@foxy.io/elements 1.40.0-beta.2 → 1.40.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -14
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-0c134ce7.js → shared-0098edce.js} +1 -1
- package/dist/cdn/shared-511fcf8e.js +15 -0
- package/dist/cdn/shared-653368ea.js +1 -0
- package/dist/cdn/translations/native-integration-form/en.json +82 -17
- package/dist/cdn/translations/template-config-form/en.json +6 -6
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -0
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +24 -2
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.d.ts +1 -2
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js +32 -52
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/index.d.ts +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.d.ts +12 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js +123 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js.map +1 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.d.ts +8 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js +10 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js.map +1 -0
- package/dist/elements/public/TaxForm/TaxForm.js +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +2 -2
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +6 -9
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.d.ts +0 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js +40 -66
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.d.ts +8 -12
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js +69 -91
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.d.ts +1 -0
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js +1 -0
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-80a1bf6f.js +0 -1
- package/dist/cdn/shared-aca2705d.js +0 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { InternalEditableControl } from "../../../../internal/InternalEditableControl/InternalEditableControl.js";
|
|
2
|
+
import { getResourceId } from '@foxy.io/sdk/core';
|
|
3
|
+
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
4
|
+
import { html, svg } from 'lit-element';
|
|
5
|
+
import { classMap } from "../../../../../utils/class-map.js";
|
|
6
|
+
export class InternalNativeIntegrationFormCodeMapControl extends InternalEditableControl {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.itemCategoryBase = null;
|
|
10
|
+
this.itemCategories = null;
|
|
11
|
+
this.__newMappingGetValue = () => void 0;
|
|
12
|
+
this.__newMappingSetValue = (value) => {
|
|
13
|
+
const id = getResourceId(value);
|
|
14
|
+
if (typeof id === 'string' || typeof id === 'number') {
|
|
15
|
+
if (this._value && id in this._value) {
|
|
16
|
+
const entry = this.renderRoot.querySelector(`#category-${id}`);
|
|
17
|
+
entry === null || entry === void 0 ? void 0 : entry.animate([
|
|
18
|
+
{ background: '' },
|
|
19
|
+
{ background: 'var(--lumo-primary-color-50pct)' },
|
|
20
|
+
{ background: '' },
|
|
21
|
+
], {
|
|
22
|
+
duration: 2000,
|
|
23
|
+
easing: 'ease',
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this._value = { ...this._value, [id]: '' };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static get properties() {
|
|
33
|
+
return {
|
|
34
|
+
...super.properties,
|
|
35
|
+
itemCategoryBase: { attribute: 'item-category-base' },
|
|
36
|
+
itemCategories: { attribute: 'item-categories' },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
renderControl() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return html `
|
|
42
|
+
<foxy-internal-summary-control infer="existing-mappings" unsafe-helper-text>
|
|
43
|
+
${Object.entries((_a = this._value) !== null && _a !== void 0 ? _a : {}).map(([id, taxCode]) => {
|
|
44
|
+
var _a, _b, _c, _d, _e;
|
|
45
|
+
let categoryHref;
|
|
46
|
+
try {
|
|
47
|
+
categoryHref = new URL(id, (_a = this.itemCategoryBase) !== null && _a !== void 0 ? _a : void 0).toString();
|
|
48
|
+
}
|
|
49
|
+
catch (_f) {
|
|
50
|
+
categoryHref = undefined;
|
|
51
|
+
}
|
|
52
|
+
const loader = this.renderRoot.querySelector(`#category${id}Loader`);
|
|
53
|
+
const status = (loader === null || loader === void 0 ? void 0 : loader.in('fail')) ? this.t('existing-mappings.status_fail')
|
|
54
|
+
: (loader === null || loader === void 0 ? void 0 : loader.in('busy')) ? this.t('existing-mappings.status_busy')
|
|
55
|
+
: null;
|
|
56
|
+
return html `
|
|
57
|
+
<div class="flex items-center gap-xs" id="category-${id}">
|
|
58
|
+
<foxy-nucleon
|
|
59
|
+
parent=${ifDefined((_b = this.itemCategories) !== null && _b !== void 0 ? _b : void 0)}
|
|
60
|
+
class="hidden"
|
|
61
|
+
infer=""
|
|
62
|
+
href=${ifDefined(categoryHref)}
|
|
63
|
+
id="category${id}Loader"
|
|
64
|
+
@update=${() => this.requestUpdate()}
|
|
65
|
+
>
|
|
66
|
+
</foxy-nucleon>
|
|
67
|
+
|
|
68
|
+
<foxy-internal-text-control
|
|
69
|
+
helper-text=""
|
|
70
|
+
layout="summary-item"
|
|
71
|
+
label=${(_e = (_d = (_c = loader === null || loader === void 0 ? void 0 : loader.data) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : status) !== null && _e !== void 0 ? _e : id}
|
|
72
|
+
infer=""
|
|
73
|
+
class="flex-1"
|
|
74
|
+
.getValue=${() => taxCode}
|
|
75
|
+
.setValue=${(v) => (this._value = { ...this._value, [id]: v })}
|
|
76
|
+
>
|
|
77
|
+
</foxy-internal-text-control>
|
|
78
|
+
|
|
79
|
+
<button
|
|
80
|
+
aria-label=${this.t('delete')}
|
|
81
|
+
class=${classMap({
|
|
82
|
+
'flex-shrink-0 rounded-full transition-colors': true,
|
|
83
|
+
'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
|
|
84
|
+
'cursor-pointer text-tertiary hover-text-body': !this.disabled,
|
|
85
|
+
'cursor-default text-disabled': this.disabled,
|
|
86
|
+
})}
|
|
87
|
+
style="width: 1em; height: 1em;"
|
|
88
|
+
?disabled=${this.disabled}
|
|
89
|
+
?hidden=${this.readonly || !!taxCode}
|
|
90
|
+
@click=${() => {
|
|
91
|
+
const newValue = { ...this._value };
|
|
92
|
+
delete newValue[id];
|
|
93
|
+
this._value = newValue;
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: translate(0.1em, 0.1em) scale(1.3);"><path fill-rule="evenodd" d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z" clip-rule="evenodd" /> </svg>`}
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
100
|
+
})}
|
|
101
|
+
</foxy-internal-summary-control>
|
|
102
|
+
|
|
103
|
+
<foxy-internal-summary-control helper-text="" label="" infer="new-mapping" class="mt-s">
|
|
104
|
+
<foxy-internal-resource-picker-control
|
|
105
|
+
layout="summary-item"
|
|
106
|
+
first=${ifDefined((_b = this.itemCategories) !== null && _b !== void 0 ? _b : void 0)}
|
|
107
|
+
infer=""
|
|
108
|
+
item="foxy-item-category-card"
|
|
109
|
+
.getValue=${this.__newMappingGetValue}
|
|
110
|
+
.setValue=${this.__newMappingSetValue}
|
|
111
|
+
>
|
|
112
|
+
</foxy-internal-resource-picker-control>
|
|
113
|
+
</foxy-internal-summary-control>
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
get _value() {
|
|
117
|
+
return super._value;
|
|
118
|
+
}
|
|
119
|
+
set _value(newValue) {
|
|
120
|
+
super._value = newValue;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=InternalNativeIntegrationFormCodeMapControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalNativeIntegrationFormCodeMapControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,gFAA6E;AAC/G,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,0CAAuC;AAE1D,MAAM,OAAO,2CAA4C,SAAQ,uBAAuB;IAAxF;;QASE,qBAAgB,GAAkB,IAAI,CAAC;QAEvC,mBAAc,GAAkB,IAAI,CAAC;QAEpB,yBAAoB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAEpC,yBAAoB,GAAG,CAAC,KAAa,EAAE,EAAE;YACxD,MAAM,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;YAEhC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;gBACpD,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE;oBACpC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;oBAC/D,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CACZ;wBACE,EAAE,UAAU,EAAE,EAAE,EAAE;wBAClB,EAAE,UAAU,EAAE,iCAAiC,EAAE;wBACjD,EAAE,UAAU,EAAE,EAAE,EAAE;qBACnB,EACD;wBACE,QAAQ,EAAE,IAAI;wBACd,MA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AAC,QAA4C;QAC/D,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC1B,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 { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalEditableControl } from '../../../../internal/InternalEditableControl/InternalEditableControl';\nimport { getResourceId } from '@foxy.io/sdk/core';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-element';\nimport { classMap } from '../../../../../utils/class-map';\n\nexport class InternalNativeIntegrationFormCodeMapControl extends InternalEditableControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n itemCategoryBase: { attribute: 'item-category-base' },\n itemCategories: { attribute: 'item-categories' },\n };\n }\n\n itemCategoryBase: string | null = null;\n\n itemCategories: string | null = null;\n\n private readonly __newMappingGetValue = () => void 0;\n\n private readonly __newMappingSetValue = (value: string) => {\n const id = getResourceId(value);\n\n if (typeof id === 'string' || typeof id === 'number') {\n if (this._value && id in this._value) {\n const entry = this.renderRoot.querySelector(`#category-${id}`);\n entry?.animate(\n [\n { background: '' },\n { background: 'var(--lumo-primary-color-50pct)' },\n { background: '' },\n ],\n {\n duration: 2000,\n easing: 'ease',\n }\n );\n } else {\n this._value = { ...this._value, [id]: '' };\n }\n }\n };\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-summary-control infer=\"existing-mappings\" unsafe-helper-text>\n ${Object.entries(this._value ?? {}).map(([id, taxCode]) => {\n let categoryHref: string | undefined;\n\n try {\n categoryHref = new URL(id, this.itemCategoryBase ?? void 0).toString();\n } catch {\n categoryHref = undefined;\n }\n\n type Loader = NucleonElement<Resource<Rels.ItemCategory>>;\n const loader = this.renderRoot.querySelector<Loader>(`#category${id}Loader`);\n const status = loader?.in('fail')\n ? this.t('existing-mappings.status_fail')\n : loader?.in('busy')\n ? this.t('existing-mappings.status_busy')\n : null;\n\n return html`\n <div class=\"flex items-center gap-xs\" id=\"category-${id}\">\n <foxy-nucleon\n parent=${ifDefined(this.itemCategories ?? void 0)}\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(categoryHref)}\n id=\"category${id}Loader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-internal-text-control\n helper-text=\"\"\n layout=\"summary-item\"\n label=${loader?.data?.name ?? status ?? id}\n infer=\"\"\n class=\"flex-1\"\n .getValue=${() => taxCode}\n .setValue=${(v: string) => (this._value = { ...this._value, [id]: v })}\n >\n </foxy-internal-text-control>\n\n <button\n aria-label=${this.t('delete')}\n class=${classMap({\n 'flex-shrink-0 rounded-full transition-colors': true,\n 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,\n 'cursor-pointer text-tertiary hover-text-body': !this.disabled,\n 'cursor-default text-disabled': this.disabled,\n })}\n style=\"width: 1em; height: 1em;\"\n ?disabled=${this.disabled}\n ?hidden=${this.readonly || !!taxCode}\n @click=${() => {\n const newValue = { ...this._value };\n delete newValue[id];\n this._value = newValue;\n }}\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em; transform: translate(0.1em, 0.1em) scale(1.3);\"><path fill-rule=\"evenodd\" d=\"M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z\" clip-rule=\"evenodd\" /> </svg>`}\n </button>\n </div>\n `;\n })}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control helper-text=\"\" label=\"\" infer=\"new-mapping\" class=\"mt-s\">\n <foxy-internal-resource-picker-control\n layout=\"summary-item\"\n first=${ifDefined(this.itemCategories ?? void 0)}\n infer=\"\"\n item=\"foxy-item-category-card\"\n .getValue=${this.__newMappingGetValue}\n .setValue=${this.__newMappingSetValue}\n >\n </foxy-internal-resource-picker-control>\n </foxy-internal-summary-control>\n `;\n }\n\n protected get _value(): Record<string, string> | undefined {\n return super._value as Record<string, string> | undefined;\n }\n\n protected set _value(newValue: Record<string, string> | undefined) {\n super._value = newValue;\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../../../../internal/InternalResourcePickerControl/index';
|
|
2
|
+
import '../../../../internal/InternalEditableControl/index';
|
|
3
|
+
import '../../../../internal/InternalSummaryControl/index';
|
|
4
|
+
import '../../../../internal/InternalTextControl/index';
|
|
5
|
+
import '../../../ItemCategoryCard/index';
|
|
6
|
+
import '../../../NucleonElement/index';
|
|
7
|
+
import { InternalNativeIntegrationFormCodeMapControl } from './InternalNativeIntegrationFormCodeMapControl';
|
|
8
|
+
export { InternalNativeIntegrationFormCodeMapControl };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../../../internal/InternalResourcePickerControl/index.js";
|
|
2
|
+
import "../../../../internal/InternalEditableControl/index.js";
|
|
3
|
+
import "../../../../internal/InternalSummaryControl/index.js";
|
|
4
|
+
import "../../../../internal/InternalTextControl/index.js";
|
|
5
|
+
import "../../../ItemCategoryCard/index.js";
|
|
6
|
+
import "../../../NucleonElement/index.js";
|
|
7
|
+
import { InternalNativeIntegrationFormCodeMapControl } from "./InternalNativeIntegrationFormCodeMapControl.js";
|
|
8
|
+
customElements.define('foxy-internal-native-integration-form-code-map-control', InternalNativeIntegrationFormCodeMapControl);
|
|
9
|
+
export { InternalNativeIntegrationFormCodeMapControl };
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.ts"],"names":[],"mappings":"AAAA,qEAAkE;AAClE,+DAA4D;AAC5D,8DAA2D;AAC3D,2DAAwD;AAExD,4CAAyC;AACzC,0CAAuC;AAEvC,OAAO,EAAE,2CAA2C,EAAE,yDAAsD;AAE5G,cAAc,CAAC,MAAM,CACnB,wDAAwD,EACxD,2CAA2C,CAC5C,CAAC;AAEF,OAAO,EAAE,2CAA2C,EAAE,CAAC","sourcesContent":["import '../../../../internal/InternalResourcePickerControl/index';\nimport '../../../../internal/InternalEditableControl/index';\nimport '../../../../internal/InternalSummaryControl/index';\nimport '../../../../internal/InternalTextControl/index';\n\nimport '../../../ItemCategoryCard/index';\nimport '../../../NucleonElement/index';\n\nimport { InternalNativeIntegrationFormCodeMapControl } from './InternalNativeIntegrationFormCodeMapControl';\n\ncustomElements.define(\n 'foxy-internal-native-integration-form-code-map-control',\n InternalNativeIntegrationFormCodeMapControl\n);\n\nexport { InternalNativeIntegrationFormCodeMapControl };\n"]}
|
|
@@ -231,7 +231,7 @@ export class TaxForm extends Base {
|
|
|
231
231
|
if (this.form.type === 'union' ||
|
|
232
232
|
!this.form.country ||
|
|
233
233
|
defaultLiveRateCountries.includes(this.form.country)) {
|
|
234
|
-
options.unshift({ label: 'option_default', value: '
|
|
234
|
+
options.unshift({ label: 'option_default', value: '' });
|
|
235
235
|
}
|
|
236
236
|
if (this.form.type === 'union' ||
|
|
237
237
|
!this.form.country ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaxForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxForm/TaxForm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAA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I,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;IAED,IAAY,wBAAwB;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC1F,CAAC;IAED,IAAY,iBAAiB;QAC3B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;SAC1F;aAAM;YACL,OAAO,CAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAChF;IACH,CAAC;IAED,IAAY,gBAAgB;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACnE,CAAC;IAED,IAAY,cAAc;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;IACpC,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'tax-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n// prettier-ignore\nconst defaultLiveRateCountries: (string | undefined)[] = ['US', 'CA', 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IM', 'IT', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];\nconst taxJarLiveRateCountries = [...defaultLiveRateCountries, 'AU'];\n\n/**\n * Form element for creating or editing taxes (`fx:tax`).\n *\n * @element foxy-tax-form\n * @since 1.13.0\n */\nexport class TaxForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n nativeIntegrations: { attribute: 'native-integrations' },\n countries: {},\n regions: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 30 || 'name:v8n_too_long',\n ({ country: c, type: t }) => t !== 'country' || !!c || 'country:v8n_required',\n ({ country: c, type: t }) => t !== 'region' || !!c || 'country:v8n_required',\n ({ country: c, use_origin_rates: r }) => !r || !!c || 'country:v8n_required',\n ({ region: v, type: t }) => t != 'region' || !!v || 'region:v8n_required',\n ({ region: v }) => !v || v.length <= 20 || 'region:v8n_too_long',\n ({ city: v }) => !v || v.length <= 50 || 'city:v8n_too_long',\n ({ city: c, type: t }) => t != 'local' || !!c || 'city:v8n_required',\n ({ rate: v, type, is_live }) => {\n return (\n v === void 0 ||\n v > 0 ||\n // @ts-expect-error SDK types are not up to date.\n type === 'custom_tax_endpoint' ||\n type === void 0 ||\n is_live ||\n 'rate:v8n_invalid'\n );\n },\n ];\n }\n\n /** URL of the `fx:native_integrations` collection for the store. */\n nativeIntegrations: string | null = null;\n\n /** URL of the `fx:countries` property helper resource. */\n countries: string | null = null;\n\n /** URL of the `fx:regions` property helper resource. */\n regions: string | null = null;\n\n private __countrySetValue = (newValue: string) => {\n this.edit({ country: newValue, region: '', city: '' });\n this.edit({ apply_to_shipping: this.__isApplyToShippingHidden });\n };\n\n private __regionSetValue = (newValue: string) => {\n this.edit({ region: newValue, city: '' });\n };\n\n private __typeSetValue = (newValue: Data['type']) => {\n this.edit({\n type: newValue,\n country: '',\n region: '',\n city: '',\n // @ts-expect-error SDK types are not up to date.\n service_provider: newValue === 'custom_tax_endpoint' ? 'custom_tax' : '',\n apply_to_shipping: false,\n use_origin_rates: false,\n exempt_all_customer_tax_ids: false,\n is_live: false,\n rate: 0,\n });\n };\n\n private readonly __typeOptions = JSON.stringify([\n { label: 'option_custom_tax_endpoint', value: 'custom_tax_endpoint' },\n { label: 'option_global', value: 'global' },\n { label: 'option_union', value: 'union' },\n { label: 'option_country', value: 'country' },\n { label: 'option_region', value: 'region' },\n { label: 'option_local', value: 'local' },\n ]);\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n alwaysMatch.unshift('native-integrations');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n const type = this.form.type as string | undefined;\n\n if (type === 'global' || type === 'custom_tax_endpoint') {\n alwaysMatch.unshift('group-one:is-live', 'group-one:service-provider');\n if (type === 'custom_tax_endpoint') alwaysMatch.unshift('group-one:rate');\n } else {\n if (this.form.is_live) {\n alwaysMatch.unshift('group-one:rate');\n } else {\n alwaysMatch.unshift('group-one:service-provider');\n }\n }\n\n if (this.__nativeIntegrationsUrl === void 0) alwaysMatch.unshift('native-integrations');\n if (this.__isCountryHidden) alwaysMatch.unshift('group-three:country');\n if (this.__isRegionHidden) {\n alwaysMatch.unshift('group-three:region-select', 'group-three:region-input');\n }\n\n if (this.__isCityHidden) alwaysMatch.unshift('group-three:city');\n if (this.__isApplyToShippingHidden) alwaysMatch.unshift('group-two:apply-to-shipping');\n if (this.__isUseOriginRatesHidden) alwaysMatch.unshift('group-two:use-origin-rates');\n if (this.__isExemptAllCustomerTaxIdsHidden) {\n alwaysMatch.unshift('group-two:exempt-all-customer-tax-ids');\n }\n\n const regions = Object.values(this.__regionsLoader?.data?.values ?? {});\n alwaysMatch.unshift(`group-three:region-${regions.length ? 'input' : 'select'}`);\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const countries = Object.values(this.__countriesLoader?.data?.values ?? {});\n const countryOptions = countries.map(c => ({ rawLabel: c.default, value: c.cc2 }));\n\n const regions = Object.values(this.__regionsLoader?.data?.values ?? {});\n const regionOptions = regions.map(r => ({ rawLabel: r.default, value: r.code }));\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"group-one\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n options=${this.__typeOptions}\n layout=\"summary-item\"\n infer=\"type\"\n .setValue=${this.__typeSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control infer=\"is-live\"></foxy-internal-switch-control>\n\n <foxy-internal-select-control\n options=${JSON.stringify(this.__serviceProviderOptions)}\n layout=\"summary-item\"\n infer=\"service-provider\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-number-control layout=\"summary-item\" suffix=\"%\" infer=\"rate\" min=\"0\">\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n infer=\"native-integrations\"\n first=${ifDefined(this.__nativeIntegrationsUrl)}\n item=\"foxy-native-integration-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"group-two\">\n <foxy-internal-switch-control infer=\"exempt-all-customer-tax-ids\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"apply-to-shipping\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"use-origin-rates\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"group-three\">\n <foxy-internal-select-control\n options=${JSON.stringify(countryOptions)}\n layout=\"summary-item\"\n infer=\"country\"\n .setValue=${this.__countrySetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n property=\"region\"\n options=${JSON.stringify(regionOptions)}\n layout=\"summary-item\"\n infer=\"region-select\"\n .setValue=${this.__regionSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n property=\"region\"\n layout=\"summary-item\"\n infer=\"region-input\"\n .setValue=${this.__regionSetValue}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"city\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.countries ?? void 0)}\n id=\"countriesLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.__regionsUrl)}\n id=\"regionsLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __serviceProviderOptions() {\n const options = [\n { label: 'option_avalara', value: 'avalara' },\n { label: 'option_onesource', value: 'onesource' },\n ];\n\n if (\n this.form.type === 'union' ||\n !this.form.country ||\n defaultLiveRateCountries.includes(this.form.country)\n ) {\n options.unshift({ label: 'option_default', value: 'default' });\n }\n\n if (\n this.form.type === 'union' ||\n !this.form.country ||\n taxJarLiveRateCountries.includes(this.form.country)\n ) {\n options.push({ label: 'option_taxjar', value: 'taxjar' });\n }\n\n return options;\n }\n\n private get __nativeIntegrationsUrl() {\n try {\n const url = new URL(this.nativeIntegrations ?? '');\n const provider = this.form.service_provider;\n if (provider) {\n url.searchParams.set('provider', provider);\n return url.toString();\n }\n } catch {\n // do nothing\n }\n }\n\n private get __regionsUrl() {\n try {\n const regionsURL = new URL(this.regions ?? '');\n const country = this.form.country;\n if (country) regionsURL.searchParams.set('country_code', country);\n return regionsURL.toString();\n } catch {\n // do nothing\n }\n }\n\n private get __countriesLoader() {\n type Loader = NucleonElement<Resource<Rels.Countries>>;\n return this.renderRoot.querySelector<Loader>('#countriesLoader');\n }\n\n private get __regionsLoader() {\n type Loader = NucleonElement<Resource<Rels.Regions>>;\n return this.renderRoot.querySelector<Loader>('#regionsLoader');\n }\n\n private get __isExemptAllCustomerTaxIdsHidden() {\n const type = this.form.type as string | undefined;\n if (type === 'custom_tax_endpoint') return true;\n if (type === 'country' || type === 'region' || type === 'local') return !!this.form.is_live;\n\n const provider = this.form.service_provider as string | undefined;\n return !provider || provider === 'onesource' || provider === 'avalara' || provider === 'taxjar';\n }\n\n private get __isApplyToShippingHidden() {\n const type = this.form.type as string | undefined;\n\n if (!type || type === 'custom_tax_endpoint') return true;\n if (type === 'union') return false;\n if (type === 'country' && this.form.is_live) return true;\n if (type === 'region' && this.form.is_live) return true;\n\n return !!this.form.is_live && defaultLiveRateCountries.includes(this.form.country);\n }\n\n private get __isUseOriginRatesHidden() {\n return this.form.type !== 'union' || !this.form.is_live || !!this.form.service_provider;\n }\n\n private get __isCountryHidden() {\n if (this.form.type === 'union') {\n return (!this.form.service_provider || this.form.is_live) && !this.form.use_origin_rates;\n } else {\n return !(['country', 'region', 'local'] as unknown[]).includes(this.form.type);\n }\n }\n\n private get __isRegionHidden() {\n return this.form.type !== 'local' && this.form.type !== 'region';\n }\n\n private get __isCityHidden() {\n return this.form.type !== 'local';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TaxForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxForm/TaxForm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,UAAU,CAAC;AACtB,MAAM,IAAI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3B,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;YAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;SAC1F;aAAM;YACL,OAAO,CAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAChF;IACH,CAAC;IAED,IAAY,gBAAgB;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACnE,CAAC;IAED,IAAY,cAAc;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;IACpC,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'tax-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n// prettier-ignore\nconst defaultLiveRateCountries: (string | undefined)[] = ['US', 'CA', 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IM', 'IT', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'];\nconst taxJarLiveRateCountries = [...defaultLiveRateCountries, 'AU'];\n\n/**\n * Form element for creating or editing taxes (`fx:tax`).\n *\n * @element foxy-tax-form\n * @since 1.13.0\n */\nexport class TaxForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n nativeIntegrations: { attribute: 'native-integrations' },\n countries: {},\n regions: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 30 || 'name:v8n_too_long',\n ({ country: c, type: t }) => t !== 'country' || !!c || 'country:v8n_required',\n ({ country: c, type: t }) => t !== 'region' || !!c || 'country:v8n_required',\n ({ country: c, use_origin_rates: r }) => !r || !!c || 'country:v8n_required',\n ({ region: v, type: t }) => t != 'region' || !!v || 'region:v8n_required',\n ({ region: v }) => !v || v.length <= 20 || 'region:v8n_too_long',\n ({ city: v }) => !v || v.length <= 50 || 'city:v8n_too_long',\n ({ city: c, type: t }) => t != 'local' || !!c || 'city:v8n_required',\n ({ rate: v, type, is_live }) => {\n return (\n v === void 0 ||\n v > 0 ||\n // @ts-expect-error SDK types are not up to date.\n type === 'custom_tax_endpoint' ||\n type === void 0 ||\n is_live ||\n 'rate:v8n_invalid'\n );\n },\n ];\n }\n\n /** URL of the `fx:native_integrations` collection for the store. */\n nativeIntegrations: string | null = null;\n\n /** URL of the `fx:countries` property helper resource. */\n countries: string | null = null;\n\n /** URL of the `fx:regions` property helper resource. */\n regions: string | null = null;\n\n private __countrySetValue = (newValue: string) => {\n this.edit({ country: newValue, region: '', city: '' });\n this.edit({ apply_to_shipping: this.__isApplyToShippingHidden });\n };\n\n private __regionSetValue = (newValue: string) => {\n this.edit({ region: newValue, city: '' });\n };\n\n private __typeSetValue = (newValue: Data['type']) => {\n this.edit({\n type: newValue,\n country: '',\n region: '',\n city: '',\n // @ts-expect-error SDK types are not up to date.\n service_provider: newValue === 'custom_tax_endpoint' ? 'custom_tax' : '',\n apply_to_shipping: false,\n use_origin_rates: false,\n exempt_all_customer_tax_ids: false,\n is_live: false,\n rate: 0,\n });\n };\n\n private readonly __typeOptions = JSON.stringify([\n { label: 'option_custom_tax_endpoint', value: 'custom_tax_endpoint' },\n { label: 'option_global', value: 'global' },\n { label: 'option_union', value: 'union' },\n { label: 'option_country', value: 'country' },\n { label: 'option_region', value: 'region' },\n { label: 'option_local', value: 'local' },\n ]);\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n alwaysMatch.unshift('native-integrations');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n const type = this.form.type as string | undefined;\n\n if (type === 'global' || type === 'custom_tax_endpoint') {\n alwaysMatch.unshift('group-one:is-live', 'group-one:service-provider');\n if (type === 'custom_tax_endpoint') alwaysMatch.unshift('group-one:rate');\n } else {\n if (this.form.is_live) {\n alwaysMatch.unshift('group-one:rate');\n } else {\n alwaysMatch.unshift('group-one:service-provider');\n }\n }\n\n if (this.__nativeIntegrationsUrl === void 0) alwaysMatch.unshift('native-integrations');\n if (this.__isCountryHidden) alwaysMatch.unshift('group-three:country');\n if (this.__isRegionHidden) {\n alwaysMatch.unshift('group-three:region-select', 'group-three:region-input');\n }\n\n if (this.__isCityHidden) alwaysMatch.unshift('group-three:city');\n if (this.__isApplyToShippingHidden) alwaysMatch.unshift('group-two:apply-to-shipping');\n if (this.__isUseOriginRatesHidden) alwaysMatch.unshift('group-two:use-origin-rates');\n if (this.__isExemptAllCustomerTaxIdsHidden) {\n alwaysMatch.unshift('group-two:exempt-all-customer-tax-ids');\n }\n\n const regions = Object.values(this.__regionsLoader?.data?.values ?? {});\n alwaysMatch.unshift(`group-three:region-${regions.length ? 'input' : 'select'}`);\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const countries = Object.values(this.__countriesLoader?.data?.values ?? {});\n const countryOptions = countries.map(c => ({ rawLabel: c.default, value: c.cc2 }));\n\n const regions = Object.values(this.__regionsLoader?.data?.values ?? {});\n const regionOptions = regions.map(r => ({ rawLabel: r.default, value: r.code }));\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"group-one\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n options=${this.__typeOptions}\n layout=\"summary-item\"\n infer=\"type\"\n .setValue=${this.__typeSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control infer=\"is-live\"></foxy-internal-switch-control>\n\n <foxy-internal-select-control\n options=${JSON.stringify(this.__serviceProviderOptions)}\n layout=\"summary-item\"\n infer=\"service-provider\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-number-control layout=\"summary-item\" suffix=\"%\" infer=\"rate\" min=\"0\">\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n infer=\"native-integrations\"\n first=${ifDefined(this.__nativeIntegrationsUrl)}\n item=\"foxy-native-integration-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"group-two\">\n <foxy-internal-switch-control infer=\"exempt-all-customer-tax-ids\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"apply-to-shipping\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"use-origin-rates\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"group-three\">\n <foxy-internal-select-control\n options=${JSON.stringify(countryOptions)}\n layout=\"summary-item\"\n infer=\"country\"\n .setValue=${this.__countrySetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n property=\"region\"\n options=${JSON.stringify(regionOptions)}\n layout=\"summary-item\"\n infer=\"region-select\"\n .setValue=${this.__regionSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n property=\"region\"\n layout=\"summary-item\"\n infer=\"region-input\"\n .setValue=${this.__regionSetValue}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control layout=\"summary-item\" infer=\"city\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.countries ?? void 0)}\n id=\"countriesLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.__regionsUrl)}\n id=\"regionsLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __serviceProviderOptions() {\n const options = [\n { label: 'option_avalara', value: 'avalara' },\n { label: 'option_onesource', value: 'onesource' },\n ];\n\n if (\n this.form.type === 'union' ||\n !this.form.country ||\n defaultLiveRateCountries.includes(this.form.country)\n ) {\n options.unshift({ label: 'option_default', value: '' });\n }\n\n if (\n this.form.type === 'union' ||\n !this.form.country ||\n taxJarLiveRateCountries.includes(this.form.country)\n ) {\n options.push({ label: 'option_taxjar', value: 'taxjar' });\n }\n\n return options;\n }\n\n private get __nativeIntegrationsUrl() {\n try {\n const url = new URL(this.nativeIntegrations ?? '');\n const provider = this.form.service_provider;\n if (provider) {\n url.searchParams.set('provider', provider);\n return url.toString();\n }\n } catch {\n // do nothing\n }\n }\n\n private get __regionsUrl() {\n try {\n const regionsURL = new URL(this.regions ?? '');\n const country = this.form.country;\n if (country) regionsURL.searchParams.set('country_code', country);\n return regionsURL.toString();\n } catch {\n // do nothing\n }\n }\n\n private get __countriesLoader() {\n type Loader = NucleonElement<Resource<Rels.Countries>>;\n return this.renderRoot.querySelector<Loader>('#countriesLoader');\n }\n\n private get __regionsLoader() {\n type Loader = NucleonElement<Resource<Rels.Regions>>;\n return this.renderRoot.querySelector<Loader>('#regionsLoader');\n }\n\n private get __isExemptAllCustomerTaxIdsHidden() {\n const type = this.form.type as string | undefined;\n if (type === 'custom_tax_endpoint') return true;\n if (type === 'country' || type === 'region' || type === 'local') return !!this.form.is_live;\n\n const provider = this.form.service_provider as string | undefined;\n return !provider || provider === 'onesource' || provider === 'avalara' || provider === 'taxjar';\n }\n\n private get __isApplyToShippingHidden() {\n const type = this.form.type as string | undefined;\n\n if (!type || type === 'custom_tax_endpoint') return true;\n if (type === 'union') return false;\n if (type === 'country' && this.form.is_live) return true;\n if (type === 'region' && this.form.is_live) return true;\n\n return !!this.form.is_live && defaultLiveRateCountries.includes(this.form.country);\n }\n\n private get __isUseOriginRatesHidden() {\n return this.form.type !== 'union' || !this.form.is_live || !!this.form.service_provider;\n }\n\n private get __isCountryHidden() {\n if (this.form.type === 'union') {\n return (!this.form.service_provider || this.form.is_live) && !this.form.use_origin_rates;\n } else {\n return !(['country', 'region', 'local'] as unknown[]).includes(this.form.type);\n }\n }\n\n private get __isRegionHidden() {\n return this.form.type !== 'local' && this.form.type !== 'region';\n }\n\n private get __isCityHidden() {\n return this.form.type !== 'local';\n }\n}\n"]}
|
|
@@ -14,9 +14,9 @@ declare const Base: typeof InternalForm & import("lit-element").Constructor<impo
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class TemplateConfigForm extends Base<Data> {
|
|
16
16
|
static get properties(): PropertyDeclarations;
|
|
17
|
-
/** URI of the `fx:countries` hAPI resource
|
|
17
|
+
/** URI of the `fx:countries` hAPI resource with `?include_regions=true`. */
|
|
18
18
|
countries: string | null;
|
|
19
|
-
/** URI of the `fx:regions` hAPI resource. */
|
|
19
|
+
/** @deprecated URI of the `fx:regions` hAPI resource. */
|
|
20
20
|
regions: string | null;
|
|
21
21
|
/** URI of the `fx:store` hAPI resource related to this template config. If this property is `null`, a link relationship will be used when available. */
|
|
22
22
|
store: string | null;
|
|
@@ -16,9 +16,9 @@ const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
|
|
|
16
16
|
export class TemplateConfigForm extends Base {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
/** URI of the `fx:countries` hAPI resource
|
|
19
|
+
/** URI of the `fx:countries` hAPI resource with `?include_regions=true`. */
|
|
20
20
|
this.countries = null;
|
|
21
|
-
/** URI of the `fx:regions` hAPI resource. */
|
|
21
|
+
/** @deprecated URI of the `fx:regions` hAPI resource. */
|
|
22
22
|
this.regions = null;
|
|
23
23
|
/** URI of the `fx:store` hAPI resource related to this template config. If this property is `null`, a link relationship will be used when available. */
|
|
24
24
|
this.store = null;
|
|
@@ -181,7 +181,7 @@ export class TemplateConfigForm extends Base {
|
|
|
181
181
|
return new BooleanSelector(alwaysHidden.join(' ').trim());
|
|
182
182
|
}
|
|
183
183
|
renderBody() {
|
|
184
|
-
var _a, _b, _c, _d, _e
|
|
184
|
+
var _a, _b, _c, _d, _e;
|
|
185
185
|
const customCheckoutFieldRequirementsControls = [
|
|
186
186
|
[
|
|
187
187
|
'billing_address1',
|
|
@@ -356,7 +356,6 @@ export class TemplateConfigForm extends Base {
|
|
|
356
356
|
json-path="location_filtering.shipping_filter_values"
|
|
357
357
|
countries=${ifDefined((_a = this.countries) !== null && _a !== void 0 ? _a : void 0)}
|
|
358
358
|
property="json"
|
|
359
|
-
regions=${ifDefined((_b = this.regions) !== null && _b !== void 0 ? _b : void 0)}
|
|
360
359
|
infer="location-filtering-filter-values"
|
|
361
360
|
.setValue=${this.__locationFilteringFilterValuesSetValue}
|
|
362
361
|
>
|
|
@@ -377,9 +376,8 @@ export class TemplateConfigForm extends Base {
|
|
|
377
376
|
<foxy-internal-template-config-form-filter-values-control
|
|
378
377
|
json-template=${this.__defaultJSON}
|
|
379
378
|
json-path="location_filtering.shipping_filter_values"
|
|
380
|
-
countries=${ifDefined((
|
|
379
|
+
countries=${ifDefined((_b = this.countries) !== null && _b !== void 0 ? _b : void 0)}
|
|
381
380
|
property="json"
|
|
382
|
-
regions=${ifDefined((_d = this.regions) !== null && _d !== void 0 ? _d : void 0)}
|
|
383
381
|
infer="location-filtering-shipping-filter-values"
|
|
384
382
|
>
|
|
385
383
|
</foxy-internal-template-config-form-filter-values-control>
|
|
@@ -399,9 +397,8 @@ export class TemplateConfigForm extends Base {
|
|
|
399
397
|
<foxy-internal-template-config-form-filter-values-control
|
|
400
398
|
json-template=${this.__defaultJSON}
|
|
401
399
|
json-path="location_filtering.billing_filter_values"
|
|
402
|
-
countries=${ifDefined((
|
|
400
|
+
countries=${ifDefined((_c = this.countries) !== null && _c !== void 0 ? _c : void 0)}
|
|
403
401
|
property="json"
|
|
404
|
-
regions=${ifDefined((_f = this.regions) !== null && _f !== void 0 ? _f : void 0)}
|
|
405
402
|
infer="location-filtering-billing-filter-values"
|
|
406
403
|
>
|
|
407
404
|
</foxy-internal-template-config-form-filter-values-control>
|
|
@@ -718,7 +715,7 @@ export class TemplateConfigForm extends Base {
|
|
|
718
715
|
<foxy-nucleon
|
|
719
716
|
class="hidden"
|
|
720
717
|
infer=""
|
|
721
|
-
href=${ifDefined((
|
|
718
|
+
href=${ifDefined((_d = this.store) !== null && _d !== void 0 ? _d : (_e = this.data) === null || _e === void 0 ? void 0 : _e._links['fx:store'].href)}
|
|
722
719
|
id="storeLoader"
|
|
723
720
|
@update=${() => this.requestUpdate()}
|
|
724
721
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateConfigForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/TemplateConfigForm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,sBAAmB;AAC5C,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,e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aAAa;;;;;;;;;;0BAUlB,IAAI,CAAC,aAAa;;;;;;;;;0BASlB,IAAI,CAAC,aAAa;;;;;;;;;YAShC,GAAG,CAAA,iWAAiW;;;;;;;;;;;;;;;;;;;0BAmBtV,IAAI,CAAC,aAAa;;;;;;;;;;;;oBAYxB,IAAI,CAAC,sBAAsB;oBAC3B,IAAI,CAAC,sBAAsB;;;;;wBAKvB,IAAI,CAAC,aAAa;;;;;;;;wBAQlB,IAAI,CAAC,aAAa;;;;;;;;wBAQlB,IAAI,CAAC,aAAa;;;;;;;;wBAQlB,IAAI,CAAC,aAAa;;;;;;;QAOlC,KAAK,CAAC,UAAU,EAAE;;;;;eAKX,SAAS,OAAC,IAAI,CAAC,KAAK,yCAAI,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAExD,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;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;IACxE,CAAC;IAED,IAAY,UAAU;;QACpB,OAAO,OAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import type { Data, TemplateConfigJSON } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { getDefaultJSON } from './defaults';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'template-config-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing template configs (`fx:template_config`).\n *\n * @element foxy-template-config-form\n * @since 1.14.0\n */\nexport class TemplateConfigForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n countries: {},\n regions: {},\n store: {},\n };\n }\n\n /** URI of the `fx:countries` hAPI resource. */\n countries: string | null = null;\n\n /** URI of the `fx:regions` hAPI resource. */\n regions: string | null = null;\n\n /** URI of the `fx:store` hAPI resource related to this template config. If this property is `null`, a link relationship will be used when available. */\n store: string | null = null;\n\n private readonly __customCheckoutFieldCouponEntryRequirementsOptions = JSON.stringify([\n { label: 'option_enabled', value: 'enabled' },\n { label: 'option_disabled', value: 'disabled' },\n ]);\n\n private readonly __customCheckoutFieldRequirementsOptions = JSON.stringify([\n { label: 'option_default', value: 'default' },\n { label: 'option_optional', value: 'optional' },\n { label: 'option_required', value: 'required' },\n { label: 'option_hidden', value: 'hidden' },\n ]);\n\n private readonly __tosCheckboxSettingsInitialStateOptions = JSON.stringify([\n { label: 'option_checked', value: 'checked' },\n { label: 'option_unchecked', value: 'unchecked' },\n ]);\n\n private readonly __locationFilteringFilterTypeOptions = JSON.stringify([\n { label: 'option_blocklist', value: 'blacklist' },\n { label: 'option_allowlist', value: 'whitelist' },\n ]);\n\n private readonly __foxycompleteShowComboboxOptions = JSON.stringify([\n { label: 'option_combobox', value: 'combobox' },\n { label: 'option_search', value: 'search' },\n ]);\n\n private readonly __tosCheckboxSettingsUsageOptions = JSON.stringify([\n { label: 'option_none', value: 'none' },\n { label: 'option_optional', value: 'optional' },\n { label: 'option_required', value: 'required' },\n ]);\n\n private readonly __locationFilteringUsageOptions = JSON.stringify([\n { label: 'option_none', value: 'none' },\n { label: 'option_shipping', value: 'shipping' },\n { label: 'option_billing', value: 'billing' },\n { label: 'option_both', value: 'both' },\n { label: 'option_independent', value: 'independent' },\n ]);\n\n private readonly __cscRequirementsValueOptions = JSON.stringify([\n { label: 'option_all_cards', value: 'all_cards' },\n { label: 'option_sso_only', value: 'sso_only' },\n { label: 'option_new_cards_only', value: 'new_cards_only' },\n ]);\n\n private readonly __checkoutTypeDefaultOptions = JSON.stringify([\n { label: 'option_default_account', value: 'default_account' },\n { label: 'option_default_guest', value: 'default_guest' },\n ]);\n\n private readonly __checkoutTypeAccountOptions = JSON.stringify([\n { label: 'option_account', value: 'account_only' },\n { label: 'option_guest', value: 'guest_only' },\n { label: 'option_both', value: 'default_guest' },\n ]);\n\n private readonly __cartTypeOptions = JSON.stringify([\n { label: 'option_default', value: 'default' },\n { label: 'option_fullpage', value: 'fullpage' },\n { label: 'option_custom', value: 'custom' },\n ]);\n\n private readonly __locationFilteringFilterValuesSetValue = (\n newValue: Record<string, '*' | string[]>\n ) => {\n const formJson = this.__formJson;\n const newConfig = {\n ...formJson.location_filtering,\n shipping_filter_values: newValue,\n billing_filter_values: newValue,\n };\n\n this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newConfig }) });\n };\n\n private readonly __locationFilteringFilterTypeSetValue = (value: string) => {\n const formJson = this.__formJson;\n const newValue = {\n ...formJson.location_filtering,\n shipping_filter_type: value,\n billing_filter_type: value,\n };\n\n this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newValue }) });\n };\n\n private readonly __foxycompleteShowComboboxGetValue = () => {\n return this.__formJson.foxycomplete.show_combobox ? 'combobox' : 'search';\n };\n\n private readonly __foxycompleteShowComboboxSetValue = (value: string) => {\n const newValue = value === 'combobox';\n const foxycomplete = { ...this.__formJson.foxycomplete, show_combobox: newValue };\n this.edit({ json: JSON.stringify({ ...this.__formJson, foxycomplete }) });\n };\n\n private readonly __checkoutTypeAccountGetValue = () => {\n const formJson = this.__formJson;\n return formJson.checkout_type.includes('default') ? 'default_guest' : formJson.checkout_type;\n };\n\n private readonly __customConfigGetValue = () => {\n const formJson = this.__formJson;\n if (typeof formJson.custom_config === 'string') return formJson.custom_config;\n return JSON.stringify(formJson.custom_config, null, 2);\n };\n\n private readonly __customConfigSetValue = (newValue: string) => {\n const formJson = this.__formJson;\n\n try {\n formJson.custom_config = JSON.parse(newValue);\n } catch {\n formJson.custom_config = newValue;\n }\n\n this.edit({ json: JSON.stringify(formJson) });\n };\n\n private readonly __defaultJSON = JSON.stringify(getDefaultJSON());\n\n get hiddenSelector(): BooleanSelector {\n const alwaysHidden = [super.hiddenSelector.toString()];\n\n const dataJson = this.__dataJson;\n const formJson = this.__formJson;\n\n const locationFilteringUsage = formJson.location_filtering.usage;\n const checkoutType = formJson.checkout_type;\n\n if (formJson.cart_display_config.usage !== 'required') {\n alwaysHidden.unshift('cart-group-two', 'cart-group-three', 'cart-group-four');\n }\n\n if (formJson.foxycomplete.usage !== 'required') {\n alwaysHidden.unshift(\n 'country-and-region-group-one:foxycomplete-show-combobox',\n 'country-and-region-group-one:foxycomplete-combobox-open',\n 'country-and-region-group-one:foxycomplete-combobox-close',\n 'country-and-region-group-one:foxycomplete-show-flags'\n );\n }\n\n if (formJson.foxycomplete.show_combobox === false) {\n alwaysHidden.unshift(\n 'country-and-region-group-one:foxycomplete-combobox-open',\n 'country-and-region-group-one:foxycomplete-combobox-close'\n );\n }\n\n if (locationFilteringUsage !== 'both') {\n alwaysHidden.unshift('country-and-region-group-two');\n }\n\n if (locationFilteringUsage !== 'shipping' && locationFilteringUsage !== 'independent') {\n alwaysHidden.unshift('country-and-region-group-three');\n }\n\n if (locationFilteringUsage !== 'billing' && locationFilteringUsage !== 'independent') {\n alwaysHidden.unshift('country-and-region-group-four');\n }\n\n if (checkoutType !== 'default_account' && checkoutType !== 'default_guest') {\n alwaysHidden.unshift('customer-accounts:checkout-type-default');\n }\n\n if (formJson.tos_checkbox_settings.usage === 'none') {\n alwaysHidden.unshift(\n 'consent-group-one:tos-checkbox-settings-url',\n 'consent-group-one:tos-checkbox-settings-initial-state',\n 'consent-group-one:tos-checkbox-settings-is-hidden'\n );\n }\n\n if (formJson.analytics_config.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-analytics', 'analytics-config-google-tag');\n }\n\n if (dataJson?.analytics_config.google_analytics.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-analytics');\n }\n\n if (formJson.analytics_config.google_analytics.usage !== 'required') {\n alwaysHidden.unshift(\n 'analytics-config-google-analytics:analytics-config-google-analytics-account-id',\n 'analytics-config-google-analytics:analytics-config-google-analytics-include-on-site'\n );\n }\n\n if (formJson.analytics_config.google_tag.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-account-id');\n alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-send-to');\n }\n\n if (this.__storeLoader?.data?.features_multiship !== true) {\n alwaysHidden.unshift('custom-script-values-multiship-checkout-fields');\n }\n\n return new BooleanSelector(alwaysHidden.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const customCheckoutFieldRequirementsControls = [\n [\n 'billing_address1',\n 'billing_address2',\n 'billing_city',\n 'billing_region',\n 'billing_postal_code',\n 'billing_country',\n ],\n [\n 'billing_first_name',\n 'billing_last_name',\n 'billing_company',\n 'billing_tax_id',\n 'billing_phone',\n 'coupon_entry',\n ],\n ];\n\n const cartDisplayConfigFields = [\n ['show_product_weight', 'show_product_category', 'show_product_code', 'show_product_options'],\n ['show_sub_frequency', 'show_sub_startdate', 'show_sub_nextdate', 'show_sub_enddate'],\n ];\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"cart-group-one\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_type\"\n property=\"json\"\n options=${this.__cartTypeOptions}\n layout=\"summary-item\"\n infer=\"cart-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"cart_display_config.usage\"\n property=\"json\"\n infer=\"cart-display-config-usage\"\n invert\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <div\n class=\"grid sm-grid-cols-2 gap-m\"\n ?hidden=${cartDisplayConfigFields.every((group, index) => {\n return group.every(prop => {\n const suffix = index === 0 ? 'two' : 'three';\n const sel = `cart-group-${suffix}:cart-display-config-${prop.replace(/_/g, '-')}`;\n return this.hiddenSelector.matches(sel, true);\n });\n })}\n >\n ${cartDisplayConfigFields.map((group, index) => {\n const suffix = index === 0 ? 'two' : 'three';\n return html`\n <foxy-internal-summary-control infer=\"cart-group-${suffix}\">\n ${group.map(prop => {\n return html`\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_display_config.${prop}\"\n property=\"json\"\n infer=\"cart-display-config-${prop.replace(/_/g, '-')}\"\n >\n </foxy-internal-switch-control>\n `;\n })}\n </foxy-internal-summary-control>\n `;\n })}\n </div>\n\n <foxy-internal-summary-control infer=\"cart-group-four\">\n <foxy-internal-editable-list-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_display_config.hidden_product_options\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"cart-display-config-hidden-product-options\"\n simple-value\n >\n </foxy-internal-editable-list-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-one\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"foxycomplete.usage\"\n property=\"json\"\n infer=\"foxycomplete-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-select-control\n options=${this.__foxycompleteShowComboboxOptions}\n layout=\"summary-item\"\n infer=\"foxycomplete-show-combobox\"\n .getValue=${this.__foxycompleteShowComboboxGetValue}\n .setValue=${this.__foxycompleteShowComboboxSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.combobox_open\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"foxycomplete-combobox-open\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.combobox_close\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"foxycomplete-combobox-close\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.show_flags\"\n property=\"json\"\n infer=\"foxycomplete-show-flags\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"enabled\"\n json-path=\"postal_code_lookup.usage\"\n property=\"json\"\n infer=\"postal-code-lookup\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.usage\"\n property=\"json\"\n options=${this.__locationFilteringUsageOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-usage\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-two\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-filter-type\"\n .setValue=${this.__locationFilteringFilterTypeSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n regions=${ifDefined(this.regions ?? void 0)}\n infer=\"location-filtering-filter-values\"\n .setValue=${this.__locationFilteringFilterValuesSetValue}\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-three\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-shipping-filter-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n regions=${ifDefined(this.regions ?? void 0)}\n infer=\"location-filtering-shipping-filter-values\"\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-four\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.billing_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-billing-filter-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.billing_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n regions=${ifDefined(this.regions ?? void 0)}\n infer=\"location-filtering-billing-filter-values\"\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"customer-accounts\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"checkout_type\"\n property=\"json\"\n options=${this.__checkoutTypeAccountOptions}\n layout=\"summary-item\"\n infer=\"checkout-type-account\"\n .getValue=${this.__checkoutTypeAccountGetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"checkout_type\"\n property=\"json\"\n options=${this.__checkoutTypeDefaultOptions}\n layout=\"summary-item\"\n infer=\"checkout-type-default\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-one\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.usage\"\n property=\"json\"\n options=${this.__tosCheckboxSettingsUsageOptions}\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-usage\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.url\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-url\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.initial_state\"\n property=\"json\"\n options=${this.__tosCheckboxSettingsInitialStateOptions}\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-initial-state\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.is_hidden\"\n property=\"json\"\n infer=\"tos-checkbox-settings-is-hidden\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-two\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"eu_secure_data_transfer_consent.usage\"\n property=\"json\"\n infer=\"eu-secure-data-transfer-consent-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-three\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"newsletter_subscribe.usage\"\n property=\"json\"\n infer=\"newsletter-subscribe-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"supported-cards-group\">\n <foxy-internal-template-config-form-supported-cards-control\n json-template=${this.__defaultJSON}\n json-path=\"supported_payment_cards\"\n property=\"json\"\n infer=\"supported-payment-cards\"\n >\n </foxy-internal-template-config-form-supported-cards-control>\n\n <p class=\"flex items-start gap-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-primary\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <foxy-i18n infer=\"\" key=\"disclaimer\"></foxy-i18n>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"csc-requirements-group\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"csc_requirements\"\n property=\"json\"\n options=${this.__cscRequirementsValueOptions}\n layout=\"summary-item\"\n infer=\"csc-requirements\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"checkout-fields-group-one\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"disabled\"\n true-alias=\"enabled\"\n json-path=\"custom_checkout_field_requirements.cart_controls\"\n property=\"json\"\n infer=\"custom-checkout-field-requirements-cart-controls\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <div\n class=\"grid sm-grid-cols-2 gap-m\"\n ?hidden=${customCheckoutFieldRequirementsControls.every((group, index) => {\n return group.every(prop => {\n const suffix = index === 0 ? 'two' : 'three';\n const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');\n const sel = `checkout-fields-group-${suffix}:custom-checkout-field-requirements-${infer}`;\n return this.hiddenSelector.matches(sel, true);\n });\n })}\n >\n ${customCheckoutFieldRequirementsControls.map((group, index) => {\n const suffix = index === 0 ? 'two' : 'three';\n return html`\n <foxy-internal-summary-control infer=\"checkout-fields-group-${suffix}\">\n ${group.map(prop => {\n const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');\n const path = `custom_checkout_field_requirements.${prop}`;\n return html`\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=${path}\n property=\"json\"\n options=${prop === 'coupon_entry'\n ? this.__customCheckoutFieldCouponEntryRequirementsOptions\n : this.__customCheckoutFieldRequirementsOptions}\n layout=\"summary-item\"\n infer=\"custom-checkout-field-requirements-${infer}\"\n >\n </foxy-internal-select-control>\n `;\n })}\n </foxy-internal-summary-control>\n `;\n })}\n </div>\n\n <foxy-internal-summary-control infer=\"analytics-config\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.usage\"\n property=\"json\"\n infer=\"analytics-config-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"analytics-config-google-analytics\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.google_analytics.usage\"\n property=\"json\"\n infer=\"analytics-config-google-analytics-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_analytics.account_id\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-analytics-account-id\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_analytics.include_on_site\"\n property=\"json\"\n infer=\"analytics-config-google-analytics-include-on-site\"\n >\n </foxy-internal-switch-control>\n\n <p class=\"flex items-start gap-s bg-error-10 text-error\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-error\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <foxy-i18n infer=\"\" key=\"deprecation_notice\"></foxy-i18n>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"analytics-config-google-tag\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.google_tag.usage\"\n property=\"json\"\n infer=\"analytics-config-google-tag-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_tag.account_id\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-tag-account-id\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_tag.send_to\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-tag-send-to\"\n >\n </foxy-internal-text-control>\n\n <p class=\"flex items-start gap-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-primary\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <span>\n <foxy-i18n infer=\"\" key=\"usage_notice\"></foxy-i18n>\n <br />\n <a\n target=\"_blank\"\n class=\"cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=\"https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads\"\n rel=\"nofollow noreferrer noopener\"\n >\n <foxy-i18n class=\"transition-opacity group-hover-opacity-80\" infer=\"\" key=\"docs_link\">\n </foxy-i18n>\n </a>\n </span>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"debug\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"debug.usage\"\n property=\"json\"\n infer=\"debug-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control\n infer=\"custom-config\"\n .getValue=${this.__customConfigGetValue}\n .setValue=${this.__customConfigSetValue}\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.header\"\n property=\"json\"\n infer=\"custom-script-values-header\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.checkout_fields\"\n property=\"json\"\n infer=\"custom-script-values-checkout-fields\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.multiship_checkout_fields\"\n property=\"json\"\n infer=\"custom-script-values-multiship-checkout-fields\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.footer\"\n property=\"json\"\n infer=\"custom-script-values-footer\"\n >\n </foxy-internal-source-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store ?? 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 private get __formJson(): TemplateConfigJSON {\n return this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();\n }\n\n private get __dataJson(): TemplateConfigJSON | null {\n return this.data?.json ? JSON.parse(this.data.json) : null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TemplateConfigForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/TemplateConfigForm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,sBAAmB;AAC5C,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAAlD;;QAUE,4EAA4E;QAC5E,cAAS,GAAkB,IAAI,CAAC;QAEhC,yDAAyD;QACzD,YAAO,GAAkB,IAAI,CAAC;QAE9B,wJAAwJ;QACxJ,UAAK,GAAkB,IAAI,CAAC;QAEX,wDAAmD,GAAG,IAAI,CAAC,SAAS,CAAC;YACpF,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;YAC7C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE;SAChD,CAAC,CAAC;QAEc,6CAAwC,GAAG,IAAI,CAAC,SAAS,CAAC;YACzE,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;YAC7C,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE;YAC/C,EAAE,KAAK,EAAE,iBAAiB,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Ac,EAAE,CAAC;IACxE,CAAC;IAED,IAAY,UAAU;;QACpB,OAAO,OAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import type { Data, TemplateConfigJSON } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { getDefaultJSON } from './defaults';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'template-config-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing template configs (`fx:template_config`).\n *\n * @element foxy-template-config-form\n * @since 1.14.0\n */\nexport class TemplateConfigForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n countries: {},\n regions: {},\n store: {},\n };\n }\n\n /** URI of the `fx:countries` hAPI resource with `?include_regions=true`. */\n countries: string | null = null;\n\n /** @deprecated URI of the `fx:regions` hAPI resource. */\n regions: string | null = null;\n\n /** URI of the `fx:store` hAPI resource related to this template config. If this property is `null`, a link relationship will be used when available. */\n store: string | null = null;\n\n private readonly __customCheckoutFieldCouponEntryRequirementsOptions = JSON.stringify([\n { label: 'option_enabled', value: 'enabled' },\n { label: 'option_disabled', value: 'disabled' },\n ]);\n\n private readonly __customCheckoutFieldRequirementsOptions = JSON.stringify([\n { label: 'option_default', value: 'default' },\n { label: 'option_optional', value: 'optional' },\n { label: 'option_required', value: 'required' },\n { label: 'option_hidden', value: 'hidden' },\n ]);\n\n private readonly __tosCheckboxSettingsInitialStateOptions = JSON.stringify([\n { label: 'option_checked', value: 'checked' },\n { label: 'option_unchecked', value: 'unchecked' },\n ]);\n\n private readonly __locationFilteringFilterTypeOptions = JSON.stringify([\n { label: 'option_blocklist', value: 'blacklist' },\n { label: 'option_allowlist', value: 'whitelist' },\n ]);\n\n private readonly __foxycompleteShowComboboxOptions = JSON.stringify([\n { label: 'option_combobox', value: 'combobox' },\n { label: 'option_search', value: 'search' },\n ]);\n\n private readonly __tosCheckboxSettingsUsageOptions = JSON.stringify([\n { label: 'option_none', value: 'none' },\n { label: 'option_optional', value: 'optional' },\n { label: 'option_required', value: 'required' },\n ]);\n\n private readonly __locationFilteringUsageOptions = JSON.stringify([\n { label: 'option_none', value: 'none' },\n { label: 'option_shipping', value: 'shipping' },\n { label: 'option_billing', value: 'billing' },\n { label: 'option_both', value: 'both' },\n { label: 'option_independent', value: 'independent' },\n ]);\n\n private readonly __cscRequirementsValueOptions = JSON.stringify([\n { label: 'option_all_cards', value: 'all_cards' },\n { label: 'option_sso_only', value: 'sso_only' },\n { label: 'option_new_cards_only', value: 'new_cards_only' },\n ]);\n\n private readonly __checkoutTypeDefaultOptions = JSON.stringify([\n { label: 'option_default_account', value: 'default_account' },\n { label: 'option_default_guest', value: 'default_guest' },\n ]);\n\n private readonly __checkoutTypeAccountOptions = JSON.stringify([\n { label: 'option_account', value: 'account_only' },\n { label: 'option_guest', value: 'guest_only' },\n { label: 'option_both', value: 'default_guest' },\n ]);\n\n private readonly __cartTypeOptions = JSON.stringify([\n { label: 'option_default', value: 'default' },\n { label: 'option_fullpage', value: 'fullpage' },\n { label: 'option_custom', value: 'custom' },\n ]);\n\n private readonly __locationFilteringFilterValuesSetValue = (\n newValue: Record<string, '*' | string[]>\n ) => {\n const formJson = this.__formJson;\n const newConfig = {\n ...formJson.location_filtering,\n shipping_filter_values: newValue,\n billing_filter_values: newValue,\n };\n\n this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newConfig }) });\n };\n\n private readonly __locationFilteringFilterTypeSetValue = (value: string) => {\n const formJson = this.__formJson;\n const newValue = {\n ...formJson.location_filtering,\n shipping_filter_type: value,\n billing_filter_type: value,\n };\n\n this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newValue }) });\n };\n\n private readonly __foxycompleteShowComboboxGetValue = () => {\n return this.__formJson.foxycomplete.show_combobox ? 'combobox' : 'search';\n };\n\n private readonly __foxycompleteShowComboboxSetValue = (value: string) => {\n const newValue = value === 'combobox';\n const foxycomplete = { ...this.__formJson.foxycomplete, show_combobox: newValue };\n this.edit({ json: JSON.stringify({ ...this.__formJson, foxycomplete }) });\n };\n\n private readonly __checkoutTypeAccountGetValue = () => {\n const formJson = this.__formJson;\n return formJson.checkout_type.includes('default') ? 'default_guest' : formJson.checkout_type;\n };\n\n private readonly __customConfigGetValue = () => {\n const formJson = this.__formJson;\n if (typeof formJson.custom_config === 'string') return formJson.custom_config;\n return JSON.stringify(formJson.custom_config, null, 2);\n };\n\n private readonly __customConfigSetValue = (newValue: string) => {\n const formJson = this.__formJson;\n\n try {\n formJson.custom_config = JSON.parse(newValue);\n } catch {\n formJson.custom_config = newValue;\n }\n\n this.edit({ json: JSON.stringify(formJson) });\n };\n\n private readonly __defaultJSON = JSON.stringify(getDefaultJSON());\n\n get hiddenSelector(): BooleanSelector {\n const alwaysHidden = [super.hiddenSelector.toString()];\n\n const dataJson = this.__dataJson;\n const formJson = this.__formJson;\n\n const locationFilteringUsage = formJson.location_filtering.usage;\n const checkoutType = formJson.checkout_type;\n\n if (formJson.cart_display_config.usage !== 'required') {\n alwaysHidden.unshift('cart-group-two', 'cart-group-three', 'cart-group-four');\n }\n\n if (formJson.foxycomplete.usage !== 'required') {\n alwaysHidden.unshift(\n 'country-and-region-group-one:foxycomplete-show-combobox',\n 'country-and-region-group-one:foxycomplete-combobox-open',\n 'country-and-region-group-one:foxycomplete-combobox-close',\n 'country-and-region-group-one:foxycomplete-show-flags'\n );\n }\n\n if (formJson.foxycomplete.show_combobox === false) {\n alwaysHidden.unshift(\n 'country-and-region-group-one:foxycomplete-combobox-open',\n 'country-and-region-group-one:foxycomplete-combobox-close'\n );\n }\n\n if (locationFilteringUsage !== 'both') {\n alwaysHidden.unshift('country-and-region-group-two');\n }\n\n if (locationFilteringUsage !== 'shipping' && locationFilteringUsage !== 'independent') {\n alwaysHidden.unshift('country-and-region-group-three');\n }\n\n if (locationFilteringUsage !== 'billing' && locationFilteringUsage !== 'independent') {\n alwaysHidden.unshift('country-and-region-group-four');\n }\n\n if (checkoutType !== 'default_account' && checkoutType !== 'default_guest') {\n alwaysHidden.unshift('customer-accounts:checkout-type-default');\n }\n\n if (formJson.tos_checkbox_settings.usage === 'none') {\n alwaysHidden.unshift(\n 'consent-group-one:tos-checkbox-settings-url',\n 'consent-group-one:tos-checkbox-settings-initial-state',\n 'consent-group-one:tos-checkbox-settings-is-hidden'\n );\n }\n\n if (formJson.analytics_config.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-analytics', 'analytics-config-google-tag');\n }\n\n if (dataJson?.analytics_config.google_analytics.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-analytics');\n }\n\n if (formJson.analytics_config.google_analytics.usage !== 'required') {\n alwaysHidden.unshift(\n 'analytics-config-google-analytics:analytics-config-google-analytics-account-id',\n 'analytics-config-google-analytics:analytics-config-google-analytics-include-on-site'\n );\n }\n\n if (formJson.analytics_config.google_tag.usage !== 'required') {\n alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-account-id');\n alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-send-to');\n }\n\n if (this.__storeLoader?.data?.features_multiship !== true) {\n alwaysHidden.unshift('custom-script-values-multiship-checkout-fields');\n }\n\n return new BooleanSelector(alwaysHidden.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const customCheckoutFieldRequirementsControls = [\n [\n 'billing_address1',\n 'billing_address2',\n 'billing_city',\n 'billing_region',\n 'billing_postal_code',\n 'billing_country',\n ],\n [\n 'billing_first_name',\n 'billing_last_name',\n 'billing_company',\n 'billing_tax_id',\n 'billing_phone',\n 'coupon_entry',\n ],\n ];\n\n const cartDisplayConfigFields = [\n ['show_product_weight', 'show_product_category', 'show_product_code', 'show_product_options'],\n ['show_sub_frequency', 'show_sub_startdate', 'show_sub_nextdate', 'show_sub_enddate'],\n ];\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"cart-group-one\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_type\"\n property=\"json\"\n options=${this.__cartTypeOptions}\n layout=\"summary-item\"\n infer=\"cart-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"cart_display_config.usage\"\n property=\"json\"\n infer=\"cart-display-config-usage\"\n invert\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <div\n class=\"grid sm-grid-cols-2 gap-m\"\n ?hidden=${cartDisplayConfigFields.every((group, index) => {\n return group.every(prop => {\n const suffix = index === 0 ? 'two' : 'three';\n const sel = `cart-group-${suffix}:cart-display-config-${prop.replace(/_/g, '-')}`;\n return this.hiddenSelector.matches(sel, true);\n });\n })}\n >\n ${cartDisplayConfigFields.map((group, index) => {\n const suffix = index === 0 ? 'two' : 'three';\n return html`\n <foxy-internal-summary-control infer=\"cart-group-${suffix}\">\n ${group.map(prop => {\n return html`\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_display_config.${prop}\"\n property=\"json\"\n infer=\"cart-display-config-${prop.replace(/_/g, '-')}\"\n >\n </foxy-internal-switch-control>\n `;\n })}\n </foxy-internal-summary-control>\n `;\n })}\n </div>\n\n <foxy-internal-summary-control infer=\"cart-group-four\">\n <foxy-internal-editable-list-control\n json-template=${this.__defaultJSON}\n json-path=\"cart_display_config.hidden_product_options\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"cart-display-config-hidden-product-options\"\n simple-value\n >\n </foxy-internal-editable-list-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-one\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"foxycomplete.usage\"\n property=\"json\"\n infer=\"foxycomplete-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-select-control\n options=${this.__foxycompleteShowComboboxOptions}\n layout=\"summary-item\"\n infer=\"foxycomplete-show-combobox\"\n .getValue=${this.__foxycompleteShowComboboxGetValue}\n .setValue=${this.__foxycompleteShowComboboxSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.combobox_open\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"foxycomplete-combobox-open\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.combobox_close\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"foxycomplete-combobox-close\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"foxycomplete.show_flags\"\n property=\"json\"\n infer=\"foxycomplete-show-flags\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"enabled\"\n json-path=\"postal_code_lookup.usage\"\n property=\"json\"\n infer=\"postal-code-lookup\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.usage\"\n property=\"json\"\n options=${this.__locationFilteringUsageOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-usage\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-two\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-filter-type\"\n .setValue=${this.__locationFilteringFilterTypeSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n infer=\"location-filtering-filter-values\"\n .setValue=${this.__locationFilteringFilterValuesSetValue}\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-three\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-shipping-filter-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.shipping_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n infer=\"location-filtering-shipping-filter-values\"\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"country-and-region-group-four\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.billing_filter_type\"\n property=\"json\"\n options=${this.__locationFilteringFilterTypeOptions}\n layout=\"summary-item\"\n infer=\"location-filtering-billing-filter-type\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-template-config-form-filter-values-control\n json-template=${this.__defaultJSON}\n json-path=\"location_filtering.billing_filter_values\"\n countries=${ifDefined(this.countries ?? void 0)}\n property=\"json\"\n infer=\"location-filtering-billing-filter-values\"\n >\n </foxy-internal-template-config-form-filter-values-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"customer-accounts\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"checkout_type\"\n property=\"json\"\n options=${this.__checkoutTypeAccountOptions}\n layout=\"summary-item\"\n infer=\"checkout-type-account\"\n .getValue=${this.__checkoutTypeAccountGetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"checkout_type\"\n property=\"json\"\n options=${this.__checkoutTypeDefaultOptions}\n layout=\"summary-item\"\n infer=\"checkout-type-default\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-one\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.usage\"\n property=\"json\"\n options=${this.__tosCheckboxSettingsUsageOptions}\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-usage\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.url\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-url\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.initial_state\"\n property=\"json\"\n options=${this.__tosCheckboxSettingsInitialStateOptions}\n layout=\"summary-item\"\n infer=\"tos-checkbox-settings-initial-state\"\n >\n </foxy-internal-select-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"tos_checkbox_settings.is_hidden\"\n property=\"json\"\n infer=\"tos-checkbox-settings-is-hidden\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-two\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"eu_secure_data_transfer_consent.usage\"\n property=\"json\"\n infer=\"eu-secure-data-transfer-consent-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"consent-group-three\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"newsletter_subscribe.usage\"\n property=\"json\"\n infer=\"newsletter-subscribe-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"supported-cards-group\">\n <foxy-internal-template-config-form-supported-cards-control\n json-template=${this.__defaultJSON}\n json-path=\"supported_payment_cards\"\n property=\"json\"\n infer=\"supported-payment-cards\"\n >\n </foxy-internal-template-config-form-supported-cards-control>\n\n <p class=\"flex items-start gap-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-primary\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <foxy-i18n infer=\"\" key=\"disclaimer\"></foxy-i18n>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"csc-requirements-group\">\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=\"csc_requirements\"\n property=\"json\"\n options=${this.__cscRequirementsValueOptions}\n layout=\"summary-item\"\n infer=\"csc-requirements\"\n >\n </foxy-internal-select-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"checkout-fields-group-one\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"disabled\"\n true-alias=\"enabled\"\n json-path=\"custom_checkout_field_requirements.cart_controls\"\n property=\"json\"\n infer=\"custom-checkout-field-requirements-cart-controls\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <div\n class=\"grid sm-grid-cols-2 gap-m\"\n ?hidden=${customCheckoutFieldRequirementsControls.every((group, index) => {\n return group.every(prop => {\n const suffix = index === 0 ? 'two' : 'three';\n const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');\n const sel = `checkout-fields-group-${suffix}:custom-checkout-field-requirements-${infer}`;\n return this.hiddenSelector.matches(sel, true);\n });\n })}\n >\n ${customCheckoutFieldRequirementsControls.map((group, index) => {\n const suffix = index === 0 ? 'two' : 'three';\n return html`\n <foxy-internal-summary-control infer=\"checkout-fields-group-${suffix}\">\n ${group.map(prop => {\n const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');\n const path = `custom_checkout_field_requirements.${prop}`;\n return html`\n <foxy-internal-select-control\n json-template=${this.__defaultJSON}\n json-path=${path}\n property=\"json\"\n options=${prop === 'coupon_entry'\n ? this.__customCheckoutFieldCouponEntryRequirementsOptions\n : this.__customCheckoutFieldRequirementsOptions}\n layout=\"summary-item\"\n infer=\"custom-checkout-field-requirements-${infer}\"\n >\n </foxy-internal-select-control>\n `;\n })}\n </foxy-internal-summary-control>\n `;\n })}\n </div>\n\n <foxy-internal-summary-control infer=\"analytics-config\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.usage\"\n property=\"json\"\n infer=\"analytics-config-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"analytics-config-google-analytics\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.google_analytics.usage\"\n property=\"json\"\n infer=\"analytics-config-google-analytics-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_analytics.account_id\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-analytics-account-id\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_analytics.include_on_site\"\n property=\"json\"\n infer=\"analytics-config-google-analytics-include-on-site\"\n >\n </foxy-internal-switch-control>\n\n <p class=\"flex items-start gap-s bg-error-10 text-error\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-error\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <foxy-i18n infer=\"\" key=\"deprecation_notice\"></foxy-i18n>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"analytics-config-google-tag\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"analytics_config.google_tag.usage\"\n property=\"json\"\n infer=\"analytics-config-google-tag-usage\"\n >\n </foxy-internal-switch-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_tag.account_id\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-tag-account-id\"\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n json-template=${this.__defaultJSON}\n json-path=\"analytics_config.google_tag.send_to\"\n property=\"json\"\n layout=\"summary-item\"\n infer=\"analytics-config-google-tag-send-to\"\n >\n </foxy-internal-text-control>\n\n <p class=\"flex items-start gap-s\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0 text-primary\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z\" clip-rule=\"evenodd\"></path></svg>`}\n <span>\n <foxy-i18n infer=\"\" key=\"usage_notice\"></foxy-i18n>\n <br />\n <a\n target=\"_blank\"\n class=\"cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=\"https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads\"\n rel=\"nofollow noreferrer noopener\"\n >\n <foxy-i18n class=\"transition-opacity group-hover-opacity-80\" infer=\"\" key=\"docs_link\">\n </foxy-i18n>\n </a>\n </span>\n </p>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"debug\">\n <foxy-internal-switch-control\n json-template=${this.__defaultJSON}\n false-alias=\"none\"\n true-alias=\"required\"\n json-path=\"debug.usage\"\n property=\"json\"\n infer=\"debug-usage\"\n >\n </foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-source-control\n infer=\"custom-config\"\n .getValue=${this.__customConfigGetValue}\n .setValue=${this.__customConfigSetValue}\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.header\"\n property=\"json\"\n infer=\"custom-script-values-header\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.checkout_fields\"\n property=\"json\"\n infer=\"custom-script-values-checkout-fields\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.multiship_checkout_fields\"\n property=\"json\"\n infer=\"custom-script-values-multiship-checkout-fields\"\n >\n </foxy-internal-source-control>\n\n <foxy-internal-source-control\n json-template=${this.__defaultJSON}\n json-path=\"custom_script_values.footer\"\n property=\"json\"\n infer=\"custom-script-values-footer\"\n >\n </foxy-internal-source-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store ?? 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 private get __formJson(): TemplateConfigJSON {\n return this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();\n }\n\n private get __dataJson(): TemplateConfigJSON | null {\n return this.data?.json ? JSON.parse(this.data.json) : null;\n }\n}\n"]}
|
|
@@ -4,7 +4,6 @@ import { TemplateResult } from 'lit-html';
|
|
|
4
4
|
export declare class InternalTemplateConfigFormFilterValuesControl extends InternalEditableControl {
|
|
5
5
|
static get properties(): PropertyDeclarations;
|
|
6
6
|
countries: string | null;
|
|
7
|
-
regions: string | null;
|
|
8
7
|
private __newCountry;
|
|
9
8
|
renderControl(): TemplateResult;
|
|
10
9
|
private __addCountry;
|