@foxy.io/elements 1.50.0-beta.1 → 1.50.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/shared-bb2b7d41.js +1 -0
- package/dist/cdn/translations/admin-subscription-form/en.json +4 -2
- package/dist/cdn/translations/coupon-form/en.json +1 -1
- package/dist/cdn/translations/customer/en.json +1 -1
- package/dist/cdn/translations/customer-portal/de.json +1 -1
- package/dist/cdn/translations/customer-portal/en.json +1 -1
- package/dist/cdn/translations/customer-portal/sv.json +1 -1
- package/dist/cdn/translations/subscription-form/en.json +1 -1
- package/dist/cdn/translations/transaction/en.json +4 -2
- package/dist/cdn/translations/transaction-card/en.json +1 -1
- package/dist/cdn/translations/user-invitation-form/en.json +10 -1
- package/dist/cdn/translations/webhook-form/en.json +3 -1
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js +1 -0
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +8 -3
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.d.ts +2 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +16 -2
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.d.ts +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js +30 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.d.ts +2 -0
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js +30 -10
- package/dist/elements/public/UserInvitationForm/UserInvitationForm.js.map +1 -1
- package/dist/elements/public/UserInvitationForm/index.d.ts +1 -0
- package/dist/elements/public/UserInvitationForm/index.js +1 -0
- package/dist/elements/public/UserInvitationForm/index.js.map +1 -1
- package/dist/elements/public/WebhookForm/WebhookForm.js +1 -0
- package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
- package/package.json +1 -1
|
@@ -920,6 +920,8 @@
|
|
|
920
920
|
"total_tax": "Tax",
|
|
921
921
|
"subtotal": "Subtotal",
|
|
922
922
|
"total": "Total",
|
|
923
|
+
"refundable_amount": "Refundable",
|
|
924
|
+
"refundable_amount_note": "The amount that can be refunded is different from the order total above because this transaction has been modified",
|
|
923
925
|
"price": "{{amount, price}}",
|
|
924
926
|
"status_capturing": "Capturing",
|
|
925
927
|
"status_captured": "Captured",
|
|
@@ -928,7 +930,7 @@
|
|
|
928
930
|
"status_pending": "Pending",
|
|
929
931
|
"status_completed": "Completed",
|
|
930
932
|
"status_problem": "Problem",
|
|
931
|
-
"status_pending_fraud_review": "
|
|
933
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
932
934
|
"status_rejected": "Rejected",
|
|
933
935
|
"status_declined": "Declined",
|
|
934
936
|
"status_refunding": "Refunding",
|
|
@@ -1740,7 +1742,7 @@
|
|
|
1740
1742
|
"button": "Void"
|
|
1741
1743
|
},
|
|
1742
1744
|
"refund": {
|
|
1743
|
-
"message_idle": "This action will attempt to refund the
|
|
1745
|
+
"message_idle": "This action will attempt to refund {{ amount, price }} to the payment method used in this transaction. Would you like to proceed?",
|
|
1744
1746
|
"message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
|
|
1745
1747
|
"message_done": "Transaction was refunded successfully. You can close this dialog now.",
|
|
1746
1748
|
"button_close": "Close",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"status_pending": "Pending",
|
|
14
14
|
"status_completed": "Completed",
|
|
15
15
|
"status_problem": "Problem",
|
|
16
|
-
"status_pending_fraud_review": "
|
|
16
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
17
17
|
"status_rejected": "Rejected",
|
|
18
18
|
"status_declined": "Declined",
|
|
19
19
|
"status_refunding": "Refunding",
|
|
@@ -32,7 +32,16 @@
|
|
|
32
32
|
"revoke": {
|
|
33
33
|
"idle": "Revoke access",
|
|
34
34
|
"busy": "Revoking...",
|
|
35
|
-
"fail": "Failed to revoke"
|
|
35
|
+
"fail": "Failed to revoke",
|
|
36
|
+
"message_idle": "You are about to remove your own access to {{ store_name }} ({{ store_domain }}). Are you sure you want to proceed? If you need access to this store again in the future, you will need to be re-invited by another user of the store.",
|
|
37
|
+
"message_fail": "Failed to revoke access. If you'd like to retry, close this dialog and click the revoke button again.",
|
|
38
|
+
"message_done": "Your access was revoked successfully. Close this dialog to continue.",
|
|
39
|
+
"button_close": "Close",
|
|
40
|
+
"button_confirm": "Leave this store",
|
|
41
|
+
"button_cancel": "Cancel",
|
|
42
|
+
"loading_busy": "Processing",
|
|
43
|
+
"header": "Confirmation Required",
|
|
44
|
+
"button": "Revoke access"
|
|
36
45
|
},
|
|
37
46
|
"resend": {
|
|
38
47
|
"idle": "Resend invitation",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"subtitle_transaction_log": "Transaction log webhook",
|
|
10
10
|
"subtitle_subscription": "Subscription webhook",
|
|
11
11
|
"subtitle_customer": "Customer webhook",
|
|
12
|
+
"subtitle_changelog": "Changelog webhook",
|
|
12
13
|
"copy-id": {
|
|
13
14
|
"failed_to_copy": "Failed to copy",
|
|
14
15
|
"click_to_copy": "Copy ID",
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"event_resource_transaction_log": "Transaction log",
|
|
51
52
|
"event_resource_subscription": "Subscription",
|
|
52
53
|
"event_resource_transaction": "Transaction",
|
|
53
|
-
"event_resource_customer": "Customer"
|
|
54
|
+
"event_resource_customer": "Customer",
|
|
55
|
+
"event_resource_changelog": "Changelog"
|
|
54
56
|
},
|
|
55
57
|
"url": {
|
|
56
58
|
"label": "Endpoint",
|
|
@@ -32,6 +32,7 @@ export class InternalPostActionControl extends InternalControl {
|
|
|
32
32
|
|
|
33
33
|
<vaadin-button
|
|
34
34
|
theme=${ifDefined((_b = this.theme) !== null && _b !== void 0 ? _b : void 0)}
|
|
35
|
+
class="w-full"
|
|
35
36
|
?disabled=${this.disabled || this.readonly}
|
|
36
37
|
@click=${(evt) => {
|
|
37
38
|
const button = evt.currentTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAA9D;;QAUE,mBAAc,GAA2B,EAAE,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAA9D;;QAUE,mBAAc,GAA2B,EAAE,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;IA+B7B,CAAC;IA5CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC9D,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE;SACT,CAAC;IACJ,CAAC;IAQD,aAAa;;QACX,OAAO,IAAI,CAAA;;0BAEW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC;;eAE9C,SAAS,OAAC,IAAI,CAAC,IAAI,mCAAI,KAAK,CAAC,CAAC;gBAC7B,CAAC,GAAoB,EAAE,EAAE;YAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS;gBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5E,CAAC;;;;;gBAKO,SAAS,OAAC,IAAI,CAAC,KAAK,mCAAI,KAAK,CAAC,CAAC;;oBAE3B,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;iBACjC,CAAC,GAAgB,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,aAA8B,CAAC;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAC1C,0CAA0C,CAC3C,CAAC;YAEF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,MAAM,EAAE;QACvB,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog/InternalConfirmDialog';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n theme: {},\n href: {},\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n theme: string | null = null;\n\n href: string | null = null;\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-post-action-control-dialog\n message-options=${JSON.stringify(this.messageOptions)}\n infer=\"\"\n href=${ifDefined(this.href ?? void 0)}\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.dispatchEvent(new CustomEvent('success'));\n }}\n >\n </foxy-internal-post-action-control-dialog>\n\n <vaadin-button\n theme=${ifDefined(this.theme ?? void 0)}\n class=\"w-full\"\n ?disabled=${this.disabled || this.readonly}\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as ButtonElement;\n const dialog = this.renderRoot.querySelector<InternalConfirmDialog>(\n 'foxy-internal-post-action-control-dialog'\n );\n\n dialog?.show(button);\n }}\n >\n <foxy-i18n infer=\"\" key=\"button\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n}\n"]}
|
|
@@ -224,10 +224,15 @@ export class Transaction extends Base {
|
|
|
224
224
|
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 : '';
|
|
225
225
|
}
|
|
226
226
|
renderHeaderActions() {
|
|
227
|
-
var _a
|
|
228
|
-
const
|
|
227
|
+
var _a;
|
|
228
|
+
const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
|
|
229
|
+
const foldersHref = store === null || store === void 0 ? void 0 : store._links['fx:transaction_folders'].href;
|
|
229
230
|
return html `
|
|
230
|
-
<foxy-internal-transaction-actions-control
|
|
231
|
+
<foxy-internal-transaction-actions-control
|
|
232
|
+
currency-display=${(store === null || store === void 0 ? void 0 : store.use_international_currency_symbol) ? 'code' : 'symbol'}
|
|
233
|
+
folders=${ifDefined(foldersHref)}
|
|
234
|
+
infer="actions"
|
|
235
|
+
>
|
|
231
236
|
</foxy-internal-transaction-actions-control>
|
|
232
237
|
`;
|
|
233
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAOA,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,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,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;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,6EAA6E;QAC7E,gBAAW,GAAkB,IAAI,CAAC;QAElC,4BAAuB,GAAsC,IAAI,CAAC;QAElE,wBAAmB,GAAsC,IAAI,CAAC;QAE7C,0BAAqB,GAAG;YACvC;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,KAAK,EAAE,SAAmC,EAAE,EAAE;oBACrD,IAAI,CAAC,IAAI,CAAC,IAAI;wBAAE,OAAO;oBAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC;oBACtD,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACtC,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,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AC;;;;;;;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;;;;;;;;;iBASjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;qBACpD,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;;;;;;;;eAQ1B,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 { Badge } from '../../internal/InternalForm/types';\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, svg } 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(): Badge[] {\n const badges = super.headerSubtitleBadges;\n const folder = this.data?._embedded?.['fx:folder'];\n\n if (folder?.name) {\n const folderColor = folder.color ?? '';\n const colors: Record<string, string> = {\n 'red': 'bg-folder-red text-white',\n 'red_pale': 'bg-folder-red-pale text-black',\n 'green': 'bg-folder-green text-white',\n 'green_pale': 'bg-folder-green-pale text-black',\n 'blue': 'bg-folder-blue text-white',\n 'blue_pale': 'bg-folder-blue-pale text-black',\n 'orange': 'bg-folder-orange text-white',\n 'orange_pale': 'bg-folder-orange-pale text-black',\n 'violet': 'bg-folder-violet text-white',\n 'violet_pale': 'bg-folder-violet-pale text-black',\n '': 'bg-contrast-5 text-body',\n };\n\n badges.push({\n class: colors[folderColor in colors ? folderColor : ''],\n icon: svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em;\"><path d=\"M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z\" /></svg>`,\n text: folder.name,\n });\n }\n\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n if (this.data?.is_test) badges.push({ key: 'test' });\n\n return badges;\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n const foldersHref = this.__storeLoader?.data?._links['fx:transaction_folders'].href;\n\n return html`\n <foxy-internal-transaction-actions-control folders=${ifDefined(foldersHref)} 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"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAOA,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,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,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;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,6EAA6E;QAC7E,gBAAW,GAAkB,IAAI,CAAC;QAElC,4BAAuB,GAAsC,IAAI,CAAC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{ NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Badge } from '../../internal/InternalForm/types';\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, svg } 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(): Badge[] {\n const badges = super.headerSubtitleBadges;\n const folder = this.data?._embedded?.['fx:folder'];\n\n if (folder?.name) {\n const folderColor = folder.color ?? '';\n const colors: Record<string, string> = {\n 'red': 'bg-folder-red text-white',\n 'red_pale': 'bg-folder-red-pale text-black',\n 'green': 'bg-folder-green text-white',\n 'green_pale': 'bg-folder-green-pale text-black',\n 'blue': 'bg-folder-blue text-white',\n 'blue_pale': 'bg-folder-blue-pale text-black',\n 'orange': 'bg-folder-orange text-white',\n 'orange_pale': 'bg-folder-orange-pale text-black',\n 'violet': 'bg-folder-violet text-white',\n 'violet_pale': 'bg-folder-violet-pale text-black',\n '': 'bg-contrast-5 text-body',\n };\n\n badges.push({\n class: colors[folderColor in colors ? folderColor : ''],\n icon: svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em;\"><path d=\"M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z\" /></svg>`,\n text: folder.name,\n });\n }\n\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n if (this.data?.is_test) badges.push({ key: 'test' });\n\n return badges;\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n const store = this.__storeLoader?.data;\n const foldersHref = store?._links['fx:transaction_folders'].href;\n\n return html`\n <foxy-internal-transaction-actions-control\n currency-display=${store?.use_international_currency_symbol ? 'code' : 'symbol'}\n folders=${ifDefined(foldersHref)}\n infer=\"actions\"\n >\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"]}
|
|
@@ -2,8 +2,10 @@ import type { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
|
2
2
|
import { InternalControl } from '../../../../internal/InternalControl/InternalControl';
|
|
3
3
|
export declare class InternalTransactionActionsControl extends InternalControl {
|
|
4
4
|
static get properties(): PropertyDeclarations;
|
|
5
|
+
currencyDisplay: string | null;
|
|
5
6
|
folders: string | null;
|
|
6
7
|
renderControl(): TemplateResult;
|
|
8
|
+
private get __refundAmount();
|
|
7
9
|
private __renderSendEmailsAction;
|
|
8
10
|
private __renderCaptureAction;
|
|
9
11
|
private __renderVoidAction;
|
|
@@ -4,11 +4,13 @@ import { html, svg } from 'lit-html';
|
|
|
4
4
|
export class InternalTransactionActionsControl extends InternalControl {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
|
+
this.currencyDisplay = null;
|
|
7
8
|
this.folders = null;
|
|
8
9
|
}
|
|
9
10
|
static get properties() {
|
|
10
11
|
return {
|
|
11
12
|
...super.properties,
|
|
13
|
+
currencyDisplay: { attribute: 'currency-display' },
|
|
12
14
|
folders: {},
|
|
13
15
|
};
|
|
14
16
|
}
|
|
@@ -27,6 +29,13 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
27
29
|
</div>
|
|
28
30
|
`;
|
|
29
31
|
}
|
|
32
|
+
get __refundAmount() {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
const data = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data;
|
|
35
|
+
const originalTotal = (_b = data === null || data === void 0 ? void 0 : data.total_order) !== null && _b !== void 0 ? _b : 0;
|
|
36
|
+
// @ts-expect-error SDK types do not include amount on fx:refund
|
|
37
|
+
return parseFloat((_d = (_c = data === null || data === void 0 ? void 0 : data._links['fx:refund']) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : originalTotal);
|
|
38
|
+
}
|
|
30
39
|
__renderSendEmailsAction() {
|
|
31
40
|
var _a, _b;
|
|
32
41
|
return html `
|
|
@@ -64,12 +73,17 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
64
73
|
`;
|
|
65
74
|
}
|
|
66
75
|
__renderRefundAction() {
|
|
67
|
-
var _a, _b, _c;
|
|
76
|
+
var _a, _b, _c, _d, _e;
|
|
77
|
+
const currencyCode = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currency_code;
|
|
68
78
|
return html `
|
|
69
79
|
<foxy-internal-post-action-control
|
|
80
|
+
message-options=${JSON.stringify({
|
|
81
|
+
currencyDisplay: this.currencyDisplay,
|
|
82
|
+
amount: `${this.__refundAmount} ${currencyCode}`,
|
|
83
|
+
})}
|
|
70
84
|
infer="refund"
|
|
71
85
|
theme="tertiary-inline"
|
|
72
|
-
href=${ifDefined((
|
|
86
|
+
href=${ifDefined((_e = (_d = (_c = this.nucleon) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d._links['fx:refund']) === null || _e === void 0 ? void 0 : _e.href)}
|
|
73
87
|
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
74
88
|
>
|
|
75
89
|
</foxy-internal-post-action-control>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QAQE,YAAO,GAAkB,IAAI,CAAC;IA2KhC,CAAC;IAlLC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAID,aAAa;;QACX,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAA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ACvB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,EAAE,UAAU,EAAG,GAAG,CAAC,aAAmC,CAAC,KAAK,EAAE,EAAE;YAC3E,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,KAAK,EAAE;QACtB,CAAC;;uCAE4B,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,CAAA,cAAc,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,CAAA;cACnF,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;;;YAG9B,OAAO;aACN,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;aAC3C,GAAG,CAAC,MAAM,CAAC,EAAE;YACZ,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3C,MAAM,UAAU,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,MAAK,UAAU,CAAC;YACxD,OAAO,IAAI,CAAA;gCACO,UAAU,cAAc,UAAU,cAAc,UAAU;oBACtE,MAAM,CAAC,IAAI;;eAEhB,CAAC;QACJ,CAAC,CAAC;;;KAGT,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { Transaction } from '../../Transaction';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { Rels } from '@foxy.io/sdk/backend';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n folders: {},\n };\n }\n\n folders: string | null = null;\n\n renderControl(): TemplateResult {\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 ${this.__renderArchiveAction()}\n ${this.folders ? this.__renderFolderSelector(this.folders) : ''}\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 private __renderArchiveAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\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 `;\n }\n\n private __renderFolderSelector(foldersHref: string) {\n type FoldersLoader = NucleonElement<Resource<Rels.StoreTransactionFolders>>;\n\n const foldersLoader = this.renderRoot.querySelector<FoldersLoader>('#foldersLoader');\n const folders = Array.from(foldersLoader?.data?._embedded?.['fx:transaction_folders'] ?? []);\n const host = this.nucleon as Transaction | null;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${foldersHref}\n id=\"foldersLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <label\n class=\"group relative rounded focus-within-ring-2 focus-within-ring-primary-50\"\n ?hidden=${folders.length === 0}\n >\n <span\n class=\"inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80\"\n >\n <foxy-i18n class=\"font-medium text-primary\" infer=\"folder\" key=\"caption\"></foxy-i18n>\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-primary transform scale-125\" style=\"width: 1em; height: 1em\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </span>\n\n <select\n class=\"absolute inset-0 opacity-0 cursor-pointer\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @change=${(evt: Event) => {\n host?.edit({ folder_uri: (evt.currentTarget as HTMLSelectElement).value });\n host?.submit(false);\n }}\n >\n <option value=\"\" ?selected=${!host?.form.folder_uri} ?disabled=${!host?.form.folder_uri}>\n ${this.t('folder.option_none')}\n </option>\n\n ${folders\n .sort((a, b) => a.sort_order - b.sort_order)\n .map(folder => {\n const folderHref = folder._links.self.href;\n const isSelected = host?.form.folder_uri === folderHref;\n return html`\n <option value=${folderHref} ?selected=${isSelected} ?disabled=${isSelected}>\n ${folder.name}\n </option>\n `;\n })}\n </select>\n </label>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAt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,oBAAoB,CAAC;;;YAG9B,OAAO;aACN,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;aAC3C,GAAG,CAAC,MAAM,CAAC,EAAE;YACZ,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3C,MAAM,UAAU,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,MAAK,UAAU,CAAC;YACxD,OAAO,IAAI,CAAA;gCACO,UAAU,cAAc,UAAU,cAAc,UAAU;oBACtE,MAAM,CAAC,IAAI;;eAEhB,CAAC;QACJ,CAAC,CAAC;;;KAGT,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { Transaction } from '../../Transaction';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { Rels } from '@foxy.io/sdk/backend';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currencyDisplay: { attribute: 'currency-display' },\n folders: {},\n };\n }\n\n currencyDisplay: string | null = null;\n\n folders: string | null = null;\n\n renderControl(): TemplateResult {\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 ${this.__renderArchiveAction()}\n ${this.folders ? this.__renderFolderSelector(this.folders) : ''}\n </div>\n `;\n }\n\n private get __refundAmount(): number {\n const data = (this.nucleon as Transaction | null)?.data;\n const originalTotal = data?.total_order ?? 0;\n // @ts-expect-error SDK types do not include amount on fx:refund\n return parseFloat(data?._links['fx:refund']?.amount ?? originalTotal);\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 const currencyCode = (this.nucleon as Transaction | null)?.data?.currency_code;\n\n return html`\n <foxy-internal-post-action-control\n message-options=${JSON.stringify({\n currencyDisplay: this.currencyDisplay,\n amount: `${this.__refundAmount} ${currencyCode}`,\n })}\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 private __renderArchiveAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\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 `;\n }\n\n private __renderFolderSelector(foldersHref: string) {\n type FoldersLoader = NucleonElement<Resource<Rels.StoreTransactionFolders>>;\n\n const foldersLoader = this.renderRoot.querySelector<FoldersLoader>('#foldersLoader');\n const folders = Array.from(foldersLoader?.data?._embedded?.['fx:transaction_folders'] ?? []);\n const host = this.nucleon as Transaction | null;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${foldersHref}\n id=\"foldersLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <label\n class=\"group relative rounded focus-within-ring-2 focus-within-ring-primary-50\"\n ?hidden=${folders.length === 0}\n >\n <span\n class=\"inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80\"\n >\n <foxy-i18n class=\"font-medium text-primary\" infer=\"folder\" key=\"caption\"></foxy-i18n>\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-primary transform scale-125\" style=\"width: 1em; height: 1em\"><path fill-rule=\"evenodd\" d=\"M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z\" clip-rule=\"evenodd\" /></svg>`}\n </span>\n\n <select\n class=\"absolute inset-0 opacity-0 cursor-pointer\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @change=${(evt: Event) => {\n host?.edit({ folder_uri: (evt.currentTarget as HTMLSelectElement).value });\n host?.submit(false);\n }}\n >\n <option value=\"\" ?selected=${!host?.form.folder_uri} ?disabled=${!host?.form.folder_uri}>\n ${this.t('folder.option_none')}\n </option>\n\n ${folders\n .sort((a, b) => a.sort_order - b.sort_order)\n .map(folder => {\n const folderHref = folder._links.self.href;\n const isSelected = host?.form.folder_uri === folderHref;\n return html`\n <option value=${folderHref} ?selected=${isSelected} ?disabled=${isSelected}>\n ${folder.name}\n </option>\n `;\n })}\n </select>\n </label>\n `;\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { InternalControl } from '../../../../internal/InternalControl/InternalCo
|
|
|
3
3
|
export declare class InternalTransactionSummaryControl extends InternalControl {
|
|
4
4
|
private readonly __storeLoaderId;
|
|
5
5
|
renderControl(): TemplateResult;
|
|
6
|
+
private get __refundableAmount();
|
|
6
7
|
private get __storeHref();
|
|
7
8
|
private get __store();
|
|
8
9
|
private __renderPrice;
|
|
@@ -13,6 +13,7 @@ export class InternalTransactionSummaryControl extends InternalControl {
|
|
|
13
13
|
return html ``;
|
|
14
14
|
const taxes = (_c = (_b = data === null || data === void 0 ? void 0 : data._embedded) === null || _b === void 0 ? void 0 : _b['fx:applied_taxes']) !== null && _c !== void 0 ? _c : [];
|
|
15
15
|
const shipments = (_e = (_d = data._embedded) === null || _d === void 0 ? void 0 : _d['fx:shipments']) !== null && _e !== void 0 ? _e : [];
|
|
16
|
+
const refundableAmount = this.__refundableAmount;
|
|
16
17
|
return html `
|
|
17
18
|
<foxy-nucleon
|
|
18
19
|
infer=""
|
|
@@ -80,9 +81,38 @@ export class InternalTransactionSummaryControl extends InternalControl {
|
|
|
80
81
|
${this.__renderPrice(data.total_order)}
|
|
81
82
|
</span>
|
|
82
83
|
</span>
|
|
84
|
+
|
|
85
|
+
${refundableAmount !== data.total_order
|
|
86
|
+
? html `
|
|
87
|
+
<span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span>
|
|
88
|
+
<span class="col-span-2 flex justify-end">
|
|
89
|
+
<span>
|
|
90
|
+
<span class="text-xl font-medium leading-xs">
|
|
91
|
+
<foxy-i18n infer="" key="refundable_amount"></foxy-i18n>:
|
|
92
|
+
${this.__renderPrice(refundableAmount)}
|
|
93
|
+
</span>
|
|
94
|
+
<br />
|
|
95
|
+
<foxy-i18n
|
|
96
|
+
class="inline-block whitespace-normal leading-s text-tertiary"
|
|
97
|
+
style="max-width: 48ch"
|
|
98
|
+
infer=""
|
|
99
|
+
key="refundable_amount_note"
|
|
100
|
+
>
|
|
101
|
+
</foxy-i18n>
|
|
102
|
+
</span>
|
|
103
|
+
</span>
|
|
104
|
+
`
|
|
105
|
+
: ''}
|
|
83
106
|
</p>
|
|
84
107
|
`;
|
|
85
108
|
}
|
|
109
|
+
get __refundableAmount() {
|
|
110
|
+
var _a, _b, _c, _d;
|
|
111
|
+
const data = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data;
|
|
112
|
+
const originalTotal = (_b = data === null || data === void 0 ? void 0 : data.total_order) !== null && _b !== void 0 ? _b : 0;
|
|
113
|
+
// @ts-expect-error SDK types do not include amount on fx:refund
|
|
114
|
+
return parseFloat((_d = (_c = data === null || data === void 0 ? void 0 : data._links['fx:refund']) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : originalTotal);
|
|
115
|
+
}
|
|
86
116
|
get __storeHref() {
|
|
87
117
|
var _a, _b, _c;
|
|
88
118
|
return (_c = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:store']) === null || _c === void 0 ? void 0 : _c.href;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QACmB,oBAAe,GAAG,aAAa,CAAC;IAmInD,CAAC;IAjIC,aAAa;;QACX,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAwB,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEzB,MAAM,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,0CAAG,kBAAkB,oCAAK,EAAE,CAAC;QAC1D,MAAM,SAAS,eAAG,IAAI,CAAC,SAAS,0CAAG,cAAc,oCAAK,EAAE,CAAC;QAEzD,OAAO,IAAI,CAAA;;;eAGA,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;aAC7B,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;;;;;;;gBAS5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAqC,CAAC;;UAEpE,SAAS,CAAC,MAAM,KAAK,CAAC,I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C,CAAC,CAAC,EAAE;;;mBAG3E;YACT,eAAe;YACf,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM;YAC/C,MAAM,EAAE,GAAG,MAAM,IAAI,YAAY,EAAE;SACpC;;;KAGJ,CAAC;IACJ,CAAC;IAEO,cAAc;;QACpB,MAAM,MAAM,GAAG,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,KAAI,WAAW,CAAC;QACzD,IAAI,KAAK,GAAG,EAAE,CAAC;QAEf,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACnF,KAAK,GAAG,4BAA4B,CAAC;SACtC;aAAM,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,WAAW,EAAE;YAC5C,KAAK,GAAG,kCAAkC,CAAC;SAC5C;aAAM,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvF,KAAK,GAAG,8BAA8B,CAAC;SACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}:</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}:</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:gift_card_code_logs']?.map(log => {\n // @ts-expect-error deep zoom is not supported by the SDK types\n const name = log._embedded?.['fx:gift_card']?.name;\n // @ts-expect-error deep zoom is not supported by the SDK types\n const code = log._embedded?.['fx:gift_card_code']?.code;\n\n if (name && code) {\n return html`\n <span data-testclass=\"gift-card-code\">${name} • ${code}:</span>\n <span>${this.__renderPrice(log.balance_adjustment ?? 0, true)}</span>\n `;\n }\n })}\n ${data?._embedded?.['fx:discounts']?.map(({ name, code: c, amount }) => {\n return html`\n <span data-testclass=\"discount\">${name}${c ? html` • ${c}` : ''}:</span>\n <span>${this.__renderPrice(amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>:\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n </p>\n `;\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/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AI,0CAAE,aAAmC,CAAC;QAE7E,OAAO,IAAI,CAAA;;gBAEC,UAAU,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE;;;mBAG3E;YACT,eAAe;YACf,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM;YAC/C,MAAM,EAAE,GAAG,MAAM,IAAI,YAAY,EAAE;SACpC;;;KAGJ,CAAC;IACJ,CAAC;IAEO,cAAc;;QACpB,MAAM,MAAM,GAAG,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,KAAI,WAAW,CAAC;QACzD,IAAI,KAAK,GAAG,EAAE,CAAC;QAEf,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACnF,KAAK,GAAG,4BAA4B,CAAC;SACtC;aAAM,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,WAAW,EAAE;YAC5C,KAAK,GAAG,kCAAkC,CAAC;SAC5C;aAAM,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvF,KAAK,GAAG,8BAA8B,CAAC;SACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n const refundableAmount = this.__refundableAmount;\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}:</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}:</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:gift_card_code_logs']?.map(log => {\n // @ts-expect-error deep zoom is not supported by the SDK types\n const name = log._embedded?.['fx:gift_card']?.name;\n // @ts-expect-error deep zoom is not supported by the SDK types\n const code = log._embedded?.['fx:gift_card_code']?.code;\n\n if (name && code) {\n return html`\n <span data-testclass=\"gift-card-code\">${name} • ${code}:</span>\n <span>${this.__renderPrice(log.balance_adjustment ?? 0, true)}</span>\n `;\n }\n })}\n ${data?._embedded?.['fx:discounts']?.map(({ name, code: c, amount }) => {\n return html`\n <span data-testclass=\"discount\">${name}${c ? html` • ${c}` : ''}:</span>\n <span>${this.__renderPrice(amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>:\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n\n ${refundableAmount !== data.total_order\n ? html`\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n <span class=\"col-span-2 flex justify-end\">\n <span>\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"refundable_amount\"></foxy-i18n>:\n ${this.__renderPrice(refundableAmount)}\n </span>\n <br />\n <foxy-i18n\n class=\"inline-block whitespace-normal leading-s text-tertiary\"\n style=\"max-width: 48ch\"\n infer=\"\"\n key=\"refundable_amount_note\"\n >\n </foxy-i18n>\n </span>\n </span>\n `\n : ''}\n </p>\n `;\n }\n\n private get __refundableAmount(): number {\n const data = this.nucleon?.data as Data | undefined;\n const originalTotal = data?.total_order ?? 0;\n // @ts-expect-error SDK types do not include amount on fx:refund\n return parseFloat(data?._links['fx:refund']?.amount ?? originalTotal);\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
|
|
@@ -15,6 +15,8 @@ export declare class UserInvitationForm extends Base<Data> {
|
|
|
15
15
|
getStorePageHref: ((storeHref: string) => string) | null;
|
|
16
16
|
/** Default host domain for stores that don't use a custom domain name, e.g. `foxycart.com`. */
|
|
17
17
|
defaultDomain: string | null;
|
|
18
|
+
/** Currently logged in user resource URL. Used to display a warning when revoking access. */
|
|
19
|
+
currentUser: string | null;
|
|
18
20
|
/** Admin layout will display user info, user layout (default) will display store info. */
|
|
19
21
|
layout: 'admin' | 'user' | null;
|
|
20
22
|
private readonly __storeDomainGetValue;
|
|
@@ -15,6 +15,8 @@ export class UserInvitationForm extends Base {
|
|
|
15
15
|
this.getStorePageHref = null;
|
|
16
16
|
/** Default host domain for stores that don't use a custom domain name, e.g. `foxycart.com`. */
|
|
17
17
|
this.defaultDomain = null;
|
|
18
|
+
/** Currently logged in user resource URL. Used to display a warning when revoking access. */
|
|
19
|
+
this.currentUser = null;
|
|
18
20
|
/** Admin layout will display user info, user layout (default) will display store info. */
|
|
19
21
|
this.layout = null;
|
|
20
22
|
this.__storeDomainGetValue = () => {
|
|
@@ -29,6 +31,7 @@ export class UserInvitationForm extends Base {
|
|
|
29
31
|
...super.properties,
|
|
30
32
|
getStorePageHref: { attribute: false },
|
|
31
33
|
defaultDomain: { attribute: 'default-domain' },
|
|
34
|
+
currentUser: { attribute: 'current-user' },
|
|
32
35
|
layout: {},
|
|
33
36
|
};
|
|
34
37
|
}
|
|
@@ -149,8 +152,8 @@ export class UserInvitationForm extends Base {
|
|
|
149
152
|
</div>
|
|
150
153
|
`;
|
|
151
154
|
}
|
|
152
|
-
__renderAdminSnapshotState({ first_name, last_name }) {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
155
|
+
__renderAdminSnapshotState({ first_name, last_name, store_name, _links }) {
|
|
156
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
154
157
|
const hasName = (first_name === null || first_name === void 0 ? void 0 : first_name.trim()) || (last_name === null || last_name === void 0 ? void 0 : last_name.trim());
|
|
155
158
|
const nameOptions = { first_name, last_name, context: hasName ? '' : 'empty' };
|
|
156
159
|
const status = (_a = this.data) === null || _a === void 0 ? void 0 : _a.status;
|
|
@@ -217,18 +220,35 @@ export class UserInvitationForm extends Base {
|
|
|
217
220
|
hidden.matches('resend', true) &&
|
|
218
221
|
hidden.matches('delete', true)}
|
|
219
222
|
>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
${this.currentUser && _links['fx:user'] && this.currentUser === _links['fx:user'].href
|
|
224
|
+
? html `
|
|
225
|
+
<foxy-internal-post-action-control
|
|
226
|
+
message-options=${JSON.stringify({
|
|
227
|
+
store_domain: this.__storeDomainGetValue(),
|
|
228
|
+
store_name,
|
|
229
|
+
})}
|
|
230
|
+
infer="revoke"
|
|
231
|
+
class="flex-1"
|
|
232
|
+
theme="error"
|
|
233
|
+
href=${ifDefined((_e = (_d = this.data) === null || _d === void 0 ? void 0 : _d._links['fx:revoke']) === null || _e === void 0 ? void 0 : _e.href)}
|
|
234
|
+
@success=${() => this.dispatchEvent(new CustomEvent('selfrevoked'))}
|
|
235
|
+
>
|
|
236
|
+
</foxy-internal-post-action-control>
|
|
237
|
+
`
|
|
238
|
+
: html `
|
|
239
|
+
<foxy-internal-user-invitation-form-async-action
|
|
240
|
+
infer="revoke"
|
|
241
|
+
class="flex-1"
|
|
242
|
+
theme="error"
|
|
243
|
+
href=${ifDefined((_g = (_f = this.data) === null || _f === void 0 ? void 0 : _f._links['fx:revoke']) === null || _g === void 0 ? void 0 : _g.href)}
|
|
244
|
+
>
|
|
245
|
+
</foxy-internal-user-invitation-form-async-action>
|
|
246
|
+
`}
|
|
227
247
|
|
|
228
248
|
<foxy-internal-user-invitation-form-async-action
|
|
229
249
|
infer="resend"
|
|
230
250
|
class="flex-1"
|
|
231
|
-
href=${ifDefined((
|
|
251
|
+
href=${ifDefined((_j = (_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:resend']) === null || _j === void 0 ? void 0 : _j.href)}
|
|
232
252
|
>
|
|
233
253
|
</foxy-internal-user-invitation-form-async-action>
|
|
234
254
|
|