@foxy.io/elements 1.30.0-beta.2 → 1.30.0-beta.4

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 (26) hide show
  1. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  2. package/dist/cdn/foxy-coupon-form.js +1 -1
  3. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  4. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  5. package/dist/cdn/foxy-gift-card-form.js +1 -1
  6. package/dist/cdn/foxy-native-integration-form.js +1 -1
  7. package/dist/cdn/foxy-store-form.js +1 -1
  8. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  9. package/dist/cdn/foxy-transaction.js +1 -1
  10. package/dist/cdn/{shared-7dd710e4.js → shared-fae08dfb.js} +1 -1
  11. package/dist/cdn/translations/admin-subscription-form/en.json +11 -11
  12. package/dist/cdn/translations/coupon-form/en.json +59 -55
  13. package/dist/cdn/translations/customer-portal/de.json +1 -1
  14. package/dist/cdn/translations/transaction/en.json +11 -11
  15. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +24 -18
  16. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
  17. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.d.ts +1 -0
  18. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js +39 -17
  19. package/dist/elements/internal/InternalQueryBuilderControl/InternalQueryBuilderControl.js.map +1 -1
  20. package/dist/elements/public/CouponForm/CouponForm.js +25 -18
  21. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  22. package/dist/elements/public/Transaction/Transaction.js +10 -13
  23. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  24. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +0 -1
  25. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +1 -1
  26. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CouponForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/CouponForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAuCE,2BAAsB,GAAqC,IAAI,CAAC;QAE/C,+CAA0C,GAAG,GAAG,EAAE;;YACjE,MAAM,KAAK,SAAG,IAAI,CAAC,IAAI,CAAC,kCAAkC,0CACtD,KAAK,CAAC,GAAG,EACV,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EACzB,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,EAC3E,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAE7B,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;QACrB,CAAC,CAAC;QAEe,+CAA0C,GAAG,CAAC,QAAgB,EAAE,EAAE;YACjF,IAAI,CAAC,IAAI,CAAC;gBACR,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,IAAI,CAAC,iCAAiC;iBACzC;YACP,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE;YACzE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE;SAC1E;;;;;;oBAMW,IAAI,CAAC,0CAA0C;oBAC/C,IAAI,CAAC,0CAA0C;;;;;;;;kBAQjD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;uBAEjC,SAAS,aAAC,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC;qBACxE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,2BAA2B,EAAE,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA+DnE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;QAS1D,KAAK,CAAC,UAAU,EAAE;;;;;eAKX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { Data, TransactionPageHrefGetter } from './types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { SwipeAction } from '../../internal/InternalAsyncListControl/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Option } from '../QueryBuilder/types';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Operator, Type } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'coupon-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing coupons (`fx:coupon`).\n *\n * @element foxy-coupon-form\n * @since 1.15.0\n */\nexport class CouponForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n __couponCodesActions: { type: Array },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',\n ({ inclusive_tax_rate: v }) => !v || v >= 0 || 'inclusive-tax-rate:v8n_too_small',\n ({ inclusive_tax_rate: v }) => !v || v <= 1 || 'inclusive-tax-rate:v8n_too_big',\n ({ number_of_uses_allowed: v }) => !v || v >= 0 || 'number-of-uses-allowed:v8n_too_small',\n ({ coupon_discount_details: v }) => !!v || 'rules:v8n_required',\n ({ coupon_discount_details: v }) => !v || v.length <= 200 || 'rules:v8n_too_long',\n ({ item_option_restrictions: v }) => {\n return !v || JSON.stringify(v).length <= 6000 || 'item-option-restrictions:v8n_too_long';\n },\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ({ customer_attribute_restrictions: v }) => {\n return !v || v.length <= 2000 || 'customer-attribute-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_code: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-code:v8n_too_small';\n },\n ({ customer_subscription_restrictions: v }) => {\n return !v || v.length <= 200 || 'customer-subscription-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_customer: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-customer:v8n_too_small';\n },\n ];\n }\n\n getTransactionPageHref: TransactionPageHrefGetter | null = null;\n\n private readonly __customerSubscriptionRestrictionsGetValue = () => {\n const items = this.form.customer_subscription_restrictions\n ?.split(',')\n .map(value => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .map(value => ({ value }));\n\n return items ?? [];\n };\n\n private readonly __customerSubscriptionRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n customer_subscription_restrictions: newValue\n .map(({ value }) => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .join(),\n });\n\n this.edit({\n customer_auto_apply:\n !!this.form.customer_subscription_restrictions ||\n !!this.form.customer_attribute_restrictions,\n });\n };\n\n private readonly __productCodeRestrictionsGetValue = () => {\n return this.form.product_code_restrictions\n ?.split(',')\n .filter(v => !!v.trim())\n .map(value => ({\n value,\n label: value.startsWith('-')\n ? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })\n : this.t(`product-code-restrictions.label_allow`, { value }),\n }));\n };\n\n private readonly __productCodeRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n product_code_restrictions: newValue\n .map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))\n .filter((v, i, a) => !!v && a.indexOf(v) === i)\n .join(','),\n });\n };\n\n private readonly __itemOptionRestrictionsOperators = [Operator.In];\n\n private readonly __itemOptionRestrictionsGetValue = () => {\n const query = new URLSearchParams();\n const rules = this.form.item_option_restrictions ?? {};\n\n for (const key in rules) {\n query.set(`${key}:in`, rules[key].join(','));\n }\n\n return query.toString();\n };\n\n private readonly __itemOptionRestrictionsSetValue = (newValue: string) => {\n const rules = Object.fromEntries(\n Array.from(new URLSearchParams(newValue).entries()).map(([key, value]) => {\n return [key.replace(':in', ''), value.split(',').filter(v => !!v.trim())];\n })\n );\n\n this.edit({ item_option_restrictions: rules });\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __couponCodesActions: SwipeAction<Resource<Rels.CouponCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__couponCodesActions[0].state = 'busy';\n this.__couponCodesActions = [...this.__couponCodesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__couponCodesActions[0].state = 'end';\n } catch {\n this.__couponCodesActions[0].state = 'error';\n } finally {\n this.__couponCodesActions = [...this.__couponCodesActions];\n setTimeout(() => {\n this.__couponCodesActions[0].state = 'idle';\n this.__couponCodesActions = [...this.__couponCodesActions];\n }, 1000);\n }\n },\n },\n ];\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data) {\n alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { ...super.headerSubtitleOptions, id: this.headerCopyIdValue };\n }\n\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:generate_codes'].href}\n infer=\"generate\"\n form=\"foxy-generate-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:coupon_codes'].href}\n infer=\"import\"\n form=\"foxy-coupon-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n ${super.renderHeaderActions(data)}\n `;\n }\n\n renderBody(): TemplateResult {\n let codesUrl: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:coupon_codes'].href ?? '');\n url.searchParams.set('order', 'date_created desc');\n\n codesUrl = url.toString();\n } catch {\n codesUrl = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-coupon-form-rules-control infer=\"rules\">\n </foxy-internal-coupon-form-rules-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"coupon-codes\"\n item=\"foxy-coupon-code-card\"\n form=\"foxy-coupon-code-form\"\n alert\n .formProps=${{ '.getTransactionPageHref': this.getTransactionPageHref }}\n .actions=${this.__couponCodesActions}\n .filters=${this.__codesFilters}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-query-builder-control\n infer=\"item-option-restrictions\"\n disable-or\n .operators=${this.__itemOptionRestrictionsOperators}\n .getValue=${this.__itemOptionRestrictionsGetValue}\n .setValue=${this.__itemOptionRestrictionsSetValue}\n >\n </foxy-internal-query-builder-control>\n\n <foxy-internal-query-builder-control infer=\"customer-attribute-restrictions\">\n </foxy-internal-query-builder-control>\n\n <foxy-internal-editable-list-control\n infer=\"product-code-restrictions\"\n .getValue=${this.__productCodeRestrictionsGetValue}\n .setValue=${this.__productCodeRestrictionsSetValue}\n .units=${[\n { label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },\n { label: this.t('product-code-restrictions.unit_block'), value: 'block' },\n ]}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-editable-list-control\n infer=\"customer-subscription-restrictions\"\n .getValue=${this.__customerSubscriptionRestrictionsGetValue}\n .setValue=${this.__customerSubscriptionRestrictionsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-async-resource-link-list-control\n foreign-key-for-uri=\"item_category_uri\"\n foreign-key-for-id=\"item_category_id\"\n own-key-for-uri=\"coupon_uri\"\n own-uri=${ifDefined(this.data?._links.self.href)}\n embed-key=\"fx:coupon_item_categories\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:coupon_item_categories'].href)}\n infer=\"category-restrictions\"\n limit=\"5\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-async-resource-link-list-control>\n\n <foxy-internal-summary-control infer=\"uses\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-customer\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-code\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"timeframe\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"taxes\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"inclusive-tax-rate\"\n min=\"0\"\n max=\"1\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"options\">\n <foxy-internal-switch-control infer=\"multiple-codes-allowed\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"combinable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-category-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-line-item-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"is-taxable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"shared-codes-allowed\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"customer-auto-apply\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n infer=\"attributes\"\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\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>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
