@payloadcms/plugin-ecommerce 3.57.0-internal.d758c66 → 3.57.0-internal.f26caed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collections/addresses/createAddressesCollection.d.ts +1 -1
- package/dist/collections/addresses/createAddressesCollection.d.ts.map +1 -1
- package/dist/collections/addresses/createAddressesCollection.js.map +1 -1
- package/dist/collections/addresses/defaultCountries.d.ts +1 -1
- package/dist/collections/addresses/defaultCountries.d.ts.map +1 -1
- package/dist/collections/addresses/defaultCountries.js.map +1 -1
- package/dist/collections/addresses/hooks/beforeChange.d.ts +1 -1
- package/dist/collections/addresses/hooks/beforeChange.d.ts.map +1 -1
- package/dist/collections/addresses/hooks/beforeChange.js.map +1 -1
- package/dist/collections/carts/createCartsCollection.d.ts +1 -1
- package/dist/collections/carts/createCartsCollection.d.ts.map +1 -1
- package/dist/collections/carts/createCartsCollection.js.map +1 -1
- package/dist/collections/orders/createOrdersCollection.d.ts +1 -1
- package/dist/collections/orders/createOrdersCollection.d.ts.map +1 -1
- package/dist/collections/orders/createOrdersCollection.js.map +1 -1
- package/dist/collections/products/createProductsCollection.d.ts +1 -1
- package/dist/collections/products/createProductsCollection.d.ts.map +1 -1
- package/dist/collections/products/createProductsCollection.js.map +1 -1
- package/dist/collections/transactions/createTransactionsCollection.d.ts +1 -1
- package/dist/collections/transactions/createTransactionsCollection.d.ts.map +1 -1
- package/dist/collections/transactions/createTransactionsCollection.js.map +1 -1
- package/dist/collections/variants/createVariantOptionsCollection.d.ts +1 -1
- package/dist/collections/variants/createVariantOptionsCollection.d.ts.map +1 -1
- package/dist/collections/variants/createVariantOptionsCollection.js.map +1 -1
- package/dist/collections/variants/createVariantTypesCollection.d.ts +1 -1
- package/dist/collections/variants/createVariantTypesCollection.d.ts.map +1 -1
- package/dist/collections/variants/createVariantTypesCollection.js.map +1 -1
- package/dist/collections/variants/createVariantsCollection/index.d.ts +1 -1
- package/dist/collections/variants/createVariantsCollection/index.d.ts.map +1 -1
- package/dist/collections/variants/createVariantsCollection/index.js.map +1 -1
- package/dist/currencies/index.d.ts +1 -1
- package/dist/currencies/index.d.ts.map +1 -1
- package/dist/currencies/index.js.map +1 -1
- package/dist/endpoints/confirmOrder.d.ts +1 -1
- package/dist/endpoints/confirmOrder.d.ts.map +1 -1
- package/dist/endpoints/confirmOrder.js.map +1 -1
- package/dist/endpoints/initiatePayment.d.ts +1 -1
- package/dist/endpoints/initiatePayment.d.ts.map +1 -1
- package/dist/endpoints/initiatePayment.js.map +1 -1
- package/dist/exports/types.d.ts +1 -1
- package/dist/exports/types.d.ts.map +1 -1
- package/dist/exports/types.js.map +1 -1
- package/dist/fields/amountField.d.ts +1 -1
- package/dist/fields/amountField.d.ts.map +1 -1
- package/dist/fields/amountField.js.map +1 -1
- package/dist/fields/cartItemsField.d.ts +1 -1
- package/dist/fields/cartItemsField.d.ts.map +1 -1
- package/dist/fields/cartItemsField.js.map +1 -1
- package/dist/fields/currencyField.d.ts +1 -1
- package/dist/fields/currencyField.d.ts.map +1 -1
- package/dist/fields/currencyField.js.map +1 -1
- package/dist/fields/pricesField.d.ts +1 -1
- package/dist/fields/pricesField.d.ts.map +1 -1
- package/dist/fields/pricesField.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -13
- package/dist/index.js.map +1 -1
- package/dist/payments/adapters/stripe/confirmOrder.d.ts +1 -1
- package/dist/payments/adapters/stripe/confirmOrder.d.ts.map +1 -1
- package/dist/payments/adapters/stripe/confirmOrder.js.map +1 -1
- package/dist/payments/adapters/stripe/index.d.ts +1 -1
- package/dist/payments/adapters/stripe/index.d.ts.map +1 -1
- package/dist/payments/adapters/stripe/index.js.map +1 -1
- package/dist/payments/adapters/stripe/initiatePayment.d.ts +1 -1
- package/dist/payments/adapters/stripe/initiatePayment.d.ts.map +1 -1
- package/dist/payments/adapters/stripe/initiatePayment.js.map +1 -1
- package/dist/react/provider/index.d.ts +10 -15
- package/dist/react/provider/index.d.ts.map +1 -1
- package/dist/react/provider/index.js +22 -21
- package/dist/react/provider/index.js.map +1 -1
- package/dist/react/provider/types.d.ts +172 -0
- package/dist/react/provider/types.d.ts.map +1 -0
- package/dist/react/provider/types.js +3 -0
- package/dist/react/provider/types.js.map +1 -0
- package/dist/react/provider/utilities.d.ts +1 -1
- package/dist/react/provider/utilities.d.ts.map +1 -1
- package/dist/react/provider/utilities.js.map +1 -1
- package/dist/{types/index.d.ts → types.d.ts} +2 -177
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/PriceCell/index.d.ts +1 -1
- package/dist/ui/PriceCell/index.d.ts.map +1 -1
- package/dist/ui/PriceCell/index.js.map +1 -1
- package/dist/ui/PriceInput/FormattedInput.d.ts +1 -1
- package/dist/ui/PriceInput/FormattedInput.d.ts.map +1 -1
- package/dist/ui/PriceInput/FormattedInput.js.map +1 -1
- package/dist/ui/PriceInput/index.d.ts +1 -1
- package/dist/ui/PriceInput/index.d.ts.map +1 -1
- package/dist/ui/PriceInput/index.js.map +1 -1
- package/dist/ui/PriceRowLabel/index.d.ts +1 -1
- package/dist/ui/PriceRowLabel/index.d.ts.map +1 -1
- package/dist/ui/PriceRowLabel/index.js.map +1 -1
- package/dist/ui/utilities.d.ts +1 -1
- package/dist/ui/utilities.d.ts.map +1 -1
- package/dist/ui/utilities.js.map +1 -1
- package/dist/utilities/defaultProductsValidation.d.ts +1 -1
- package/dist/utilities/defaultProductsValidation.d.ts.map +1 -1
- package/dist/utilities/defaultProductsValidation.js.map +1 -1
- package/dist/utilities/getCollectionSlugMap.d.ts +1 -1
- package/dist/utilities/getCollectionSlugMap.d.ts.map +1 -1
- package/dist/utilities/getCollectionSlugMap.js +4 -5
- package/dist/utilities/getCollectionSlugMap.js.map +1 -1
- package/dist/utilities/sanitizePluginConfig.d.ts +1 -1
- package/dist/utilities/sanitizePluginConfig.d.ts.map +1 -1
- package/dist/utilities/sanitizePluginConfig.js.map +1 -1
- package/package.json +9 -10
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/utilities.d.ts +0 -36
- package/dist/types/utilities.d.ts.map +0 -1
- package/dist/types/utilities.js +0 -3
- package/dist/types/utilities.js.map +0 -1
- package/dist/utilities/pushTypeScriptProperties.d.ts +0 -10
- package/dist/utilities/pushTypeScriptProperties.d.ts.map +0 -1
- package/dist/utilities/pushTypeScriptProperties.js +0 -40
- package/dist/utilities/pushTypeScriptProperties.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,eAAe,EACf,KAAK,EACN,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE;IAAE,aAAa,EAAE,KAAK,EAAE,CAAA;CAAE,KAAK,KAAK,EAAE,CAAA;AAE1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE;IACtC,iBAAiB,EAAE,gBAAgB,CAAA;CACpC,KAAK,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAElD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,qBAAqB,CAAA;IACzB,OAAO,EAAE,qBAAqB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;IAC5D,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,qBAAqB,GAAG,eAAe,CAAC,UAA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
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n Access,\n CollectionConfig,\n DefaultDocumentIDType,\n Endpoint,\n Field,\n FieldAccess,\n GroupField,\n PayloadRequest,\n PopulateType,\n SelectType,\n TypedCollection,\n Where,\n} from 'payload'\nimport type React from 'react'\n\nimport type { TypedEcommerce } from './utilities.js'\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type CollectionOverride = (args: {\n defaultCollection: CollectionConfig\n}) => CollectionConfig | Promise<CollectionConfig>\n\nexport type CartItem = {\n id: DefaultDocumentIDType\n product: DefaultDocumentIDType | TypedCollection['products']\n quantity: number\n variant?: DefaultDocumentIDType | TypedCollection['variants']\n}\n\ntype DefaultCartType = {\n currency?: string\n customer?: DefaultDocumentIDType | TypedCollection['customers']\n id: DefaultDocumentIDType\n items: CartItem[]\n subtotal?: number\n}\n\nexport type Cart = DefaultCartType\n\ntype InitiatePaymentReturnType = {\n /**\n * Allows for additional data to be returned, such as payment method specific data\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n message: string\n}\n\ntype InitiatePayment = (args: {\n /**\n * The slug of the customers collection, defaults to 'users'.\n */\n customersSlug?: string\n data: {\n /**\n * Billing address for the payment.\n */\n billingAddress: TypedCollection['addresses']\n /**\n * Cart items.\n */\n cart: Cart\n /**\n * Currency code to use for the payment.\n */\n currency: string\n customerEmail: string\n /**\n * Shipping address for the payment.\n */\n shippingAddress?: TypedCollection['addresses']\n }\n req: PayloadRequest\n /**\n * The slug of the transactions collection, defaults to 'transactions'.\n * For example, this is used to create a record of the payment intent in the transactions collection.\n */\n transactionsSlug: string\n}) => InitiatePaymentReturnType | Promise<InitiatePaymentReturnType>\n\ntype ConfirmOrderReturnType = {\n /**\n * Allows for additional data to be returned, such as payment method specific data\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any\n message: string\n orderID: DefaultDocumentIDType\n transactionID: DefaultDocumentIDType\n}\n\ntype ConfirmOrder = (args: {\n /**\n * The slug of the carts collection, defaults to 'carts'.\n * For example, this is used to retrieve the cart for the order.\n */\n cartsSlug?: string\n /**\n * The slug of the customers collection, defaults to 'users'.\n */\n customersSlug?: string\n /**\n * Data made available to the payment method when confirming an order. You should get the cart items from the transaction.\n */\n data: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any // Allows for additional data to be passed through, such as payment method specific data\n customerEmail?: string\n }\n /**\n * The slug of the orders collection, defaults to 'orders'.\n */\n ordersSlug?: string\n req: PayloadRequest\n /**\n * The slug of the transactions collection, defaults to 'transactions'.\n * For example, this is used to create a record of the payment intent in the transactions collection.\n */\n transactionsSlug?: string\n}) => ConfirmOrderReturnType | Promise<ConfirmOrderReturnType>\n\n/**\n * The full payment adapter config expected as part of the config for the Ecommerce plugin.\n *\n * You can insert this type directly or return it from a function constructing it.\n */\nexport type PaymentAdapter = {\n /**\n * The function that is called via the `/api/payments/{provider_name}/confirm-order` endpoint to confirm an order after a payment has been made.\n *\n * You should handle the order confirmation logic here.\n *\n * @example\n *\n * ```ts\n * const confirmOrder: ConfirmOrder = async ({ data: { customerEmail }, ordersSlug, req, transactionsSlug }) => {\n // Confirm the payment with Stripe or another payment provider here\n // Create an order in the orders collection here\n // Update the record of the payment intent in the transactions collection here\n return {\n message: 'Order confirmed successfully',\n orderID: 'order_123',\n transactionID: 'txn_123',\n // Include any additional data required for the payment method here\n }\n }\n * ```\n */\n confirmOrder: ConfirmOrder\n /**\n * An array of endpoints to be bootstrapped to Payload's API in order to support the payment method. All API paths are relative to `/api/payments/{provider_name}`.\n *\n * So for example, path `/webhooks` in the Stripe adapter becomes `/api/payments/stripe/webhooks`.\n *\n * @example '/webhooks'\n */\n endpoints?: Endpoint[]\n /**\n * A group configuration to be used in the admin interface to display the payment method.\n *\n * @example\n *\n * ```ts\n * const groupField: GroupField = {\n name: 'stripe',\n type: 'group',\n admin: {\n condition: (data) => data?.paymentMethod === 'stripe',\n },\n fields: [\n {\n name: 'stripeCustomerID',\n type: 'text',\n label: 'Stripe Customer ID',\n required: true,\n },\n {\n name: 'stripePaymentIntentID',\n type: 'text',\n label: 'Stripe PaymentIntent ID',\n required: true,\n },\n ],\n }\n * ```\n */\n group: GroupField\n /**\n * The function that is called via the `/api/payments/{provider_name}/initiate` endpoint to initiate a payment for an order.\n *\n * You should handle the payment initiation logic here.\n *\n * @example\n *\n * ```ts\n * const initiatePayment: InitiatePayment = async ({ data: { cart, currency, customerEmail, billingAddress, shippingAddress }, req, transactionsSlug }) => {\n // Create a payment intent with Stripe or another payment provider here\n // Create a record of the payment intent in the transactions collection here\n return {\n message: 'Payment initiated successfully',\n // Include any additional data required for the payment method here\n }\n }\n * ```\n */\n initiatePayment: InitiatePayment\n /**\n * The label of the payment method\n * @example\n * 'Bank Transfer'\n */\n label?: string\n /**\n * The name of the payment method\n * @example 'stripe'\n */\n name: string\n}\n\nexport type PaymentAdapterClient = {\n confirmOrder: boolean\n initiatePayment: boolean\n} & Pick<PaymentAdapter, 'label' | 'name'>\n\nexport type Currency = {\n /**\n * The ISO 4217 currency code\n * @example 'usd'\n */\n code: string\n /**\n * The number of decimal places the currency uses\n * @example 2\n */\n decimals: number\n /**\n * A user friendly name for the currency.\n *\n * @example 'US Dollar'\n */\n label: string\n /**\n * The symbol of the currency\n * @example '$'\n */\n symbol: string\n}\n\n/**\n * Commonly used arguments for a Payment Adapter function, it's use is entirely optional.\n */\nexport type PaymentAdapterArgs = {\n /**\n * Overrides the default fields of the collection. Affects the payment fields on collections such as transactions.\n */\n groupOverrides?: { fields?: FieldsOverride } & Partial<Omit<GroupField, 'fields'>>\n /**\n * The visually readable label for the payment method.\n * @example 'Bank Transfer'\n */\n label?: string\n}\n\n/**\n * Commonly used arguments for a Payment Adapter function, it's use is entirely optional.\n */\nexport type PaymentAdapterClientArgs = {\n /**\n * The visually readable label for the payment method.\n * @example 'Bank Transfer'\n */\n label?: string\n}\n\nexport type VariantsConfig = {\n /**\n * Override the default variants collection. If you override the collection, you should ensure it has the required fields for variants or re-use the default fields.\n *\n * @example\n *\n * ```ts\n * variants: {\n variantOptionsCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'customField',\n label: 'Custom Field',\n type: 'text',\n },\n ],\n })\n }\n ```\n */\n variantOptionsCollectionOverride?: CollectionOverride\n /**\n * Override the default variants collection. If you override the collection, you should ensure it has the required fields for variants or re-use the default fields.\n *\n * @example\n *\n * ```ts\n * variants: {\n variantsCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'customField',\n label: 'Custom Field',\n type: 'text',\n },\n ],\n })\n }\n ```\n */\n variantsCollectionOverride?: CollectionOverride\n /**\n * Override the default variants collection. If you override the collection, you should ensure it has the required fields for variants or re-use the default fields.\n *\n * @example\n *\n * ```ts\n * variants: {\n variantTypesCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'customField',\n label: 'Custom Field',\n type: 'text',\n },\n ],\n })\n }\n ```\n */\n variantTypesCollectionOverride?: CollectionOverride\n}\n\nexport type ProductsConfig = {\n /**\n * Override the default products collection. If you override the collection, you should ensure it has the required fields for products or re-use the default fields.\n *\n * @example\n *\n * ```ts\n products: {\n productsCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'notes',\n label: 'Notes',\n type: 'textarea',\n },\n ],\n })\n }\n ```\n */\n productsCollectionOverride?: CollectionOverride\n /**\n * Customise the validation used for checking products or variants before a transaction is created or a payment can be confirmed.\n */\n validation?: ProductsValidation\n /**\n * Enable variants and provide configuration for the variant collections.\n *\n * Defaults to true.\n */\n variants?: boolean | VariantsConfig\n}\n\nexport type OrdersConfig = {\n /**\n * Override the default orders collection. If you override the collection, you should ensure it has the required fields for orders or re-use the default fields.\n *\n * @example\n *\n * ```ts\n orders: {\n ordersCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'notes',\n label: 'Notes',\n type: 'textarea',\n },\n ],\n })\n }\n ```\n */\n ordersCollectionOverride?: CollectionOverride\n}\n\nexport type TransactionsConfig = {\n /**\n * Override the default transactions collection. If you override the collection, you should ensure it has the required fields for transactions or re-use the default fields.\n *\n * @example\n *\n * ```ts\n transactions: {\n transactionsCollectionOverride: ({ defaultCollection }) => ({\n ...defaultCollection,\n fields: [\n ...defaultCollection.fields,\n {\n name: 'notes',\n label: 'Notes',\n type: 'textarea',\n },\n ],\n })\n }\n ```\n */\n transactionsCollectionOverride?: CollectionOverride\n}\n\nexport type CustomQuery = {\n depth?: number\n select?: SelectType\n where?: Where\n}\n\nexport type PaymentsConfig = {\n paymentMethods?: PaymentAdapter[]\n productsQuery?: CustomQuery\n variantsQuery?: CustomQuery\n}\n\nexport type CountryType = {\n /**\n * A user friendly name for the country.\n */\n label: string\n /**\n * The ISO 3166-1 alpha-2 country code.\n * @example 'US'\n */\n value: string\n}\n\n/**\n * Configuration for the addresses used by the Ecommerce plugin. Use this to override the default collection or fields used throughout\n */\ntype AddressesConfig = {\n /**\n * Override the default addresses collection. If you override the collection, you should ensure it has the required fields for addresses or re-use the default fields.\n *\n * @example\n * ```ts\n * addressesCollectionOverride: (defaultCollection) => {\n * return {\n * ...defaultCollection,\n * fields: [\n * ...defaultCollection.fields,\n * // add custom fields here\n * ],\n * }\n * }\n * ```\n */\n addressesCollectionOverride?: CollectionOverride\n /**\n * These fields will be applied to all locations where addresses are used, such as Orders and Transactions. Preferred use over the collectionOverride config.\n */\n addressFields?: FieldsOverride\n /**\n * Provide an array of countries to support for addresses. This will be used in the admin interface to provide a select field of countries.\n *\n * Defaults to a set of commonly used countries.\n *\n * @example\n * ```\n * [\n { label: 'United States', value: 'US' },\n { label: 'Canada', value: 'CA' },\n ]\n */\n supportedCountries?: CountryType[]\n}\n\nexport type CustomersConfig = {\n /**\n * Slug of the customers collection, defaults to 'users'.\n * This is used to link carts and orders to customers.\n */\n slug: string\n}\n\nexport type CartsConfig = {\n cartsCollectionOverride?: CollectionOverride\n}\n\nexport type InventoryConfig = {\n /**\n * Override the default field used to track inventory levels. Defaults to 'inventory'.\n */\n fieldName?: string\n}\n\nexport type CurrenciesConfig = {\n /**\n * Defaults to the first supported currency.\n *\n * @example 'USD'\n */\n defaultCurrency: string\n /**\n *\n */\n supportedCurrencies: Currency[]\n}\n\n/**\n * A function that validates a product or variant before a transaction is created or completed.\n * This should throw an error if validation fails as it will be caught by the function calling it.\n */\nexport type ProductsValidation = (args: {\n /**\n * The full currencies config, allowing you to check against supported currencies and their settings.\n */\n currenciesConfig?: CurrenciesConfig\n /**\n * The ISO 4217 currency code being usen in this transaction.\n */\n currency?: string\n /**\n * The full product data.\n */\n product: TypedCollection['products']\n /**\n * Quantity to check the inventory amount against.\n */\n quantity: number\n /**\n * The full variant data, if a variant was selected for the product otherwise it will be undefined.\n */\n variant?: TypedCollection['variants']\n}) => Promise<void> | void\n\n/**\n * A map of collection slugs used by the Ecommerce plugin.\n * Provides an easy way to track the slugs of collections even when they are overridden.\n */\nexport type CollectionSlugMap = {\n addresses: string\n carts: string\n customers: string\n orders: string\n products: string\n transactions: string\n variantOptions: string\n variants: string\n variantTypes: string\n}\n\n/**\n * Access control functions used throughout the Ecommerce plugin.\n * You must provide these when configuring the plugin.\n *\n * @example\n *\n * ```ts\n * access: {\n adminOnly,\n adminOnlyFieldAccess,\n adminOrCustomerOwner,\n adminOrPublishedStatus,\n customerOnlyFieldAccess,\n }\n ```\n */\nexport type AccessConfig = {\n /**\n * Limited to only admin users.\n */\n adminOnly: Access\n /**\n * Limited to only admin users, specifically for Field level access control.\n */\n adminOnlyFieldAccess: FieldAccess\n /**\n * Is the owner of the document via the `customer` field or is an admin.\n */\n adminOrCustomerOwner: Access\n /**\n * The document status is published or user is admin.\n */\n adminOrPublishedStatus: Access\n /**\n * Authenticated users only. Defaults to the example function.\n *\n * @example\n * anyUser: ({ req }) => !!req?.user\n */\n authenticatedOnly?: Access\n /**\n * Limited to customers only, specifically for Field level access control.\n */\n customerOnlyFieldAccess: FieldAccess\n /**\n * Entirely public access. Defaults to the example function.\n *\n * @example\n * publicAccess: () => true\n */\n publicAccess?: Access\n}\n\nexport type EcommercePluginConfig = {\n /**\n * Customise the access control for the plugin.\n *\n * @example\n * ```ts\n * ```\n */\n access: AccessConfig\n /**\n * Enable the addresses collection to allow customers, transactions and orders to have multiple addresses for shipping and billing. Accepts an override to customise the addresses collection.\n * Defaults to supporting a default set of countries.\n */\n addresses?: AddressesConfig | boolean\n /**\n * Configure the target collection used for carts.\n *\n * Defaults to true.\n */\n carts?: boolean | CartsConfig\n /**\n * Configure supported currencies and default settings.\n *\n * Defaults to supporting USD.\n */\n currencies?: CurrenciesConfig\n /**\n * Configure the target collection used for customers.\n *\n * @example\n * ```ts\n * customers: {\n * slug: 'users', // default\n * }\n *\n */\n customers: CustomersConfig\n /**\n * Enable tracking of inventory for products and variants. Accepts a config object to override the default collection settings.\n *\n * Defaults to true.\n */\n inventory?: boolean | InventoryConfig\n /**\n * Enables orders and accepts a config object to override the default collection settings.\n *\n * Defaults to true.\n */\n orders?: boolean | OrdersConfig\n /**\n * Enable tracking of payments. Accepts a config object to override the default collection settings.\n *\n * Defaults to true when the paymentMethods array is provided.\n */\n payments?: PaymentsConfig\n /**\n * Enables products and variants. Accepts a config object to override the product collection and each variant collection type.\n *\n * Defaults to true.\n */\n products?: boolean | ProductsConfig\n /**\n * Override the default slugs used across the plugin. This lets the plugin know which slugs to use for various internal operations and fields.\n */\n slugMap?: Partial<CollectionSlugMap>\n /**\n * Enable tracking of transactions. Accepts a config object to override the default collection settings.\n *\n * Defaults to true when the paymentMethods array is provided.\n */\n transactions?: boolean | TransactionsConfig\n}\n\nexport type SanitizedEcommercePluginConfig = {\n access: Required<AccessConfig>\n addresses: { addressFields: Field[] } & Omit<AddressesConfig, 'addressFields'>\n currencies: Required<CurrenciesConfig>\n inventory?: InventoryConfig\n payments: {\n paymentMethods: [] | PaymentAdapter[]\n }\n} & Omit<\n Required<EcommercePluginConfig>,\n 'access' | 'addresses' | 'currencies' | 'inventory' | 'payments'\n>\n\nexport type EcommerceCollections = TypedEcommerce['collections']\n\nexport type AddressesCollection = EcommerceCollections['addresses']\nexport type CartsCollection = EcommerceCollections['carts']\n\nexport type SyncLocalStorageConfig = {\n /**\n * Key to use for localStorage.\n * Defaults to 'cart'.\n */\n key?: string\n}\n\ntype APIProps = {\n /**\n * The route for the Payload API, defaults to `/api`.\n */\n apiRoute?: string\n /**\n * Customise the query used to fetch carts. Use this when you need to fetch additional data and optimise queries using depth, select and populate.\n *\n * Defaults to `{ depth: 0 }`.\n */\n cartsFetchQuery?: {\n depth?: number\n populate?: PopulateType\n select?: SelectType\n }\n /**\n * The route for the Payload API, defaults to ``. Eg for a Payload app running on `http://localhost:3000`, the default serverURL would be `http://localhost:3000`.\n */\n serverURL?: string\n}\n\nexport type ContextProps = {\n /**\n * The slug for the addresses collection.\n *\n * Defaults to 'addresses'.\n */\n addressesSlug?: string\n api?: APIProps\n /**\n * The slug for the carts collection.\n *\n * Defaults to 'carts'.\n */\n cartsSlug?: string\n children?: React.ReactNode\n /**\n * The configuration for currencies used in the ecommerce context.\n * This is used to handle currency formatting and calculations, defaults to USD.\n */\n currenciesConfig?: CurrenciesConfig\n /**\n * The slug for the customers collection.\n *\n * Defaults to 'users'.\n */\n customersSlug?: string\n /**\n * Enable debug mode for the ecommerce context. This will log additional information to the console.\n * Defaults to false.\n */\n debug?: boolean\n /**\n * Whether to enable support for variants in the cart.\n * This allows adding products with specific variants to the cart.\n * Defaults to false.\n */\n enableVariants?: boolean\n /**\n * Supported payment methods for the ecommerce context.\n */\n paymentMethods?: PaymentAdapterClient[]\n /**\n * Whether to enable localStorage for cart persistence.\n * Defaults to true.\n */\n syncLocalStorage?: boolean | SyncLocalStorageConfig\n}\n\n/**\n * Type used internally to represent the cart item to be added.\n */\ntype CartItemArgument = {\n /**\n * The ID of the product to add to the cart. Always required.\n */\n product: DefaultDocumentIDType\n /**\n * The ID of the variant to add to the cart. Optional, if not provided, the product will be added without a variant.\n */\n variant?: DefaultDocumentIDType\n}\n\nexport type EcommerceContextType<T extends EcommerceCollections = EcommerceCollections> = {\n /**\n * Add an item to the cart.\n */\n addItem: (item: CartItemArgument, quantity?: number) => Promise<void>\n /**\n * All current addresses for the current user.\n * This is used to manage shipping and billing addresses.\n */\n addresses?: T['addresses'][]\n /**\n * The current data of the cart.\n */\n cart?: T['addresses']\n /**\n * The ID of the current cart corresponding to the cart in the database or local storage.\n */\n cartID?: DefaultDocumentIDType\n /**\n * Clear the cart, removing all items.\n */\n clearCart: () => Promise<void>\n /**\n * Initiate a payment using the selected payment method.\n * This method should be called after the cart is ready for checkout.\n * It requires the payment method ID and any necessary payment data.\n */\n confirmOrder: (\n paymentMethodID: string,\n options?: { additionalData: Record<string, unknown> },\n ) => Promise<unknown>\n /**\n * Create a new address by providing the data.\n */\n createAddress: (data: Partial<T['addresses']>) => Promise<void>\n /**\n * The configuration for the currencies used in the ecommerce context.\n */\n currenciesConfig: CurrenciesConfig\n /**\n * The currently selected currency used for the cart and price formatting automatically.\n */\n currency: Currency\n /**\n * Decrement an item in the cart by its index ID.\n * If quantity reaches 0, the item will be removed from the cart.\n */\n decrementItem: (item: DefaultDocumentIDType) => Promise<void>\n /**\n * Increment an item in the cart by its index ID.\n */\n incrementItem: (item: DefaultDocumentIDType) => Promise<void>\n /**\n * Initiate a payment using the selected payment method.\n * This method should be called after the cart is ready for checkout.\n * It requires the payment method ID and any necessary payment data.\n */\n initiatePayment: (\n paymentMethodID: string,\n options?: { additionalData: Record<string, unknown> },\n ) => Promise<unknown>\n paymentMethods: PaymentAdapterClient[]\n /**\n * Remove an item from the cart by its index ID.\n */\n removeItem: (item: DefaultDocumentIDType) => Promise<void>\n /**\n * The name of the currently selected payment method.\n * This is used to determine which payment method to use when initiating a payment.\n */\n selectedPaymentMethod?: null | string\n /**\n * Change the currency for the cart, it defaults to the configured currency.\n * This will update the currency used for pricing and calculations.\n */\n setCurrency: (currency: string) => void\n /**\n * Update an address by providing the data and the ID.\n */\n updateAddress: (addressID: DefaultDocumentIDType, data: Partial<T['addresses']>) => Promise<void>\n}\n"],"names":[],"mappings":"AAoyBA,WAgFC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DefaultDocumentIDType, GeneratedTypes } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* THIS FILE IS EXTREMELY SENSITIVE PLEASE BE CAREFUL AS THERE IS EVIL AT PLAY
|
|
4
|
-
*
|
|
5
|
-
* This file is used to extract the types for the ecommerce plugin
|
|
6
|
-
* from the user's generated types. It must be kept as a .ts file
|
|
7
|
-
* and not a .tsx file, and it must not import any other files
|
|
8
|
-
* that are not strictly types. This is to prevent circular
|
|
9
|
-
* dependencies and to ensure that the types are always available.
|
|
10
|
-
*
|
|
11
|
-
* Do not add any runtime code to this file.
|
|
12
|
-
*/
|
|
13
|
-
type CartsUntyped = {
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
id: DefaultDocumentIDType;
|
|
16
|
-
items?: any[];
|
|
17
|
-
subtotal?: number;
|
|
18
|
-
};
|
|
19
|
-
type AddressesUntyped = {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
id: DefaultDocumentIDType;
|
|
22
|
-
};
|
|
23
|
-
type ResolveEcommerceType<T> = 'ecommerce' extends keyof T ? T['ecommerce'] : T['ecommerceUntyped'];
|
|
24
|
-
export type TypedEcommerce = ResolveEcommerceType<GeneratedTypes>;
|
|
25
|
-
declare module 'payload' {
|
|
26
|
-
interface GeneratedTypes {
|
|
27
|
-
ecommerceUntyped: {
|
|
28
|
-
collections: {
|
|
29
|
-
addresses: AddressesUntyped;
|
|
30
|
-
carts: CartsUntyped;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../src/types/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEpE;;;;;;;;;;GAUG;AAEH,KAAK,YAAY,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;IAClB,EAAE,EAAE,qBAAqB,CAAA;IACzB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;IAClB,EAAE,EAAE,qBAAqB,CAAA;CAC1B,CAAA;AAED,KAAK,oBAAoB,CAAC,CAAC,IAAI,WAAW,SAAS,MAAM,CAAC,GACtD,CAAC,CAAC,WAAW,CAAC,GAEd,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAEzB,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAA;AAEjE,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,cAAc;QAC7B,gBAAgB,EAAE;YAChB,WAAW,EAAE;gBACX,SAAS,EAAE,gBAAgB,CAAA;gBAC3B,KAAK,EAAE,YAAY,CAAA;aACpB,CAAA;SACF,CAAA;KACF;CACF"}
|
package/dist/types/utilities.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/utilities.ts"],"sourcesContent":["import type { DefaultDocumentIDType, GeneratedTypes } from 'payload'\n\n/**\n * THIS FILE IS EXTREMELY SENSITIVE PLEASE BE CAREFUL AS THERE IS EVIL AT PLAY\n *\n * This file is used to extract the types for the ecommerce plugin\n * from the user's generated types. It must be kept as a .ts file\n * and not a .tsx file, and it must not import any other files\n * that are not strictly types. This is to prevent circular\n * dependencies and to ensure that the types are always available.\n *\n * Do not add any runtime code to this file.\n */\n\ntype CartsUntyped = {\n [key: string]: any\n id: DefaultDocumentIDType\n items?: any[]\n subtotal?: number\n}\n\ntype AddressesUntyped = {\n [key: string]: any\n id: DefaultDocumentIDType\n}\n\ntype ResolveEcommerceType<T> = 'ecommerce' extends keyof T\n ? T['ecommerce']\n : // @ts-expect-error - typescript doesnt play nice here\n T['ecommerceUntyped']\n\nexport type TypedEcommerce = ResolveEcommerceType<GeneratedTypes>\n\ndeclare module 'payload' {\n export interface GeneratedTypes {\n ecommerceUntyped: {\n collections: {\n addresses: AddressesUntyped\n carts: CartsUntyped\n }\n }\n }\n}\n"],"names":[],"mappings":"AA+BA,WAAiE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema4 } from 'json-schema';
|
|
2
|
-
import type { SanitizedConfig } from 'payload';
|
|
3
|
-
import type { CollectionSlugMap, SanitizedEcommercePluginConfig } from '../types/index.js';
|
|
4
|
-
export declare const pushTypeScriptProperties: ({ collectionSlugMap, jsonSchema, }: {
|
|
5
|
-
collectionSlugMap: CollectionSlugMap;
|
|
6
|
-
config: SanitizedConfig;
|
|
7
|
-
jsonSchema: JSONSchema4;
|
|
8
|
-
sanitizedPluginConfig: SanitizedEcommercePluginConfig;
|
|
9
|
-
}) => JSONSchema4;
|
|
10
|
-
//# sourceMappingURL=pushTypeScriptProperties.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pushTypeScriptProperties.d.ts","sourceRoot":"","sources":["../../src/utilities/pushTypeScriptProperties.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAA;AAE1F,eAAO,MAAM,wBAAwB,uCAGlC;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,EAAE,WAAW,CAAA;IACvB,qBAAqB,EAAE,8BAA8B,CAAA;CACtD,KAAG,WAoCH,CAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const pushTypeScriptProperties = ({ collectionSlugMap, jsonSchema })=>{
|
|
2
|
-
if (!jsonSchema.properties) {
|
|
3
|
-
jsonSchema.properties = {};
|
|
4
|
-
}
|
|
5
|
-
if (Array.isArray(jsonSchema.required)) {
|
|
6
|
-
jsonSchema.required.push('ecommerce');
|
|
7
|
-
}
|
|
8
|
-
const requiredCollectionProperties = [];
|
|
9
|
-
const propertiesMap = new Map();
|
|
10
|
-
Object.entries(collectionSlugMap).forEach(([key, slug])=>{
|
|
11
|
-
propertiesMap.set(key, {
|
|
12
|
-
$ref: `#/definitions/${slug}`
|
|
13
|
-
});
|
|
14
|
-
requiredCollectionProperties.push(slug);
|
|
15
|
-
});
|
|
16
|
-
console.log({
|
|
17
|
-
collectionSlugMap,
|
|
18
|
-
propertiesMap
|
|
19
|
-
});
|
|
20
|
-
jsonSchema.properties.ecommerce = {
|
|
21
|
-
type: 'object',
|
|
22
|
-
additionalProperties: false,
|
|
23
|
-
properties: {
|
|
24
|
-
collections: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
additionalProperties: false,
|
|
27
|
-
properties: {
|
|
28
|
-
...Object.fromEntries(propertiesMap)
|
|
29
|
-
},
|
|
30
|
-
required: requiredCollectionProperties
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
required: [
|
|
34
|
-
'collections'
|
|
35
|
-
]
|
|
36
|
-
};
|
|
37
|
-
return jsonSchema;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=pushTypeScriptProperties.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/pushTypeScriptProperties.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { SanitizedConfig } from 'payload'\n\nimport type { CollectionSlugMap, SanitizedEcommercePluginConfig } from '../types/index.js'\n\nexport const pushTypeScriptProperties = ({\n collectionSlugMap,\n jsonSchema,\n}: {\n collectionSlugMap: CollectionSlugMap\n config: SanitizedConfig\n jsonSchema: JSONSchema4\n sanitizedPluginConfig: SanitizedEcommercePluginConfig\n}): JSONSchema4 => {\n if (!jsonSchema.properties) {\n jsonSchema.properties = {}\n }\n\n if (Array.isArray(jsonSchema.required)) {\n jsonSchema.required.push('ecommerce')\n }\n\n const requiredCollectionProperties: string[] = []\n const propertiesMap = new Map<string, { $ref: string }>()\n\n Object.entries(collectionSlugMap).forEach(([key, slug]) => {\n propertiesMap.set(key, { $ref: `#/definitions/${slug}` })\n\n requiredCollectionProperties.push(slug)\n })\n\n console.log({ collectionSlugMap, propertiesMap })\n jsonSchema.properties.ecommerce = {\n type: 'object',\n additionalProperties: false,\n properties: {\n collections: {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...Object.fromEntries(propertiesMap),\n },\n required: requiredCollectionProperties,\n },\n },\n required: ['collections'],\n }\n\n return jsonSchema\n}\n"],"names":["pushTypeScriptProperties","collectionSlugMap","jsonSchema","properties","Array","isArray","required","push","requiredCollectionProperties","propertiesMap","Map","Object","entries","forEach","key","slug","set","$ref","console","log","ecommerce","type","additionalProperties","collections","fromEntries"],"mappings":"AAMA,OAAO,MAAMA,2BAA2B,CAAC,EACvCC,iBAAiB,EACjBC,UAAU,EAMX;IACC,IAAI,CAACA,WAAWC,UAAU,EAAE;QAC1BD,WAAWC,UAAU,GAAG,CAAC;IAC3B;IAEA,IAAIC,MAAMC,OAAO,CAACH,WAAWI,QAAQ,GAAG;QACtCJ,WAAWI,QAAQ,CAACC,IAAI,CAAC;IAC3B;IAEA,MAAMC,+BAAyC,EAAE;IACjD,MAAMC,gBAAgB,IAAIC;IAE1BC,OAAOC,OAAO,CAACX,mBAAmBY,OAAO,CAAC,CAAC,CAACC,KAAKC,KAAK;QACpDN,cAAcO,GAAG,CAACF,KAAK;YAAEG,MAAM,CAAC,cAAc,EAAEF,MAAM;QAAC;QAEvDP,6BAA6BD,IAAI,CAACQ;IACpC;IAEAG,QAAQC,GAAG,CAAC;QAAElB;QAAmBQ;IAAc;IAC/CP,WAAWC,UAAU,CAACiB,SAAS,GAAG;QAChCC,MAAM;QACNC,sBAAsB;QACtBnB,YAAY;YACVoB,aAAa;gBACXF,MAAM;gBACNC,sBAAsB;gBACtBnB,YAAY;oBACV,GAAGQ,OAAOa,WAAW,CAACf,cAAc;gBACtC;gBACAH,UAAUE;YACZ;QACF;QACAF,UAAU;YAAC;SAAc;IAC3B;IAEA,OAAOJ;AACT,EAAC"}
|