@foxy.io/elements 1.41.0-beta.3 → 1.41.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +5 -5
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.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-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-collection-page.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-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.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-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.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-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.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-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.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-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- 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-card.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-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.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-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-store-card.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-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.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-card.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-transactions-table.js +7 -7
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-8a380d5b.js → shared-0ae48c81.js} +1 -1
- package/dist/cdn/{shared-968df92b.js → shared-14209e60.js} +1 -1
- package/dist/cdn/{shared-c5025eca.js → shared-174ae849.js} +1 -1
- package/dist/cdn/{shared-15f46bcc.js → shared-1d2c7978.js} +1 -1
- package/dist/cdn/{shared-75f0b4ce.js → shared-1f659198.js} +1 -1
- package/dist/cdn/{shared-7f25f727.js → shared-2a941373.js} +1 -1
- package/dist/cdn/{shared-72536261.js → shared-375c365e.js} +1 -1
- package/dist/cdn/{shared-32f04dd0.js → shared-379b6e13.js} +1 -1
- package/dist/cdn/{shared-678878ae.js → shared-3c7e55e4.js} +1 -1
- package/dist/cdn/{shared-86d308bf.js → shared-44209364.js} +1 -1
- package/dist/cdn/{shared-ee4757df.js → shared-499c03b8.js} +1 -1
- package/dist/cdn/{shared-ec013722.js → shared-58bb3dda.js} +1 -1
- package/dist/cdn/{shared-72ebbdcd.js → shared-5c6a00e9.js} +1 -1
- package/dist/cdn/{shared-df97fdc7.js → shared-6ce9d926.js} +1 -1
- package/dist/cdn/{shared-4507220f.js → shared-70bcd6ae.js} +1 -1
- package/dist/cdn/{shared-f2f81cda.js → shared-7eefc244.js} +1 -1
- package/dist/cdn/{shared-90a27f17.js → shared-7f14ea13.js} +1 -1
- package/dist/cdn/{shared-be50c355.js → shared-922db328.js} +1 -1
- package/dist/cdn/{shared-a510a176.js → shared-a0570012.js} +1 -1
- package/dist/cdn/{shared-59657e70.js → shared-b82e43e5.js} +1 -1
- package/dist/cdn/{shared-313956af.js → shared-cdaf66d3.js} +1 -1
- package/dist/cdn/{shared-ffa49371.js → shared-dc383217.js} +1 -1
- package/dist/cdn/{shared-49fef994.js → shared-ed3fc85e.js} +1 -1
- package/dist/cdn/{shared-92f7ee94.js → shared-f00ebf92.js} +1 -1
- package/dist/cdn/{shared-2be606c3.js → shared-f7db49fe.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +59 -59
- package/dist/cdn/translations/experimental-add-to-cart-builder/en.json +5 -2
- package/dist/cdn/translations/template-config-form/en.json +1 -1
- package/dist/cdn/translations/transaction/en.json +36 -56
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.d.ts +0 -4
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js +12 -63
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js.map +1 -1
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.d.ts +16 -0
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.js +95 -0
- package/dist/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.js.map +1 -0
- package/dist/elements/internal/InternalPostActionControl/index.d.ts +1 -2
- package/dist/elements/internal/InternalPostActionControl/index.js +3 -2
- package/dist/elements/internal/InternalPostActionControl/index.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js +35 -11
- package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js.map +1 -1
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.d.ts +1 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js +3 -0
- package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js.map +1 -1
- package/dist/elements/public/I18n/format/date.js +1 -1
- package/dist/elements/public/I18n/format/date.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +1 -0
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +10 -2
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/package.json +1 -1
- /package/dist/cdn/{shared-35dbfac1.js → shared-14177287.js} +0 -0
|
@@ -1679,68 +1679,48 @@
|
|
|
1679
1679
|
},
|
|
1680
1680
|
"actions": {
|
|
1681
1681
|
"capture": {
|
|
1682
|
-
"
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
"
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
"
|
|
1691
|
-
"message": "This will attempt to capture this transaction. Would you like to proceed?",
|
|
1692
|
-
"confirm": "Yes",
|
|
1693
|
-
"cancel": "No",
|
|
1694
|
-
"header": "Capture"
|
|
1695
|
-
}
|
|
1682
|
+
"message_idle": "This action will attempt to capture this transaction. Would you like to proceed?",
|
|
1683
|
+
"message_fail": "Failed to capture this transaction. If you'd like to retry, close this dialog and click the capture button again.",
|
|
1684
|
+
"message_done": "Transaction was captured successfully. You can close this dialog now.",
|
|
1685
|
+
"button_close": "Close",
|
|
1686
|
+
"button_confirm": "Capture",
|
|
1687
|
+
"button_cancel": "Go back",
|
|
1688
|
+
"loading_busy": "Processing",
|
|
1689
|
+
"header": "Capture",
|
|
1690
|
+
"button": "Capture"
|
|
1696
1691
|
},
|
|
1697
1692
|
"void": {
|
|
1698
|
-
"
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
"
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
"
|
|
1707
|
-
"message": "This will attempt to void this transaction. Would you like to proceed?",
|
|
1708
|
-
"confirm": "Yes",
|
|
1709
|
-
"cancel": "No",
|
|
1710
|
-
"header": "Void"
|
|
1711
|
-
}
|
|
1693
|
+
"message_idle": "This action will attempt to void this transaction. Would you like to proceed?",
|
|
1694
|
+
"message_fail": "Failed to void this transaction. If you'd like to retry, close this dialog and click the void button again.",
|
|
1695
|
+
"message_done": "Transaction was voided successfully. You can close this dialog now.",
|
|
1696
|
+
"button_close": "Close",
|
|
1697
|
+
"button_confirm": "Void",
|
|
1698
|
+
"button_cancel": "Go back",
|
|
1699
|
+
"loading_busy": "Processing",
|
|
1700
|
+
"header": "Void",
|
|
1701
|
+
"button": "Void"
|
|
1712
1702
|
},
|
|
1713
1703
|
"refund": {
|
|
1714
|
-
"
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
"
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
"
|
|
1723
|
-
"message": "This will attempt to refund this transaction. Would you like to proceed?",
|
|
1724
|
-
"confirm": "Yes",
|
|
1725
|
-
"cancel": "No",
|
|
1726
|
-
"header": "Refund"
|
|
1727
|
-
}
|
|
1704
|
+
"message_idle": "This action will attempt to refund the full amount of this transaction. Would you like to proceed?",
|
|
1705
|
+
"message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
|
|
1706
|
+
"message_done": "Transaction was refunded successfully. You can close this dialog now.",
|
|
1707
|
+
"button_close": "Close",
|
|
1708
|
+
"button_confirm": "Refund",
|
|
1709
|
+
"button_cancel": "Go back",
|
|
1710
|
+
"loading_busy": "Processing",
|
|
1711
|
+
"header": "Refund",
|
|
1712
|
+
"button": "Refund"
|
|
1728
1713
|
},
|
|
1729
1714
|
"send-emails": {
|
|
1730
|
-
"
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
"
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
"
|
|
1739
|
-
"message": "This will attempt to resend emails for this transaction. Would you like to proceed?",
|
|
1740
|
-
"confirm": "Yes",
|
|
1741
|
-
"cancel": "No",
|
|
1742
|
-
"header": "Resend emails"
|
|
1743
|
-
}
|
|
1715
|
+
"message_idle": "This action will attempt to resend emails for this transaction. Would you like to proceed?",
|
|
1716
|
+
"message_fail": "Failed to resend emails for this transaction. If you'd like to retry, close this dialog and click the resend emails button again.",
|
|
1717
|
+
"message_done": "Emails for this transaction were resent successfully. You can close this dialog now.",
|
|
1718
|
+
"button_close": "Close",
|
|
1719
|
+
"button_confirm": "Resend emails",
|
|
1720
|
+
"button_cancel": "Go back",
|
|
1721
|
+
"loading_busy": "Processing",
|
|
1722
|
+
"header": "Resend emails",
|
|
1723
|
+
"button": "Resend emails"
|
|
1744
1724
|
},
|
|
1745
1725
|
"subscription": {
|
|
1746
1726
|
"caption": "Go to subscription"
|
|
@@ -5,9 +5,5 @@ export declare class InternalPostActionControl extends InternalControl {
|
|
|
5
5
|
messageOptions: Record<string, string>;
|
|
6
6
|
theme: string | null;
|
|
7
7
|
href: string | null;
|
|
8
|
-
private __buttonState;
|
|
9
|
-
private readonly __api;
|
|
10
8
|
renderControl(): TemplateResult;
|
|
11
|
-
private __sendPost;
|
|
12
|
-
private __getNotificationRenderer;
|
|
13
9
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { InternalControl } from "../InternalControl/InternalControl.js";
|
|
2
|
-
import { html, render } from 'lit-html';
|
|
3
2
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
4
|
-
import {
|
|
3
|
+
import { html } from 'lit-html';
|
|
5
4
|
export class InternalPostActionControl extends InternalControl {
|
|
6
5
|
constructor() {
|
|
7
6
|
super(...arguments);
|
|
8
7
|
this.messageOptions = {};
|
|
9
8
|
this.theme = null;
|
|
10
9
|
this.href = null;
|
|
11
|
-
this.__buttonState = 'idle';
|
|
12
|
-
this.__api = new API(this);
|
|
13
10
|
}
|
|
14
11
|
static get properties() {
|
|
15
12
|
return {
|
|
@@ -17,82 +14,34 @@ export class InternalPostActionControl extends InternalControl {
|
|
|
17
14
|
messageOptions: { type: Object, attribute: 'message-options' },
|
|
18
15
|
theme: {},
|
|
19
16
|
href: {},
|
|
20
|
-
__buttonState: {},
|
|
21
17
|
};
|
|
22
18
|
}
|
|
23
19
|
renderControl() {
|
|
24
|
-
var _a;
|
|
20
|
+
var _a, _b;
|
|
25
21
|
return html `
|
|
26
|
-
<foxy-internal-
|
|
27
|
-
|
|
28
|
-
infer="
|
|
29
|
-
|
|
30
|
-
.messageOptions=${this.messageOptions}
|
|
22
|
+
<foxy-internal-post-action-control-dialog
|
|
23
|
+
message-options=${JSON.stringify(this.messageOptions)}
|
|
24
|
+
infer=""
|
|
25
|
+
href=${ifDefined((_a = this.href) !== null && _a !== void 0 ? _a : void 0)}
|
|
31
26
|
@hide=${(evt) => {
|
|
32
27
|
if (!evt.detail.cancelled)
|
|
33
|
-
this.
|
|
28
|
+
this.dispatchEvent(new CustomEvent('success'));
|
|
34
29
|
}}
|
|
35
30
|
>
|
|
36
|
-
</foxy-internal-
|
|
37
|
-
|
|
38
|
-
<vaadin-notification
|
|
39
|
-
position="bottom-end"
|
|
40
|
-
duration="3000"
|
|
41
|
-
theme="success"
|
|
42
|
-
id="success-notification"
|
|
43
|
-
.renderer=${this.__getNotificationRenderer('success')}
|
|
44
|
-
>
|
|
45
|
-
</vaadin-notification>
|
|
46
|
-
|
|
47
|
-
<vaadin-notification
|
|
48
|
-
position="bottom-end"
|
|
49
|
-
duration="3000"
|
|
50
|
-
theme="error"
|
|
51
|
-
id="error-notification"
|
|
52
|
-
.renderer=${this.__getNotificationRenderer('error')}
|
|
53
|
-
>
|
|
54
|
-
</vaadin-notification>
|
|
31
|
+
</foxy-internal-post-action-control-dialog>
|
|
55
32
|
|
|
56
33
|
<vaadin-button
|
|
57
|
-
theme=${ifDefined((
|
|
58
|
-
?disabled=${this.disabled || this.readonly
|
|
34
|
+
theme=${ifDefined((_b = this.theme) !== null && _b !== void 0 ? _b : void 0)}
|
|
35
|
+
?disabled=${this.disabled || this.readonly}
|
|
59
36
|
@click=${(evt) => {
|
|
60
37
|
const button = evt.currentTarget;
|
|
61
|
-
const dialog = this.renderRoot.querySelector('
|
|
38
|
+
const dialog = this.renderRoot.querySelector('foxy-internal-post-action-control-dialog');
|
|
62
39
|
dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
|
|
63
40
|
}}
|
|
64
41
|
>
|
|
65
|
-
<foxy-i18n infer="
|
|
42
|
+
<foxy-i18n infer="" key="button"></foxy-i18n>
|
|
66
43
|
</vaadin-button>
|
|
67
44
|
`;
|
|
68
45
|
}
|
|
69
|
-
async __sendPost() {
|
|
70
|
-
if (this.href && this.__buttonState === 'idle') {
|
|
71
|
-
this.__buttonState = 'busy';
|
|
72
|
-
const response = await this.__api.fetch(this.href, { method: 'POST' });
|
|
73
|
-
const result = response.ok ? 'success' : 'error';
|
|
74
|
-
const selector = `#${result}-notification`;
|
|
75
|
-
const notification = this.renderRoot.querySelector(selector);
|
|
76
|
-
notification === null || notification === void 0 ? void 0 : notification.open();
|
|
77
|
-
this.__buttonState = 'idle';
|
|
78
|
-
this.dispatchEvent(new CustomEvent(result));
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
__getNotificationRenderer(state) {
|
|
82
|
-
return (root) => {
|
|
83
|
-
if (!root.firstElementChild)
|
|
84
|
-
root.innerHTML = '<span></span>';
|
|
85
|
-
const layout = html `
|
|
86
|
-
<foxy-i18n
|
|
87
|
-
style="color: var(--lumo-${state}-contrast-color)"
|
|
88
|
-
lang=${this.lang}
|
|
89
|
-
key=${state}
|
|
90
|
-
ns="${this.ns} notification"
|
|
91
|
-
>
|
|
92
|
-
</foxy-i18n>
|
|
93
|
-
`;
|
|
94
|
-
render(layout, root.firstElementChild);
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
46
|
}
|
|
98
47
|
//# sourceMappingURL=InternalPostActionControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"
|
|
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;IA8B7B,CAAC;IA3CC,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;oBAC3B,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 ?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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
2
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
3
|
+
import { Dialog } from '../../private/Dialog/Dialog';
|
|
4
|
+
export declare class InternalPostActionControlDialog extends Dialog {
|
|
5
|
+
static get properties(): PropertyDeclarations;
|
|
6
|
+
messageOptions: Record<string, string>;
|
|
7
|
+
closable: boolean;
|
|
8
|
+
header: string;
|
|
9
|
+
alert: boolean;
|
|
10
|
+
href: string | null;
|
|
11
|
+
private readonly __api;
|
|
12
|
+
private __state;
|
|
13
|
+
get hiddenSelector(): BooleanSelector;
|
|
14
|
+
render(): TemplateResult;
|
|
15
|
+
hide(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { html, svg } from 'lit-element';
|
|
2
|
+
import { BooleanSelector } from '@foxy.io/sdk/core';
|
|
3
|
+
import { Dialog } from "../../private/Dialog/Dialog.js";
|
|
4
|
+
import { API } from "../../public/NucleonElement/API.js";
|
|
5
|
+
export class InternalPostActionControlDialog extends Dialog {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.messageOptions = {};
|
|
9
|
+
this.closable = true;
|
|
10
|
+
this.header = 'header';
|
|
11
|
+
this.alert = true;
|
|
12
|
+
this.href = null;
|
|
13
|
+
this.__api = new API(this);
|
|
14
|
+
this.__state = 'idle';
|
|
15
|
+
}
|
|
16
|
+
static get properties() {
|
|
17
|
+
return {
|
|
18
|
+
...super.properties,
|
|
19
|
+
messageOptions: { type: Object, attribute: 'message-options' },
|
|
20
|
+
href: {},
|
|
21
|
+
__state: { attribute: false },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
get hiddenSelector() {
|
|
25
|
+
const alwaysMatch = ['close-button', super.hiddenSelector.toString()];
|
|
26
|
+
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return super.render(() => html `
|
|
30
|
+
<div class="relative">
|
|
31
|
+
<div class="mb-m mt-xs flex justify-center">
|
|
32
|
+
${this.__state === 'done'
|
|
33
|
+
? svg `<svg class="text-success" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`
|
|
34
|
+
: this.__state === 'fail'
|
|
35
|
+
? svg `<svg class="text-error" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" /></svg>`
|
|
36
|
+
: svg `<svg class="text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" /></svg>`}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<foxy-i18n
|
|
40
|
+
class="block font-lumo text-m text-body text-center mb-l"
|
|
41
|
+
infer=""
|
|
42
|
+
key="message_${this.__state === 'busy' ? 'idle' : this.__state}"
|
|
43
|
+
.options=${this.messageOptions}
|
|
44
|
+
>
|
|
45
|
+
</foxy-i18n>
|
|
46
|
+
|
|
47
|
+
<div class="grid grid-cols-2 gap-m">
|
|
48
|
+
${this.__state === 'done' || this.__state === 'fail'
|
|
49
|
+
? html `
|
|
50
|
+
<vaadin-button class="col-span-2" theme="contrast" @click=${() => this.hide()}>
|
|
51
|
+
<foxy-i18n infer="" key="button_close"></foxy-i18n>
|
|
52
|
+
</vaadin-button>
|
|
53
|
+
`
|
|
54
|
+
: html `
|
|
55
|
+
<vaadin-button
|
|
56
|
+
?disabled=${this.disabled || this.readonly}
|
|
57
|
+
@click=${() => this.hide()}
|
|
58
|
+
>
|
|
59
|
+
<foxy-i18n infer="" key="button_cancel"></foxy-i18n>
|
|
60
|
+
</vaadin-button>
|
|
61
|
+
|
|
62
|
+
<vaadin-button
|
|
63
|
+
theme="primary"
|
|
64
|
+
?disabled=${this.disabled || this.readonly}
|
|
65
|
+
@click=${async () => {
|
|
66
|
+
if (this.href && this.__state === 'idle') {
|
|
67
|
+
this.__state = 'busy';
|
|
68
|
+
this.closable = false;
|
|
69
|
+
const response = await this.__api.fetch(this.href, { method: 'POST' });
|
|
70
|
+
this.__state = response.ok ? 'done' : 'fail';
|
|
71
|
+
this.closable = true;
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<foxy-i18n infer="" key="button_confirm"></foxy-i18n>
|
|
76
|
+
</vaadin-button>
|
|
77
|
+
`}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
${this.__state === 'busy'
|
|
81
|
+
? html `
|
|
82
|
+
<div class="bg-base absolute inset-0 flex items-center justify-center">
|
|
83
|
+
<foxy-spinner layout="vertical" infer=""></foxy-spinner>
|
|
84
|
+
</div>
|
|
85
|
+
`
|
|
86
|
+
: ''}
|
|
87
|
+
</div>
|
|
88
|
+
`);
|
|
89
|
+
}
|
|
90
|
+
async hide() {
|
|
91
|
+
await super.hide(this.__state !== 'done');
|
|
92
|
+
this.__state = 'idle';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=InternalPostActionControlDialog.js.map
|
package/dist/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalPostActionControlDialog.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.ts"],"names":[],"mappings":"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","sourcesContent":["import { PropertyDeclarations, TemplateResult, html, svg } from 'lit-element';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Dialog } from '../../private/Dialog/Dialog';\nimport { API } from '../../public/NucleonElement/API';\n\nexport class InternalPostActionControlDialog extends Dialog {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n href: {},\n __state: { attribute: false },\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n closable = true;\n\n header = 'header';\n\n alert = true;\n\n href: string | null = null;\n\n private readonly __api = new API(this);\n\n private __state: 'idle' | 'busy' | 'done' | 'fail' = 'idle';\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['close-button', super.hiddenSelector.toString()];\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n render(): TemplateResult {\n return super.render(\n () => html`\n <div class=\"relative\">\n <div class=\"mb-m mt-xs flex justify-center\">\n ${this.__state === 'done'\n ? svg`<svg class=\"text-success\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z\" /></svg>`\n : this.__state === 'fail'\n ? svg`<svg class=\"text-error\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z\" /></svg>`\n : svg`<svg class=\"text-primary\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z\" /></svg>`}\n </div>\n\n <foxy-i18n\n class=\"block font-lumo text-m text-body text-center mb-l\"\n infer=\"\"\n key=\"message_${this.__state === 'busy' ? 'idle' : this.__state}\"\n .options=${this.messageOptions}\n >\n </foxy-i18n>\n\n <div class=\"grid grid-cols-2 gap-m\">\n ${this.__state === 'done' || this.__state === 'fail'\n ? html`\n <vaadin-button class=\"col-span-2\" theme=\"contrast\" @click=${() => this.hide()}>\n <foxy-i18n infer=\"\" key=\"button_close\"></foxy-i18n>\n </vaadin-button>\n `\n : html`\n <vaadin-button\n ?disabled=${this.disabled || this.readonly}\n @click=${() => this.hide()}\n >\n <foxy-i18n infer=\"\" key=\"button_cancel\"></foxy-i18n>\n </vaadin-button>\n\n <vaadin-button\n theme=\"primary\"\n ?disabled=${this.disabled || this.readonly}\n @click=${async () => {\n if (this.href && this.__state === 'idle') {\n this.__state = 'busy';\n this.closable = false;\n const response = await this.__api.fetch(this.href, { method: 'POST' });\n this.__state = response.ok ? 'done' : 'fail';\n this.closable = true;\n }\n }}\n >\n <foxy-i18n infer=\"\" key=\"button_confirm\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n\n ${this.__state === 'busy'\n ? html`\n <div class=\"bg-base absolute inset-0 flex items-center justify-center\">\n <foxy-spinner layout=\"vertical\" infer=\"\"></foxy-spinner>\n </div>\n `\n : ''}\n </div>\n `\n );\n }\n\n async hide(): Promise<void> {\n await super.hide(this.__state !== 'done');\n this.__state = 'idle';\n }\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import '@vaadin/vaadin-notification';
|
|
2
1
|
import '@vaadin/vaadin-button';
|
|
3
|
-
import '../InternalConfirmDialog/index';
|
|
4
2
|
import '../InternalControl/index';
|
|
3
|
+
import '../../public/Spinner/index';
|
|
5
4
|
import '../../public/I18n/index';
|
|
6
5
|
import { InternalPostActionControl } from './InternalPostActionControl';
|
|
7
6
|
export { InternalPostActionControl };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import '@vaadin/vaadin-notification';
|
|
2
1
|
import '@vaadin/vaadin-button';
|
|
3
|
-
import "../InternalConfirmDialog/index.js";
|
|
4
2
|
import "../InternalControl/index.js";
|
|
3
|
+
import "../../public/Spinner/index.js";
|
|
5
4
|
import "../../public/I18n/index.js";
|
|
5
|
+
import { InternalPostActionControlDialog } from "./InternalPostActionControlDialog.js";
|
|
6
6
|
import { InternalPostActionControl } from "./InternalPostActionControl.js";
|
|
7
7
|
customElements.define('foxy-internal-post-action-control', InternalPostActionControl);
|
|
8
|
+
customElements.define('foxy-internal-post-action-control-dialog', InternalPostActionControlDialog);
|
|
8
9
|
export { InternalPostActionControl };
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAE/B,qCAAkC;AAElC,uCAAoC;AACpC,oCAAiC;AAEjC,OAAO,EAAE,+BAA+B,EAAE,6CAA0C;AACpF,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AAExE,cAAc,CAAC,MAAM,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC;AACtF,cAAc,CAAC,MAAM,CAAC,0CAA0C,EAAE,+BAA+B,CAAC,CAAC;AAEnG,OAAO,EAAE,yBAAyB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-button';\n\nimport '../InternalControl/index';\n\nimport '../../public/Spinner/index';\nimport '../../public/I18n/index';\n\nimport { InternalPostActionControlDialog } from './InternalPostActionControlDialog';\nimport { InternalPostActionControl } from './InternalPostActionControl';\n\ncustomElements.define('foxy-internal-post-action-control', InternalPostActionControl);\ncustomElements.define('foxy-internal-post-action-control-dialog', InternalPostActionControlDialog);\n\nexport { InternalPostActionControl };\n"]}
|
|
@@ -98,7 +98,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
98
98
|
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
99
99
|
}
|
|
100
100
|
renderBody() {
|
|
101
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
102
102
|
const addToCartCode = this.__getAddToCartCode();
|
|
103
103
|
const storeUrl = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:store'].href) !== null && _b !== void 0 ? _b : this.store) !== null && _c !== void 0 ? _c : void 0;
|
|
104
104
|
const store = (_d = this.__storeLoader) === null || _d === void 0 ? void 0 : _d.data;
|
|
@@ -125,6 +125,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
125
125
|
store=${ifDefined(storeUrl)}
|
|
126
126
|
index=${index}
|
|
127
127
|
infer="item"
|
|
128
|
+
?use-cart-validation=${ifDefined(store === null || store === void 0 ? void 0 : store.use_cart_validation)}
|
|
128
129
|
.defaultItemCategory=${this.__defaultItemCategory}
|
|
129
130
|
@remove=${() => {
|
|
130
131
|
var _a;
|
|
@@ -155,7 +156,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
155
156
|
</foxy-internal-summary-control>
|
|
156
157
|
|
|
157
158
|
<div class="space-y-m md-col-span-2 sticky top-0">
|
|
158
|
-
${addToCartCode
|
|
159
|
+
${addToCartCode && !addToCartCode.error
|
|
159
160
|
? html `
|
|
160
161
|
<foxy-internal-summary-control infer="preview">
|
|
161
162
|
<div class="flex">
|
|
@@ -294,8 +295,19 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
294
295
|
`
|
|
295
296
|
: html `
|
|
296
297
|
<foxy-internal-summary-control infer="preview">
|
|
297
|
-
<div class="flex items-center justify-center p-xl">
|
|
298
|
-
<foxy-spinner
|
|
298
|
+
<div class="flex flex-col gap-xs items-center justify-center p-xl">
|
|
299
|
+
<foxy-spinner
|
|
300
|
+
layout="no-label"
|
|
301
|
+
infer="unavailable"
|
|
302
|
+
state=${(addToCartCode === null || addToCartCode === void 0 ? void 0 : addToCartCode.error) ? 'paused' : 'busy'}
|
|
303
|
+
>
|
|
304
|
+
</foxy-spinner>
|
|
305
|
+
<foxy-i18n
|
|
306
|
+
class="text-tertiary text-s"
|
|
307
|
+
infer="unavailable"
|
|
308
|
+
key="${(_f = addToCartCode === null || addToCartCode === void 0 ? void 0 : addToCartCode.error) !== null && _f !== void 0 ? _f : 'loading_busy'}"
|
|
309
|
+
>
|
|
310
|
+
</foxy-i18n>
|
|
299
311
|
</div>
|
|
300
312
|
</foxy-internal-summary-control>
|
|
301
313
|
`}
|
|
@@ -303,7 +315,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
303
315
|
<foxy-internal-summary-control infer="cart-settings">
|
|
304
316
|
<foxy-internal-resource-picker-control
|
|
305
317
|
layout="summary-item"
|
|
306
|
-
first=${ifDefined((
|
|
318
|
+
first=${ifDefined((_h = (_g = this.__storeLoader) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h._links['fx:template_sets'].href)}
|
|
307
319
|
infer="template-set-uri"
|
|
308
320
|
item="foxy-template-set-card"
|
|
309
321
|
>
|
|
@@ -357,7 +369,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
357
369
|
<foxy-nucleon
|
|
358
370
|
class="hidden"
|
|
359
371
|
infer=""
|
|
360
|
-
href=${ifDefined((
|
|
372
|
+
href=${ifDefined((_j = this.localeCodes) !== null && _j !== void 0 ? _j : void 0)}
|
|
361
373
|
id="localeCodesHelperLoader"
|
|
362
374
|
@update=${() => this.requestUpdate()}
|
|
363
375
|
>
|
|
@@ -366,7 +378,7 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
366
378
|
<foxy-nucleon
|
|
367
379
|
class="hidden"
|
|
368
380
|
infer=""
|
|
369
|
-
href=${ifDefined((
|
|
381
|
+
href=${ifDefined((_k = this.form.template_set_uri) !== null && _k !== void 0 ? _k : void 0)}
|
|
370
382
|
id="templateSetLoader"
|
|
371
383
|
@update=${() => this.requestUpdate()}
|
|
372
384
|
>
|
|
@@ -375,13 +387,13 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
375
387
|
<foxy-nucleon
|
|
376
388
|
class="hidden"
|
|
377
389
|
infer=""
|
|
378
|
-
href=${ifDefined((
|
|
390
|
+
href=${ifDefined((_o = (_m = (_l = this.data) === null || _l === void 0 ? void 0 : _l._links['fx:store'].href) !== null && _m !== void 0 ? _m : this.store) !== null && _o !== void 0 ? _o : void 0)}
|
|
379
391
|
id="storeLoaderId"
|
|
380
392
|
@update=${() => this.requestUpdate()}
|
|
381
393
|
>
|
|
382
394
|
</foxy-nucleon>
|
|
383
395
|
|
|
384
|
-
${(
|
|
396
|
+
${(_p = this.form.items) === null || _p === void 0 ? void 0 : _p.map((product, index) => {
|
|
385
397
|
var _a;
|
|
386
398
|
return html `
|
|
387
399
|
<foxy-nucleon
|
|
@@ -557,8 +569,12 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
557
569
|
if (itemCategory && itemCategory.code !== 'DEFAULT') {
|
|
558
570
|
addHiddenInput(`${prefix}category`, itemCategory.code);
|
|
559
571
|
}
|
|
560
|
-
if (product.code)
|
|
572
|
+
if (product.code) {
|
|
561
573
|
addHiddenInput(`${prefix}code`, product.code);
|
|
574
|
+
}
|
|
575
|
+
else if (store.use_cart_validation) {
|
|
576
|
+
return { error: 'code_required' };
|
|
577
|
+
}
|
|
562
578
|
if (product.parent_code)
|
|
563
579
|
addHiddenInput(`${prefix}parent_code`, product.parent_code);
|
|
564
580
|
if (product.image) {
|
|
@@ -756,8 +772,12 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
756
772
|
}
|
|
757
773
|
url.searchParams.set(`${prefix}name`, product.name);
|
|
758
774
|
url.searchParams.set(`${prefix}price`, `${product.price}${currencyCode}`);
|
|
759
|
-
if (product.code)
|
|
775
|
+
if (product.code) {
|
|
760
776
|
url.searchParams.set(`${prefix}code`, product.code);
|
|
777
|
+
}
|
|
778
|
+
else if (store.use_cart_validation) {
|
|
779
|
+
return { error: 'code_required' };
|
|
780
|
+
}
|
|
761
781
|
if (product.parent_code)
|
|
762
782
|
url.searchParams.set(`${prefix}parent_code`, product.parent_code);
|
|
763
783
|
if (product.image) {
|
|
@@ -844,6 +864,10 @@ export class ExperimentalAddToCartBuilder extends Base {
|
|
|
844
864
|
const linkHref = this.__getAddToCartLinkHref();
|
|
845
865
|
if (!formHTML && !linkHref)
|
|
846
866
|
return null;
|
|
867
|
+
if (typeof formHTML === 'object')
|
|
868
|
+
return { error: formHTML.error };
|
|
869
|
+
if (typeof linkHref === 'object')
|
|
870
|
+
return { error: linkHref.error };
|
|
847
871
|
let unsignedCode;
|
|
848
872
|
if (linkHref) {
|
|
849
873
|
const linkHTML = `<a href="${encode(linkHref)}">Add to cart</a>`;
|