1
+ {"version":3,"file":"CouponForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/CouponForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAuCE,2BAAsB,GAAqC,IAAI,CAAC;QAE/C,+CAA0C,GAAG,GAAG,EAAE;;YACjE,MAAM,K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AE,IAAI,CAAC;;;;;;;;;QAS1D,KAAK,CAAC,UAAU,EAAE;;;;;eAKX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { Data, TransactionPageHrefGetter } from './types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { SwipeAction } from '../../internal/InternalAsyncListControl/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Option } from '../QueryBuilder/types';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Operator, Type } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'coupon-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing coupons (`fx:coupon`).\n *\n * @element foxy-coupon-form\n * @since 1.15.0\n */\nexport class CouponForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n __couponCodesActions: { type: Array },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',\n ({ inclusive_tax_rate: v }) => !v || v >= 0 || 'inclusive-tax-rate:v8n_too_small',\n ({ inclusive_tax_rate: v }) => !v || v <= 1 || 'inclusive-tax-rate:v8n_too_big',\n ({ number_of_uses_allowed: v }) => !v || v >= 0 || 'number-of-uses-allowed:v8n_too_small',\n ({ coupon_discount_details: v }) => !!v || 'rules:v8n_required',\n ({ coupon_discount_details: v }) => !v || v.length <= 200 || 'rules:v8n_too_long',\n ({ item_option_restrictions: v }) => {\n return !v || JSON.stringify(v).length <= 6000 || 'item-option-restrictions:v8n_too_long';\n },\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ({ customer_attribute_restrictions: v }) => {\n return !v || v.length <= 2000 || 'customer-attribute-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_code: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-code:v8n_too_small';\n },\n ({ customer_subscription_restrictions: v }) => {\n return !v || v.length <= 200 || 'customer-subscription-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_customer: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-customer:v8n_too_small';\n },\n ];\n }\n\n getTransactionPageHref: TransactionPageHrefGetter | null = null;\n\n private readonly __customerSubscriptionRestrictionsGetValue = () => {\n const items = this.form.customer_subscription_restrictions\n ?.split(',')\n .map(value => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .map(value => ({ value }));\n\n return items ?? [];\n };\n\n private readonly __customerSubscriptionRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n customer_subscription_restrictions: newValue\n .map(({ value }) => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .join(),\n });\n\n this.edit({\n customer_auto_apply:\n !!this.form.customer_subscription_restrictions ||\n !!this.form.customer_attribute_restrictions,\n });\n };\n\n private readonly __productCodeRestrictionsGetValue = () => {\n return this.form.product_code_restrictions\n ?.split(',')\n .filter(v => !!v.trim())\n .map(value => ({\n value,\n label: value.startsWith('-')\n ? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })\n : this.t(`product-code-restrictions.label_allow`, { value }),\n }));\n };\n\n private readonly __productCodeRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n product_code_restrictions: newValue\n .map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))\n .filter((v, i, a) => !!v && a.indexOf(v) === i)\n .join(','),\n });\n };\n\n private readonly __itemOptionRestrictionsOperators = [Operator.In];\n\n private readonly __itemOptionRestrictionsGetValue = () => {\n const query = new URLSearchParams();\n const rules = this.form.item_option_restrictions ?? {};\n\n for (const key in rules) {\n query.set(`${key}:in`, rules[key].join(','));\n }\n\n return query.toString();\n };\n\n private readonly __itemOptionRestrictionsSetValue = (newValue: string) => {\n const rules = Object.fromEntries(\n Array.from(new URLSearchParams(newValue).entries()).map(([key, value]) => {\n return [key.replace(':in', ''), value.split(',').filter(v => !!v.trim())];\n })\n );\n\n this.edit({ item_option_restrictions: rules });\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __couponCodesActions: SwipeAction<Resource<Rels.CouponCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__couponCodesActions[0].state = 'busy';\n this.__couponCodesActions = [...this.__couponCodesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__couponCodesActions[0].state = 'end';\n } catch {\n this.__couponCodesActions[0].state = 'error';\n } finally {\n this.__couponCodesActions = [...this.__couponCodesActions];\n setTimeout(() => {\n this.__couponCodesActions[0].state = 'idle';\n this.__couponCodesActions = [...this.__couponCodesActions];\n }, 1000);\n }\n },\n },\n ];\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data) {\n alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { ...super.headerSubtitleOptions, id: this.headerCopyIdValue };\n }\n\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:generate_codes'].href}\n infer=\"generate\"\n form=\"foxy-generate-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:coupon_codes'].href}\n infer=\"import\"\n form=\"foxy-coupon-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n ${super.renderHeaderActions(data)}\n `;\n }\n\n renderBody(): TemplateResult {\n let codesUrl: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:coupon_codes'].href ?? '');\n url.searchParams.set('order', 'date_created desc');\n\n codesUrl = url.toString();\n } catch {\n codesUrl = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-coupon-form-rules-control infer=\"rules\">\n </foxy-internal-coupon-form-rules-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"coupon-codes\"\n item=\"foxy-coupon-code-card\"\n form=\"foxy-coupon-code-form\"\n alert\n .formProps=${{ '.getTransactionPageHref': this.getTransactionPageHref }}\n .actions=${this.__couponCodesActions}\n .filters=${this.__codesFilters}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-editable-list-control\n infer=\"product-code-restrictions\"\n .getValue=${this.__productCodeRestrictionsGetValue}\n .setValue=${this.__productCodeRestrictionsSetValue}\n .units=${[\n { label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },\n { label: this.t('product-code-restrictions.unit_block'), value: 'block' },\n ]}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-query-builder-control\n infer=\"item-option-restrictions\"\n disable-or\n .operators=${this.__itemOptionRestrictionsOperators}\n .getValue=${this.__itemOptionRestrictionsGetValue}\n .setValue=${this.__itemOptionRestrictionsSetValue}\n >\n </foxy-internal-query-builder-control>\n\n <foxy-internal-summary-control infer=\"customer-restrictions\">\n <foxy-internal-query-builder-control\n layout=\"summary-item\"\n infer=\"customer-attribute-restrictions\"\n >\n </foxy-internal-query-builder-control>\n\n <foxy-internal-editable-list-control\n layout=\"summary-item\"\n infer=\"customer-subscription-restrictions\"\n .getValue=${this.__customerSubscriptionRestrictionsGetValue}\n .setValue=${this.__customerSubscriptionRestrictionsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-switch-control infer=\"customer-auto-apply\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-resource-link-list-control\n foreign-key-for-uri=\"item_category_uri\"\n foreign-key-for-id=\"item_category_id\"\n own-key-for-uri=\"coupon_uri\"\n own-uri=${ifDefined(this.data?._links.self.href)}\n embed-key=\"fx:coupon_item_categories\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:coupon_item_categories'].href)}\n infer=\"category-restrictions\"\n limit=\"5\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-async-resource-link-list-control>\n\n <foxy-internal-summary-control infer=\"uses\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-customer\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-code\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"timeframe\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"taxes\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"inclusive-tax-rate\"\n min=\"0\"\n max=\"1\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"options\">\n <foxy-internal-switch-control infer=\"multiple-codes-allowed\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"combinable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-category-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-line-item-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"is-taxable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"shared-codes-allowed\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n infer=\"attributes\"\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\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>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
@@ -101,9 +101,8 @@ export class Transaction extends Base {
101
101
  if (type === 'subscription_cancellation') {
102
102
  alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');
103
103
  }
104
- if (!((_d = (_c = this.__storeLoader) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.use_webhook)) {
105
- alwaysMatch.unshift('datafeed', 'actions:resend-datafeed');
106
- }
104
+ if (!((_d = (_c = this.__storeLoader) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.use_webhook))
105
+ alwaysMatch.unshift('datafeed');
107
106
  return new BooleanSelector(alwaysMatch.join(' ').trim());
108
107
  }
109
108
  get headerSubtitleOptions() {
@@ -193,20 +192,13 @@ export class Transaction extends Base {
193
192
  return (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.display_id) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '';
194
193
  }
195
194
  renderHeaderActions() {
196
- var _a, _b;
197
195
  return html `
198
196
  <foxy-internal-transaction-actions-control infer="actions">
199
197
  </foxy-internal-transaction-actions-control>
200
-
201
- <foxy-internal-transaction-post-action-control
202
- infer="actions resend-datafeed"
203
- href=${ifDefined((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:process_webhook']) === null || _b === void 0 ? void 0 : _b.href)}
204
- >
205
- </foxy-internal-transaction-post-action-control>
206
198
  `;
207
199
  }
208
200
  renderBody() {
209
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
201
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
210
202
  let shipmentsLink = undefined;
211
203
  let webhooksLink = undefined;
212
204
  let itemsLink = undefined;
@@ -226,7 +218,7 @@ export class Transaction extends Base {
226
218
  webhooksLink = webhooksUrl.toString();
227
219
  itemsLink = itemsUrl.toString();
228
220
  }
229
- catch (_l) {
221
+ catch (_o) {
230
222
  //
231
223
  }
232
224
  }
@@ -338,12 +330,17 @@ export class Transaction extends Base {
338
330
 
339
331
  <foxy-internal-summary-control infer="datafeed">
340
332
  <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control>
333
+ <foxy-internal-transaction-post-action-control
334
+ infer="process-webhook"
335
+ href=${ifDefined((_l = (_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:process_webhook']) === null || _l === void 0 ? void 0 : _l.href)}
336
+ >
337
+ </foxy-internal-transaction-post-action-control>
341
338
  </foxy-internal-summary-control>
342
339
 
343
340
  <foxy-nucleon
344
341
  class="hidden"
345
342
  infer=""
346
- href=${ifDefined((_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:store'].href)}
343
+ href=${ifDefined((_m = this.data) === null || _m === void 0 ? void 0 : _m._links['fx:store'].href)}
347
344
  id="storeLoader"
348
345
  @update=${() => this.requestUpdate()}
349
346
  >
@@ -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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Ae,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;;;;;kBAK3E,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;kBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,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;;;;;;;;;;;eAWnC,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) {\n alwaysMatch.unshift('datafeed', 'actions:resend-datafeed');\n }\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 <foxy-internal-transaction-post-action-control\n infer=\"actions resend-datafeed\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n >\n </foxy-internal-transaction-post-action-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-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;A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AC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;kBAMS,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;;;;;kBAK3E,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;kBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,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 .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"]}
@@ -29,7 +29,6 @@ export class InternalTransactionPostActionControl extends InternalControl {
29
29
  </foxy-internal-confirm-dialog>
30
30
 
31
31
  <vaadin-button
32
- class="w-full"
33
32
  theme="${theme} tertiary-inline"
34
33
  ?disabled=${state === 'busy' || this.disabled}
35
34
  @click=${(evt) => {
@@ -1 +1 @@
1
- {"version":3,"file":"InternalTransactionPostActionControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionPostAction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AAK,CAAC,QAAQ;;QACpB,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM;YAAE,OAAO;QAEpC,IAAI;YACF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;YAEtB,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACzC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,OAAC,IAAI,CAAC,IAAI,mCAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAEtE,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YAC7C,IAAI,QAAQ,CAAC,EAAE;gBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;SAC9D;QAAC,WAAM;YACN,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;SACvB;IACH,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, html, TemplateResult } from 'lit-element';\nimport { InternalConfirmDialog } from '../../../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { DialogHideEvent } from '../../../../private/Dialog/DialogHideEvent';\nimport { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport { ButtonElement } from '@vaadin/vaadin-button';\n\nexport class InternalTransactionPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __state: { type: String },\n theme: { type: String },\n href: { type: String },\n };\n }\n\n theme: string | null = null;\n\n href: string | null = null;\n\n private __state = 'idle';\n\n renderControl(): TemplateResult {\n const state = this.__state;\n const theme = state === 'fail' ? 'error' : state === 'idle' ? this.theme : '';\n\n return html`\n <foxy-internal-confirm-dialog\n header=\"header\"\n infer=\"confirm\"\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => !evt.detail.cancelled && this.__submit()}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n class=\"w-full\"\n theme=\"${theme} tertiary-inline\"\n ?disabled=${state === 'busy' || this.disabled}\n @click=${(evt: CustomEvent) => {\n const confirm = this.renderRoot.querySelector('#confirm') as InternalConfirmDialog;\n confirm.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=${state} infer=\"\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private async __submit(): Promise<void> {\n if (this.__state === 'busy') return;\n\n try {\n this.__state = 'busy';\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(this.href ?? '', { method: 'POST' });\n\n this.__state = response.ok ? 'idle' : 'fail';\n if (response.ok) this.dispatchEvent(new CustomEvent('done'));\n } catch {\n this.__state = 'fail';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"InternalTransactionPostActionControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,IAAI,EAAkB,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,gEAA6D;AAEvF,OAAO,EAAE,cAAc,EAAE,kDAA+C;AAGxE,MAAM,OAAO,oCAAqC,SAAQ,eAAe;IAAzE;;QAUE,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;QAEnB,YAAO,GAAG,MAAM,CAAC;IA2C3B,CAAC;IAxDC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACvB,CAAC;IACJ,CAAC;IAQD,aAAa;QACX,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,MAAM,KAAK,GAAG,KAA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, html, TemplateResult } from 'lit-element';\nimport { InternalConfirmDialog } from '../../../../internal/InternalConfirmDialog/InternalConfirmDialog';\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { DialogHideEvent } from '../../../../private/Dialog/DialogHideEvent';\nimport { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport { ButtonElement } from '@vaadin/vaadin-button';\n\nexport class InternalTransactionPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __state: { type: String },\n theme: { type: String },\n href: { type: String },\n };\n }\n\n theme: string | null = null;\n\n href: string | null = null;\n\n private __state = 'idle';\n\n renderControl(): TemplateResult {\n const state = this.__state;\n const theme = state === 'fail' ? 'error' : state === 'idle' ? this.theme : '';\n\n return html`\n <foxy-internal-confirm-dialog\n header=\"header\"\n infer=\"confirm\"\n id=\"confirm\"\n @hide=${(evt: DialogHideEvent) => !evt.detail.cancelled && this.__submit()}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-button\n theme=\"${theme} tertiary-inline\"\n ?disabled=${state === 'busy' || this.disabled}\n @click=${(evt: CustomEvent) => {\n const confirm = this.renderRoot.querySelector('#confirm') as InternalConfirmDialog;\n confirm.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=${state} infer=\"\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private async __submit(): Promise<void> {\n if (this.__state === 'busy') return;\n\n try {\n this.__state = 'busy';\n\n const api = new NucleonElement.API(this);\n const response = await api.fetch(this.href ?? '', { method: 'POST' });\n\n this.__state = response.ok ? 'idle' : 'fail';\n if (response.ok) this.dispatchEvent(new CustomEvent('done'));\n } catch {\n this.__state = 'fail';\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.30.0-beta.2",
4
+ "version": "1.30.0-beta.4",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",