@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
package/dist/types/hapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hapi.js","sourceRoot":"","sources":["../../src/types/hapi.ts"],"names":[],"mappings":"","sourcesContent":["interface Link {\n href: string;\n title: string;\n type?: string;\n}\n\ntype Curies = [\n {\n name: string;\n href: string;\n templated: boolean;\n }\n];\n\nexport interface FxAttribute {\n _links: { [key: string]: Link } & {\n curies: Curies;\n self: Link;\n };\n name: string;\n value: string;\n visibility: 'public' | 'private' | 'restricted';\n date_created: string;\n date_modified: string;\n}\n\nexport interface FxCustomerPortalSettings {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:store': Link;\n };\n\n /** If this field is true we get legacy API key or sso key from store and save it in settings. For false value we drop it. */\n sso: boolean;\n /** The date this resource was created. */\n date_created: string;\n /** The date this resource was last modified. */\n date_modified: string;\n /** Shared secret key. */\n jwtSharedSecret: string;\n /** Life span of session in minutes. Maximum 40320 (4 weeks). */\n sessionLifespanInMinutes: number;\n /** An array of domains. No trailing slashes, must be https unless it's localhost. Can accept a port. Allow up to 10 entries. */\n allowedOrigins: string[];\n /** Object which contains \"allowFrequencyModification\" and \"allowNextDateModification\" fields. Subscription modification data. */\n subscriptions: {\n /** An array that contains objects with jsonataQuery and values. Max length 10 (items). */\n allowFrequencyModification: {\n /** A string that should be a valid [JSONata](https://jsonata.org/) query. Max length 200 chars. */\n jsonataQuery: string;\n /** These strings should match the sub_frequency regex sanitization. Max array length 20, max length per string 4 characters. */\n values: string[];\n }[];\n /** We can forbid modify subscription next date. False disables modification, true lifts all constraints, array of objects defines custom rules. */\n allowNextDateModification:\n | boolean\n | {\n /** Beginning of the time period this rule applies to as frequency. Example: `2w` – apply to dates at least 2 weeks from now. */\n min?: string;\n /** End of the time period this rules applies to as frequency. Example: `1y` – apply to dates at most 1 year from now. */\n max?: string;\n /** Subscription selector that should be a valid [JSONata](https://jsonata.org/) query. Max length 200 chars. */\n jsonataQuery: string;\n /** List of dates (YYYY-MM-DD) that customers can't pick as next payment date. */\n disallowedDates?: string[];\n /** A pattern defining the days that will be available for customers to pick as the next payment date. */\n allowedDays?:\n | {\n /** Constraint type. If `day`, then this rule contains days of week only. */\n type: 'day';\n /** Days of week, 1-7, where 1 is Monday and 7 is Sunday. */\n days: number[];\n }\n | {\n /** Constraint type. If `month`, then this rule contains days of month only. */\n type: 'month';\n /** Days of month, 1-31. */\n days: number[];\n };\n }[];\n };\n}\n\nexport interface FxBookmark {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:property_helpers': Link;\n 'fx:reporting': Link;\n 'fx:encode': Link;\n 'fx:user': Link;\n 'fx:store': Link;\n 'fx:stores': Link;\n 'fx:token': Link;\n };\n\n message: string;\n}\n\nexport interface FxStore {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:attributes': Link;\n 'fx:store_version': Link;\n 'fx:users': Link;\n 'fx:user_accesses': Link;\n 'fx:customers': Link;\n 'fx:carts': Link;\n 'fx:transactions': Link;\n 'fx:subscriptions': Link;\n 'fx:subscription_settings': Link;\n 'fx:item_categories': Link;\n 'fx:taxes': Link;\n 'fx:payment_method_sets': Link;\n 'fx:coupons': Link;\n 'fx:template_sets': Link;\n 'fx:cart_templates': Link;\n 'fx:cart_include_templates': Link;\n 'fx:checkout_templates': Link;\n 'fx:customer_portal_settings': Link;\n 'fx:process_subscription_webhook': Link;\n 'fx:template_configs': Link;\n 'fx:payment_gateways': Link;\n 'fx:payment_methods_expiring': Link;\n 'fx:store_shipping_methods': Link;\n 'fx:receipt_templates': Link;\n 'fx:email_templates': Link;\n 'fx:error_entries': Link;\n 'fx:downloadables': Link;\n 'fx:hosted_payment_gateways': Link;\n 'fx:fraud_protections': Link;\n 'fx:integrations': Link;\n 'fx:native_integrations': Link;\n 'fx:activate_store_monthly_url': Link;\n 'fx:activate_store_yearly_url': Link;\n };\n\n _embedded?: Record<string, unknown> & {\n 'fx:attributes': FxAttribute[];\n };\n\n /** This is the store version for this store. For more details about this version, see the {@link https://api-sandbox.foxycart.com/hal-browser/browser.html#https://api-sandbox.foxycart.com/property_helpers/store_versions store_versions} property helpers which include changelog information. */\n store_version_uri: string;\n /** The name of your store as you'd like it displayed to your customers and our system. */\n store_name: string;\n /** This is a unique FoxyCart subdomain for your cart, checkout, and receipt. If you install a custom SSL certificate, this will contain a full domain such as store.yourdomain.com. */\n store_domain: string;\n /** Set to true when you plan to use a custom SSL certificate. If set to true, your store_domain must be a full domain. */\n use_remote_domain: boolean;\n /** The URL of your online store. */\n store_url: string;\n /** By default, FoxyCart sends customers back to the page referrer after completing a purchase. Instead, you can set a specific URL here. */\n receipt_continue_url: string;\n /** This is the email address of your store. By default, this will be the from address for your store receipts. If you specify a from_email, you can also put in multiple email addresses here, separated by a comma to be used when bcc_on_receipt_email is true. */\n store_email: string;\n /** Used for when you want to specify a different from email than your store's email address or when your store_email has a list of email addresses. */\n from_email: string;\n /** Set this to true if you would like each receipt sent to your customer to also be blind carbon copied to your store's email address. */\n bcc_on_receipt_email: boolean;\n /** Set this to true if you have set up your DNS settings to include and spf record for FoxyCart. See the {@link http://wiki.foxycart.com/v/1.1/emails FoxyCart documentation} for more details. */\n use_email_dns: boolean;\n /** If you'd like to configure your own SMTP server for sending transaction receipt emails, you can do so here. The JSON supports the following fields: `username`,`password`,`host`,`port`,`security`. The security value can be blank, `ssl`, or `tls` */\n smtp_config: string | null;\n /** The postal code of your store. This will be used for calculating shipping costs if you sell shippable items. */\n postal_code: string;\n /** The two character code for states in the United States. Other countries may call this a province. When a two character code isn't available, use the full region name. This will be used for calculating shipping costs if you sell shippable items. */\n region: string;\n /** Two character ISO 3166-1-alpha-2 code for the country your store is located in. This will be used for calculating shipping costs if you sell shippable items. */\n country: string;\n /** The locale code for your Store's locale. This will be used to format strings for your store. */\n locale_code: string;\n /** Set to true to prevent the currency symbol from being displayed (example: a points based checkout system). */\n hide_currency_symbol: boolean;\n /** Set to true to prevent the decimal characters from being displayed (example: a points based checkout system). */\n hide_decimal_characters: boolean;\n /** Set true to use the international currency symbol such as USD instead of the regional one like $. */\n use_international_currency_symbol: boolean;\n /** The default language for your store's cart, checkout, and receipt strings. */\n language: string;\n /** A url to your store's logo which may be used in your store's templates. */\n logo_url: string;\n /** The preferred configuration of your customer checkout experience, such as defaulting to guest checkout or requiring account creation with each checkout. */\n checkout_type: string;\n /** Set this to true to POST encrypted XML of your order to the webhook url of your choice. */\n use_webhook: boolean;\n /** This is the url of the webhook endpoint for processing your store's webhook. See the {@link http://wiki.foxycart.com/static/redirect/webhook FoxyCart documentation} for more details. */\n webhook_url: string;\n /** This is the key used to encrypt your webhook data. It is also used as the legacy API key and the HMAC cart encryption key. */\n webhook_key: string;\n /** Set to true to use HMAC cart validation for your store. */\n use_cart_validation: boolean;\n /** Set this to true to redirect to your server before checkout so you can use our single sign on feature and log in your users automatically to FoxyCart or if you want to validate items before checkout. */\n use_single_sign_on: boolean;\n /** This is your single sign on url to redirect your users to prior to hitting the checkout page. See the {@link http://wiki.foxycart.com/static/redirect/sso FoxyCart documentation} for more details. */\n single_sign_on_url: string;\n /** When saving a customer to FoxyCart, this is the password hashing method that will be used. */\n customer_password_hash_type: string;\n /** Configuration settings for the customer_password_hash_type in use. See the {@link http://wiki.foxycart.com/static/redirect/customers FoxyCart documentation} for more details. */\n customer_password_hash_config: string;\n /** Set to true to turn on FoxyCart's multiship functionality for shipping items to multiple locations in a single order. See the {@link http://wiki.foxycart.com/static/redirect/multiship FoxyCart documentation} for more details. */\n features_multiship: boolean;\n /** Set to true to require all front-end add-to-cart interactions have a valid `expires` property. */\n products_require_expires_property: boolean;\n /** If your store sells products which collect personal or sensitive information as product attributes, you may want to consider lowering your cart session lifespan. You can leave it as 0 to keep the default which is currently 43200 seconds (12 hours). The maximum allowed time is currently 259200 seconds (72 hours). */\n app_session_time: number;\n /** Used for determining the type of the customer address used when calculating shipping costs. */\n shipping_address_type: string;\n /** Shipping rate signing ensures that the rate the customer selects is carried through and not altered in any way. If you're intending to make use of javascript snippets on your store to alter the price or label of shipping rates or add custom rates dynamically, disable this setting as it will block those rates from being applied. The default is false. */\n require_signed_shipping_rates: boolean;\n /** The timezone of your store. This will impact how dates are shown to customers and within the FoxyCart admin. */\n timezone: string;\n /** Set a master password here if you would like to be able to check out as your customers without having to know their password. */\n unified_order_entry_password: string;\n /** Instead of displaying the Foxy Transaction ID, you can display your own custom display ID on your store's receipt and receipt emails. This JSON config determines how those display ids will work. The JSON supports the following fields: `enabled`, `start`, `length`, `prefix`, `suffix`. */\n custom_display_id_config: string;\n /** This can only be set during store creation. Contact us if you need this value changed later. */\n affiliate_id: number;\n /** This settings makes your checkout page completely non-functioning. Your customers will see the maintenance notification language string instead. The default is false. */\n is_maintenance_mode: boolean;\n /** If this store is in development or if it has an active FoxyCart subscription and can therefore use a live payment gateway to process live transactions. */\n is_active: boolean;\n /** The date of the first payment for this FoxyCart store subscription. This can be considered the go live date for this store. */\n first_payment_date: string | null;\n /** The date this resource was created. */\n date_created: string | null;\n /** The date this resource was last modified. */\n date_modified: string | null;\n}\n\nexport interface FxUser {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:default_store': Link;\n 'fx:attributes': Link;\n 'fx:stores': Link;\n };\n\n _embedded: Record<string, unknown>;\n\n /** The user's given name. */\n first_name: string;\n /** The user's surname. */\n last_name: string;\n /** The user's email address. This is used as the login to the FoxyCart admin for this user. */\n email: string;\n /** The user's phone number. */\n phone: string;\n /** This can only be set during user creation. Contact us if you need this value changed later. */\n affiliate_id: number;\n /** If this user is a programmer who writes server side code in languages like PHP, .NET, Python, Java, Ruby, etc */\n is_programmer: boolean;\n /** If this user is a front end developer who writes code in things like HTML, CSS, and maybe some JavaScript. */\n is_front_end_developer: boolean;\n /** If this user is a front end designer who works in wireframes, graphic designs, and user interfaces. */\n is_designer: boolean;\n /** If this user is a a merchant or store admin involved in the item and money side of the e-commerce business. */\n is_merchant: boolean;\n /** The date this resource was created. */\n date_created: string;\n /** The date this resource was last modified. */\n date_modified: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hapi.js","sourceRoot":"","sources":["../../src/types/hapi.ts"],"names":[],"mappings":"","sourcesContent":["interface Link {\n href: string;\n title: string;\n type?: string;\n}\n\ntype Curies = [\n {\n name: string;\n href: string;\n templated: boolean;\n }\n];\n\nexport interface FxAttribute {\n _links: { [key: string]: Link } & {\n curies: Curies;\n self: Link;\n };\n name: string;\n value: string;\n visibility: 'public' | 'private' | 'restricted';\n date_created: string;\n date_modified: string;\n}\n\nexport interface FxCustomerPortalSettings {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:store': Link;\n };\n\n /** If this field is true we get legacy API key or sso key from store and save it in settings. For false value we drop it. */\n sso: boolean;\n /** The date this resource was created. */\n date_created: string;\n /** The date this resource was last modified. */\n date_modified: string;\n /** Shared secret key. */\n jwtSharedSecret: string;\n /** Life span of session in minutes. Maximum 40320 (4 weeks). */\n sessionLifespanInMinutes: number;\n /** An array of domains. No trailing slashes, must be https unless it's localhost. Can accept a port. Allow up to 10 entries. */\n allowedOrigins: string[];\n /** Object which contains \"allowFrequencyModification\" and \"allowNextDateModification\" fields. Subscription modification data. */\n subscriptions: {\n /** An array that contains objects with jsonataQuery and values. Max length 10 (items). */\n allowFrequencyModification: {\n /** A string that should be a valid [JSONata](https://jsonata.org/) query. Max length 200 chars. */\n jsonataQuery: string;\n /** These strings should match the sub_frequency regex sanitization. Max array length 20, max length per string 4 characters. */\n values: string[];\n }[];\n /** We can forbid modify subscription next date. False disables modification, true lifts all constraints, array of objects defines custom rules. */\n allowNextDateModification:\n | boolean\n | {\n /** Beginning of the time period this rule applies to as frequency. Example: `2w` – apply to dates at least 2 weeks from now. */\n min?: string;\n /** End of the time period this rules applies to as frequency. Example: `1y` – apply to dates at most 1 year from now. */\n max?: string;\n /** Subscription selector that should be a valid [JSONata](https://jsonata.org/) query. Max length 200 chars. */\n jsonataQuery: string;\n /** List of dates (YYYY-MM-DD) that customers can't pick as next payment date. */\n disallowedDates?: string[];\n /** A pattern defining the days that will be available for customers to pick as the next payment date. */\n allowedDays?:\n | {\n /** Constraint type. If `day`, then this rule contains days of week only. */\n type: 'day';\n /** Days of week, 1-7, where 1 is Monday and 7 is Sunday. */\n days: number[];\n }\n | {\n /** Constraint type. If `month`, then this rule contains days of month only. */\n type: 'month';\n /** Days of month, 1-31. */\n days: number[];\n };\n }[];\n };\n /** Self-registration settings. Self-registration is disabled if this field is undefined. */\n signUp?: {\n /** If this field is true, then self-registration is enabled. */\n enabled: boolean;\n /** Client verification settings. */\n verification: {\n /** Verification type. Currently only hCaptcha is supported. */\n type: 'hcaptcha';\n /** hCaptcha site key. If empty, Foxy will use its own hCaptcha site key. */\n siteKey: string;\n /** hCaptcha secret key. If empty, Foxy will use its own hCaptcha secret key. */\n secretKey: string;\n };\n };\n}\n\nexport interface FxBookmark {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:property_helpers': Link;\n 'fx:reporting': Link;\n 'fx:encode': Link;\n 'fx:user': Link;\n 'fx:store': Link;\n 'fx:stores': Link;\n 'fx:token': Link;\n };\n\n message: string;\n}\n\nexport interface FxStore {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:attributes': Link;\n 'fx:store_version': Link;\n 'fx:users': Link;\n 'fx:user_accesses': Link;\n 'fx:customers': Link;\n 'fx:carts': Link;\n 'fx:transactions': Link;\n 'fx:subscriptions': Link;\n 'fx:subscription_settings': Link;\n 'fx:item_categories': Link;\n 'fx:taxes': Link;\n 'fx:payment_method_sets': Link;\n 'fx:coupons': Link;\n 'fx:template_sets': Link;\n 'fx:cart_templates': Link;\n 'fx:cart_include_templates': Link;\n 'fx:checkout_templates': Link;\n 'fx:customer_portal_settings': Link;\n 'fx:process_subscription_webhook': Link;\n 'fx:template_configs': Link;\n 'fx:payment_gateways': Link;\n 'fx:payment_methods_expiring': Link;\n 'fx:store_shipping_methods': Link;\n 'fx:receipt_templates': Link;\n 'fx:email_templates': Link;\n 'fx:error_entries': Link;\n 'fx:downloadables': Link;\n 'fx:hosted_payment_gateways': Link;\n 'fx:fraud_protections': Link;\n 'fx:integrations': Link;\n 'fx:native_integrations': Link;\n 'fx:activate_store_monthly_url': Link;\n 'fx:activate_store_yearly_url': Link;\n };\n\n _embedded?: Record<string, unknown> & {\n 'fx:attributes': FxAttribute[];\n };\n\n /** This is the store version for this store. For more details about this version, see the {@link https://api-sandbox.foxycart.com/hal-browser/browser.html#https://api-sandbox.foxycart.com/property_helpers/store_versions store_versions} property helpers which include changelog information. */\n store_version_uri: string;\n /** The name of your store as you'd like it displayed to your customers and our system. */\n store_name: string;\n /** This is a unique FoxyCart subdomain for your cart, checkout, and receipt. If you install a custom SSL certificate, this will contain a full domain such as store.yourdomain.com. */\n store_domain: string;\n /** Set to true when you plan to use a custom SSL certificate. If set to true, your store_domain must be a full domain. */\n use_remote_domain: boolean;\n /** The URL of your online store. */\n store_url: string;\n /** By default, FoxyCart sends customers back to the page referrer after completing a purchase. Instead, you can set a specific URL here. */\n receipt_continue_url: string;\n /** This is the email address of your store. By default, this will be the from address for your store receipts. If you specify a from_email, you can also put in multiple email addresses here, separated by a comma to be used when bcc_on_receipt_email is true. */\n store_email: string;\n /** Used for when you want to specify a different from email than your store's email address or when your store_email has a list of email addresses. */\n from_email: string;\n /** Set this to true if you would like each receipt sent to your customer to also be blind carbon copied to your store's email address. */\n bcc_on_receipt_email: boolean;\n /** Set this to true if you have set up your DNS settings to include and spf record for FoxyCart. See the {@link http://wiki.foxycart.com/v/1.1/emails FoxyCart documentation} for more details. */\n use_email_dns: boolean;\n /** If you'd like to configure your own SMTP server for sending transaction receipt emails, you can do so here. The JSON supports the following fields: `username`,`password`,`host`,`port`,`security`. The security value can be blank, `ssl`, or `tls` */\n smtp_config: string | null;\n /** The postal code of your store. This will be used for calculating shipping costs if you sell shippable items. */\n postal_code: string;\n /** The two character code for states in the United States. Other countries may call this a province. When a two character code isn't available, use the full region name. This will be used for calculating shipping costs if you sell shippable items. */\n region: string;\n /** Two character ISO 3166-1-alpha-2 code for the country your store is located in. This will be used for calculating shipping costs if you sell shippable items. */\n country: string;\n /** The locale code for your Store's locale. This will be used to format strings for your store. */\n locale_code: string;\n /** Set to true to prevent the currency symbol from being displayed (example: a points based checkout system). */\n hide_currency_symbol: boolean;\n /** Set to true to prevent the decimal characters from being displayed (example: a points based checkout system). */\n hide_decimal_characters: boolean;\n /** Set true to use the international currency symbol such as USD instead of the regional one like $. */\n use_international_currency_symbol: boolean;\n /** The default language for your store's cart, checkout, and receipt strings. */\n language: string;\n /** A url to your store's logo which may be used in your store's templates. */\n logo_url: string;\n /** The preferred configuration of your customer checkout experience, such as defaulting to guest checkout or requiring account creation with each checkout. */\n checkout_type: string;\n /** Set this to true to POST encrypted XML of your order to the webhook url of your choice. */\n use_webhook: boolean;\n /** This is the url of the webhook endpoint for processing your store's webhook. See the {@link http://wiki.foxycart.com/static/redirect/webhook FoxyCart documentation} for more details. */\n webhook_url: string;\n /** This is the key used to encrypt your webhook data. It is also used as the legacy API key and the HMAC cart encryption key. */\n webhook_key: string;\n /** Set to true to use HMAC cart validation for your store. */\n use_cart_validation: boolean;\n /** Set this to true to redirect to your server before checkout so you can use our single sign on feature and log in your users automatically to FoxyCart or if you want to validate items before checkout. */\n use_single_sign_on: boolean;\n /** This is your single sign on url to redirect your users to prior to hitting the checkout page. See the {@link http://wiki.foxycart.com/static/redirect/sso FoxyCart documentation} for more details. */\n single_sign_on_url: string;\n /** When saving a customer to FoxyCart, this is the password hashing method that will be used. */\n customer_password_hash_type: string;\n /** Configuration settings for the customer_password_hash_type in use. See the {@link http://wiki.foxycart.com/static/redirect/customers FoxyCart documentation} for more details. */\n customer_password_hash_config: string;\n /** Set to true to turn on FoxyCart's multiship functionality for shipping items to multiple locations in a single order. See the {@link http://wiki.foxycart.com/static/redirect/multiship FoxyCart documentation} for more details. */\n features_multiship: boolean;\n /** Set to true to require all front-end add-to-cart interactions have a valid `expires` property. */\n products_require_expires_property: boolean;\n /** If your store sells products which collect personal or sensitive information as product attributes, you may want to consider lowering your cart session lifespan. You can leave it as 0 to keep the default which is currently 43200 seconds (12 hours). The maximum allowed time is currently 259200 seconds (72 hours). */\n app_session_time: number;\n /** Used for determining the type of the customer address used when calculating shipping costs. */\n shipping_address_type: string;\n /** Shipping rate signing ensures that the rate the customer selects is carried through and not altered in any way. If you're intending to make use of javascript snippets on your store to alter the price or label of shipping rates or add custom rates dynamically, disable this setting as it will block those rates from being applied. The default is false. */\n require_signed_shipping_rates: boolean;\n /** The timezone of your store. This will impact how dates are shown to customers and within the FoxyCart admin. */\n timezone: string;\n /** Set a master password here if you would like to be able to check out as your customers without having to know their password. */\n unified_order_entry_password: string;\n /** Instead of displaying the Foxy Transaction ID, you can display your own custom display ID on your store's receipt and receipt emails. This JSON config determines how those display ids will work. The JSON supports the following fields: `enabled`, `start`, `length`, `prefix`, `suffix`. */\n custom_display_id_config: string;\n /** This can only be set during store creation. Contact us if you need this value changed later. */\n affiliate_id: number;\n /** This settings makes your checkout page completely non-functioning. Your customers will see the maintenance notification language string instead. The default is false. */\n is_maintenance_mode: boolean;\n /** If this store is in development or if it has an active FoxyCart subscription and can therefore use a live payment gateway to process live transactions. */\n is_active: boolean;\n /** The date of the first payment for this FoxyCart store subscription. This can be considered the go live date for this store. */\n first_payment_date: string | null;\n /** The date this resource was created. */\n date_created: string | null;\n /** The date this resource was last modified. */\n date_modified: string | null;\n}\n\nexport interface FxUser {\n _links: {\n 'curies': Curies;\n 'self': Link;\n 'fx:default_store': Link;\n 'fx:attributes': Link;\n 'fx:stores': Link;\n };\n\n _embedded: Record<string, unknown>;\n\n /** The user's given name. */\n first_name: string;\n /** The user's surname. */\n last_name: string;\n /** The user's email address. This is used as the login to the FoxyCart admin for this user. */\n email: string;\n /** The user's phone number. */\n phone: string;\n /** This can only be set during user creation. Contact us if you need this value changed later. */\n affiliate_id: number;\n /** If this user is a programmer who writes server side code in languages like PHP, .NET, Python, Java, Ruby, etc */\n is_programmer: boolean;\n /** If this user is a front end developer who writes code in things like HTML, CSS, and maybe some JavaScript. */\n is_front_end_developer: boolean;\n /** If this user is a front end designer who works in wireframes, graphic designs, and user interfaces. */\n is_designer: boolean;\n /** If this user is a a merchant or store admin involved in the item and money side of the e-commerce business. */\n is_merchant: boolean;\n /** The date this resource was created. */\n date_created: string;\n /** The date this resource was last modified. */\n date_modified: string;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export function parseDuration(value, full = false) {
|
|
2
2
|
var _a;
|
|
3
3
|
const unitsMap = { y: 'year', m: 'month', w: 'week', d: 'day' };
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const unit = value.replace(/^\.?\d+/, '');
|
|
5
|
+
const count = value.substring(0, value.length - unit.length);
|
|
6
6
|
return {
|
|
7
7
|
count: count === '.5' ? 0.5 : parseInt(count),
|
|
8
8
|
units: full ? (_a = unitsMap[unit]) !== null && _a !== void 0 ? _a : unit : unit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-duration.js","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAI,GAAG,KAAK;;IACvD,MAAM,QAAQ,GAA2B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IACxF,MAAM,
|
|
1
|
+
{"version":3,"file":"parse-duration.js","sourceRoot":"","sources":["../../src/utils/parse-duration.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAI,GAAG,KAAK;;IACvD,MAAM,QAAQ,GAA2B,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IACxF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO;QACL,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC7C,KAAK,EAAE,IAAI,CAAC,CAAC,OAAC,QAAQ,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAC,CAAC,CAAC,IAAI;KAC5C,CAAC;AACJ,CAAC","sourcesContent":["export interface Duration {\n count: number;\n units: string;\n}\n\nexport function parseDuration(value: string, full = false): Duration {\n const unitsMap: Record<string, string> = { y: 'year', m: 'month', w: 'week', d: 'day' };\n const unit = value.replace(/^\\.?\\d+/, '');\n const count = value.substring(0, value.length - unit.length);\n\n return {\n count: count === '.5' ? 0.5 : parseInt(count),\n units: full ? unitsMap[unit] ?? unit : unit,\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxy.io/elements",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.24.0
|
|
4
|
+
"version": "1.24.0",
|
|
5
5
|
"description": "E-commerce web components by Foxy.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@foxy.io/sdk": "^1.
|
|
31
|
+
"@foxy.io/sdk": "^1.11.0",
|
|
32
32
|
"@open-wc/lit-helpers": "^0.3.12",
|
|
33
33
|
"@open-wc/scoped-elements": "^1.2.1",
|
|
34
34
|
"@polymer/iron-icons": "^3.0.1",
|
|
35
35
|
"@vaadin-component-factory/vcf-tooltip": "^1.3.14",
|
|
36
36
|
"@vaadin/vaadin": "^14.8.5",
|
|
37
|
+
"check-password-strength": "^2.0.7",
|
|
37
38
|
"cookie-storage": "^6.1.0",
|
|
38
39
|
"dedent": "^0.7.0",
|
|
39
40
|
"email-validator": "^2.0.4",
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"service-worker-router": "^1.7.5",
|
|
47
48
|
"traverse": "^0.6.6",
|
|
48
49
|
"uainfer": "^0.5.0",
|
|
50
|
+
"vanilla-hcaptcha": "^1.0.2",
|
|
49
51
|
"webcomponent-qr-code": "^1.0.5",
|
|
50
52
|
"xstate": "^4.16.0"
|
|
51
53
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./shared-53532131.js";import{d as a,ae as o,af as t,ag as n}from"./shared-0dabe195.js";function s(s,e,f){return null==s?s:function(s,e,f,i){if(!a(s))return s;for(var u=-1,d=(e=o(e,s)).length,p=d-1,l=s;null!=l&&++u<d;){var v=t(e[u]),c=f;if("__proto__"===v||"constructor"===v||"prototype"===v)return s;if(u!=p){var m=l[v];void 0===(c=i?i(m,v,l):void 0)&&(c=a(m)?m:n(e[u+1])?[]:{})}r(l,v,c),l=l[v]}return s}(s,e,f)}export{s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r}from"./shared-0dabe195.js";import{p as s}from"./shared-46f3f71c.js";function t(t){var a;const n=s(t),o=null!==(a={y:"yearly",m:"monthly",w:"weekly",d:"daily"}[n.units])&&void 0!==a?a:n.units;return r(r({},n),{},{units:o})}export{t as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,_ as t}from"./shared-0dabe195.js";import{h as n,L as r}from"./shared-7f33a83a.js";import{i as s,a}from"./shared-a88c5cf1.js";import{F as i}from"./shared-343d1fd7.js";import{I as o}from"./shared-763a6797.js";const l={type:"backend",init:()=>{},read:(t,n,r)=>{const s=async e=>{const t=e.ok?null:new Error(await e.text()),n=!!e.ok&&await e.json();r(t,n)},a=e=>{const t=e instanceof Error?e:new Error(String(e));r(t,!1)},o=new i("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:new e.WHATWGRequest(`foxy://i18n/${n}/${t}`),resolve:s,reject:a});dispatchEvent(o),o.defaultPrevented||fetch(o.request).then(s).catch(a)},create:()=>{throw new Error("foxy-i18n does not support resource creation")}};function c(e,t=!1){var n;const r=e.replace(/(y|m|w|d)/,""),s=e.replace(/\.?\d+/,"");return{count:".5"===r?.5:parseInt(r),units:t&&null!==(n={y:"year",m:"month",w:"week",d:"day"}[s])&&void 0!==n?n:s}}const u={discount:({ns:e,type:t,details:n},r,s)=>{const a=t.endsWith("_percentage")?.01:1,i=n.split("|"),o=`${["allunits","incremental","repeat","single"].includes(i[0])?i.shift():"single"}_${t}_discount_summary`;return i.map((t=>{var n,r;const s=null!==(r=null===(n=/[-+]/.exec(t))||void 0===n?void 0:n.index)&&void 0!==r?r:-1,i=parseFloat(t.substring(s))*a,l=parseFloat(t.substring(0,s));return`$t(${o}, ${JSON.stringify({maximumFractionDigits:10,adjustment:i,from:l,ns:e})})`})).join("; ")},relative:(e,t,n)=>{const r=new Intl.RelativeTimeFormat(n);let{count:s,units:a}=c(e,!0);return.5===s&&"month"===a&&(s=2,a="week"),r.format(s,a)},percent:(e,n,r,s)=>{let a=null;try{"number"==typeof e&&(a=e.toLocaleString(r,t(t({},s),{},{style:"percent"})))}catch(e){console.warn(`i18next formatter error: ${e.message}`)}return a||String(e)},ordinal:(e,t,n)=>`${e}$t(ordinal_${new Intl.PluralRules(n,{type:"ordinal"}).select(e)})`,price:(e,t,n,r)=>{var s;try{const[t,a]=e.split(" ");return parseFloat(t).toLocaleString(n,{maximumFractionDigits:2,minimumFractionDigits:2,currencyDisplay:null!==(s=null==r?void 0:r.currencyDisplay)&&void 0!==s?s:"symbol",signDisplay:null==r?void 0:r.signDisplay,style:"currency",currency:a})}catch(t){return e}},date:(e,t,n,r)=>{var s,a,i;if(!e)return"$t(unknown)";const o=new Date(e),l=null!==(s=null==r?void 0:r.month)&&void 0!==s?s:"long",c=(null!==(a=null==r?void 0:r.year)&&void 0!==a?a:(new Date).getFullYear()===o.getFullYear())?void 0:"numeric",u=null!==(i=null==r?void 0:r.day)&&void 0!==i?i:"numeric";return o.toLocaleDateString(n,{month:l,year:c,day:u})},time:(e,t,n)=>new Date(e).toLocaleTimeString(n,{hour:"numeric",minute:"numeric"})};let d,p=e=>e;class m extends(a(o(r),"")){constructor(){super(...arguments),this.options={},this.key=""}static onTranslationChange(e){const t=["initialized","loaded"],n=["removed","added"];return t.forEach((t=>m.i18next.on(t,e))),n.forEach((t=>m.i18next.store.on(t,e))),()=>{t.forEach((t=>m.i18next.off(t,e))),n.forEach((t=>m.i18next.store.off(t,e)))}}static onResourceFetch(e){const t=t=>{if(t instanceof i&&t.request.url.startsWith("foxy://i18n/")){const[n,r]=t.request.url.split("/").reverse();t.respondWith(e(r,n))}};return addEventListener("fetch",t),()=>removeEventListener("fetch",t)}static setGateways({values:e}){for(const t in e)this.i18next.addResource("en","gateways",`gateways.${t}`,e[t].name)}static get properties(){return t(t({},super.properties),{},{options:{type:Object},key:{type:String}})}connectedCallback(){super.connectedCallback(),this.__unsubscribe=m.onTranslationChange((()=>this.requestUpdate()))}render(){return n(d||(d=p`<span>${0}</span>`),this.t(this.key,t(t({},this.options),{},{lng:this.lang})))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.__unsubscribe)||void 0===e||e.call(this)}}m.FetchEvent=i,m.i18next=s.createInstance().use(l),m.i18next.init({interpolation:{format:(e,t="",n="en",r={})=>t.split(" ").filter((e=>!!e.trim())).reduce(((e,t)=>{var s,a;return null!==(a=null===(s=u[t])||void 0===s?void 0:s.call(u,e,t,n,r))&&void 0!==a?a:e}),e),escapeValue:!1},fallbackLng:"en",fallbackNS:"shared",defaultNS:"shared",ns:["shared"]}),customElements.define("foxy-i18n",m);export{m as I,c as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ah as a,ai as r}from"./shared-0dabe195.js";var e=function(){try{var r=a(Object,"defineProperty");return r({},"",{}),r}catch(a){}}();function t(a,r,t){"__proto__"==r&&e?e(a,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):a[r]=t}var o=Object.prototype.hasOwnProperty;function n(a,e,n){var i=a[e];o.call(a,e)&&r(i,n)&&(void 0!==n||e in a)||t(a,e,n)}export{n as a,t as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import{I as e}from"./shared-421e46e9.js";customElements.define("foxy-internal-card",e);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e,aj as t,ak as s}from"./shared-0dabe195.js";var n=function(e,t,s,n){return new(s||(s=Promise))((function(i,o){function r(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};class i extends e{constructor(e){super(Object.assign(Object.assign({},e),{fetch:(...e)=>this.__fetch(...e)}))}signIn(t){return n(this,void 0,void 0,(function*(){i.v8n.credentials.check(t);const s=yield this.fetch(new URL("./authenticate",this.base).toString(),{body:JSON.stringify(t),method:"POST"});if(!s.ok){const t=401===s.status?"UNAUTHORIZED":"UNKNOWN";throw new e.AuthError({code:t})}{const e=yield s.json(),t=Object.assign(Object.assign({},e),{date_created:(new Date).toISOString()});this.storage.setItem(i.SESSION,JSON.stringify(t))}}))}sendPasswordResetEmail(t){return n(this,void 0,void 0,(function*(){i.v8n.email.check(t.email);if(!(yield this.fetch(new URL("./forgot_password",this.base).toString(),{body:JSON.stringify(t),method:"POST"})).ok)throw new e.AuthError({code:"UNKNOWN"})}))}signOut(){return n(this,void 0,void 0,(function*(){if(!(yield this.fetch(new URL("./authenticate",this.base).toString(),{method:"DELETE"})).ok)throw new e.AuthError({code:"UNKNOWN"});this.storage.clear(),this.cache.clear()}))}__fetch(e,t){var o;return n(this,void 0,void 0,(function*(){let n=JSON.parse(null!==(o=this.storage.getItem(i.SESSION))&&void 0!==o?o:"null");const r=new s.Request(e,t);if(null!==n){new Date(n.date_created).getTime()+1e3*n.expires_in<Date.now()?(this.console.info("Session has expired, signing out."),this.storage.clear(),this.cache.clear(),n=null):r.headers.set("Authorization",`Bearer ${n.session_token}`)}r.headers.set("Content-Type","application/json"),r.headers.set("FOXY-API-VERSION","1"),this.console.trace(`${r.method} ${r.url}`);const a=yield s.fetch(r);if(n&&a.ok){const e=Object.assign(Object.assign({},n),{date_created:(new Date).toISOString()});this.storage.setItem(i.SESSION,JSON.stringify(e))}return a}))}}i.SESSION="session",i.v8n=Object.assign({},e.v8n,{credentials:t().schema({email:t().string(),newPassword:t().optional(t().string()),password:t().string()}),email:t().string()});let o=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([a-zµμ]*)/gi;function r(e="",t="ms"){var s=null;return(e=e.replace(/(\d),(\d)/g,"$1$2")).replace(o,(function(e,t,n){(n=r[n]||r[n.toLowerCase().replace(/s$/,"")])&&(s=(s||0)+parseFloat(t,10)*n)})),s&&s/r[t]}r.nanosecond=r.ns=1e-6,r["µs"]=r["μs"]=r.us=r.microsecond=.001,r.millisecond=r.ms=1,r.second=r.sec=r.s=1e3*r.ms,r.minute=r.min=r.m=60*r.s,r.hour=r.hr=r.h=60*r.m,r.day=r.d=24*r.h,r.week=r.wk=r.w=7*r.d,r.month=r.b=30.4375*r.d,r.year=r.yr=r.y=365.25*r.d;export{i as A,r as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e,m as t,e as s,f as r,_ as i,R as n}from"./shared-0dabe195.js";import{h as o,L as h}from"./shared-7f33a83a.js";import{A as a}from"./shared-bbbb8894.js";import{F as d}from"./shared-343d1fd7.js";import{U as u,a as l}from"./shared-3ab0306f.js";import{I as c}from"./shared-763a6797.js";import{i as _}from"./shared-8528906b.js";function f(t,s){let r=null;return e(s).forEach((function(){var e,s,i,n,o,h,a,d,u,l,c;if(null===(i=null===(s=null===(e=this.node)||void 0===e?void 0:e._links)||void 0===s?void 0:s.self)||void 0===i?void 0:i.href){const e=null===(h=null===(o=null===(n=this.node)||void 0===n?void 0:n._links)||void 0===o?void 0:o.self)||void 0===h?void 0:h.href,s=new URL(null===(u=null===(d=null===(a=this.node)||void 0===a?void 0:a._links)||void 0===d?void 0:d.self)||void 0===u?void 0:u.href);if(s.searchParams.delete("zoom"),t===e||t===s.toString())return r=JSON.stringify(this.node),void this.stop()}Object.entries(null!==(c=null===(l=this.node)||void 0===l?void 0:l._links)&&void 0!==c?c:{}).some((([e,s])=>{var i,n;if(s.href!==t)return!1;const o=null===(n=null===(i=this.node)||void 0===i?void 0:i._embedded)||void 0===n?void 0:n[e];if(!o||!Array.isArray(o))return!1;const h=o.length<20?o.length:21,a=new URL(t),d=new URL(t);return a.searchParams.set("offset",o.length.toString()),d.searchParams.set("offset",h.toString()),r=JSON.stringify({returned_items:o.length,total_items:h,offset:0,limit:20,_embedded:{[e]:o},_links:{curies:this.node._links.curies,first:{href:t},last:{href:d.toString()},prev:{href:t},next:{href:a.toString()},self:{href:t}}}),this.stop(),!0}))})),new Response(r,{status:r?200:404})}let v,p=e=>e;class m extends(c(h)){constructor(){super(),this.lang="",this.parent="",this.related=[],this.__hrefToLoad=null,this.__group="",this.__unsubscribeFromRumour=null,this.__fetchEventQueue=[],this.__service=_(s.withConfig({services:{sendDelete:()=>this._sendDelete(),sendPatch:({edits:e})=>this._sendPatch(e),sendPost:({edits:e})=>this._sendPost(e),sendGet:()=>this._sendGet()},actions:{validate:r({errors:e=>{const t=this.constructor.v8n,s=i(i({},e.data),e.edits);return t.map((e=>e(s))).filter((e=>"string"==typeof e)).filter(((e,t,s)=>s.indexOf(e)===t))}})}})),this.__createService()}static get inferredProperties(){return[...super.inferredProperties,"group","lang"]}static get properties(){return{__state:{type:String,reflect:!0,attribute:"state"},related:{type:Array},parent:{type:String},group:{type:String,noAccessor:!0},href:{type:String,noAccessor:!0},lang:{type:String}}}static get v8n(){return[]}get failure(){return this.__service.state.context.failure}get errors(){return this.__service.state.context.errors}get form(){const{data:e,edits:t}=this.__service.state.context;return i(i({},e),t)}get data(){return this.__service.state.context.data}set data(e){this.__destroyRumour(),this.__hrefToLoad=null,this.__service.send({type:"SET_DATA",data:e}),e&&this.__createRumour()}get group(){return this.__group}set group(e){this.__group=e,this.__destroyRumour(),this.__createRumour()}get href(){var e,t,s;return null!==(s=null!==(t=null===(e=this.form._links)||void 0===e?void 0:e.self.href)&&void 0!==t?t:this.__hrefToLoad)&&void 0!==s?s:""}set href(e){this.__hrefToLoad=e,e?this.__service.send({type:"FETCH"}):this.data=null}in(e){return this.__service.state.matches(e)}undo(){this.__service.send({type:"UNDO"})}edit(e){var t;"string"==typeof(null===(t=e._links)||void 0===t?void 0:t.self.href)&&(this.__hrefToLoad=null),this.__service.send({type:"EDIT",data:e})}submit(){this.reportValidity(),this.__service.send({type:"SUBMIT"})}checkValidity(){const e=this.in({idle:{template:{dirty:"valid"}}}),t=this.in({idle:{snapshot:{dirty:"valid"}}}),s=this.in({idle:{template:{clean:"valid"}}}),r=this.in({idle:{snapshot:{clean:"valid"}}});return s||e||(r||t)}reportValidity(){const e=this.ownerDocument.createTreeWalker(this.renderRoot,NodeFilter.SHOW_ELEMENT);do{const t=e.currentNode,s=["reportValidity","validate"];for(const e of s)if(e in t)try{t[e]();break}catch(e){continue}}while(e.nextNode());return this.checkValidity()}delete(){this.__service.send({type:"DELETE"})}refresh(){this.__service.send({type:"REFRESH"})}render(){return o(v||(v=p`<slot></slot>`))}connectedCallback(){super.connectedCallback(),this.href&&!this.data&&this.__service.send({type:"FETCH"}),this.__createRumour(),this.__createServer(),this.__processFetchEventQueue(),this.dispatchEvent(new u)}disconnectedCallback(){super.disconnectedCallback(),this.__destroyRumour(),this.__destroyServer(),this.__flushFetchEventQueue("parent element was disconnected"),this.dispatchEvent(new u)}applyInferredProperties(e){var t,s;super.applyInferredProperties(e),null!==this.infer&&(this.group=null!==(t=e.get("group"))&&void 0!==t?t:"",this.lang=null!==(s=e.get("lang"))&&void 0!==s?s:"")}async _fetch(...e){const t=await new a(this).fetch(...e);if(!t.ok)throw t;return t.json()}async _sendPost(e){let t;this.__destroyRumour();try{const s=JSON.stringify(e),r=await this._fetch(this.parent,{body:s,method:"POST"});t=await this._fetch(r._links.self.href);const i=m.Rumour(this.group),n=[...this.related,this.parent];i.share({data:t,related:n,source:t._links.self.href})}finally{this.__createRumour()}return t}async _sendGet(){let e;this.__destroyRumour();try{e=await this._fetch(this.href),m.Rumour(this.group).share({data:e,source:this.href})}finally{this.__createRumour()}return e}async _sendPatch(e){let t;this.__destroyRumour();try{const s=JSON.stringify(e);t=await this._fetch(this.href,{body:s,method:"PATCH"});m.Rumour(this.group).share({data:t,source:this.href,related:this.related})}finally{this.__createRumour()}return t}async _sendDelete(){this.__destroyRumour();try{await this._fetch(this.href,{method:"DELETE"});const e=m.Rumour(this.group),t=[...this.related,this.parent];e.share({data:null,source:this.href,related:t})}finally{this.__createRumour()}return null}get __state(){const e=this.__service.state.toStrings().reduce(((e,t)=>[...e,...t.split(".")]),[]);return[...new Set(e)].join(" ")}__createService(){this.__service.onTransition((e=>{var t,s;if(!e.changed)return;let r;e.matches("idle")&&((null===(t=e.history)||void 0===t?void 0:t.matches({busy:"deleting"}))?r=l.ResourceDeleted:(null===(s=e.history)||void 0===s?void 0:s.matches({busy:"creating"}))&&(r=l.ResourceCreated)),this.requestUpdate(),this.dispatchEvent(new u("update",{detail:{result:r}})),e.matches("busy")||this.__processFetchEventQueue()})),this.__service.onChange((()=>{this.requestUpdate(),this.dispatchEvent(new u)})),this.__service.start()}__createRumour(){const e=m.Rumour(this.group);this.__unsubscribeFromRumour=e.track((e=>this.__handleRumourUpdate(e)))}__destroyRumour(){var e;null===(e=this.__unsubscribeFromRumour)||void 0===e||e.call(this),this.__unsubscribeFromRumour=null}__createServer(){this.__fetchEventHandler=this.__handleFetchEvent.bind(this),this.addEventListener("fetch",this.__fetchEventHandler)}__destroyServer(){this.removeEventListener("fetch",this.__fetchEventHandler)}__handleRumourUpdate(e){var t;try{const s=null===(t=this.__service.state)||void 0===t?void 0:t.context.data,r=s?e(s):s;if(r!==s&&(this.data=r,!r)){const e=l.ResourceDeleted,t=new u("update",{detail:{result:e}});this.dispatchEvent(t)}}catch(e){if(!(e instanceof n.UpdateError))throw e;this.__service.send({type:"REFRESH"})}}__processFetchEventQueue(){const e=new m.API(this);this.__fetchEventQueue.forEach((t=>{const s=t.request,r=f(s.url,this.data),i=r.ok?r:e.fetch(s);t.respondWith(Promise.resolve(i)),r.ok&&console.debug(`%c@foxy.io/elements::${this.localName}\n%c200%c GET ${s.url}`,"color: gray","background: gray; padding: 0 .2em; border-radius: .2em; color: white;","")})),this.__fetchEventQueue=[]}__flushFetchEventQueue(e){this.__fetchEventQueue.forEach((t=>{t.respondWith(Promise.reject(new Error(e)))})),this.__fetchEventQueue=[]}__handleFetchEvent(e){e instanceof d&&(e.defaultPrevented||"GET"===e.request.method&&(e.request.url.startsWith("foxy://")||e.composedPath()[0]!==this&&(e.preventDefault(),this.__fetchEventQueue.push(e),this.__service.state.matches("busy")||this.__processFetchEventQueue())))}}m.UpdateEvent=u,m.Rumour=t((()=>new n)),m.API=a;export{m as N,f as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-46f3f71c.js";import{I as e}from"./shared-91eb066c.js";import{h as t,c as i}from"./shared-7f33a83a.js";import{_ as n,Y as r}from"./shared-0dabe195.js";import"./shared-9bdd5400.js";import"./shared-8128b5e3.js";import"./foxy-spinner.js";import{C as s}from"./shared-1fd59009.js";import{T as a}from"./shared-a88c5cf1.js";import{N as o}from"./shared-a6517170.js";import{c as l}from"./shared-4e709717.js";let d,c=e=>e;customElements.define("foxy-internal-delete-control",class extends e{constructor(){super(...arguments),this.theme="error"}static get properties(){return n(n({},super.properties),{},{theme:{type:String}})}renderControl(){return t(d||(d=c` <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" infer="" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button data-testid="delete" theme="${0}" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="delete"></foxy-i18n> </vaadin-button> `),(e=>{var t;return!e.detail.cancelled&&(null===(t=this.nucleon)||void 0===t?void 0:t.delete())}),this.theme,this.disabled||this.readonly,(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}))}});let m,f=e=>e;customElements.define("foxy-internal-create-control",class extends e{constructor(){super(...arguments),this.theme="primary success"}static get properties(){return n(n({},super.properties),{},{theme:{type:String}})}renderControl(){return t(m||(m=f` <vaadin-button class="w-full" theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="create"></foxy-i18n> </vaadin-button> `),this.theme,this.disabled||this.__isInvalid,(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.submit()}))}get __isCleanTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{clean:"invalid"}}}))}get __isDirtyTemplateInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{template:{dirty:"invalid"}}}))}get __isCleanSnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{clean:"invalid"}}}))}get __isDirtySnapshotInvalid(){var e;return!!(null===(e=this.nucleon)||void 0===e?void 0:e.in({idle:{snapshot:{dirty:"invalid"}}}))}get __isTemplateInvalid(){return this.__isCleanTemplateInvalid||this.__isDirtyTemplateInvalid}get __isSnapshotInvalid(){return this.__isCleanSnapshotInvalid||this.__isDirtySnapshotInvalid}get __isInvalid(){return this.__isSnapshotInvalid||this.__isTemplateInvalid}});let p,y,u=e=>e;customElements.define("foxy-internal-timestamps-control",class extends e{static get styles(){return[super.styles,i(p||(p=u`.max-w-0{max-width:0}`))]}renderControl(){return t(y||(y=u` <table class="font-lumo text-m leading-m w-full"> <tbody class="divide-y divide-contrast-10"> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n infer="" key="date_created"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" infer="" key="date"> </foxy-i18n> </td> </tr> <tr> <td class="max-w-0 truncate py-s text-secondary w-1-3 pr-m"> <foxy-i18n infer="" key="date_modified"></foxy-i18n> </td> <td class="max-w-0 truncate py-s text-body w-2-3"> <foxy-i18n options="${0}" infer="" key="date"> </foxy-i18n> </td> </tr> </tbody> </table> `),JSON.stringify({value:r(this,"nucleon.form.date_created")}),JSON.stringify({value:r(this,"nucleon.form.date_modified")}))}});let h,v,x,_=e=>e;const b=s(a(o));class g extends b{renderBody(){return this.data?t(h||(h=_` <foxy-internal-timestamps-control infer="timestamps"></foxy-internal-timestamps-control> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> `)):t(v||(v=_`<foxy-internal-create-control infer="create"></foxy-internal-create-control>`))}render(){const e=!(this.in("idle")||this.in({busy:"fetching"})&&this.data);return t(x||(x=_` <div aria-busy="${0}" aria-live="polite" class="relative"> <div class="${0}"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="${0}" class="m-auto" state="${0}" infer="spinner"> </foxy-spinner> </div> </div> `),this.in("busy"),l({"grid grid-cols-1 gap-m":!0,"transition-opacity":!0,"opacity-0 pointer-events-none":e}),this.renderBody(),l({"transition-opacity absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!e}),this.in("fail")?"vertical":"no-label",this.in("fail")?"error":"busy")}}customElements.define("foxy-internal-form",g);export{g as I};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as e}from"./shared-0dabe195.js";import{F as s}from"./shared-343d1fd7.js";class t extends e{constructor(e){super({base:new URL(document.baseURI),fetch:(...n)=>new Promise(((o,a)=>{const r="string"==typeof n[0]?new t.WHATWGRequest(...n):n[0];r.headers.set("Content-Type","application/json"),r.headers.set("FOXY-API-VERSION","1");const c=new s("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:r,resolve:o,reject:a});e.dispatchEvent(c),c.defaultPrevented||o(new Response(null,{status:500}))}))})}}t.FetchEvent=s;export{t as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,am as t,_ as r}from"./shared-0dabe195.js";import{h as n,L as s}from"./shared-7f33a83a.js";import{A as o}from"./shared-7e887e5b.js";import"./shared-e640e9fa.js";import{C as i}from"./shared-1fd59009.js";import{F as a}from"./shared-343d1fd7.js";import{I as u}from"./shared-763a6797.js";var l=e((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatCookie=void 0;var r=function(e){var t=e.path,r=e.domain,n=e.expires,s=e.secure,o=function(e){var t=e.sameSite;return void 0===t?null:["none","lax","strict"].indexOf(t.toLowerCase())>=0?t:null}(e);return[null==t?"":";path="+t,null==r?"":";domain="+r,null==n?"":";expires="+n.toUTCString(),void 0===s||!1===s?"":";secure",null===o?"":";SameSite="+o].join("")};t.formatCookie=function(e,t,n){return[encodeURIComponent(e),"=",encodeURIComponent(t),r(n)].join("")}})),c=e((function(e,t){function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,s=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){s=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(s)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.parseCookies=void 0;t.parseCookies=function(e){if(0===e.length)return{};var t={},n=new RegExp("\\s*;\\s*");return e.split(n).forEach((function(e){var n=r(e.split("="),2),s=n[0],o=n[1],i=decodeURIComponent(s),a=decodeURIComponent(o);t[i]=a})),t}})),f=e((function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.CookieStorage=void 0;var n=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._defaultOptions=Object.assign({domain:null,expires:null,path:null,secure:!1},t),"undefined"!=typeof Proxy)return new Proxy(this,s)}var t,n,o;return t=e,(n=[{key:"clear",value:function(){var e=this,t=c.parseCookies(this._getCookie());Object.keys(t).forEach((function(t){return e.removeItem(t)}))}},{key:"getItem",value:function(e){var t=c.parseCookies(this._getCookie());return Object.prototype.hasOwnProperty.call(t,e)?t[e]:null}},{key:"key",value:function(e){var t=c.parseCookies(this._getCookie()),r=Object.keys(t).sort();return e<r.length?r[e]:null}},{key:"removeItem",value:function(e,t){var r=Object.assign(Object.assign(Object.assign({},this._defaultOptions),t),{expires:new Date(0)}),n=l.formatCookie(e,"",r);this._setCookie(n)}},{key:"setItem",value:function(e,t,r){var n=Object.assign(Object.assign({},this._defaultOptions),r),s=l.formatCookie(e,t,n);this._setCookie(s)}},{key:"_getCookie",value:function(){return"undefined"==typeof document||void 0===document.cookie?"":document.cookie}},{key:"_setCookie",value:function(e){document.cookie=e}},{key:"length",get:function(){var e=c.parseCookies(this._getCookie());return Object.keys(e).length}}])&&r(t.prototype,n),o&&r(t,o),e}();t.CookieStorage=n;var s={defineProperty:function(e,t,r){return e.setItem(t.toString(),String(r.value)),!0},deleteProperty:function(e,t){return e.removeItem(t.toString()),!0},get:function(e,t,r){if("string"==typeof t&&t in e)return e[t];var n=e.getItem(t.toString());return null!==n?n:void 0},getOwnPropertyDescriptor:function(e,t){if(!(t in e))return{configurable:!0,enumerable:!0,value:e.getItem(t.toString()),writable:!0}},has:function(e,t){return"string"==typeof t&&t in e||null!==e.getItem(t.toString())},ownKeys:function(e){for(var t=[],r=0;r<e.length;r++){var n=e.key(r);null!==n&&t.push(n)}return t},preventExtensions:function(e){throw new TypeError("can't prevent extensions on this proxy object")},set:function(e,t,r,n){return e.setItem(t.toString(),String(r)),!0}}})),p=t(e((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"CookieStorage",{enumerable:!0,get:function(){return f.CookieStorage}}),Object.defineProperty(t,"formatCookie",{enumerable:!0,get:function(){return l.formatCookie}}),Object.defineProperty(t,"parseCookies",{enumerable:!0,get:function(){return c.parseCookies}})})));class h extends p.CookieStorage{constructor(){super({sameSite:"Strict",expires:new Date,secure:!0,domain:location.hostname,path:"/"})}getItem(e){if(e===o.SESSION){const e=super.getItem("fx.customer"),t=super.getItem("fx.customer.duration"),r=super.getItem("fx.customer.start"),n=super.getItem("fx.customer.jwt");if(null===e||null===t||null===r||null===n)return null;const s={session_token:e,date_created:r,expires_in:parseInt(t),jwt:n},o=super.getItem("fx.customer.sso");return null!==o&&(s.sso=o),JSON.stringify(s)}return super.getItem(e)}setItem(e,t,r){if(e!==o.SESSION)return super.setItem(e,t,r);{const e=JSON.parse(t),r=1e3*e.expires_in,n=new Date(new Date(e.date_created).getTime()+r);super.setItem("fx.customer",e.session_token,{expires:n}),super.setItem("fx.customer.jwt",e.jwt,{expires:n}),super.setItem("fx.customer.start",e.date_created,{expires:n}),super.setItem("fx.customer.duration",String(e.expires_in),{expires:n}),e.sso&&super.setItem("fx.customer.sso",e.sso,{expires:n})}}clear(){for(let e=0;e<this.length;){const t=super.key(e);t.startsWith("fx.customer")?super.removeItem(t):e++}}}const d=new h;let m,g=e=>e;class _ extends(i(u(s))){constructor(){var e;super(...arguments),e=this,this.__storage="local",this.__level=0,this.__base=location.origin,this.__api=this.__createAPIInstance(),this.__handleFetch=async function(t){if(!(t instanceof a))return;if(t.defaultPrevented)return;if(t.composedPath()[0]===e)return;t.preventDefault();const r=new a("fetch",{cancelable:!0,composed:!0,request:t.request,bubbles:!0,reject:e=>t.respondWith(Promise.reject(e)),resolve:n=>{"foxy://customer-api/session"===r.request.url&&e.requestUpdate(),401===n.status&&e.requestUpdate(),t.respondWith(Promise.resolve(n))}});e.dispatchEvent(r)&&r.respondWith(e.__handleRequest(r.request))}}static get properties(){return r(r({},super.properties),{},{storage:{type:String,noAccessor:!0},level:{type:Number,noAccessor:!0},base:{type:String,noAccessor:!0}})}get isLoggedIn(){return!!this.api.storage.getItem(o.SESSION)}get api(){return this.__api}get base(){return this.__base}set base(e){this.__base=e,this.__api=this.__createAPIInstance()}get level(){return this.__level}set level(e){this.__level=e,this.__api=this.__createAPIInstance()}get storage(){return this.__storage}set storage(e){this.__storage=e,this.__api=this.__createAPIInstance()}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}render(){return n(m||(m=g` ${0} <slot></slot> `),this.renderTemplateOrSlot(this.isLoggedIn?"logged-in":"logged-out"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}__createAPIInstance(){const e={session:sessionStorage,cookie:d,local:localStorage};return new o({storage:e[this.storage],level:this.level,base:new URL(this.base)})}async __handleVirtualAuthSessionDelete(){return await this.api.signOut(),this.dispatchEvent(new _.SignOutEvent("signout")),this.requestUpdate(),new Response}async __handleVirtualAuthSessionPost(e){const t=await e.clone().json();if("password"!==t.type)throw new Error(`Unknown payload type ${t.type}`);let n,s;try{await this.api.signIn(t.credential),this.dispatchEvent(new _.SignInEvent("signin")),this.requestUpdate(),n=200,s=r({_links:{self:{href:e.url}}},t)}catch(e){if(!(e instanceof o.AuthError))throw e;if("UNAUTHORIZED"!==e.code)throw e;n=401,s={total:1,_embedded:{"fx:errors":[{message:e.message,logref:"unavailable",code:"invalid_credential_error"}]}}}return new Response(JSON.stringify(s),{status:n})}async __handleVirtualAuthSessionGet(e){return new Response(JSON.stringify({_links:{self:{href:e.url}},type:"password",credential:{email:"",password:""}}))}async __handleVirtualAuthRecoverPost(e){const t=await e.clone().json();if("email"===t.type)return await this.api.sendPasswordResetEmail(t.detail),new Response(JSON.stringify({_links:{self:{href:e.url}},email:t.email}));throw new Error(`Unknown payload type ${t.type}`)}async __handleVirtualAuthRecoverGet(e){return new Response(JSON.stringify({_links:{self:{href:e.url}},email:""}))}async __handleRequest(e){const t=e.url,r=e.method;try{if("foxy://customer-api/session"===t){if("DELETE"===r)return this.__handleVirtualAuthSessionDelete();if("POST"===r)return this.__handleVirtualAuthSessionPost(e);if("GET"===r)return this.__handleVirtualAuthSessionGet(e)}if("foxy://customer-api/recover"===t){if("POST"===r)return this.__handleVirtualAuthRecoverPost(e);if("GET"===r)return this.__handleVirtualAuthRecoverGet(e)}const n=await this.api.fetch(e);return 401===n.status&&(this.api.storage.clear(),this.dispatchEvent(new _.SignOutEvent("signout")),this.requestUpdate()),n}catch(e){return new Response(null,{status:500})}}}_.SignOutEvent=class extends CustomEvent{},_.SignInEvent=class extends CustomEvent{};export{_ as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-ad0256d0.js";import"./shared-0689b25a.js";import{I as e}from"./shared-a134d313.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";let s,l=e=>e;customElements.define("foxy-internal-password-control",class extends e{renderControl(){return r(s||(s=l` <vaadin-password-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> `),a(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var a;return"Enter"===e.key&&(null===(a=this.nucleon)||void 0===a?void 0:a.submit())}),(e=>{const a=e.currentTarget;this._value=a.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { LitElement, PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
|
-
declare const enum Steps {
|
|
3
|
-
CurrentPassword = 1,
|
|
4
|
-
NewPassword = 2,
|
|
5
|
-
Done = 3
|
|
6
|
-
}
|
|
7
|
-
declare const Base: typeof LitElement & import("lit-element").Constructor<import("../../../mixins/inferrable").InferrableMixinHost> & {
|
|
8
|
-
inferredProperties: string[];
|
|
9
|
-
} & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
10
|
-
defaultNS: string;
|
|
11
|
-
} & {
|
|
12
|
-
styles: import("lit-element").CSSResultArray;
|
|
13
|
-
};
|
|
14
|
-
export declare class InternalCustomerPortalChangePassword extends Base {
|
|
15
|
-
static get properties(): PropertyDeclarations;
|
|
16
|
-
isErrorVisible: boolean;
|
|
17
|
-
disabled: boolean;
|
|
18
|
-
customer: string;
|
|
19
|
-
session: string;
|
|
20
|
-
email: string;
|
|
21
|
-
step: Steps;
|
|
22
|
-
private readonly __handleTriggerClick;
|
|
23
|
-
private readonly __handleSignInFormUpdate;
|
|
24
|
-
private readonly __handleSignInFormFetch;
|
|
25
|
-
private readonly __renderSignInForm;
|
|
26
|
-
render(): TemplateResult;
|
|
27
|
-
private __getResponse;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { LitElement, html } from 'lit-element';
|
|
2
|
-
import { API } from "../NucleonElement/API.js";
|
|
3
|
-
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
4
|
-
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
5
|
-
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
6
|
-
import { InferrableMixin } from "../../../mixins/inferrable.js";
|
|
7
|
-
const Base = ResponsiveMixin(ThemeableMixin(TranslatableMixin(InferrableMixin(LitElement))));
|
|
8
|
-
export class InternalCustomerPortalChangePassword extends Base {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.isErrorVisible = false;
|
|
12
|
-
this.disabled = false;
|
|
13
|
-
this.customer = '';
|
|
14
|
-
this.session = '';
|
|
15
|
-
this.email = '';
|
|
16
|
-
this.step = 1 /* CurrentPassword */;
|
|
17
|
-
this.__handleTriggerClick = (evt) => {
|
|
18
|
-
const button = evt.currentTarget;
|
|
19
|
-
const dialog = this.renderRoot.querySelector('#dialog');
|
|
20
|
-
this.isErrorVisible = false;
|
|
21
|
-
this.step = 1 /* CurrentPassword */;
|
|
22
|
-
dialog.show(button);
|
|
23
|
-
};
|
|
24
|
-
this.__handleSignInFormUpdate = (evt, ctx) => {
|
|
25
|
-
var _a, _b, _c, _d;
|
|
26
|
-
ctx.handleUpdate(evt);
|
|
27
|
-
const target = evt.currentTarget;
|
|
28
|
-
if (((_a = target.form.credential) === null || _a === void 0 ? void 0 : _a.email) || !this.email)
|
|
29
|
-
return;
|
|
30
|
-
target.edit({
|
|
31
|
-
type: (_b = target.form.type) !== null && _b !== void 0 ? _b : 'password',
|
|
32
|
-
credential: {
|
|
33
|
-
email: this.email,
|
|
34
|
-
password: (_d = (_c = target.form.credential) === null || _c === void 0 ? void 0 : _c.password) !== null && _d !== void 0 ? _d : '',
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
this.__handleSignInFormFetch = (evt) => {
|
|
39
|
-
if (evt.defaultPrevented)
|
|
40
|
-
return;
|
|
41
|
-
if (evt.request.method !== 'POST')
|
|
42
|
-
return;
|
|
43
|
-
if (evt.request.url !== this.session)
|
|
44
|
-
return;
|
|
45
|
-
evt.preventDefault();
|
|
46
|
-
evt.stopImmediatePropagation();
|
|
47
|
-
evt.respondWith(this.__getResponse(evt.request));
|
|
48
|
-
};
|
|
49
|
-
this.__renderSignInForm = ctx => {
|
|
50
|
-
const readonlyControls = [];
|
|
51
|
-
const hiddenControls = ['email'];
|
|
52
|
-
let background = 'bg-primary-10';
|
|
53
|
-
let foreground = 'text-primary';
|
|
54
|
-
let icon = 'icons:lock-outline';
|
|
55
|
-
let slot = 'password:before';
|
|
56
|
-
if (this.step === 2 /* NewPassword */) {
|
|
57
|
-
hiddenControls.push('password');
|
|
58
|
-
slot = 'new-password:before';
|
|
59
|
-
icon = 'icons:lock-open';
|
|
60
|
-
}
|
|
61
|
-
if (this.step === 3 /* Done */) {
|
|
62
|
-
readonlyControls.push('new-password');
|
|
63
|
-
hiddenControls.push('password', 'submit');
|
|
64
|
-
background = 'bg-success-10';
|
|
65
|
-
foreground = 'text-success';
|
|
66
|
-
slot = 'new-password:before';
|
|
67
|
-
icon = 'icons:done-all';
|
|
68
|
-
}
|
|
69
|
-
if (!this.isErrorVisible)
|
|
70
|
-
hiddenControls.push('error');
|
|
71
|
-
return html `
|
|
72
|
-
<foxy-sign-in-form
|
|
73
|
-
readonlycontrols=${readonlyControls.join(' ')}
|
|
74
|
-
hiddencontrols=${hiddenControls.join(' ')}
|
|
75
|
-
parent=${this.session}
|
|
76
|
-
class="mt-s"
|
|
77
|
-
lang=${ctx.dialog.lang}
|
|
78
|
-
ns=${ctx.dialog.ns}
|
|
79
|
-
@update=${(evt) => this.__handleSignInFormUpdate(evt, ctx)}
|
|
80
|
-
@fetch=${this.__handleSignInFormFetch}
|
|
81
|
-
>
|
|
82
|
-
<div class="mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l ${background}" slot=${slot}>
|
|
83
|
-
<iron-icon icon=${icon} class="m-auto ${foreground}"></iron-icon>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<foxy-i18n
|
|
87
|
-
class="block text-center text-m text-secondary leading-m mb-m"
|
|
88
|
-
lang=${ctx.dialog.lang}
|
|
89
|
-
slot=${slot}
|
|
90
|
-
key="change_password_step_${this.step}"
|
|
91
|
-
ns=${ctx.dialog.ns}
|
|
92
|
-
>
|
|
93
|
-
</foxy-i18n>
|
|
94
|
-
</foxy-sign-in-form>
|
|
95
|
-
`;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
static get properties() {
|
|
99
|
-
return {
|
|
100
|
-
...super.properties,
|
|
101
|
-
isErrorVisible: { attribute: false },
|
|
102
|
-
disabled: { type: Boolean },
|
|
103
|
-
customer: { type: String },
|
|
104
|
-
session: { type: String },
|
|
105
|
-
email: { type: String },
|
|
106
|
-
step: { attribute: false },
|
|
107
|
-
fail: { attribute: false },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
render() {
|
|
111
|
-
return html `
|
|
112
|
-
<foxy-form-dialog
|
|
113
|
-
hiddencontrols="save-button"
|
|
114
|
-
header="change_password"
|
|
115
|
-
lang=${this.lang}
|
|
116
|
-
ns=${this.ns}
|
|
117
|
-
alert
|
|
118
|
-
id="dialog"
|
|
119
|
-
keep-open-on-post
|
|
120
|
-
.form=${this.__renderSignInForm}
|
|
121
|
-
>
|
|
122
|
-
</foxy-form-dialog>
|
|
123
|
-
|
|
124
|
-
<vaadin-button class="w-full" ?disabled=${this.disabled} @click=${this.__handleTriggerClick}>
|
|
125
|
-
<foxy-i18n lang=${this.lang} key="change_password" ns=${this.ns}></foxy-i18n>
|
|
126
|
-
</vaadin-button>
|
|
127
|
-
`;
|
|
128
|
-
}
|
|
129
|
-
async __getResponse(request) {
|
|
130
|
-
const json = (await request.clone().json());
|
|
131
|
-
const api = new API(this);
|
|
132
|
-
this.isErrorVisible = false;
|
|
133
|
-
if (this.step === 1 /* CurrentPassword */) {
|
|
134
|
-
const response = await api.fetch(request.url, {
|
|
135
|
-
method: request.method,
|
|
136
|
-
body: JSON.stringify(json),
|
|
137
|
-
});
|
|
138
|
-
if (response.ok) {
|
|
139
|
-
this.step = 2 /* NewPassword */;
|
|
140
|
-
const body = { _embedded: { 'fx:errors': [{ code: 'new_password_required_error' }] } };
|
|
141
|
-
return new API.WHATWGResponse(JSON.stringify(body), { status: 400 });
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.isErrorVisible = true;
|
|
145
|
-
return response;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (this.step === 2 /* NewPassword */) {
|
|
149
|
-
const response = await api.fetch(this.customer, {
|
|
150
|
-
method: 'PATCH',
|
|
151
|
-
body: JSON.stringify({
|
|
152
|
-
password: json.credential.new_password,
|
|
153
|
-
password_old: json.credential.password,
|
|
154
|
-
}),
|
|
155
|
-
});
|
|
156
|
-
if (response.ok) {
|
|
157
|
-
this.step = 3 /* Done */;
|
|
158
|
-
json._links = { self: { href: request.url } };
|
|
159
|
-
return new API.WHATWGResponse(JSON.stringify(json));
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
this.isErrorVisible = true;
|
|
163
|
-
return response;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return api.fetch(request);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=InternalCustomerPortalChangePassword.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCustomerPortalChangePassword.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalChangePassword.ts"],"names":[],"mappings":"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","sourcesContent":["import { FormRenderer, FormRendererContext } from '../FormDialog/types';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '../NucleonElement/API';\nimport { ButtonElement } from '@vaadin/vaadin-button';\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { SignInForm } from '../SignInForm/SignInForm';\nimport { Data as SignInFormData } from '../SignInForm/types';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst enum Steps {\n CurrentPassword = 1,\n NewPassword = 2,\n Done = 3,\n}\n\nconst Base = ResponsiveMixin(ThemeableMixin(TranslatableMixin(InferrableMixin(LitElement))));\n\ntype UpdateEvent = InstanceType<typeof SignInForm.UpdateEvent>;\ntype FetchEvent = InstanceType<typeof SignInForm.API.FetchEvent>;\n\nexport class InternalCustomerPortalChangePassword extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n isErrorVisible: { attribute: false },\n disabled: { type: Boolean },\n customer: { type: String },\n session: { type: String },\n email: { type: String },\n step: { attribute: false },\n fail: { attribute: false },\n };\n }\n\n isErrorVisible = false;\n\n disabled = false;\n\n customer = '';\n\n session = '';\n\n email = '';\n\n step = Steps.CurrentPassword;\n\n private readonly __handleTriggerClick = (evt: CustomEvent<void>) => {\n const button = evt.currentTarget as ButtonElement;\n const dialog = this.renderRoot.querySelector('#dialog') as FormDialog;\n\n this.isErrorVisible = false;\n this.step = Steps.CurrentPassword;\n\n dialog.show(button);\n };\n\n private readonly __handleSignInFormUpdate = (evt: UpdateEvent, ctx: FormRendererContext) => {\n ctx.handleUpdate(evt);\n\n const target = evt.currentTarget as SignInForm;\n if (target.form.credential?.email || !this.email) return;\n\n target.edit({\n type: target.form.type ?? 'password',\n credential: {\n email: this.email,\n password: target.form.credential?.password ?? '',\n },\n });\n };\n\n private readonly __handleSignInFormFetch = (evt: FetchEvent) => {\n if (evt.defaultPrevented) return;\n if (evt.request.method !== 'POST') return;\n if (evt.request.url !== this.session) return;\n\n evt.preventDefault();\n evt.stopImmediatePropagation();\n evt.respondWith(this.__getResponse(evt.request));\n };\n\n private readonly __renderSignInForm: FormRenderer = ctx => {\n const readonlyControls: string[] = [];\n const hiddenControls: string[] = ['email'];\n\n let background = 'bg-primary-10';\n let foreground = 'text-primary';\n let icon = 'icons:lock-outline';\n let slot = 'password:before';\n\n if (this.step === Steps.NewPassword) {\n hiddenControls.push('password');\n slot = 'new-password:before';\n icon = 'icons:lock-open';\n }\n\n if (this.step === Steps.Done) {\n readonlyControls.push('new-password');\n hiddenControls.push('password', 'submit');\n background = 'bg-success-10';\n foreground = 'text-success';\n slot = 'new-password:before';\n icon = 'icons:done-all';\n }\n\n if (!this.isErrorVisible) hiddenControls.push('error');\n\n return html`\n <foxy-sign-in-form\n readonlycontrols=${readonlyControls.join(' ')}\n hiddencontrols=${hiddenControls.join(' ')}\n parent=${this.session}\n class=\"mt-s\"\n lang=${ctx.dialog.lang}\n ns=${ctx.dialog.ns}\n @update=${(evt: UpdateEvent) => this.__handleSignInFormUpdate(evt, ctx)}\n @fetch=${this.__handleSignInFormFetch}\n >\n <div class=\"mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l ${background}\" slot=${slot}>\n <iron-icon icon=${icon} class=\"m-auto ${foreground}\"></iron-icon>\n </div>\n\n <foxy-i18n\n class=\"block text-center text-m text-secondary leading-m mb-m\"\n lang=${ctx.dialog.lang}\n slot=${slot}\n key=\"change_password_step_${this.step}\"\n ns=${ctx.dialog.ns}\n >\n </foxy-i18n>\n </foxy-sign-in-form>\n `;\n };\n\n render(): TemplateResult {\n return html`\n <foxy-form-dialog\n hiddencontrols=\"save-button\"\n header=\"change_password\"\n lang=${this.lang}\n ns=${this.ns}\n alert\n id=\"dialog\"\n keep-open-on-post\n .form=${this.__renderSignInForm}\n >\n </foxy-form-dialog>\n\n <vaadin-button class=\"w-full\" ?disabled=${this.disabled} @click=${this.__handleTriggerClick}>\n <foxy-i18n lang=${this.lang} key=\"change_password\" ns=${this.ns}></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private async __getResponse(request: Request): Promise<Response> {\n const json = (await request.clone().json()) as SignInFormData;\n const api = new API(this);\n\n this.isErrorVisible = false;\n\n if (this.step === Steps.CurrentPassword) {\n const response = await api.fetch(request.url, {\n method: request.method,\n body: JSON.stringify(json),\n });\n\n if (response.ok) {\n this.step = Steps.NewPassword;\n const body = { _embedded: { 'fx:errors': [{ code: 'new_password_required_error' }] } };\n return new API.WHATWGResponse(JSON.stringify(body), { status: 400 });\n } else {\n this.isErrorVisible = true;\n return response;\n }\n }\n\n if (this.step === Steps.NewPassword) {\n const response = await api.fetch(this.customer, {\n method: 'PATCH',\n body: JSON.stringify({\n password: json.credential.new_password,\n password_old: json.credential.password,\n }),\n });\n\n if (response.ok) {\n this.step = Steps.Done;\n json._links = { self: { href: request.url } };\n return new API.WHATWGResponse(JSON.stringify(json));\n } else {\n this.isErrorVisible = true;\n return response;\n }\n }\n\n return api.fetch(request);\n }\n}\n"]}
|