@foxy.io/elements 1.40.0 → 1.41.0-beta.2
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-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-5b4e2567.js → shared-109ec474.js} +1 -1
- package/dist/cdn/shared-1100bca8.js +1 -0
- package/dist/cdn/{shared-eef73355.js → shared-18e3b778.js} +1 -1
- package/dist/cdn/{shared-9e8ed3af.js → shared-35a49192.js} +1 -1
- package/dist/cdn/{shared-00e02b35.js → shared-43637d69.js} +1 -1
- package/dist/cdn/{shared-cc7e1dc6.js → shared-47d95cdd.js} +1 -1
- package/dist/cdn/{shared-17f2f27a.js → shared-57a179b3.js} +1 -1
- package/dist/cdn/{shared-3a952968.js → shared-6199cae2.js} +1 -1
- package/dist/cdn/{shared-5cd33249.js → shared-63eef674.js} +1 -1
- package/dist/cdn/{shared-e4119ddc.js → shared-67f73b81.js} +1 -1
- package/dist/cdn/{shared-c73c69bf.js → shared-697d44e6.js} +1 -1
- package/dist/cdn/{shared-0c2879b9.js → shared-6be00444.js} +1 -1
- package/dist/cdn/{shared-0098edce.js → shared-7097e2e1.js} +1 -1
- package/dist/cdn/{shared-e21ddeae.js → shared-77132fe8.js} +1 -1
- package/dist/cdn/{shared-653368ea.js → shared-864ff856.js} +1 -1
- package/dist/cdn/{shared-33ecc7ee.js → shared-86e9c57a.js} +1 -1
- package/dist/cdn/{shared-e0da7113.js → shared-88220d9e.js} +1 -1
- package/dist/cdn/{shared-4a4f6eb9.js → shared-888018de.js} +1 -1
- package/dist/cdn/{shared-4a32f76a.js → shared-9a64bf35.js} +1 -1
- package/dist/cdn/{shared-511fcf8e.js → shared-e41fced3.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +16 -0
- package/dist/cdn/translations/coupon-form/en.json +15 -0
- package/dist/cdn/translations/transaction/en.json +60 -35
- package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.d.ts +1 -0
- package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.js +3 -0
- package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.js.map +1 -1
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.d.ts +13 -0
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js +98 -0
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js.map +1 -0
- package/dist/elements/internal/InternalPostActionControl/index.d.ts +7 -0
- package/dist/elements/internal/InternalPostActionControl/index.js +9 -0
- package/dist/elements/internal/InternalPostActionControl/index.js.map +1 -0
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js +21 -4
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js.map +1 -1
- package/dist/elements/public/AdminSubscriptionForm/index.d.ts +1 -0
- package/dist/elements/public/AdminSubscriptionForm/index.js +1 -0
- package/dist/elements/public/AdminSubscriptionForm/index.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +16 -1
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +5 -3
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +1 -1
- package/dist/elements/public/Transaction/index.js +1 -1
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +16 -14
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.d.ts +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-e5546d55.js +0 -1
- package/dist/cdn/translations/country/zh-cn.json +0 -248
- package/dist/cdn/translations/country/zh-hk.json +0 -245
- package/dist/cdn/translations/customer-portal/zh-hk.json +0 -1182
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.d.ts +0 -10
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +0 -60
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +0 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.d.ts +0 -6
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js +0 -8
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js.map +0 -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,IAAI,EAAE,QAAQ,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OA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E;;;;;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 { Option, ParsedValue } from '../QueryBuilder/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 { 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 { Type, Operator } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { parse } from '../QueryBuilder/utils/parse';\nimport { stringify } from '../QueryBuilder/utils/stringify';\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 __customerAttributeRestrictionsOperators: Operator[] = [\n Operator.Not,\n Operator.In,\n ];\n\n private readonly __customerAttributeRestrictionsGetValue = () => {\n const simplifiedValue = parse(this.form.customer_attribute_restrictions ?? '')\n .filter(value => Array.isArray(value) || typeof value.name === 'string')\n .map(value => {\n if (Array.isArray(value)) {\n return value\n .filter(({ name }) => typeof name === 'string')\n .map(({ name, operator, value }) => {\n const output: ParsedValue = { path: name as string, operator, value };\n return output;\n });\n }\n\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: value.name as string,\n };\n\n return output;\n });\n\n return stringify(simplifiedValue, true);\n };\n\n private readonly __customerAttributeRestrictionsSetValue = (newValue: string) => {\n const augmentedValue = parse(newValue).map(value => {\n if (Array.isArray(value)) {\n return value.map(({ path, operator, value }) => {\n const output: ParsedValue = { name: path, path: 'attributes', operator, value };\n return output;\n });\n } else {\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: 'attributes',\n name: value.path,\n };\n\n return output;\n }\n });\n\n this.edit({ customer_attribute_restrictions: stringify(augmentedValue, true) });\n };\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 __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-array-map-control infer=\"item-option-restrictions\">\n </foxy-internal-array-map-control>\n\n <foxy-internal-query-builder-control\n infer=\"customer-attribute-restrictions\"\n disable-zoom\n disable-or\n .operators=${this.__customerAttributeRestrictionsOperators}\n .getValue=${this.__customerAttributeRestrictionsGetValue}\n .setValue=${this.__customerAttributeRestrictionsSetValue}\n >\n </foxy-internal-query-builder-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-summary-control infer=\"auto-apply\">\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"]}
|
|
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,IAAI,EAAE,QAAQ,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,uCAAoC;AACpD,OAAO,EAAE,SAAS,EAAE,2CAAwC;AAE5D,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,6CAAwC,GAAe;YACtE,QAAQ,CAAC,GAAG;YACZ,QAAQ,CAAC,EAAE;SACZ,CAAC;QAEe,4CAAuC,GAAG,GAAG,EAAE;;YAC9D,MAAM,eAAe,GAAG,KAAK,OAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,mCAAI,EAAE,CAAC;iBAC3E,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC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C,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE;YACzE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE;SAC1E;;;;;;;;;;;qBAWY,IAAI,CAAC,wCAAwC;oBAC9C,IAAI,CAAC,uCAAuC;oBAC5C,IAAI,CAAC,uCAAuC;;;;;;oBAM5C,IAAI,CAAC,0CAA0C;oBAC/C,IAAI,CAAC,0CAA0C;;;;;;;;;;;;;;;;kBAgBjD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAkEnE,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 { Option, ParsedValue } from '../QueryBuilder/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 { 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 { Type, Operator } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { parse } from '../QueryBuilder/utils/parse';\nimport { stringify } from '../QueryBuilder/utils/stringify';\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 __customerAttributeRestrictionsOperators: Operator[] = [\n Operator.Not,\n Operator.In,\n ];\n\n private readonly __customerAttributeRestrictionsGetValue = () => {\n const simplifiedValue = parse(this.form.customer_attribute_restrictions ?? '')\n .filter(value => Array.isArray(value) || typeof value.name === 'string')\n .map(value => {\n if (Array.isArray(value)) {\n return value\n .filter(({ name }) => typeof name === 'string')\n .map(({ name, operator, value }) => {\n const output: ParsedValue = { path: name as string, operator, value };\n return output;\n });\n }\n\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: value.name as string,\n };\n\n return output;\n });\n\n return stringify(simplifiedValue, true);\n };\n\n private readonly __customerAttributeRestrictionsSetValue = (newValue: string) => {\n const augmentedValue = parse(newValue).map(value => {\n if (Array.isArray(value)) {\n return value.map(({ path, operator, value }) => {\n const output: ParsedValue = { name: path, path: 'attributes', operator, value };\n return output;\n });\n } else {\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: 'attributes',\n name: value.path,\n };\n\n return output;\n }\n });\n\n this.edit({ customer_attribute_restrictions: stringify(augmentedValue, true) });\n };\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 __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-stub', 'category-restrictions-stub', 'attributes-stub');\n } else {\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-summary-control infer=\"coupon-codes-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\n </foxy-internal-summary-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-array-map-control infer=\"item-option-restrictions\">\n </foxy-internal-array-map-control>\n\n <foxy-internal-query-builder-control\n infer=\"customer-attribute-restrictions\"\n disable-zoom\n disable-or\n .operators=${this.__customerAttributeRestrictionsOperators}\n .getValue=${this.__customerAttributeRestrictionsGetValue}\n .setValue=${this.__customerAttributeRestrictionsSetValue}\n >\n </foxy-internal-query-builder-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-summary-control infer=\"auto-apply\">\n <foxy-internal-switch-control infer=\"customer-auto-apply\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"category-restrictions-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\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-summary-control infer=\"attributes-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\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"]}
|
|
@@ -68,7 +68,7 @@ export class Transaction extends Base {
|
|
|
68
68
|
var _a, _b, _c;
|
|
69
69
|
const alwaysMatch = [
|
|
70
70
|
'billing-addresses',
|
|
71
|
-
'datafeed',
|
|
71
|
+
'datafeed:data-is-fed',
|
|
72
72
|
'webhooks:dialog:url',
|
|
73
73
|
super.readonlySelector,
|
|
74
74
|
];
|
|
@@ -340,11 +340,13 @@ export class Transaction extends Base {
|
|
|
340
340
|
|
|
341
341
|
<foxy-internal-summary-control infer="datafeed">
|
|
342
342
|
<foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control>
|
|
343
|
-
<foxy-internal-
|
|
343
|
+
<foxy-internal-post-action-control
|
|
344
344
|
infer="process-webhook"
|
|
345
|
+
theme="tertiary-inline"
|
|
345
346
|
href=${ifDefined((_q = (_p = this.data) === null || _p === void 0 ? void 0 : _p._links['fx:process_webhook']) === null || _q === void 0 ? void 0 : _q.href)}
|
|
347
|
+
@success=${() => this.refresh()}
|
|
346
348
|
>
|
|
347
|
-
</foxy-internal-
|
|
349
|
+
</foxy-internal-post-action-control>
|
|
348
350
|
</foxy-internal-summary-control>
|
|
349
351
|
|
|
350
352
|
<foxy-nucleon
|
|
@@ -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,o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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 localeCodes: { attribute: 'locale-codes' },\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 /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: 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 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 headerSubtitleBadges(): { key: string }[] {\n const badges = super.headerSubtitleBadges;\n if (this.data?.is_test) badges.push({ key: 'test' });\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n return badges;\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 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 .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\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 <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\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;;QAYE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QA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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 localeCodes: { attribute: 'locale-codes' },\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 /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: 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 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:data-is-fed',\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 headerSubtitleBadges(): { key: string }[] {\n const badges = super.headerSubtitleBadges;\n if (this.data?.is_test) badges.push({ key: 'test' });\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n return badges;\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 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 .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\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 <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\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-post-action-control\n infer=\"process-webhook\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n @success=${() => this.refresh()}\n >\n </foxy-internal-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"]}
|
|
@@ -13,11 +13,11 @@ import '../AddressForm/index';
|
|
|
13
13
|
import '../ItemCard/index';
|
|
14
14
|
import '../ItemForm/index';
|
|
15
15
|
import '../I18n/index';
|
|
16
|
+
import '../../internal/InternalPostActionControl/index';
|
|
16
17
|
import '../../internal/InternalAsyncListControl/index';
|
|
17
18
|
import '../../internal/InternalSummaryControl/index';
|
|
18
19
|
import '../../internal/InternalSwitchControl/index';
|
|
19
20
|
import '../../internal/InternalForm/index';
|
|
20
|
-
import './internal/InternalTransactionPostActionControl/index';
|
|
21
21
|
import './internal/InternalTransactionCustomerControl/index';
|
|
22
22
|
import './internal/InternalTransactionActionsControl/index';
|
|
23
23
|
import './internal/InternalTransactionSummaryControl/index';
|
|
@@ -13,11 +13,11 @@ import "../AddressForm/index.js";
|
|
|
13
13
|
import "../ItemCard/index.js";
|
|
14
14
|
import "../ItemForm/index.js";
|
|
15
15
|
import "../I18n/index.js";
|
|
16
|
+
import "../../internal/InternalPostActionControl/index.js";
|
|
16
17
|
import "../../internal/InternalAsyncListControl/index.js";
|
|
17
18
|
import "../../internal/InternalSummaryControl/index.js";
|
|
18
19
|
import "../../internal/InternalSwitchControl/index.js";
|
|
19
20
|
import "../../internal/InternalForm/index.js";
|
|
20
|
-
import "./internal/InternalTransactionPostActionControl/index.js";
|
|
21
21
|
import "./internal/InternalTransactionCustomerControl/index.js";
|
|
22
22
|
import "./internal/InternalTransactionActionsControl/index.js";
|
|
23
23
|
import "./internal/InternalTransactionSummaryControl/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/index.ts"],"names":[],"mappings":"AAAA,wCAAqC;AACrC,mCAAgC;AAChC,mCAAgC;AAChC,qCAAkC;AAClC,qCAAkC;AAClC,qCAAkC;AAClC,oCAAiC;AACjC,kCAA+B;AAC/B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,8BAA2B;AAC3B,8BAA2B;AAC3B,0BAAuB;AAEvB,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,8CAA2C;AAE3C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/index.ts"],"names":[],"mappings":"AAAA,wCAAqC;AACrC,mCAAgC;AAChC,mCAAgC;AAChC,qCAAkC;AAClC,qCAAkC;AAClC,qCAAkC;AAClC,oCAAiC;AACjC,kCAA+B;AAC/B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,iCAA8B;AAC9B,8BAA2B;AAC3B,8BAA2B;AAC3B,0BAAuB;AAEvB,2DAAwD;AACxD,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,8CAA2C;AAE3C,gEAA6D;AAC7D,+DAA4D;AAC5D,+DAA4D;AAE5D,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAE5C,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import '../BillingAddressCard/index';\nimport '../AttributeCard/index';\nimport '../AttributeForm/index';\nimport '../CustomFieldForm/index';\nimport '../CustomFieldCard/index';\nimport '../CopyToClipboard/index';\nimport '../NucleonElement/index';\nimport '../ShipmentCard/index';\nimport '../PaymentCard/index';\nimport '../WebhookCard/index';\nimport '../WebhookForm/index';\nimport '../AddressForm/index';\nimport '../ItemCard/index';\nimport '../ItemForm/index';\nimport '../I18n/index';\n\nimport '../../internal/InternalPostActionControl/index';\nimport '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalSwitchControl/index';\nimport '../../internal/InternalForm/index';\n\nimport './internal/InternalTransactionCustomerControl/index';\nimport './internal/InternalTransactionActionsControl/index';\nimport './internal/InternalTransactionSummaryControl/index';\n\nimport { Transaction } from './Transaction';\n\ncustomElements.define('foxy-transaction', Transaction);\n\nexport { Transaction };\n"]}
|
|
@@ -34,47 +34,49 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
34
34
|
__renderSendEmailsAction() {
|
|
35
35
|
var _a, _b;
|
|
36
36
|
return html `
|
|
37
|
-
<foxy-internal-
|
|
37
|
+
<foxy-internal-post-action-control
|
|
38
38
|
infer="send-emails"
|
|
39
|
+
theme="tertiary-inline"
|
|
39
40
|
href=${ifDefined((_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:send_emails'].href)}
|
|
40
|
-
@
|
|
41
|
+
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
41
42
|
>
|
|
42
|
-
</foxy-internal-
|
|
43
|
+
</foxy-internal-post-action-control>
|
|
43
44
|
`;
|
|
44
45
|
}
|
|
45
46
|
__renderCaptureAction() {
|
|
46
47
|
var _a, _b;
|
|
47
48
|
return html `
|
|
48
|
-
<foxy-internal-
|
|
49
|
-
theme="success"
|
|
49
|
+
<foxy-internal-post-action-control
|
|
50
|
+
theme="tertiary-inline success"
|
|
50
51
|
infer="capture"
|
|
51
52
|
href=${ifDefined((_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:capture'].href)}
|
|
52
|
-
@
|
|
53
|
+
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
53
54
|
>
|
|
54
|
-
</foxy-internal-
|
|
55
|
+
</foxy-internal-post-action-control>
|
|
55
56
|
`;
|
|
56
57
|
}
|
|
57
58
|
__renderVoidAction() {
|
|
58
59
|
var _a, _b, _c;
|
|
59
60
|
return html `
|
|
60
|
-
<foxy-internal-
|
|
61
|
-
theme="error"
|
|
61
|
+
<foxy-internal-post-action-control
|
|
62
|
+
theme="tertiary-inline error"
|
|
62
63
|
infer="void"
|
|
63
64
|
href=${ifDefined((_c = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:void']) === null || _c === void 0 ? void 0 : _c.href)}
|
|
64
|
-
@
|
|
65
|
+
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
65
66
|
>
|
|
66
|
-
</foxy-internal-
|
|
67
|
+
</foxy-internal-post-action-control>
|
|
67
68
|
`;
|
|
68
69
|
}
|
|
69
70
|
__renderRefundAction() {
|
|
70
71
|
var _a, _b, _c;
|
|
71
72
|
return html `
|
|
72
|
-
<foxy-internal-
|
|
73
|
+
<foxy-internal-post-action-control
|
|
73
74
|
infer="refund"
|
|
75
|
+
theme="tertiary-inline"
|
|
74
76
|
href=${ifDefined((_c = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:refund']) === null || _c === void 0 ? void 0 : _c.href)}
|
|
75
|
-
@
|
|
77
|
+
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
76
78
|
>
|
|
77
|
-
</foxy-internal-
|
|
79
|
+
</foxy-internal-post-action-control>
|
|
78
80
|
`;
|
|
79
81
|
}
|
|
80
82
|
__renderSubscriptionAction() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gEAA6D;AAGvF,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IACpE,aAAa;;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,OAA6B,CAAC;QAEhD,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,GAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC1E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,gBAAgB,GAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE;UACnF,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,iBAAiB,GAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC,EAAE;UACtF,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;;;;sBAIhE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;mBACjD,GAAG,EAAE;YACZ,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,EAAE,gBAAgB,EAAE,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,gBAAgB,CAAA,EAAE,EAAE;YAC/D,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,GAAG;QACjB,CAAC;;;;2BAIgB,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,gBAAgB,EAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;;;;;KAK3E,CAAC;IACJ,CAAC;IAEO,wBAAwB;;QAC9B,OAAO,IAAI,CAAA
|
|
1
|
+
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,gEAA6D;AAGvF,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IACpE,aAAa;;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,OAA6B,CAAC;QAEhD,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,GAAE,CAAC,CAAC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AAE,MAAM,CAAC,YAAY,2CAAG,IAAI,CAAC;;;;KAI3D,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { html, TemplateResult } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { Transaction } from '../../Transaction';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n renderControl(): TemplateResult {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <div class=\"flex flex-wrap gap-x-m gap-y-xs\">\n ${this.nucleon?.data?._links['fx:capture'] ? this.__renderCaptureAction() : ''}\n ${this.nucleon?.data?._links['fx:void'] ? this.__renderVoidAction() : ''}\n ${this.nucleon?.data?._links['fx:refund'] ? this.__renderRefundAction() : ''}\n ${this.nucleon?.data?._links['fx:send_emails'] ? this.__renderSendEmailsAction() : ''}\n ${this.nucleon?.data?._links['fx:subscription'] ? this.__renderSubscriptionAction() : ''}\n ${this.nucleon?.data?._links['fx:receipt'] ? this.__renderReceiptAction() : ''}\n\n <vaadin-button\n theme=\"tertiary-inline\"\n ?disabled=${this.disabledSelector.matches('archive', true)}\n @click=${() => {\n host?.edit({ hide_transaction: !host?.form.hide_transaction });\n host?.submit();\n }}\n >\n <foxy-i18n\n infer=\"archive\"\n key=\"caption_${host?.form.hide_transaction ? 'unarchive' : 'archive'}\"\n >\n </foxy-i18n>\n </vaadin-button>\n </div>\n `;\n }\n\n private __renderSendEmailsAction() {\n return html`\n <foxy-internal-post-action-control\n infer=\"send-emails\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:send_emails'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderCaptureAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline success\"\n infer=\"capture\"\n href=${ifDefined(this.nucleon?.data?._links['fx:capture'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderVoidAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline error\"\n infer=\"void\"\n href=${ifDefined(this.nucleon?.data?._links['fx:void']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderRefundAction() {\n return html`\n <foxy-internal-post-action-control\n infer=\"refund\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:refund']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderSubscriptionAction() {\n const host = this.nucleon as Transaction | null;\n const subHref = host?.data?._links['fx:subscription']?.href;\n const subPageHref = subHref ? host?.getSubscriptionPageHref?.(subHref) : void 0;\n\n return html`\n <a\n class=\"rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${ifDefined(subPageHref)}\n >\n <foxy-i18n infer=\"subscription\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderReceiptAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <a\n target=\"_blank\"\n class=\"rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${ifDefined(host?.data?._links['fx:receipt']?.href)}\n >\n <foxy-i18n infer=\"receipt\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n}\n"]}
|
package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@vaadin/vaadin-button';
|
|
2
|
+
import '../../../../internal/InternalPostActionControl/index';
|
|
2
3
|
import '../../../../internal/InternalControl/index';
|
|
3
4
|
import '../../../I18n/index';
|
|
4
|
-
import '../InternalTransactionPostActionControl/index';
|
|
5
5
|
import { InternalTransactionActionsControl as Control } from './InternalTransactionActionsControl';
|
|
6
6
|
export { Control as InternalTransactionActionsControl };
|
package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@vaadin/vaadin-button';
|
|
2
|
+
import "../../../../internal/InternalPostActionControl/index.js";
|
|
2
3
|
import "../../../../internal/InternalControl/index.js";
|
|
3
4
|
import "../../../I18n/index.js";
|
|
4
|
-
import "../InternalTransactionPostActionControl/index.js";
|
|
5
5
|
import { InternalTransactionActionsControl as Control } from "./InternalTransactionActionsControl.js";
|
|
6
6
|
customElements.define('foxy-internal-transaction-actions-control', Control);
|
|
7
7
|
export { Control as InternalTransactionActionsControl };
|
package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,uDAAoD;AACpD,gCAA6B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,iEAA8D;AAC9D,uDAAoD;AACpD,gCAA6B;AAE7B,OAAO,EAAE,iCAAiC,IAAI,OAAO,EAAE,+CAA4C;AAEnG,cAAc,CAAC,MAAM,CAAC,2CAA2C,EAAE,OAAO,CAAC,CAAC;AAE5E,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-button';\nimport '../../../../internal/InternalPostActionControl/index';\nimport '../../../../internal/InternalControl/index';\nimport '../../../I18n/index';\n\nimport { InternalTransactionActionsControl as Control } from './InternalTransactionActionsControl';\n\ncustomElements.define('foxy-internal-transaction-actions-control', Control);\n\nexport { Control as InternalTransactionActionsControl };\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./shared-8ef0ca65.js";import"./shared-4d32d19e.js";import{_ as t}from"./shared-cb58dfcd.js";import{h as e}from"./shared-ba5c42c7.js";import{D as s}from"./shared-048d5cae.js";let i,n=t=>t;customElements.define("foxy-internal-confirm-dialog",class extends s{constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.alert=!0,this.confirm="confirm",this.message="message",this.cancel="cancel",this.theme="primary"}static get properties(){return t(t({},super.properties),{},{confirm:{type:String},message:{type:String},cancel:{type:String},theme:{type:String}})}render(){return super.render((()=>e(i||(i=n` <foxy-i18n class="block font-lumo text-m text-body text-center mb-m" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <div class="grid grid-cols-2 gap-m"> <vaadin-button data-testid="cancelButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> <vaadin-button theme="${0}" data-testid="confirmButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> </div> `),this.lang,this.message,this.ns,this.__handleCancel,this.ns,this.lang,this.cancel,this.theme,this.__handleConfirm,this.ns,this.lang,this.confirm)))}async __handleCancel(){await this.hide(!0)}async __handleConfirm(){await this.hide()}});
|