@foxy.io/elements 1.14.0-beta.3 → 1.14.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-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +9 -9
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +2 -2
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +4 -4
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +14 -0
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-14788132.js → shared-00563cb0.js} +1 -1
- package/dist/cdn/shared-0ced76a0.js +358 -0
- package/dist/cdn/{shared-302d8a7b.js → shared-106daaca.js} +1 -1
- package/dist/cdn/{shared-c7f352fa.js → shared-10bdb6b9.js} +5 -5
- package/dist/cdn/{shared-2d99835c.js → shared-1469c1c4.js} +1 -1
- package/dist/cdn/{shared-d196432b.js → shared-16f72e27.js} +1 -1
- package/dist/cdn/{shared-82dd0556.js → shared-1761daef.js} +1 -1
- package/dist/cdn/shared-18459dcd.js +264 -0
- package/dist/cdn/{shared-a21a7562.js → shared-1b7e65e4.js} +1 -1
- package/dist/cdn/{shared-3534b284.js → shared-200f613b.js} +1 -1
- package/dist/cdn/{shared-57522229.js → shared-2174bcd4.js} +1 -1
- package/dist/cdn/{shared-3e14c0d2.js → shared-218ba06e.js} +1 -1
- package/dist/cdn/{shared-acf49ecc.js → shared-34b2c1e2.js} +1 -1
- package/dist/cdn/{shared-72678c5d.js → shared-3d868b17.js} +1 -1
- package/dist/cdn/{shared-b8349f79.js → shared-44cfc617.js} +1 -1
- package/dist/cdn/shared-4a52d9b5.js +1 -0
- package/dist/cdn/shared-4be4e513.js +314 -0
- package/dist/cdn/{shared-a4410f22.js → shared-593f7e2c.js} +1 -1
- package/dist/cdn/{shared-d19e2399.js → shared-59e44f29.js} +1 -1
- package/dist/cdn/{shared-84df58e1.js → shared-614e1a4e.js} +1 -1
- package/dist/cdn/{shared-d97a6ee5.js → shared-63eaded9.js} +3 -3
- package/dist/cdn/{shared-7fd12533.js → shared-6b7602c7.js} +1 -1
- package/dist/cdn/{shared-94c83b2b.js → shared-6d45a07b.js} +1 -1
- package/dist/cdn/{shared-dd66b354.js → shared-7a39a41f.js} +1 -1
- package/dist/cdn/{shared-652ef7fe.js → shared-9221e6b2.js} +1 -1
- package/dist/cdn/{shared-59a0cb0f.js → shared-94b0ae99.js} +1 -1
- package/dist/cdn/{shared-bbc97ae0.js → shared-9d779f46.js} +1 -1
- package/dist/cdn/{shared-3553ff4d.js → shared-a46edf4b.js} +1 -1
- package/dist/cdn/{shared-27d93838.js → shared-b0f0e8b5.js} +1 -1
- package/dist/cdn/shared-b28a59de.js +1 -0
- package/dist/cdn/{shared-8e38d64f.js → shared-b710881a.js} +2 -2
- package/dist/cdn/{shared-dce03b47.js → shared-bb824ab4.js} +1 -1
- package/dist/cdn/shared-c4b96261.js +1 -0
- package/dist/cdn/{shared-2b2b56f6.js → shared-d94ffc2b.js} +1 -1
- package/dist/cdn/shared-df573cea.js +12 -0
- package/dist/cdn/{shared-fda14a3d.js → shared-e7f8ffe9.js} +1 -1
- package/dist/cdn/{shared-92442eb1.js → shared-ec861f31.js} +1 -1
- package/dist/cdn/{shared-a71bd9f0.js → shared-f0a83bd6.js} +1 -1
- package/dist/cdn/{shared-e969772e.js → shared-fb90e05c.js} +1 -1
- package/dist/cdn/translations/shared/en.json +41 -1
- package/dist/elements/private/Group/Group.js +1 -1
- package/dist/elements/private/Group/Group.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +23 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +129 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +20 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +125 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +25 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +529 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/defaults.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js +95 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/index.d.ts +9 -0
- package/dist/elements/public/TemplateConfigForm/index.js +11 -0
- package/dist/elements/public/TemplateConfigForm/index.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/types.d.ts +116 -0
- package/dist/elements/public/TemplateConfigForm/types.js +2 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -0
- package/dist/elements/public/index.d.ts +1 -0
- package/dist/elements/public/index.defined.d.ts +1 -0
- package/dist/elements/public/index.defined.js +1 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +1 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +51 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-04b77f79.js +0 -369
- package/dist/cdn/shared-1108653b.js +0 -577
- package/dist/cdn/shared-4ee97558.js +0 -1
- package/dist/cdn/shared-a0c2bbe0.js +0 -1
- package/dist/cdn/shared-bec929ac.js +0 -1
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { ChoiceChangeEvent } from "../../private/events.js";
|
|
2
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
3
|
+
import { html } from 'lit-html';
|
|
4
|
+
import { Checkbox } from "../../private/Checkbox/Checkbox.js";
|
|
5
|
+
import { Choice } from "../../private/Choice/Choice.js";
|
|
6
|
+
import { ConfigurableMixin } from "../../../mixins/configurable.js";
|
|
7
|
+
import { CountriesList } from "./CountriesList.js";
|
|
8
|
+
import { Group } from "../../private/Group/Group.js";
|
|
9
|
+
import { NucleonElement } from "../NucleonElement/NucleonElement.js";
|
|
10
|
+
import { ResponsiveMixin } from "../../../mixins/responsive.js";
|
|
11
|
+
import { ThemeableMixin } from "../../../mixins/themeable.js";
|
|
12
|
+
import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
13
|
+
import { classMap } from "../../../utils/class-map.js";
|
|
14
|
+
import { getDefaultJSON } from "./defaults.js";
|
|
15
|
+
import { live } from 'lit-html/directives/live';
|
|
16
|
+
const NS = 'template-config-form';
|
|
17
|
+
const Base = ScopedElementsMixin(ResponsiveMixin(ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)))));
|
|
18
|
+
export class TemplateConfigForm extends Base {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.countries = '';
|
|
22
|
+
this.regions = '';
|
|
23
|
+
this.__addHiddenFieldInputValue = '';
|
|
24
|
+
}
|
|
25
|
+
static get scopedElements() {
|
|
26
|
+
return {
|
|
27
|
+
'vaadin-text-field': customElements.get('vaadin-text-field'),
|
|
28
|
+
'vaadin-text-area': customElements.get('vaadin-text-area'),
|
|
29
|
+
'iron-icon': customElements.get('iron-icon'),
|
|
30
|
+
'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
|
|
31
|
+
'foxy-spinner': customElements.get('foxy-spinner'),
|
|
32
|
+
'foxy-i18n': customElements.get('foxy-i18n'),
|
|
33
|
+
'x-countries-list': CountriesList,
|
|
34
|
+
'x-checkbox': Checkbox,
|
|
35
|
+
'x-choice': Choice,
|
|
36
|
+
'x-group': Group,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
static get properties() {
|
|
40
|
+
return {
|
|
41
|
+
...super.properties,
|
|
42
|
+
__addHiddenFieldInputValue: { attribute: false },
|
|
43
|
+
countries: { type: String },
|
|
44
|
+
regions: { type: String },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const hidden = this.hiddenControls;
|
|
50
|
+
const json = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();
|
|
51
|
+
return html `
|
|
52
|
+
<div class="relative" aria-busy=${this.in('busy')} aria-live="polite">
|
|
53
|
+
<div
|
|
54
|
+
class=${classMap({
|
|
55
|
+
'space-y-l transition-opacity': true,
|
|
56
|
+
'opacity-50': !this.in('idle'),
|
|
57
|
+
})}
|
|
58
|
+
>
|
|
59
|
+
${hidden.matches('cart-type', true) ? '' : this.__renderCartType(json)}
|
|
60
|
+
${hidden.matches('foxycomplete', true) ? '' : this.__renderFoxycomplete(json)}
|
|
61
|
+
${hidden.matches('locations', true) ? '' : this.__renderLocations(json)}
|
|
62
|
+
${hidden.matches('hidden-fields', true) ? '' : this.__renderHiddenFields(json)}
|
|
63
|
+
${hidden.matches('header', true) ? '' : this.__renderHeader(json)}
|
|
64
|
+
${hidden.matches('footer', true) ? '' : this.__renderFooter(json)}
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div
|
|
68
|
+
class=${classMap({
|
|
69
|
+
'transition duration-500 ease-in-out absolute inset-0 flex': true,
|
|
70
|
+
'opacity-0 pointer-events-none': this.in('idle'),
|
|
71
|
+
})}
|
|
72
|
+
>
|
|
73
|
+
<foxy-spinner
|
|
74
|
+
layout="vertical"
|
|
75
|
+
class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
|
|
76
|
+
state=${this.in('fail') ? 'error' : 'busy'}
|
|
77
|
+
lang=${this.lang}
|
|
78
|
+
ns="${this.ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
|
|
79
|
+
>
|
|
80
|
+
</foxy-spinner>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
__renderCartType(json) {
|
|
86
|
+
const { lang, ns } = this;
|
|
87
|
+
const items = ['default', 'fullpage', 'custom'];
|
|
88
|
+
return html `
|
|
89
|
+
<div>
|
|
90
|
+
${this.renderTemplateOrSlot('cart-type:before')}
|
|
91
|
+
|
|
92
|
+
<x-group frame>
|
|
93
|
+
<foxy-i18n slot="header" lang=${lang} key="cart_type" ns=${ns}></foxy-i18n>
|
|
94
|
+
|
|
95
|
+
<x-choice
|
|
96
|
+
.value=${json.cart_type}
|
|
97
|
+
.items=${items}
|
|
98
|
+
?disabled=${this.disabledSelector.matches('cart-type', true)}
|
|
99
|
+
?readonly=${this.readonlySelector.matches('cart-type', true)}
|
|
100
|
+
@change=${(evt) => {
|
|
101
|
+
this.edit({ json: JSON.stringify({ ...json, cart_type: evt.detail }) });
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
${items.map(item => {
|
|
105
|
+
return html `
|
|
106
|
+
<div slot="${item}-label" class="grid leading-s py-s">
|
|
107
|
+
<foxy-i18n lang=${lang} key="cart_type_${item}" ns=${ns}></foxy-i18n>
|
|
108
|
+
<foxy-i18n
|
|
109
|
+
class="text-tertiary text-s"
|
|
110
|
+
lang=${lang}
|
|
111
|
+
key="cart_type_${item}_explainer"
|
|
112
|
+
ns=${ns}
|
|
113
|
+
>
|
|
114
|
+
</foxy-i18n>
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
})}
|
|
118
|
+
</x-choice>
|
|
119
|
+
</x-group>
|
|
120
|
+
|
|
121
|
+
${this.renderTemplateOrSlot('cart-type:after')}
|
|
122
|
+
</div>
|
|
123
|
+
`;
|
|
124
|
+
}
|
|
125
|
+
__renderFoxycomplete(json) {
|
|
126
|
+
const { lang, ns } = this;
|
|
127
|
+
const isDisabled = this.disabledSelector.matches('foxycomplete', true);
|
|
128
|
+
const isReadonly = this.readonlySelector.matches('foxycomplete', true);
|
|
129
|
+
const items = ['combobox', 'search', 'disabled'];
|
|
130
|
+
const value = json.foxycomplete.usage === 'none'
|
|
131
|
+
? 'disabled'
|
|
132
|
+
: json.foxycomplete.show_combobox
|
|
133
|
+
? 'combobox'
|
|
134
|
+
: 'search';
|
|
135
|
+
const renderFlagsCheckbox = () => html `
|
|
136
|
+
<x-checkbox
|
|
137
|
+
?disabled=${isDisabled}
|
|
138
|
+
?readonly=${isReadonly}
|
|
139
|
+
?checked=${json.foxycomplete.show_flags}
|
|
140
|
+
@change=${(evt) => {
|
|
141
|
+
const newConfig = {
|
|
142
|
+
...json.foxycomplete,
|
|
143
|
+
show_flags: evt.detail,
|
|
144
|
+
};
|
|
145
|
+
this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<foxy-i18n lang=${lang} key="show_country_flags" ns=${ns}></foxy-i18n>
|
|
149
|
+
</x-checkbox>
|
|
150
|
+
`;
|
|
151
|
+
return html `
|
|
152
|
+
<div>
|
|
153
|
+
${this.renderTemplateOrSlot('foxycomplete:before')}
|
|
154
|
+
|
|
155
|
+
<x-group frame>
|
|
156
|
+
<foxy-i18n slot="header" lang=${lang} key="foxycomplete" ns=${ns}></foxy-i18n>
|
|
157
|
+
|
|
158
|
+
<x-choice
|
|
159
|
+
.value=${value}
|
|
160
|
+
.items=${items}
|
|
161
|
+
?disabled=${isDisabled}
|
|
162
|
+
?readonly=${isReadonly}
|
|
163
|
+
@change=${(evt) => {
|
|
164
|
+
if (!(evt instanceof ChoiceChangeEvent))
|
|
165
|
+
return;
|
|
166
|
+
const newConfig = {
|
|
167
|
+
...json.foxycomplete,
|
|
168
|
+
usage: evt.detail === 'disabled' ? 'none' : 'required',
|
|
169
|
+
show_combobox: evt.detail === 'combobox',
|
|
170
|
+
};
|
|
171
|
+
this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
${items.map(item => {
|
|
175
|
+
return html `
|
|
176
|
+
<div slot="${item}-label" class="grid leading-s py-s">
|
|
177
|
+
<foxy-i18n lang=${lang} key="foxycomplete_${item}" ns=${ns}></foxy-i18n>
|
|
178
|
+
<foxy-i18n
|
|
179
|
+
class="text-tertiary text-s"
|
|
180
|
+
lang=${lang}
|
|
181
|
+
key="foxycomplete_${item}_explainer"
|
|
182
|
+
ns=${ns}
|
|
183
|
+
>
|
|
184
|
+
</foxy-i18n>
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
187
|
+
})}
|
|
188
|
+
|
|
189
|
+
<div slot="combobox" class="space-y-m pb-s" ?hidden=${value !== 'combobox'}>
|
|
190
|
+
<div class="grid grid-cols-2 gap-m" style="max-width: 16rem">
|
|
191
|
+
${['open', 'close'].map(action => {
|
|
192
|
+
const field = action === 'open' ? 'combobox_open' : 'combobox_close';
|
|
193
|
+
return html `
|
|
194
|
+
<vaadin-text-field
|
|
195
|
+
label=${this.t(`${action}_icon`)}
|
|
196
|
+
.value=${json.foxycomplete[field]}
|
|
197
|
+
?disabled=${isDisabled}
|
|
198
|
+
?readonly=${isReadonly}
|
|
199
|
+
@input=${(evt) => {
|
|
200
|
+
const target = evt.currentTarget;
|
|
201
|
+
const newConfig = {
|
|
202
|
+
...json.foxycomplete,
|
|
203
|
+
[field]: target.value,
|
|
204
|
+
};
|
|
205
|
+
this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });
|
|
206
|
+
}}
|
|
207
|
+
>
|
|
208
|
+
</vaadin-text-field>
|
|
209
|
+
`;
|
|
210
|
+
})}
|
|
211
|
+
</div>
|
|
212
|
+
|
|
213
|
+
${renderFlagsCheckbox()}
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div slot="search" class="pb-s" ?hidden=${value !== 'search'}>
|
|
217
|
+
${renderFlagsCheckbox()}
|
|
218
|
+
</div>
|
|
219
|
+
</x-choice>
|
|
220
|
+
|
|
221
|
+
<div class="border-t border-contrast-10 p-m">
|
|
222
|
+
<x-checkbox
|
|
223
|
+
?disabled=${isDisabled}
|
|
224
|
+
?readonly=${isReadonly}
|
|
225
|
+
?checked=${json.postal_code_lookup.usage === 'enabled'}
|
|
226
|
+
@change=${(evt) => {
|
|
227
|
+
const newConfig = {
|
|
228
|
+
usage: evt.detail ? 'enabled' : 'none',
|
|
229
|
+
};
|
|
230
|
+
this.edit({ json: JSON.stringify({ ...json, postal_code_lookup: newConfig }) });
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
<foxy-i18n lang=${lang} key="enable_postcode_lookup" ns=${ns}></foxy-i18n>
|
|
234
|
+
</x-checkbox>
|
|
235
|
+
</div>
|
|
236
|
+
</x-group>
|
|
237
|
+
|
|
238
|
+
${this.renderTemplateOrSlot('foxycomplete:after')}
|
|
239
|
+
</div>
|
|
240
|
+
`;
|
|
241
|
+
}
|
|
242
|
+
__renderLocations(json) {
|
|
243
|
+
const { lang, ns } = this;
|
|
244
|
+
const config = json.location_filtering;
|
|
245
|
+
const shippingChoice = config.shipping_filter_type === 'blacklist' ? 'block' : 'allow';
|
|
246
|
+
const billingChoice = config.usage === 'both'
|
|
247
|
+
? 'copy'
|
|
248
|
+
: config.billing_filter_type === 'blacklist'
|
|
249
|
+
? 'block'
|
|
250
|
+
: 'allow';
|
|
251
|
+
const normalize = () => {
|
|
252
|
+
if (config.usage === 'both') {
|
|
253
|
+
config.billing_filter_type = config.shipping_filter_type;
|
|
254
|
+
config.billing_filter_values = config.shipping_filter_values;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
const hasBillingFilters = Object.keys(config.billing_filter_values).length > 0;
|
|
258
|
+
const hasShippingFilters = Object.keys(config.shipping_filter_values).length > 0;
|
|
259
|
+
if (!hasBillingFilters && !hasShippingFilters) {
|
|
260
|
+
config.usage = 'none';
|
|
261
|
+
}
|
|
262
|
+
else if (hasBillingFilters && !hasShippingFilters) {
|
|
263
|
+
config.usage = 'billing';
|
|
264
|
+
}
|
|
265
|
+
else if (hasShippingFilters && !hasBillingFilters) {
|
|
266
|
+
config.usage = 'shipping';
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
config.usage = 'independent';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return html `
|
|
274
|
+
${this.renderTemplateOrSlot('locations:before')}
|
|
275
|
+
|
|
276
|
+
<x-group frame>
|
|
277
|
+
<foxy-i18n slot="header" lang=${lang} key="location_plural" ns=${ns}></foxy-i18n>
|
|
278
|
+
|
|
279
|
+
<div class="grid sm-grid-cols-2 bg-contrast-10" style="gap: 1px">
|
|
280
|
+
<x-group class="bg-base pt-m">
|
|
281
|
+
<foxy-i18n class="text-tertiary" slot="header" lang=${lang} key="shipping" ns=${ns}>
|
|
282
|
+
</foxy-i18n>
|
|
283
|
+
|
|
284
|
+
<x-choice
|
|
285
|
+
.items=${['allow', 'block']}
|
|
286
|
+
.value=${shippingChoice}
|
|
287
|
+
@change=${(evt) => {
|
|
288
|
+
if (config.usage !== 'both')
|
|
289
|
+
config.usage = 'independent';
|
|
290
|
+
config.shipping_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';
|
|
291
|
+
normalize();
|
|
292
|
+
this.edit({ json: JSON.stringify(json) });
|
|
293
|
+
}}
|
|
294
|
+
>
|
|
295
|
+
<foxy-i18n slot="allow-label" lang=${lang} key="allowlist" ns=${ns}></foxy-i18n>
|
|
296
|
+
<foxy-i18n slot="block-label" lang=${lang} key="blocklist" ns=${ns}></foxy-i18n>
|
|
297
|
+
|
|
298
|
+
<x-countries-list
|
|
299
|
+
countries=${JSON.stringify(config.shipping_filter_values)}
|
|
300
|
+
regions=${this.regions}
|
|
301
|
+
class="mb-m"
|
|
302
|
+
href=${this.countries}
|
|
303
|
+
slot=${shippingChoice}
|
|
304
|
+
lang=${lang}
|
|
305
|
+
ns=${ns}
|
|
306
|
+
?disabled=${this.disabledSelector.matches('locations', true)}
|
|
307
|
+
?readonly=${this.readonlySelector.matches('locations', true)}
|
|
308
|
+
@update:countries=${(evt) => {
|
|
309
|
+
config.shipping_filter_values = evt.currentTarget.countries;
|
|
310
|
+
normalize();
|
|
311
|
+
this.edit({ json: JSON.stringify(json) });
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
</x-countries-list>
|
|
315
|
+
</x-choice>
|
|
316
|
+
</x-group>
|
|
317
|
+
|
|
318
|
+
<x-group class="bg-base pt-m">
|
|
319
|
+
<foxy-i18n class="text-tertiary" slot="header" lang=${lang} key="billing" ns=${ns}>
|
|
320
|
+
</foxy-i18n>
|
|
321
|
+
|
|
322
|
+
<x-choice
|
|
323
|
+
.items=${['allow', 'block', 'copy']}
|
|
324
|
+
.value=${billingChoice}
|
|
325
|
+
@change=${(evt) => {
|
|
326
|
+
if (evt.detail === 'copy') {
|
|
327
|
+
config.usage = 'both';
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
config.usage = 'independent';
|
|
331
|
+
config.billing_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';
|
|
332
|
+
}
|
|
333
|
+
normalize();
|
|
334
|
+
this.edit({ json: JSON.stringify(json) });
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
<foxy-i18n slot="allow-label" lang=${lang} key="allowlist" ns=${ns}></foxy-i18n>
|
|
338
|
+
<foxy-i18n slot="block-label" lang=${lang} key="blocklist" ns=${ns}></foxy-i18n>
|
|
339
|
+
<foxy-i18n slot="copy-label" lang=${lang} key="same_as_shipping" ns=${ns}></foxy-i18n>
|
|
340
|
+
|
|
341
|
+
<x-countries-list
|
|
342
|
+
countries=${JSON.stringify(config.billing_filter_values)}
|
|
343
|
+
regions=${this.regions}
|
|
344
|
+
class="mb-m"
|
|
345
|
+
href=${this.countries}
|
|
346
|
+
slot=${billingChoice}
|
|
347
|
+
lang=${lang}
|
|
348
|
+
ns=${ns}
|
|
349
|
+
?disabled=${this.disabledSelector.matches('locations', true)}
|
|
350
|
+
?readonly=${this.readonlySelector.matches('locations', true)}
|
|
351
|
+
?hidden=${billingChoice === 'copy'}
|
|
352
|
+
@update:countries=${(evt) => {
|
|
353
|
+
config.billing_filter_values = evt.currentTarget.countries;
|
|
354
|
+
normalize();
|
|
355
|
+
this.edit({ json: JSON.stringify(json) });
|
|
356
|
+
}}
|
|
357
|
+
>
|
|
358
|
+
</x-countries-list>
|
|
359
|
+
</x-choice>
|
|
360
|
+
</x-group>
|
|
361
|
+
</div>
|
|
362
|
+
</x-group>
|
|
363
|
+
|
|
364
|
+
${this.renderTemplateOrSlot('locations:after')}
|
|
365
|
+
`;
|
|
366
|
+
}
|
|
367
|
+
__renderHiddenFields(json) {
|
|
368
|
+
const { lang, ns } = this;
|
|
369
|
+
const suggestions = [];
|
|
370
|
+
const fields = [];
|
|
371
|
+
const config = json.cart_display_config;
|
|
372
|
+
for (const key in config) {
|
|
373
|
+
if (!key.startsWith('show_'))
|
|
374
|
+
continue;
|
|
375
|
+
const field = key.substring(5);
|
|
376
|
+
suggestions.push(field);
|
|
377
|
+
if (config.usage === 'required' && !config[key])
|
|
378
|
+
fields.push(field);
|
|
379
|
+
}
|
|
380
|
+
if (config.usage === 'required') {
|
|
381
|
+
fields.push(...config.hidden_product_options);
|
|
382
|
+
}
|
|
383
|
+
const addField = () => {
|
|
384
|
+
config.usage = 'required';
|
|
385
|
+
if (suggestions.includes(this.__addHiddenFieldInputValue)) {
|
|
386
|
+
config[`show_${this.__addHiddenFieldInputValue}`] = false;
|
|
387
|
+
}
|
|
388
|
+
else if (!config.hidden_product_options.includes(this.__addHiddenFieldInputValue)) {
|
|
389
|
+
config.hidden_product_options.push(this.__addHiddenFieldInputValue);
|
|
390
|
+
}
|
|
391
|
+
this.edit({ json: JSON.stringify(json) });
|
|
392
|
+
this.__addHiddenFieldInputValue = '';
|
|
393
|
+
};
|
|
394
|
+
const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';
|
|
395
|
+
const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];
|
|
396
|
+
return html `
|
|
397
|
+
<div>
|
|
398
|
+
${this.renderTemplateOrSlot('hidden-fields:before')}
|
|
399
|
+
|
|
400
|
+
<x-group frame>
|
|
401
|
+
<foxy-i18n slot="header" lang=${lang} key="hidden_fields" ns=${ns}></foxy-i18n>
|
|
402
|
+
|
|
403
|
+
<div class="divide-y divide-contrast-10">
|
|
404
|
+
${fields.map(field => html `
|
|
405
|
+
<div class="h-m ml-m pr-xs flex items-center justify-between">
|
|
406
|
+
${suggestions.includes(field)
|
|
407
|
+
? html `<foxy-i18n lang=${lang} key=${field} ns=${ns}></foxy-i18n>`
|
|
408
|
+
: html `<span>${field}</span>`}
|
|
409
|
+
|
|
410
|
+
<button
|
|
411
|
+
class="flex w-xs h-xs items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50"
|
|
412
|
+
@click=${() => {
|
|
413
|
+
if (typeof config[`show_${field}`] === 'boolean') {
|
|
414
|
+
config[`show_${field}`] = true;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
config.hidden_product_options = config.hidden_product_options.filter(option => option !== field);
|
|
418
|
+
}
|
|
419
|
+
this.edit({ json: JSON.stringify(json) });
|
|
420
|
+
}}
|
|
421
|
+
>
|
|
422
|
+
<iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon>
|
|
423
|
+
</button>
|
|
424
|
+
</div>
|
|
425
|
+
`)}
|
|
426
|
+
</div>
|
|
427
|
+
|
|
428
|
+
<div
|
|
429
|
+
style="border-radius: ${inputRadius.join(' ')}"
|
|
430
|
+
class=${classMap({
|
|
431
|
+
'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,
|
|
432
|
+
'border-t border-contrast-10': fields.length > 0,
|
|
433
|
+
})}
|
|
434
|
+
>
|
|
435
|
+
<input
|
|
436
|
+
placeholder=${this.t('add_field')}
|
|
437
|
+
class="w-full bg-transparent appearance-none h-m px-m focus-outline-none"
|
|
438
|
+
list="hidden-fields-list"
|
|
439
|
+
.value=${live(this.__addHiddenFieldInputValue)}
|
|
440
|
+
@keydown=${(evt) => evt.key === 'Enter' && addField()}
|
|
441
|
+
@input=${(evt) => {
|
|
442
|
+
this.__addHiddenFieldInputValue = evt.currentTarget.value;
|
|
443
|
+
}}
|
|
444
|
+
/>
|
|
445
|
+
|
|
446
|
+
<datalist id="hidden-fields-list">
|
|
447
|
+
${suggestions
|
|
448
|
+
.filter(suggestion => !fields.includes(suggestion))
|
|
449
|
+
.map(suggestion => html `<option value=${suggestion}>${this.t(suggestion)}</option>`)}
|
|
450
|
+
</datalist>
|
|
451
|
+
|
|
452
|
+
<button
|
|
453
|
+
aria-label=${this.t('add_field')}
|
|
454
|
+
class=${classMap({
|
|
455
|
+
'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,
|
|
456
|
+
'flex items-center justify-center rounded-full transition-colors': true,
|
|
457
|
+
'bg-contrast-5 text-disabled cursor-default': !this.__addHiddenFieldInputValue,
|
|
458
|
+
'bg-success-10 text-success cursor-pointer': !!this.__addHiddenFieldInputValue,
|
|
459
|
+
'hover-bg-success hover-text-success-contrast': !!this.__addHiddenFieldInputValue,
|
|
460
|
+
'focus-outline-none focus-ring-2': !!this.__addHiddenFieldInputValue,
|
|
461
|
+
})}
|
|
462
|
+
?disabled=${!this.__addHiddenFieldInputValue}
|
|
463
|
+
@click=${addField}
|
|
464
|
+
>
|
|
465
|
+
<iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon>
|
|
466
|
+
</button>
|
|
467
|
+
</div>
|
|
468
|
+
</x-group>
|
|
469
|
+
|
|
470
|
+
${this.renderTemplateOrSlot('hidden-fields:after')}
|
|
471
|
+
</div>
|
|
472
|
+
`;
|
|
473
|
+
}
|
|
474
|
+
__renderHeader(json) {
|
|
475
|
+
return html `
|
|
476
|
+
<div>
|
|
477
|
+
${this.renderTemplateOrSlot('header:before')}
|
|
478
|
+
|
|
479
|
+
<vaadin-text-area
|
|
480
|
+
class="w-full"
|
|
481
|
+
label=${this.t('custom_header')}
|
|
482
|
+
helper-text=${this.t('custom_header_helper_text')}
|
|
483
|
+
.value=${json.custom_script_values.header}
|
|
484
|
+
?disabled=${this.disabledSelector.matches('header', true)}
|
|
485
|
+
?readonly=${this.readonlySelector.matches('header', true)}
|
|
486
|
+
@input=${(evt) => {
|
|
487
|
+
const target = evt.currentTarget;
|
|
488
|
+
const newConfig = {
|
|
489
|
+
...json.custom_script_values,
|
|
490
|
+
header: target.value,
|
|
491
|
+
};
|
|
492
|
+
this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });
|
|
493
|
+
}}
|
|
494
|
+
>
|
|
495
|
+
</vaadin-text-area>
|
|
496
|
+
|
|
497
|
+
${this.renderTemplateOrSlot('header:after')}
|
|
498
|
+
</div>
|
|
499
|
+
`;
|
|
500
|
+
}
|
|
501
|
+
__renderFooter(json) {
|
|
502
|
+
return html `
|
|
503
|
+
<div>
|
|
504
|
+
${this.renderTemplateOrSlot('footer:before')}
|
|
505
|
+
|
|
506
|
+
<vaadin-text-area
|
|
507
|
+
class="w-full"
|
|
508
|
+
label=${this.t('custom_footer')}
|
|
509
|
+
helper-text=${this.t('custom_footer_helper_text')}
|
|
510
|
+
.value=${json.custom_script_values.footer}
|
|
511
|
+
?disabled=${this.disabledSelector.matches('footer', true)}
|
|
512
|
+
?readonly=${this.readonlySelector.matches('footer', true)}
|
|
513
|
+
@input=${(evt) => {
|
|
514
|
+
const target = evt.currentTarget;
|
|
515
|
+
const newConfig = {
|
|
516
|
+
...json.custom_script_values,
|
|
517
|
+
footer: target.value,
|
|
518
|
+
};
|
|
519
|
+
this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });
|
|
520
|
+
}}
|
|
521
|
+
>
|
|
522
|
+
</vaadin-text-area>
|
|
523
|
+
|
|
524
|
+
${this.renderTemplateOrSlot('footer:after')}
|
|
525
|
+
</div>
|
|
526
|
+
`;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
//# sourceMappingURL=TemplateConfigForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateConfigForm.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/TemplateConfigForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAA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I,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { CheckboxChangeEvent, ChoiceChangeEvent } from '../../private/events';\nimport { Data, TemplateConfigJSON } from './types';\nimport { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { Checkbox } from '../../private/Checkbox/Checkbox';\nimport { Choice } from '../../private/Choice/Choice';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { CountriesList } from './CountriesList';\nimport { Group } from '../../private/Group/Group';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { TextAreaElement } from '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { TextFieldElement } from '@vaadin/vaadin-text-field/vaadin-text-field';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { getDefaultJSON } from './defaults';\nimport { live } from 'lit-html/directives/live';\n\nconst NS = 'template-config-form';\nconst Base = ScopedElementsMixin(\n ResponsiveMixin(ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS))))\n);\n\nexport class TemplateConfigForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-field': customElements.get('vaadin-text-field'),\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'iron-icon': customElements.get('iron-icon'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'x-countries-list': CountriesList,\n 'x-checkbox': Checkbox,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __addHiddenFieldInputValue: { attribute: false },\n countries: { type: String },\n regions: { type: String },\n };\n }\n\n countries = '';\n\n regions = '';\n\n private __addHiddenFieldInputValue = '';\n\n render(): TemplateResult {\n const hidden = this.hiddenControls;\n const json: TemplateConfigJSON = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();\n\n return html`\n <div class=\"relative\" aria-busy=${this.in('busy')} aria-live=\"polite\">\n <div\n class=${classMap({\n 'space-y-l transition-opacity': true,\n 'opacity-50': !this.in('idle'),\n })}\n >\n ${hidden.matches('cart-type', true) ? '' : this.__renderCartType(json)}\n ${hidden.matches('foxycomplete', true) ? '' : this.__renderFoxycomplete(json)}\n ${hidden.matches('locations', true) ? '' : this.__renderLocations(json)}\n ${hidden.matches('hidden-fields', true) ? '' : this.__renderHiddenFields(json)}\n ${hidden.matches('header', true) ? '' : this.__renderHeader(json)}\n ${hidden.matches('footer', true) ? '' : this.__renderFooter(json)}\n </div>\n\n <div\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': this.in('idle'),\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=${this.in('fail') ? 'error' : 'busy'}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderCartType(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const items = ['default', 'fullpage', 'custom'];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('cart-type:before')}\n\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${lang} key=\"cart_type\" ns=${ns}></foxy-i18n>\n\n <x-choice\n .value=${json.cart_type}\n .items=${items}\n ?disabled=${this.disabledSelector.matches('cart-type', true)}\n ?readonly=${this.readonlySelector.matches('cart-type', true)}\n @change=${(evt: ChoiceChangeEvent) => {\n this.edit({ json: JSON.stringify({ ...json, cart_type: evt.detail }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"cart_type_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-tertiary text-s\"\n lang=${lang}\n key=\"cart_type_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n </x-choice>\n </x-group>\n\n ${this.renderTemplateOrSlot('cart-type:after')}\n </div>\n `;\n }\n\n private __renderFoxycomplete(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const isDisabled = this.disabledSelector.matches('foxycomplete', true);\n const isReadonly = this.readonlySelector.matches('foxycomplete', true);\n const items = ['combobox', 'search', 'disabled'];\n const value =\n json.foxycomplete.usage === 'none'\n ? 'disabled'\n : json.foxycomplete.show_combobox\n ? 'combobox'\n : 'search';\n\n const renderFlagsCheckbox = () => html`\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.foxycomplete.show_flags}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n show_flags: evt.detail,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"show_country_flags\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n `;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('foxycomplete:before')}\n\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${lang} key=\"foxycomplete\" ns=${ns}></foxy-i18n>\n\n <x-choice\n .value=${value}\n .items=${items}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @change=${(evt: Event) => {\n if (!(evt instanceof ChoiceChangeEvent)) return;\n\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n usage: evt.detail === 'disabled' ? 'none' : 'required',\n show_combobox: evt.detail === 'combobox',\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n ${items.map(item => {\n return html`\n <div slot=\"${item}-label\" class=\"grid leading-s py-s\">\n <foxy-i18n lang=${lang} key=\"foxycomplete_${item}\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"text-tertiary text-s\"\n lang=${lang}\n key=\"foxycomplete_${item}_explainer\"\n ns=${ns}\n >\n </foxy-i18n>\n </div>\n `;\n })}\n\n <div slot=\"combobox\" class=\"space-y-m pb-s\" ?hidden=${value !== 'combobox'}>\n <div class=\"grid grid-cols-2 gap-m\" style=\"max-width: 16rem\">\n ${['open', 'close'].map(action => {\n const field = action === 'open' ? 'combobox_open' : 'combobox_close';\n\n return html`\n <vaadin-text-field\n label=${this.t(`${action}_icon`)}\n .value=${json.foxycomplete[field]}\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextFieldElement;\n const newConfig: TemplateConfigJSON['foxycomplete'] = {\n ...json.foxycomplete,\n [field]: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, foxycomplete: newConfig }) });\n }}\n >\n </vaadin-text-field>\n `;\n })}\n </div>\n\n ${renderFlagsCheckbox()}\n </div>\n\n <div slot=\"search\" class=\"pb-s\" ?hidden=${value !== 'search'}>\n ${renderFlagsCheckbox()}\n </div>\n </x-choice>\n\n <div class=\"border-t border-contrast-10 p-m\">\n <x-checkbox\n ?disabled=${isDisabled}\n ?readonly=${isReadonly}\n ?checked=${json.postal_code_lookup.usage === 'enabled'}\n @change=${(evt: CheckboxChangeEvent) => {\n const newConfig: TemplateConfigJSON['postal_code_lookup'] = {\n usage: evt.detail ? 'enabled' : 'none',\n };\n\n this.edit({ json: JSON.stringify({ ...json, postal_code_lookup: newConfig }) });\n }}\n >\n <foxy-i18n lang=${lang} key=\"enable_postcode_lookup\" ns=${ns}></foxy-i18n>\n </x-checkbox>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('foxycomplete:after')}\n </div>\n `;\n }\n\n private __renderLocations(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const config = json.location_filtering;\n\n const shippingChoice = config.shipping_filter_type === 'blacklist' ? 'block' : 'allow';\n const billingChoice =\n config.usage === 'both'\n ? 'copy'\n : config.billing_filter_type === 'blacklist'\n ? 'block'\n : 'allow';\n\n const normalize = () => {\n if (config.usage === 'both') {\n config.billing_filter_type = config.shipping_filter_type;\n config.billing_filter_values = config.shipping_filter_values;\n } else {\n const hasBillingFilters = Object.keys(config.billing_filter_values).length > 0;\n const hasShippingFilters = Object.keys(config.shipping_filter_values).length > 0;\n\n if (!hasBillingFilters && !hasShippingFilters) {\n config.usage = 'none';\n } else if (hasBillingFilters && !hasShippingFilters) {\n config.usage = 'billing';\n } else if (hasShippingFilters && !hasBillingFilters) {\n config.usage = 'shipping';\n } else {\n config.usage = 'independent';\n }\n }\n };\n\n return html`\n ${this.renderTemplateOrSlot('locations:before')}\n\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${lang} key=\"location_plural\" ns=${ns}></foxy-i18n>\n\n <div class=\"grid sm-grid-cols-2 bg-contrast-10\" style=\"gap: 1px\">\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n class=\"text-tertiary\" slot=\"header\" lang=${lang} key=\"shipping\" ns=${ns}>\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block']}\n .value=${shippingChoice}\n @change=${(evt: ChoiceChangeEvent) => {\n if (config.usage !== 'both') config.usage = 'independent';\n config.shipping_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.shipping_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${shippingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${this.disabledSelector.matches('locations', true)}\n ?readonly=${this.readonlySelector.matches('locations', true)}\n @update:countries=${(evt: CustomEvent) => {\n config.shipping_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n\n <x-group class=\"bg-base pt-m\">\n <foxy-i18n class=\"text-tertiary\" slot=\"header\" lang=${lang} key=\"billing\" ns=${ns}>\n </foxy-i18n>\n\n <x-choice\n .items=${['allow', 'block', 'copy']}\n .value=${billingChoice}\n @change=${(evt: ChoiceChangeEvent) => {\n if (evt.detail === 'copy') {\n config.usage = 'both';\n } else {\n config.usage = 'independent';\n config.billing_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';\n }\n\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <foxy-i18n slot=\"allow-label\" lang=${lang} key=\"allowlist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"block-label\" lang=${lang} key=\"blocklist\" ns=${ns}></foxy-i18n>\n <foxy-i18n slot=\"copy-label\" lang=${lang} key=\"same_as_shipping\" ns=${ns}></foxy-i18n>\n\n <x-countries-list\n countries=${JSON.stringify(config.billing_filter_values)}\n regions=${this.regions}\n class=\"mb-m\"\n href=${this.countries}\n slot=${billingChoice}\n lang=${lang}\n ns=${ns}\n ?disabled=${this.disabledSelector.matches('locations', true)}\n ?readonly=${this.readonlySelector.matches('locations', true)}\n ?hidden=${billingChoice === 'copy'}\n @update:countries=${(evt: CustomEvent) => {\n config.billing_filter_values = (evt.currentTarget as CountriesList).countries;\n normalize();\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n </x-countries-list>\n </x-choice>\n </x-group>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('locations:after')}\n `;\n }\n\n private __renderHiddenFields(json: TemplateConfigJSON) {\n const { lang, ns } = this;\n const suggestions = [] as string[];\n const fields = [] as string[];\n const config = json.cart_display_config;\n\n type FieldName = keyof Omit<\n TemplateConfigJSON['cart_display_config'],\n 'hidden_product_options' | 'usage'\n >;\n\n for (const key in config) {\n if (!key.startsWith('show_')) continue;\n const field = key.substring(5);\n suggestions.push(field);\n if (config.usage === 'required' && !config[key as FieldName]) fields.push(field);\n }\n\n if (config.usage === 'required') {\n fields.push(...config.hidden_product_options);\n }\n\n const addField = () => {\n config.usage = 'required';\n\n if (suggestions.includes(this.__addHiddenFieldInputValue)) {\n config[`show_${this.__addHiddenFieldInputValue}` as FieldName] = false;\n } else if (!config.hidden_product_options.includes(this.__addHiddenFieldInputValue)) {\n config.hidden_product_options.push(this.__addHiddenFieldInputValue);\n }\n\n this.edit({ json: JSON.stringify(json) });\n this.__addHiddenFieldInputValue = '';\n };\n\n const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';\n const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('hidden-fields:before')}\n\n <x-group frame>\n <foxy-i18n slot=\"header\" lang=${lang} key=\"hidden_fields\" ns=${ns}></foxy-i18n>\n\n <div class=\"divide-y divide-contrast-10\">\n ${fields.map(\n field => html`\n <div class=\"h-m ml-m pr-xs flex items-center justify-between\">\n ${suggestions.includes(field)\n ? html`<foxy-i18n lang=${lang} key=${field} ns=${ns}></foxy-i18n>`\n : html`<span>${field}</span>`}\n\n <button\n class=\"flex w-xs h-xs items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50\"\n @click=${() => {\n if (typeof config[`show_${field}` as FieldName] === 'boolean') {\n config[`show_${field}` as FieldName] = true;\n } else {\n config.hidden_product_options = config.hidden_product_options.filter(\n option => option !== field\n );\n }\n\n this.edit({ json: JSON.stringify(json) });\n }}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n `\n )}\n </div>\n\n <div\n style=\"border-radius: ${inputRadius.join(' ')}\"\n class=${classMap({\n 'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,\n 'border-t border-contrast-10': fields.length > 0,\n })}\n >\n <input\n placeholder=${this.t('add_field')}\n class=\"w-full bg-transparent appearance-none h-m px-m focus-outline-none\"\n list=\"hidden-fields-list\"\n .value=${live(this.__addHiddenFieldInputValue)}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && addField()}\n @input=${(evt: InputEvent) => {\n this.__addHiddenFieldInputValue = (evt.currentTarget as HTMLInputElement).value;\n }}\n />\n\n <datalist id=\"hidden-fields-list\">\n ${suggestions\n .filter(suggestion => !fields.includes(suggestion))\n .map(\n suggestion => html`<option value=${suggestion}>${this.t(suggestion)}</option>`\n )}\n </datalist>\n\n <button\n aria-label=${this.t('add_field')}\n class=${classMap({\n 'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.__addHiddenFieldInputValue,\n 'bg-success-10 text-success cursor-pointer': !!this.__addHiddenFieldInputValue,\n 'hover-bg-success hover-text-success-contrast': !!this.__addHiddenFieldInputValue,\n 'focus-outline-none focus-ring-2': !!this.__addHiddenFieldInputValue,\n })}\n ?disabled=${!this.__addHiddenFieldInputValue}\n @click=${addField}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n </x-group>\n\n ${this.renderTemplateOrSlot('hidden-fields:after')}\n </div>\n `;\n }\n\n private __renderHeader(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('header:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_header')}\n helper-text=${this.t('custom_header_helper_text')}\n .value=${json.custom_script_values.header}\n ?disabled=${this.disabledSelector.matches('header', true)}\n ?readonly=${this.readonlySelector.matches('header', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n header: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n }\n\n private __renderFooter(json: TemplateConfigJSON) {\n return html`\n <div>\n ${this.renderTemplateOrSlot('footer:before')}\n\n <vaadin-text-area\n class=\"w-full\"\n label=${this.t('custom_footer')}\n helper-text=${this.t('custom_footer_helper_text')}\n .value=${json.custom_script_values.footer}\n ?disabled=${this.disabledSelector.matches('footer', true)}\n ?readonly=${this.readonlySelector.matches('footer', true)}\n @input=${(evt: CustomEvent) => {\n const target = evt.currentTarget as TextAreaElement;\n const newConfig: TemplateConfigJSON['custom_script_values'] = {\n ...json.custom_script_values,\n footer: target.value,\n };\n\n this.edit({ json: JSON.stringify({ ...json, custom_script_values: newConfig }) });\n }}\n >\n </vaadin-text-area>\n\n ${this.renderTemplateOrSlot('footer:after')}\n </div>\n `;\n }\n}\n"]}
|