@foxy.io/elements 1.14.0-beta.10 → 1.14.0-beta.11

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.
Files changed (73) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  5. package/dist/cdn/foxy-attribute-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-form.js +1 -1
  7. package/dist/cdn/foxy-cancellation-form.js +1 -1
  8. package/dist/cdn/foxy-collection-page.js +1 -1
  9. package/dist/cdn/foxy-collection-pages.js +1 -1
  10. package/dist/cdn/foxy-custom-field-card.js +1 -1
  11. package/dist/cdn/foxy-custom-field-form.js +1 -1
  12. package/dist/cdn/foxy-customer-card.js +1 -1
  13. package/dist/cdn/foxy-customer-form.js +1 -1
  14. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  15. package/dist/cdn/foxy-customer-portal.js +18 -15
  16. package/dist/cdn/foxy-customer.js +1 -1
  17. package/dist/cdn/foxy-customers-table.js +1 -1
  18. package/dist/cdn/foxy-discount-card.js +1 -1
  19. package/dist/cdn/foxy-donation.js +1 -1
  20. package/dist/cdn/foxy-email-template-form.js +1 -1
  21. package/dist/cdn/foxy-error-entry-card.js +1 -1
  22. package/dist/cdn/foxy-form-dialog.js +1 -1
  23. package/dist/cdn/foxy-i18n.js +1 -1
  24. package/dist/cdn/foxy-items-form.js +1 -1
  25. package/dist/cdn/foxy-payment-card.js +1 -1
  26. package/dist/cdn/foxy-payment-method-card.js +1 -1
  27. package/dist/cdn/foxy-query-builder.js +1 -1
  28. package/dist/cdn/foxy-sign-in-form.js +1 -1
  29. package/dist/cdn/foxy-spinner.js +1 -1
  30. package/dist/cdn/foxy-subscription-card.js +1 -1
  31. package/dist/cdn/foxy-subscription-form.js +2 -2
  32. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  33. package/dist/cdn/foxy-table.js +1 -1
  34. package/dist/cdn/foxy-tax-card.js +1 -1
  35. package/dist/cdn/foxy-tax-form.js +1 -1
  36. package/dist/cdn/foxy-template-config-form.js +1 -1
  37. package/dist/cdn/foxy-template-form.js +1 -1
  38. package/dist/cdn/foxy-transaction-card.js +1 -1
  39. package/dist/cdn/foxy-transactions-table.js +1 -1
  40. package/dist/cdn/foxy-user-form.js +1 -1
  41. package/dist/cdn/foxy-users-table.js +1 -1
  42. package/dist/cdn/{shared-4ba926ca.js → shared-05956f55.js} +1 -1
  43. package/dist/cdn/{shared-7007dedb.js → shared-05b473a7.js} +1 -1
  44. package/dist/cdn/{shared-da787055.js → shared-1177fd2a.js} +1 -1
  45. package/dist/cdn/{shared-c5ae5d33.js → shared-2b685624.js} +1 -1
  46. package/dist/cdn/{shared-d01035c5.js → shared-4168c6cd.js} +1 -1
  47. package/dist/cdn/{shared-d05c93a5.js → shared-5d1314d7.js} +1 -1
  48. package/dist/cdn/{shared-0f9809ab.js → shared-70631d0a.js} +1 -1
  49. package/dist/cdn/{shared-ca7c3b9a.js → shared-775b37f9.js} +1 -1
  50. package/dist/cdn/{shared-a3d2c48e.js → shared-8730c141.js} +1 -1
  51. package/dist/cdn/{shared-5d94bacb.js → shared-93f23978.js} +1 -1
  52. package/dist/cdn/{shared-007c4e34.js → shared-a94b7271.js} +1 -1
  53. package/dist/cdn/{shared-daf6b763.js → shared-bda600d6.js} +1 -1
  54. package/dist/cdn/{shared-b24377bf.js → shared-d3167239.js} +1 -1
  55. package/dist/cdn/shared-e36452b9.js +1 -0
  56. package/dist/cdn/{shared-31d03530.js → shared-f968379d.js} +7 -7
  57. package/dist/cdn/{shared-00070cc4.js → shared-fbeb1de3.js} +1 -1
  58. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.d.ts +1 -0
  59. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js +17 -8
  60. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js.map +1 -1
  61. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +11 -3
  62. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  63. package/dist/elements/public/ItemsForm/private/Picture.d.ts +1 -0
  64. package/dist/elements/public/ItemsForm/private/Picture.js +2 -0
  65. package/dist/elements/public/ItemsForm/private/Picture.js.map +1 -1
  66. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +12 -4
  67. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  68. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +20 -13
  69. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  70. package/dist/mixins/themeable.js +10 -8
  71. package/dist/mixins/themeable.js.map +1 -1
  72. package/package.json +1 -1
  73. package/dist/cdn/shared-fe8a7aa2.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAE9D,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAGjE,OAAO,EAAE,cAAc,EAAE,mCAAgC;AAEzD,OAAO,EAAE,OAAO,EAAE,wCAAqC;AAEvD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,kDAA+C;AAE3E,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,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BAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import { Choice, Group, Skeleton } from '../../private/index';\nimport { Data, Item, Settings, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\nimport {\n getAllowedFrequencies,\n getNextTransactionDateConstraints,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nimport { ButtonElement } from '@vaadin/vaadin-button';\nimport { CellContext } from '../Table/types';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FormDialog } from '../FormDialog';\nimport { InternalCalendar } from '../../internal/InternalCalendar';\nimport { NucleonElement } from '../NucleonElement/index';\nimport { PageRendererContext } from '../CollectionPages/types';\nimport { Preview } from '../ItemsForm/private/Preview';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\nimport { Data as TransactionsTableData } from '../TransactionsTable/types';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-preview': Preview,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { type: Object },\n };\n }\n\n settings: Settings | null = null;\n\n templates: Templates = {};\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const currency = data._embedded['fx:last_transaction'].currency_code;\n const total = data._embedded['fx:last_transaction'].total_order;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({ ...frequency, amount: `${total} ${currency}` })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = () => {\n return html`\n <div data-testid=\"header\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold\">${this.__renderHeaderTitle()}</div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsItem = (item: Item) => {\n const price = item.price.toLocaleString(this.lang || 'en', {\n style: 'currency',\n currency: this.data!._embedded['fx:last_transaction'].currency_code,\n });\n\n let quantity: TemplateResult;\n\n if (item.quantity > 1) {\n quantity = html`\n <div\n data-testclass=\"item-quantity\"\n class=\"px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold\"\n >\n ${item.quantity}\n </div>\n `;\n } else {\n quantity = html``;\n }\n\n return html`\n <figure class=\"flex items-center space-x-m py-s pr-m\" data-testclass=\"item\">\n <x-preview\n data-testclass=\"item-preview\"\n class=\"w-l h-l\"\n .quantity=${item.quantity}\n .image=${item.image}\n >\n </x-preview>\n\n <figcaption class=\"leading-s flex-1 flex justify-between items-center\">\n <div class=\"flex flex-col\">\n <span class=\"font-medium\" data-testclass=\"item-name\">${item.name}</span>\n <span class=\"text-secondary text-s\" data-testclass=\"item-price\">${price}</span>\n </div>\n\n ${quantity}\n </figcaption>\n </figure>\n `;\n };\n\n private readonly __renderItems = () => {\n const hiddenSelector = this.hiddenSelector;\n const items = this.data?._embedded['fx:transaction_template']._embedded['fx:items'] ?? [];\n const label = hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions();\n\n return html`\n <div data-testid=\"items\">\n ${this.renderTemplateOrSlot('items:before')}\n <x-group frame>\n <div slot=\"header\">${label}</div>\n <div class=\"divide-y divide-contrast-10 pl-s\">${items.map(this.__renderItemsItem)}</div>\n </x-group>\n ${this.renderTemplateOrSlot('items:after')}\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${SubscriptionForm.defaultNS}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n private readonly __transactionsTableColumns = [\n {\n cell(ctx: CellContext<TransactionsTableData>) {\n const colors: Record<string, string> = {\n declined: 'text-error',\n rejected: 'text-error',\n };\n\n const status = TransactionsTable.statusColumn.cell!(ctx);\n const price = TransactionsTable.priceColumn.cell!(ctx);\n const color = colors[ctx.data.status] ?? 'text-body';\n\n return ctx.html`\n <span class=\"sr-only\">${status}</span>\n <span class=\"${color} text-s\">${price}</span>\n `;\n },\n },\n { cell: TransactionsTable.idColumn.cell, hideBelow: 'sm' },\n { cell: TransactionsTable.dateColumn.cell },\n { cell: TransactionsTable.receiptColumn.cell },\n ];\n\n private readonly __renderTransactionsPage = ({ html, ...ctx }: PageRendererContext) => {\n return html`\n <foxy-table\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-transactions-table')?.defaultNS ?? ''}\"\n .columns=${this.__transactionsTableColumns}\n >\n </foxy-table>\n `;\n };\n\n private readonly __renderTransactions = () => {\n const { lang, ns } = this;\n\n return html`\n <div data-testid=\"transactions\">\n ${this.renderTemplateOrSlot('transactions:before')}\n\n <x-group frame>\n <foxy-i18n lang=${lang} slot=\"header\" key=\"transaction_plural\" ns=${ns}></foxy-i18n>\n <foxy-collection-pages\n group=${this.group}\n class=\"block divide-y divide-contrast-10 px-m\"\n first=${this.data?._links['fx:transactions'].href ?? ''}\n lang=${lang}\n ns=${ns}\n .page=${this.__renderTransactionsPage}\n >\n </foxy-collection-pages>\n </x-group>\n\n ${this.renderTemplateOrSlot('transactions:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div\n data-testid=\"wrapper\"\n aria-busy=${isBusy}\n aria-live=\"polite\"\n class=\"relative space-y-l text-body font-lumo text-m leading-m\"\n >\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.hiddenSelector.matches('transactions', true) ? '' : this.__renderTransactions()}\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': !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' : isBusy ? '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 __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.settings === null) return true;\n if (this.data === null) return false;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.settings === null) return true;\n if (this.data === null) return false;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
