@foxy.io/elements 1.14.2 → 1.15.0-beta.3
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 +1 -1
- package/dist/cdn/foxy-address-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-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -0
- package/dist/cdn/foxy-coupon-code-form.js +1 -0
- package/dist/cdn/foxy-coupon-codes-form.js +1 -0
- package/dist/cdn/foxy-coupon-form.js +1 -0
- 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 +4 -807
- package/dist/cdn/foxy-customer-portal.js +2 -2
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.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-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -0
- package/dist/cdn/foxy-i18n.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 -0
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -69
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.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-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-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-74b9e1d1.js → shared-0bda8ecb.js} +1 -1
- package/dist/cdn/{shared-07abcd7b.js → shared-0fcdd1c4.js} +1 -1
- package/dist/cdn/{shared-a46edf4b.js → shared-30131f76.js} +1 -1
- package/dist/cdn/shared-36629ded.js +131 -0
- package/dist/cdn/{shared-bc2bfe52.js → shared-4038cb18.js} +1 -1
- package/dist/cdn/{shared-44cfc617.js → shared-423a4840.js} +1 -1
- package/dist/cdn/shared-4fa5f144.js +1 -0
- package/dist/cdn/shared-51b5e223.js +1 -0
- package/dist/cdn/{shared-593f7e2c.js → shared-51e28c83.js} +1 -1
- package/dist/cdn/shared-710ed658.js +134 -0
- package/dist/cdn/shared-800a5471.js +1 -0
- package/dist/cdn/{shared-8a7bee0d.js → shared-8f7a66c4.js} +1 -1
- package/dist/cdn/{shared-91e768be.js → shared-9af7b5f0.js} +1 -1
- package/dist/cdn/{shared-7a42073a.js → shared-a11160e7.js} +5 -5
- package/dist/cdn/{shared-5f54e916.js → shared-a4e6ecb0.js} +1 -1
- package/dist/cdn/{shared-6ebe3825.js → shared-a8d96c23.js} +1 -1
- package/dist/cdn/{shared-322e60b1.js → shared-b03b6d72.js} +1 -1
- package/dist/cdn/shared-b2330475.js +1 -0
- package/dist/cdn/{shared-1761daef.js → shared-c1dadefe.js} +1 -1
- package/dist/cdn/shared-c6a4b2d6.js +1 -0
- package/dist/cdn/shared-ccea5a33.js +69 -0
- package/dist/cdn/shared-cd3c902e.js +1 -0
- package/dist/cdn/{shared-34b2c1e2.js → shared-d3831f99.js} +1 -1
- package/dist/cdn/shared-d9a260f0.js +1 -0
- package/dist/cdn/{shared-b1fc5dc3.js → shared-f875a4f8.js} +1 -1
- package/dist/cdn/{shared-e7f8ffe9.js → shared-fb403e1f.js} +1 -1
- package/dist/cdn/shared-ff149b55.js +804 -0
- package/dist/cdn/translations/customer-portal/zh-hk.json +35 -0
- package/dist/cdn/translations/shared/en.json +105 -0
- package/dist/cdn/translations/shared/zh-hk.json +179 -0
- package/dist/elements/private/Checkbox/Checkbox.js +36 -22
- package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
- package/dist/elements/private/EditableList/EditableList.d.ts +20 -0
- package/dist/elements/private/EditableList/EditableList.js +123 -0
- package/dist/elements/private/EditableList/EditableList.js.map +1 -0
- package/dist/elements/public/CouponCard/CouponCard.d.ts +29 -0
- package/dist/elements/public/CouponCard/CouponCard.js +130 -0
- package/dist/elements/public/CouponCard/CouponCard.js.map +1 -0
- package/dist/elements/public/CouponCard/index.d.ts +5 -0
- package/dist/elements/public/CouponCard/index.js +7 -0
- package/dist/elements/public/CouponCard/index.js.map +1 -0
- package/dist/elements/public/CouponCard/types.d.ts +15 -0
- package/dist/elements/public/CouponCard/types.js +2 -0
- package/dist/elements/public/CouponCard/types.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.d.ts +45 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +218 -0
- package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/index.d.ts +8 -0
- package/dist/elements/public/CouponCodeForm/index.js +10 -0
- package/dist/elements/public/CouponCodeForm/index.js.map +1 -0
- package/dist/elements/public/CouponCodeForm/types.d.ts +15 -0
- package/dist/elements/public/CouponCodeForm/types.js +2 -0
- package/dist/elements/public/CouponCodeForm/types.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.d.ts +29 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js +209 -0
- package/dist/elements/public/CouponCodesForm/CouponCodesForm.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/index.d.ts +8 -0
- package/dist/elements/public/CouponCodesForm/index.js +12 -0
- package/dist/elements/public/CouponCodesForm/index.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.d.ts +14 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.js +48 -0
- package/dist/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.js.map +1 -0
- package/dist/elements/public/CouponCodesForm/types.d.ts +16 -0
- package/dist/elements/public/CouponCodesForm/types.js +2 -0
- package/dist/elements/public/CouponCodesForm/types.js.map +1 -0
- package/dist/elements/public/CouponForm/CouponForm.d.ts +77 -0
- package/dist/elements/public/CouponForm/CouponForm.js +1266 -0
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -0
- package/dist/elements/public/CouponForm/index.d.ts +19 -0
- package/dist/elements/public/CouponForm/index.js +21 -0
- package/dist/elements/public/CouponForm/index.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.d.ts +19 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js +98 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPage.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.d.ts +19 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js +51 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItem.js.map +1 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.d.ts +19 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js +52 -0
- package/dist/elements/public/CouponForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
- package/dist/elements/public/CouponForm/types.d.ts +27 -0
- package/dist/elements/public/CouponForm/types.js +2 -0
- package/dist/elements/public/CouponForm/types.js.map +1 -0
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.d.ts +39 -0
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.js +197 -0
- package/dist/elements/public/GenerateCodesForm/GenerateCodesForm.js.map +1 -0
- package/dist/elements/public/GenerateCodesForm/index.d.ts +8 -0
- package/dist/elements/public/GenerateCodesForm/index.js +10 -0
- package/dist/elements/public/GenerateCodesForm/index.js.map +1 -0
- package/dist/elements/public/GenerateCodesForm/types.d.ts +24 -0
- package/dist/elements/public/GenerateCodesForm/types.js +2 -0
- package/dist/elements/public/GenerateCodesForm/types.js.map +1 -0
- package/dist/elements/public/I18n/format/date.js +7 -6
- package/dist/elements/public/I18n/format/date.js.map +1 -1
- package/dist/elements/public/I18n/format/discount.d.ts +6 -0
- package/dist/elements/public/I18n/format/discount.js +20 -0
- package/dist/elements/public/I18n/format/discount.js.map +1 -0
- package/dist/elements/public/I18n/format/index.js +4 -0
- package/dist/elements/public/I18n/format/index.js.map +1 -1
- package/dist/elements/public/I18n/format/ordinal.d.ts +6 -0
- package/dist/elements/public/I18n/format/ordinal.js +9 -0
- package/dist/elements/public/I18n/format/ordinal.js.map +1 -0
- package/dist/elements/public/Pagination/Pagination.d.ts +37 -0
- package/dist/elements/public/Pagination/Pagination.js +154 -0
- package/dist/elements/public/Pagination/Pagination.js.map +1 -0
- package/dist/elements/public/Pagination/index.d.ts +6 -0
- package/dist/elements/public/Pagination/index.js +8 -0
- package/dist/elements/public/Pagination/index.js.map +1 -0
- package/dist/elements/public/Table/Table.js +20 -5
- package/dist/elements/public/Table/Table.js.map +1 -1
- package/dist/elements/public/index.d.ts +6 -0
- package/dist/elements/public/index.defined.d.ts +6 -0
- package/dist/elements/public/index.defined.js +6 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +6 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +80 -4
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-00563cb0.js +0 -1
- package/dist/cdn/shared-1f1734cb.js +0 -264
- package/dist/cdn/shared-66cb6a36.js +0 -1
- package/dist/cdn/shared-9a40309d.js +0 -1
- package/dist/cdn/shared-9c099da6.js +0 -1
- package/dist/cdn/shared-ce1da35d.js +0 -1
- package/dist/cdn/shared-f1dc1c6c.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CouponCodeForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodeForm/CouponCodeForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,aAAa,EAAE,+BAA4B;AAEpD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,iBAAiB,CAC5B,cAAc,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAC3E,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,cAAe,SAAQ,IAAU;IAA9C;;QAsBE,cAAS,GAAc,EAAE,CAAC;IA4K5B,CAAC;IAjMC,MAAM,KAAK,cAAc;QACvB,OAAO;YACL,mBAAmB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AA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;;;;;;sBAM9B,MAAM,IAAI,SAAS,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;mBACvE,IAAI,CAAC,MAAM;;0BAEJ,IAAI,CAAC,EAAE,sBAAsB,IAAI,CAAC,IAAI;;;UAGtD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;IAEO,cAAc;QACpB,OAAO,IAAI,CAAA;;;;;;;;;iBASE,IAAI,CAAC,IAAI;eACX,IAAI,CAAC,EAAE;;kBAEJ,CAAC,GAAoB,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE;;;;UAIxE,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;;;;;;sBAM9B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;mBACnE,CAAC,GAAgB,EAAE,EAAE;YAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,CAA0B,CAAC;YACnF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,aAA8B,CAAC,CAAC;QACnD,CAAC;;0BAEe,IAAI,CAAC,EAAE,sBAAsB,IAAI,CAAC,IAAI;;;UAGtD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ButtonElement } from '@vaadin/vaadin-button';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport { InternalConfirmDialog } from '../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PropertyTable } from '../../private/index';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'coupon-code-form';\nconst Base = ConfigurableMixin(\n ThemeableMixin(ScopedElementsMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing coupon codes (`fx:coupon_code`).\n *\n * @slot code:before\n * @slot code:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @element foxy-coupon-code-form\n * @since 1.15.0\n */\nexport class CouponCodeForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-button': customElements.get('vaadin-button'),\n\n 'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n\n 'x-property-table': PropertyTable,\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code_required',\n ({ code: v }) => !v || v.length <= 50 || 'code_too_long',\n ];\n }\n\n templates: Templates = {};\n\n render(): TemplateResult {\n return html`\n <div class=\"relative space-y-m\">\n ${this.__isCodeHidden ? null : this.__renderCode()}\n ${this.__isTimestampsHidden ? null : this.__renderTimestamps()}\n ${this.__isCreateHidden ? null : this.__renderCreate()}\n ${this.__isDeleteHidden ? null : this.__renderDelete()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !this.in('busy') && !this.in('fail'),\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${this.in('fail') ? 'error' : this.in('busy') ? 'busy' : 'empty'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private get __isCodeHidden(): boolean {\n return this.hiddenSelector.matches('code', true);\n }\n\n private get __isTimestampsHidden(): boolean {\n if (this.hiddenSelector.matches('timestamps', true)) return true;\n return !this.data;\n }\n\n private get __isCreateHidden(): boolean {\n if (this.hiddenSelector.matches('create', true)) return true;\n return !!this.data;\n }\n\n private get __isDeleteHidden(): boolean {\n if (this.hiddenSelector.matches('delete', true)) return true;\n return !this.data;\n }\n\n private __getErrorMessage(prefix: string) {\n const error = this.errors.find(err => err.startsWith(prefix));\n return error ? this.t(error.replace(prefix, 'v8n')).toString() : '';\n }\n\n private __getValidator(prefix: string) {\n return () => !this.errors.some(err => err.startsWith(prefix));\n }\n\n private __renderCode(): TemplateResult {\n return html`\n <div>\n ${this.renderTemplateOrSlot('code:before')}\n\n <vaadin-text-field\n data-testid=\"code\"\n class=\"w-full\"\n label=${this.t('code')}\n value=${ifDefined(this.form.code)}\n .checkValidity=${this.__getValidator('code')}\n .errorMessage=${this.__getErrorMessage('code')}\n ?disabled=${this.in('busy') || this.disabledSelector.matches('code', true)}\n ?readonly=${this.readonlySelector.matches('code', true)}\n required\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: CustomEvent) => {\n const newCode = (evt.currentTarget as TextFieldElement).value;\n this.edit({ code: newCode });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot('name:after')}\n </div>\n `;\n }\n\n private __renderTimestamps(): TemplateResult {\n return html`\n <div>\n ${this.renderTemplateOrSlot('timestamps:before')}\n\n <x-property-table\n data-testid=\"timestamps\"\n .items=${(['date_modified', 'date_created'] as const).map(field => ({\n name: this.t(field),\n value: this.data?.[field]\n ? this.t('date', { value: new Date(this.data[field] as string) })\n : '',\n }))}\n >\n </x-property-table>\n\n ${this.renderTemplateOrSlot('timestamps:after')}\n </div>\n `;\n }\n\n private __renderCreate(): TemplateResult {\n const isCleanTemplateInvalid = this.in({ idle: { template: { clean: 'invalid' } } });\n const isDirtyTemplateInvalid = this.in({ idle: { template: { dirty: 'invalid' } } });\n const isCleanSnapshotInvalid = this.in({ idle: { snapshot: { clean: 'invalid' } } });\n const isDirtySnapshotInvalid = this.in({ idle: { snapshot: { dirty: 'invalid' } } });\n const isTemplateInvalid = isCleanTemplateInvalid || isDirtyTemplateInvalid;\n const isSnaphotInvalid = isCleanSnapshotInvalid || isDirtySnapshotInvalid;\n const isInvalid = isTemplateInvalid || isSnaphotInvalid;\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('create:before')}\n\n <vaadin-button\n data-testid=\"create\"\n class=\"w-full\"\n theme=\"primary success\"\n ?disabled=${isBusy || isInvalid || this.disabledSelector.matches('create', true)}\n @click=${this.submit}\n >\n <foxy-i18n ns=${this.ns} key=\"create\" lang=${this.lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('create:after')}\n </div>\n `;\n }\n\n private __renderDelete(): TemplateResult {\n return html`\n <div>\n <foxy-internal-confirm-dialog\n data-testid=\"confirm\"\n message=\"delete_prompt\"\n confirm=\"delete\"\n cancel=\"cancel\"\n header=\"delete\"\n theme=\"primary error\"\n lang=${this.lang}\n ns=${this.ns}\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => !evt.detail.cancelled && this.delete()}\n >\n </foxy-internal-confirm-dialog>\n\n ${this.renderTemplateOrSlot('delete:before')}\n\n <vaadin-button\n data-testid=\"delete\"\n theme=\"primary error\"\n class=\"w-full\"\n ?disabled=${this.in('busy') || this.disabledSelector.matches('delete', true)}\n @click=${(evt: CustomEvent) => {\n const confirm = this.renderRoot.querySelector('#confirm') as InternalConfirmDialog;\n confirm.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n ns=${this.ns} key=\"delete\" lang=${this.lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('delete:after')}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../../internal/InternalConfirmDialog/index';
|
|
2
|
+
import '../../internal/InternalSandbox/index';
|
|
3
|
+
import '../Spinner/index';
|
|
4
|
+
import '../I18n/index';
|
|
5
|
+
import '@vaadin/vaadin-text-field/vaadin-text-field';
|
|
6
|
+
import '@vaadin/vaadin-button';
|
|
7
|
+
import { CouponCodeForm } from './CouponCodeForm';
|
|
8
|
+
export { CouponCodeForm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../internal/InternalConfirmDialog/index.js";
|
|
2
|
+
import "../../internal/InternalSandbox/index.js";
|
|
3
|
+
import "../Spinner/index.js";
|
|
4
|
+
import "../I18n/index.js";
|
|
5
|
+
import '@vaadin/vaadin-text-field/vaadin-text-field';
|
|
6
|
+
import '@vaadin/vaadin-button';
|
|
7
|
+
import { CouponCodeForm } from "./CouponCodeForm.js";
|
|
8
|
+
customElements.define('foxy-coupon-code-form', CouponCodeForm);
|
|
9
|
+
export { CouponCodeForm };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodeForm/index.ts"],"names":[],"mappings":"AAAA,uDAAoD;AACpD,iDAA8C;AAC9C,6BAA0B;AAC1B,0BAAuB;AACvB,OAAO,6CAA6C,CAAC;AACrD,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAElD,cAAc,CAAC,MAAM,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import '../../internal/InternalConfirmDialog/index';\nimport '../../internal/InternalSandbox/index';\nimport '../Spinner/index';\nimport '../I18n/index';\nimport '@vaadin/vaadin-text-field/vaadin-text-field';\nimport '@vaadin/vaadin-button';\n\nimport { CouponCodeForm } from './CouponCodeForm';\n\ncustomElements.define('foxy-coupon-code-form', CouponCodeForm);\n\nexport { CouponCodeForm };\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CouponCodeForm } from './CouponCodeForm';
|
|
2
|
+
import { Rels } from '@foxy.io/sdk/backend';
|
|
3
|
+
import { Renderer } from '../../../mixins/configurable';
|
|
4
|
+
import { Resource } from '@foxy.io/sdk/core';
|
|
5
|
+
export declare type Data = Resource<Rels.CouponCode>;
|
|
6
|
+
export declare type Templates = {
|
|
7
|
+
'code:before'?: Renderer<CouponCodeForm>;
|
|
8
|
+
'code:after'?: Renderer<CouponCodeForm>;
|
|
9
|
+
'timestamps:before'?: Renderer<CouponCodeForm>;
|
|
10
|
+
'timestamps:after'?: Renderer<CouponCodeForm>;
|
|
11
|
+
'delete:before'?: Renderer<CouponCodeForm>;
|
|
12
|
+
'delete:after'?: Renderer<CouponCodeForm>;
|
|
13
|
+
'create:before'?: Renderer<CouponCodeForm>;
|
|
14
|
+
'create:after'?: Renderer<CouponCodeForm>;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodeForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { CouponCodeForm } from './CouponCodeForm';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.CouponCode>;\n\nexport type Templates = {\n 'code:before'?: Renderer<CouponCodeForm>;\n 'code:after'?: Renderer<CouponCodeForm>;\n 'timestamps:before'?: Renderer<CouponCodeForm>;\n 'timestamps:after'?: Renderer<CouponCodeForm>;\n 'delete:before'?: Renderer<CouponCodeForm>;\n 'delete:after'?: Renderer<CouponCodeForm>;\n 'create:before'?: Renderer<CouponCodeForm>;\n 'create:after'?: Renderer<CouponCodeForm>;\n};\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Data, Templates } from './types';
|
|
2
|
+
import { ScopedElementsMap } from '@open-wc/scoped-elements';
|
|
3
|
+
import { TemplateResult } from 'lit-html';
|
|
4
|
+
import { NucleonElement } from '../NucleonElement/NucleonElement';
|
|
5
|
+
declare const Base: typeof NucleonElement & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
6
|
+
defaultNS: string;
|
|
7
|
+
} & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost> & {
|
|
8
|
+
styles: import("lit-element").CSSResultArray;
|
|
9
|
+
} & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost>;
|
|
10
|
+
/**
|
|
11
|
+
* Form element for importing coupon codes (`fx:coupon_codes`).
|
|
12
|
+
*
|
|
13
|
+
* @slot codes:before
|
|
14
|
+
* @slot codes:after
|
|
15
|
+
*
|
|
16
|
+
* @slot import:before
|
|
17
|
+
* @slot import:after
|
|
18
|
+
*
|
|
19
|
+
* @element foxy-coupon-codes-form
|
|
20
|
+
* @since 1.15.0
|
|
21
|
+
*/
|
|
22
|
+
export declare class CouponCodesForm extends Base<Data> {
|
|
23
|
+
static get scopedElements(): ScopedElementsMap;
|
|
24
|
+
templates: Templates;
|
|
25
|
+
render(): TemplateResult;
|
|
26
|
+
private __renderCodes;
|
|
27
|
+
private __renderImport;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
2
|
+
import { html } from 'lit-html';
|
|
3
|
+
import { ConfigurableMixin } from "../../../mixins/configurable.js";
|
|
4
|
+
import { EditableList } from "../../private/EditableList/EditableList.js";
|
|
5
|
+
import { Group } from "../../private/Group/Group.js";
|
|
6
|
+
import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
7
|
+
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
8
|
+
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
9
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
10
|
+
const NS = 'coupon-codes-form';
|
|
11
|
+
const Base = ConfigurableMixin(ThemeableMixin(ScopedElementsMixin(TranslatableMixin(NucleonElement, NS))));
|
|
12
|
+
/**
|
|
13
|
+
* Form element for importing coupon codes (`fx:coupon_codes`).
|
|
14
|
+
*
|
|
15
|
+
* @slot codes:before
|
|
16
|
+
* @slot codes:after
|
|
17
|
+
*
|
|
18
|
+
* @slot import:before
|
|
19
|
+
* @slot import:after
|
|
20
|
+
*
|
|
21
|
+
* @element foxy-coupon-codes-form
|
|
22
|
+
* @since 1.15.0
|
|
23
|
+
*/
|
|
24
|
+
export class CouponCodesForm extends Base {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.templates = {};
|
|
28
|
+
}
|
|
29
|
+
static get scopedElements() {
|
|
30
|
+
return {
|
|
31
|
+
'vaadin-button': customElements.get('vaadin-button'),
|
|
32
|
+
'iron-icon': customElements.get('iron-icon'),
|
|
33
|
+
'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
|
|
34
|
+
'foxy-spinner': customElements.get('foxy-spinner'),
|
|
35
|
+
'foxy-i18n': customElements.get('foxy-i18n'),
|
|
36
|
+
'x-editable-list': EditableList,
|
|
37
|
+
'x-group': Group,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const { hiddenSelector, lang, ns } = this;
|
|
43
|
+
const isBusy = this.in('busy');
|
|
44
|
+
const isFail = this.in('fail');
|
|
45
|
+
const isSnapshot = this.in({ idle: 'snapshot' });
|
|
46
|
+
const isTemplate = this.in({ idle: 'template' });
|
|
47
|
+
const transition = 'transition-opacity duration-500';
|
|
48
|
+
const hidden = 'opacity-0 pointer-events-none';
|
|
49
|
+
return html `
|
|
50
|
+
<div class="relative">
|
|
51
|
+
<div
|
|
52
|
+
class=${classMap({
|
|
53
|
+
'relative space-y-m': true,
|
|
54
|
+
[transition]: true,
|
|
55
|
+
[hidden]: isSnapshot,
|
|
56
|
+
})}
|
|
57
|
+
>
|
|
58
|
+
${hiddenSelector.matches('codes', true) ? '' : this.__renderCodes()}
|
|
59
|
+
${hiddenSelector.matches('import', true) ? '' : this.__renderImport()}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
class=${classMap({
|
|
64
|
+
'absolute inset-0 flex flex-col items-center justify-center': true,
|
|
65
|
+
'text-center text-m text-secondary leading-m': true,
|
|
66
|
+
[transition]: true,
|
|
67
|
+
[hidden]: !isSnapshot,
|
|
68
|
+
})}
|
|
69
|
+
>
|
|
70
|
+
<div class="mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l bg-success">
|
|
71
|
+
<iron-icon icon="icons:done-all" class="m-auto text-success-contrast"></iron-icon>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<foxy-i18n class="block" lang=${lang} key="import_codes_done" ns=${ns}></foxy-i18n>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div
|
|
78
|
+
class=${classMap({
|
|
79
|
+
'absolute inset-0 flex': true,
|
|
80
|
+
[transition]: true,
|
|
81
|
+
[hidden]: !isBusy && !isFail,
|
|
82
|
+
})}
|
|
83
|
+
>
|
|
84
|
+
<foxy-spinner
|
|
85
|
+
layout="vertical"
|
|
86
|
+
class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
|
|
87
|
+
state=${isFail ? 'error' : isTemplate ? 'empty' : 'busy'}
|
|
88
|
+
lang=${lang}
|
|
89
|
+
ns="${ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
90
|
+
>
|
|
91
|
+
</foxy-spinner>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
__renderCodes() {
|
|
97
|
+
var _a;
|
|
98
|
+
const maxVisible = 16;
|
|
99
|
+
const codes = (_a = this.form.coupon_codes) !== null && _a !== void 0 ? _a : [];
|
|
100
|
+
const visibleCodes = codes.length > maxVisible ? codes.slice(-maxVisible) : codes;
|
|
101
|
+
const hiddenCodes = codes.length > maxVisible ? codes.slice(0, -maxVisible) : [];
|
|
102
|
+
const items = visibleCodes.map(code => {
|
|
103
|
+
let href;
|
|
104
|
+
try {
|
|
105
|
+
const url = new URL(this.parent);
|
|
106
|
+
url.searchParams.set('code', code);
|
|
107
|
+
href = url.toString();
|
|
108
|
+
}
|
|
109
|
+
catch (_a) {
|
|
110
|
+
href = this.parent;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
value: code,
|
|
114
|
+
label: html `
|
|
115
|
+
<foxy-internal-coupon-codes-form-list-item
|
|
116
|
+
group=${this.group}
|
|
117
|
+
href=${href}
|
|
118
|
+
lang=${this.lang}
|
|
119
|
+
ns=${this.ns}
|
|
120
|
+
>
|
|
121
|
+
</foxy-internal-coupon-codes-form-list-item>
|
|
122
|
+
`,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
return html `
|
|
126
|
+
<div>
|
|
127
|
+
${this.renderTemplateOrSlot('codes:before')}
|
|
128
|
+
|
|
129
|
+
<x-group class="mb-xs" frame>
|
|
130
|
+
<foxy-i18n slot="header" lang=${this.lang} key="code_plural" ns=${this.ns}></foxy-i18n>
|
|
131
|
+
|
|
132
|
+
<x-editable-list
|
|
133
|
+
lang=${this.lang}
|
|
134
|
+
ns=${this.ns}
|
|
135
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches('codes', true)}
|
|
136
|
+
?readonly=${this.readonlySelector.matches('codes', true)}
|
|
137
|
+
.items=${items}
|
|
138
|
+
@change=${(evt) => {
|
|
139
|
+
const list = evt.currentTarget;
|
|
140
|
+
const newCodes = new Set([...hiddenCodes, ...list.items.map(item => item.value)]);
|
|
141
|
+
this.edit({ coupon_codes: [...newCodes] });
|
|
142
|
+
}}
|
|
143
|
+
@paste=${(evt) => {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
evt.preventDefault();
|
|
146
|
+
const text = (_b = (_a = evt.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) !== null && _b !== void 0 ? _b : '';
|
|
147
|
+
const pastedCodes = text
|
|
148
|
+
.split(' ')
|
|
149
|
+
.map(code => code.trim())
|
|
150
|
+
.filter(code => code.length > 0);
|
|
151
|
+
this.edit({ coupon_codes: Array.from(new Set([...codes, ...pastedCodes])) });
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<div
|
|
155
|
+
class="ml-m py-s border-b border-contrast-10 font-lumo"
|
|
156
|
+
?hidden=${hiddenCodes.length === 0}
|
|
157
|
+
>
|
|
158
|
+
<foxy-i18n
|
|
159
|
+
options=${JSON.stringify({ count: hiddenCodes.length })}
|
|
160
|
+
class="block text-body text-m mb-xs"
|
|
161
|
+
lang=${this.lang}
|
|
162
|
+
key="hidden_codes_header"
|
|
163
|
+
ns=${this.ns}
|
|
164
|
+
>
|
|
165
|
+
</foxy-i18n>
|
|
166
|
+
|
|
167
|
+
<foxy-i18n
|
|
168
|
+
class="block text-xs text-tertiary"
|
|
169
|
+
lang=${this.lang}
|
|
170
|
+
key="hidden_codes_explainer"
|
|
171
|
+
ns=${this.ns}
|
|
172
|
+
>
|
|
173
|
+
</foxy-i18n>
|
|
174
|
+
</div>
|
|
175
|
+
</x-editable-list>
|
|
176
|
+
</x-group>
|
|
177
|
+
|
|
178
|
+
<foxy-i18n
|
|
179
|
+
class="block text-xs text-tertiary leading-s"
|
|
180
|
+
lang=${this.lang}
|
|
181
|
+
key="code_import_hint"
|
|
182
|
+
ns=${this.ns}
|
|
183
|
+
>
|
|
184
|
+
</foxy-i18n>
|
|
185
|
+
|
|
186
|
+
${this.renderTemplateOrSlot('codes:after')}
|
|
187
|
+
</div>
|
|
188
|
+
`;
|
|
189
|
+
}
|
|
190
|
+
__renderImport() {
|
|
191
|
+
return html `
|
|
192
|
+
<div>
|
|
193
|
+
${this.renderTemplateOrSlot('import:before')}
|
|
194
|
+
|
|
195
|
+
<vaadin-button
|
|
196
|
+
class="w-full mb-xs"
|
|
197
|
+
theme="primary success"
|
|
198
|
+
?disabled=${!this.in('idle') || this.disabledSelector.matches('import', true)}
|
|
199
|
+
@click=${this.submit}
|
|
200
|
+
>
|
|
201
|
+
<foxy-i18n ns=${this.ns} key="import" lang=${this.lang}></foxy-i18n>
|
|
202
|
+
</vaadin-button>
|
|
203
|
+
|
|
204
|
+
${this.renderTemplateOrSlot('import:after')}
|
|
205
|
+
</div>
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=CouponCodesForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CouponCodesForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodesForm/CouponCodesForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,mDAAgD;AACvE,OAAO,EAAE,KAAK,EAAE,qCAAkC;AAClD,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,mBAAm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,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC;mBACpE,IAAI,CAAC,MAAM;;0BAEJ,IAAI,CAAC,EAAE,sBAAsB,IAAI,CAAC,IAAI;;;UAGtD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EditableList } from '../../private/EditableList/EditableList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'coupon-codes-form';\nconst Base = ConfigurableMixin(\n ThemeableMixin(ScopedElementsMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for importing coupon codes (`fx:coupon_codes`).\n *\n * @slot codes:before\n * @slot codes:after\n *\n * @slot import:before\n * @slot import:after\n *\n * @element foxy-coupon-codes-form\n * @since 1.15.0\n */\nexport class CouponCodesForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-button': customElements.get('vaadin-button'),\n 'iron-icon': customElements.get('iron-icon'),\n\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n\n 'x-editable-list': EditableList,\n 'x-group': Group,\n };\n }\n\n templates: Templates = {};\n\n render(): TemplateResult {\n const { hiddenSelector, lang, ns } = this;\n\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n const isSnapshot = this.in({ idle: 'snapshot' });\n const isTemplate = this.in({ idle: 'template' });\n\n const transition = 'transition-opacity duration-500';\n const hidden = 'opacity-0 pointer-events-none';\n\n return html`\n <div class=\"relative\">\n <div\n class=${classMap({\n 'relative space-y-m': true,\n [transition]: true,\n [hidden]: isSnapshot,\n })}\n >\n ${hiddenSelector.matches('codes', true) ? '' : this.__renderCodes()}\n ${hiddenSelector.matches('import', true) ? '' : this.__renderImport()}\n </div>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex flex-col items-center justify-center': true,\n 'text-center text-m text-secondary leading-m': true,\n [transition]: true,\n [hidden]: !isSnapshot,\n })}\n >\n <div class=\"mx-auto flex mb-m w-l h-l rounded-t-l rounded-b-l bg-success\">\n <iron-icon icon=\"icons:done-all\" class=\"m-auto text-success-contrast\"></iron-icon>\n </div>\n\n <foxy-i18n class=\"block\" lang=${lang} key=\"import_codes_done\" ns=${ns}></foxy-i18n>\n </div>\n\n <div\n class=${classMap({\n 'absolute inset-0 flex': true,\n [transition]: true,\n [hidden]: !isBusy && !isFail,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${isFail ? 'error' : isTemplate ? 'empty' : 'busy'}\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderCodes() {\n const maxVisible = 16;\n const codes = this.form.coupon_codes ?? [];\n\n const visibleCodes = codes.length > maxVisible ? codes.slice(-maxVisible) : codes;\n const hiddenCodes = codes.length > maxVisible ? codes.slice(0, -maxVisible) : [];\n\n const items = visibleCodes.map(code => {\n let href: string;\n\n try {\n const url = new URL(this.parent);\n url.searchParams.set('code', code);\n href = url.toString();\n } catch {\n href = this.parent;\n }\n\n return {\n value: code,\n label: html`\n <foxy-internal-coupon-codes-form-list-item\n group=${this.group}\n href=${href}\n lang=${this.lang}\n ns=${this.ns}\n >\n </foxy-internal-coupon-codes-form-list-item>\n `,\n };\n });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('codes:before')}\n\n <x-group class=\"mb-xs\" frame>\n <foxy-i18n slot=\"header\" lang=${this.lang} key=\"code_plural\" ns=${this.ns}></foxy-i18n>\n\n <x-editable-list\n lang=${this.lang}\n ns=${this.ns}\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('codes', true)}\n ?readonly=${this.readonlySelector.matches('codes', true)}\n .items=${items}\n @change=${(evt: CustomEvent) => {\n const list = evt.currentTarget as EditableList;\n const newCodes = new Set([...hiddenCodes, ...list.items.map(item => item.value)]);\n this.edit({ coupon_codes: [...newCodes] });\n }}\n @paste=${(evt: ClipboardEvent) => {\n evt.preventDefault();\n\n const text = evt.clipboardData?.getData('text') ?? '';\n const pastedCodes = text\n .split(' ')\n .map(code => code.trim())\n .filter(code => code.length > 0);\n\n this.edit({ coupon_codes: Array.from(new Set([...codes, ...pastedCodes])) });\n }}\n >\n <div\n class=\"ml-m py-s border-b border-contrast-10 font-lumo\"\n ?hidden=${hiddenCodes.length === 0}\n >\n <foxy-i18n\n options=${JSON.stringify({ count: hiddenCodes.length })}\n class=\"block text-body text-m mb-xs\"\n lang=${this.lang}\n key=\"hidden_codes_header\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"block text-xs text-tertiary\"\n lang=${this.lang}\n key=\"hidden_codes_explainer\"\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n </x-editable-list>\n </x-group>\n\n <foxy-i18n\n class=\"block text-xs text-tertiary leading-s\"\n lang=${this.lang}\n key=\"code_import_hint\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('codes:after')}\n </div>\n `;\n }\n\n private __renderImport() {\n return html`\n <div>\n ${this.renderTemplateOrSlot('import:before')}\n\n <vaadin-button\n class=\"w-full mb-xs\"\n theme=\"primary success\"\n ?disabled=${!this.in('idle') || this.disabledSelector.matches('import', true)}\n @click=${this.submit}\n >\n <foxy-i18n ns=${this.ns} key=\"import\" lang=${this.lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('import:after')}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '@vaadin/vaadin-button';
|
|
2
|
+
import '@polymer/iron-icons';
|
|
3
|
+
import '@polymer/iron-icon';
|
|
4
|
+
import '../../internal/InternalSandbox/index';
|
|
5
|
+
import '../Spinner/index';
|
|
6
|
+
import '../I18n/index';
|
|
7
|
+
import { CouponCodesForm } from './CouponCodesForm';
|
|
8
|
+
export { CouponCodesForm };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@vaadin/vaadin-button';
|
|
2
|
+
import '@polymer/iron-icons';
|
|
3
|
+
import '@polymer/iron-icon';
|
|
4
|
+
import "../../internal/InternalSandbox/index.js";
|
|
5
|
+
import "../Spinner/index.js";
|
|
6
|
+
import "../I18n/index.js";
|
|
7
|
+
import { CouponCodesForm } from "./CouponCodesForm.js";
|
|
8
|
+
import { InternalCouponCodesFormListItem } from "./internal/InternalCouponCodesFormListItem.js";
|
|
9
|
+
customElements.define('foxy-coupon-codes-form', CouponCodesForm);
|
|
10
|
+
customElements.define('foxy-internal-coupon-codes-form-list-item', InternalCouponCodesFormListItem);
|
|
11
|
+
export { CouponCodesForm };
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodesForm/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,iDAA8C;AAC9C,6BAA0B;AAC1B,0BAAuB;AAEvB,OAAO,EAAE,eAAe,EAAE,6BAA0B;AACpD,OAAO,EAAE,+BAA+B,EAAE,sDAAmD;AAE7F,cAAc,CAAC,MAAM,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;AACjE,cAAc,CAAC,MAAM,CAAC,2CAA2C,EAAE,+BAA+B,CAAC,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-button';\nimport '@polymer/iron-icons';\nimport '@polymer/iron-icon';\nimport '../../internal/InternalSandbox/index';\nimport '../Spinner/index';\nimport '../I18n/index';\n\nimport { CouponCodesForm } from './CouponCodesForm';\nimport { InternalCouponCodesFormListItem } from './internal/InternalCouponCodesFormListItem';\n\ncustomElements.define('foxy-coupon-codes-form', CouponCodesForm);\ncustomElements.define('foxy-internal-coupon-codes-form-list-item', InternalCouponCodesFormListItem);\n\nexport { CouponCodesForm };\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import { NucleonElement } from '../../NucleonElement/NucleonElement';
|
|
3
|
+
import { Rels } from '@foxy.io/sdk/backend';
|
|
4
|
+
import { Resource } from '@foxy.io/sdk/core';
|
|
5
|
+
declare type Data = Resource<Rels.CouponCodes>;
|
|
6
|
+
declare const Base: typeof NucleonElement & {
|
|
7
|
+
styles: import("lit-element").CSSResultArray;
|
|
8
|
+
} & import("lit-element").Constructor<import("../../../../mixins/translatable").TranslatableMixinHost> & {
|
|
9
|
+
defaultNS: string;
|
|
10
|
+
};
|
|
11
|
+
export declare class InternalCouponCodesFormListItem extends Base<Data> {
|
|
12
|
+
render(): TemplateResult;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
import { NucleonElement } from "../../NucleonElement/NucleonElement.js";
|
|
3
|
+
import { ThemeableMixin } from "../../../../mixins/themeable.js";
|
|
4
|
+
import { TranslatableMixin } from "../../../../mixins/translatable.js";
|
|
5
|
+
const Base = TranslatableMixin(ThemeableMixin(NucleonElement));
|
|
6
|
+
export class InternalCouponCodesFormListItem extends Base {
|
|
7
|
+
render() {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
let code;
|
|
10
|
+
try {
|
|
11
|
+
code = (_a = new URL(this.href).searchParams.get('code')) !== null && _a !== void 0 ? _a : '';
|
|
12
|
+
}
|
|
13
|
+
catch (_c) {
|
|
14
|
+
return html ``;
|
|
15
|
+
}
|
|
16
|
+
let statusClass = 'text-tertiary bg-contrast-5';
|
|
17
|
+
let statusKey;
|
|
18
|
+
let codeClass = 'text-body';
|
|
19
|
+
if (this.in('fail')) {
|
|
20
|
+
statusKey = 'loading_error';
|
|
21
|
+
}
|
|
22
|
+
else if (this.in('busy')) {
|
|
23
|
+
statusKey = 'loading_busy';
|
|
24
|
+
}
|
|
25
|
+
else if (((_b = this.data) === null || _b === void 0 ? void 0 : _b.returned_items) === 0) {
|
|
26
|
+
statusClass = 'text-success bg-success-10';
|
|
27
|
+
statusKey = 'unique';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
statusClass = 'text-error bg-error-10';
|
|
31
|
+
statusKey = 'duplicate';
|
|
32
|
+
codeClass = 'text-error';
|
|
33
|
+
}
|
|
34
|
+
return html `
|
|
35
|
+
<div class="flex justify-between items-center font-lumo leading-m">
|
|
36
|
+
<div class="text-m ${codeClass}">${code}</div>
|
|
37
|
+
<foxy-i18n
|
|
38
|
+
class="text-xs font-medium px-xs rounded ${statusClass}"
|
|
39
|
+
lang=${this.lang}
|
|
40
|
+
key=${statusKey}
|
|
41
|
+
ns=${this.ns}
|
|
42
|
+
>
|
|
43
|
+
</foxy-i18n>
|
|
44
|
+
</div>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=InternalCouponCodesFormListItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalCouponCodesFormListItem.js","sourceRoot":"","sources":["../../../../../src/elements/public/CouponCodesForm/internal/InternalCouponCodesFormListItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,+CAA4C;AAGrE,OAAO,EAAE,cAAc,EAAE,wCAAqC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,2CAAwC;AAGpE,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/D,MAAM,OAAO,+BAAgC,SAAQ,IAAU;IAC7D,MAAM;;QACJ,IAAI,IAAY,CAAC;QAEjB,IAAI;YACF,IAAI,SAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;SAC1D;QAAC,WAAM;YACN,OAAO,IAAI,CAAA,EAAE,CAAC;SACf;QAED,IAAI,WAAW,GAAG,6BAA6B,CAAC;QAChD,IAAI,SAAiB,CAAC;QACtB,IAAI,SAAS,GAAG,WAAW,CAAC;QAE5B,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;YACnB,SAAS,GAAG,eAAe,CAAC;SAC7B;aAAM,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;YAC1B,SAAS,GAAG,cAAc,CAAC;SAC5B;aAAM,IAAI,OAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,MAAK,CAAC,EAAE;YAC1C,WAAW,GAAG,4BAA4B,CAAC;YAC3C,SAAS,GAAG,QAAQ,CAAC;SACtB;aAAM;YACL,WAAW,GAAG,wBAAwB,CAAC;YACvC,SAAS,GAAG,WAAW,CAAC;YACxB,SAAS,GAAG,YAAY,CAAC;SAC1B;QAED,OAAO,IAAI,CAAA;;6BAEc,SAAS,KAAK,IAAI;;qDAEM,WAAW;iBAC/C,IAAI,CAAC,IAAI;gBACV,SAAS;eACV,IAAI,CAAC,EAAE;;;;KAIjB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { NucleonElement } from '../../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../../mixins/translatable';\n\ntype Data = Resource<Rels.CouponCodes>;\nconst Base = TranslatableMixin(ThemeableMixin(NucleonElement));\n\nexport class InternalCouponCodesFormListItem extends Base<Data> {\n render(): TemplateResult {\n let code: string;\n\n try {\n code = new URL(this.href).searchParams.get('code') ?? '';\n } catch {\n return html``;\n }\n\n let statusClass = 'text-tertiary bg-contrast-5';\n let statusKey: string;\n let codeClass = 'text-body';\n\n if (this.in('fail')) {\n statusKey = 'loading_error';\n } else if (this.in('busy')) {\n statusKey = 'loading_busy';\n } else if (this.data?.returned_items === 0) {\n statusClass = 'text-success bg-success-10';\n statusKey = 'unique';\n } else {\n statusClass = 'text-error bg-error-10';\n statusKey = 'duplicate';\n codeClass = 'text-error';\n }\n\n return html`\n <div class=\"flex justify-between items-center font-lumo leading-m\">\n <div class=\"text-m ${codeClass}\">${code}</div>\n <foxy-i18n\n class=\"text-xs font-medium px-xs rounded ${statusClass}\"\n lang=${this.lang}\n key=${statusKey}\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CouponCodesForm } from './CouponCodesForm';
|
|
2
|
+
import { Renderer } from '../../../mixins/configurable';
|
|
3
|
+
export declare type Data = {
|
|
4
|
+
_links: {
|
|
5
|
+
self: {
|
|
6
|
+
href: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
coupon_codes: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare type Templates = {
|
|
12
|
+
'codes:before'?: Renderer<CouponCodesForm>;
|
|
13
|
+
'codes:after'?: Renderer<CouponCodesForm>;
|
|
14
|
+
'import:before'?: Renderer<CouponCodesForm>;
|
|
15
|
+
'import:after'?: Renderer<CouponCodesForm>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCodesForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { CouponCodesForm } from './CouponCodesForm';\nimport { Renderer } from '../../../mixins/configurable';\n\nexport type Data = {\n _links: { self: { href: string } };\n coupon_codes: string[];\n};\n\nexport type Templates = {\n 'codes:before'?: Renderer<CouponCodesForm>;\n 'codes:after'?: Renderer<CouponCodesForm>;\n 'import:before'?: Renderer<CouponCodesForm>;\n 'import:after'?: Renderer<CouponCodesForm>;\n};\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Data } from './types';
|
|
2
|
+
import { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
3
|
+
import { ScopedElementsMap } from '@open-wc/scoped-elements';
|
|
4
|
+
import { NucleonElement } from '../NucleonElement/NucleonElement';
|
|
5
|
+
import { NucleonV8N } from '../NucleonElement/types';
|
|
6
|
+
declare const Base: typeof NucleonElement & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
7
|
+
defaultNS: string;
|
|
8
|
+
} & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
|
|
9
|
+
styles: import("lit-element").CSSResultArray;
|
|
10
|
+
} & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
|
|
11
|
+
/**
|
|
12
|
+
* Form element for creating or editing coupons (`fx:coupon`).
|
|
13
|
+
*
|
|
14
|
+
* @slot name:before
|
|
15
|
+
* @slot name:after
|
|
16
|
+
*
|
|
17
|
+
* @slot rules:before
|
|
18
|
+
* @slot rules:after
|
|
19
|
+
*
|
|
20
|
+
* @slot codes:before
|
|
21
|
+
* @slot codes:after
|
|
22
|
+
*
|
|
23
|
+
* @slot usage:before
|
|
24
|
+
* @slot usage:after
|
|
25
|
+
*
|
|
26
|
+
* @slot product-restrictions:before
|
|
27
|
+
* @slot product-restrictions:after
|
|
28
|
+
*
|
|
29
|
+
* @slot category-restrictions:before
|
|
30
|
+
* @slot category-restrictions:after
|
|
31
|
+
*
|
|
32
|
+
* @slot options:before
|
|
33
|
+
* @slot options:after
|
|
34
|
+
*
|
|
35
|
+
* @slot timestamps:before
|
|
36
|
+
* @slot timestamps:after
|
|
37
|
+
*
|
|
38
|
+
* @slot delete:before
|
|
39
|
+
* @slot delete:after
|
|
40
|
+
*
|
|
41
|
+
* @slot create:before
|
|
42
|
+
* @slot create:after
|
|
43
|
+
*
|
|
44
|
+
* @element foxy-coupon-form
|
|
45
|
+
* @since 1.15.0
|
|
46
|
+
*/
|
|
47
|
+
export declare class CouponForm extends Base<Data> {
|
|
48
|
+
static get scopedElements(): ScopedElementsMap;
|
|
49
|
+
static get properties(): PropertyDeclarations;
|
|
50
|
+
static get v8n(): NucleonV8N<Data>;
|
|
51
|
+
private __codesTableColumns;
|
|
52
|
+
private static readonly __codesQueryOptions;
|
|
53
|
+
private __codesTableQuery;
|
|
54
|
+
private __itemCategories;
|
|
55
|
+
render(): TemplateResult;
|
|
56
|
+
protected _sendGet(): Promise<Data>;
|
|
57
|
+
private __getErrorMessage;
|
|
58
|
+
private __getValidator;
|
|
59
|
+
private __renderName;
|
|
60
|
+
private __renderRulesPreset;
|
|
61
|
+
private __renderRulesTierSelect;
|
|
62
|
+
private __renderRulesTierSwitch;
|
|
63
|
+
private __renderRulesTierField;
|
|
64
|
+
private __renderRulesTier;
|
|
65
|
+
private __renderRulesUrlParameter;
|
|
66
|
+
private __renderRulesDescription;
|
|
67
|
+
private __renderRules;
|
|
68
|
+
private __renderCodes;
|
|
69
|
+
private __renderUsage;
|
|
70
|
+
private __renderProductRestrictions;
|
|
71
|
+
private __renderCategoryRestrictions;
|
|
72
|
+
private __renderOptions;
|
|
73
|
+
private __renderTimestamps;
|
|
74
|
+
private __renderCreate;
|
|
75
|
+
private __renderDelete;
|
|
76
|
+
}
|
|
77
|
+
export {};
|