@foxy.io/elements 1.30.0-beta.3 → 1.30.0-beta.5
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-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-item-form.js +1 -179
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +179 -156
- package/dist/cdn/translations/cart-form/en.json +438 -413
- package/dist/cdn/translations/customer-portal/de.json +1 -1
- package/dist/cdn/translations/item-form/en.json +179 -156
- package/dist/cdn/translations/transaction/en.json +179 -156
- package/dist/elements/public/CartForm/CartForm.js +1 -0
- package/dist/elements/public/CartForm/CartForm.js.map +1 -1
- package/dist/elements/public/ItemForm/ItemForm.d.ts +9 -1
- package/dist/elements/public/ItemForm/ItemForm.js +152 -128
- package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
- package/dist/elements/public/ItemForm/index.d.ts +2 -3
- package/dist/elements/public/ItemForm/index.js +2 -3
- package/dist/elements/public/ItemForm/index.js.map +1 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +0 -1
- package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +1 -0
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBA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AC;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;IAED,IAAY,cAAc;;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACxC,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa;YAAE,OAAO,IAAI,CAAC,aAAa,CAAC;QAEnD,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAChD,MAAM,UAAU,SAAG,OAAC,IAAI,CAAC,aAAa,mCAAI,IAAI,CAAC,oBAAoB,CAAC,0CAAE,WAAW,CAAC;QAClF,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5E,IAAI,UAAU;YAAE,mBAAO,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,0CAAG,CAAC,oCAAK,IAAI,CAAC;QAE7E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAY,iBAAiB;;QAC3B,OAAO,OAAA,IAAI,CAAC,OAAO,0CAAE,iCAAiC,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,CAAC;CACF","sourcesContent":["import type { CustomerPageGetter, Data, Settings, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\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-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-submit-control': customElements.get('foxy-internal-submit-control'),\n 'foxy-internal-delete-control': customElements.get('foxy-internal-delete-control'),\n 'foxy-internal-undo-control': customElements.get('foxy-internal-undo-control'),\n 'foxy-copy-to-clipboard': customElements.get('foxy-copy-to-clipboard'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-customer-card': customElements.get('foxy-customer-card'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n getCustomerPageHref: CustomerPageGetter | null = null;\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\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 text-s font-medium text-secondary\"\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 __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n limit=\"5\"\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"end-date\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"end_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.end_date?.substr(0, 10))}\n value=${ifDefined(data?.end_date)}\n lang=${lang}\n ?readonly=${!this.__isEndDateEditable}\n ?disabled=${this.disabledSelector.matches('end-date', true)}\n .checkAvailability=${this.__checkEndDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ end_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\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 __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkEndDateAvailability = (date: Date) => {\n const tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 1);\n tomorrow.setHours(0, 0, 0, 0);\n return date.getTime() >= tomorrow.getTime();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\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=${ns}\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 class=\"sm-col-span-2\">\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 __renderCustomer = () => {\n const customerHref = this.data?._links['fx:customer'].href;\n const customerPageHref = customerHref ? this.getCustomerPageHref?.(customerHref) : void 0;\n\n return html`\n <div data-testid=\"customer\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('customer:before')}\n\n <foxy-i18n infer=\"customer\" class=\"block text-s font-medium leading-xs mb-xs\" key=\"label\">\n </foxy-i18n>\n\n <a\n class=${classMap({\n 'block rounded transition-colors': true,\n 'ring-1 ring-contrast-10': !customerPageHref,\n 'cursor-pointer bg-contrast-5 hover-bg-contrast-10': !!customerPageHref,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': !!customerPageHref,\n })}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n href=${ifDefined(customerPageHref)}\n >\n <foxy-customer-card infer=\"customer\" href=${ifDefined(customerHref)}></foxy-customer-card>\n </a>\n\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n get headerTitleOptions(): Record<string, unknown> {\n if (this.data && this.__currencyCode) {\n const frequency = parseFrequency(this.data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n const amount = `${total} ${this.__currencyCode}`;\n const currencyDisplay = this.__currencyDisplay;\n const context = this.__currencyCode\n ? this.data.frequency === '.5m'\n ? 'twice_a_month'\n : 'recurring'\n : 'existing';\n\n return { ...frequency, amount, currencyDisplay, context };\n } else {\n return {};\n }\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n let context: string;\n let date: string | null = null;\n\n if (this.data?.first_failed_transaction_date) {\n context = 'failed';\n date = this.data.first_failed_transaction_date;\n } else if (this.data?.end_date) {\n const hasEnded = new Date(this.data.end_date).getTime() > Date.now();\n context = hasEnded ? 'will_be_cancelled' : 'cancelled';\n date = this.data.end_date;\n } else if (!this.data?.is_active) {\n context = 'inactive';\n } else if (new Date(this.data.start_date) > new Date()) {\n context = 'will_be_active';\n date = this.data.start_date;\n } else {\n context = 'active';\n date = this.data.next_transaction_date;\n }\n\n return { date, context };\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n ${this.hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n ${this.__isEndDateVisible ? this.__renderEndDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(this.__currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes']?.href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded?.['fx:transaction_template'] as Embed | undefined;\n\n return embed ? void 0 : data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded?.['fx:transaction_template'] as Embed | undefined;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n\n return embed ?? this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\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 __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isEndDateVisible() {\n if (this.hiddenSelector.matches('end-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 return !this.settings;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isEndDateEditable() {\n if (this.readonlySelector.matches('end-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n\n return this.settings === null;\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 private get __currencyCode() {\n const cart = this.__transactionTemplate;\n if (cart?.currency_code) return cart.currency_code;\n\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n\n return null;\n }\n\n private get __currencyDisplay() {\n return this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;A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AG,IAAI,CAAC,mBAAmB,CAAC;QAChD,MAAM,UAAU,SAAG,OAAC,IAAI,CAAC,aAAa,mCAAI,IAAI,CAAC,oBAAoB,CAAC,0CAAE,WAAW,CAAC;QAClF,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5E,IAAI,UAAU;YAAE,mBAAO,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,0CAAG,CAAC,oCAAK,IAAI,CAAC;QAE7E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAY,iBAAiB;;QAC3B,OAAO,OAAA,IAAI,CAAC,OAAO,0CAAE,iCAAiC,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7E,CAAC;CACF","sourcesContent":["import type { CustomerPageGetter, Data, Settings, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\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-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-submit-control': customElements.get('foxy-internal-submit-control'),\n 'foxy-internal-delete-control': customElements.get('foxy-internal-delete-control'),\n 'foxy-internal-undo-control': customElements.get('foxy-internal-undo-control'),\n 'foxy-copy-to-clipboard': customElements.get('foxy-copy-to-clipboard'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-customer-card': customElements.get('foxy-customer-card'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n getCustomerPageHref: CustomerPageGetter | null = null;\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\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 text-s font-medium text-secondary\"\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 __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"end-date\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"end_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.end_date?.substr(0, 10))}\n value=${ifDefined(data?.end_date)}\n lang=${lang}\n ?readonly=${!this.__isEndDateEditable}\n ?disabled=${this.disabledSelector.matches('end-date', true)}\n .checkAvailability=${this.__checkEndDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ end_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\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 __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkEndDateAvailability = (date: Date) => {\n const tomorrow = new Date();\n tomorrow.setDate(tomorrow.getDate() + 1);\n tomorrow.setHours(0, 0, 0, 0);\n return date.getTime() >= tomorrow.getTime();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\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=${ns}\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 class=\"sm-col-span-2\">\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 __renderCustomer = () => {\n const customerHref = this.data?._links['fx:customer'].href;\n const customerPageHref = customerHref ? this.getCustomerPageHref?.(customerHref) : void 0;\n\n return html`\n <div data-testid=\"customer\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('customer:before')}\n\n <foxy-i18n infer=\"customer\" class=\"block text-s font-medium leading-xs mb-xs\" key=\"label\">\n </foxy-i18n>\n\n <a\n class=${classMap({\n 'block rounded transition-colors': true,\n 'ring-1 ring-contrast-10': !customerPageHref,\n 'cursor-pointer bg-contrast-5 hover-bg-contrast-10': !!customerPageHref,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': !!customerPageHref,\n })}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n href=${ifDefined(customerPageHref)}\n >\n <foxy-customer-card infer=\"customer\" href=${ifDefined(customerHref)}></foxy-customer-card>\n </a>\n\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n get headerTitleOptions(): Record<string, unknown> {\n if (this.data && this.__currencyCode) {\n const frequency = parseFrequency(this.data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n const amount = `${total} ${this.__currencyCode}`;\n const currencyDisplay = this.__currencyDisplay;\n const context = this.__currencyCode\n ? this.data.frequency === '.5m'\n ? 'twice_a_month'\n : 'recurring'\n : 'existing';\n\n return { ...frequency, amount, currencyDisplay, context };\n } else {\n return {};\n }\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n let context: string;\n let date: string | null = null;\n\n if (this.data?.first_failed_transaction_date) {\n context = 'failed';\n date = this.data.first_failed_transaction_date;\n } else if (this.data?.end_date) {\n const hasEnded = new Date(this.data.end_date).getTime() > Date.now();\n context = hasEnded ? 'will_be_cancelled' : 'cancelled';\n date = this.data.end_date;\n } else if (!this.data?.is_active) {\n context = 'inactive';\n } else if (new Date(this.data.start_date) > new Date()) {\n context = 'will_be_active';\n date = this.data.start_date;\n } else {\n context = 'active';\n date = this.data.next_transaction_date;\n }\n\n return { date, context };\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n ${this.hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n ${this.__isEndDateVisible ? this.__renderEndDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(this.__currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes']?.href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded?.['fx:transaction_template'] as Embed | undefined;\n\n return embed ? void 0 : data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded?.['fx:transaction_template'] as Embed | undefined;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n\n return embed ?? this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\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 __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isEndDateVisible() {\n if (this.hiddenSelector.matches('end-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 return !this.settings;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isEndDateEditable() {\n if (this.readonlySelector.matches('end-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n\n return this.settings === null;\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 private get __currencyCode() {\n const cart = this.__transactionTemplate;\n if (cart?.currency_code) return cart.currency_code;\n\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n\n return null;\n }\n\n private get __currencyDisplay() {\n return this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAWE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,4BAAuB,GAAsC,IAAI,CAAC;QAElE,wBAAmB,GAAsC,IAAI,CAAC;QAE7C,0BAAqB,GAAG;YACvC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,KAAK,EAAE,SAAmC,EAAE,EAAE;oBACrD,IAAI,CAAC,IAAI,CAAC,IAAI;wBAAE,OAAO;oBAEvB,qDAAqD;oBACrD,4CAA4C;oBAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC;oBACtD,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oB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,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;iBAQjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;;;;;;;;eAQ1D,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n // TODO remove ts-expect-error when SDK has the types\n // @ts-expect-error SDK types are incomplete\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n // TODO: Remove the ts-expect-error comment when SDK has the types\n // @ts-expect-error SDK doesn't have the types\n const webhooksUrl = new URL(this.__storeLoader?.data._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n .related=${[this.href]}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <div\n class=\"grid gap-m sm-grid-cols-2\"\n ?hidden=${hidden.matches('custom-fields', true) && hidden.matches('attributes', true)}\n >\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAWE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,4BAAuB,GAAsC,IAAI,CAAC;QAElE,wBAAmB,GAAsC,IAAI,CAAC;QAE7C,0BAAqB,GAAG;YACvC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,KAAK,EAAE,SAAmC,EAAE,EAAE;oBACrD,IAAI,CAAC,IAAI,CAAC,IAAI;wBAAE,O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C,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWpD,SAAS,CAAC,aAAa,CAAC;;;;;;;gBAOxB,SAAS,CAAC,YAAY,CAAC;;;;;;uBAMhB,IAAI,CAAC,qBAAqB;qBAC5B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;qBAC7B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;iBAQjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;;;;;;;;eAQ1D,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n // TODO remove ts-expect-error when SDK has the types\n // @ts-expect-error SDK types are incomplete\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n return html`\n <foxy-internal-transaction-actions-control infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n // TODO: Remove the ts-expect-error comment when SDK has the types\n // @ts-expect-error SDK doesn't have the types\n const webhooksUrl = new URL(this.__storeLoader?.data._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <div\n class=\"grid gap-m sm-grid-cols-2\"\n ?hidden=${hidden.matches('custom-fields', true) && hidden.matches('attributes', true)}\n >\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-transaction-post-action-control\n infer=\"process-webhook\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>('#storeLoader');\n }\n}\n"]}
|