1
+ {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAE9D,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,iCAAiC,EACjC,qBAAqB,GAC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I,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACjE,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACrC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE;YAAE,OAAO,KAAK,CAAC;QAC7F,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAChD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAExC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IACzC,CAAC;IAED,IAAY,aAAa;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import { Choice, Group, Skeleton } from '../../private/index';\nimport { Data, Item, Settings, Templates } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\nimport {\n getAllowedFrequencies,\n getNextTransactionDateConstraints,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nimport { ButtonElement } from '@vaadin/vaadin-button';\nimport { CellContext } from '../Table/types';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FormDialog } from '../FormDialog';\nimport { InternalCalendar } from '../../internal/InternalCalendar';\nimport { NucleonElement } from '../NucleonElement/index';\nimport { PageRendererContext } from '../CollectionPages/types';\nimport { Preview } from '../ItemsForm/private/Preview';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\nimport { Data as TransactionsTableData } from '../TransactionsTable/types';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(\n ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-preview': Preview,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { type: Object },\n };\n }\n\n settings: Settings | null = null;\n\n templates: Templates = {};\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const currency = data._embedded['fx:last_transaction'].currency_code;\n const total = data._embedded['fx:last_transaction'].total_order;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({ ...frequency, amount: `${total} ${currency}` })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = () => {\n return html`\n <div data-testid=\"header\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold\">${this.__renderHeaderTitle()}</div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsItem = (item: Item) => {\n const price = item.price.toLocaleString(this.lang || 'en', {\n style: 'currency',\n currency: this.data!._embedded['fx:last_transaction'].currency_code,\n });\n\n let quantity: TemplateResult;\n\n if (item.quantity > 1) {\n quantity = html`\n <div\n data-testclass=\"item-quantity\"\n class=\"px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold\"\n >\n ${item.quantity}\n </div>\n `;\n } else {\n quantity = html``;\n }\n\n return html`\n <figure class=\"flex items-center space-x-m py-s pr-m\" data-testclass=\"item\">\n <x-preview\n data-testclass=\"item-preview\"\n class=\"w-l h-l\"\n .quantity=${item.quantity}\n .image=${item.image}\n >\n </x-preview>\n\n <figcaption class=\"leading-s flex-1 flex justify-between items-center\">\n <div class=\"flex flex-col\">\n <span class=\"font-medium\" data-testclass=\"item-name\">${item.name}</span>\n <span class=\"text-secondary text-s\" data-testclass=\"item-price\">${price}</span>\n </div>\n\n ${quantity}\n </figcaption>\n </figure>\n `;\n };\n\n private readonly __renderItems = () => {\n const hiddenSelector = this.hiddenSelector;\n const items = this.data?._embedded['fx:transaction_template']._embedded['fx:items'] ?? [];\n const label = hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions();\n\n return html`\n <div data-testid=\"items\">\n ${this.renderTemplateOrSlot('items:before')}\n <x-group frame>\n <div slot=\"header\">${label}</div>\n <div class=\"divide-y divide-contrast-10 pl-s\">${items.map(this.__renderItemsItem)}</div>\n </x-group>\n ${this.renderTemplateOrSlot('items:after')}\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${SubscriptionForm.defaultNS}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n private readonly __transactionsTableColumns = [\n {\n cell(ctx: CellContext<TransactionsTableData>) {\n const colors: Record<string, string> = {\n declined: 'text-error',\n rejected: 'text-error',\n };\n\n const status = TransactionsTable.statusColumn.cell!(ctx);\n const price = TransactionsTable.priceColumn.cell!(ctx);\n const color = colors[ctx.data.status] ?? 'text-body';\n\n return ctx.html`\n <span class=\"sr-only\">${status}</span>\n <span class=\"${color} text-s\">${price}</span>\n `;\n },\n },\n { cell: TransactionsTable.idColumn.cell, hideBelow: 'sm' },\n { cell: TransactionsTable.dateColumn.cell },\n { cell: TransactionsTable.receiptColumn.cell },\n ];\n\n private readonly __renderTransactionsPage = ({ html, ...ctx }: PageRendererContext) => {\n return html`\n <foxy-table\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-transactions-table')?.defaultNS ?? ''}\"\n .columns=${this.__transactionsTableColumns}\n >\n </foxy-table>\n `;\n };\n\n private readonly __renderTransactions = () => {\n const { lang, ns } = this;\n\n return html`\n <div data-testid=\"transactions\">\n ${this.renderTemplateOrSlot('transactions:before')}\n\n <x-group frame>\n <foxy-i18n lang=${lang} slot=\"header\" key=\"transaction_plural\" ns=${ns}></foxy-i18n>\n <foxy-collection-pages\n group=${this.group}\n class=\"block divide-y divide-contrast-10 px-m\"\n first=${this.data?._links['fx:transactions'].href ?? ''}\n lang=${lang}\n ns=${ns}\n .page=${this.__renderTransactionsPage}\n >\n </foxy-collection-pages>\n </x-group>\n\n ${this.renderTemplateOrSlot('transactions:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const isBusy = this.in('busy');\n const isFail = this.in('fail');\n\n return html`\n <div\n data-testid=\"wrapper\"\n aria-busy=${isBusy}\n aria-live=\"polite\"\n class=\"relative space-y-l text-body font-lumo text-m leading-m\"\n >\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.hiddenSelector.matches('transactions', true) ? '' : this.__renderTransactions()}\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': !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' : isBusy ? '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 __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
@@ -474,7 +474,7 @@ export class TemplateConfigForm extends Base {
474
474
  const suggestions = [];
475
475
  const fields = [];
476
476
  const config = json.cart_display_config;
477
- const isDisabled = this.disabledSelector.matches('hidden-fields', true);
477
+ const isDisabled = !this.in('idle') || this.disabledSelector.matches('hidden-fields', true);
478
478
  const isReadonly = this.readonlySelector.matches('hidden-fields', true);
479
479
  for (const key in config) {
480
480
  if (!key.startsWith('show_'))
@@ -500,8 +500,9 @@ export class TemplateConfigForm extends Base {
500
500
  };
501
501
  const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';
502
502
  const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];
503
+ const isAddButtonDisabled = isDisabled || !this.__addHiddenFieldInputValue;
503
504
  return html `
504
- <div>
505
+ <div data-testid="hidden-fields">
505
506
  ${this.renderTemplateOrSlot('hidden-fields:before')}
506
507
 
507
508
  <x-group frame>
@@ -514,7 +515,7 @@ export class TemplateConfigForm extends Base {
514
515
  >
515
516
  </foxy-i18n>
516
517
 
517
- <div class="divide-y divide-contrast-10">
518
+ <div class="divide-y divide-contrast-10" data-testid="hidden-fields-list">
518
519
  ${fields.map(field => {
519
520
  return html `
520
521
  <div
@@ -529,6 +530,7 @@ export class TemplateConfigForm extends Base {
529
530
  : html `<span>${field}</span>`}
530
531
 
531
532
  <button
533
+ aria-label=${this.t('delete')}
532
534
  class=${classMap({
533
535
  'w-xs h-xs rounded-full transition-colors': true,
534
536
  'hover-bg-error-10 hover-text-error': !isDisabled,
@@ -556,6 +558,7 @@ export class TemplateConfigForm extends Base {
556
558
  </div>
557
559
 
558
560
  <div
561
+ data-testid="hidden-fields-new"
559
562
  style="border-radius: ${inputRadius.join(' ')}"
560
563
  class=${classMap({
561
564
  'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,
@@ -570,6 +573,7 @@ export class TemplateConfigForm extends Base {
570
573
  list="hidden-fields-list"
571
574
  .value=${live(this.__addHiddenFieldInputValue)}
572
575
  ?disabled=${isDisabled}
576
+ ?readonly=${isReadonly}
573
577
  @keydown=${(evt) => evt.key === 'Enter' && addField()}
574
578
  @input=${(evt) => {
575
579
  this.__addHiddenFieldInputValue = evt.currentTarget.value;
@@ -587,12 +591,12 @@ export class TemplateConfigForm extends Base {
587
591
  class=${classMap({
588
592
  'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,
589
593
  'flex items-center justify-center rounded-full transition-colors': true,
590
- 'bg-contrast-5 text-disabled cursor-default': !this.__addHiddenFieldInputValue,
591
- 'bg-success-10 text-success cursor-pointer': !!this.__addHiddenFieldInputValue,
592
- 'hover-bg-success hover-text-success-contrast': !!this.__addHiddenFieldInputValue,
593
- 'focus-outline-none focus-ring-2': !!this.__addHiddenFieldInputValue,
594
+ 'bg-contrast-5 text-disabled cursor-default': isAddButtonDisabled,
595
+ 'bg-success-10 text-success cursor-pointer': !isAddButtonDisabled,
596
+ 'hover-bg-success hover-text-success-contrast': !isAddButtonDisabled,
597
+ 'focus-outline-none focus-ring-2': !isAddButtonDisabled,
594
598
  })}
595
- ?disabled=${!this.__addHiddenFieldInputValue}
599
+ ?disabled=${isAddButtonDisabled}
596
600
  @click=${addField}
597
601
  >
598
602
  <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon>
@@ -606,7 +610,7 @@ export class TemplateConfigForm extends Base {
606
610
  }
607
611
  __renderCards(json) {
608
612
  const { lang, ns } = this;
609
- const isDisabled = this.disabledSelector.matches('cards', true);
613
+ const isDisabled = !this.in('idle') || this.disabledSelector.matches('cards', true);
610
614
  const isReadonly = this.readonlySelector.matches('cards', true);
611
615
  const config = json.supported_payment_cards;
612
616
  let skipForSaved;
@@ -634,7 +638,7 @@ export class TemplateConfigForm extends Base {
634
638
  visa: 'Visa',
635
639
  };
636
640
  return html `
637
- <div>
641
+ <div data-testid="cards">
638
642
  ${this.renderTemplateOrSlot('cards:before')}
639
643
 
640
644
  <div class="space-y-xs">
@@ -682,16 +686,17 @@ export class TemplateConfigForm extends Base {
682
686
  type="checkbox"
683
687
  class="sr-only"
684
688
  ?disabled=${isDisabled}
689
+ ?readonly=${isReadonly}
685
690
  ?checked=${isChecked}
686
691
  @change=${(evt) => {
687
692
  if (isReadonly)
688
693
  return evt.preventDefault();
689
694
  evt.stopPropagation();
690
- if (isChecked) {
691
- config.splice(config.indexOf(type), 1);
695
+ if (evt.currentTarget.checked) {
696
+ config.push(type);
692
697
  }
693
698
  else {
694
- config.push(type);
699
+ config.splice(config.indexOf(type), 1);
695
700
  }
696
701
  this.edit({ json: JSON.stringify(json) });
697
702
  }}
@@ -704,6 +709,7 @@ export class TemplateConfigForm extends Base {
704
709
 
705
710
  <div class="flex flex-wrap p-s border-t border-contrast-10">
706
711
  <x-checkbox
712
+ data-testid="cards-saved-check"
707
713
  class="m-s"
708
714
  ?disabled=${isDisabled || json.csc_requirements === 'new_cards_only'}
709
715
  ?readonly=${isReadonly}
@@ -718,6 +724,7 @@ export class TemplateConfigForm extends Base {
718
724
  </x-checkbox>
719
725
 
720
726
  <x-checkbox
727
+ data-testid="cards-sso-check"
721
728
  class="m-s"
722
729
  ?disabled=${isDisabled}
723
730
  ?readonly=${isReadonly}