@foxy.io/elements 1.29.0 → 1.30.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-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-cancellation-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-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.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-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-donation.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-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-i18n-editor.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 +3 -3
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.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-sign-in-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-card.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-card.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-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-cfb33387.js → shared-01f18104.js} +1 -1
- package/dist/cdn/{shared-3483c729.js → shared-09fc6fa0.js} +1 -1
- package/dist/cdn/{shared-8bb3eb45.js → shared-1729e19a.js} +1 -1
- package/dist/cdn/{shared-fe4a2e3d.js → shared-19f46691.js} +1 -1
- package/dist/cdn/{shared-38f0bda5.js → shared-2bd96ec7.js} +2 -2
- package/dist/cdn/{shared-a97c3129.js → shared-2d75f154.js} +1 -1
- package/dist/cdn/{shared-8526ed32.js → shared-3b975a29.js} +1 -1
- package/dist/cdn/{shared-ae00ce7c.js → shared-3cf043a7.js} +1 -1
- package/dist/cdn/{shared-0ad0fb9f.js → shared-41e7554e.js} +1 -1
- package/dist/cdn/{shared-ee2cda29.js → shared-471e77dd.js} +1 -1
- package/dist/cdn/{shared-1467a889.js → shared-476827c7.js} +1 -1
- package/dist/cdn/{shared-75331d5e.js → shared-4a652d60.js} +1 -1
- package/dist/cdn/{shared-22ba950a.js → shared-4d172731.js} +1 -1
- package/dist/cdn/{shared-70747a5c.js → shared-5721fb53.js} +1 -1
- package/dist/cdn/{shared-376784f0.js → shared-5bc86d84.js} +1 -1
- package/dist/cdn/shared-6d11abd7.js +280 -0
- package/dist/cdn/{shared-13203be0.js → shared-6f4fa343.js} +1 -1
- package/dist/cdn/{shared-f21254a3.js → shared-6f877b15.js} +1 -1
- package/dist/cdn/{shared-d0e4d7b1.js → shared-73045804.js} +1 -1
- package/dist/cdn/{shared-f4abc29a.js → shared-787e8da4.js} +1 -1
- package/dist/cdn/{shared-9a22d597.js → shared-7dd710e4.js} +1 -1
- package/dist/cdn/{shared-970d98db.js → shared-8fbebf38.js} +1 -1
- package/dist/cdn/{shared-cc808e01.js → shared-9637a2de.js} +1 -1
- package/dist/cdn/{shared-dfc47fd9.js → shared-96a392d9.js} +1 -1
- package/dist/cdn/{shared-4f183419.js → shared-97514fcb.js} +1 -1
- package/dist/cdn/{shared-c9845b4a.js → shared-9bf7d9a7.js} +1 -1
- package/dist/cdn/{shared-421a3ced.js → shared-a0efdc94.js} +1 -1
- package/dist/cdn/{shared-32e92c3b.js → shared-a8233033.js} +1 -1
- package/dist/cdn/{shared-edae6816.js → shared-ad76e640.js} +1 -1
- package/dist/cdn/{shared-6a8a40cc.js → shared-b38762ef.js} +1 -1
- package/dist/cdn/{shared-ce0465c6.js → shared-b980ba1d.js} +1 -1
- package/dist/cdn/{shared-afd7214a.js → shared-cb3b9d8b.js} +1 -1
- package/dist/cdn/{shared-ecf479f2.js → shared-d5ff9121.js} +1 -1
- package/dist/cdn/{shared-1ecfa77b.js → shared-deff3eda.js} +1 -1
- package/dist/cdn/{shared-301a779e.js → shared-e47bd38e.js} +1 -1
- package/dist/cdn/{shared-dbda59a0.js → shared-e5098b19.js} +1 -1
- package/dist/cdn/{shared-19768452.js → shared-e7bff5de.js} +1 -1
- package/dist/cdn/{shared-e4870c47.js → shared-ea5ff8bc.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +108 -0
- package/dist/cdn/translations/coupon-form/en.json +103 -50
- package/dist/cdn/translations/transaction/en.json +108 -0
- package/dist/cdn/translations/webhook-card/en.json +5 -1
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +9 -2
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +150 -32
- package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/index.d.ts +3 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js +3 -0
- package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
- package/dist/elements/internal/InternalAsyncListControl/styles.d.ts +1 -0
- package/dist/elements/internal/InternalAsyncListControl/styles.js +12 -0
- package/dist/elements/internal/InternalAsyncListControl/styles.js.map +1 -0
- package/dist/elements/internal/InternalAsyncListControl/types.d.ts +5 -1
- package/dist/elements/internal/InternalAsyncListControl/types.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.d.ts +0 -3
- package/dist/elements/public/CouponForm/CouponForm.js +56 -76
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/CouponForm/index.d.ts +2 -2
- package/dist/elements/public/CouponForm/index.js +2 -2
- package/dist/elements/public/CouponForm/index.js.map +1 -1
- package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.d.ts +2 -0
- package/dist/elements/public/Transaction/Transaction.js +114 -19
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +6 -0
- package/dist/elements/public/Transaction/index.js +6 -0
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/dist/elements/public/WebhookCard/WebhookCard.d.ts +8 -0
- package/dist/elements/public/WebhookCard/WebhookCard.js +73 -6
- package/dist/elements/public/WebhookCard/WebhookCard.js.map +1 -1
- package/dist/elements/public/WebhookCard/index.d.ts +2 -0
- package/dist/elements/public/WebhookCard/index.js +2 -0
- package/dist/elements/public/WebhookCard/index.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.d.ts +7 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js +40 -4
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-ba7354fa.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftCardForm.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftCardForm/GiftCardForm.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,IAAI,EAAE,iCAA8B;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,UAAU,EAAE,wBAAqB;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,EAAE,GAAG,gBAAgB,CAAC;AAC5B,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAU;IAA5C;;QAsCE,8DAA8D;QAC9D,oBAAe,GAAoC,EAAE,CAAC,EAAE;YACtD,OAAO,sCAAsC,EAAE,EAAE,CAAC;QACpD,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AAM,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 { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Action } from '../../internal/InternalAsyncListControl/types';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { Option, Type } from '../QueryBuilder/types';\nimport { html } from 'lit-element';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { currencies } from './currencies';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'gift-card-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing gift cards (`fx:gift_card`).\n *\n * @element foxy-gift-card-form\n * @since 1.15.0\n */\nexport class GiftCardForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getCustomerHref: { attribute: false },\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\n form => {\n if (form.provisioning_config?.allow_autoprovisioning) {\n if (!form.sku) return 'sku:v8n_required';\n if (form.sku.length > 200) return 'sku:v8n_too_long';\n }\n\n return true;\n },\n\n form => {\n const v = form.provisioning_config?.initial_balance_min;\n return typeof v === 'number' && v < 0 ? 'min-balance:v8n_negative' : true;\n },\n\n form => {\n const v = form.provisioning_config?.initial_balance_max;\n return typeof v === 'number' && v < 0 ? 'max-balance:v8n_negative' : true;\n },\n\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ];\n }\n\n /** Returns a `fx:customer` Resource URL for a Customer ID. */\n getCustomerHref: (id: number | string) => string = id => {\n return `https://api.foxycart.com/customers/${id}`;\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 __currencyCodeGetValue = () => {\n return this.form.currency_code?.toLowerCase();\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'current_balance', path: 'current_balance', type: Type.Number },\n { label: 'end_date', path: 'end_date', type: Type.Date },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __codesActions: Action<Resource<Rels.GiftCardCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__codesActions[0].state = 'busy';\n this.__codesActions = [...this.__codesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__codesActions[0].state = 'end';\n } catch {\n this.__codesActions[0].state = 'error';\n } finally {\n this.__codesActions = [...this.__codesActions];\n setTimeout(() => {\n this.__codesActions[0].state = 'idle';\n this.__codesActions = [...this.__codesActions];\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('codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { 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:gift_card_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:gift_card_codes'].href}\n infer=\"import\"\n form=\"foxy-gift-card-codes-form\"\n .related=${[data._links['fx:gift_card_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:gift_card_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 <div class=\"grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"md-col-span-2\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n property=\"currency_code\"\n infer=\"currency\"\n .getValue=${this.__currencyCodeGetValue}\n .options=${currencies.map(value => ({\n label: this.t(`currency.code_${value}`),\n value,\n }))}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-frequency-control property=\"expires_after\" infer=\"expires\">\n </foxy-internal-frequency-control>\n </div>\n\n <foxy-internal-gift-card-form-provisioning-control infer=\"provisioning\">\n </foxy-internal-gift-card-form-provisioning-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"codes\"\n item=\"foxy-gift-card-code-card\"\n form=\"foxy-gift-card-code-form\"\n alert\n .formProps=${{ '.getCustomerHref': this.getCustomerHref }}\n .actions=${this.__codesActions}\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-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=\"gift_card_uri\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:gift_card_item_categories'].href)}\n embed-key=\"fx:gift_card_item_categories\"\n own-uri=${ifDefined(this.data?._links.self.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-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":"GiftCardForm.js","sourceRoot":"","sources":["../../../../src/elements/public/GiftC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I,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;;;;;;;;uBAQc,SAAS,aAAC,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC;qBACxE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,8BAA8B,EAAE,IAAI,CAAC;;kBAEpE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;gBAQxC,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 { PropertyDeclarations, TemplateResult } from 'lit-element';\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';\nimport type { Data } from './types';\n\nimport { Option, Type } from '../QueryBuilder/types';\nimport { html } from 'lit-element';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { currencies } from './currencies';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst NS = 'gift-card-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing gift cards (`fx:gift_card`).\n *\n * @element foxy-gift-card-form\n * @since 1.15.0\n */\nexport class GiftCardForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getCustomerHref: { attribute: false },\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\n form => {\n if (form.provisioning_config?.allow_autoprovisioning) {\n if (!form.sku) return 'sku:v8n_required';\n if (form.sku.length > 200) return 'sku:v8n_too_long';\n }\n\n return true;\n },\n\n form => {\n const v = form.provisioning_config?.initial_balance_min;\n return typeof v === 'number' && v < 0 ? 'min-balance:v8n_negative' : true;\n },\n\n form => {\n const v = form.provisioning_config?.initial_balance_max;\n return typeof v === 'number' && v < 0 ? 'max-balance:v8n_negative' : true;\n },\n\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ];\n }\n\n /** Returns a `fx:customer` Resource URL for a Customer ID. */\n getCustomerHref: (id: number | string) => string = id => {\n return `https://api.foxycart.com/customers/${id}`;\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 __currencyCodeGetValue = () => {\n return this.form.currency_code?.toLowerCase();\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'current_balance', path: 'current_balance', type: Type.Number },\n { label: 'end_date', path: 'end_date', type: Type.Date },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __codesActions: SwipeAction<Resource<Rels.GiftCardCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__codesActions[0].state = 'busy';\n this.__codesActions = [...this.__codesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__codesActions[0].state = 'end';\n } catch {\n this.__codesActions[0].state = 'error';\n } finally {\n this.__codesActions = [...this.__codesActions];\n setTimeout(() => {\n this.__codesActions[0].state = 'idle';\n this.__codesActions = [...this.__codesActions];\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('codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { 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:gift_card_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:gift_card_codes'].href}\n infer=\"import\"\n form=\"foxy-gift-card-codes-form\"\n .related=${[data._links['fx:gift_card_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:gift_card_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 <div class=\"grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"md-col-span-2\">\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n property=\"currency_code\"\n infer=\"currency\"\n .getValue=${this.__currencyCodeGetValue}\n .options=${currencies.map(value => ({\n label: this.t(`currency.code_${value}`),\n value,\n }))}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-frequency-control property=\"expires_after\" infer=\"expires\">\n </foxy-internal-frequency-control>\n </div>\n\n <foxy-internal-gift-card-form-provisioning-control infer=\"provisioning\">\n </foxy-internal-gift-card-form-provisioning-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"codes\"\n item=\"foxy-gift-card-code-card\"\n form=\"foxy-gift-card-code-form\"\n alert\n .formProps=${{ '.getCustomerHref': this.getCustomerHref }}\n .actions=${this.__codesActions}\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-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=\"gift_card_uri\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:gift_card_item_categories'].href)}\n embed-key=\"fx:gift_card_item_categories\"\n own-uri=${ifDefined(this.data?._links.self.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-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"]}
|
|
@@ -19,11 +19,13 @@ export declare class Transaction extends Base<Data> {
|
|
|
19
19
|
paymentGatewaysHelper: string | null;
|
|
20
20
|
getSubscriptionPageHref: ((href: string) => string) | null;
|
|
21
21
|
getCustomerPageHref: ((href: string) => string) | null;
|
|
22
|
+
private readonly __webhooksBulkActions;
|
|
22
23
|
get readonlySelector(): BooleanSelector;
|
|
23
24
|
get hiddenSelector(): BooleanSelector;
|
|
24
25
|
get headerSubtitleOptions(): Record<string, unknown>;
|
|
25
26
|
get headerCopyIdValue(): string;
|
|
26
27
|
renderHeaderActions(): TemplateResult;
|
|
27
28
|
renderBody(): TemplateResult;
|
|
29
|
+
private get __storeLoader();
|
|
28
30
|
}
|
|
29
31
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';
|
|
1
2
|
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
2
|
-
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
3
3
|
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
4
4
|
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
5
5
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
@@ -21,6 +21,38 @@ export class Transaction extends Base {
|
|
|
21
21
|
this.paymentGatewaysHelper = null;
|
|
22
22
|
this.getSubscriptionPageHref = null;
|
|
23
23
|
this.getCustomerPageHref = null;
|
|
24
|
+
this.__webhooksBulkActions = [
|
|
25
|
+
{
|
|
26
|
+
name: 'refeed',
|
|
27
|
+
onClick: async (selection) => {
|
|
28
|
+
if (!this.data)
|
|
29
|
+
return;
|
|
30
|
+
// TODO remove ts-expect-error when SDK has the types
|
|
31
|
+
// @ts-expect-error SDK types are incomplete
|
|
32
|
+
const url = this.data._links['fx:send_webhooks'].href;
|
|
33
|
+
const api = new Transaction.API(this);
|
|
34
|
+
const response = await api.fetch(url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),
|
|
38
|
+
event: 'refeed',
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
selection.forEach(hook => {
|
|
42
|
+
Transaction.Rumour('').share({
|
|
43
|
+
related: [
|
|
44
|
+
...selection.map(hook => hook._links['fx:logs'].href),
|
|
45
|
+
...selection.map(hook => hook._links['fx:statuses'].href),
|
|
46
|
+
],
|
|
47
|
+
source: hook._links.self.href,
|
|
48
|
+
data: hook,
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok)
|
|
52
|
+
throw new Error(await response.text());
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
24
56
|
}
|
|
25
57
|
static get properties() {
|
|
26
58
|
return {
|
|
@@ -33,26 +65,46 @@ export class Transaction extends Base {
|
|
|
33
65
|
}
|
|
34
66
|
get readonlySelector() {
|
|
35
67
|
var _a, _b, _c;
|
|
68
|
+
const alwaysMatch = [
|
|
69
|
+
'billing-addresses',
|
|
70
|
+
'datafeed',
|
|
71
|
+
'webhooks:dialog:url',
|
|
72
|
+
super.readonlySelector,
|
|
73
|
+
];
|
|
36
74
|
const isEditable = Boolean((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:void']) !== null && _b !== void 0 ? _b : (_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:refund']);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
if (!isEditable)
|
|
76
|
+
alwaysMatch.push('items', 'attributes', 'custom-fields');
|
|
77
|
+
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
40
78
|
}
|
|
41
79
|
get hiddenSelector() {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
const alwaysMatch = [
|
|
82
|
+
'billing-addresses:dialog:delete',
|
|
83
|
+
'billing-addresses:dialog:timestamps',
|
|
84
|
+
'webhooks:dialog:header:copy-json',
|
|
85
|
+
'webhooks:dialog:header:copy-id',
|
|
86
|
+
'webhooks:dialog:timestamps',
|
|
87
|
+
'webhooks:dialog:name',
|
|
88
|
+
'webhooks:dialog:query',
|
|
89
|
+
'webhooks:dialog:encryption-key',
|
|
90
|
+
'webhooks:dialog:delete',
|
|
91
|
+
super.readonlySelector,
|
|
92
|
+
];
|
|
44
93
|
const type = (_a = this.data) === null || _a === void 0 ? void 0 : _a.type;
|
|
45
94
|
if (!((_b = this.data) === null || _b === void 0 ? void 0 : _b._links['fx:subscription']))
|
|
46
|
-
|
|
95
|
+
alwaysMatch.unshift('subscription');
|
|
47
96
|
if (type === 'subscription_modification')
|
|
48
|
-
|
|
97
|
+
alwaysMatch.unshift('actions');
|
|
49
98
|
if (type === 'updateinfo') {
|
|
50
|
-
|
|
99
|
+
alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');
|
|
51
100
|
}
|
|
52
101
|
if (type === 'subscription_cancellation') {
|
|
53
|
-
|
|
102
|
+
alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');
|
|
54
103
|
}
|
|
55
|
-
|
|
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
|
+
}
|
|
107
|
+
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
56
108
|
}
|
|
57
109
|
get headerSubtitleOptions() {
|
|
58
110
|
var _a, _b, _c, _d, _e;
|
|
@@ -141,39 +193,52 @@ export class Transaction extends Base {
|
|
|
141
193
|
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 : '';
|
|
142
194
|
}
|
|
143
195
|
renderHeaderActions() {
|
|
196
|
+
var _a;
|
|
144
197
|
return html `
|
|
145
198
|
<foxy-internal-transaction-actions-control infer="actions">
|
|
146
199
|
</foxy-internal-transaction-actions-control>
|
|
200
|
+
|
|
201
|
+
<foxy-internal-transaction-post-action-control
|
|
202
|
+
infer="actions resend-datafeed"
|
|
203
|
+
href=${ifDefined((_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:process_webhook'].href)}
|
|
204
|
+
>
|
|
205
|
+
</foxy-internal-transaction-post-action-control>
|
|
147
206
|
`;
|
|
148
207
|
}
|
|
149
208
|
renderBody() {
|
|
150
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
151
210
|
let shipmentsLink = undefined;
|
|
211
|
+
let webhooksLink = undefined;
|
|
152
212
|
let itemsLink = undefined;
|
|
153
213
|
const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];
|
|
154
214
|
const hidden = this.hiddenSelector;
|
|
155
215
|
if (this.data) {
|
|
156
216
|
try {
|
|
157
217
|
const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);
|
|
218
|
+
// TODO: Remove the ts-expect-error comment when SDK has the types
|
|
219
|
+
// @ts-expect-error SDK doesn't have the types
|
|
220
|
+
const webhooksUrl = new URL((_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data._links['fx:webhooks'].href) !== null && _b !== void 0 ? _b : '');
|
|
158
221
|
const itemsUrl = new URL(this.data._links['fx:items'].href);
|
|
159
222
|
shipmentsUrl.searchParams.set('zoom', 'items:item_category');
|
|
223
|
+
webhooksUrl.searchParams.set('event_resource', 'transaction');
|
|
160
224
|
itemsUrl.searchParams.set('zoom', 'item_options');
|
|
161
225
|
shipmentsLink = shipmentsUrl.toString();
|
|
226
|
+
webhooksLink = webhooksUrl.toString();
|
|
162
227
|
itemsLink = itemsUrl.toString();
|
|
163
228
|
}
|
|
164
|
-
catch (
|
|
229
|
+
catch (_l) {
|
|
165
230
|
//
|
|
166
231
|
}
|
|
167
232
|
}
|
|
168
233
|
return html `
|
|
169
234
|
${this.renderHeader()}
|
|
170
|
-
${alertStatuses.includes((
|
|
235
|
+
${alertStatuses.includes((_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : '')
|
|
171
236
|
? html `
|
|
172
237
|
<p
|
|
173
238
|
class="leading-xs text-body rounded bg-error-10 block"
|
|
174
239
|
style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
175
240
|
>
|
|
176
|
-
<foxy-i18n infer="header" key="alert_status_${(
|
|
241
|
+
<foxy-i18n infer="header" key="alert_status_${(_e = this.data) === null || _e === void 0 ? void 0 : _e.status}"></foxy-i18n>
|
|
177
242
|
</p>
|
|
178
243
|
`
|
|
179
244
|
: ''}
|
|
@@ -203,7 +268,7 @@ export class Transaction extends Base {
|
|
|
203
268
|
|
|
204
269
|
<foxy-internal-async-list-control
|
|
205
270
|
infer="billing-addresses"
|
|
206
|
-
first=${ifDefined((
|
|
271
|
+
first=${ifDefined((_f = this.data) === null || _f === void 0 ? void 0 : _f._links['fx:billing_addresses'].href)}
|
|
207
272
|
item="foxy-billing-address-card"
|
|
208
273
|
form="foxy-address-form"
|
|
209
274
|
hide-create-button
|
|
@@ -214,7 +279,7 @@ export class Transaction extends Base {
|
|
|
214
279
|
|
|
215
280
|
<foxy-internal-async-list-control
|
|
216
281
|
infer="payments"
|
|
217
|
-
first=${ifDefined((
|
|
282
|
+
first=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g._links['fx:payments'].href)}
|
|
218
283
|
item="foxy-payment-card"
|
|
219
284
|
.itemProps=${{
|
|
220
285
|
'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,
|
|
@@ -230,7 +295,7 @@ export class Transaction extends Base {
|
|
|
230
295
|
<foxy-internal-async-list-control
|
|
231
296
|
infer="custom-fields"
|
|
232
297
|
class="min-w-0"
|
|
233
|
-
first=${ifDefined((
|
|
298
|
+
first=${ifDefined((_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:custom_fields'].href)}
|
|
234
299
|
limit="5"
|
|
235
300
|
form="foxy-custom-field-form"
|
|
236
301
|
item="foxy-custom-field-card"
|
|
@@ -241,7 +306,7 @@ export class Transaction extends Base {
|
|
|
241
306
|
<foxy-internal-async-list-control
|
|
242
307
|
infer="attributes"
|
|
243
308
|
class="min-w-0"
|
|
244
|
-
first=${ifDefined((
|
|
309
|
+
first=${ifDefined((_j = this.data) === null || _j === void 0 ? void 0 : _j._links['fx:attributes'].href)}
|
|
245
310
|
limit="5"
|
|
246
311
|
form="foxy-attribute-form"
|
|
247
312
|
item="foxy-attribute-card"
|
|
@@ -256,7 +321,37 @@ export class Transaction extends Base {
|
|
|
256
321
|
item="foxy-shipment-card"
|
|
257
322
|
>
|
|
258
323
|
</foxy-internal-async-list-control>
|
|
324
|
+
|
|
325
|
+
<foxy-internal-async-list-control
|
|
326
|
+
infer="webhooks"
|
|
327
|
+
first=${ifDefined(webhooksLink)}
|
|
328
|
+
item="foxy-webhook-card"
|
|
329
|
+
form="foxy-webhook-form"
|
|
330
|
+
hide-create-button
|
|
331
|
+
hide-delete-button
|
|
332
|
+
alert
|
|
333
|
+
.bulkActions=${this.__webhooksBulkActions}
|
|
334
|
+
.itemProps=${{ 'resource-uri': this.href }}
|
|
335
|
+
.formProps=${{ 'resource-uri': this.href }}
|
|
336
|
+
>
|
|
337
|
+
</foxy-internal-async-list-control>
|
|
338
|
+
|
|
339
|
+
<foxy-internal-summary-control infer="datafeed">
|
|
340
|
+
<foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control>
|
|
341
|
+
</foxy-internal-summary-control>
|
|
342
|
+
|
|
343
|
+
<foxy-nucleon
|
|
344
|
+
class="hidden"
|
|
345
|
+
infer=""
|
|
346
|
+
href=${ifDefined((_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:store'].href)}
|
|
347
|
+
id="storeLoader"
|
|
348
|
+
@update=${() => this.requestUpdate()}
|
|
349
|
+
>
|
|
350
|
+
</foxy-nucleon>
|
|
259
351
|
`;
|
|
260
352
|
}
|
|
353
|
+
get __storeLoader() {
|
|
354
|
+
return this.renderRoot.querySelector('#storeLoader');
|
|
355
|
+
}
|
|
261
356
|
}
|
|
262
357
|
//# sourceMappingURL=Transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,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,eAA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CAAI,EAAE,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAA;;;;;4DAK8C,MAAA,IAAI,CAAC,IAAI,0CAAE,MAAM;;WAElE;YACH,CAAC,CAAC,EAAE;;;;;;;kBAOM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;;;;;kBAKhE,SAAS,CAAC,SAAS,CAAC;;;;;qBAKjB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;gBAUhB,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWzD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC;;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;;;;KAInC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\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 get readonlySelector(): BooleanSelector {\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n return isEditable\n ? new BooleanSelector(`${super.readonlySelector} billing-addresses`)\n : new BooleanSelector(\n `${super.readonlySelector} billing-addresses items attributes custom-fields`\n );\n }\n\n get hiddenSelector(): BooleanSelector {\n const hidden = ['billing-addresses:dialog:delete billing-addresses:dialog:timestamps'];\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) hidden.push('subscription');\n if (type === 'subscription_modification') hidden.push('actions');\n\n if (type === 'updateinfo') {\n hidden.push('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n hidden.push('not=customer,subscription,custom-fields,attributes');\n }\n\n return new BooleanSelector(`${super.hiddenSelector} ${hidden.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 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 itemsUrl = new URL(this.data._links['fx:items'].href);\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n itemsUrl.searchParams.set('zoom', 'item_options');\n shipmentsLink = shipmentsUrl.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 }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAWE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,4BAAuB,GAAsC,IAAI,CAAC;QAElE,wBAAmB,GAAsC,IAAI,CAAC;QAE7C,0BAAqB,GAAG;YACvC;gBACE,IAAI,EAAE,QAAQ;gBACd,O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AAM,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"]}
|
|
@@ -4,13 +4,19 @@ import '../AttributeForm/index';
|
|
|
4
4
|
import '../CustomFieldForm/index';
|
|
5
5
|
import '../CustomFieldCard/index';
|
|
6
6
|
import '../CopyToClipboard/index';
|
|
7
|
+
import '../NucleonElement/index';
|
|
7
8
|
import '../ShipmentCard/index';
|
|
8
9
|
import '../PaymentCard/index';
|
|
10
|
+
import '../WebhookCard/index';
|
|
11
|
+
import '../WebhookForm/index';
|
|
9
12
|
import '../ItemCard/index';
|
|
10
13
|
import '../ItemForm/index';
|
|
11
14
|
import '../I18n/index';
|
|
12
15
|
import '../../internal/InternalAsyncListControl/index';
|
|
16
|
+
import '../../internal/InternalSummaryControl/index';
|
|
17
|
+
import '../../internal/InternalSwitchControl/index';
|
|
13
18
|
import '../../internal/InternalForm/index';
|
|
19
|
+
import './internal/InternalTransactionPostActionControl/index';
|
|
14
20
|
import './internal/InternalTransactionCustomerControl/index';
|
|
15
21
|
import './internal/InternalTransactionActionsControl/index';
|
|
16
22
|
import './internal/InternalTransactionSummaryControl/index';
|
|
@@ -4,13 +4,19 @@ import "../AttributeForm/index.js";
|
|
|
4
4
|
import "../CustomFieldForm/index.js";
|
|
5
5
|
import "../CustomFieldCard/index.js";
|
|
6
6
|
import "../CopyToClipboard/index.js";
|
|
7
|
+
import "../NucleonElement/index.js";
|
|
7
8
|
import "../ShipmentCard/index.js";
|
|
8
9
|
import "../PaymentCard/index.js";
|
|
10
|
+
import "../WebhookCard/index.js";
|
|
11
|
+
import "../WebhookForm/index.js";
|
|
9
12
|
import "../ItemCard/index.js";
|
|
10
13
|
import "../ItemForm/index.js";
|
|
11
14
|
import "../I18n/index.js";
|
|
12
15
|
import "../../internal/InternalAsyncListControl/index.js";
|
|
16
|
+
import "../../internal/InternalSummaryControl/index.js";
|
|
17
|
+
import "../../internal/InternalSwitchControl/index.js";
|
|
13
18
|
import "../../internal/InternalForm/index.js";
|
|
19
|
+
import "./internal/InternalTransactionPostActionControl/index.js";
|
|
14
20
|
import "./internal/InternalTransactionCustomerControl/index.js";
|
|
15
21
|
import "./internal/InternalTransactionActionsControl/index.js";
|
|
16
22
|
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,kCAA+B;AAC/B,iCAA8B;AAC9B,8BAA2B;AAC3B,8BAA2B;AAC3B,0BAAuB;AAEvB,0DAAuD;AACvD,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 '../ShipmentCard/index';\nimport '../PaymentCard/index';\nimport '../ItemCard/index';\nimport '../ItemForm/index';\nimport '../I18n/index';\n\nimport '../../internal/InternalAsyncListControl/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"]}
|
|
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,8BAA2B;AAC3B,8BAA2B;AAC3B,0BAAuB;AAEvB,0DAAuD;AACvD,wDAAqD;AACrD,uDAAoD;AACpD,8CAA2C;AAE3C,kEAA+D;AAC/D,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 '../ItemCard/index';\nimport '../ItemForm/index';\nimport '../I18n/index';\n\nimport '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalSummaryControl/index';\nimport '../../internal/InternalSwitchControl/index';\nimport '../../internal/InternalForm/index';\n\nimport './internal/InternalTransactionPostActionControl/index';\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"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PropertyDeclarations } from 'lit-element';
|
|
1
2
|
import type { TemplateResult } from 'lit-html';
|
|
2
3
|
import type { Data } from './types';
|
|
3
4
|
import { InternalCard } from '../../internal/InternalCard/InternalCard';
|
|
@@ -11,6 +12,13 @@ declare const WebhookCard_base: typeof InternalCard & import("lit-element").Cons
|
|
|
11
12
|
* @since 1.17.0
|
|
12
13
|
*/
|
|
13
14
|
export declare class WebhookCard extends WebhookCard_base<Data> {
|
|
15
|
+
static get properties(): PropertyDeclarations;
|
|
16
|
+
/**
|
|
17
|
+
* Optional URI of a transaction, customer or subscription. When provided,
|
|
18
|
+
* the form will display logs and statuses for that particular resource only.
|
|
19
|
+
*/
|
|
20
|
+
resourceUri: string | null;
|
|
14
21
|
renderBody(): TemplateResult;
|
|
22
|
+
private get __statusesLoader();
|
|
15
23
|
}
|
|
16
24
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
2
|
+
import { getResourceId } from '@foxy.io/sdk/core';
|
|
1
3
|
import { InternalCard } from "../../internal/InternalCard/InternalCard.js";
|
|
4
|
+
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
5
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
2
6
|
import { html } from 'lit-html';
|
|
3
|
-
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
4
7
|
/**
|
|
5
8
|
* Basic card displaying webhook (`fx:webhook`) info.
|
|
6
9
|
*
|
|
@@ -8,17 +11,81 @@ import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
|
8
11
|
* @since 1.17.0
|
|
9
12
|
*/
|
|
10
13
|
export class WebhookCard extends TranslatableMixin(InternalCard, 'webhook-card') {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
/**
|
|
17
|
+
* Optional URI of a transaction, customer or subscription. When provided,
|
|
18
|
+
* the form will display logs and statuses for that particular resource only.
|
|
19
|
+
*/
|
|
20
|
+
this.resourceUri = null;
|
|
21
|
+
}
|
|
22
|
+
static get properties() {
|
|
23
|
+
return {
|
|
24
|
+
...super.properties,
|
|
25
|
+
resourceUri: { attribute: 'resource-uri' },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
11
28
|
renderBody() {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
30
|
+
let statusesLink = undefined;
|
|
31
|
+
try {
|
|
32
|
+
const resourceId = getResourceId((_a = this.resourceUri) !== null && _a !== void 0 ? _a : '');
|
|
33
|
+
const url = new URL((_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b._links['fx:statuses'].href) !== null && _c !== void 0 ? _c : '');
|
|
34
|
+
if (resourceId !== null) {
|
|
35
|
+
url.searchParams.set('resource_id', String(resourceId));
|
|
36
|
+
url.searchParams.set('order', 'date_created desc');
|
|
37
|
+
url.searchParams.set('limit', '1');
|
|
38
|
+
statusesLink = url.toString();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (_k) {
|
|
42
|
+
// ignore
|
|
43
|
+
}
|
|
44
|
+
const statusesLoader = this.__statusesLoader;
|
|
45
|
+
const lastStatus = (_d = statusesLoader === null || statusesLoader === void 0 ? void 0 : statusesLoader.data) === null || _d === void 0 ? void 0 : _d._embedded['fx:webhook_statuses'][0];
|
|
13
46
|
return html `
|
|
14
47
|
<div class="grid grid-cols-1 leading-s -my-xs">
|
|
15
|
-
<p class="
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
48
|
+
<p class="flex items-center gap-s justify-between">
|
|
49
|
+
<span class="text-m truncate text-body font-medium">
|
|
50
|
+
${(_e = this.data) === null || _e === void 0 ? void 0 : _e.name}​
|
|
51
|
+
</span>
|
|
52
|
+
<foxy-i18n
|
|
53
|
+
class=${classMap({
|
|
54
|
+
'text-tertiary': !lastStatus || lastStatus.status === 'pending',
|
|
55
|
+
'text-success': (lastStatus === null || lastStatus === void 0 ? void 0 : lastStatus.status) === 'successful',
|
|
56
|
+
'text-error': (lastStatus === null || lastStatus === void 0 ? void 0 : lastStatus.status) === 'failed',
|
|
57
|
+
'hidden': !(statusesLoader === null || statusesLoader === void 0 ? void 0 : statusesLoader.data),
|
|
58
|
+
'text-s': true,
|
|
59
|
+
})}
|
|
60
|
+
infer=""
|
|
61
|
+
key="status_${(_f = lastStatus === null || lastStatus === void 0 ? void 0 : lastStatus.status) !== null && _f !== void 0 ? _f : 'none'}"
|
|
62
|
+
>
|
|
63
|
+
</foxy-i18n>
|
|
19
64
|
</p>
|
|
65
|
+
|
|
66
|
+
<p class="text-s truncate text-secondary">${(_g = this.data) === null || _g === void 0 ? void 0 : _g.url}​</p>
|
|
67
|
+
|
|
68
|
+
${this.resourceUri === null
|
|
69
|
+
? html `
|
|
70
|
+
<p class="text-s truncate text-tertiary">
|
|
71
|
+
${(_h = this.data) === null || _h === void 0 ? void 0 : _h.format} • ${(_j = this.data) === null || _j === void 0 ? void 0 : _j.event_resource}​
|
|
72
|
+
</p>
|
|
73
|
+
`
|
|
74
|
+
: ''}
|
|
20
75
|
</div>
|
|
76
|
+
|
|
77
|
+
<foxy-nucleon
|
|
78
|
+
class="hidden"
|
|
79
|
+
infer=""
|
|
80
|
+
href=${ifDefined(statusesLink)}
|
|
81
|
+
id="statusesLoader"
|
|
82
|
+
@update=${() => this.requestUpdate()}
|
|
83
|
+
>
|
|
84
|
+
</foxy-nucleon>
|
|
21
85
|
`;
|
|
22
86
|
}
|
|
87
|
+
get __statusesLoader() {
|
|
88
|
+
return this.renderRoot.querySelector('#statusesLoader');
|
|
89
|
+
}
|
|
23
90
|
}
|
|
24
91
|
//# sourceMappingURL=WebhookCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookCard/WebhookCard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebhookCard.js","sourceRoot":"","sources":["../../../../src/elements/public/WebhookCard/WebhookCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB,CAAC,YAAY,EAAE,cAAc,CAAO;IAAtF;;QAQE;;;WAGG;QACH,gBAAW,GAAkB,IAAI,CAAC;IAoEpC,CAAC;IA/EC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE;SAC3C,CAAC;IACJ,CAAC;IAQD,UAAU;;QACR,IAAI,YAAY,GAAuB,SAAS,CAAC;QAEjD,IAAI;YACF,MAAM,UAAU,GAAG,aAAa,OAAC,IAAI,CAAC,WAAW,mCAAI,EAAE,CAAC,CAAC;YACzD,MAAM,GAAG,GAAG,IAAI,GAAG,aAAC,IAAI,CAAC,IAAI,0CAAE,MA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CAAC,IAAI,0CAAE,MAAM,WAAW,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc;;aAE1D;YACH,CAAC,CAAC,EAAE;;;;;;eAMC,SAAS,CAAC,YAAY,CAAC;;kBAEpB,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,gBAAgB;QAE1B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,iBAAiB,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { getResourceId } from '@foxy.io/sdk/core';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { classMap } from '../../../utils/class-map';\nimport { html } from 'lit-html';\n\n/**\n * Basic card displaying webhook (`fx:webhook`) info.\n *\n * @element foxy-webhook-card\n * @since 1.17.0\n */\nexport class WebhookCard extends TranslatableMixin(InternalCard, 'webhook-card')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n resourceUri: { attribute: 'resource-uri' },\n };\n }\n\n /**\n * Optional URI of a transaction, customer or subscription. When provided,\n * the form will display logs and statuses for that particular resource only.\n */\n resourceUri: string | null = null;\n\n renderBody(): TemplateResult {\n let statusesLink: string | undefined = undefined;\n\n try {\n const resourceId = getResourceId(this.resourceUri ?? '');\n const url = new URL(this.data?._links['fx:statuses'].href ?? '');\n\n if (resourceId !== null) {\n url.searchParams.set('resource_id', String(resourceId));\n url.searchParams.set('order', 'date_created desc');\n url.searchParams.set('limit', '1');\n statusesLink = url.toString();\n }\n } catch {\n // ignore\n }\n\n const statusesLoader = this.__statusesLoader;\n const lastStatus = statusesLoader?.data?._embedded['fx:webhook_statuses'][0];\n\n return html`\n <div class=\"grid grid-cols-1 leading-s -my-xs\">\n <p class=\"flex items-center gap-s justify-between\">\n <span class=\"text-m truncate text-body font-medium\">\n ${this.data?.name}​\n </span>\n <foxy-i18n\n class=${classMap({\n 'text-tertiary': !lastStatus || lastStatus.status === 'pending',\n 'text-success': lastStatus?.status === 'successful',\n 'text-error': lastStatus?.status === 'failed',\n 'hidden': !statusesLoader?.data,\n 'text-s': true,\n })}\n infer=\"\"\n key=\"status_${lastStatus?.status ?? 'none'}\"\n >\n </foxy-i18n>\n </p>\n\n <p class=\"text-s truncate text-secondary\">${this.data?.url}​</p>\n\n ${this.resourceUri === null\n ? html`\n <p class=\"text-s truncate text-tertiary\">\n ${this.data?.format} • ${this.data?.event_resource}​\n </p>\n `\n : ''}\n </div>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(statusesLink)}\n id=\"statusesLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __statusesLoader() {\n type Loader = NucleonElement<Resource<Rels.WebhookStatuses>>;\n return this.renderRoot.querySelector<Loader>('#statusesLoader');\n }\n}\n"]}
|