Free and open-source under MIT license (#565)

* feat: free and open-source under MIT license
This commit is contained in:
Dan Ribbens
2022-05-16 19:25:20 -04:00
committed by GitHub
parent 16b7edbc97
commit 4913441017
93 changed files with 332 additions and 585 deletions

View File

@@ -1,5 +1,5 @@
<h1 align="center">Payload</h1>
<p align="center">A self-hosted, TypeScript / JavaScript headless CMS & application framework built with Express, MongoDB and React.</p>
<p align="center">A free and open-source TypeScript headless CMS & application framework built with Express, MongoDB and React.</p>
<p align="center">
<a href="https://github.com/payloadcms/payload/actions">
<img src="https://github.com/payloadcms/payload/workflows/build/badge.svg" />
@@ -21,25 +21,15 @@
<img src="https://payloadcms.com/images/og-image.jpg" alt="Payload headless CMS Admin panel built with React" />
</a>
### Quick Start
```
npx create-payload-app
```
Alternatively, it only takes about five minutes to [create an app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
### Documentation
Check out the [Payload website](https://payloadcms.com/docs/getting-started/what-is-payload) to find in-depth documentation for everything that Payload offers.
### Features
- Completely free and open-source
- [GraphQL](https://payloadcms.com/docs/graphql/overview), [REST](https://payloadcms.com/docs/rest-api/overview), and [Local](https://payloadcms.com/docs/local-api/overview) APIs
- [Easily customizable ReactJS Admin](https://payloadcms.com/docs/admin/overview)
- [Fully self-hosted](https://payloadcms.com/docs/production/deployment)
- [Extensible Authentication](https://payloadcms.com/docs/authentication/overview)
- [Local file storage & upload](https://payloadcms.com/docs/upload/overview)
- [Version History and Drafts](https://payloadcms.com/docs/versions/overview)
- [Field-based Localization](https://payloadcms.com/docs/configuration/localization)
- [Block-based Layout Builder](https://payloadcms.com/docs/fields/blocks)
- [Extensible SlateJS rich text editor](https://payloadcms.com/docs/fields/rich-text)
@@ -53,18 +43,14 @@ Check out the [Payload website](https://payloadcms.com/docs/getting-started/what
### Code-first
If you know JavaScript, you know Payload. Payload is a _code-first_ CMS, which allows us to do a lot of things right:
Payload is a CMS that has been designed for developers from the ground up to deliver them what they need to build great digital products. If you know JavaScript, you know Payload. It's a _code-first_ CMS, which allows us to do a lot of things right:
- Payload gives you everything you need, but then steps back and lets you build what you want in JavaScript or TypeScript - with no unnecessary complexity brought by GUIs. You'll understand how your CMS works, because you will have written it exactly how you want it.
- Bring your own Express server and do whatever you need on top of Payload. Payload doesn't impose anything on you or your app.
- Completely control the Admin panel by using your own React components. Swap out fields or even entire views with ease.
- Use your data however and wherever you need thanks to auto-generated, yet fully extensible REST, GraphQL and Local Node APIs.
### Free forever for personal use and small projects
Payload is 100% free for personal projects or small use cases where only one admin user is required. You can also get started without an account whatsoever while running on `localhost`.
## Installation
### Quick Start
Before beginning to work with Payload, make sure you have all of the [required software](https://payloadcms.com/docs/getting-started/installation).
@@ -74,8 +60,18 @@ From there, the easiest way to get started with Payload is to use the `create-pa
npx create-payload-app
```
Alternatively, it only takes about five minutes to [write out your own app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
Alternatively, it only takes about five minutes to [create an app from scratch](https://payloadcms.com/docs/getting-started/installation#from-scratch).
## License
### Documentation
Find the Payload license [here](https://github.com/payloadcms/payload/blob/master/license.md).
Check out the [Payload website](https://payloadcms.com/docs/getting-started/what-is-payload) to find in-depth documentation for everything that Payload offers.
### Other Resources
##### Discussions
There are lots of good conversations and resources in our [GitHub Discussions board](https://github.com/payloadcms/payload/discussions). If you're struggling with something, chances are, someone's already solved what you're up against. Searching Discussions will often provide very helpful tips and tricks.
##### Discord
Join [Payload's Discord channel](https://discord.com/invite/r6sCXqVk3v) to interact with Payload developers in realtime.

View File

@@ -1,3 +1,5 @@
export { default as Meta } from '../dist/admin/components/utilities/Meta';
export { useLocale } from '../dist/admin/components/utilities/Locale';
export { useDocumentInfo } from '../dist/admin/components/utilities/DocumentInfo';
export { useConfig } from '../dist/admin/components/utilities/Config';
export { useAuth } from '../dist/admin/components/utilities/Auth';

View File

@@ -2,10 +2,6 @@
Below you'll find a set of guidelines for how to contribute to Payload CMS.
## Payload is proprietary software
Even though you can read Payload's source code, it's technically not "open source". Payload requires an active license to be used in all production purposes. That said, we do not expect PRs from the public, but we still welcome pull requests of any kind.
## Opening issues
Before you submit an issue, please check all existing [open and closed issues](https://github.com/payloadcms/payload/issues) to see if your issue has previously been resolved or is already known. If there is already an issue logged, feel free to upvote it by adding a :thumbsup: [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). If you would like to submit a new issue, please fill out our Issue Template to the best of your ability so we can accurately understand your report.
@@ -22,7 +18,7 @@ Payload documentation can be found directly within its codebase and you can feel
## Building additional features
If you're an incredibly awesome person and want to help us make Payload even better through new features or additions, we would be thrilled to work with you. If your proposed feature is accepted by our team and is significant enough, pending our discretion, we'd be happy to hook you up with a pro-bono license.
If you're an incredibly awesome person and want to help us make Payload even better through new features or additions, we would be thrilled to work with you.
To help us work on new features, you can reach out to our Development team at [`dev@payloadcms.com`](mailto:dev@payloadcms.com). Be as complete and descriptive as possible regarding your vision and we'll go from there!
@@ -30,4 +26,3 @@ To help us work on new features, you can reach out to our Development team at [`
For all Pull Requests, you should be extremely descriptive about both your problem and proposed solution. If there are any affected open or closed issues, please leave the issue number in your PR message.
By opening a Pull Request against Payload's codebase, you automatically give the entirety of the contribution within your PR to Payload CMS, LLC and retain no personal ownership whatsoever afterward. For more information, please read the full [Payload license](https://github.com/payloadcms/payload/blob/master/license.md).

View File

@@ -1,6 +1,6 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useConfig } from '../../../../src/admin/components/utilities/Config';
// As this is the demo project, we import our dependencies from the `src` directory.
import Card from '../../../../src/admin/components/elements/Card';

View File

@@ -1,6 +1,6 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import { NavLink } from 'react-router-dom';
import { useConfig } from '../../../../src/admin/components/utilities/Config';
// As this is the demo project, we import our dependencies from the `src` directory.
import Chevron from '../../../../src/admin/components/icons/Chevron';

View File

@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../src/admin/components/utilities/Config';
// As this is the demo project, we import our dependencies from the `src` directory.
import DefaultTemplate from '../../../../../src/admin/components/templates/Default';

View File

@@ -1,13 +1,14 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
// As this is the demo project, we import our dependencies from the `src` directory.
import MinimalTemplate from '../../../../../src/admin/components/templates/Minimal';
import Button from '../../../../../src/admin/components/elements/Button';
import { useConfig } from '../../../../../src/admin/components/utilities/Config';
// In your projects, you can import as follows:
// import { MinimalTemplate } from 'payload/components/templates';
// import { Button } from 'payload/components/elements';
// import { useConfig } from 'payload/components/utilities';
import './index.scss';

View File

@@ -1,9 +1,9 @@
import { useConfig } from '@payloadcms/config-provider';
import React, { useCallback } from 'react';
import UploadInput from '../../../../../../../src/admin/components/forms/field-types/Upload/Input';
import { Props as UploadFieldType } from '../../../../../../../src/admin/components/forms/field-types/Upload/types';
import useField from '../../../../../../../src/admin/components/forms/useField';
import { SanitizedCollectionConfig } from '../../../../../../../src/collections/config/types';
import { useConfig } from '../../../../../../../src/admin/components/utilities/Config';
const Text: React.FC<UploadFieldType> = (props) => {
const {

View File

@@ -69,7 +69,3 @@ This is totally possible. For the above scenario, by specifying `admin: { user:
### Restricting user access
If you would like to restrict which users from a single Collection can access the Admin panel, you can use the `admin` access control function. [Click here](/docs/access-control/overview#admin) to learn more.
## License enforcement
Payload requires a valid license key to be used on production domains. You can use it as much as you'd like locally and on staging / UAT domains, but when you deploy to production, you'll need a license key to activate Payload's Admin panel. For more information, [click here](/docs/production/licensing).

View File

@@ -20,7 +20,6 @@ Example response:
```js
{
canAccessAdmin: true,
license: 'LICENSE_KEY_HERE',
collections: {
pages: {
create: {

View File

@@ -110,10 +110,6 @@ In contrast to running Mongo locally, a popular option is to sign up for a free
Customize Mongo connection options. Payload will connect to your MongoDB database using default options which you can override and extend to include all the [options](https://mongoosejs.com/docs/connections.html#options) available to mongoose.
##### `license`
Your Payload license key. Not needed for development purposes, but when it's time to deploy to production, you need to add your license key here. More info about how Payload licensing works can be found [here](/docs/production/licensing).
##### `email`
An object used to configure SMTP. [Read more](/docs/email/overview).

View File

@@ -1,84 +0,0 @@
---
title: The Payload License
label: Licensing
order: 30
desc: Payload is free to use locally for development purposes. You can purchase a license when you are ready to deploy, or to receive support from Payload developers.
keywords: licensing, production, fields, config, configuration, documentation, Content Management System, cms, headless, javascript, node, react, express
---
## Try it for free
Payload is free to use locally for development purposes for as long as you like. There is no obligation to sign up for either a free or paid account until it's time to deploy to production or you'd like to receive support from Payload developers. At that time, you can sign up for a license and manage your licenses from your [Payload account](/account). For information on plans and available packages, see the [pricing](/pricing) page.
## Signing up for a license
Payload offers three license options that are meant to give you the flexibility you need for your project:
##### Personal
Completely free forever. Only one email address can be used to access the admin panel, but all other features that Payload offers are available. You still need to [sign up for a license key](/checkout) to be given a Personal license, but no credit card is required!
##### Team
Economically priced for small teams of five admin users or less. The Team package also includes automatic support for as many staging or UAT-style domains that you need.
##### Pro
Unlimited admin users, staging domain support, and dev-to-dev support directly with the Payload team. With this package, you can use the Payload Admin panel for customer-facing account management and much more.
**To sign up for a license,**
1. Complete the [checkout](/checkout) process. Choose your plan and billing period, if applicable, and you'll be provided with a license key after successfully checking out.
1. Within your project, add your license to a `.env` variable, and then add the `license` property to your `payload.init()` call.
`server.js`:
```js
const payload = require('payload');
payload.init({
license: process.env.PAYLOAD_LICENSE_KEY,
// the rest of your init options
});
```
3. All set! You can open the Admin panel of your Payload application on a public domain and your copy of Payload will be fully licensed.
## How Payload license enforcement works
Payload licensing is enforced only through its Admin panel. Each time the Admin panel is loaded, a request is made to our licensing server that evaluates the domain that the panel was loaded from. We then verify that you have a valid, active license key and that the domain being used matches the license accordingly.
<Banner type="success">
<strong>Note:</strong><br/>
Your Payload APIs will always be available, regardless of subscription status. This means you can have peace of mind that your critical operations relying on your API will not going to be hindered because of a lapse in billing issue or a network problem between systems. Only the Admin panel will be affected.
</Banner>
### How to choose the domain for your license
Payload licenses are specific to **one** domain, but you can use your Payload API from an unlimited amount of sources. However, you can *only access your Payload Admin panel from one domain*. This means that when you are selecting the domain you'd like to tie to your Payload license, you should choose the domain that you'd like to use to access your admin panel in production.
**Examples:**
- If you'd like to access your admin panel from a subdomain like `api.yourdomainhere.com/admin`, you would use `api.yourdomain.com` for your license.
- If you'd like to access via a root-level domain like `coolsitehere.com/admin`, you would use `coolsitehere.com` for your license.
<Banner type="success">
<strong>Note:</strong><br/>
Even though your Payload license is tied to one domain, you can use your Admin panel for dev purposes however and wherever you'd like.
</Banner>
#### Within the Team and Pro plans, how does Payload know if the license is being used for staging or production purposes?
Our licensing service checks for any of the following criteria to determine if your domain is regarded as `production` or `development`:
1. If your Admin panel was loaded from an `ip`
1. If it includes a port other than `80` or `443`. For example: `dev.example.com:8000`
1. If your domain includes any of these keywords: `test`, `testing`, `dev`, `stage`, `staging`, `sandbox`, `acc`, `acceptance`, `demo`, `local`, `loc`
### FAQ
1. **Why am I paying for open-source software?** Payload is not open source. You can view the code, but that doesn't mean it is free. A subscription license is required for production use you're not permitted to take parts of Payload for your own purposes. Those details aside, we are like an open-source software in that we encourage our community to participate as they see fit by exploring the code, reporting any issues to our [issue tracker](https://github.com/payloadcms/payload/issues) and you can even go as far as opening pull request if you wish.
1. **Do you have educational or non-profit pricing available?** It would make us very happy to support your organization through the use of Payload. Please [contact](/contact) us to get started. We will ask to see verification of your organization's status.
1. **Can I transfer a license?** You can change the domain name of a license in your Payload account by clicking on the license domain name, finding the "Change domain" link and following the instructions. If you need to transfer ownership to another user or organization, you can [contact us](mailto:info@payloadcms.com) for help.
### Read the full license
You can read the entirety of the Payload license directly in the distributed NPM package or in the Payload source code at [github.com](https://github.com/payloadcms/payload/blob/master/license.md)

View File

@@ -1,238 +1,22 @@
**Payload License Agreement**
v.202102281830
Updated: February 28, 2021
Payload is a modern, extensible CMS built with application developers in mind. Payload is free to download and install—and free to use for Personal Purposes. We are passionate about Payload, and we hope that you will enjoy it, too. A valid license is required to utilize Payload as detailed below in Section 5(b).
To ensure a mutual and full understanding of your and our respective rights and responsibilities, please read this entire Payload License Agreement (this "Agreement"). This Agreement is between you and Payload LLC, a registered Michigan limited liability company ("we" or "us"). You and we are sometimes referred to collectively as the "Parties" or individually as a "Party" to simply drafting when our rights and responsibilities are the same. This Agreement is effective as of the date and time you first download, copy, install, access, or otherwise make use of Payload (the "Effective Date"); by doing so, you agree to be bound by the terms and conditions of this Agreement.
1. **Definitions**
"API" means application programming interface.
"Affiliate" means, in reference to a Person, any other Person that directly, or indirectly through one or more intermediaries, controls, is controlled by, or is under common control with, such Person. The term "control" (including the terms "controlled by" and "under common control with") means the power to direct or cause the direction of the management and policies of a Person, whether by voting interest, contract, or otherwise.
"CMS" means content-management system.
"Contribution" means any work of authorship, including the original version of the work, any modifications or additions thereto, and any derivative works thereof, that you submit to us for inclusion into Payload. For purposes of this definition, the word "submit" means to communicate in any form (electronically, verbally, in writing, or otherwise) to us or our representatives, including by, on, or using electronic mailing lists, source-code control systems, or issue-tracking systems that are managed by us, or on our behalf, for the purpose of discussing and improving Payload. For purposes of this definition, the term "work of authorship" includes Software and Documentation.
"Documentation" means instruction, explanation, or guidance describing or relating to Software, whether in human- or machine-readable form, including: guidance relating to the operation, installation, administration, or use of Software; technical requirements or specifications; file or record layouts or fields; schematics; flow charts; algorithms; architectural diagrams; data models; build instructions; compilation instructions; testing or configuration instructions; developer annotations; information regarding the design or configuration of hardware, operating environment, or network infrastructure; and all other similar types of information relating to the creation, design, development, installation, implementation, execution, structure, function, performance, correction, modification, improvement, or use of Software or its operating environment.
"Entity" means a corporation, partnership, joint venture, limited-liability company, governmental authority or agency, unincorporated organization, trust, or other legally-recognized association of two or more individuals and/or Entities.
"Go-Live Date" means, in relation to a Production Instance, the date on which the instance, or any portion thereof, is first executed.
"Intellectual Property Rights" means all rights in and to US or foreign (a) copyrights or works of authorship (whether copyrightable or not), including computer programs and rights in and to data and databases, (b) trademarks, service marks, trade dress, trade names, logos, corporate names, or domain names, or other similar designations of source or origin, together with the goodwill symbolized by any of the foregoing, (c) patents, patent disclosures, or inventions (whether patentable or not), (d) trade secrets, know-how, or other confidential information, and (e) all other intellectual property rights, in each case whether registered or unregistered, and including all registrations and applications for, and renewals or extensions of, such rights, and all similar or equivalent rights or forms of protection in any part of the world.
"Law" means any statute, law, ordinance, regulation, rule, code, order, constitution, treaty, common law, judgment, decree, or other requirement of any federal, state, local, or foreign government or political subdivision thereof, or any court, arbitrator, or tribunal of competent jurisdiction.
"Losses" means all losses, damages, deficiencies, claims, actions, judgments, settlements, interest, awards, penalties, fines, costs, or expenses of whatever kind, including reasonable attorneys' fees and the costs of enforcing any right to indemnification hereunder and the cost of pursuing any insurance providers.
"Marketplace" means the official online repository within the Payload website containing all Official Extension(s) to be made available for use in conjunction with Payload.
"Official Extension" means any Software that has been licensed and made available through the Payload Marketplace to be used in conjunction with Payload.
"Open-Source Component" means Software distributed by a third party under an open-source license, for example, Apache-2.0, BSD-2-Clause, BSD-3-Clause, CCO 1.0, ISC, LGPL-3.0, or MIT, copies of which can be found at [https://opensource.org/licenses](https://opensource.org/licenses).
"Organization" means any association of Persons, for example, a for-profit or non-profit business entity, a government entity, and educational institution, or a informal association of any kind.
"Payload" means all Software, Documentation, files, information, resources, and other materials available at any time on or by way of the Website, the Repository, or the Registry or otherwise distributed by Payload LLC, as well as all copies thereof (whether partial or complete, and whether or not merged into other materials) and all Intellectual Property Rights in each of the foregoing, but excluding Open-Source Components.
"Person" means an individual or an Entity.
"Personnel" means, with respect to a Person, such Person's employees, contractors, agents, attorneys, advisors, and representatives. If such Person is an Entity, Personnel includes such Entity's owners, directors, and officers.
"Personal Purpose" means a purpose that is for a sole individual, not as part of an Entity.
"Production Instance" means an instance of Payload that performs a Production Purpose, whether one-time, repeated, continuous, intermittent, periodic, or irregular.
"Production Purpose" means a purpose other than a Personal Purpose (for example, operating your Organization or delivering products or services within or outside of your Organization).
"Registry" means NPM repository located at https://www.npmjs.com/package/payload.
"Repository" means the GitHub repository located at https://github.com/payloadcms/payload.
"Software" means source code, object code, API's, and all works incorporated into each of the foregoing.
"Territory" means all countries not subject to U.S. export restrictions.
"Third-Party Materials" means items not owned by us, which may include Software (such as open-source software or third-party add-ons or extensions), content, data, information, or other materials.
"Update" means any change, patch, fix, upgrade, adaptation, alteration, translation, correction, revision, supplement, enhancement, improvement, or other modification of Payload that we may, in our sole discretion, release from time to time. An Update may consist, among other things, of modifications to Payloads features, functionality, or interfaces.
"Website" means [https://payloadcms.com](https://payloadcms.com).
2. **License**. Provided that you remain at all times in compliance with the terms and conditions of this Agreement, we hereby grant to you a limited, non-exclusive, non-sublicensable, non-transferable license to use Payload within the Territory for any purpose not prohibited by this Agreement or applicable Law (the "License"). All rights not expressly granted herein are reserved. You acknowledge that the License is adequate consideration for all your responsibilities, representations, and warranties hereunder.
3. **Your Rights**. During the Term (as defined in Section 13(a)), and provided that you remain at all times in compliance with the terms and conditions of this Agreement, you may: (a) download and copy Payload, in whole or in part; (b) install and use one or more instances of Payload as a CMS for your applications or websites; and (c) modify, adapt, enhance, or improve Payload for your own use (but not for distribution, sale, or sublicensing in any form); and (d) develop and share extensions to Payload by way of the Repository, the Registry, and/or the Website subject to our prior written approval in each case.
4. **Your Responsibilities**
a. **Restrictions**. You will not (and will not assist any other Person to):
&nbsp;&nbsp;&nbsp;&nbsp; i. sell, license, rent, lease, lend, publish, transfer, convey, or otherwise distribute Payload to any third party;
&nbsp;&nbsp;&nbsp;&nbsp; ii. bypass, block, or disable Payload licensing-verification mechanisms;
&nbsp;&nbsp;&nbsp;&nbsp; iii. remove, alter, or obscure any trademarks, copyright notices, or other proprietary-rights notices or symbols;
&nbsp;&nbsp;&nbsp;&nbsp; iv. infringe or misuse Payload, including by using Payload without a license or in violation of Payload License terms;
&nbsp;&nbsp;&nbsp;&nbsp; v. dispute our ownership of Payload or any Intellectual Property Right therein; or
&nbsp;&nbsp;&nbsp;&nbsp; vi. use Payload for:
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; A. any illegal purpose;
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; B. the design, construction, operation, or maintenance of any system or application where error or failure could cause personal injury, death, or property damage;
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; C. developing or providing a competing product or service; or
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; D. any purpose that is to our detriment or commercial disadvantage.
b. **Requirements**. You will:
&nbsp;&nbsp;&nbsp;&nbsp; i. comply with all applicable Laws;
&nbsp;&nbsp;&nbsp;&nbsp; ii. promptly notify us if you become aware of any actual or suspected infringement or misuse of Payload or any claim that Payload infringes the rights of any Person;
&nbsp;&nbsp;&nbsp;&nbsp; iii. cooperate with and assist us in all reasonable ways to stop or prevent any actual or threatened infringement or misuse of Payload;
&nbsp;&nbsp;&nbsp;&nbsp; iv. retain (and not alter or obscure) this Agreement and all trademarks, copyright notices, and other notices of Intellectual Property Rights in connection with Payload; and
&nbsp;&nbsp;&nbsp;&nbsp; v. for any Production Instance that you control or operate directly or indirectly, including by way of a contractor or intermediary:
&nbsp;&nbsp;&nbsp;&nbsp; A. notify us of the domain name utilized by Payload and the name and email of the individual(s) responsible for administering the instance and the server;
&nbsp;&nbsp;&nbsp;&nbsp; B. promptly update us of any changes to the information in Section 4(b)(v)(A); and
&nbsp;&nbsp;&nbsp;&nbsp; C. pay the fee set forth in Section 5(b).
5. **Fees**
a. **Personal Instances**. No fee. Payload is free of charge for Personal Purposes.
b. **Production Instances**. The subscription fee, as paid at time of purchase or license renewal, (the "Subscription") for each domain operating a Production Instance, is due at the time of Licence purchase until your subscription expires. All fees are exclusive of taxes. You are responsible for any taxes, duties, or other charges imposed by any governmental authority on amounts paid by you pursuant hereto (except for any taxes imposed on our income). Payment must be made in U.S. dollars by Credit Card. Interest will accrue on any past-due amount at the rate of 1.8% per month, compounded monthly, or the highest rate permitted by applicable Law, whichever is less. You will reimburse us immediately for all costs we incur in relation to any overdue amount, including attorney fees and collection-agency fees, whether or not a formal complaint is filed, and no notice of default is required. In the event that any amount becomes overdue, we may, in our sole discretion, and in addition to any other remedy available at law, in equity, or hereunder: (i) suspend or revoke your License, (ii) withhold new licenses, or (iii) terminate this Agreement. You will pay all amounts due hereunder in full, without any setoff, deduction, or withholding for any reason, except as may be permitted by applicable Law. No refunds will be granted or paid.
6. **Support**
a. **Basic Support**. If you have a Production Instance for which the Subscription has been paid (a "Paid-Up Instance") and are otherwise in compliance with all terms and conditions hereof, we will perform the following support services for your Paid-Up Instance (“Basic Support”):
&nbsp;&nbsp;&nbsp;&nbsp; 12. Email support
&nbsp;&nbsp;&nbsp;&nbsp; 13. While we attempt to handle all requests promptly, response time is not guaranteed.
b. **Enhanced Support**. You may, at your option, purchase enhanced support subject to a separate Support Agreement. Upon making such purchase, you will be entitled to additional services and benefits ("Enhanced Support"). See our Website for details.
c. **Alternatives**. If you do not have a Paid-Up Instance and you have not purchased Enhanced Support, you can still seek information and assistance by way of the following freely-available community resources, which, while not guaranteed to resolve your question or issue, may be helpful:
&nbsp;&nbsp;&nbsp;&nbsp; i. Documentation, Issues and discussions sections of the Payload Repository, or other online community resources
7. **Open-Source Components**. Payload makes use of certain Open-Source Components distributed under the following licences: Apache-2.0, BSD-2-Clause, BSD-3-Clause, CCO 1.0, ISC, LGPL-3.0, and MIT, or other licensing that does not restrict commercial use. Your use of Open-Source Components, including those on which Payload relies, is subject to the terms and conditions of the applicable open-source licenses. A copy of each license can be found at [https://opensource.org/licenses](https://opensource.org/licenses).
8. **Intellectual Property**
a. **Ownership**. Payload LLC is the sole and exclusive owner of all right, title, and interest in and to Payload, all Updates thereto, all Official Extensions based thereon, and all Intellectual Property Rights in each of the foregoing, subject only to the rights of third parties in Open-Source Components and the License granted hereunder. You acknowledge that you have no ownership interest in Payload and that, except for the License granted hereunder, nothing herein or elsewhere grants to you or any third party (by implication, waiver, estoppel or otherwise) any right, title, or interest (including any Intellectual Property Right) in or to Payload or any portion thereof.
b. **Contributions**. If you make a Contribution to Payload, you hereby automatically, immediately, unconditionally, and irrevocably assign the entirety of such Contribution to Payload LLC for no additional consideration beyond the License granted hereunder. Similarly, in the event that you acquire (by any means) or have (at any time) any right, title, or interest (including any Intellectual Property Right) in or to Payload beyond the License granted hereunder, you hereby automatically, immediately, unconditionally, and irrevocably assign the entirety of such right, title, and interest to Payload LLC for no additional consideration beyond the License granted hereunder. In the event of any assignment by you to us under this Section 8(b), you hereby irrevocably waive, to the extent permitted by applicable law, any and all claims you may now or hereafter have in any jurisdiction to all rights of paternity, integrity, disclosure, and withdrawal and any other rights (which may be known as "moral rights") with respect to the subject matter of such assignment. For further information regarding how to contribute, please visit the Payload Repository.
9. **Your Representations and Warranties**. You represent and warrant as follows:
a. You have full right, power, and authority to enter into and perform your obligations under this Agreement.
b. If you are an organization,
&nbsp;&nbsp;&nbsp;&nbsp; i. the organization is duly organized, validly existing, and in good standing as a corporation or other entity under the Laws of the jurisdiction of its incorporation or organization; and
&nbsp;&nbsp;&nbsp;&nbsp; ii. your acceptance of this Agreement has been duly authorized by all necessary corporate or organizational action.
c. This Agreement is a legal, valid, and binding obligation of each Party, enforceable against each Party in accordance with its terms.
10. **DISCLAIMER OF WARRANTIES**. PAYLOAD IS PROVIDED "AS IS." YOU ASSUME ALL RISK ASSOCIATED WITH YOUR INSTALLATION AND USE OF PAYLOAD. WE SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, AND ALL WARRANTIES ARISING FROM USAGE, TRADE PRACTICE, OR COURSE OF DEALING. WITHOUT LIMITING THE FOREGOING, WE MAKE NO WARRANTY OF ANY KIND THAT PAYLOAD WILL MEET YOUR ANY OTHER PERSON'S REQUIREMENTS OR STANDARDS, OPERATE WITHOUT INTERRUPTION, ACHIEVE ANY INTENDED RESULT, BE COMPATIBLE WITH ANY OTHER SOFTWARE, SYSTEMS, OR SERVICES, OR BE ACCURATE, COMPLETE, SECURE, SAFE, FREE OF HARMFUL CODE, OR ERROR FREE. SIMILARLY, ANY USE OF THIRD-PARTY MATERIALS, INCLUDING ANY DISTRIBUTED ALONG WITH PAYLOAD, IS AT YOUR OWN RISK. ALL THIRD-PARTY MATERIALS ARE PROVIDED "AS IS" AND ANY REPRESENTATION OR WARRANTY CONCERNING ANY OF THEM IS STRICTLY BETWEEN YOU AND THE THIRD-PARTY OWNER OR DISTRIBUTOR OF SUCH MATERIALS.
11. **Limitations of Liability**
a. **EXCLUSION OF DAMAGES**. IN NO EVENT WILL WE OR OUR PERSONNEL BE LIABLE UNDER OR IN CONNECTION WITH THIS AGREEMENT OR ITS SUBJECT MATTER (INCLUDING PAYLOAD, ANY SERVICES WE PROVIDE IN CONNECTION WITH PAYLOAD, AND ANY THIRD-PARTY MATERIALS DISTRIBUTED ALONG WITH PAYLOAD) UNDER ANY LEGAL OR EQUITABLE THEORY (WHETHER IN CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY, OR OTHERWISE) FOR ANY (i) INCREASED COSTS, DIMINUTION IN VALUE, OR LOSS OF BUSINESS, PRODUCTION, REVENUES, OR PROFITS; (ii) LOSS OF GOODWILL OR REPUTATION; (iii) INABILITY TO USE, OR INTERRUPTION OR DELAY IN USING, ANY SOFTWARE OR MATERIALS; (iv) LOSS, DAMAGE, OR CORRUPTION OF DATA; (v) BREACH OF DATA OR SYSTEM SECURITY; (vi) COST OF REPLACEMENT GOODS OR SERVICES; OR (vii) CONSEQUENTIAL, INCIDENTAL, DIRECT, INDIRECT, EXEMPLARY, SPECIAL, ENHANCED, OR PUNITIVE DAMAGES, IN EACH CASE REGARDLESS OF WHETHER WE OR OUR PERSONNEL WERE ADVISED OF THE POSSIBILITY OF SUCH LOSSES OR DAMAGES OR SUCH LOSSES OR DAMAGES WERE OTHERWISE FORESEEABLE, AND NOTWITHSTANDING THE FAILURE OF ANY REMEDY OF ITS ESSENTIAL PURPOSE.
b. **CAP ON LIABILITY**. IN NO EVENT WILL OUR TOTAL, AGGREGATE LIABILITY, TOGETHER WITH THAT OUR PERSONNEL, ARISING OUT OF OR RELATED TO THIS AGREEMENT UNDER ANY LEGAL OR EQUITABLE THEORY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY, OR OTHERWISE, EXCEED THE TOTAL AMOUNTS PAID TO US UNDER THIS AGREEMENT IN THE ONE (1) YEAR PERIOD PRECEDING THE EVENT GIVING RISE TO THE CLAIM. THE FOREGOING LIMITATIONS APPLY EVEN IF ANY REMEDY FAILS OF ITS ESSENTIAL PURPOSE.
12. **Indemnification**. You will indemnify, defend, and hold harmless us and our Affiliates, and each of our and their respective Personnel, from and against any and all Losses incurred as a result of your actions or omissions, including: (a) any infringement resulting from your modification of Payload or your combination of Payload with other systems or materials not provided by us; and (b) any breach by you of any representation, warranty, obligation, or restriction under this Agreement.
13. **Term and Termination**
a. **Term**. This Agreement takes effect as of the Effective Date and continues in effect until terminated as set forth below in Section 13(b) (the "Term").
b. **Termination**. This Agreement may be terminated:
&nbsp;&nbsp;&nbsp;&nbsp; i. by us, at any time, effective on written notice to you, if we, in our sole discretion, believe that you have breached this Agreement;
&nbsp;&nbsp;&nbsp;&nbsp; ii. by you, at any time, effective immediately, when you cease to use Payload and permanently delete all copies;
&nbsp;&nbsp;&nbsp;&nbsp; iii. automatically, effective immediately and without notice, if you are a company, corporation, or other legal entity and you (A) are dissolved or liquidated or take any corporate action for such purpose; (B) become insolvent or are generally unable to pay your debts as they become due; (C) become the subject of any voluntary or involuntary bankruptcy proceeding under any domestic or foreign bankruptcy or insolvency Law; (D) make or seek to make a general assignment for the benefit of creditors; or (E) apply for, or consent to, the appointment of a trustee, receiver or custodian for a substantial part of your property.
c. **Effect of Termination**. Upon termination of this Agreement:
&nbsp;&nbsp;&nbsp;&nbsp; i. all rights and licenses granted to you hereunder immediately terminate;
&nbsp;&nbsp;&nbsp;&nbsp; ii. any amounts payable by you to us are due immediately;
&nbsp;&nbsp;&nbsp;&nbsp; iii. you will immediately cease all use of Payload;
&nbsp;&nbsp;&nbsp;&nbsp; iv. as soon as possible, but in any event not more than seven (7) days after termination, you will permanently erase Payload and all copies thereof (whether whole or partial, and whether or not merged into other materials or works) from all devices and systems that you control, directly or indirectly; and
&nbsp;&nbsp;&nbsp;&nbsp; v. if we so request, you will certify to us in writing that you have complied with the requirements of Section 13(c)(iii) and 13(c)(iv).
14. **Data Collection and Sharing**
a. **Personal Information**. When you download Payload, we may offer you the opportunity to provide us information about you, including contact information (collectively, "Personal Information"). If you choose to provide Personal Information, you hereby grant us the right to
&nbsp;&nbsp;&nbsp;&nbsp; i. collect, process, and store your Personal Information;
&nbsp;&nbsp;&nbsp;&nbsp; ii. use your Personal Information to communicate with you about Payload, including about Updates or important product announcements; and
&nbsp;&nbsp;&nbsp;&nbsp; iii. share your Personal Information with our Personnel and third parties who, in our sole discretion, have a need to know in order to perform our obligations or exercise our rights hereunder.
b. **System Parameters and Usage Metrics**. Payload contains features to help us verify licensing and to improve our products and services. You hereby grant us the right to
&nbsp;&nbsp;&nbsp;&nbsp; i. program Payload to collect and send us information about (i) the system on which Payload is installed ("System Information") and (ii) your usage of Payload (“Usage Metrics”);
&nbsp;&nbsp;&nbsp;&nbsp; ii. collect, process, and store System Information and Usage Metrics;
&nbsp;&nbsp;&nbsp;&nbsp; iii. use System Information and Usage Metrics for any purpose in connection with the monitoring, maintenance, development, and licensing of Payload, including the development and marketing of Updates; and
&nbsp;&nbsp;&nbsp;&nbsp; iv. share System Information and Usage Metrics with our Personnel and third parties who, in our sole discretion, have a need to know in order to perform our obligations or exercise our rights hereunder.
c. **Feedback**. We welcome comments, ideas, suggestions, recommendations, and other feedback (collectively, "Feedback"). You acknowledge that we are and will be the sole and exclusive owner of Feedback and that we may freely incorporate Feedback into Payload and use it as a basis for Updates. Upon providing Feedback by any means, directly or indirectly, you hereby automatically, immediately, unconditionally, and irrevocably assign to us all right, title, and interest in such Feedback for no additional consideration beyond the License granted hereunder.
15. **Audit**. We or our designee may, with reasonable forenotice, inspect and audit your use of Payload during the Term and for three (3) years thereafter. You will make available such records, information, equipment, and Personnel, and provide such cooperation and assistance, as may be requested in connection with such audit. If we determine that you have failed at any time to comply with this Agreement, you will immediately pay to us all amounts due based on your use of Payload for any Production Purpose, plus interest, as set forth in Section 5(b), and reimburse us for all costs incurred in conducting the inspection and audit.
16. **Miscellaneous**
a. **Relationship of the Parties**. The relationship of the Parties is that of independent contractors. Nothing herein will be construed as creating any agency, partnership, joint venture, or other form of joint enterprise, employment, or fiduciary relationship between the Parties. Neither Party will have authority to contract for or bind the other Party in any manner whatsoever.
b. **Entire Agreement**. This Agreement is the sole and entire agreement of the Parties with respect to the subject matter of this Agreement and supersedes all prior and contemporaneous understandings, agreements, representations, and warranties, both written and oral, with respect to such subject matter. In the event that applicable Law in a jurisdiction limits or prohibits any provision hereof, then such provision will be deemed limited or deleted, but only to the minimum extent required to render this Agreement valid and enforceable, and such limitation or deletion will be effective only in such jurisdiction.
c. **Interpretation**. For purposes of this Agreement: The words "include," "includes," and "including" are deemed to be followed by the words "without limitation"; the word "or" is not exclusive; the words "herein," "hereof," "hereby," "hereto" and "hereunder" refer to this Agreement as a whole; words denoting the singular have a comparable meaning when used in the plural and vice versa; words denoting any gender include all genders; and the word "any" implies "all" and vice versa so as to achieve the broadest interpretation. Unless the context otherwise requires, references to: a "Section" means a section of this Agreement; this “Agreement” means this Agreement as amended, supplemented and modified from time to time in accordance herewith; and to a “Law” means such Law as amended from time to time and includes any successor Law thereto and any regulations promulgated thereunder. Titles and headings are for reference only and do not affect the interpretation of this Agreement. The Parties intend that this Agreement be construed without regard to any presumption or rule requiring construction or interpretation against the drafter.
d. **Modification and Waiver**. We reserve the right to modify this Agreement at any time in our sole discretion. We will notify you of any changes by posting an updated Agreement on our Website. You acknowledge that such notification is adequate. The updated Agreement is effective when we post it on our Website. No other purported amendment to or modification of this Agreement is effective unless expressly set forth in writing and signed by us. No waiver of any provision hereof is effective unless expressly set forth in writing and signed by the Party so waiving. Except as otherwise set forth herein, no failure to exercise, or delay in exercising, any right, remedy, power, or privilege arising from this Agreement will operate or be construed as a waiver thereof; nor will any single or partial exercise of any right, remedy, power, or privilege hereunder preclude any other or further exercise thereof or the exercise of any other right, remedy, power, or privilege.
e. **Survival**. The following Sections of this Agreement (and any other provision hereof that should, by its nature, survive termination) will survive any termination hereof: Sections 4, 5(b), 8, 9, 10, 11, 12, 13(c), 14, 15, 16(e-g), and 16(i-m).
f. **Severability**. If any provision hereof is held to be invalid, illegal, or unenforceable in any jurisdiction, such invalidity, illegality, or unenforceability will not affect any other term or provision hereof or invalidate or render unenforceable such term or provision in any other jurisdiction. In the event of such holding, the Parties will negotiate in good faith to modify this Agreement so as to effect their original intent as closely as possible in a mutually-acceptable manner in order that the transactions contemplated herein be consummated as originally contemplated to the greatest extent possible.
g. **Further Assurances**. Upon request, you will execute and deliver all such documents and instruments, and take all such further actions, as may be necessary to give full effect to this Agreement.
h. **No Third-Party Beneficiaries**. This Agreement is for the sole benefit of the Parties and their respective successors and permitted assigns. Nothing herein, express or implied, is intended to, or will, confer on any other Person any legal or equitable right, benefit, or remedy of any nature whatsoever under or by reason of this Agreement.
i. **Assignment and Delegation**. You may not assign or otherwise transfer any of your rights hereunder, and you may not delegate or otherwise transfer any of your obligations hereunder. Any purported assignment, delegation, or transfer in violation of this Section 16(i) is void. This Agreement is binding on and inures to the benefit of the Parties hereto and their respective successors and permitted assigns.
j. **Governing Law and Dispute Resolution**. This Agreement is governed by and construed in accordance with the internal laws of the State of Michigan without giving effect to any choice- or conflict-of-law provision or rule that would require or permit the application of the laws of any jurisdiction other than those of the State of Michigan. Any legal suit, action, or other proceeding (each, an "Proceeding") arising out of or related to this Agreement or the License granted hereunder will be instituted exclusively in the federal or state courts located in the County of Kent, Michigan, and each Party hereby irrevocably submits to the exclusive jurisdiction of such courts in any such Proceeding. Service of process, summons, notice, or other document to the address that you provided upon registration, or as subsequently updated by you, will be effective service of process for any Proceeding brought in any such court. The prevailing Party in any Proceeding arising out of or related to this Agreement is entitled to recover its attorney fees and court costs from the non-prevailing Party. All claims will be pursued on an individual basis. You hereby waive your right to commence, become a party to, or remain a participant in any group, representative, class, collective, or hybrid class/collective Proceeding in any court or other dispute-resolution forum.
k. **Equitable Relief**. You acknowledge that a breach or threatened breach of any of your obligations hereunder would cause us irreparable harm for which monetary damages would not be an adequate remedy and that, in the event of such breach or threatened breach, we will be entitled to equitable relief, including a restraining order, an injunction, specific performance, and any other relief that may be available from a court of competent jurisdiction, without any requirement to post a bond or other security or to prove actual damages or that monetary damages are not an adequate remedy. Such remedies are not exclusive and are in addition to all other remedies available at law, in equity, or otherwise.
l. **Publicity**. Each Party hereby consents to the use of its trademarks, service marks, trade names, and logos (collectively "Marks"), if any, in the other Partys promotional messaging and materials, including websites, provided that such use is not likely to cause confusion, cause mistake, or deceive as to (i) the nature of the Parties' relationship, (ii) the origin of a Partys goods, or (iii) the sponsorship or approval of a Party's goods, services, or commercial activities by the other Party.
m. **Notices**. Any notice or other communication to you in relation to this Agreement is effective if in writing and sent to you at the address you provided upon registration or as subsequently updated by you. You hereby consent to receiving notices and other communication from us at such address. If you do not register or provide contact information, then you acknowledge that any notice or other communication that we publish on the Website is effective notice to you 24 hours after such publication.
(The MIT License)
Copyright (c) 2018-2022 Payload CMS, LLC <info@payloadcms.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -92,7 +92,6 @@
"@faceless-ui/modal": "^1.1.7",
"@faceless-ui/scroll-info": "^1.2.3",
"@faceless-ui/window-info": "^2.0.2",
"@payloadcms/config-provider": "^1.0.1",
"babel-jest": "^26.3.0",
"babel-loader": "^8.1.0",
"body-parser": "^1.19.0",
@@ -127,6 +126,7 @@
"joi": "^17.3.0",
"json-schema-to-typescript": "^10.1.5",
"jsonwebtoken": "^8.5.1",
"jwt-decode": "^3.1.2",
"method-override": "^3.0.0",
"micro-memoize": "^4.0.9",
"mime": "^2.5.0",

View File

@@ -2,13 +2,13 @@ import React, { Suspense, lazy, useState, useEffect } from 'react';
import {
Route, Switch, withRouter, Redirect,
} from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useAuth } from './utilities/Auth';
import { useConfig } from './utilities/Config';
import List from './views/collections/List';
import DefaultTemplate from './templates/Default';
import { requests } from '../api';
import Loading from './elements/Loading';
import StayLoggedIn from './modals/StayLoggedIn';
import Unlicensed from './views/Unlicensed';
import Versions from './views/Versions';
import Version from './views/Version';
import { DocumentInfoProvider } from './utilities/DocumentInfo';
@@ -24,7 +24,6 @@ const Edit = lazy(() => import('./views/collections/Edit'));
const EditGlobal = lazy(() => import('./views/Global'));
const ResetPassword = lazy(() => import('./views/ResetPassword'));
const Unauthorized = lazy(() => import('./views/Unauthorized'));
const UnauthorizedUser = lazy(() => import('./views/UnauthorizedUser'));
const Account = lazy(() => import('./views/Account'));
const Routes = () => {
@@ -108,12 +107,6 @@ const Routes = () => {
<Route path={`${match.url}/reset/:token`}>
<ResetPassword />
</Route>
<Route path={`${match.url}/unlicensed-domain`}>
<Unlicensed />
</Route>
<Route path={`${match.url}/unauthorized-user`}>
<UnauthorizedUser />
</Route>
{collections.map((collection) => {
if (collection?.auth?.verify) {

View File

@@ -1,8 +1,8 @@
import { useConfig } from '@payloadcms/config-provider';
import { formatDistance } from 'date-fns';
import { useHistory } from 'react-router-dom';
import { toast } from 'react-toastify';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useConfig } from '../../utilities/Config';
import { useWatchForm, useFormModified } from '../../forms/Form/context';
import { useLocale } from '../../utilities/Locale';
import { Props } from './types';

View File

@@ -2,7 +2,7 @@ import React, { useState, useCallback } from 'react';
import { toast } from 'react-toastify';
import { useHistory } from 'react-router-dom';
import { Modal, useModal } from '@faceless-ui/modal';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Button from '../Button';
import MinimalTemplate from '../../templates/Minimal';
import { useForm } from '../../forms/Form/context';

View File

@@ -1,6 +1,6 @@
import React, { useCallback } from 'react';
import { useHistory } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { Props } from './types';
import Button from '../Button';
import { useForm } from '../../forms/Form/context';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../utilities/Config';
import CopyToClipboard from '../../CopyToClipboard';
import formatFilesize from '../../../../../uploads/formatFilesize';
import { Props } from './types';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import qs from 'qs';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useLocale } from '../../utilities/Locale';
import { useSearchParams } from '../../utilities/SearchParams';
import Popup from '../Popup';

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { NavLink, Link, useHistory } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
import Chevron from '../../icons/Chevron';
import LogOut from '../../icons/LogOut';

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../utilities/Auth';
import Button from '../Button';
import { Props } from './types';
import { useLocale } from '../../utilities/Locale';

View File

@@ -1,5 +1,5 @@
import React, { useCallback } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import FormSubmit from '../../forms/Submit';
import { useForm, useFormModified } from '../../forms/Form/context';
import { useDocumentInfo } from '../../utilities/DocumentInfo';

View File

@@ -1,7 +1,7 @@
import React, { useCallback, useState } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { toast } from 'react-toastify';
import { Modal, useModal } from '@faceless-ui/modal';
import { useConfig } from '../../utilities/Config';
import { Props } from './types';
import { useDocumentInfo } from '../../utilities/DocumentInfo';
import Button from '../Button';

View File

@@ -1,5 +1,5 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import { useConfig } from '../../utilities/Config';
import Button from '../Button';
import { Props } from './types';
import { useDocumentInfo } from '../../utilities/DocumentInfo';

View File

@@ -1,5 +1,5 @@
import React, { useReducer, useState, useCallback, useEffect } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../utilities/Config';
import { Props, Option, ValueWithRelation, GetResults } from './types';
import optionsReducer from './optionsReducer';
import useDebounce from '../../../../../hooks/useDebounce';

View File

@@ -6,7 +6,7 @@ import isDeepEqual from 'deep-equal';
import { serialize } from 'object-to-formdata';
import { useHistory } from 'react-router-dom';
import { toast } from 'react-toastify';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../utilities/Auth';
import { useLocale } from '../../utilities/Locale';
import { useDocumentInfo } from '../../utilities/DocumentInfo';
import { requests } from '../../../api';

View File

@@ -1,7 +1,6 @@
import React, { useCallback, useEffect, useReducer, useState } from 'react';
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../../utilities/Auth';
import withCondition from '../../withCondition';
import Button from '../../../elements/Button';
import DraggableSection from '../../DraggableSection';

View File

@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useReducer, useState } from 'react';
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../../utilities/Auth';
import { usePreferences } from '../../../utilities/Preferences';
import { useLocale } from '../../../utilities/Locale';
import withCondition from '../../withCondition';

View File

@@ -2,8 +2,9 @@ import React, {
useCallback, useEffect, useState, useReducer,
} from 'react';
import equal from 'deep-equal';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import qs from 'qs';
import { useConfig } from '../../../utilities/Config';
import { useAuth } from '../../../utilities/Auth';
import withCondition from '../../withCondition';
import ReactSelect from '../../../elements/ReactSelect';
import { Value } from '../../../elements/ReactSelect/types';

View File

@@ -1,5 +1,6 @@
import React, { Fragment, useState, useEffect } from 'react';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../../utilities/Config';
import { useAuth } from '../../../../../../../utilities/Auth';
import { useWatchForm } from '../../../../../../Form/context';
import Relationship from '../../../../../Relationship';
import Select from '../../../../../Select';

View File

@@ -2,7 +2,7 @@ import React, { Fragment, useCallback, useEffect, useState } from 'react';
import { Modal, useModal } from '@faceless-ui/modal';
import { Transforms } from 'slate';
import { ReactEditor, useSlate } from 'slate-react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
import ElementButton from '../../Button';
import RelationshipIcon from '../../../../../../icons/Relationship';
import Form from '../../../../../Form';

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useFocused, useSelected } from 'slate-react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
import RelationshipIcon from '../../../../../../icons/Relationship';
import usePayloadAPI from '../../../../../../../hooks/usePayloadAPI';

View File

@@ -2,7 +2,7 @@ import React, { Fragment, useEffect, useState } from 'react';
import { Modal, useModal } from '@faceless-ui/modal';
import { Transforms } from 'slate';
import { ReactEditor, useSlate } from 'slate-react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
import ElementButton from '../../Button';
import UploadIcon from '../../../../../../icons/Upload';
import usePayloadAPI from '../../../../../../../hooks/usePayloadAPI';

View File

@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useState } from 'react';
import { Transforms, Element } from 'slate';
import { ReactEditor, useSlateStatic } from 'slate-react';
import { Modal } from '@faceless-ui/modal';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../../../../../../utilities/Auth';
import { SanitizedCollectionConfig } from '../../../../../../../../../collections/config/types';
import buildStateFromSchema from '../../../../../../Form/buildStateFromSchema';
import MinimalTemplate from '../../../../../../../templates/Minimal';

View File

@@ -1,8 +1,8 @@
import * as React from 'react';
import { Modal } from '@faceless-ui/modal';
import { useConfig } from '@payloadcms/config-provider';
import { Element, Transforms } from 'slate';
import { ReactEditor, useSlateStatic } from 'slate-react';
import { useConfig } from '../../../../../../../utilities/Config';
import { SanitizedCollectionConfig } from '../../../../../../../../../collections/config/types';
import usePayloadAPI from '../../../../../../../../hooks/usePayloadAPI';
import MinimalTemplate from '../../../../../../../templates/Minimal';

View File

@@ -2,7 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
import { useModal } from '@faceless-ui/modal';
import { Transforms } from 'slate';
import { ReactEditor, useSlateStatic, useFocused, useSelected } from 'slate-react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
import usePayloadAPI from '../../../../../../../hooks/usePayloadAPI';
import FileGraphic from '../../../../../../graphics/File';
import useThumbnail from '../../../../../../../hooks/useThumbnail';

View File

@@ -1,6 +1,7 @@
import React, { useCallback } from 'react';
import { Modal, useModal } from '@faceless-ui/modal';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../../../utilities/Config';
import { useAuth } from '../../../../utilities/Auth';
import MinimalTemplate from '../../../../templates/Minimal';
import Form from '../../../Form';
import Button from '../../../../elements/Button';

View File

@@ -1,7 +1,8 @@
import React, { Fragment, useState, useEffect } from 'react';
import equal from 'deep-equal';
import { Modal, useModal } from '@faceless-ui/modal';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../utilities/Config';
import { useAuth } from '../../../../utilities/Auth';
import { Where } from '../../../../../../types';
import MinimalTemplate from '../../../../templates/Minimal';
import Button from '../../../../elements/Button';

View File

@@ -1,5 +1,5 @@
import React, { useCallback } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../utilities/Config';
import useField from '../../useField';
import withCondition from '../../withCondition';
import { upload } from '../../../../../fields/validations';

View File

@@ -1,7 +1,7 @@
import {
useCallback, useEffect, useState,
} from 'react';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../utilities/Auth';
import { useFormProcessing, useFormSubmitted, useFormModified, useForm } from '../Form/context';
import useDebounce from '../../../hooks/useDebounce';
import { Options, FieldType } from './types';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
const PayloadIcon: React.FC = () => (

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
const PayloadLogo: React.FC = () => (

View File

@@ -1,6 +1,6 @@
import React from 'react';
import NavigationPrompt from 'react-router-navigation-prompt';
import { useAuth } from '@payloadcms/config-provider';
import { useAuth } from '../../utilities/Auth';
import { useFormModified } from '../../forms/Form/context';
import MinimalTemplate from '../../templates/Minimal';
import Button from '../../elements/Button';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useModal, Modal } from '@faceless-ui/modal';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import MinimalTemplate from '../../templates/Minimal';
import Button from '../../elements/Button';
import { Props } from './types';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import DefaultNav from '../../elements/Nav';
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
import Meta from '../../utilities/Meta';

View File

@@ -0,0 +1,171 @@
import React, {
useState, createContext, useContext, useEffect, useCallback,
} from 'react';
import jwtDecode from 'jwt-decode';
import { useLocation, useHistory } from 'react-router-dom';
import { useModal } from '@faceless-ui/modal';
import { User, Permissions } from '../../../../auth/types';
import { useConfig } from '../Config';
import { requests } from '../../../api';
import useDebounce from '../../../hooks/useDebounce';
import { AuthContext } from './types';
const Context = createContext({} as AuthContext);
export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const [user, setUser] = useState<User | null>();
const [tokenInMemory, setTokenInMemory] = useState<string>();
const { pathname } = useLocation();
const { push } = useHistory();
const config = useConfig();
const {
admin: {
user: userSlug,
},
serverURL,
routes: {
admin,
api,
},
} = config;
const exp = user?.exp;
const [permissions, setPermissions] = useState<Permissions>();
const { open: openModal, closeAll: closeAllModals } = useModal();
const [lastLocationChange, setLastLocationChange] = useState(0);
const debouncedLocationChange = useDebounce(lastLocationChange, 10000);
const email = user?.email;
const refreshCookie = useCallback(() => {
const now = Math.round((new Date()).getTime() / 1000);
const remainingTime = (exp as number || 0) - now;
if (exp && remainingTime < 120) {
setTimeout(async () => {
const request = await requests.post(`${serverURL}${api}/${userSlug}/refresh-token`);
if (request.status === 200) {
const json = await request.json();
setUser(json.user);
} else {
setUser(null);
push(`${admin}/logout-inactivity`);
}
}, 1000);
}
}, [setUser, push, exp, admin, api, serverURL, userSlug]);
const setToken = useCallback((token: string) => {
const decoded = jwtDecode(token) as User;
setUser(decoded);
setTokenInMemory(token);
}, []);
const logOut = () => {
setUser(null);
setTokenInMemory(undefined);
requests.post(`${serverURL}${api}/${userSlug}/logout`);
};
// On mount, get user and set
useEffect(() => {
const fetchMe = async () => {
const request = await requests.get(`${serverURL}${api}/${userSlug}/me`);
if (request.status === 200) {
const json = await request.json();
setUser(json?.user || null);
if (json?.token) {
setToken(json.token);
}
}
};
fetchMe();
}, [setToken, api, serverURL, userSlug]);
// When location changes, refresh cookie
useEffect(() => {
if (email) {
refreshCookie();
}
}, [debouncedLocationChange, refreshCookie, email]);
useEffect(() => {
setLastLocationChange(Date.now());
}, [pathname]);
// When user changes, get new access
useEffect(() => {
async function getPermissions() {
const request = await requests.get(`${serverURL}${api}/access`);
if (request.status === 200) {
const json: Permissions = await request.json();
setPermissions(json);
}
}
if (email) {
getPermissions();
}
}, [email, api, serverURL]);
useEffect(() => {
let reminder: ReturnType<typeof setTimeout>;
const now = Math.round((new Date()).getTime() / 1000);
const remainingTime = exp as number - now;
if (remainingTime > 0) {
reminder = setTimeout(() => {
openModal('stay-logged-in');
}, ((remainingTime - 60) * 1000));
}
return () => {
if (reminder) clearTimeout(reminder);
};
}, [exp, openModal]);
useEffect(() => {
let forceLogOut: ReturnType<typeof setTimeout>;
const now = Math.round((new Date()).getTime() / 1000);
const remainingTime = exp as number - now;
if (remainingTime > 0) {
forceLogOut = setTimeout(() => {
setUser(null);
push(`${admin}/logout-inactivity`);
closeAllModals();
}, remainingTime * 1000);
}
return () => {
if (forceLogOut) clearTimeout(forceLogOut);
};
}, [exp, push, closeAllModals, admin]);
return (
<Context.Provider value={{
user,
logOut,
refreshCookie,
permissions,
setToken,
token: tokenInMemory,
}}
>
{children}
</Context.Provider>
);
};
export const useAuth = (): AuthContext => useContext(Context);

View File

@@ -0,0 +1,10 @@
import { User, Permissions } from '../../../../auth/types';
export type AuthContext = {
user?: User | null
logOut: () => void
refreshCookie: () => void
setToken: (token: string) => void
token?: string
permissions?: Permissions
}

View File

@@ -0,0 +1,12 @@
import React, { createContext, useContext } from 'react';
import { SanitizedConfig } from '../../../../config/types';
const Context = createContext<SanitizedConfig>({} as SanitizedConfig);
export const ConfigProvider: React.FC<{config: SanitizedConfig, children: React.ReactNode}> = ({ children, config }) => (
<Context.Provider value={config}>
{children}
</Context.Provider>
);
export const useConfig = (): SanitizedConfig => useContext(Context);

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../Config';
const NestProviders = ({ providers, children }) => {
const Component = providers[0];

View File

@@ -1,8 +1,8 @@
import React, {
createContext, useCallback, useContext, useEffect, useState,
} from 'react';
import { useConfig } from '@payloadcms/config-provider';
import qs from 'qs';
import { useConfig } from '../Config';
import { PaginatedDocs } from '../../../../mongoose/types';
import { ContextType, Props, Version } from './types';
import { TypeWithID } from '../../../../globals/config/types';

View File

@@ -1,7 +1,8 @@
import React, {
createContext, useContext, useState, useEffect,
} from 'react';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../Config';
import { useAuth } from '../Auth';
import { usePreferences } from '../Preferences';
import { useSearchParams } from '../SearchParams';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import Helmet from 'react-helmet';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../Config';
import { Props } from './types';
import payloadFavicon from '../../../assets/images/favicon.svg';
import payloadOgImage from '../../../assets/images/og-image.png';

View File

@@ -1,6 +1,7 @@
import React, { createContext, useCallback, useContext, useEffect, useRef } from 'react';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../Config';
import { useAuth } from '../Auth';
import { requests } from '../../../api';
type PreferencesContext = {

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import format from 'date-fns/format';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Eyebrow from '../../elements/Eyebrow';
import Form from '../../forms/Form';
import PreviewButton from '../../elements/PreviewButton';

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import { useStepNav } from '../../elements/StepNav';
import usePayloadAPI from '../../../hooks/usePayloadAPI';

View File

@@ -1,5 +1,6 @@
import React from 'react';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import MinimalTemplate from '../../templates/Minimal';
import Meta from '../../utilities/Meta';
import Form from '../../forms/Form';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Eyebrow from '../../elements/Eyebrow';
import Card from '../../elements/Card';

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import { useStepNav } from '../../elements/StepNav';
import RenderCustomComponent from '../../utilities/RenderCustomComponent';
import DefaultDashboard from './Default';

View File

@@ -1,7 +1,8 @@
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { toast } from 'react-toastify';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import MinimalTemplate from '../../templates/Minimal';
import Form from '../../forms/Form';
import Email from '../../forms/field-types/Email';

View File

@@ -1,6 +1,6 @@
import React from 'react';
import format from 'date-fns/format';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Eyebrow from '../../elements/Eyebrow';
import Form from '../../forms/Form';
import PreviewButton from '../../elements/PreviewButton';

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useLocation } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import { useStepNav } from '../../elements/StepNav';
import usePayloadAPI from '../../../hooks/usePayloadAPI';

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { Link, useHistory } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import Logo from '../../graphics/Logo';
import MinimalTemplate from '../../templates/Minimal';
import Form from '../../forms/Form';

View File

@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import Minimal from '../../templates/Minimal';
import Button from '../../elements/Button';
import Meta from '../../utilities/Meta';

View File

@@ -1,5 +1,5 @@
import React, { useEffect } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Eyebrow from '../../elements/Eyebrow';
import { useStepNav } from '../../elements/StepNav';
import Button from '../../elements/Button';

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { Link, useHistory, useParams } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import MinimalTemplate from '../../templates/Minimal';
import Form from '../../forms/Form';
import Password from '../../forms/field-types/Password';

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import Button from '../../elements/Button';
import Meta from '../../utilities/Meta';
import MinimalTemplate from '../../templates/Minimal';

View File

@@ -1,15 +0,0 @@
@import '../../../scss/styles.scss';
.unauthorized-user {
&__plan-name {
text-transform: capitalize;
}
&__button-group {
display: flex;
> *:first-child {
margin-right: base(.5);
}
}
}

View File

@@ -1,68 +0,0 @@
import React from 'react';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import Button from '../../elements/Button';
import Meta from '../../utilities/Meta';
import Banner from '../../elements/Banner';
import MinimalTemplate from '../../templates/Minimal';
import X from '../../icons/X';
import './index.scss';
const baseClass = 'unauthorized-user';
const UnauthorizedUser: React.FC = () => {
const { licensePlan, user } = useAuth();
const {
routes: {
admin,
},
} = useConfig();
return (
<MinimalTemplate className={baseClass}>
<Meta
title="Unauthorized User"
description="Unauthorized User"
keywords="Unauthorized, Payload, CMS"
/>
<h2>Your user account is unauthorized</h2>
<Banner
type="error"
alignIcon="left"
icon={<X />}
>
Sorry, the
{' '}
<strong className={`${baseClass}__plan-name`}>
{licensePlan}
</strong>
{' '}
license associated with this domain does not grant access to your email address (
<strong>{user?.email}</strong>
).
</Banner>
<p>
Don&apos;t worry&mdash;your Payload API is still accessible, but you can only access the Payload admin panel with user(s) that are specifically whitelisted by the owner of this Payload license.
</p>
<p>The user accounts that are granted access can be configured within the Payload CMS website. Contact the owner of the license to learn more.</p>
<div className={`${baseClass}__button-group`}>
<Button
el="link"
url={`${admin}/logout`}
>
Log out
</Button>
<Button
el="anchor"
url="https://payloadcms.com/login"
buttonStyle="secondary"
newTab
>
Go to the Payload CMS website
</Button>
</div>
</MinimalTemplate>
);
};
export default UnauthorizedUser;

View File

@@ -1,43 +0,0 @@
import React from 'react';
import Button from '../../elements/Button';
import Meta from '../../utilities/Meta';
import Banner from '../../elements/Banner';
import MinimalTemplate from '../../templates/Minimal';
import X from '../../icons/X';
const Unlicensed: React.FC = () => (
<MinimalTemplate className="unlicensed">
<Meta
title="Unlicensed"
description="Unlicensed"
keywords="Unlicensed, Payload, CMS"
/>
<h2>Your Payload license is invalid</h2>
<Banner
type="error"
alignIcon="left"
icon={<X />}
>
Sorry, but your license appears to be invalid for the domain
{' '}
<strong>
{window.location.hostname}
</strong>
.
</Banner>
<p>
Don&apos;t worry&mdash;your Payload API is still accessible, but a valid license is required to use the Payload admin panel on a live domain. Your payment method may have expired, or your license may not be properly tied to this domain.
</p>
<p>You can manage your licenses, including changing the domain that the license is attached to, through the Payload website.</p>
<br />
<Button
el="anchor"
url="https://payloadcms.com/login"
newTab
>
Review your licenses
</Button>
</MinimalTemplate>
);
export default Unlicensed;

View File

@@ -1,6 +1,7 @@
import React, { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import Logo from '../../graphics/Logo';
import MinimalTemplate from '../../templates/Minimal';
import Button from '../../elements/Button';

View File

@@ -1,7 +1,7 @@
import React, { useState, useCallback, useEffect } from 'react';
import qs from 'qs';
import { useConfig } from '@payloadcms/config-provider';
import format from 'date-fns/format';
import { useConfig } from '../../../utilities/Config';
import { Props } from './types';
import ReactSelect from '../../../elements/ReactSelect';
import { PaginatedDocs } from '../../../../../mongoose/types';

View File

@@ -1,6 +1,6 @@
import { useConfig } from '@payloadcms/config-provider';
import React from 'react';
import ReactDiffViewer from 'react-diff-viewer';
import { useConfig } from '../../../../../utilities/Config';
import { useLocale } from '../../../../../utilities/Locale';
import { SanitizedCollectionConfig } from '../../../../../../../collections/config/types';
import { fieldAffectsData, fieldIsPresentationalOnly, RelationshipField } from '../../../../../../../fields/config/types';

View File

@@ -1,8 +1,8 @@
import React, { Fragment, useCallback, useState } from 'react';
import { toast } from 'react-toastify';
import { Modal, useModal } from '@faceless-ui/modal';
import { useConfig } from '@payloadcms/config-provider';
import { useHistory } from 'react-router-dom';
import { useConfig } from '../../../utilities/Config';
import { Button, MinimalTemplate, Pill } from '../../..';
import { Props } from './types';
import { requests } from '../../../../api';

View File

@@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react';
import { useAuth, useConfig } from '@payloadcms/config-provider';
import { useRouteMatch } from 'react-router-dom';
import format from 'date-fns/format';
import { useConfig } from '../../utilities/Config';
import { useAuth } from '../../utilities/Auth';
import usePayloadAPI from '../../../hooks/usePayloadAPI';
import Eyebrow from '../../elements/Eyebrow';
import Loading from '../../elements/Loading';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link, useRouteMatch } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import format from 'date-fns/format';
import { useConfig } from '../../utilities/Config';
import { Column } from '../../elements/Table/types';
import SortColumn from '../../elements/SortColumn';
import { SanitizedCollectionConfig } from '../../../../collections/config/types';

View File

@@ -1,7 +1,7 @@
import { useConfig } from '@payloadcms/config-provider';
import React, { useEffect, useState } from 'react';
import { useRouteMatch } from 'react-router-dom';
import format from 'date-fns/format';
import { useConfig } from '../../utilities/Config';
import usePayloadAPI from '../../../hooks/usePayloadAPI';
import Eyebrow from '../../elements/Eyebrow';
import Loading from '../../elements/Loading';

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import { toast } from 'react-toastify';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../utilities/Config';
import Email from '../../../../forms/field-types/Email';
import Password from '../../../../forms/field-types/Password';
import Checkbox from '../../../../forms/field-types/Checkbox';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link, useRouteMatch } from 'react-router-dom';
import format from 'date-fns/format';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../utilities/Config';
import Eyebrow from '../../../elements/Eyebrow';
import Form from '../../../forms/Form';
import Loading from '../../../elements/Loading';

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { Redirect, useRouteMatch, useHistory, useLocation } from 'react-router-dom';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useConfig } from '../../../utilities/Config';
import { useAuth } from '../../../utilities/Auth';
import { useStepNav } from '../../../elements/StepNav';
import usePayloadAPI from '../../../../hooks/usePayloadAPI';

View File

@@ -7,7 +7,7 @@ import Checkbox from './field-types/Checkbox';
import Textarea from './field-types/Textarea';
import Select from './field-types/Select';
jest.mock('@payloadcms/config-provider', () => ({
jest.mock('../../../../utilities/Config', () => ({
useConfig: () => ({ admin: { dateFormat: 'MMMM do yyyy, h:mm a' } }),
}));

View File

@@ -1,6 +1,6 @@
import React from 'react';
import format from 'date-fns/format';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
const DateCell = ({ data }) => {
const { admin: { dateFormat } } = useConfig();

View File

@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../../../utilities/Config';
const RelationshipCell = (props) => {
const { field, data: cellData } = props;

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../../utilities/Config';
import RenderCustomComponent from '../../../../utilities/RenderCustomComponent';
import cellComponents from './field-types';
import { Props } from './types';

View File

@@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../../../utilities/Config';
import UploadGallery from '../../../elements/UploadGallery';
import Eyebrow from '../../../elements/Eyebrow';
import Paginator from '../../../elements/Paginator';

View File

@@ -1,8 +1,8 @@
import React, { useEffect, useState, useCallback } from 'react';
import { useConfig, useAuth } from '@payloadcms/config-provider';
import { useHistory } from 'react-router-dom';
import queryString from 'qs';
import { useConfig } from '../../../utilities/Config';
import { useAuth } from '../../../utilities/Auth';
import usePayloadAPI from '../../../../hooks/usePayloadAPI';
import DefaultList from './Default';
import RenderCustomComponent from '../../../utilities/RenderCustomComponent';

View File

@@ -1,4 +1,4 @@
import { useConfig } from '@payloadcms/config-provider';
import { useConfig } from '../components/utilities/Config';
import { SanitizedCollectionConfig } from '../../collections/config/types';
import isImage from '../../uploads/isImage';

View File

@@ -8,7 +8,8 @@ import { ScrollInfoProvider } from '@faceless-ui/scroll-info';
import { WindowInfoProvider } from '@faceless-ui/window-info';
import { ModalProvider, ModalContainer } from '@faceless-ui/modal';
import { ToastContainer, Slide } from 'react-toastify';
import { ConfigProvider, AuthProvider } from '@payloadcms/config-provider';
import { AuthProvider } from './components/utilities/Auth';
import { ConfigProvider } from './components/utilities/Config';
import { PreferencesProvider } from './components/utilities/Preferences';
import { CustomProvider } from './components/utilities/CustomProvider';
import { SearchParamsProvider } from './components/utilities/SearchParams';

View File

@@ -97,7 +97,6 @@ async function accessOperation(this: Payload, args: Arguments): Promise<Permissi
if (userCollectionConfig) {
results.canAccessAdmin = userCollectionConfig.access.admin ? userCollectionConfig.access.admin(args) : isLoggedIn;
if (results.canAccessAdmin) results.license = this.license;
} else {
results.canAccessAdmin = false;
}

View File

@@ -42,7 +42,6 @@ export type GlobalPermission = {
export type Permissions = {
canAccessAdmin: boolean
license?: string
collections: CollectionPermission[]
globals?: GlobalPermission[]
}

View File

@@ -65,7 +65,6 @@ export type InitOptions = {
mongoURL: string;
mongoOptions?: ConnectOptions;
secret: string;
license?: string;
email?: EmailOptions;
local?: boolean;
onInit?: (payload: Payload) => void;

View File

@@ -91,8 +91,6 @@ export class Payload {
sendEmail: (message: Message) => Promise<unknown>;
license: string;
secret: string;
mongoURL: string;
@@ -128,7 +126,6 @@ export class Payload {
throw new Error('Error: missing MongoDB connection URL.');
}
this.license = options.license;
this.emailOptions = { ...(options.email) };
this.secret = crypto
.createHash('sha256')

View File

@@ -1672,13 +1672,6 @@
dependencies:
"@octokit/openapi-types" "^11.2.0"
"@payloadcms/config-provider@^1.0.1":
version "1.0.1"
resolved "https://registry.npmjs.org/@payloadcms/config-provider/-/config-provider-1.0.1.tgz#211e1d1dbb4fb1a2497dd553e7c8588b75f2514b"
integrity sha512-wkjXF32plu4aTKcIPOeKH/i34QUZQ72fIZqWs/d0dI73JeO8oi1V+KL6JX8U3T0uqbBZvx1BXE6fJSb5Dzj8mQ==
dependencies:
jwt-decode "^3.1.2"
"@polka/url@^1.0.0-next.20":
version "1.0.0-next.21"
resolved "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1"