Compare commits
6 Commits
v3.0.0-bet
...
3.0.0-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b05a5e1fb6 | ||
|
|
92a5da1006 | ||
|
|
75a95469b2 | ||
|
|
c0ae287d46 | ||
|
|
a2b92aa3ff | ||
|
|
544a2285d3 |
@@ -154,7 +154,7 @@
|
||||
"tempy": "^1.0.1",
|
||||
"ts-node": "10.9.1",
|
||||
"tsx": "^4.7.1",
|
||||
"turbo": "^1.13.2",
|
||||
"turbo": "^1.13.3",
|
||||
"typescript": "5.4.5",
|
||||
"uuid": "^9.0.1",
|
||||
"yocto-queue": "^1.0.0"
|
||||
|
||||
@@ -100,7 +100,7 @@ export const initPage = async ({
|
||||
const docID = collectionSlug && createOrID !== 'create' ? createOrID : undefined
|
||||
|
||||
const isAdminRoute = route.startsWith(adminRoute)
|
||||
const isAuthRoute = authRoutes.some((r) => r === route.replace(adminRoute, ''))
|
||||
const isAuthRoute = authRoutes.some((r) => route.replace(adminRoute, '').startsWith(r))
|
||||
|
||||
if (redirectUnauthenticatedUser && !user && !isAuthRoute) {
|
||||
if (searchParams && 'redirect' in searchParams) delete searchParams.redirect
|
||||
|
||||
103
packages/next/src/views/ResetPassword/index.client.tsx
Normal file
103
packages/next/src/views/ResetPassword/index.client.tsx
Normal file
@@ -0,0 +1,103 @@
|
||||
'use client'
|
||||
import type { FormState } from 'payload/types'
|
||||
|
||||
import { ConfirmPassword } from '@payloadcms/ui/fields/ConfirmPassword'
|
||||
import { HiddenInput } from '@payloadcms/ui/fields/HiddenInput'
|
||||
import { Password } from '@payloadcms/ui/fields/Password'
|
||||
import { Form, useFormFields } from '@payloadcms/ui/forms/Form'
|
||||
import { FormSubmit } from '@payloadcms/ui/forms/Submit'
|
||||
import { useAuth } from '@payloadcms/ui/providers/Auth'
|
||||
import { useConfig } from '@payloadcms/ui/providers/Config'
|
||||
import { useTranslation } from '@payloadcms/ui/providers/Translation'
|
||||
import { useRouter } from 'next/navigation.js'
|
||||
import React from 'react'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
type Args = {
|
||||
token: string
|
||||
}
|
||||
|
||||
const initialState: FormState = {
|
||||
'confirm-password': {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
password: {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
}
|
||||
|
||||
export const ResetPasswordClient: React.FC<Args> = ({ token }) => {
|
||||
const i18n = useTranslation()
|
||||
const {
|
||||
admin: { user: userSlug },
|
||||
routes: { admin, api },
|
||||
serverURL,
|
||||
} = useConfig()
|
||||
|
||||
const history = useRouter()
|
||||
|
||||
const { fetchFullUser } = useAuth()
|
||||
|
||||
const onSuccess = React.useCallback(
|
||||
async (data) => {
|
||||
if (data.token) {
|
||||
await fetchFullUser()
|
||||
history.push(`${admin}`)
|
||||
} else {
|
||||
history.push(`${admin}/login`)
|
||||
toast.success(i18n.t('general:updatedSuccessfully'), { autoClose: 3000 })
|
||||
}
|
||||
},
|
||||
[fetchFullUser, history, admin, i18n],
|
||||
)
|
||||
|
||||
return (
|
||||
<Form
|
||||
action={`${serverURL}${api}/${userSlug}/reset-password`}
|
||||
initialState={initialState}
|
||||
method="POST"
|
||||
onSuccess={onSuccess}
|
||||
>
|
||||
<PasswordToConfirm />
|
||||
<ConfirmPassword />
|
||||
<HiddenInput forceUsePathFromProps name="token" value={token} />
|
||||
<FormSubmit>{i18n.t('authentication:resetPassword')}</FormSubmit>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
const PasswordToConfirm = () => {
|
||||
const { t } = useTranslation()
|
||||
const { value: confirmValue } = useFormFields(([fields]) => {
|
||||
return fields['confirm-password']
|
||||
})
|
||||
|
||||
const validate = React.useCallback(
|
||||
(value: string) => {
|
||||
if (!value) {
|
||||
return t('validation:required')
|
||||
}
|
||||
|
||||
if (value === confirmValue) {
|
||||
return true
|
||||
}
|
||||
|
||||
return t('fields:passwordsDoNotMatch')
|
||||
},
|
||||
[confirmValue, t],
|
||||
)
|
||||
|
||||
return (
|
||||
<Password
|
||||
autoComplete="off"
|
||||
label={t('authentication:newPassword')}
|
||||
name="password"
|
||||
required
|
||||
validate={validate}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -1,15 +1,5 @@
|
||||
.reset-password {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
min-height: 100vh;
|
||||
|
||||
&__wrap {
|
||||
margin: 0 auto var(--base);
|
||||
width: 100%;
|
||||
|
||||
svg {
|
||||
width: 100%;
|
||||
}
|
||||
form > .field-type {
|
||||
margin-bottom: var(--base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,11 @@ import type { AdminViewProps } from 'payload/types'
|
||||
|
||||
import { Button } from '@payloadcms/ui/elements/Button'
|
||||
import { Translation } from '@payloadcms/ui/elements/Translation'
|
||||
import { ConfirmPassword } from '@payloadcms/ui/fields/ConfirmPassword'
|
||||
import { HiddenInput } from '@payloadcms/ui/fields/HiddenInput'
|
||||
import { Password } from '@payloadcms/ui/fields/Password'
|
||||
import { Form } from '@payloadcms/ui/forms/Form'
|
||||
import { FormSubmit } from '@payloadcms/ui/forms/Submit'
|
||||
import { MinimalTemplate } from '@payloadcms/ui/templates/Minimal'
|
||||
import LinkImport from 'next/link.js'
|
||||
import React from 'react'
|
||||
|
||||
import { ResetPasswordClient } from './index.client.js'
|
||||
import './index.scss'
|
||||
|
||||
export const resetPasswordBaseClass = 'reset-password'
|
||||
@@ -22,7 +18,9 @@ export { generateResetPasswordMetadata } from './meta.js'
|
||||
export const ResetPassword: React.FC<AdminViewProps> = ({ initPageResult, params }) => {
|
||||
const { req } = initPageResult
|
||||
|
||||
const { token } = params
|
||||
const {
|
||||
segments: [_, token],
|
||||
} = params
|
||||
|
||||
const {
|
||||
i18n,
|
||||
@@ -31,21 +29,9 @@ export const ResetPassword: React.FC<AdminViewProps> = ({ initPageResult, params
|
||||
} = req
|
||||
|
||||
const {
|
||||
admin: { user: userSlug },
|
||||
routes: { admin, api },
|
||||
serverURL,
|
||||
routes: { admin },
|
||||
} = config
|
||||
|
||||
// const onSuccess = async (data) => {
|
||||
// if (data.token) {
|
||||
// await fetchFullUser()
|
||||
// history.push(`${admin}`)
|
||||
// } else {
|
||||
// history.push(`${admin}/login`)
|
||||
// toast.success(i18n.t('general:updatedSuccessfully'), { autoClose: 3000 })
|
||||
// }
|
||||
// }
|
||||
|
||||
if (user) {
|
||||
return (
|
||||
<MinimalTemplate className={resetPasswordBaseClass}>
|
||||
@@ -73,22 +59,7 @@ export const ResetPassword: React.FC<AdminViewProps> = ({ initPageResult, params
|
||||
<MinimalTemplate className={resetPasswordBaseClass}>
|
||||
<div className={`${resetPasswordBaseClass}__wrap`}>
|
||||
<h1>{i18n.t('authentication:resetPassword')}</h1>
|
||||
<Form
|
||||
action={`${serverURL}${api}/${userSlug}/reset-password`}
|
||||
method="POST"
|
||||
// onSuccess={onSuccess}
|
||||
redirect={admin}
|
||||
>
|
||||
<Password
|
||||
autoComplete="off"
|
||||
label={i18n.t('authentication:newPassword')}
|
||||
name="password"
|
||||
required
|
||||
/>
|
||||
<ConfirmPassword />
|
||||
<HiddenInput forceUsePathFromProps name="token" value={token} />
|
||||
<FormSubmit>{i18n.t('authentication:resetPassword')}</FormSubmit>
|
||||
</Form>
|
||||
<ResetPasswordClient token={token} />
|
||||
</div>
|
||||
</MinimalTemplate>
|
||||
)
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/index.ts",
|
||||
"require": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
@@ -36,12 +36,14 @@
|
||||
"types.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "echo \"Build temporarily disabled.\" && exit 0",
|
||||
"build": "pnpm copyfiles && pnpm build:swc && pnpm build:types",
|
||||
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
||||
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
||||
"clean": "rimraf {dist,*.tsbuildinfo}",
|
||||
"prepublishOnly": "pnpm clean && pnpm turbo run build && pnpm test",
|
||||
"test": "echo 'No tests available.'"
|
||||
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
||||
"prepublishOnly": "pnpm clean && pnpm turbo build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@payloadcms/ui": "workspace:*",
|
||||
@@ -51,17 +53,19 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@payloadcms/eslint-config": "workspace:*",
|
||||
"@payloadcms/next": "workspace:*",
|
||||
"@payloadcms/translations": "workspace:*",
|
||||
"@payloadcms/ui": "workspace:*",
|
||||
"@types/express": "^4.17.9",
|
||||
"@types/lodash.get": "^4.4.7",
|
||||
"@types/react": "18.2.74",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"payload": "workspace:*",
|
||||
"prettier": "^2.7.1",
|
||||
"webpack": "^5.78.0"
|
||||
"payload": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"payload": "workspace:*",
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||
"@payloadcms/translations": "workspace:*",
|
||||
"@payloadcms/ui": "workspace:*",
|
||||
"payload": "workspace:*"
|
||||
},
|
||||
"publishConfig": {
|
||||
"exports": {
|
||||
@@ -72,6 +76,7 @@
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"registry": "https://registry.npmjs.org/",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"homepage:": "https://payloadcms.com"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Config } from 'payload/config'
|
||||
|
||||
import type { SanitizedStripeConfig, StripeConfig } from './types'
|
||||
import type { SanitizedStripeConfig, StripeConfig } from './types.js'
|
||||
|
||||
import { getFields } from './fields/getFields'
|
||||
import { getFields } from './fields/getFields.js'
|
||||
|
||||
const stripePlugin =
|
||||
export const stripePlugin =
|
||||
(incomingStripeConfig: StripeConfig) =>
|
||||
(config: Config): Config => {
|
||||
const { collections } = config
|
||||
@@ -42,5 +42,3 @@ const stripePlugin =
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
export default stripePlugin
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { CollectionConfig, Field } from 'payload/types'
|
||||
|
||||
import type { SanitizedStripeConfig } from '../types'
|
||||
import type { SanitizedStripeConfig } from '../types.js'
|
||||
|
||||
import { LinkToDoc } from '../ui/LinkToDoc'
|
||||
import { LinkToDoc } from '../ui/LinkToDoc.js'
|
||||
|
||||
interface Args {
|
||||
collection: CollectionConfig
|
||||
@@ -39,13 +39,12 @@ export const getFields = ({ collection, stripeConfig, syncConfig }: Args): Field
|
||||
type: 'ui',
|
||||
admin: {
|
||||
components: {
|
||||
Field: (args) =>
|
||||
LinkToDoc({
|
||||
...args,
|
||||
isTestKey: stripeConfig.isTestKey,
|
||||
nameOfIDField: 'stripeID',
|
||||
stripeResourceType: syncConfig.stripeResourceType,
|
||||
}),
|
||||
Field: LinkToDoc,
|
||||
},
|
||||
custom: {
|
||||
isTestKey: stripeConfig.isTestKey,
|
||||
nameOfIDField: 'stripeID',
|
||||
stripeResourceType: syncConfig.stripeResourceType,
|
||||
},
|
||||
position: 'sidebar',
|
||||
},
|
||||
|
||||
@@ -3,11 +3,12 @@ import type { CollectionBeforeValidateHook, CollectionConfig } from 'payload/typ
|
||||
import { APIError } from 'payload/errors'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import type { StripeConfig } from '../types'
|
||||
import type { StripeConfig } from '../types.js'
|
||||
|
||||
import { deepen } from '../utilities/deepen'
|
||||
import { deepen } from '../utilities/deepen.js'
|
||||
|
||||
const stripeSecretKey = process.env.STRIPE_SECRET_KEY
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
|
||||
type HookArgsWithCustomCollection = Omit<
|
||||
@@ -52,12 +53,15 @@ export const createNewInStripe: CollectionBeforeValidateHookWithArgs = async (ar
|
||||
|
||||
if (syncConfig) {
|
||||
// combine all fields of this object and match their respective values within the document
|
||||
let syncedFields = syncConfig.fields.reduce((acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
let syncedFields = syncConfig.fields.reduce(
|
||||
(acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
|
||||
acc[stripeProperty] = dataRef[fieldPath]
|
||||
return acc
|
||||
}, {} as Record<string, any>)
|
||||
acc[stripeProperty] = dataRef[fieldPath]
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, any>,
|
||||
)
|
||||
|
||||
syncedFields = deepen(syncedFields)
|
||||
|
||||
@@ -72,6 +76,7 @@ export const createNewInStripe: CollectionBeforeValidateHookWithArgs = async (ar
|
||||
try {
|
||||
// NOTE: Typed as "any" because the "create" method is not standard across all Stripe resources
|
||||
const stripeResource = await stripe?.[syncConfig.stripeResourceType]?.create(
|
||||
// @ts-expect-error
|
||||
syncedFields,
|
||||
)
|
||||
|
||||
@@ -105,6 +110,7 @@ export const createNewInStripe: CollectionBeforeValidateHookWithArgs = async (ar
|
||||
|
||||
// NOTE: Typed as "any" because the "create" method is not standard across all Stripe resources
|
||||
const stripeResource = await stripe?.[syncConfig.stripeResourceType]?.create(
|
||||
// @ts-expect-error
|
||||
syncedFields,
|
||||
)
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@ import type { CollectionAfterDeleteHook, CollectionConfig } from 'payload/types'
|
||||
import { APIError } from 'payload/errors'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import type { StripeConfig } from '../types'
|
||||
import type { StripeConfig } from '../types.js'
|
||||
|
||||
const stripeSecretKey = process.env.STRIPE_SECRET_KEY
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
|
||||
type HookArgsWithCustomCollection = Omit<Parameters<CollectionAfterDeleteHook>[0], 'collection'> & {
|
||||
|
||||
@@ -3,11 +3,12 @@ import type { CollectionBeforeChangeHook, CollectionConfig } from 'payload/types
|
||||
import { APIError } from 'payload/errors'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import type { StripeConfig } from '../types'
|
||||
import type { StripeConfig } from '../types.js'
|
||||
|
||||
import { deepen } from '../utilities/deepen'
|
||||
import { deepen } from '../utilities/deepen.js'
|
||||
|
||||
const stripeSecretKey = process.env.STRIPE_SECRET_KEY
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
const stripe = new Stripe(stripeSecretKey || '', { apiVersion: '2022-08-01' })
|
||||
|
||||
type HookArgsWithCustomCollection = Omit<
|
||||
@@ -39,12 +40,15 @@ export const syncExistingWithStripe: CollectionBeforeChangeHookWithArgs = async
|
||||
if (syncConfig) {
|
||||
if (operation === 'update') {
|
||||
// combine all fields of this object and match their respective values within the document
|
||||
let syncedFields = syncConfig.fields.reduce((acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
let syncedFields = syncConfig.fields.reduce(
|
||||
(acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
|
||||
acc[stripeProperty] = data[fieldPath]
|
||||
return acc
|
||||
}, {} as Record<string, any>)
|
||||
acc[stripeProperty] = data[fieldPath]
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, any>,
|
||||
)
|
||||
|
||||
syncedFields = deepen(syncedFields)
|
||||
|
||||
|
||||
@@ -9,7 +9,10 @@ import { syncExistingWithStripe } from './hooks/syncExistingWithStripe.js'
|
||||
import { stripeREST } from './routes/rest.js'
|
||||
import { stripeWebhooks } from './routes/webhooks.js'
|
||||
|
||||
const stripePlugin =
|
||||
export { LinkToDoc } from './ui/LinkToDoc.js'
|
||||
export { stripeProxy } from './utilities/stripeProxy.js'
|
||||
|
||||
export const stripePlugin =
|
||||
(incomingStripeConfig: StripeConfig) =>
|
||||
(config: Config): Config => {
|
||||
const { collections } = config
|
||||
@@ -112,5 +115,3 @@ const stripePlugin =
|
||||
endpoints,
|
||||
}
|
||||
}
|
||||
|
||||
export default stripePlugin
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export const createNewInStripe = () => null
|
||||
export const deleteFromStripe = () => null
|
||||
export const stripeREST = () => null
|
||||
export const stripeWebhooks = () => null
|
||||
export const syncExistingWithStripe = () => null
|
||||
|
||||
export default {
|
||||
raw: () => {}, // mock express fn
|
||||
}
|
||||
@@ -33,7 +33,9 @@ export const stripeREST = async (args: {
|
||||
}
|
||||
|
||||
responseJSON = await stripeProxy({
|
||||
// @ts-expect-error
|
||||
stripeArgs,
|
||||
// @ts-expect-error
|
||||
stripeMethod,
|
||||
stripeSecretKey,
|
||||
})
|
||||
|
||||
@@ -19,6 +19,7 @@ export const stripeWebhooks = async (args: {
|
||||
|
||||
if (stripeWebhooksEndpointSecret) {
|
||||
const stripe = new Stripe(stripeSecretKey, {
|
||||
// api version can only be the latest, stripe recommends ts ignoring it
|
||||
apiVersion: '2022-08-01',
|
||||
appInfo: {
|
||||
name: 'Stripe Payload Plugin',
|
||||
@@ -26,17 +27,14 @@ export const stripeWebhooks = async (args: {
|
||||
},
|
||||
})
|
||||
|
||||
const body = await req.text()
|
||||
const stripeSignature = req.headers.get('stripe-signature')
|
||||
|
||||
if (stripeSignature) {
|
||||
let event: Stripe.Event | undefined
|
||||
|
||||
try {
|
||||
event = stripe.webhooks.constructEvent(
|
||||
await req.text(),
|
||||
stripeSignature,
|
||||
stripeWebhooksEndpointSecret,
|
||||
)
|
||||
event = stripe.webhooks.constructEvent(body, stripeSignature, stripeWebhooksEndpointSecret)
|
||||
} catch (err: unknown) {
|
||||
const msg: string = err instanceof Error ? err.message : JSON.stringify(err)
|
||||
req.payload.logger.error(`Error constructing Stripe event: ${msg}`)
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
'use client'
|
||||
import type { CustomComponent } from 'payload/config'
|
||||
import type { UIField } from 'payload/types'
|
||||
|
||||
import { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'
|
||||
// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
|
||||
import { useFormFields } from '@payloadcms/ui/forms/Form'
|
||||
import React from 'react'
|
||||
|
||||
export const LinkToDoc: React.FC<
|
||||
UIField & {
|
||||
isTestKey: boolean
|
||||
nameOfIDField: string
|
||||
stripeResourceType: string
|
||||
}
|
||||
> = (props) => {
|
||||
const { isTestKey, nameOfIDField, stripeResourceType } = props
|
||||
export const LinkToDoc: CustomComponent<UIField> = () => {
|
||||
const { custom } = useFieldProps()
|
||||
const { isTestKey, nameOfIDField, stripeResourceType } = custom
|
||||
|
||||
const field = useFormFields(([fields]) => fields[nameOfIDField])
|
||||
const { value: stripeID } = field || {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import lodashGet from 'lodash.get'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import type { StripeProxy } from '../types'
|
||||
import type { StripeProxy } from '../types.js'
|
||||
|
||||
export const stripeProxy: StripeProxy = async ({ stripeArgs, stripeMethod, stripeSecretKey }) => {
|
||||
const stripe = new Stripe(stripeSecretKey, {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import type { SanitizedStripeConfig, StripeWebhookHandler } from '../types'
|
||||
import type { SanitizedStripeConfig, StripeWebhookHandler } from '../types.js'
|
||||
|
||||
import { deepen } from '../utilities/deepen'
|
||||
import { deepen } from '../utilities/deepen.js'
|
||||
|
||||
type HandleCreatedOrUpdated = (
|
||||
args: Parameters<StripeWebhookHandler>[0] & {
|
||||
@@ -62,12 +62,15 @@ export const handleCreatedOrUpdated: HandleCreatedOrUpdated = async (args) => {
|
||||
const foundDoc = payloadQuery.docs[0] as any
|
||||
|
||||
// combine all properties of the Stripe doc and match their respective fields within the document
|
||||
let syncedData = syncConfig.fields.reduce((acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
let syncedData = syncConfig.fields.reduce(
|
||||
(acc, field) => {
|
||||
const { fieldPath, stripeProperty } = field
|
||||
|
||||
acc[fieldPath] = stripeDoc[stripeProperty]
|
||||
return acc
|
||||
}, {} as Record<string, any>)
|
||||
acc[fieldPath] = stripeDoc[stripeProperty]
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, any>,
|
||||
)
|
||||
|
||||
syncedData = deepen({
|
||||
...syncedData,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SanitizedStripeConfig, StripeWebhookHandler } from '../types'
|
||||
import type { SanitizedStripeConfig, StripeWebhookHandler } from '../types.js'
|
||||
|
||||
type HandleDeleted = (
|
||||
args: Parameters<StripeWebhookHandler>[0] & {
|
||||
@@ -58,6 +58,7 @@ export const handleDeleted: HandleDeleted = async (args) => {
|
||||
if (logs) payload.logger.info(`- Deleting Payload document with ID: '${foundDoc.id}'...`)
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
payload.delete({
|
||||
id: foundDoc.id,
|
||||
collection: collectionSlug,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { StripeWebhookHandler } from '../types'
|
||||
import type { StripeWebhookHandler } from '../types.js'
|
||||
|
||||
import { handleCreatedOrUpdated } from './handleCreatedOrUpdated'
|
||||
import { handleDeleted } from './handleDeleted'
|
||||
import { handleCreatedOrUpdated } from './handleCreatedOrUpdated.js'
|
||||
import { handleDeleted } from './handleDeleted.js'
|
||||
|
||||
export const handleWebhooks: StripeWebhookHandler = async (args) => {
|
||||
export const handleWebhooks: StripeWebhookHandler = (args) => {
|
||||
const { event, payload, stripeConfig } = args
|
||||
|
||||
if (stripeConfig?.logs)
|
||||
@@ -21,7 +21,7 @@ export const handleWebhooks: StripeWebhookHandler = async (args) => {
|
||||
if (syncConfig) {
|
||||
switch (method) {
|
||||
case 'created': {
|
||||
await handleCreatedOrUpdated({
|
||||
void handleCreatedOrUpdated({
|
||||
...args,
|
||||
resourceType,
|
||||
stripeConfig,
|
||||
@@ -30,7 +30,7 @@ export const handleWebhooks: StripeWebhookHandler = async (args) => {
|
||||
break
|
||||
}
|
||||
case 'updated': {
|
||||
await handleCreatedOrUpdated({
|
||||
void handleCreatedOrUpdated({
|
||||
...args,
|
||||
resourceType,
|
||||
stripeConfig,
|
||||
@@ -39,7 +39,7 @@ export const handleWebhooks: StripeWebhookHandler = async (args) => {
|
||||
break
|
||||
}
|
||||
case 'deleted': {
|
||||
await handleDeleted({
|
||||
void handleDeleted({
|
||||
...args,
|
||||
resourceType,
|
||||
stripeConfig,
|
||||
|
||||
@@ -27,6 +27,8 @@ export const clientTranslationKeys = [
|
||||
'authentication:loggingOut',
|
||||
'authentication:login',
|
||||
'authentication:logOut',
|
||||
'authentication:loggedIn',
|
||||
'authentication:loggedInChangePassword',
|
||||
'authentication:logout',
|
||||
'authentication:logoutUser',
|
||||
'authentication:logoutSuccessful',
|
||||
|
||||
@@ -8,7 +8,7 @@ export const cs: Language = {
|
||||
accountOfCurrentUser: 'Účet současného uživatele',
|
||||
alreadyActivated: 'Již aktivováno',
|
||||
alreadyLoggedIn: 'Již přihlášen',
|
||||
apiKey: 'Klíč API',
|
||||
apiKey: 'API klíč',
|
||||
backToLogin: 'Zpět na přihlášení',
|
||||
beginCreateFirstUser: 'Začněte vytvořením svého prvního uživatele.',
|
||||
changePassword: 'Změnit heslo',
|
||||
@@ -19,7 +19,7 @@ export const cs: Language = {
|
||||
createFirstUser: 'Vytvořit prvního uživatele',
|
||||
emailNotValid: 'Zadaný email není platný',
|
||||
emailSent: 'Email odeslán',
|
||||
enableAPIKey: 'Povolit klíč API',
|
||||
enableAPIKey: 'Povolit API klíč',
|
||||
failedToUnlock: 'Nepodařilo se odemknout',
|
||||
forceUnlock: 'Vynutit odemčení',
|
||||
forgotPassword: 'Zapomněli jste heslo?',
|
||||
@@ -27,9 +27,9 @@ export const cs: Language = {
|
||||
'Zadejte svůj email níže. Obdržíte email s instrukcemi, jak resetovat vaše heslo.',
|
||||
forgotPasswordQuestion: 'Zapomněli jste heslo?',
|
||||
generate: 'Generovat',
|
||||
generateNewAPIKey: 'Generovat nový klíč API',
|
||||
generateNewAPIKey: 'Generovat nový API klíč',
|
||||
generatingNewAPIKeyWillInvalidate:
|
||||
'Vytvoření nového klíče API <1>zneplatní</1> předchozí klíč. Opravdu chcete pokračovat?',
|
||||
'Vytvoření nového API klíče <1>zneplatní</1> předchozí klíč. Opravdu chcete pokračovat?',
|
||||
lockUntil: 'Uzamknout do',
|
||||
logBackIn: 'Znovu se přihlásit',
|
||||
logOut: 'Odhlásit se',
|
||||
@@ -45,7 +45,7 @@ export const cs: Language = {
|
||||
'Abyste se mohli přihlásit s jiným uživatelem, nejdříve se <0>odhlaste</0>.',
|
||||
logout: 'Odhlásit se',
|
||||
logoutUser: 'Odhlásit uživatele',
|
||||
newAPIKeyGenerated: 'Byl vygenerován nový klíč API.',
|
||||
newAPIKeyGenerated: 'Byl vygenerován nový API klíč.',
|
||||
newAccountCreated:
|
||||
'Pro přístup k <a href="{{serverURL}}">{{serverURL}}</a> byl pro vás vytvořen nový účet. Klepněte na následující odkaz nebo zkopírujte URL do svého prohlížeče pro ověření vašeho emailu: <a href="{{verificationURL}}">{{verificationURL}}</a><br> Po ověření vašeho emailu se budete moci úspěšně přihlásit.',
|
||||
newPassword: 'Nové heslo',
|
||||
@@ -109,7 +109,7 @@ export const cs: Language = {
|
||||
},
|
||||
fields: {
|
||||
addLabel: 'Přidat {{label}}',
|
||||
addLink: 'Přidat Odkaz',
|
||||
addLink: 'Přidat odkaz',
|
||||
addNew: 'Přidat nový',
|
||||
addNewLabel: 'Přidat nový {{label}}',
|
||||
addRelationship: 'Přidat vztah',
|
||||
@@ -161,10 +161,10 @@ export const cs: Language = {
|
||||
addBelow: 'Přidat pod',
|
||||
addFilter: 'Přidat filtr',
|
||||
adminTheme: 'Motiv administračního rozhraní',
|
||||
and: 'A',
|
||||
and: 'a',
|
||||
applyChanges: 'Použít změny',
|
||||
ascending: 'Vzestupně',
|
||||
automatic: 'Automatické',
|
||||
automatic: 'Automatický',
|
||||
backToDashboard: 'Zpět na nástěnku',
|
||||
cancel: 'Zrušit',
|
||||
changesNotSaved: 'Vaše změny nebyly uloženy. Pokud teď odejdete, ztratíte své změny.',
|
||||
@@ -185,7 +185,7 @@ export const cs: Language = {
|
||||
createdAt: 'Vytvořeno v',
|
||||
creating: 'Vytváření',
|
||||
creatingNewLabel: 'Vytváření nového {{label}}',
|
||||
dark: 'Tmavé',
|
||||
dark: 'Tmavý',
|
||||
dashboard: 'Nástěnka',
|
||||
delete: 'Odstranit',
|
||||
deletedCountSuccessfully: 'Úspěšně smazáno {{count}} {{label}}.',
|
||||
@@ -199,7 +199,7 @@ export const cs: Language = {
|
||||
duplicateWithoutSaving: 'Duplikovat bez uložení změn',
|
||||
edit: 'Upravit',
|
||||
editLabel: 'Upravit {{label}}',
|
||||
editing: 'Úpravy',
|
||||
editing: 'Úprava',
|
||||
editingLabel_many: 'Úprava {{count}} {{label}}',
|
||||
editingLabel_one: 'Úprava {{count}} {{label}}',
|
||||
editingLabel_other: 'Úprava {{count}} {{label}}',
|
||||
@@ -241,7 +241,7 @@ export const cs: Language = {
|
||||
order: 'Pořadí',
|
||||
pageNotFound: 'Stránka nenalezena',
|
||||
password: 'Heslo',
|
||||
payloadSettings: 'Nastavení datového záběru',
|
||||
payloadSettings: 'Payload nastavení',
|
||||
perPage: 'Na stránku: {{limit}}',
|
||||
remove: 'Odstranit',
|
||||
reset: 'Resetovat',
|
||||
@@ -289,20 +289,20 @@ export const cs: Language = {
|
||||
isLessThanOrEqualTo: 'je menší nebo rovno',
|
||||
isLike: 'je jako',
|
||||
isNotEqualTo: 'není rovno',
|
||||
isNotIn: 'není in',
|
||||
isNotIn: 'není v',
|
||||
near: 'blízko',
|
||||
},
|
||||
upload: {
|
||||
crop: 'Plodina',
|
||||
crop: 'Ořez',
|
||||
cropToolDescription:
|
||||
'Přetáhněte rohy vybrané oblasti, nakreslete novou oblast nebo upravte hodnoty níže.',
|
||||
'Přetáhněte rohy vybrané oblasti, nakreslete novou oblast nebo upravte níže uvedené hodnoty.',
|
||||
dragAndDrop: 'Přetáhněte soubor',
|
||||
dragAndDropHere: 'nebo sem přetáhněte soubor',
|
||||
editImage: 'Upravit obrázek',
|
||||
fileName: 'Název souboru',
|
||||
fileSize: 'Velikost souboru',
|
||||
focalPoint: 'Středobod',
|
||||
focalPointDescription: 'Přetáhněte bod zaměření přímo na náhled nebo upravte hodnoty níže.',
|
||||
focalPointDescription: 'Přetáhněte bod zaměření přímo na náhled nebo upravte níže uvedené hodnoty.',
|
||||
height: 'Výška',
|
||||
lessInfo: 'Méně informací',
|
||||
moreInfo: 'Více informací',
|
||||
@@ -310,7 +310,7 @@ export const cs: Language = {
|
||||
selectCollectionToBrowse: 'Vyberte kolekci pro procházení',
|
||||
selectFile: 'Vyberte soubor',
|
||||
setCropArea: 'Nastavit oblast ořezu',
|
||||
setFocalPoint: 'Nastavit ohnisko',
|
||||
setFocalPoint: 'Nastavit středobod',
|
||||
sizes: 'Velikosti',
|
||||
sizesFor: 'Velikosti pro {{label}}',
|
||||
width: 'Šířka',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use client'
|
||||
import type { ClientCollectionConfig, FieldAffectingData, Where } from 'payload/types'
|
||||
import type { ClientCollectionConfig, Where } from 'payload/types'
|
||||
|
||||
import * as facelessUIImport from '@faceless-ui/window-info'
|
||||
import { getTranslation } from '@payloadcms/translations'
|
||||
import React, { useState } from 'react'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import AnimateHeightImport from 'react-animate-height'
|
||||
|
||||
const AnimateHeight = (AnimateHeightImport.default ||
|
||||
@@ -59,11 +59,22 @@ export const ListControls: React.FC<ListControlsProps> = (props) => {
|
||||
breakpoints: { s: smallBreak },
|
||||
} = useWindowInfo()
|
||||
|
||||
const hasWhereParam = useRef(Boolean(searchParams?.where))
|
||||
|
||||
const shouldInitializeWhereOpened = validateWhereQuery(searchParams?.where)
|
||||
const [visibleDrawer, setVisibleDrawer] = useState<'columns' | 'sort' | 'where'>(
|
||||
shouldInitializeWhereOpened ? 'where' : undefined,
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (hasWhereParam.current && !searchParams?.where) {
|
||||
setVisibleDrawer(undefined)
|
||||
hasWhereParam.current = false
|
||||
} else if (searchParams?.where) {
|
||||
hasWhereParam.current = true
|
||||
}
|
||||
}, [setVisibleDrawer, searchParams?.where])
|
||||
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
<div className={`${baseClass}__wrap`}>
|
||||
@@ -156,6 +167,7 @@ export const ListControls: React.FC<ListControlsProps> = (props) => {
|
||||
<WhereBuilder
|
||||
collectionPluralLabel={collectionConfig?.labels?.plural}
|
||||
collectionSlug={collectionConfig.slug}
|
||||
key={String(hasWhereParam.current && !searchParams?.where)}
|
||||
/>
|
||||
</AnimateHeight>
|
||||
{enableSort && (
|
||||
|
||||
@@ -18,7 +18,7 @@ export type ConfirmPasswordFieldProps = {
|
||||
export const ConfirmPassword: React.FC<ConfirmPasswordFieldProps> = (props) => {
|
||||
const { disabled } = props
|
||||
|
||||
const password = useFormFields<FormField>(([fields]) => fields.password)
|
||||
const password = useFormFields<FormField>(([fields]) => fields?.password)
|
||||
const { t } = useTranslation()
|
||||
|
||||
const validate = useCallback(
|
||||
|
||||
@@ -58,6 +58,7 @@ export const useField = <T,>(options: Options): FieldType<T> => {
|
||||
const showError = valid === false && submitted
|
||||
|
||||
const prevValid = useRef(valid)
|
||||
const prevErrorMessage = useRef(field?.errorMessage)
|
||||
|
||||
// Method to return from `useField`, used to
|
||||
// update field values from field component(s)
|
||||
@@ -175,8 +176,9 @@ export const useField = <T,>(options: Options): FieldType<T> => {
|
||||
|
||||
// Only dispatch if the validation result has changed
|
||||
// This will prevent unnecessary rerenders
|
||||
if (valid !== prevValid.current) {
|
||||
if (valid !== prevValid.current || errorMessage !== prevErrorMessage.current) {
|
||||
prevValid.current = valid
|
||||
prevErrorMessage.current = errorMessage
|
||||
|
||||
const update: UPDATE = {
|
||||
type: 'UPDATE',
|
||||
|
||||
107
pnpm-lock.yaml
generated
107
pnpm-lock.yaml
generated
@@ -170,7 +170,7 @@ importers:
|
||||
version: 9.1.8
|
||||
next:
|
||||
specifier: ^14.3.0-canary.7
|
||||
version: 14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)
|
||||
version: 14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1)
|
||||
node-mocks-http:
|
||||
specifier: ^1.14.1
|
||||
version: 1.14.1
|
||||
@@ -253,8 +253,8 @@ importers:
|
||||
specifier: ^4.7.1
|
||||
version: 4.7.2
|
||||
turbo:
|
||||
specifier: ^1.13.2
|
||||
version: 1.13.2
|
||||
specifier: ^1.13.3
|
||||
version: 1.13.3
|
||||
typescript:
|
||||
specifier: 5.4.5
|
||||
version: 5.4.5
|
||||
@@ -1188,9 +1188,6 @@ importers:
|
||||
lodash.get:
|
||||
specifier: ^4.4.2
|
||||
version: 4.4.2
|
||||
react:
|
||||
specifier: ^18.0.0
|
||||
version: 18.2.0
|
||||
stripe:
|
||||
specifier: ^10.2.0
|
||||
version: 10.17.0
|
||||
@@ -1201,6 +1198,12 @@ importers:
|
||||
'@payloadcms/eslint-config':
|
||||
specifier: workspace:*
|
||||
version: link:../eslint-config-payload
|
||||
'@payloadcms/next':
|
||||
specifier: workspace:*
|
||||
version: link:../next
|
||||
'@payloadcms/translations':
|
||||
specifier: workspace:*
|
||||
version: link:../translations
|
||||
'@types/express':
|
||||
specifier: ^4.17.9
|
||||
version: 4.17.21
|
||||
@@ -1216,12 +1219,6 @@ importers:
|
||||
payload:
|
||||
specifier: workspace:*
|
||||
version: link:../payload
|
||||
prettier:
|
||||
specifier: ^2.7.1
|
||||
version: 2.8.8
|
||||
webpack:
|
||||
specifier: ^5.78.0
|
||||
version: 5.91.0(@swc/core@1.4.13)(esbuild@0.19.12)(webpack-cli@5.1.4)
|
||||
|
||||
packages/richtext-lexical:
|
||||
dependencies:
|
||||
@@ -1485,7 +1482,7 @@ importers:
|
||||
version: 2.3.0
|
||||
next:
|
||||
specifier: ^14.3.0-canary.7
|
||||
version: 14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)
|
||||
version: 14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1)
|
||||
object-to-formdata:
|
||||
specifier: 4.5.1
|
||||
version: 4.5.1
|
||||
@@ -12354,48 +12351,6 @@ packages:
|
||||
/next-tick@1.1.0:
|
||||
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
|
||||
|
||||
/next@14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0):
|
||||
resolution: {integrity: sha512-loPrWTCvHvZgOy3rgL9+2WpxNDxlRNt462ihqm/DUuyK8LUZV1F4H920YTAu1wEiYC8RrpNUbpz8K7KRYAkQiA==}
|
||||
engines: {node: '>=18.17.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@opentelemetry/api': ^1.1.0
|
||||
'@playwright/test': ^1.41.2
|
||||
react: ^18.0.0
|
||||
react-dom: ^18.0.0
|
||||
sass: ^1.3.0
|
||||
peerDependenciesMeta:
|
||||
'@opentelemetry/api':
|
||||
optional: true
|
||||
'@playwright/test':
|
||||
optional: true
|
||||
sass:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@next/env': 14.3.0-canary.7
|
||||
'@playwright/test': 1.43.0
|
||||
'@swc/helpers': 0.5.5
|
||||
busboy: 1.6.0
|
||||
caniuse-lite: 1.0.30001607
|
||||
graceful-fs: 4.2.11
|
||||
postcss: 8.4.31
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.2.0)
|
||||
optionalDependencies:
|
||||
'@next/swc-darwin-arm64': 14.3.0-canary.7
|
||||
'@next/swc-darwin-x64': 14.3.0-canary.7
|
||||
'@next/swc-linux-arm64-gnu': 14.3.0-canary.7
|
||||
'@next/swc-linux-arm64-musl': 14.3.0-canary.7
|
||||
'@next/swc-linux-x64-gnu': 14.3.0-canary.7
|
||||
'@next/swc-linux-x64-musl': 14.3.0-canary.7
|
||||
'@next/swc-win32-arm64-msvc': 14.3.0-canary.7
|
||||
'@next/swc-win32-ia32-msvc': 14.3.0-canary.7
|
||||
'@next/swc-win32-x64-msvc': 14.3.0-canary.7
|
||||
transitivePeerDependencies:
|
||||
- '@babel/core'
|
||||
- babel-plugin-macros
|
||||
|
||||
/next@14.3.0-canary.7(@babel/core@7.24.4)(@playwright/test@1.43.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.74.1):
|
||||
resolution: {integrity: sha512-loPrWTCvHvZgOy3rgL9+2WpxNDxlRNt462ihqm/DUuyK8LUZV1F4H920YTAu1wEiYC8RrpNUbpz8K7KRYAkQiA==}
|
||||
engines: {node: '>=18.17.0'}
|
||||
@@ -12438,7 +12393,6 @@ packages:
|
||||
transitivePeerDependencies:
|
||||
- '@babel/core'
|
||||
- babel-plugin-macros
|
||||
dev: false
|
||||
|
||||
/node-abi@3.57.0:
|
||||
resolution: {integrity: sha512-Dp+A9JWxRaKuHP35H77I4kCKesDy5HUDEmScia2FyncMTOXASMyg251F5PhFoDA5uqBrDDffiLpbqnrZmNXW+g==}
|
||||
@@ -13918,6 +13872,7 @@ packages:
|
||||
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/prettier@3.2.5:
|
||||
resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==}
|
||||
@@ -15788,64 +15743,64 @@ packages:
|
||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
||||
|
||||
/turbo-darwin-64@1.13.2:
|
||||
resolution: {integrity: sha512-CCSuD8CfmtncpohCuIgq7eAzUas0IwSbHfI8/Q3vKObTdXyN8vAo01gwqXjDGpzG9bTEVedD0GmLbD23dR0MLA==}
|
||||
/turbo-darwin-64@1.13.3:
|
||||
resolution: {integrity: sha512-glup8Qx1qEFB5jerAnXbS8WrL92OKyMmg5Hnd4PleLljAeYmx+cmmnsmLT7tpaVZIN58EAAwu8wHC6kIIqhbWA==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo-darwin-arm64@1.13.2:
|
||||
resolution: {integrity: sha512-0HySm06/D2N91rJJ89FbiI/AodmY8B3WDSFTVEpu2+8spUw7hOJ8okWOT0e5iGlyayUP9gr31eOeL3VFZkpfCw==}
|
||||
/turbo-darwin-arm64@1.13.3:
|
||||
resolution: {integrity: sha512-/np2xD+f/+9qY8BVtuOQXRq5f9LehCFxamiQnwdqWm5iZmdjygC5T3uVSYuagVFsZKMvX3ycySwh8dylGTl6lg==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo-linux-64@1.13.2:
|
||||
resolution: {integrity: sha512-7HnibgbqZrjn4lcfIouzlPu8ZHSBtURG4c7Bedu7WJUDeZo+RE1crlrQm8wuwO54S0siYqUqo7GNHxu4IXbioQ==}
|
||||
/turbo-linux-64@1.13.3:
|
||||
resolution: {integrity: sha512-G+HGrau54iAnbXLfl+N/PynqpDwi/uDzb6iM9hXEDG+yJnSJxaHMShhOkXYJPk9offm9prH33Khx2scXrYVW1g==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo-linux-arm64@1.13.2:
|
||||
resolution: {integrity: sha512-sUq4dbpk6SNKg/Hkwn256Vj2AEYSQdG96repio894h5/LEfauIK2QYiC/xxAeW3WBMc6BngmvNyURIg7ltrePg==}
|
||||
/turbo-linux-arm64@1.13.3:
|
||||
resolution: {integrity: sha512-qWwEl5VR02NqRyl68/3pwp3c/olZuSp+vwlwrunuoNTm6JXGLG5pTeme4zoHNnk0qn4cCX7DFrOboArlYxv0wQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo-windows-64@1.13.2:
|
||||
resolution: {integrity: sha512-DqzhcrciWq3dpzllJR2VVIyOhSlXYCo4mNEWl98DJ3FZ08PEzcI3ceudlH6F0t/nIcfSItK1bDP39cs7YoZHEA==}
|
||||
/turbo-windows-64@1.13.3:
|
||||
resolution: {integrity: sha512-Nudr4bRChfJzBPzEmpVV85VwUYRCGKecwkBFpbp2a4NtrJ3+UP1VZES653ckqCu2FRyRuS0n03v9euMbAvzH+Q==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo-windows-arm64@1.13.2:
|
||||
resolution: {integrity: sha512-WnPMrwfCXxK69CdDfS1/j2DlzcKxSmycgDAqV0XCYpK/812KB0KlvsVAt5PjEbZGXkY88pCJ1BLZHAjF5FcbqA==}
|
||||
/turbo-windows-arm64@1.13.3:
|
||||
resolution: {integrity: sha512-ouJCgsVLd3icjRLmRvHQDDZnmGzT64GBupM1Y+TjtYn2LVaEBoV6hicFy8x5DUpnqdLy+YpCzRMkWlwhmkX7sQ==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/turbo@1.13.2:
|
||||
resolution: {integrity: sha512-rX/d9f4MgRT3yK6cERPAkfavIxbpBZowDQpgvkYwGMGDQ0Nvw1nc0NVjruE76GrzXQqoxR1UpnmEP54vBARFHQ==}
|
||||
/turbo@1.13.3:
|
||||
resolution: {integrity: sha512-n17HJv4F4CpsYTvKzUJhLbyewbXjq1oLCi90i5tW1TiWDz16ML1eDG7wi5dHaKxzh5efIM56SITnuVbMq5dk4g==}
|
||||
hasBin: true
|
||||
optionalDependencies:
|
||||
turbo-darwin-64: 1.13.2
|
||||
turbo-darwin-arm64: 1.13.2
|
||||
turbo-linux-64: 1.13.2
|
||||
turbo-linux-arm64: 1.13.2
|
||||
turbo-windows-64: 1.13.2
|
||||
turbo-windows-arm64: 1.13.2
|
||||
turbo-darwin-64: 1.13.3
|
||||
turbo-darwin-arm64: 1.13.3
|
||||
turbo-linux-64: 1.13.3
|
||||
turbo-linux-arm64: 1.13.3
|
||||
turbo-windows-64: 1.13.3
|
||||
turbo-windows-arm64: 1.13.3
|
||||
dev: true
|
||||
|
||||
/type-check@0.4.0:
|
||||
|
||||
@@ -52,7 +52,7 @@ const packageWhitelist = [
|
||||
'plugin-redirects',
|
||||
'plugin-search',
|
||||
'plugin-seo',
|
||||
// 'plugin-stripe',
|
||||
'plugin-stripe',
|
||||
// 'plugin-sentry',
|
||||
]
|
||||
|
||||
|
||||
54
test/admin/components/views/CustomView/index.client.tsx
Normal file
54
test/admin/components/views/CustomView/index.client.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
'use client'
|
||||
import { ConfirmPassword } from '@payloadcms/ui/fields/ConfirmPassword'
|
||||
import { Password } from '@payloadcms/ui/fields/Password'
|
||||
import { Form, useFormFields } from '@payloadcms/ui/forms/Form'
|
||||
import { FormSubmit } from '@payloadcms/ui/forms/Submit'
|
||||
import React from 'react'
|
||||
|
||||
export const ClientForm: React.FC = () => {
|
||||
return (
|
||||
<Form
|
||||
initialState={{
|
||||
'confirm-password': {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
password: {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
}}
|
||||
>
|
||||
<CustomPassword />
|
||||
<ConfirmPassword />
|
||||
|
||||
<FormSubmit>Submit</FormSubmit>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
const CustomPassword: React.FC = () => {
|
||||
const confirmPassword = useFormFields(([fields]) => {
|
||||
return fields['confirm-password']
|
||||
})
|
||||
|
||||
const confirmValue = confirmPassword.value
|
||||
|
||||
return (
|
||||
<Password
|
||||
autoComplete="off"
|
||||
label="Password"
|
||||
name="password"
|
||||
required
|
||||
validate={(value) => {
|
||||
if (value && confirmValue) {
|
||||
return confirmValue === value ? true : 'Passwords must match!!!!'
|
||||
}
|
||||
|
||||
return 'Field is required'
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
import type { AdminViewProps } from 'payload/types'
|
||||
|
||||
import LinkImport from 'next/link.js'
|
||||
import React from 'react'
|
||||
|
||||
import type { AdminViewProps } from '../../../../../packages/payload/types.js'
|
||||
|
||||
const Link = (LinkImport.default || LinkImport) as unknown as typeof LinkImport.default
|
||||
|
||||
import { Button } from '@payloadcms/ui/elements/Button'
|
||||
|
||||
import { customNestedViewPath, customViewTitle } from '../../../shared.js'
|
||||
import { ClientForm } from './index.client.js'
|
||||
|
||||
export const CustomView: React.FC<AdminViewProps> = ({ initPageResult }) => {
|
||||
const {
|
||||
@@ -48,6 +49,7 @@ export const CustomView: React.FC<AdminViewProps> = ({ initPageResult }) => {
|
||||
>
|
||||
Go to Nested View
|
||||
</Button>
|
||||
<ClientForm />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { CollectionConfig } from 'payload/types'
|
||||
|
||||
import { LinkToDoc } from '../../../packages/plugin-stripe/src/ui/LinkToDoc.js'
|
||||
import { LinkToDoc } from '@payloadcms/plugin-stripe'
|
||||
|
||||
import { customersSlug } from '../shared.js'
|
||||
|
||||
export const Customers: CollectionConfig = {
|
||||
@@ -31,13 +32,12 @@ export const Customers: CollectionConfig = {
|
||||
type: 'ui',
|
||||
admin: {
|
||||
components: {
|
||||
Field: (args) =>
|
||||
LinkToDoc({
|
||||
...args,
|
||||
isTestKey: process.env.PAYLOAD_PUBLIC_IS_STRIPE_TEST_KEY === 'true',
|
||||
nameOfIDField: `${args.path}.stripeSubscriptionID`,
|
||||
stripeResourceType: 'subscriptions',
|
||||
}),
|
||||
Field: LinkToDoc,
|
||||
},
|
||||
custom: {
|
||||
isTestKey: process.env.PAYLOAD_PUBLIC_IS_STRIPE_TEST_KEY === 'true',
|
||||
nameOfIDField: `stripeSubscriptionID`,
|
||||
stripeResourceType: 'subscriptions',
|
||||
},
|
||||
},
|
||||
label: 'Link',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import stripePlugin from '@payloadcms/plugin-stripe'
|
||||
import { stripePlugin } from '@payloadcms/plugin-stripe'
|
||||
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
import { devUser } from '../credentials.js'
|
||||
|
||||
Reference in New Issue
Block a user