@foxy.io/elements 1.24.0-beta.5 → 1.24.0
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/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +2 -2
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +13 -31
- package/dist/cdn/foxy-customer.js +7 -7
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +2 -2
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +5 -5
- package/dist/cdn/foxy-shipment-card.js +2 -2
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +7 -7
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-a96a2154.js → shared-099c1f57.js} +1 -1
- package/dist/cdn/{shared-8465a37a.js → shared-0c0ee663.js} +1 -1
- package/dist/cdn/shared-1196b6a7.js +1 -0
- package/dist/cdn/{shared-7680d300.js → shared-13fbea95.js} +1 -1
- package/dist/cdn/{shared-7ead930c.js → shared-27d21f4a.js} +1 -1
- package/dist/cdn/shared-2edcd981.js +1 -0
- package/dist/cdn/{shared-421e46e9.js → shared-31d8e3b8.js} +1 -1
- package/dist/cdn/shared-35728235.js +1 -0
- package/dist/cdn/{shared-a88c5cf1.js → shared-3b709ddc.js} +2 -2
- package/dist/cdn/shared-3bcc07cd.js +1 -0
- package/dist/cdn/{shared-13cc4ed4.js → shared-3c2414d4.js} +1 -1
- package/dist/cdn/{shared-2fa6a5a0.js → shared-3f04e4cc.js} +1 -1
- package/dist/cdn/{shared-6273b7e1.js → shared-406ce9ad.js} +1 -1
- package/dist/cdn/{shared-6b3be508.js → shared-4b20fc75.js} +1 -1
- package/dist/cdn/{shared-0dabe195.js → shared-4c2e9064.js} +1 -1
- package/dist/cdn/{shared-9765be8f.js → shared-5103c1b4.js} +1 -1
- package/dist/cdn/{shared-c97f7178.js → shared-5784c088.js} +1 -1
- package/dist/cdn/shared-584174ff.js +1 -0
- package/dist/cdn/{shared-125d1a00.js → shared-59fc6288.js} +1 -1
- package/dist/cdn/{shared-527abf31.js → shared-5a889c45.js} +1 -1
- package/dist/cdn/{shared-1fd59009.js → shared-5cf7b194.js} +1 -1
- package/dist/cdn/{shared-5616a12f.js → shared-5db85492.js} +1 -1
- package/dist/cdn/{shared-619bcf83.js → shared-601f27b1.js} +1 -1
- package/dist/cdn/{shared-c758220c.js → shared-621b3283.js} +1 -1
- package/dist/cdn/shared-630a0ff2.js +1 -0
- package/dist/cdn/{shared-8134d8a7.js → shared-6daeb197.js} +1 -1
- package/dist/cdn/{shared-72a13fda.js → shared-7723f756.js} +1 -1
- package/dist/cdn/{shared-90be9ac7.js → shared-773e7177.js} +1 -1
- package/dist/cdn/{shared-8128b5e3.js → shared-799dc083.js} +1 -1
- package/dist/cdn/{shared-4966b3e4.js → shared-7a455b15.js} +1 -1
- package/dist/cdn/{shared-0689b25a.js → shared-7abbc95c.js} +4 -4
- package/dist/cdn/{shared-7d4e0011.js → shared-7fab31ac.js} +1 -1
- package/dist/cdn/{shared-e640e9fa.js → shared-800ee6c0.js} +1 -1
- package/dist/cdn/shared-8a9c64b2.js +1 -0
- package/dist/cdn/{shared-fa5f0117.js → shared-8f922de8.js} +1 -1
- package/dist/cdn/{shared-9bdd5400.js → shared-9048eeb2.js} +1 -1
- package/dist/cdn/{shared-31a891e8.js → shared-9954ee26.js} +3 -3
- package/dist/cdn/{shared-8fbab85c.js → shared-9aa72495.js} +1 -1
- package/dist/cdn/shared-9b12aeac.js +1 -0
- package/dist/cdn/{shared-7bf6e728.js → shared-9b486845.js} +1 -1
- package/dist/cdn/{shared-403af08d.js → shared-ad80244a.js} +1 -1
- package/dist/cdn/{shared-6dffe67d.js → shared-b446c140.js} +1 -1
- package/dist/cdn/{shared-fc77174e.js → shared-b7556b77.js} +1 -1
- package/dist/cdn/{shared-eb232194.js → shared-b87d1af0.js} +1 -1
- package/dist/cdn/{shared-91eb066c.js → shared-ba93be6b.js} +1 -1
- package/dist/cdn/{shared-017ab35f.js → shared-baeef007.js} +1 -1
- package/dist/cdn/{shared-db06114b.js → shared-bee111d6.js} +1 -1
- package/dist/cdn/{shared-aa569a99.js → shared-c76ef8d8.js} +1 -1
- package/dist/cdn/{shared-3164d0c3.js → shared-c839e147.js} +1 -1
- package/dist/cdn/{shared-639dda4b.js → shared-d1f5de89.js} +1 -1
- package/dist/cdn/{shared-897ab5e6.js → shared-d90dbae7.js} +1 -1
- package/dist/cdn/{shared-42adf053.js → shared-ddac7722.js} +2 -2
- package/dist/cdn/{shared-ad0256d0.js → shared-de3dae6c.js} +1 -1
- package/dist/cdn/shared-e006e82c.js +1 -0
- package/dist/cdn/shared-e2e2ca6a.js +1 -0
- package/dist/cdn/{shared-a7475f62.js → shared-e5239bec.js} +1 -1
- package/dist/cdn/{shared-8528906b.js → shared-e8a51c60.js} +1 -1
- package/dist/cdn/{shared-aa22ee61.js → shared-e8a85228.js} +1 -1
- package/dist/cdn/{shared-4bd1efd7.js → shared-eb8a0fdf.js} +1 -1
- package/dist/cdn/{shared-c541c9e9.js → shared-ef7f2d07.js} +1 -1
- package/dist/cdn/{shared-e5786b8b.js → shared-efaf8d49.js} +1 -1
- package/dist/cdn/{shared-15fe0f50.js → shared-f0a9f3c2.js} +1 -1
- package/dist/cdn/{shared-19c9fe00.js → shared-f21e5761.js} +1 -1
- package/dist/cdn/shared-f241722a.js +1 -0
- package/dist/cdn/{shared-4a0298cb.js → shared-f29acc38.js} +1 -1
- package/dist/cdn/{shared-848813a4.js → shared-f29d410a.js} +1 -1
- package/dist/cdn/{shared-f4822b9e.js → shared-f5bbb1e0.js} +1 -1
- package/dist/cdn/{shared-57922341.js → shared-fcfbfbdb.js} +1 -1
- package/dist/cdn/{shared-bf2113a4.js → shared-fd40a40c.js} +1 -1
- package/dist/cdn/{shared-763a6797.js → shared-fd96bcd1.js} +1 -1
- package/dist/cdn/{shared-a134d313.js → shared-ff7fd5fa.js} +1 -1
- package/dist/cdn/{shared-6b0498b2.js → shared-fff03a45.js} +3 -3
- package/dist/cdn/translations/customer/en.json +76 -15
- package/dist/cdn/translations/customer-form/en.json +84 -15
- package/dist/cdn/translations/customer-portal/en.json +115 -31
- package/dist/cdn/translations/customer-portal-settings/en.json +9 -0
- package/dist/cdn/translations/transaction/en.json +79 -15
- package/dist/elements/internal/InternalForm/InternalForm.d.ts +10 -0
- package/dist/elements/internal/InternalForm/InternalForm.js +48 -1
- package/dist/elements/internal/InternalForm/InternalForm.js.map +1 -1
- package/dist/elements/internal/InternalForm/index.d.ts +1 -0
- package/dist/elements/internal/InternalForm/index.js +1 -0
- package/dist/elements/internal/InternalForm/index.js.map +1 -1
- package/dist/elements/internal/InternalForm/types.d.ts +4 -0
- package/dist/elements/internal/InternalForm/types.js +2 -0
- package/dist/elements/internal/InternalForm/types.js.map +1 -0
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.d.ts +5 -1
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js +36 -1
- package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js.map +1 -1
- package/dist/elements/internal/InternalPasswordControl/generateRandomPassword.d.ts +1 -0
- package/dist/elements/internal/InternalPasswordControl/generateRandomPassword.js +11 -0
- package/dist/elements/internal/InternalPasswordControl/generateRandomPassword.js.map +1 -0
- package/dist/elements/public/Customer/Customer.d.ts +5 -2
- package/dist/elements/public/Customer/Customer.js +10 -0
- package/dist/elements/public/Customer/Customer.js.map +1 -1
- package/dist/elements/public/Customer/types.d.ts +1 -0
- package/dist/elements/public/Customer/types.js.map +1 -1
- package/dist/elements/public/CustomerApi/CustomerApi.d.ts +33 -2
- package/dist/elements/public/CustomerApi/CustomerApi.js +62 -11
- package/dist/elements/public/CustomerApi/CustomerApi.js.map +1 -1
- package/dist/elements/public/CustomerForm/CustomerForm.d.ts +47 -15
- package/dist/elements/public/CustomerForm/CustomerForm.js +259 -155
- package/dist/elements/public/CustomerForm/CustomerForm.js.map +1 -1
- package/dist/elements/public/CustomerForm/index.d.ts +6 -6
- package/dist/elements/public/CustomerForm/index.js +6 -6
- package/dist/elements/public/CustomerForm/index.js.map +1 -1
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/InternalCustomerFormLegalNoticeControl.d.ts +5 -0
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/InternalCustomerFormLegalNoticeControl.js +23 -0
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/InternalCustomerFormLegalNoticeControl.js.map +1 -0
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/index.d.ts +4 -0
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/index.js +6 -0
- package/dist/elements/public/CustomerForm/internal/InternalCustomerFormLegalNoticeControl/index.js.map +1 -0
- package/dist/elements/public/CustomerForm/types.d.ts +27 -7
- package/dist/elements/public/CustomerForm/types.js.map +1 -1
- package/dist/elements/public/CustomerPortal/CustomerPortal.js +12 -15
- package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.d.ts +8 -11
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js +9 -33
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.d.ts +14 -10
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +152 -16
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/CustomerPortal/index.d.ts +2 -0
- package/dist/elements/public/CustomerPortal/index.js +2 -2
- package/dist/elements/public/CustomerPortal/index.js.map +1 -1
- package/dist/elements/public/CustomerPortalSettings/CustomerPortalSettings.js +14 -0
- package/dist/elements/public/CustomerPortalSettings/CustomerPortalSettings.js.map +1 -1
- package/dist/elements/public/CustomerPortalSettings/machine.js +10 -0
- package/dist/elements/public/CustomerPortalSettings/machine.js.map +1 -1
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUp.d.ts +14 -0
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUp.js +132 -0
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUp.js.map +1 -0
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUpChangeEvent.d.ts +4 -0
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUpChangeEvent.js +6 -0
- package/dist/elements/public/CustomerPortalSettings/private/SignUp/SignUpChangeEvent.js.map +1 -0
- package/dist/elements/public/CustomerPortalSettings/types.d.ts +4 -0
- package/dist/elements/public/CustomerPortalSettings/types.js.map +1 -1
- package/dist/elements/public/FilterAttributeCard/FilterAttributeCard.js +1 -1
- package/dist/elements/public/FilterAttributeCard/FilterAttributeCard.js.map +1 -1
- package/dist/elements/public/FormDialog/FormDialog.d.ts +2 -0
- package/dist/elements/public/FormDialog/FormDialog.js +6 -0
- package/dist/elements/public/FormDialog/FormDialog.js.map +1 -1
- package/dist/elements/public/FormDialog/types.d.ts +3 -1
- package/dist/elements/public/FormDialog/types.js.map +1 -1
- package/dist/elements/public/NucleonElement/NucleonElement.d.ts +1 -1
- package/dist/elements/public/NucleonElement/NucleonElement.js +1 -1
- package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
- package/dist/elements/public/NucleonElement/types.d.ts +1 -1
- package/dist/elements/public/NucleonElement/types.js.map +1 -1
- package/dist/mixins/themeable.js +16 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/dist/types/hapi.d.ts +14 -0
- package/dist/types/hapi.js.map +1 -1
- package/dist/utils/parse-duration.js +2 -2
- package/dist/utils/parse-duration.js.map +1 -1
- package/package.json +4 -2
- package/dist/cdn/shared-1b2e0709.js +0 -1
- package/dist/cdn/shared-1e43b4db.js +0 -1
- package/dist/cdn/shared-46f3f71c.js +0 -1
- package/dist/cdn/shared-53532131.js +0 -1
- package/dist/cdn/shared-79d01877.js +0 -1
- package/dist/cdn/shared-7e887e5b.js +0 -1
- package/dist/cdn/shared-a6517170.js +0 -1
- package/dist/cdn/shared-b334c8b6.js +0 -1
- package/dist/cdn/shared-bbbb8894.js +0 -1
- package/dist/cdn/shared-d2222c8d.js +0 -1
- package/dist/cdn/shared-fec6fd04.js +0 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalChangePassword.d.ts +0 -29
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalChangePassword.js +0 -169
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalChangePassword.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/Customer/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Graph, Rels } from '@foxy.io/sdk/customer';\n\nimport { Templates as AddressCardTemplates } from '../AddressCard/types';\nimport { Templates as AddressFormTemplates } from '../AddressForm/types';\nimport { Templates as AttributeCardTemplates } from '../AttributeCard/types';\nimport { Templates as AttributeFormTemplates } from '../AttributeForm/types';\nimport { Customer } from './Customer';\nimport { Templates as CustomerFormTemplates } from '../CustomerForm/types';\nimport { Templates as PaymentMethodCardTemplates } from '../PaymentMethodCard/types';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Templates as SubscriptionFormTemplates } from '../SubscriptionForm/types';\nimport { Templates as SubscriptionsTableTemplates } from '../SubscriptionsTable/types';\nimport { TemplateResult } from 'lit-html';\nimport { Templates as TransactionsTableTemplates } from '../TransactionsTable/types';\n\nexport type CustomerAddresses = Resource<Rels.CustomerAddresses>;\nexport type Attributes = Resource<Rels.Attributes>;\nexport type Data = Resource<Graph>;\nexport type Tab = { title: string; content: TemplateResult };\n\nexport type Templates = {\n 'header:before'?: Renderer<Customer>;\n 'header:after'?: Renderer<Customer>;\n 'header:actions:before'?: Renderer<Customer>;\n 'header:actions:after'?: Renderer<Customer>;\n 'header:actions:edit:before'?: Renderer<Customer>;\n 'header:actions:edit:after'?: Renderer<Customer>;\n 'header:actions:edit:form:first-name:before'?: CustomerFormTemplates['first-name:before'];\n 'header:actions:edit:form:first-name:after'?: CustomerFormTemplates['first-name:after'];\n 'header:actions:edit:form:last-name:before'?: CustomerFormTemplates['last-name:before'];\n 'header:actions:edit:form:last-name:after'?: CustomerFormTemplates['last-name:after'];\n 'header:actions:edit:form:email:before'?: CustomerFormTemplates['email:before'];\n 'header:actions:edit:form:email:after'?: CustomerFormTemplates['email:after'];\n 'header:actions:edit:form:tax-id:before'?: CustomerFormTemplates['tax-id:before'];\n 'header:actions:edit:form:tax-id:after'?: CustomerFormTemplates['tax-id:after'];\n 'header:actions:edit:form:timestamps:before'?: CustomerFormTemplates['timestamps:before'];\n 'header:actions:edit:form:timestamps:after'?: CustomerFormTemplates['timestamps:after'];\n 'header:actions:edit:form:delete:before'?: CustomerFormTemplates['delete:before'];\n 'header:actions:edit:form:delete:after'?: CustomerFormTemplates['delete:after'];\n 'header:actions:edit:form:create:before'?: CustomerFormTemplates['create:before'];\n 'header:actions:edit:form:create:after'?: CustomerFormTemplates['create:after'];\n 'default'?: Renderer<Customer>;\n 'addresses:before'?: Renderer<Customer>;\n 'addresses:after'?: Renderer<Customer>;\n 'addresses:actions:before'?: Renderer<Customer>;\n 'addresses:actions:after'?: Renderer<Customer>;\n 'addresses:actions:create:before'?: Renderer<Customer>;\n 'addresses:actions:create:after'?: Renderer<Customer>;\n 'addresses:actions:create:form:address-name:before'?: AddressFormTemplates['address-name:before'];\n 'addresses:actions:create:form:address-name:after'?: AddressFormTemplates['address-name:after'];\n 'addresses:actions:create:form:first-name:before'?: AddressFormTemplates['first-name:before'];\n 'addresses:actions:create:form:first-name:after'?: AddressFormTemplates['first-name:after'];\n 'addresses:actions:create:form:last-name:before'?: AddressFormTemplates['last-name:before'];\n 'addresses:actions:create:form:last-name:after'?: AddressFormTemplates['last-name:after'];\n 'addresses:actions:create:form:region:before'?: AddressFormTemplates['region:before'];\n 'addresses:actions:create:form:region:after'?: AddressFormTemplates['region:after'];\n 'addresses:actions:create:form:city:before'?: AddressFormTemplates['city:before'];\n 'addresses:actions:create:form:city:after'?: AddressFormTemplates['city:after'];\n 'addresses:actions:create:form:phone:before'?: AddressFormTemplates['phone:before'];\n 'addresses:actions:create:form:phone:after'?: AddressFormTemplates['phone:after'];\n 'addresses:actions:create:form:company:before'?: AddressFormTemplates['company:before'];\n 'addresses:actions:create:form:company:after'?: AddressFormTemplates['company:after'];\n 'addresses:actions:create:form:address-one:before'?: AddressFormTemplates['address-one:before'];\n 'addresses:actions:create:form:address-one:after'?: AddressFormTemplates['address-one:after'];\n 'addresses:actions:create:form:address-two:before'?: AddressFormTemplates['address-two:before'];\n 'addresses:actions:create:form:address-two:after'?: AddressFormTemplates['address-two:after'];\n 'addresses:actions:create:form:postal-code:before'?: AddressFormTemplates['postal-code:before'];\n 'addresses:actions:create:form:postal-code:after'?: AddressFormTemplates['postal-code:after'];\n 'addresses:actions:create:form:timestamps:before'?: AddressFormTemplates['timestamps:before'];\n 'addresses:actions:create:form:timestamps:after'?: AddressFormTemplates['timestamps:after'];\n 'addresses:actions:create:form:delete:before'?: AddressFormTemplates['delete:before'];\n 'addresses:actions:create:form:delete:after'?: AddressFormTemplates['delete:after'];\n 'addresses:actions:create:form:create:before'?: AddressFormTemplates['create:before'];\n 'addresses:actions:create:form:create:after'?: AddressFormTemplates['create:after'];\n 'addresses:list:before'?: Renderer<Customer>;\n 'addresses:list:after'?: Renderer<Customer>;\n 'addresses:list:card:address-name:before'?: AddressCardTemplates['address-name:before'];\n 'addresses:list:card:address-name:after'?: AddressCardTemplates['address-name:after'];\n 'addresses:list:card:full-name:before'?: AddressCardTemplates['full-name:before'];\n 'addresses:list:card:full-name:after'?: AddressCardTemplates['full-name:after'];\n 'addresses:list:card:full-address:before'?: AddressCardTemplates['full-address:before'];\n 'addresses:list:card:full-address:after'?: AddressCardTemplates['full-address:after'];\n 'addresses:list:card:company:before'?: AddressCardTemplates['company:before'];\n 'addresses:list:card:company:after'?: AddressCardTemplates['company:after'];\n 'addresses:list:card:phone:before'?: AddressCardTemplates['phone:before'];\n 'addresses:list:card:phone:after'?: AddressCardTemplates['phone:after'];\n 'addresses:list:form:address-name:before'?: AddressFormTemplates['address-name:before'];\n 'addresses:list:form:address-name:after'?: AddressFormTemplates['address-name:after'];\n 'addresses:list:form:first-name:before'?: AddressFormTemplates['first-name:before'];\n 'addresses:list:form:first-name:after'?: AddressFormTemplates['first-name:after'];\n 'addresses:list:form:last-name:before'?: AddressFormTemplates['last-name:before'];\n 'addresses:list:form:last-name:after'?: AddressFormTemplates['last-name:after'];\n 'addresses:list:form:region:before'?: AddressFormTemplates['region:before'];\n 'addresses:list:form:region:after'?: AddressFormTemplates['region:after'];\n 'addresses:list:form:city:before'?: AddressFormTemplates['city:before'];\n 'addresses:list:form:city:after'?: AddressFormTemplates['city:after'];\n 'addresses:list:form:phone:before'?: AddressFormTemplates['phone:before'];\n 'addresses:list:form:phone:after'?: AddressFormTemplates['phone:after'];\n 'addresses:list:form:company:before'?: AddressFormTemplates['company:before'];\n 'addresses:list:form:company:after'?: AddressFormTemplates['company:after'];\n 'addresses:list:form:address-one:before'?: AddressFormTemplates['address-one:before'];\n 'addresses:list:form:address-one:after'?: AddressFormTemplates['address-one:after'];\n 'addresses:list:form:address-two:before'?: AddressFormTemplates['address-two:before'];\n 'addresses:list:form:address-two:after'?: AddressFormTemplates['address-two:after'];\n 'addresses:list:form:postal-code:before'?: AddressFormTemplates['postal-code:before'];\n 'addresses:list:form:postal-code:after'?: AddressFormTemplates['postal-code:after'];\n 'addresses:list:form:timestamps:before'?: AddressFormTemplates['timestamps:before'];\n 'addresses:list:form:timestamps:after'?: AddressFormTemplates['timestamps:after'];\n 'addresses:list:form:delete:before'?: AddressFormTemplates['delete:before'];\n 'addresses:list:form:delete:after'?: AddressFormTemplates['delete:after'];\n 'addresses:list:form:create:before'?: AddressFormTemplates['create:before'];\n 'addresses:list:form:create:after'?: AddressFormTemplates['create:after'];\n 'payment-methods:before'?: Renderer<Customer>;\n 'payment-methods:after'?: Renderer<Customer>;\n 'payment-methods:list:before'?: Renderer<Customer>;\n 'payment-methods:list:after'?: Renderer<Customer>;\n 'payment-methods:list:card:actions:before'?: PaymentMethodCardTemplates['actions:before'];\n 'payment-methods:list:card:actions:after'?: PaymentMethodCardTemplates['actions:after'];\n 'payment-methods:list:card:actions:delete:before'?: PaymentMethodCardTemplates['actions:delete:before'];\n 'payment-methods:list:card:actions:delete:after'?: PaymentMethodCardTemplates['actions:delete:after'];\n 'attributes:before'?: Renderer<Customer>;\n 'attributes:after'?: Renderer<Customer>;\n 'attributes:actions:before'?: Renderer<Customer>;\n 'attributes:actions:after'?: Renderer<Customer>;\n 'attributes:actions:create:before'?: Renderer<Customer>;\n 'attributes:actions:create:after'?: Renderer<Customer>;\n 'attributes:actions:create:form:name:before'?: AttributeFormTemplates['name:before'];\n 'attributes:actions:create:form:name:after'?: AttributeFormTemplates['name:after'];\n 'attributes:actions:create:form:value:before'?: AttributeFormTemplates['value:before'];\n 'attributes:actions:create:form:value:after'?: AttributeFormTemplates['value:after'];\n 'attributes:actions:create:form:visibility:before'?: AttributeFormTemplates['visibility:before'];\n 'attributes:actions:create:form:visibility:after'?: AttributeFormTemplates['visibility:after'];\n 'attributes:actions:create:form:timestamps:before'?: AttributeFormTemplates['timestamps:before'];\n 'attributes:actions:create:form:timestamps:after'?: AttributeFormTemplates['timestamps:after'];\n 'attributes:actions:create:form:delete:before'?: AttributeFormTemplates['delete:before'];\n 'attributes:actions:create:form:delete:after'?: AttributeFormTemplates['delete:after'];\n 'attributes:actions:create:form:create:before'?: AttributeFormTemplates['create:before'];\n 'attributes:actions:create:form:create:after'?: AttributeFormTemplates['create:after'];\n 'attributes:list:before'?: Renderer<Customer>;\n 'attributes:list:after'?: Renderer<Customer>;\n 'attributes:list:card:name:before'?: AttributeCardTemplates['name:before'];\n 'attributes:list:card:name:after'?: AttributeCardTemplates['name:after'];\n 'attributes:list:card:value:before'?: AttributeCardTemplates['value:before'];\n 'attributes:list:card:value:after'?: AttributeCardTemplates['value:after'];\n 'attributes:list:form:name:before'?: AttributeFormTemplates['name:before'];\n 'attributes:list:form:name:after'?: AttributeFormTemplates['name:after'];\n 'attributes:list:form:value:before'?: AttributeFormTemplates['value:before'];\n 'attributes:list:form:value:after'?: AttributeFormTemplates['value:after'];\n 'attributes:list:form:visibility:before'?: AttributeFormTemplates['visibility:before'];\n 'attributes:list:form:visibility:after'?: AttributeFormTemplates['visibility:after'];\n 'attributes:list:form:timestamps:before'?: AttributeFormTemplates['timestamps:before'];\n 'attributes:list:form:timestamps:after'?: AttributeFormTemplates['timestamps:after'];\n 'attributes:list:form:delete:before'?: AttributeFormTemplates['delete:before'];\n 'attributes:list:form:delete:after'?: AttributeFormTemplates['delete:after'];\n 'attributes:list:form:create:before'?: AttributeFormTemplates['create:before'];\n 'attributes:list:form:create:after'?: AttributeFormTemplates['create:after'];\n 'transactions:before'?: Renderer<Customer>;\n 'transactions:after'?: Renderer<Customer>;\n 'transactions:table:default'?: Renderer<TransactionsTableTemplates['default']>;\n 'subscriptions:before'?: Renderer<Customer>;\n 'subscriptions:after'?: Renderer<Customer>;\n 'subscriptions:form:header:before'?: SubscriptionFormTemplates['header:before'];\n 'subscriptions:form:header:after'?: SubscriptionFormTemplates['header:after'];\n 'subscriptions:form:items:before'?: SubscriptionFormTemplates['items:before'];\n 'subscriptions:form:items:after'?: SubscriptionFormTemplates['items:after'];\n 'subscriptions:form:items:actions:before'?: SubscriptionFormTemplates['items:actions:before'];\n 'subscriptions:form:items:actions:after'?: SubscriptionFormTemplates['items:actions:after'];\n 'subscriptions:form:end-date:before'?: SubscriptionFormTemplates['end-date:before'];\n 'subscriptions:form:end-date:after'?: SubscriptionFormTemplates['end-date:after'];\n 'subscriptions:form:end-date:form:warning:before'?: SubscriptionFormTemplates['end-date:form:warning:before'];\n 'subscriptions:form:end-date:form:warning:after'?: SubscriptionFormTemplates['end-date:form:warning:after'];\n 'subscriptions:form:end-date:form:end-date:before'?: SubscriptionFormTemplates['end-date:form:end-date:before'];\n 'subscriptions:form:end-date:form:end-date:after'?: SubscriptionFormTemplates['end-date:form:end-date:after'];\n 'subscriptions:form:end-date:form:submit:before'?: SubscriptionFormTemplates['end-date:form:submit:before'];\n 'subscriptions:form:end-date:form:submit:after'?: SubscriptionFormTemplates['end-date:form:submit:after'];\n 'subscriptions:form:next-transaction-date:before'?: SubscriptionFormTemplates['next-transaction-date:before'];\n 'subscriptions:form:next-transaction-date:after'?: SubscriptionFormTemplates['next-transaction-date:after'];\n 'subscriptions:form:frequency:before'?: SubscriptionFormTemplates['frequency:before'];\n 'subscriptions:form:frequency:after'?: SubscriptionFormTemplates['frequency:after'];\n 'subscriptions:form:transactions:before'?: SubscriptionFormTemplates['transactions:before'];\n 'subscriptions:form:transactions:after'?: SubscriptionFormTemplates['transactions:after'];\n 'subscriptions:table:default'?: Renderer<SubscriptionsTableTemplates['default']>;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/Customer/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Graph, Rels } from '@foxy.io/sdk/customer';\n\nimport { Templates as AddressCardTemplates } from '../AddressCard/types';\nimport { Templates as AddressFormTemplates } from '../AddressForm/types';\nimport { Templates as AttributeCardTemplates } from '../AttributeCard/types';\nimport { Templates as AttributeFormTemplates } from '../AttributeForm/types';\nimport { Customer } from './Customer';\nimport { Templates as CustomerFormTemplates } from '../CustomerForm/types';\nimport { Templates as PaymentMethodCardTemplates } from '../PaymentMethodCard/types';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Templates as SubscriptionFormTemplates } from '../SubscriptionForm/types';\nimport { Templates as SubscriptionsTableTemplates } from '../SubscriptionsTable/types';\nimport { TemplateResult } from 'lit-html';\nimport { Templates as TransactionsTableTemplates } from '../TransactionsTable/types';\n\nexport type CustomerAddresses = Resource<Rels.CustomerAddresses>;\nexport type Attributes = Resource<Rels.Attributes>;\nexport type Settings = Resource<Rels.CustomerPortalSettings>;\nexport type Data = Resource<Graph>;\nexport type Tab = { title: string; content: TemplateResult };\n\nexport type Templates = {\n 'header:before'?: Renderer<Customer>;\n 'header:after'?: Renderer<Customer>;\n 'header:actions:before'?: Renderer<Customer>;\n 'header:actions:after'?: Renderer<Customer>;\n 'header:actions:edit:before'?: Renderer<Customer>;\n 'header:actions:edit:after'?: Renderer<Customer>;\n 'header:actions:edit:form:first-name:before'?: CustomerFormTemplates['first-name:before'];\n 'header:actions:edit:form:first-name:after'?: CustomerFormTemplates['first-name:after'];\n 'header:actions:edit:form:last-name:before'?: CustomerFormTemplates['last-name:before'];\n 'header:actions:edit:form:last-name:after'?: CustomerFormTemplates['last-name:after'];\n 'header:actions:edit:form:email:before'?: CustomerFormTemplates['email:before'];\n 'header:actions:edit:form:email:after'?: CustomerFormTemplates['email:after'];\n 'header:actions:edit:form:tax-id:before'?: CustomerFormTemplates['tax-id:before'];\n 'header:actions:edit:form:tax-id:after'?: CustomerFormTemplates['tax-id:after'];\n 'header:actions:edit:form:timestamps:before'?: CustomerFormTemplates['timestamps:before'];\n 'header:actions:edit:form:timestamps:after'?: CustomerFormTemplates['timestamps:after'];\n 'header:actions:edit:form:delete:before'?: CustomerFormTemplates['delete:before'];\n 'header:actions:edit:form:delete:after'?: CustomerFormTemplates['delete:after'];\n 'header:actions:edit:form:create:before'?: CustomerFormTemplates['create:before'];\n 'header:actions:edit:form:create:after'?: CustomerFormTemplates['create:after'];\n 'default'?: Renderer<Customer>;\n 'addresses:before'?: Renderer<Customer>;\n 'addresses:after'?: Renderer<Customer>;\n 'addresses:actions:before'?: Renderer<Customer>;\n 'addresses:actions:after'?: Renderer<Customer>;\n 'addresses:actions:create:before'?: Renderer<Customer>;\n 'addresses:actions:create:after'?: Renderer<Customer>;\n 'addresses:actions:create:form:address-name:before'?: AddressFormTemplates['address-name:before'];\n 'addresses:actions:create:form:address-name:after'?: AddressFormTemplates['address-name:after'];\n 'addresses:actions:create:form:first-name:before'?: AddressFormTemplates['first-name:before'];\n 'addresses:actions:create:form:first-name:after'?: AddressFormTemplates['first-name:after'];\n 'addresses:actions:create:form:last-name:before'?: AddressFormTemplates['last-name:before'];\n 'addresses:actions:create:form:last-name:after'?: AddressFormTemplates['last-name:after'];\n 'addresses:actions:create:form:region:before'?: AddressFormTemplates['region:before'];\n 'addresses:actions:create:form:region:after'?: AddressFormTemplates['region:after'];\n 'addresses:actions:create:form:city:before'?: AddressFormTemplates['city:before'];\n 'addresses:actions:create:form:city:after'?: AddressFormTemplates['city:after'];\n 'addresses:actions:create:form:phone:before'?: AddressFormTemplates['phone:before'];\n 'addresses:actions:create:form:phone:after'?: AddressFormTemplates['phone:after'];\n 'addresses:actions:create:form:company:before'?: AddressFormTemplates['company:before'];\n 'addresses:actions:create:form:company:after'?: AddressFormTemplates['company:after'];\n 'addresses:actions:create:form:address-one:before'?: AddressFormTemplates['address-one:before'];\n 'addresses:actions:create:form:address-one:after'?: AddressFormTemplates['address-one:after'];\n 'addresses:actions:create:form:address-two:before'?: AddressFormTemplates['address-two:before'];\n 'addresses:actions:create:form:address-two:after'?: AddressFormTemplates['address-two:after'];\n 'addresses:actions:create:form:postal-code:before'?: AddressFormTemplates['postal-code:before'];\n 'addresses:actions:create:form:postal-code:after'?: AddressFormTemplates['postal-code:after'];\n 'addresses:actions:create:form:timestamps:before'?: AddressFormTemplates['timestamps:before'];\n 'addresses:actions:create:form:timestamps:after'?: AddressFormTemplates['timestamps:after'];\n 'addresses:actions:create:form:delete:before'?: AddressFormTemplates['delete:before'];\n 'addresses:actions:create:form:delete:after'?: AddressFormTemplates['delete:after'];\n 'addresses:actions:create:form:create:before'?: AddressFormTemplates['create:before'];\n 'addresses:actions:create:form:create:after'?: AddressFormTemplates['create:after'];\n 'addresses:list:before'?: Renderer<Customer>;\n 'addresses:list:after'?: Renderer<Customer>;\n 'addresses:list:card:address-name:before'?: AddressCardTemplates['address-name:before'];\n 'addresses:list:card:address-name:after'?: AddressCardTemplates['address-name:after'];\n 'addresses:list:card:full-name:before'?: AddressCardTemplates['full-name:before'];\n 'addresses:list:card:full-name:after'?: AddressCardTemplates['full-name:after'];\n 'addresses:list:card:full-address:before'?: AddressCardTemplates['full-address:before'];\n 'addresses:list:card:full-address:after'?: AddressCardTemplates['full-address:after'];\n 'addresses:list:card:company:before'?: AddressCardTemplates['company:before'];\n 'addresses:list:card:company:after'?: AddressCardTemplates['company:after'];\n 'addresses:list:card:phone:before'?: AddressCardTemplates['phone:before'];\n 'addresses:list:card:phone:after'?: AddressCardTemplates['phone:after'];\n 'addresses:list:form:address-name:before'?: AddressFormTemplates['address-name:before'];\n 'addresses:list:form:address-name:after'?: AddressFormTemplates['address-name:after'];\n 'addresses:list:form:first-name:before'?: AddressFormTemplates['first-name:before'];\n 'addresses:list:form:first-name:after'?: AddressFormTemplates['first-name:after'];\n 'addresses:list:form:last-name:before'?: AddressFormTemplates['last-name:before'];\n 'addresses:list:form:last-name:after'?: AddressFormTemplates['last-name:after'];\n 'addresses:list:form:region:before'?: AddressFormTemplates['region:before'];\n 'addresses:list:form:region:after'?: AddressFormTemplates['region:after'];\n 'addresses:list:form:city:before'?: AddressFormTemplates['city:before'];\n 'addresses:list:form:city:after'?: AddressFormTemplates['city:after'];\n 'addresses:list:form:phone:before'?: AddressFormTemplates['phone:before'];\n 'addresses:list:form:phone:after'?: AddressFormTemplates['phone:after'];\n 'addresses:list:form:company:before'?: AddressFormTemplates['company:before'];\n 'addresses:list:form:company:after'?: AddressFormTemplates['company:after'];\n 'addresses:list:form:address-one:before'?: AddressFormTemplates['address-one:before'];\n 'addresses:list:form:address-one:after'?: AddressFormTemplates['address-one:after'];\n 'addresses:list:form:address-two:before'?: AddressFormTemplates['address-two:before'];\n 'addresses:list:form:address-two:after'?: AddressFormTemplates['address-two:after'];\n 'addresses:list:form:postal-code:before'?: AddressFormTemplates['postal-code:before'];\n 'addresses:list:form:postal-code:after'?: AddressFormTemplates['postal-code:after'];\n 'addresses:list:form:timestamps:before'?: AddressFormTemplates['timestamps:before'];\n 'addresses:list:form:timestamps:after'?: AddressFormTemplates['timestamps:after'];\n 'addresses:list:form:delete:before'?: AddressFormTemplates['delete:before'];\n 'addresses:list:form:delete:after'?: AddressFormTemplates['delete:after'];\n 'addresses:list:form:create:before'?: AddressFormTemplates['create:before'];\n 'addresses:list:form:create:after'?: AddressFormTemplates['create:after'];\n 'payment-methods:before'?: Renderer<Customer>;\n 'payment-methods:after'?: Renderer<Customer>;\n 'payment-methods:list:before'?: Renderer<Customer>;\n 'payment-methods:list:after'?: Renderer<Customer>;\n 'payment-methods:list:card:actions:before'?: PaymentMethodCardTemplates['actions:before'];\n 'payment-methods:list:card:actions:after'?: PaymentMethodCardTemplates['actions:after'];\n 'payment-methods:list:card:actions:delete:before'?: PaymentMethodCardTemplates['actions:delete:before'];\n 'payment-methods:list:card:actions:delete:after'?: PaymentMethodCardTemplates['actions:delete:after'];\n 'attributes:before'?: Renderer<Customer>;\n 'attributes:after'?: Renderer<Customer>;\n 'attributes:actions:before'?: Renderer<Customer>;\n 'attributes:actions:after'?: Renderer<Customer>;\n 'attributes:actions:create:before'?: Renderer<Customer>;\n 'attributes:actions:create:after'?: Renderer<Customer>;\n 'attributes:actions:create:form:name:before'?: AttributeFormTemplates['name:before'];\n 'attributes:actions:create:form:name:after'?: AttributeFormTemplates['name:after'];\n 'attributes:actions:create:form:value:before'?: AttributeFormTemplates['value:before'];\n 'attributes:actions:create:form:value:after'?: AttributeFormTemplates['value:after'];\n 'attributes:actions:create:form:visibility:before'?: AttributeFormTemplates['visibility:before'];\n 'attributes:actions:create:form:visibility:after'?: AttributeFormTemplates['visibility:after'];\n 'attributes:actions:create:form:timestamps:before'?: AttributeFormTemplates['timestamps:before'];\n 'attributes:actions:create:form:timestamps:after'?: AttributeFormTemplates['timestamps:after'];\n 'attributes:actions:create:form:delete:before'?: AttributeFormTemplates['delete:before'];\n 'attributes:actions:create:form:delete:after'?: AttributeFormTemplates['delete:after'];\n 'attributes:actions:create:form:create:before'?: AttributeFormTemplates['create:before'];\n 'attributes:actions:create:form:create:after'?: AttributeFormTemplates['create:after'];\n 'attributes:list:before'?: Renderer<Customer>;\n 'attributes:list:after'?: Renderer<Customer>;\n 'attributes:list:card:name:before'?: AttributeCardTemplates['name:before'];\n 'attributes:list:card:name:after'?: AttributeCardTemplates['name:after'];\n 'attributes:list:card:value:before'?: AttributeCardTemplates['value:before'];\n 'attributes:list:card:value:after'?: AttributeCardTemplates['value:after'];\n 'attributes:list:form:name:before'?: AttributeFormTemplates['name:before'];\n 'attributes:list:form:name:after'?: AttributeFormTemplates['name:after'];\n 'attributes:list:form:value:before'?: AttributeFormTemplates['value:before'];\n 'attributes:list:form:value:after'?: AttributeFormTemplates['value:after'];\n 'attributes:list:form:visibility:before'?: AttributeFormTemplates['visibility:before'];\n 'attributes:list:form:visibility:after'?: AttributeFormTemplates['visibility:after'];\n 'attributes:list:form:timestamps:before'?: AttributeFormTemplates['timestamps:before'];\n 'attributes:list:form:timestamps:after'?: AttributeFormTemplates['timestamps:after'];\n 'attributes:list:form:delete:before'?: AttributeFormTemplates['delete:before'];\n 'attributes:list:form:delete:after'?: AttributeFormTemplates['delete:after'];\n 'attributes:list:form:create:before'?: AttributeFormTemplates['create:before'];\n 'attributes:list:form:create:after'?: AttributeFormTemplates['create:after'];\n 'transactions:before'?: Renderer<Customer>;\n 'transactions:after'?: Renderer<Customer>;\n 'transactions:table:default'?: Renderer<TransactionsTableTemplates['default']>;\n 'subscriptions:before'?: Renderer<Customer>;\n 'subscriptions:after'?: Renderer<Customer>;\n 'subscriptions:form:header:before'?: SubscriptionFormTemplates['header:before'];\n 'subscriptions:form:header:after'?: SubscriptionFormTemplates['header:after'];\n 'subscriptions:form:items:before'?: SubscriptionFormTemplates['items:before'];\n 'subscriptions:form:items:after'?: SubscriptionFormTemplates['items:after'];\n 'subscriptions:form:items:actions:before'?: SubscriptionFormTemplates['items:actions:before'];\n 'subscriptions:form:items:actions:after'?: SubscriptionFormTemplates['items:actions:after'];\n 'subscriptions:form:end-date:before'?: SubscriptionFormTemplates['end-date:before'];\n 'subscriptions:form:end-date:after'?: SubscriptionFormTemplates['end-date:after'];\n 'subscriptions:form:end-date:form:warning:before'?: SubscriptionFormTemplates['end-date:form:warning:before'];\n 'subscriptions:form:end-date:form:warning:after'?: SubscriptionFormTemplates['end-date:form:warning:after'];\n 'subscriptions:form:end-date:form:end-date:before'?: SubscriptionFormTemplates['end-date:form:end-date:before'];\n 'subscriptions:form:end-date:form:end-date:after'?: SubscriptionFormTemplates['end-date:form:end-date:after'];\n 'subscriptions:form:end-date:form:submit:before'?: SubscriptionFormTemplates['end-date:form:submit:before'];\n 'subscriptions:form:end-date:form:submit:after'?: SubscriptionFormTemplates['end-date:form:submit:after'];\n 'subscriptions:form:next-transaction-date:before'?: SubscriptionFormTemplates['next-transaction-date:before'];\n 'subscriptions:form:next-transaction-date:after'?: SubscriptionFormTemplates['next-transaction-date:after'];\n 'subscriptions:form:frequency:before'?: SubscriptionFormTemplates['frequency:before'];\n 'subscriptions:form:frequency:after'?: SubscriptionFormTemplates['frequency:after'];\n 'subscriptions:form:transactions:before'?: SubscriptionFormTemplates['transactions:before'];\n 'subscriptions:form:transactions:after'?: SubscriptionFormTemplates['transactions:after'];\n 'subscriptions:table:default'?: Renderer<SubscriptionsTableTemplates['default']>;\n};\n"]}
|
|
@@ -8,6 +8,7 @@ declare const CustomerApi_base: typeof LitElement & import("lit-element").Constr
|
|
|
8
8
|
*
|
|
9
9
|
* @fires CustomerApi#signout - Instance of `CustomerApi.SignOutEvent`. Dispatched on an element when session expires or code 401 is returned.
|
|
10
10
|
* @fires CustomerApi#signin - Instance of `CustomerApi.SignInEvent`. Dispatched on an element once authenticated.
|
|
11
|
+
* @fires CustomerApi#signup - Instance of `CustomerApi.SignUpEvent`. Dispatched on an element once a customer is created (since v1.24.0).
|
|
11
12
|
*
|
|
12
13
|
* @element foxy-customer-api
|
|
13
14
|
* @since 1.4.0
|
|
@@ -69,6 +70,34 @@ export declare class CustomerApi extends CustomerApi_base {
|
|
|
69
70
|
readonly NONE: number;
|
|
70
71
|
};
|
|
71
72
|
};
|
|
73
|
+
static readonly SignUpEvent: {
|
|
74
|
+
new (typeArg: string, eventInitDict?: CustomEventInit<void> | undefined): {
|
|
75
|
+
readonly detail: void;
|
|
76
|
+
initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: void): void;
|
|
77
|
+
readonly bubbles: boolean;
|
|
78
|
+
cancelBubble: boolean;
|
|
79
|
+
readonly cancelable: boolean;
|
|
80
|
+
readonly composed: boolean;
|
|
81
|
+
readonly currentTarget: EventTarget | null;
|
|
82
|
+
readonly defaultPrevented: boolean;
|
|
83
|
+
readonly eventPhase: number;
|
|
84
|
+
readonly isTrusted: boolean;
|
|
85
|
+
returnValue: boolean;
|
|
86
|
+
readonly srcElement: EventTarget | null;
|
|
87
|
+
readonly target: EventTarget | null;
|
|
88
|
+
readonly timeStamp: number;
|
|
89
|
+
readonly type: string;
|
|
90
|
+
composedPath(): EventTarget[];
|
|
91
|
+
initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void;
|
|
92
|
+
preventDefault(): void;
|
|
93
|
+
stopImmediatePropagation(): void;
|
|
94
|
+
stopPropagation(): void;
|
|
95
|
+
readonly AT_TARGET: number;
|
|
96
|
+
readonly BUBBLING_PHASE: number;
|
|
97
|
+
readonly CAPTURING_PHASE: number;
|
|
98
|
+
readonly NONE: number;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
72
101
|
static get properties(): PropertyDeclarations;
|
|
73
102
|
private __storage;
|
|
74
103
|
private __level;
|
|
@@ -93,9 +122,11 @@ export declare class CustomerApi extends CustomerApi_base {
|
|
|
93
122
|
private __createAPIInstance;
|
|
94
123
|
private __handleVirtualAuthSessionDelete;
|
|
95
124
|
private __handleVirtualAuthSessionPost;
|
|
96
|
-
private
|
|
125
|
+
private __handleVirtualAuthSessionAny;
|
|
97
126
|
private __handleVirtualAuthRecoverPost;
|
|
98
|
-
private
|
|
127
|
+
private __handleVirtualAuthRecoverAny;
|
|
128
|
+
private __handleVirtualAuthSignUpPost;
|
|
129
|
+
private __handleVirtualAuthSignUpAny;
|
|
99
130
|
private __handleRequest;
|
|
100
131
|
}
|
|
101
132
|
export {};
|
|
@@ -9,6 +9,7 @@ import { InferrableMixin } from "../../../mixins/inferrable.js";
|
|
|
9
9
|
*
|
|
10
10
|
* @fires CustomerApi#signout - Instance of `CustomerApi.SignOutEvent`. Dispatched on an element when session expires or code 401 is returned.
|
|
11
11
|
* @fires CustomerApi#signin - Instance of `CustomerApi.SignInEvent`. Dispatched on an element once authenticated.
|
|
12
|
+
* @fires CustomerApi#signup - Instance of `CustomerApi.SignUpEvent`. Dispatched on an element once a customer is created (since v1.24.0).
|
|
12
13
|
*
|
|
13
14
|
* @element foxy-customer-api
|
|
14
15
|
* @since 1.4.0
|
|
@@ -145,11 +146,10 @@ export class CustomerApi extends ConfigurableMixin(InferrableMixin(LitElement))
|
|
|
145
146
|
}
|
|
146
147
|
return new Response(JSON.stringify(body), { status });
|
|
147
148
|
}
|
|
148
|
-
async
|
|
149
|
+
async __handleVirtualAuthSessionAny(request) {
|
|
149
150
|
return new Response(JSON.stringify({
|
|
150
151
|
_links: { self: { href: request.url } },
|
|
151
|
-
|
|
152
|
-
credential: { email: '', password: '' },
|
|
152
|
+
message: 'POST to this endpoint to sign in',
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
155
155
|
async __handleVirtualAuthRecoverPost(request) {
|
|
@@ -165,26 +165,75 @@ export class CustomerApi extends ConfigurableMixin(InferrableMixin(LitElement))
|
|
|
165
165
|
throw new Error(`Unknown payload type ${payload.type}`);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
async
|
|
169
|
-
return new Response(JSON.stringify({
|
|
168
|
+
async __handleVirtualAuthRecoverAny(request) {
|
|
169
|
+
return new Response(JSON.stringify({
|
|
170
|
+
_links: { self: { href: request.url } },
|
|
171
|
+
message: 'POST to this endpoint to request a password reset',
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
async __handleVirtualAuthSignUpPost(request) {
|
|
175
|
+
const data = (await request.clone().json());
|
|
176
|
+
try {
|
|
177
|
+
await this.api.signUp(data);
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
if (!(err instanceof API.AuthError))
|
|
181
|
+
throw err;
|
|
182
|
+
let message;
|
|
183
|
+
let status;
|
|
184
|
+
if (err.code === 'UNAUTHORIZED') {
|
|
185
|
+
message = 'Customer registration is disabled for this store.';
|
|
186
|
+
status = 401;
|
|
187
|
+
}
|
|
188
|
+
else if (err.code === 'UNAVAILABLE') {
|
|
189
|
+
message = 'This email address is already in use by an existing customer of this store.';
|
|
190
|
+
status = 403;
|
|
191
|
+
}
|
|
192
|
+
else if (err.code === 'INVALID_FORM') {
|
|
193
|
+
message = 'Client verification failed.';
|
|
194
|
+
status = 400;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
throw err;
|
|
198
|
+
}
|
|
199
|
+
const body = JSON.stringify({ total: 1, _embedded: { 'fx:errors': [{ message }] } });
|
|
200
|
+
return new Response(body, { status });
|
|
201
|
+
}
|
|
202
|
+
if (data.password)
|
|
203
|
+
await this.api.signIn(data);
|
|
204
|
+
this.requestUpdate();
|
|
205
|
+
this.dispatchEvent(new CustomerApi.SignUpEvent('signup'));
|
|
206
|
+
return new Response(JSON.stringify({
|
|
207
|
+
_links: { self: { href: request.url } },
|
|
208
|
+
message: 'Account created',
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
async __handleVirtualAuthSignUpAny(request) {
|
|
212
|
+
return new Response(JSON.stringify({
|
|
213
|
+
_links: { self: { href: request.url } },
|
|
214
|
+
message: 'POST to this endpoint to create an account',
|
|
215
|
+
}));
|
|
170
216
|
}
|
|
171
217
|
async __handleRequest(request) {
|
|
172
218
|
const url = request.url;
|
|
173
219
|
const method = request.method;
|
|
174
220
|
try {
|
|
175
|
-
if (url
|
|
221
|
+
if (url.startsWith('foxy://customer-api/session')) {
|
|
176
222
|
if (method === 'DELETE')
|
|
177
223
|
return this.__handleVirtualAuthSessionDelete();
|
|
178
224
|
if (method === 'POST')
|
|
179
225
|
return this.__handleVirtualAuthSessionPost(request);
|
|
180
|
-
|
|
181
|
-
return this.__handleVirtualAuthSessionGet(request);
|
|
226
|
+
return this.__handleVirtualAuthSessionAny(request);
|
|
182
227
|
}
|
|
183
|
-
if (url
|
|
228
|
+
if (url.startsWith('foxy://customer-api/recover')) {
|
|
184
229
|
if (method === 'POST')
|
|
185
230
|
return this.__handleVirtualAuthRecoverPost(request);
|
|
186
|
-
|
|
187
|
-
|
|
231
|
+
return this.__handleVirtualAuthRecoverAny(request);
|
|
232
|
+
}
|
|
233
|
+
if (url.startsWith('foxy://customer-api/signup')) {
|
|
234
|
+
if (method === 'POST')
|
|
235
|
+
return this.__handleVirtualAuthSignUpPost(request);
|
|
236
|
+
return this.__handleVirtualAuthSignUpAny(request);
|
|
188
237
|
}
|
|
189
238
|
const response = await this.api.fetch(request);
|
|
190
239
|
if (response.status === 401) {
|
|
@@ -203,4 +252,6 @@ CustomerApi.SignOutEvent = class extends CustomEvent {
|
|
|
203
252
|
};
|
|
204
253
|
CustomerApi.SignInEvent = class extends CustomEvent {
|
|
205
254
|
};
|
|
255
|
+
CustomerApi.SignUpEvent = class extends CustomEvent {
|
|
256
|
+
};
|
|
206
257
|
//# sourceMappingURL=CustomerApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerApi.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerApi/CustomerApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAChD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAA/E;;QAcU,cAAS,GAAmC,OAAO,CAAC;QAEpD,YAAO,GAAG,CAAC,CAAC;QAEZ,WAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAEzB,UAAK,GAAQ,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAExC,kBAAa,GAAG,KAAK,EAAE,aAAoB,EAAE,EAAE;YACrD,IAAI,CAAC,CAAC,aAAa,YAAY,UAAU,CAAC;gBAAE,OAAO;YACnD,I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,OAAO,IAAI,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;aAC1E;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAE/C,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC5D,IAAI,CAAC,aAAa,EAAE,CAAC;aACtB;YAED,OAAO,QAAQ,CAAC;SACjB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;SAC5C;IACH,CAAC;;AArNe,wBAAY,GAAG,KAAM,SAAQ,WAAiB;CAAG,CAAC;AAElD,uBAAW,GAAG,KAAM,SAAQ,WAAiB;CAAG,CAAC","sourcesContent":["import { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '@foxy.io/sdk/customer';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { cookieStorage } from './cookieStorage';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\n/**\n * Element connector for Customer API.\n *\n * @fires CustomerApi#signout - Instance of `CustomerApi.SignOutEvent`. Dispatched on an element when session expires or code 401 is returned.\n * @fires CustomerApi#signin - Instance of `CustomerApi.SignInEvent`. Dispatched on an element once authenticated.\n *\n * @element foxy-customer-api\n * @since 1.4.0\n */\nexport class CustomerApi extends ConfigurableMixin(InferrableMixin(LitElement)) {\n static readonly SignOutEvent = class extends CustomEvent<void> {};\n\n static readonly SignInEvent = class extends CustomEvent<void> {};\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n storage: { type: String, noAccessor: true },\n level: { type: Number, noAccessor: true },\n base: { type: String, noAccessor: true },\n };\n }\n\n private __storage: 'session' | 'cookie' | 'local' = 'local';\n\n private __level = 0;\n\n private __base = location.origin;\n\n private __api: API = this.__createAPIInstance();\n\n private __handleFetch = async (originalEvent: Event) => {\n if (!(originalEvent instanceof FetchEvent)) return;\n if (originalEvent.defaultPrevented) return;\n if (originalEvent.composedPath()[0] === this) return;\n\n originalEvent.preventDefault();\n\n const apiEvent = new FetchEvent('fetch', {\n cancelable: true,\n composed: true,\n request: originalEvent.request,\n bubbles: true,\n reject: (reason: unknown) => originalEvent.respondWith(Promise.reject(reason)),\n resolve: (response: Response) => {\n if (apiEvent.request.url === 'foxy://customer-api/session') this.requestUpdate();\n if (response.status === 401) this.requestUpdate();\n originalEvent.respondWith(Promise.resolve(response));\n },\n });\n\n if (this.dispatchEvent(apiEvent)) apiEvent.respondWith(this.__handleRequest(apiEvent.request));\n };\n\n get isLoggedIn(): boolean {\n return !!this.api.storage.getItem(API.SESSION);\n }\n\n /** `FoxySDK.Customer.API` instance used by this element to communicate with the backend. */\n get api(): API {\n return this.__api;\n }\n\n /** Bookmark URL for this API. This is where the tree traversal begins. We also use this URL as a base for relative paths. */\n get base(): string {\n return this.__base;\n }\n\n set base(value: string) {\n this.__base = value;\n this.__api = this.__createAPIInstance();\n }\n\n /** Numeric Consola log level. If omitted, Consola defaults will be used. */\n get level(): number {\n return this.__level;\n }\n\n set level(value: number) {\n this.__level = value;\n this.__api = this.__createAPIInstance();\n }\n\n /** Credentials storage implementing Web Storage API. Access tokens and other related info will be stored here. Defaults to in-memory storage. */\n get storage(): 'session' | 'cookie' | 'local' {\n return this.__storage;\n }\n\n set storage(value: 'session' | 'cookie' | 'local') {\n this.__storage = value;\n this.__api = this.__createAPIInstance();\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__handleFetch);\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderTemplateOrSlot(this.isLoggedIn ? 'logged-in' : 'logged-out')}\n <slot></slot>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__handleFetch);\n }\n\n private __createAPIInstance() {\n const storageOptions = {\n session: sessionStorage,\n cookie: cookieStorage,\n local: localStorage,\n };\n\n return new API({\n storage: storageOptions[this.storage],\n level: this.level,\n base: new URL(this.base),\n });\n }\n\n private async __handleVirtualAuthSessionDelete() {\n await this.api.signOut();\n\n this.dispatchEvent(new CustomerApi.SignOutEvent('signout'));\n this.requestUpdate();\n\n return new Response();\n }\n\n private async __handleVirtualAuthSessionPost(request: Request) {\n const payload = await request.clone().json();\n if (payload.type !== 'password') throw new Error(`Unknown payload type ${payload.type}`);\n\n let status: number;\n let body: unknown;\n\n try {\n await this.api.signIn(payload.credential);\n\n this.dispatchEvent(new CustomerApi.SignInEvent('signin'));\n this.requestUpdate();\n\n status = 200;\n body = { _links: { self: { href: request.url } }, ...payload };\n } catch (err) {\n if (!(err instanceof API.AuthError)) throw err;\n if (!(err.code === 'UNAUTHORIZED')) throw err;\n\n const virtualAuthError = {\n message: err.message,\n logref: 'unavailable',\n code: 'invalid_credential_error',\n };\n\n status = 401;\n body = { total: 1, _embedded: { 'fx:errors': [virtualAuthError] } };\n }\n\n return new Response(JSON.stringify(body), { status });\n }\n\n private async __handleVirtualAuthSessionGet(request: Request) {\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n type: 'password',\n credential: { email: '', password: '' },\n })\n );\n }\n\n private async __handleVirtualAuthRecoverPost(request: Request) {\n const payload = await request.clone().json();\n\n if (payload.type === 'email') {\n await this.api.sendPasswordResetEmail(payload.detail);\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n email: payload.email,\n })\n );\n } else {\n throw new Error(`Unknown payload type ${payload.type}`);\n }\n }\n\n private async __handleVirtualAuthRecoverGet(request: Request) {\n return new Response(JSON.stringify({ _links: { self: { href: request.url } }, email: '' }));\n }\n\n private async __handleRequest(request: Request) {\n const url = request.url;\n const method = request.method;\n\n try {\n if (url === 'foxy://customer-api/session') {\n if (method === 'DELETE') return this.__handleVirtualAuthSessionDelete();\n if (method === 'POST') return this.__handleVirtualAuthSessionPost(request);\n if (method === 'GET') return this.__handleVirtualAuthSessionGet(request);\n }\n\n if (url === 'foxy://customer-api/recover') {\n if (method === 'POST') return this.__handleVirtualAuthRecoverPost(request);\n if (method === 'GET') return this.__handleVirtualAuthRecoverGet(request);\n }\n\n const response = await this.api.fetch(request);\n\n if (response.status === 401) {\n this.api.storage.clear();\n this.dispatchEvent(new CustomerApi.SignOutEvent('signout'));\n this.requestUpdate();\n }\n\n return response;\n } catch (err) {\n return new Response(null, { status: 500 });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CustomerApi.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerApi/CustomerApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,aAAa,EAAE,2BAAwB;AAChD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D;;;;;;;;;GASG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAA/E;;QAgBU,cAAS,GAAmC,OAAO,CAAC;QAEpD,YAAO,GAAG,CAAC,CAAC;QAEZ,WAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAEzB,UAAK,GAAQ,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAExC,kBAAa,GAAG,KAAK,EAAE,aAAoB,EAAE,EAAE;YACrD,IAAI,CAAC,CAAC,aAAa,YAAY,UAAU,CAAC;gBAAE,OAAO;YACnD,IAAI,aAAa,CAAC,gBAAgB;gBAAE,OAAO;YAC3C,IAA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ations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '@foxy.io/sdk/customer';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { cookieStorage } from './cookieStorage';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\n/**\n * Element connector for Customer API.\n *\n * @fires CustomerApi#signout - Instance of `CustomerApi.SignOutEvent`. Dispatched on an element when session expires or code 401 is returned.\n * @fires CustomerApi#signin - Instance of `CustomerApi.SignInEvent`. Dispatched on an element once authenticated.\n * @fires CustomerApi#signup - Instance of `CustomerApi.SignUpEvent`. Dispatched on an element once a customer is created (since v1.24.0).\n *\n * @element foxy-customer-api\n * @since 1.4.0\n */\nexport class CustomerApi extends ConfigurableMixin(InferrableMixin(LitElement)) {\n static readonly SignOutEvent = class extends CustomEvent<void> {};\n\n static readonly SignInEvent = class extends CustomEvent<void> {};\n\n static readonly SignUpEvent = class extends CustomEvent<void> {};\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n storage: { type: String, noAccessor: true },\n level: { type: Number, noAccessor: true },\n base: { type: String, noAccessor: true },\n };\n }\n\n private __storage: 'session' | 'cookie' | 'local' = 'local';\n\n private __level = 0;\n\n private __base = location.origin;\n\n private __api: API = this.__createAPIInstance();\n\n private __handleFetch = async (originalEvent: Event) => {\n if (!(originalEvent instanceof FetchEvent)) return;\n if (originalEvent.defaultPrevented) return;\n if (originalEvent.composedPath()[0] === this) return;\n\n originalEvent.preventDefault();\n\n const apiEvent = new FetchEvent('fetch', {\n cancelable: true,\n composed: true,\n request: originalEvent.request,\n bubbles: true,\n reject: (reason: unknown) => originalEvent.respondWith(Promise.reject(reason)),\n resolve: (response: Response) => {\n if (apiEvent.request.url === 'foxy://customer-api/session') this.requestUpdate();\n if (response.status === 401) this.requestUpdate();\n originalEvent.respondWith(Promise.resolve(response));\n },\n });\n\n if (this.dispatchEvent(apiEvent)) apiEvent.respondWith(this.__handleRequest(apiEvent.request));\n };\n\n get isLoggedIn(): boolean {\n return !!this.api.storage.getItem(API.SESSION);\n }\n\n /** `FoxySDK.Customer.API` instance used by this element to communicate with the backend. */\n get api(): API {\n return this.__api;\n }\n\n /** Bookmark URL for this API. This is where the tree traversal begins. We also use this URL as a base for relative paths. */\n get base(): string {\n return this.__base;\n }\n\n set base(value: string) {\n this.__base = value;\n this.__api = this.__createAPIInstance();\n }\n\n /** Numeric Consola log level. If omitted, Consola defaults will be used. */\n get level(): number {\n return this.__level;\n }\n\n set level(value: number) {\n this.__level = value;\n this.__api = this.__createAPIInstance();\n }\n\n /** Credentials storage implementing Web Storage API. Access tokens and other related info will be stored here. Defaults to in-memory storage. */\n get storage(): 'session' | 'cookie' | 'local' {\n return this.__storage;\n }\n\n set storage(value: 'session' | 'cookie' | 'local') {\n this.__storage = value;\n this.__api = this.__createAPIInstance();\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__handleFetch);\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderTemplateOrSlot(this.isLoggedIn ? 'logged-in' : 'logged-out')}\n <slot></slot>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__handleFetch);\n }\n\n private __createAPIInstance() {\n const storageOptions = {\n session: sessionStorage,\n cookie: cookieStorage,\n local: localStorage,\n };\n\n return new API({\n storage: storageOptions[this.storage],\n level: this.level,\n base: new URL(this.base),\n });\n }\n\n private async __handleVirtualAuthSessionDelete() {\n await this.api.signOut();\n\n this.dispatchEvent(new CustomerApi.SignOutEvent('signout'));\n this.requestUpdate();\n\n return new Response();\n }\n\n private async __handleVirtualAuthSessionPost(request: Request) {\n const payload = await request.clone().json();\n if (payload.type !== 'password') throw new Error(`Unknown payload type ${payload.type}`);\n\n let status: number;\n let body: unknown;\n\n try {\n await this.api.signIn(payload.credential);\n\n this.dispatchEvent(new CustomerApi.SignInEvent('signin'));\n this.requestUpdate();\n\n status = 200;\n body = { _links: { self: { href: request.url } }, ...payload };\n } catch (err) {\n if (!(err instanceof API.AuthError)) throw err;\n if (!(err.code === 'UNAUTHORIZED')) throw err;\n\n const virtualAuthError = {\n message: err.message,\n logref: 'unavailable',\n code: 'invalid_credential_error',\n };\n\n status = 401;\n body = { total: 1, _embedded: { 'fx:errors': [virtualAuthError] } };\n }\n\n return new Response(JSON.stringify(body), { status });\n }\n\n private async __handleVirtualAuthSessionAny(request: Request) {\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n message: 'POST to this endpoint to sign in',\n })\n );\n }\n\n private async __handleVirtualAuthRecoverPost(request: Request) {\n const payload = await request.clone().json();\n\n if (payload.type === 'email') {\n await this.api.sendPasswordResetEmail(payload.detail);\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n email: payload.email,\n })\n );\n } else {\n throw new Error(`Unknown payload type ${payload.type}`);\n }\n }\n\n private async __handleVirtualAuthRecoverAny(request: Request) {\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n message: 'POST to this endpoint to request a password reset',\n })\n );\n }\n\n private async __handleVirtualAuthSignUpPost(request: Request) {\n const data = (await request.clone().json()) as {\n verification: { type: 'hcaptcha'; token: string };\n first_name?: string;\n last_name?: string;\n password?: string;\n email: string;\n };\n\n try {\n await this.api.signUp(data);\n } catch (err) {\n if (!(err instanceof API.AuthError)) throw err;\n\n let message: string;\n let status: number;\n\n if (err.code === 'UNAUTHORIZED') {\n message = 'Customer registration is disabled for this store.';\n status = 401;\n } else if (err.code === 'UNAVAILABLE') {\n message = 'This email address is already in use by an existing customer of this store.';\n status = 403;\n } else if (err.code === 'INVALID_FORM') {\n message = 'Client verification failed.';\n status = 400;\n } else {\n throw err;\n }\n\n const body = JSON.stringify({ total: 1, _embedded: { 'fx:errors': [{ message }] } });\n return new Response(body, { status });\n }\n\n if (data.password) await this.api.signIn(data as Required<typeof data>);\n this.requestUpdate();\n this.dispatchEvent(new CustomerApi.SignUpEvent('signup'));\n\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n message: 'Account created',\n })\n );\n }\n\n private async __handleVirtualAuthSignUpAny(request: Request) {\n return new Response(\n JSON.stringify({\n _links: { self: { href: request.url } },\n message: 'POST to this endpoint to create an account',\n })\n );\n }\n\n private async __handleRequest(request: Request) {\n const url = request.url;\n const method = request.method;\n\n try {\n if (url.startsWith('foxy://customer-api/session')) {\n if (method === 'DELETE') return this.__handleVirtualAuthSessionDelete();\n if (method === 'POST') return this.__handleVirtualAuthSessionPost(request);\n return this.__handleVirtualAuthSessionAny(request);\n }\n\n if (url.startsWith('foxy://customer-api/recover')) {\n if (method === 'POST') return this.__handleVirtualAuthRecoverPost(request);\n return this.__handleVirtualAuthRecoverAny(request);\n }\n\n if (url.startsWith('foxy://customer-api/signup')) {\n if (method === 'POST') return this.__handleVirtualAuthSignUpPost(request);\n return this.__handleVirtualAuthSignUpAny(request);\n }\n\n const response = await this.api.fetch(request);\n\n if (response.status === 401) {\n this.api.storage.clear();\n this.dispatchEvent(new CustomerApi.SignOutEvent('signout'));\n this.requestUpdate();\n }\n\n return response;\n } catch (err) {\n return new Response(null, { status: 500 });\n }\n }\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Data, Templates } from './types';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { NucleonV8N } from '../NucleonElement/types';
|
|
6
|
-
|
|
1
|
+
import type { Data, Templates, Settings } from './types';
|
|
2
|
+
import type { PropertyDeclarations } from 'lit-element';
|
|
3
|
+
import type { ScopedElementsMap } from '@open-wc/scoped-elements';
|
|
4
|
+
import type { TemplateResult } from 'lit-html';
|
|
5
|
+
import type { NucleonV8N } from '../NucleonElement/types';
|
|
6
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
7
|
+
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
8
|
+
declare const Base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
7
9
|
defaultNS: string;
|
|
8
|
-
} & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost
|
|
9
|
-
styles: import("lit-element").CSSResultArray;
|
|
10
|
-
} & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost>;
|
|
10
|
+
} & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
|
|
11
11
|
/**
|
|
12
12
|
* Form element for creating or editing customers.
|
|
13
13
|
*
|
|
@@ -23,6 +23,21 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
|
|
|
23
23
|
* @slot tax-id:before - **new in v1.4.0**
|
|
24
24
|
* @slot tax-id:after - **new in v1.4.0**
|
|
25
25
|
*
|
|
26
|
+
* @slot is-anonymous:before - **new in v1.24.0**
|
|
27
|
+
* @slot is-anonymous:after - **new in v1.24.0**
|
|
28
|
+
*
|
|
29
|
+
* @slot password:before - **new in v1.24.0**
|
|
30
|
+
* @slot password:after - **new in v1.24.0**
|
|
31
|
+
*
|
|
32
|
+
* @slot password-old:before - **new in v1.24.0**
|
|
33
|
+
* @slot password-old:after - **new in v1.24.0**
|
|
34
|
+
*
|
|
35
|
+
* @slot forgot-password:before - **new in v1.24.0**
|
|
36
|
+
* @slot forgot-password:after - **new in v1.24.0**
|
|
37
|
+
*
|
|
38
|
+
* @slot legal-notice:before - **new in v1.24.0**
|
|
39
|
+
* @slot legal-notice:after - **new in v1.24.0**
|
|
40
|
+
*
|
|
26
41
|
* @slot timestamps:before - **new in v1.4.0**
|
|
27
42
|
* @slot timestamps:after - **new in v1.4.0**
|
|
28
43
|
*
|
|
@@ -37,13 +52,30 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
|
|
|
37
52
|
*/
|
|
38
53
|
export declare class CustomerForm extends Base<Data> {
|
|
39
54
|
static get scopedElements(): ScopedElementsMap;
|
|
40
|
-
static get
|
|
55
|
+
static get properties(): PropertyDeclarations;
|
|
56
|
+
static get v8n(): NucleonV8N<Data, CustomerForm>;
|
|
57
|
+
/** If true, won't require password when creating a customer. */
|
|
58
|
+
passwordless: boolean;
|
|
41
59
|
templates: Templates;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
|
|
60
|
+
/** Full `fx:customer_portal_settings` resource from Customer API. If present, switches this element into the Customer API mode, enabling client verification. */
|
|
61
|
+
settings: Settings | null;
|
|
62
|
+
private readonly __isAnonymousGetValue;
|
|
63
|
+
private readonly __isAnonymousSetValue;
|
|
64
|
+
private readonly __isAnonymousOptions;
|
|
65
|
+
private __refreshInterval;
|
|
66
|
+
get readonlySelector(): BooleanSelector;
|
|
67
|
+
get hiddenSelector(): BooleanSelector;
|
|
47
68
|
disconnectedCallback(): void;
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
renderBody(): TemplateResult;
|
|
71
|
+
submit(): void;
|
|
72
|
+
protected _sendPatch(edits: Partial<Data>): Promise<Data>;
|
|
73
|
+
protected _sendGet(): Promise<Data>;
|
|
74
|
+
protected _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult>;
|
|
75
|
+
private get __forgotPasswordHelperText();
|
|
76
|
+
private get __passwordPlaceholder();
|
|
77
|
+
private get __passwordHelperText();
|
|
78
|
+
private get __emailHelperText();
|
|
79
|
+
private get __hcaptcha();
|
|
48
80
|
}
|
|
49
81
|
export {};
|