@foxy.io/elements 1.34.0-beta.2 → 1.34.0

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.
Files changed (229) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  5. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  6. package/dist/cdn/foxy-api-browser.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  8. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-card.js +1 -1
  11. package/dist/cdn/foxy-attribute-form.js +1 -1
  12. package/dist/cdn/foxy-billing-address-card.js +1 -1
  13. package/dist/cdn/foxy-cancellation-form.js +1 -1
  14. package/dist/cdn/foxy-cart-card.js +1 -1
  15. package/dist/cdn/foxy-cart-form.js +2 -2
  16. package/dist/cdn/foxy-client-card.js +1 -1
  17. package/dist/cdn/foxy-client-form.js +1 -1
  18. package/dist/cdn/foxy-collection-page.js +1 -1
  19. package/dist/cdn/foxy-collection-pages.js +1 -1
  20. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  21. package/dist/cdn/foxy-coupon-card.js +1 -1
  22. package/dist/cdn/foxy-coupon-code-card.js +1 -1
  23. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  24. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  25. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  26. package/dist/cdn/foxy-coupon-form.js +1 -1
  27. package/dist/cdn/foxy-custom-field-card.js +1 -1
  28. package/dist/cdn/foxy-custom-field-form.js +1 -1
  29. package/dist/cdn/foxy-customer-card.js +1 -1
  30. package/dist/cdn/foxy-customer-form.js +1 -1
  31. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  32. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  33. package/dist/cdn/foxy-customer-portal.js +1 -1
  34. package/dist/cdn/foxy-customer.js +1 -1
  35. package/dist/cdn/foxy-customers-table.js +1 -1
  36. package/dist/cdn/foxy-discount-builder.js +1 -1
  37. package/dist/cdn/foxy-discount-card.js +1 -1
  38. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  39. package/dist/cdn/foxy-donation.js +1 -1
  40. package/dist/cdn/foxy-downloadable-card.js +1 -1
  41. package/dist/cdn/foxy-downloadable-form.js +6 -6
  42. package/dist/cdn/foxy-email-template-card.js +1 -1
  43. package/dist/cdn/foxy-email-template-form.js +1 -1
  44. package/dist/cdn/foxy-error-entry-card.js +1 -1
  45. package/dist/cdn/foxy-filter-attribute-card.js +1 -1
  46. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  47. package/dist/cdn/foxy-form-dialog.js +1 -1
  48. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  49. package/dist/cdn/foxy-gift-card-card.js +1 -1
  50. package/dist/cdn/foxy-gift-card-code-card.js +1 -1
  51. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  52. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  53. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  54. package/dist/cdn/foxy-gift-card-form.js +1 -1
  55. package/dist/cdn/foxy-i18n-editor.js +3 -3
  56. package/dist/cdn/foxy-i18n.js +1 -1
  57. package/dist/cdn/foxy-integration-card.js +1 -1
  58. package/dist/cdn/foxy-integration-form.js +1 -1
  59. package/dist/cdn/foxy-item-card.js +1 -1
  60. package/dist/cdn/foxy-item-category-card.js +1 -1
  61. package/dist/cdn/foxy-item-category-form.js +1 -1
  62. package/dist/cdn/foxy-item-form.js +1 -1
  63. package/dist/cdn/foxy-item-option-card.js +1 -1
  64. package/dist/cdn/foxy-item-option-form.js +1 -1
  65. package/dist/cdn/foxy-items-form.js +1 -1
  66. package/dist/cdn/foxy-native-integration-card.js +1 -1
  67. package/dist/cdn/foxy-native-integration-form.js +1 -1
  68. package/dist/cdn/foxy-pagination.js +1 -1
  69. package/dist/cdn/foxy-passkey-card.js +1 -1
  70. package/dist/cdn/foxy-passkey-form.js +1 -1
  71. package/dist/cdn/foxy-payment-card-embed.js +1 -1
  72. package/dist/cdn/foxy-payment-card.js +1 -1
  73. package/dist/cdn/foxy-payment-method-card.js +1 -1
  74. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  75. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  76. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  77. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  78. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  79. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  80. package/dist/cdn/foxy-query-builder.js +1 -1
  81. package/dist/cdn/foxy-report-form.js +2 -2
  82. package/dist/cdn/foxy-reports-table.js +5 -5
  83. package/dist/cdn/foxy-shipment-card.js +1 -1
  84. package/dist/cdn/foxy-shipping-container-card.js +1 -1
  85. package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
  86. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  87. package/dist/cdn/foxy-shipping-service-card.js +1 -1
  88. package/dist/cdn/foxy-sign-in-form.js +1 -1
  89. package/dist/cdn/foxy-spinner.js +2 -2
  90. package/dist/cdn/foxy-store-card.js +1 -1
  91. package/dist/cdn/foxy-store-form.js +1 -1
  92. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  93. package/dist/cdn/foxy-subscription-card.js +1 -1
  94. package/dist/cdn/foxy-subscription-form.js +1 -1
  95. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  96. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  97. package/dist/cdn/foxy-table.js +1 -1
  98. package/dist/cdn/foxy-tax-card.js +1 -1
  99. package/dist/cdn/foxy-tax-form.js +1 -1
  100. package/dist/cdn/foxy-template-config-form.js +1 -1
  101. package/dist/cdn/foxy-template-form.js +1 -1
  102. package/dist/cdn/foxy-template-set-card.js +1 -1
  103. package/dist/cdn/foxy-template-set-form.js +1 -1
  104. package/dist/cdn/foxy-transaction-card.js +1 -1
  105. package/dist/cdn/foxy-transaction.js +1 -1
  106. package/dist/cdn/foxy-transactions-table.js +1 -1
  107. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  108. package/dist/cdn/foxy-user-card.js +1 -1
  109. package/dist/cdn/foxy-user-form.js +1 -1
  110. package/dist/cdn/foxy-user-invitation-card.js +1 -1
  111. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  112. package/dist/cdn/foxy-users-table.js +1 -1
  113. package/dist/cdn/foxy-webhook-card.js +1 -1
  114. package/dist/cdn/foxy-webhook-form.js +1 -1
  115. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  116. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  117. package/dist/cdn/{shared-f4e03cdc.js → shared-0293eba8.js} +1 -1
  118. package/dist/cdn/shared-0d0fe9c0.js +1 -0
  119. package/dist/cdn/{shared-433ff5ae.js → shared-0db6454a.js} +10 -4
  120. package/dist/cdn/shared-0fe1dd67.js +1 -0
  121. package/dist/cdn/{shared-ff10b9fb.js → shared-126cb82b.js} +1 -1
  122. package/dist/cdn/{shared-3db18172.js → shared-16766722.js} +1 -1
  123. package/dist/cdn/{shared-f6f4bed5.js → shared-1838736d.js} +1 -1
  124. package/dist/cdn/{shared-9f4fad24.js → shared-1b5f155f.js} +1 -1
  125. package/dist/cdn/{shared-95a591b3.js → shared-1df36027.js} +2 -2
  126. package/dist/cdn/{shared-d3ffbcb0.js → shared-23aa2506.js} +1 -1
  127. package/dist/cdn/{shared-a9f4e92e.js → shared-2b6b735d.js} +1 -1
  128. package/dist/cdn/{shared-705ce87a.js → shared-2ddb119e.js} +1 -1
  129. package/dist/cdn/{shared-69cdc370.js → shared-2fd6e530.js} +1 -1
  130. package/dist/cdn/{shared-6b15ed9e.js → shared-370be17b.js} +5 -5
  131. package/dist/cdn/{shared-a8f38962.js → shared-3e25035f.js} +1 -1
  132. package/dist/cdn/{shared-62af0ef5.js → shared-3efc6649.js} +1 -1
  133. package/dist/cdn/shared-41072bad.js +1 -0
  134. package/dist/cdn/{shared-cc8ce493.js → shared-46de2ed2.js} +1 -1
  135. package/dist/cdn/{shared-4f33425a.js → shared-4e6c65e6.js} +1 -1
  136. package/dist/cdn/{shared-7edf38e9.js → shared-4f216dc1.js} +1 -1
  137. package/dist/cdn/{shared-83c8a2d2.js → shared-51fd3fc6.js} +1 -1
  138. package/dist/cdn/{shared-32566c11.js → shared-5245b330.js} +1 -1
  139. package/dist/cdn/{shared-8d826ccb.js → shared-527eb17e.js} +1 -1
  140. package/dist/cdn/{shared-a46c8030.js → shared-6a63a308.js} +1 -1
  141. package/dist/cdn/{shared-636cf673.js → shared-6c4a5133.js} +1 -1
  142. package/dist/cdn/{shared-25b83adb.js → shared-6cf0c762.js} +1 -1
  143. package/dist/cdn/{shared-8d5b9662.js → shared-6cf39826.js} +5 -5
  144. package/dist/cdn/shared-7040eef3.js +1 -0
  145. package/dist/cdn/{shared-47fe9f56.js → shared-74d9b3d4.js} +1 -1
  146. package/dist/cdn/{shared-136942c7.js → shared-7cfd461d.js} +1 -1
  147. package/dist/cdn/{shared-3ef5dcef.js → shared-7d234de2.js} +1 -1
  148. package/dist/cdn/{shared-a9b8c3ab.js → shared-7e1768cf.js} +1 -1
  149. package/dist/cdn/{shared-f0db16a5.js → shared-851b96ae.js} +1 -1
  150. package/dist/cdn/{shared-cb24170b.js → shared-85803aca.js} +1 -1
  151. package/dist/cdn/shared-869ed25d.js +294 -0
  152. package/dist/cdn/{shared-67d1de9a.js → shared-88bfb7f5.js} +1 -1
  153. package/dist/cdn/{shared-77135874.js → shared-8e73014c.js} +1 -1
  154. package/dist/cdn/{shared-3ebbd21d.js → shared-921e3f1e.js} +1 -1
  155. package/dist/cdn/{shared-52c9fa57.js → shared-9421c0d7.js} +1 -1
  156. package/dist/cdn/{shared-b8ae5af7.js → shared-9c479921.js} +1 -1
  157. package/dist/cdn/{shared-148214ee.js → shared-9e9bec09.js} +1 -1
  158. package/dist/cdn/{shared-6583e3f9.js → shared-a24264e6.js} +1 -1
  159. package/dist/cdn/{shared-9dd252c7.js → shared-a34983ea.js} +2 -2
  160. package/dist/cdn/{shared-a2616e4b.js → shared-a4953186.js} +1 -1
  161. package/dist/cdn/{shared-1d0d814b.js → shared-a7524277.js} +1 -1
  162. package/dist/cdn/shared-a83e33cd.js +1 -0
  163. package/dist/cdn/{shared-46189aae.js → shared-a86480c5.js} +1 -1
  164. package/dist/cdn/{shared-0d4cdb19.js → shared-ae68261f.js} +1 -1
  165. package/dist/cdn/{shared-2ca888f6.js → shared-b62fb09f.js} +1 -1
  166. package/dist/cdn/{shared-5cdec81e.js → shared-bbd2a4e6.js} +1 -1
  167. package/dist/cdn/{shared-56ee26d7.js → shared-bec65d6d.js} +1 -1
  168. package/dist/cdn/{shared-02c737dc.js → shared-c176c4fa.js} +1 -1
  169. package/dist/cdn/{shared-f79438f8.js → shared-c1f4a6ef.js} +1 -1
  170. package/dist/cdn/{shared-cfe76d01.js → shared-d735fc99.js} +1 -1
  171. package/dist/cdn/{shared-69c7aec1.js → shared-d806ec21.js} +1 -1
  172. package/dist/cdn/{shared-08e73812.js → shared-dbc9aff0.js} +1 -1
  173. package/dist/cdn/{shared-a1f697c2.js → shared-e0b00e0f.js} +1 -1
  174. package/dist/cdn/{shared-66e2a4ee.js → shared-e6379bd1.js} +1 -1
  175. package/dist/cdn/{shared-33c9ef32.js → shared-e7069b0f.js} +1 -1
  176. package/dist/cdn/{shared-70612035.js → shared-e766f6e0.js} +1 -1
  177. package/dist/cdn/{shared-57373d84.js → shared-e8df4368.js} +1 -1
  178. package/dist/cdn/{shared-b8c6eafc.js → shared-e9e2fd3f.js} +1 -1
  179. package/dist/cdn/{shared-2dd2ff95.js → shared-f378fe25.js} +1 -1
  180. package/dist/cdn/{shared-6b578d1a.js → shared-f57e1679.js} +1 -1
  181. package/dist/cdn/{shared-6b5e4fe4.js → shared-f8252d03.js} +1 -1
  182. package/dist/cdn/{shared-2aee2a22.js → shared-fceaef95.js} +1 -1
  183. package/dist/cdn/translations/template-config-form/en.json +520 -108
  184. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.d.ts +2 -0
  185. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +23 -2
  186. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
  187. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.d.ts +1 -0
  188. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +12 -2
  189. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
  190. package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.d.ts +4 -0
  191. package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js +20 -0
  192. package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js.map +1 -1
  193. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +33 -26
  194. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +679 -1234
  195. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  196. package/dist/elements/public/TemplateConfigForm/index.d.ts +9 -5
  197. package/dist/elements/public/TemplateConfigForm/index.js +9 -5
  198. package/dist/elements/public/TemplateConfigForm/index.js.map +1 -1
  199. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.d.ts +14 -0
  200. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js +138 -0
  201. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js.map +1 -0
  202. package/dist/elements/public/TemplateConfigForm/{CountryCard.d.ts → internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.d.ts} +4 -4
  203. package/dist/elements/public/TemplateConfigForm/{CountryCard.js → internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js} +20 -28
  204. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js.map +1 -0
  205. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.d.ts +4 -0
  206. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js +8 -0
  207. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js.map +1 -0
  208. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/InternalTemplateConfigFormSupportedCardsControl.d.ts +7 -0
  209. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/InternalTemplateConfigFormSupportedCardsControl.js +82 -0
  210. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/InternalTemplateConfigFormSupportedCardsControl.js.map +1 -0
  211. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/index.d.ts +3 -0
  212. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/index.js +5 -0
  213. package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormSupportedCardsControl/index.js.map +1 -0
  214. package/dist/mixins/themeable.js +4 -12
  215. package/dist/mixins/themeable.js.map +1 -1
  216. package/package.json +1 -1
  217. package/dist/cdn/shared-1acbd965.js +0 -1
  218. package/dist/cdn/shared-61ade33e.js +0 -6
  219. package/dist/cdn/shared-684174e7.js +0 -1
  220. package/dist/cdn/shared-8a65adfd.js +0 -1
  221. package/dist/cdn/shared-9ea762dc.js +0 -294
  222. package/dist/cdn/shared-b73aaedb.js +0 -1
  223. package/dist/cdn/shared-ccc7a886.js +0 -1
  224. package/dist/cdn/shared-e8744e04.js +0 -1
  225. package/dist/cdn/shared-eb8a9f27.js +0 -1
  226. package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +0 -21
  227. package/dist/elements/public/TemplateConfigForm/CountriesList.js +0 -137
  228. package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +0 -1
  229. package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +0 -1
@@ -1,26 +1,15 @@
1
- import * as logos from "../PaymentMethodCard/logos.js";
2
- import { ChoiceChangeEvent } from "../../private/events.js";
3
- import { ScopedElementsMixin } from '@open-wc/scoped-elements';
4
- import { html } from 'lit-html';
5
- import { Checkbox } from "../../private/Checkbox/Checkbox.js";
6
- import { Choice } from "../../private/Choice/Choice.js";
7
- import { ConfigurableMixin } from "../../../mixins/configurable.js";
8
- import { CountriesList } from "./CountriesList.js";
9
- import { Group } from "../../private/Group/Group.js";
10
- import { NucleonElement } from "../NucleonElement/NucleonElement.js";
11
- import { ResponsiveMixin } from "../../../mixins/responsive.js";
12
- import { ThemeableMixin } from "../../../mixins/themeable.js";
13
1
  import { TranslatableMixin } from "../../../mixins/translatable.js";
14
- import { classMap } from "../../../utils/class-map.js";
15
- import { getDefaultJSON } from "./defaults.js";
16
- import { live } from 'lit-html/directives/live';
17
2
  import { BooleanSelector } from '@foxy.io/sdk/core';
3
+ import { ResponsiveMixin } from "../../../mixins/responsive.js";
4
+ import { getDefaultJSON } from "./defaults.js";
5
+ import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
6
+ import { ifDefined } from 'lit-html/directives/if-defined';
7
+ import { html, svg } from 'lit-html';
18
8
  const NS = 'template-config-form';
19
- const Base = ScopedElementsMixin(ResponsiveMixin(ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)))));
9
+ const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
20
10
  /**
21
11
  * Form element for creating or editing template configs (`fx:template_config`).
22
12
  *
23
- *
24
13
  * @element foxy-template-config-form
25
14
  * @since 1.14.0
26
15
  */
@@ -28,1267 +17,723 @@ export class TemplateConfigForm extends Base {
28
17
  constructor() {
29
18
  super(...arguments);
30
19
  /** URI of the `fx:countries` hAPI resource. */
31
- this.countries = '';
20
+ this.countries = null;
32
21
  /** URI of the `fx:regions` hAPI resource. */
33
- this.regions = '';
34
- this.__addHiddenFieldInputValue = '';
35
- }
36
- static get scopedElements() {
37
- return {
38
- 'vaadin-text-field': customElements.get('vaadin-text-field'),
39
- 'iron-icon': customElements.get('iron-icon'),
40
- 'foxy-internal-source-control': customElements.get('foxy-internal-source-control'),
41
- 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
42
- 'foxy-spinner': customElements.get('foxy-spinner'),
43
- 'foxy-i18n': customElements.get('foxy-i18n'),
44
- 'x-countries-list': CountriesList,
45
- 'x-checkbox': Checkbox,
46
- 'x-choice': Choice,
47
- 'x-group': Group,
22
+ this.regions = null;
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
+ this.store = null;
25
+ this.__customCheckoutFieldCouponEntryRequirementsOptions = JSON.stringify([
26
+ { label: 'option_enabled', value: 'enabled' },
27
+ { label: 'option_disabled', value: 'disabled' },
28
+ ]);
29
+ this.__customCheckoutFieldRequirementsOptions = JSON.stringify([
30
+ { label: 'option_default', value: 'default' },
31
+ { label: 'option_optional', value: 'optional' },
32
+ { label: 'option_required', value: 'required' },
33
+ { label: 'option_hidden', value: 'hidden' },
34
+ ]);
35
+ this.__tosCheckboxSettingsInitialStateOptions = JSON.stringify([
36
+ { label: 'option_checked', value: 'checked' },
37
+ { label: 'option_unchecked', value: 'unchecked' },
38
+ ]);
39
+ this.__locationFilteringFilterTypeOptions = JSON.stringify([
40
+ { label: 'option_blocklist', value: 'blacklist' },
41
+ { label: 'option_allowlist', value: 'whitelist' },
42
+ ]);
43
+ this.__foxycompleteShowComboboxOptions = JSON.stringify([
44
+ { label: 'option_combobox', value: 'combobox' },
45
+ { label: 'option_search', value: 'search' },
46
+ ]);
47
+ this.__tosCheckboxSettingsUsageOptions = JSON.stringify([
48
+ { label: 'option_none', value: 'none' },
49
+ { label: 'option_optional', value: 'optional' },
50
+ { label: 'option_required', value: 'required' },
51
+ ]);
52
+ this.__locationFilteringUsageOptions = JSON.stringify([
53
+ { label: 'option_none', value: 'none' },
54
+ { label: 'option_shipping', value: 'shipping' },
55
+ { label: 'option_billing', value: 'billing' },
56
+ { label: 'option_both', value: 'both' },
57
+ { label: 'option_independent', value: 'independent' },
58
+ ]);
59
+ this.__cscRequirementsValueOptions = JSON.stringify([
60
+ { label: 'option_all_cards', value: 'all_cards' },
61
+ { label: 'option_sso_only', value: 'sso_only' },
62
+ { label: 'option_new_cards_only', value: 'new_cards_only' },
63
+ ]);
64
+ this.__checkoutTypeDefaultOptions = JSON.stringify([
65
+ { label: 'option_default_account', value: 'default_account' },
66
+ { label: 'option_default_guest', value: 'default_guest' },
67
+ ]);
68
+ this.__checkoutTypeAccountOptions = JSON.stringify([
69
+ { label: 'option_account', value: 'account_only' },
70
+ { label: 'option_guest', value: 'guest_only' },
71
+ { label: 'option_both', value: 'default_guest' },
72
+ ]);
73
+ this.__cartTypeOptions = JSON.stringify([
74
+ { label: 'option_default', value: 'default' },
75
+ { label: 'option_fullpage', value: 'fullpage' },
76
+ { label: 'option_custom', value: 'custom' },
77
+ ]);
78
+ this.__locationFilteringFilterValuesSetValue = (newValue) => {
79
+ const formJson = this.__formJson;
80
+ const newConfig = {
81
+ ...formJson.location_filtering,
82
+ shipping_filter_values: newValue,
83
+ billing_filter_values: newValue,
84
+ };
85
+ this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newConfig }) });
48
86
  };
49
- }
50
- static get properties() {
51
- return {
52
- ...super.properties,
53
- __addHiddenFieldInputValue: { attribute: false },
54
- countries: { type: String },
55
- regions: { type: String },
87
+ this.__locationFilteringFilterTypeSetValue = (value) => {
88
+ const formJson = this.__formJson;
89
+ const newValue = {
90
+ ...formJson.location_filtering,
91
+ shipping_filter_type: value,
92
+ billing_filter_type: value,
93
+ };
94
+ this.edit({ json: JSON.stringify({ ...formJson, location_filtering: newValue }) });
56
95
  };
57
- }
58
- render() {
59
- var _a, _b;
60
- const hidden = this.hiddenSelector;
61
- const json = this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();
62
- return html `
63
- <div class="relative" aria-busy=${this.in('busy')} aria-live="polite">
64
- <div class="space-y-l">
65
- ${hidden.matches('cart-type', true) ? '' : this.__renderCartType(json)}
66
- ${hidden.matches('foxycomplete', true) ? '' : this.__renderFoxycomplete(json)}
67
- ${hidden.matches('locations', true) ? '' : this.__renderLocations(json)}
68
- ${hidden.matches('hidden-fields', true) ? '' : this.__renderHiddenFields(json)}
69
- ${hidden.matches('cards', true) ? '' : this.__renderCards(json)}
70
- ${hidden.matches('checkout-type', true) ? '' : this.__renderCheckoutType(json)}
71
- ${hidden.matches('consent', true) ? '' : this.__renderConsent(json)}
72
- ${hidden.matches('fields', true) ? '' : this.__renderFields(json)}
73
- ${hidden.matches('google-analytics', true) ? '' : this.__renderGoogleAnalytics(json)}
74
- ${hidden.matches('google-tag', true) ? '' : this.__renderGoogleTag(json)}
75
- ${hidden.matches('troubleshooting', true) ? '' : this.__renderTroubleshooting(json)}
76
-
77
- <foxy-internal-source-control
78
- data-testid="custom-config"
79
- helper-text=${this.t('custom_config_helper_text')}
80
- placeholder='{ "key": "value" }'
81
- label=${this.t('custom_config')}
82
- infer="custom-config"
83
- .getValue=${() => {
84
- if (typeof json.custom_config === 'string')
85
- return json.custom_config;
86
- return JSON.stringify(json.custom_config, null, 2);
87
- }}
88
- .setValue=${(newValue) => {
96
+ this.__foxycompleteShowComboboxGetValue = () => {
97
+ return this.__formJson.foxycomplete.show_combobox ? 'combobox' : 'search';
98
+ };
99
+ this.__foxycompleteShowComboboxSetValue = (value) => {
100
+ const newValue = value === 'combobox';
101
+ const foxycomplete = { ...this.__formJson.foxycomplete, show_combobox: newValue };
102
+ this.edit({ json: JSON.stringify({ ...this.__formJson, foxycomplete }) });
103
+ };
104
+ this.__checkoutTypeAccountGetValue = () => {
105
+ const formJson = this.__formJson;
106
+ return formJson.checkout_type.includes('default') ? 'default_guest' : formJson.checkout_type;
107
+ };
108
+ this.__customConfigGetValue = () => {
109
+ const formJson = this.__formJson;
110
+ if (typeof formJson.custom_config === 'string')
111
+ return formJson.custom_config;
112
+ return JSON.stringify(formJson.custom_config, null, 2);
113
+ };
114
+ this.__customConfigSetValue = (newValue) => {
115
+ const formJson = this.__formJson;
89
116
  try {
90
- json.custom_config = JSON.parse(newValue);
117
+ formJson.custom_config = JSON.parse(newValue);
91
118
  }
92
119
  catch (_a) {
93
- json.custom_config = newValue;
120
+ formJson.custom_config = newValue;
94
121
  }
95
- this.edit({ json: JSON.stringify(json) });
96
- }}
97
- >
98
- </foxy-internal-source-control>
99
-
100
- <foxy-internal-source-control
101
- data-testid="header"
102
- placeholder="<style>h1 { color: red }</style>"
103
- helper-text=${this.t('custom_header_helper_text')}
104
- label=${this.t('custom_header')}
105
- infer="header"
106
- .getValue=${() => json.custom_script_values.header}
107
- .setValue=${(newValue) => {
108
- json.custom_script_values.header = newValue;
109
- this.edit({ json: JSON.stringify(json) });
110
- }}
111
- >
112
- </foxy-internal-source-control>
113
-
114
- <foxy-internal-source-control
115
- data-testid="custom-fields"
116
- placeholder='<label>Comment: <input name="comment"></label>'
117
- helper-text=${this.t('custom_fields_helper_text')}
118
- label=${this.t('custom_fields')}
119
- infer="custom-fields"
120
- .getValue=${() => json.custom_script_values.checkout_fields}
121
- .setValue=${(newValue) => {
122
- json.custom_script_values.checkout_fields = newValue;
123
- this.edit({ json: JSON.stringify(json) });
124
- }}
125
- >
126
- </foxy-internal-source-control>
127
-
128
- <foxy-internal-source-control
129
- data-testid="footer"
130
- placeholder='<script src="https://example.com/code.js"></script>'
131
- helper-text=${this.t('custom_footer_helper_text')}
132
- label=${this.t('custom_footer')}
133
- infer="footer"
134
- .getValue=${() => json.custom_script_values.footer}
135
- .setValue=${(newValue) => {
136
- json.custom_script_values.footer = newValue;
137
- this.edit({ json: JSON.stringify(json) });
138
- }}
139
- >
140
- </foxy-internal-source-control>
141
- </div>
142
-
143
- <div
144
- class=${classMap({
145
- 'transition duration-500 ease-in-out absolute inset-0 flex': true,
146
- 'opacity-0 pointer-events-none': this.in('idle'),
147
- })}
148
- >
149
- <foxy-spinner
150
- layout="vertical"
151
- class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l"
152
- state=${this.in('fail') ? 'error' : 'busy'}
153
- lang=${this.lang}
154
- ns="${this.ns} ${(_b = (_a = customElements.get('foxy-spinner')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
155
- >
156
- </foxy-spinner>
157
- </div>
158
- </div>
159
- `;
122
+ this.edit({ json: JSON.stringify(formJson) });
123
+ };
124
+ this.__defaultJSON = JSON.stringify(getDefaultJSON());
125
+ }
126
+ static get properties() {
127
+ return {
128
+ ...super.properties,
129
+ countries: {},
130
+ regions: {},
131
+ store: {},
132
+ };
160
133
  }
161
134
  get hiddenSelector() {
162
- var _a;
135
+ var _a, _b;
163
136
  const alwaysHidden = [super.hiddenSelector.toString()];
164
- const json = ((_a = this.data) === null || _a === void 0 ? void 0 : _a.json) ? JSON.parse(this.data.json) : null;
165
- if (!json || json.analytics_config.google_analytics.usage === 'none') {
166
- alwaysHidden.push('google-analytics');
137
+ const dataJson = this.__dataJson;
138
+ const formJson = this.__formJson;
139
+ const locationFilteringUsage = formJson.location_filtering.usage;
140
+ const checkoutType = formJson.checkout_type;
141
+ if (formJson.cart_display_config.usage !== 'required') {
142
+ alwaysHidden.unshift('cart-group-two', 'cart-group-three', 'cart-group-four');
143
+ }
144
+ if (formJson.foxycomplete.usage !== 'required') {
145
+ alwaysHidden.unshift('country-and-region-group-one:foxycomplete-show-combobox', 'country-and-region-group-one:foxycomplete-combobox-open', 'country-and-region-group-one:foxycomplete-combobox-close', 'country-and-region-group-one:foxycomplete-show-flags');
146
+ }
147
+ if (formJson.foxycomplete.show_combobox === false) {
148
+ alwaysHidden.unshift('country-and-region-group-one:foxycomplete-combobox-open', 'country-and-region-group-one:foxycomplete-combobox-close');
149
+ }
150
+ if (locationFilteringUsage !== 'both') {
151
+ alwaysHidden.unshift('country-and-region-group-two');
152
+ }
153
+ if (locationFilteringUsage !== 'shipping' && locationFilteringUsage !== 'independent') {
154
+ alwaysHidden.unshift('country-and-region-group-three');
155
+ }
156
+ if (locationFilteringUsage !== 'billing' && locationFilteringUsage !== 'independent') {
157
+ alwaysHidden.unshift('country-and-region-group-four');
158
+ }
159
+ if (checkoutType !== 'default_account' && checkoutType !== 'default_guest') {
160
+ alwaysHidden.unshift('customer-accounts:checkout-type-default');
161
+ }
162
+ if (formJson.tos_checkbox_settings.usage === 'none') {
163
+ alwaysHidden.unshift('consent-group-one:tos-checkbox-settings-url', 'consent-group-one:tos-checkbox-settings-initial-state', 'consent-group-one:tos-checkbox-settings-is-hidden');
164
+ }
165
+ if (formJson.analytics_config.usage !== 'required') {
166
+ alwaysHidden.unshift('analytics-config-google-analytics', 'analytics-config-google-tag');
167
+ }
168
+ if ((dataJson === null || dataJson === void 0 ? void 0 : dataJson.analytics_config.google_analytics.usage) !== 'required') {
169
+ alwaysHidden.unshift('analytics-config-google-analytics');
170
+ }
171
+ if (formJson.analytics_config.google_analytics.usage !== 'required') {
172
+ alwaysHidden.unshift('analytics-config-google-analytics:analytics-config-google-analytics-account-id', 'analytics-config-google-analytics:analytics-config-google-analytics-include-on-site');
173
+ }
174
+ if (formJson.analytics_config.google_tag.usage !== 'required') {
175
+ alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-account-id');
176
+ alwaysHidden.unshift('analytics-config-google-tag:analytics-config-google-tag-send-to');
177
+ }
178
+ if (((_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.features_multiship) !== true) {
179
+ alwaysHidden.unshift('custom-script-values-multiship-checkout-fields');
167
180
  }
168
181
  return new BooleanSelector(alwaysHidden.join(' ').trim());
169
182
  }
170
- __renderCartType(json) {
171
- const { lang, ns } = this;
172
- const items = ['default', 'fullpage', 'custom'];
173
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('cart-type', true);
183
+ renderBody() {
184
+ var _a, _b, _c, _d, _e, _f, _g, _h;
185
+ const customCheckoutFieldRequirementsControls = [
186
+ [
187
+ 'billing_address1',
188
+ 'billing_address2',
189
+ 'billing_city',
190
+ 'billing_region',
191
+ 'billing_postal_code',
192
+ 'billing_country',
193
+ ],
194
+ [
195
+ 'billing_first_name',
196
+ 'billing_last_name',
197
+ 'billing_company',
198
+ 'billing_tax_id',
199
+ 'billing_phone',
200
+ 'coupon_entry',
201
+ ],
202
+ ];
203
+ const cartDisplayConfigFields = [
204
+ ['show_product_weight', 'show_product_category', 'show_product_code', 'show_product_options'],
205
+ ['show_sub_frequency', 'show_sub_startdate', 'show_sub_nextdate', 'show_sub_enddate'],
206
+ ];
174
207
  return html `
175
- <div data-testid="cart-type">
176
- ${this.renderTemplateOrSlot('cart-type:before')}
177
-
178
- <x-group frame>
179
- <foxy-i18n
180
- class=${isDisabled ? 'text-disabled' : ''}
181
- slot="header"
182
- lang=${lang}
183
- key="cart_type"
184
- ns=${ns}
185
- >
186
- </foxy-i18n>
187
-
188
- <x-choice
189
- data-testid="cart-type-choice"
190
- .value=${json.cart_type}
191
- .items=${items}
192
- ?disabled=${isDisabled}
193
- ?readonly=${this.readonlySelector.matches('cart-type', true)}
194
- @change=${(evt) => {
195
- this.edit({ json: JSON.stringify({ ...json, cart_type: evt.detail }) });
196
- }}
197
- >
198
- ${items.map(item => {
199
- return html `
200
- <div slot="${item}-label" class="grid leading-s py-s">
201
- <foxy-i18n lang=${lang} key="cart_type_${item}" ns=${ns}></foxy-i18n>
202
- <foxy-i18n
203
- class="text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}"
204
- lang=${lang}
205
- key="cart_type_${item}_explainer"
206
- ns=${ns}
207
- >
208
- </foxy-i18n>
209
- </div>
210
- `;
208
+ ${this.renderHeader()}
209
+
210
+ <foxy-internal-summary-control infer="cart-group-one">
211
+ <foxy-internal-select-control
212
+ json-template=${this.__defaultJSON}
213
+ json-path="cart_type"
214
+ property="json"
215
+ options=${this.__cartTypeOptions}
216
+ layout="summary-item"
217
+ infer="cart-type"
218
+ >
219
+ </foxy-internal-select-control>
220
+
221
+ <foxy-internal-switch-control
222
+ json-template=${this.__defaultJSON}
223
+ false-alias="none"
224
+ true-alias="required"
225
+ json-path="cart_display_config.usage"
226
+ property="json"
227
+ infer="cart-display-config-usage"
228
+ invert
229
+ >
230
+ </foxy-internal-switch-control>
231
+ </foxy-internal-summary-control>
232
+
233
+ <div
234
+ class="grid sm-grid-cols-2 gap-m"
235
+ ?hidden=${cartDisplayConfigFields.every((group, index) => {
236
+ return group.every(prop => {
237
+ const suffix = index === 0 ? 'two' : 'three';
238
+ const sel = `cart-group-${suffix}:cart-display-config-${prop.replace(/_/g, '-')}`;
239
+ return this.hiddenSelector.matches(sel, true);
240
+ });
211
241
  })}
212
- </x-choice>
213
- </x-group>
214
-
215
- ${this.renderTemplateOrSlot('cart-type:after')}
216
- </div>
217
- `;
218
- }
219
- __renderFoxycomplete(json) {
220
- const { lang, ns } = this;
221
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('foxycomplete', true);
222
- const isReadonly = this.readonlySelector.matches('foxycomplete', true);
223
- const config = json.foxycomplete;
224
- const items = ['combobox', 'search', 'disabled'];
225
- const value = config.usage === 'none' ? 'disabled' : config.show_combobox ? 'combobox' : 'search';
226
- const flagsCheckbox = html `
227
- <x-checkbox
228
- data-testid="foxycomplete-flags-check"
229
- ?disabled=${isDisabled}
230
- ?readonly=${isReadonly}
231
- ?checked=${config.show_flags}
232
- @change=${(evt) => {
233
- config.show_flags = evt.detail;
234
- this.edit({ json: JSON.stringify(json) });
235
- }}
236
242
  >
237
- <foxy-i18n lang=${lang} key="show_country_flags" ns=${ns}></foxy-i18n>
238
- </x-checkbox>
239
- `;
240
- return html `
241
- <div data-testid="foxycomplete">
242
- ${this.renderTemplateOrSlot('foxycomplete:before')}
243
-
244
- <x-group frame>
245
- <foxy-i18n
246
- class=${isDisabled ? 'text-disabled' : ''}
247
- slot="header"
248
- lang=${lang}
249
- key="foxycomplete"
250
- ns=${ns}
251
- >
252
- </foxy-i18n>
253
-
254
- <x-choice
255
- data-testid="foxycomplete-choice"
256
- .value=${value}
257
- .items=${items}
258
- ?disabled=${isDisabled}
259
- ?readonly=${isReadonly}
260
- @change=${(evt) => {
261
- if (!(evt instanceof ChoiceChangeEvent))
262
- return;
263
- config.usage = evt.detail === 'disabled' ? 'none' : 'required';
264
- config.show_combobox = evt.detail === 'combobox';
265
- this.edit({ json: JSON.stringify(json) });
266
- }}
267
- >
268
- ${items.map(item => {
243
+ ${cartDisplayConfigFields.map((group, index) => {
244
+ const suffix = index === 0 ? 'two' : 'three';
269
245
  return html `
270
- <div slot="${item}-label" class="grid leading-s py-s">
271
- <foxy-i18n lang=${lang} key="foxycomplete_${item}" ns=${ns}></foxy-i18n>
272
- <foxy-i18n
273
- class="text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}"
274
- lang=${lang}
275
- key="foxycomplete_${item}_explainer"
276
- ns=${ns}
246
+ <foxy-internal-summary-control infer="cart-group-${suffix}">
247
+ ${group.map(prop => {
248
+ return html `
249
+ <foxy-internal-switch-control
250
+ json-template=${this.__defaultJSON}
251
+ json-path="cart_display_config.${prop}"
252
+ property="json"
253
+ infer="cart-display-config-${prop.replace(/_/g, '-')}"
277
254
  >
278
- </foxy-i18n>
279
- </div>
280
- `;
281
- })}
282
-
283
- <div slot="combobox" class="space-y-m pb-s" ?hidden=${value !== 'combobox'}>
284
- <div class="grid grid-cols-2 gap-m" style="max-width: 16rem">
285
- ${['open', 'close'].map(action => {
286
- const field = action === 'open' ? 'combobox_open' : 'combobox_close';
287
- return html `
288
- <vaadin-text-field
289
- data-testid="foxycomplete-${action}-icon"
290
- style="--lumo-border-radius: var(--lumo-border-radius-s)"
291
- label=${this.t(`${action}_icon`)}
292
- .value=${config[field]}
293
- ?disabled=${isDisabled}
294
- ?readonly=${isReadonly}
295
- @keydown=${(evt) => evt.key === 'Enter' && this.submit()}
296
- @input=${(evt) => {
297
- config[field] = evt.currentTarget.value;
298
- this.edit({ json: JSON.stringify(json) });
299
- }}
300
- >
301
- </vaadin-text-field>
302
- `;
303
- })}
304
- </div>
305
-
306
- ${flagsCheckbox}
307
- </div>
308
-
309
- <div slot="search" class="pb-s" ?hidden=${value !== 'search'}>${flagsCheckbox}</div>
310
- </x-choice>
311
-
312
- <div class="border-t border-contrast-10 p-m">
313
- <x-checkbox
314
- data-testid="foxycomplete-lookup-check"
315
- ?disabled=${isDisabled}
316
- ?readonly=${isReadonly}
317
- ?checked=${json.postal_code_lookup.usage === 'enabled'}
318
- @change=${(evt) => {
319
- json.postal_code_lookup.usage = evt.detail ? 'enabled' : 'none';
320
- this.edit({ json: JSON.stringify(json) });
321
- }}
322
- >
323
- <foxy-i18n lang=${lang} key="enable_postcode_lookup" ns=${ns}></foxy-i18n>
324
- </x-checkbox>
325
- </div>
326
- </x-group>
327
-
328
- ${this.renderTemplateOrSlot('foxycomplete:after')}
329
- </div>
330
- `;
331
- }
332
- __renderLocations(json) {
333
- const { lang, ns } = this;
334
- const config = json.location_filtering;
335
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('locations', true);
336
- const isReadonly = this.readonlySelector.matches('locations', true);
337
- const shippingChoice = config.shipping_filter_type === 'blacklist' ? 'block' : 'allow';
338
- const billingChoice = config.usage === 'both'
339
- ? 'copy'
340
- : config.billing_filter_type === 'blacklist'
341
- ? 'block'
342
- : 'allow';
343
- const normalize = () => {
344
- if (config.usage === 'both') {
345
- config.billing_filter_type = config.shipping_filter_type;
346
- config.billing_filter_values = config.shipping_filter_values;
347
- }
348
- else {
349
- const hasBillingFilters = Object.keys(config.billing_filter_values).length > 0;
350
- const hasShippingFilters = Object.keys(config.shipping_filter_values).length > 0;
351
- if (!hasBillingFilters && !hasShippingFilters) {
352
- config.usage = 'none';
353
- }
354
- else if (hasBillingFilters && !hasShippingFilters) {
355
- config.usage = 'billing';
356
- }
357
- else if (hasShippingFilters && !hasBillingFilters) {
358
- config.usage = 'shipping';
359
- }
360
- else {
361
- config.usage = 'independent';
362
- }
363
- }
364
- };
365
- return html `
366
- <div data-testid="locations">
367
- ${this.renderTemplateOrSlot('locations:before')}
368
-
369
- <x-group frame>
370
- <foxy-i18n
371
- class=${isDisabled ? 'text-disabled' : ''}
372
- slot="header"
373
- lang=${lang}
374
- key="location_plural"
375
- ns=${ns}
376
- >
377
- </foxy-i18n>
378
-
379
- <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap: 1px">
380
- <x-group class="bg-base pt-m">
381
- <foxy-i18n
382
- class=${isDisabled ? 'text-disabled' : 'text-tertiary'}
383
- slot="header"
384
- lang=${lang}
385
- key="shipping"
386
- ns=${ns}
387
- >
388
- </foxy-i18n>
389
-
390
- <x-choice
391
- data-testid="locations-shipping-choice"
392
- .items=${['allow', 'block']}
393
- .value=${shippingChoice}
394
- ?disabled=${isDisabled}
395
- ?readonly=${isReadonly}
396
- @change=${(evt) => {
397
- if (config.usage !== 'both')
398
- config.usage = 'independent';
399
- config.shipping_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';
400
- normalize();
401
- this.edit({ json: JSON.stringify(json) });
402
- }}
403
- >
404
- <foxy-i18n slot="allow-label" lang=${lang} key="allowlist" ns=${ns}></foxy-i18n>
405
- <foxy-i18n slot="block-label" lang=${lang} key="blocklist" ns=${ns}></foxy-i18n>
406
-
407
- <x-countries-list
408
- data-testid="locations-shipping-list"
409
- countries=${JSON.stringify(config.shipping_filter_values)}
410
- regions=${this.regions}
411
- class="mb-m"
412
- href=${this.countries}
413
- slot=${shippingChoice}
414
- lang=${lang}
415
- ns=${ns}
416
- ?disabled=${isDisabled}
417
- ?readonly=${isReadonly}
418
- @update:countries=${(evt) => {
419
- config.shipping_filter_values = evt.currentTarget.countries;
420
- normalize();
421
- this.edit({ json: JSON.stringify(json) });
422
- }}
423
- >
424
- </x-countries-list>
425
- </x-choice>
426
- </x-group>
427
-
428
- <x-group class="bg-base pt-m">
429
- <foxy-i18n
430
- class=${isDisabled ? 'text-disabled' : 'text-tertiary'}
431
- slot="header"
432
- lang=${lang}
433
- key="billing"
434
- ns=${ns}
435
- >
436
- </foxy-i18n>
437
-
438
- <x-choice
439
- data-testid="locations-billing-choice"
440
- .items=${['allow', 'block', 'copy']}
441
- .value=${billingChoice}
442
- ?disabled=${isDisabled}
443
- ?readonly=${isReadonly}
444
- @change=${(evt) => {
445
- if (evt.detail === 'copy') {
446
- config.usage = 'both';
447
- }
448
- else {
449
- config.usage = 'independent';
450
- config.billing_filter_type = evt.detail === 'block' ? 'blacklist' : 'whitelist';
451
- }
452
- normalize();
453
- this.edit({ json: JSON.stringify(json) });
454
- }}
455
- >
456
- <foxy-i18n slot="allow-label" lang=${lang} key="allowlist" ns=${ns}></foxy-i18n>
457
- <foxy-i18n slot="block-label" lang=${lang} key="blocklist" ns=${ns}></foxy-i18n>
458
- <foxy-i18n slot="copy-label" lang=${lang} key="same_as_shipping" ns=${ns}>
459
- </foxy-i18n>
460
-
461
- <x-countries-list
462
- data-testid="locations-billing-list"
463
- countries=${JSON.stringify(config.billing_filter_values)}
464
- regions=${this.regions}
465
- class="mb-m"
466
- href=${this.countries}
467
- slot=${billingChoice}
468
- lang=${lang}
469
- ns=${ns}
470
- ?disabled=${isDisabled}
471
- ?readonly=${isReadonly}
472
- ?hidden=${billingChoice === 'copy'}
473
- @update:countries=${(evt) => {
474
- config.billing_filter_values = evt.currentTarget.countries;
475
- normalize();
476
- this.edit({ json: JSON.stringify(json) });
477
- }}
478
- >
479
- </x-countries-list>
480
- </x-choice>
481
- </x-group>
482
- </div>
483
- </x-group>
484
-
485
- ${this.renderTemplateOrSlot('locations:after')}
486
- </div>
487
- `;
488
- }
489
- __renderHiddenFields(json) {
490
- const { lang, ns } = this;
491
- const suggestions = [];
492
- const fields = [];
493
- const config = json.cart_display_config;
494
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('hidden-fields', true);
495
- const isReadonly = this.readonlySelector.matches('hidden-fields', true);
496
- for (const key in config) {
497
- if (!key.startsWith('show_'))
498
- continue;
499
- const field = key.substring(5);
500
- suggestions.push(field);
501
- if (config.usage === 'required' && !config[key])
502
- fields.push(field);
503
- }
504
- if (config.usage === 'required') {
505
- fields.push(...config.hidden_product_options);
506
- }
507
- const addField = () => {
508
- config.usage = 'required';
509
- if (suggestions.includes(this.__addHiddenFieldInputValue)) {
510
- config[`show_${this.__addHiddenFieldInputValue}`] = false;
511
- }
512
- else if (!config.hidden_product_options.includes(this.__addHiddenFieldInputValue)) {
513
- config.hidden_product_options.push(this.__addHiddenFieldInputValue);
514
- }
515
- this.edit({ json: JSON.stringify(json) });
516
- this.__addHiddenFieldInputValue = '';
517
- };
518
- const radius = 'calc(var(--lumo-border-radius-l) / 1.2)';
519
- const inputRadius = fields.length === 0 ? [radius] : ['0', '0', radius, radius];
520
- const isAddButtonDisabled = isDisabled || !this.__addHiddenFieldInputValue;
521
- return html `
522
- <div data-testid="hidden-fields">
523
- ${this.renderTemplateOrSlot('hidden-fields:before')}
524
-
525
- <x-group frame>
526
- <foxy-i18n
527
- class=${isDisabled ? 'text-disabled' : ''}
528
- slot="header"
529
- lang=${lang}
530
- key="hidden_fields"
531
- ns=${ns}
532
- >
533
- </foxy-i18n>
534
-
535
- <div class="divide-y divide-contrast-10" data-testid="hidden-fields-list">
536
- ${fields.map(field => {
537
- return html `
538
- <div
539
- class=${classMap({
540
- 'h-m ml-m pr-xs flex items-center justify-between': true,
541
- 'text-secondary': isReadonly,
542
- 'text-disabled': isDisabled,
543
- })}
544
- >
545
- ${suggestions.includes(field)
546
- ? html `<foxy-i18n lang=${lang} key=${field} ns=${ns}></foxy-i18n>`
547
- : html `<span>${field}</span>`}
548
-
549
- <button
550
- aria-label=${this.t('delete')}
551
- class=${classMap({
552
- 'w-xs h-xs rounded-full transition-colors': true,
553
- 'hover-bg-error-10 hover-text-error': !isDisabled,
554
- 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !isDisabled,
555
- 'cursor-default': isDisabled,
556
- 'flex': !isReadonly,
557
- 'hidden': isReadonly,
255
+ </foxy-internal-switch-control>
256
+ `;
558
257
  })}
559
- ?disabled=${isDisabled}
560
- @click=${() => {
561
- if (typeof config[`show_${field}`] === 'boolean') {
562
- config[`show_${field}`] = true;
563
- }
564
- else {
565
- config.hidden_product_options = config.hidden_product_options.filter(option => option !== field);
566
- }
567
- this.edit({ json: JSON.stringify(json) });
568
- }}
569
- >
570
- <iron-icon icon="icons:close" class="icon-inline text-m m-auto"></iron-icon>
571
- </button>
572
- </div>
573
- `;
258
+ </foxy-internal-summary-control>
259
+ `;
574
260
  })}
575
- </div>
261
+ </div>
576
262
 
577
- <div
578
- data-testid="hidden-fields-new"
579
- style="border-radius: ${inputRadius.join(' ')}"
580
- class=${classMap({
581
- 'h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2': true,
582
- 'border-t border-contrast-10': fields.length > 0,
583
- 'flex': !isReadonly,
584
- 'hidden': isReadonly,
585
- })}
586
- >
587
- <input
588
- placeholder=${this.t('add_field')}
589
- class="w-full bg-transparent appearance-none h-m px-m focus-outline-none"
590
- list="hidden-fields-list"
591
- .value=${live(this.__addHiddenFieldInputValue)}
592
- ?disabled=${isDisabled}
593
- ?readonly=${isReadonly}
594
- @keydown=${(evt) => evt.key === 'Enter' && addField()}
595
- @input=${(evt) => {
596
- this.__addHiddenFieldInputValue = evt.currentTarget.value;
597
- }}
598
- />
263
+ <foxy-internal-summary-control infer="cart-group-four">
264
+ <foxy-internal-editable-list-control
265
+ json-template=${this.__defaultJSON}
266
+ json-path="cart_display_config.hidden_product_options"
267
+ property="json"
268
+ layout="summary-item"
269
+ infer="cart-display-config-hidden-product-options"
270
+ simple-value
271
+ >
272
+ </foxy-internal-editable-list-control>
273
+ </foxy-internal-summary-control>
274
+
275
+ <foxy-internal-summary-control infer="country-and-region-group-one">
276
+ <foxy-internal-switch-control
277
+ json-template=${this.__defaultJSON}
278
+ false-alias="none"
279
+ true-alias="required"
280
+ json-path="foxycomplete.usage"
281
+ property="json"
282
+ infer="foxycomplete-usage"
283
+ >
284
+ </foxy-internal-switch-control>
285
+
286
+ <foxy-internal-select-control
287
+ options=${this.__foxycompleteShowComboboxOptions}
288
+ layout="summary-item"
289
+ infer="foxycomplete-show-combobox"
290
+ .getValue=${this.__foxycompleteShowComboboxGetValue}
291
+ .setValue=${this.__foxycompleteShowComboboxSetValue}
292
+ >
293
+ </foxy-internal-select-control>
294
+
295
+ <foxy-internal-text-control
296
+ json-template=${this.__defaultJSON}
297
+ json-path="foxycomplete.combobox_open"
298
+ property="json"
299
+ layout="summary-item"
300
+ infer="foxycomplete-combobox-open"
301
+ >
302
+ </foxy-internal-text-control>
303
+
304
+ <foxy-internal-text-control
305
+ json-template=${this.__defaultJSON}
306
+ json-path="foxycomplete.combobox_close"
307
+ property="json"
308
+ layout="summary-item"
309
+ infer="foxycomplete-combobox-close"
310
+ >
311
+ </foxy-internal-text-control>
599
312
 
600
- <datalist id="hidden-fields-list">
601
- ${suggestions
602
- .filter(suggestion => !fields.includes(suggestion))
603
- .map(suggestion => html `<option value=${suggestion}>${this.t(suggestion)}</option>`)}
604
- </datalist>
313
+ <foxy-internal-switch-control
314
+ json-template=${this.__defaultJSON}
315
+ json-path="foxycomplete.show_flags"
316
+ property="json"
317
+ infer="foxycomplete-show-flags"
318
+ >
319
+ </foxy-internal-switch-control>
320
+
321
+ <foxy-internal-switch-control
322
+ json-template=${this.__defaultJSON}
323
+ false-alias="none"
324
+ true-alias="enabled"
325
+ json-path="postal_code_lookup"
326
+ property="json"
327
+ infer="postal-code-lookup"
328
+ >
329
+ </foxy-internal-switch-control>
330
+
331
+ <foxy-internal-select-control
332
+ json-template=${this.__defaultJSON}
333
+ json-path="location_filtering.usage"
334
+ property="json"
335
+ options=${this.__locationFilteringUsageOptions}
336
+ layout="summary-item"
337
+ infer="location-filtering-usage"
338
+ >
339
+ </foxy-internal-select-control>
340
+ </foxy-internal-summary-control>
341
+
342
+ <foxy-internal-summary-control infer="country-and-region-group-two">
343
+ <foxy-internal-select-control
344
+ json-template=${this.__defaultJSON}
345
+ json-path="location_filtering.shipping_filter_type"
346
+ property="json"
347
+ options=${this.__locationFilteringFilterTypeOptions}
348
+ layout="summary-item"
349
+ infer="location-filtering-filter-type"
350
+ .setValue=${this.__locationFilteringFilterTypeSetValue}
351
+ >
352
+ </foxy-internal-select-control>
353
+
354
+ <foxy-internal-template-config-form-filter-values-control
355
+ json-template=${this.__defaultJSON}
356
+ json-path="location_filtering.shipping_filter_values"
357
+ countries=${ifDefined((_a = this.countries) !== null && _a !== void 0 ? _a : void 0)}
358
+ property="json"
359
+ regions=${ifDefined((_b = this.regions) !== null && _b !== void 0 ? _b : void 0)}
360
+ infer="location-filtering-filter-values"
361
+ .setValue=${this.__locationFilteringFilterValuesSetValue}
362
+ >
363
+ </foxy-internal-template-config-form-filter-values-control>
364
+ </foxy-internal-summary-control>
365
+
366
+ <foxy-internal-summary-control infer="country-and-region-group-three">
367
+ <foxy-internal-select-control
368
+ json-template=${this.__defaultJSON}
369
+ json-path="location_filtering.shipping_filter_type"
370
+ property="json"
371
+ options=${this.__locationFilteringFilterTypeOptions}
372
+ layout="summary-item"
373
+ infer="location-filtering-shipping-filter-type"
374
+ >
375
+ </foxy-internal-select-control>
376
+
377
+ <foxy-internal-template-config-form-filter-values-control
378
+ json-template=${this.__defaultJSON}
379
+ json-path="location_filtering.shipping_filter_values"
380
+ countries=${ifDefined((_c = this.countries) !== null && _c !== void 0 ? _c : void 0)}
381
+ property="json"
382
+ regions=${ifDefined((_d = this.regions) !== null && _d !== void 0 ? _d : void 0)}
383
+ infer="location-filtering-shipping-filter-values"
384
+ >
385
+ </foxy-internal-template-config-form-filter-values-control>
386
+ </foxy-internal-summary-control>
387
+
388
+ <foxy-internal-summary-control infer="country-and-region-group-four">
389
+ <foxy-internal-select-control
390
+ json-template=${this.__defaultJSON}
391
+ json-path="location_filtering.billing_filter_type"
392
+ property="json"
393
+ options=${this.__locationFilteringFilterTypeOptions}
394
+ layout="summary-item"
395
+ infer="location-filtering-billing-filter-type"
396
+ >
397
+ </foxy-internal-select-control>
398
+
399
+ <foxy-internal-template-config-form-filter-values-control
400
+ json-template=${this.__defaultJSON}
401
+ json-path="location_filtering.billing_filter_values"
402
+ countries=${ifDefined((_e = this.countries) !== null && _e !== void 0 ? _e : void 0)}
403
+ property="json"
404
+ regions=${ifDefined((_f = this.regions) !== null && _f !== void 0 ? _f : void 0)}
405
+ infer="location-filtering-billing-filter-values"
406
+ >
407
+ </foxy-internal-template-config-form-filter-values-control>
408
+ </foxy-internal-summary-control>
409
+
410
+ <foxy-internal-summary-control infer="customer-accounts">
411
+ <foxy-internal-select-control
412
+ json-template=${this.__defaultJSON}
413
+ json-path="checkout_type"
414
+ property="json"
415
+ options=${this.__checkoutTypeAccountOptions}
416
+ layout="summary-item"
417
+ infer="checkout-type-account"
418
+ .getValue=${this.__checkoutTypeAccountGetValue}
419
+ >
420
+ </foxy-internal-select-control>
421
+
422
+ <foxy-internal-select-control
423
+ json-template=${this.__defaultJSON}
424
+ json-path="checkout_type"
425
+ property="json"
426
+ options=${this.__checkoutTypeDefaultOptions}
427
+ layout="summary-item"
428
+ infer="checkout-type-default"
429
+ >
430
+ </foxy-internal-select-control>
431
+ </foxy-internal-summary-control>
432
+
433
+ <foxy-internal-summary-control infer="consent-group-one">
434
+ <foxy-internal-select-control
435
+ json-template=${this.__defaultJSON}
436
+ json-path="tos_checkbox_settings.usage"
437
+ property="json"
438
+ options=${this.__tosCheckboxSettingsUsageOptions}
439
+ layout="summary-item"
440
+ infer="tos-checkbox-settings-usage"
441
+ >
442
+ </foxy-internal-select-control>
443
+
444
+ <foxy-internal-text-control
445
+ json-template=${this.__defaultJSON}
446
+ json-path="tos_checkbox_settings.url"
447
+ property="json"
448
+ layout="summary-item"
449
+ infer="tos-checkbox-settings-url"
450
+ >
451
+ </foxy-internal-text-control>
452
+
453
+ <foxy-internal-select-control
454
+ json-template=${this.__defaultJSON}
455
+ json-path="tos_checkbox_settings.initial_state"
456
+ property="json"
457
+ options=${this.__tosCheckboxSettingsInitialStateOptions}
458
+ layout="summary-item"
459
+ infer="tos-checkbox-settings-initial-state"
460
+ >
461
+ </foxy-internal-select-control>
605
462
 
606
- <button
607
- aria-label=${this.t('add_field')}
608
- class=${classMap({
609
- 'w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50': true,
610
- 'flex items-center justify-center rounded-full transition-colors': true,
611
- 'bg-contrast-5 text-disabled cursor-default': isAddButtonDisabled,
612
- 'bg-success-10 text-success cursor-pointer': !isAddButtonDisabled,
613
- 'hover-bg-success hover-text-success-contrast': !isAddButtonDisabled,
614
- 'focus-outline-none focus-ring-2': !isAddButtonDisabled,
463
+ <foxy-internal-switch-control
464
+ json-template=${this.__defaultJSON}
465
+ json-path="tos_checkbox_settings.is_hidden"
466
+ property="json"
467
+ infer="tos-checkbox-settings-is-hidden"
468
+ >
469
+ </foxy-internal-switch-control>
470
+ </foxy-internal-summary-control>
471
+
472
+ <foxy-internal-summary-control infer="consent-group-two">
473
+ <foxy-internal-switch-control
474
+ json-template=${this.__defaultJSON}
475
+ false-alias="none"
476
+ true-alias="required"
477
+ json-path="eu_secure_data_transfer_consent.usage"
478
+ property="json"
479
+ infer="eu-secure-data-transfer-consent-usage"
480
+ >
481
+ </foxy-internal-switch-control>
482
+ </foxy-internal-summary-control>
483
+
484
+ <foxy-internal-summary-control infer="consent-group-three">
485
+ <foxy-internal-switch-control
486
+ json-template=${this.__defaultJSON}
487
+ false-alias="none"
488
+ true-alias="required"
489
+ json-path="newsletter_subscribe.usage"
490
+ property="json"
491
+ infer="newsletter-subscribe-usage"
492
+ >
493
+ </foxy-internal-switch-control>
494
+ </foxy-internal-summary-control>
495
+
496
+ <foxy-internal-summary-control infer="supported-cards-group">
497
+ <foxy-internal-template-config-form-supported-cards-control
498
+ json-template=${this.__defaultJSON}
499
+ json-path="supported_payment_cards"
500
+ property="json"
501
+ infer="supported-payment-cards"
502
+ >
503
+ </foxy-internal-template-config-form-supported-cards-control>
504
+
505
+ <p class="flex items-start gap-s">
506
+ ${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>`}
507
+ <foxy-i18n infer="" key="disclaimer"></foxy-i18n>
508
+ </p>
509
+ </foxy-internal-summary-control>
510
+
511
+ <foxy-internal-summary-control infer="csc-requirements-group">
512
+ <foxy-internal-select-control
513
+ json-template=${this.__defaultJSON}
514
+ json-path="csc_requirements"
515
+ property="json"
516
+ options=${this.__cscRequirementsValueOptions}
517
+ layout="summary-item"
518
+ infer="csc-requirements"
519
+ >
520
+ </foxy-internal-select-control>
521
+ </foxy-internal-summary-control>
522
+
523
+ <foxy-internal-summary-control infer="checkout-fields-group-one">
524
+ <foxy-internal-switch-control
525
+ json-template=${this.__defaultJSON}
526
+ false-alias="disabled"
527
+ true-alias="enabled"
528
+ json-path="custom_checkout_field_requirements.cart_controls"
529
+ property="json"
530
+ infer="custom-checkout-field-requirements-cart-controls"
531
+ >
532
+ </foxy-internal-switch-control>
533
+ </foxy-internal-summary-control>
534
+
535
+ <div
536
+ class="grid sm-grid-cols-2 gap-m"
537
+ ?hidden=${customCheckoutFieldRequirementsControls.every((group, index) => {
538
+ return group.every(prop => {
539
+ const suffix = index === 0 ? 'two' : 'three';
540
+ const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');
541
+ const sel = `checkout-fields-group-${suffix}:custom-checkout-field-requirements-${infer}`;
542
+ return this.hiddenSelector.matches(sel, true);
543
+ });
615
544
  })}
616
- ?disabled=${isAddButtonDisabled}
617
- @click=${addField}
618
- >
619
- <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon>
620
- </button>
621
- </div>
622
- </x-group>
623
-
624
- ${this.renderTemplateOrSlot('hidden-fields:after')}
625
- </div>
626
- `;
627
- }
628
- __renderCards(json) {
629
- const { lang, ns } = this;
630
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('cards', true);
631
- const isReadonly = this.readonlySelector.matches('cards', true);
632
- const config = json.supported_payment_cards;
633
- let skipForSaved;
634
- let skipForSSO;
635
- if (json.csc_requirements === 'all_cards') {
636
- skipForSaved = false;
637
- skipForSSO = false;
638
- }
639
- else if (json.csc_requirements === 'sso_only') {
640
- skipForSaved = true;
641
- skipForSSO = false;
642
- }
643
- else {
644
- skipForSaved = true;
645
- skipForSSO = true;
646
- }
647
- const typeToName = {
648
- amex: 'American Express',
649
- diners: 'Diners Club',
650
- discover: 'Discover',
651
- jcb: 'JCB',
652
- maestro: 'Maestro',
653
- mastercard: 'Mastercard',
654
- unionpay: 'UnionPay',
655
- visa: 'Visa',
656
- };
657
- return html `
658
- <div data-testid="cards">
659
- ${this.renderTemplateOrSlot('cards:before')}
660
-
661
- <div class="space-y-xs">
662
- <x-group frame>
663
- <foxy-i18n
664
- class=${isDisabled ? 'text-disabled' : ''}
665
- slot="header"
666
- lang=${lang}
667
- key="supported_cards"
668
- ns=${ns}
669
- >
670
- </foxy-i18n>
671
-
672
- <div class="flex flex-wrap m-xs p-s">
673
- ${Object.entries(logos).map(([type, logo]) => {
674
- if (!typeToName[type])
675
- return;
676
- const isChecked = config.includes(type);
545
+ >
546
+ ${customCheckoutFieldRequirementsControls.map((group, index) => {
547
+ const suffix = index === 0 ? 'two' : 'three';
677
548
  return html `
678
- <div
679
- class=${classMap({
680
- 'm-xs rounded': true,
681
- 'opacity-50 cursor-default': isDisabled,
682
- 'cursor-pointer ring-primary-50 focus-within-ring-2': !isDisabled,
683
- })}
549
+ <foxy-internal-summary-control infer="checkout-fields-group-${suffix}">
550
+ ${group.map(prop => {
551
+ const infer = prop.replace(/_/g, '-').replace('1', '-one').replace('2', '-two');
552
+ const path = `custom_checkout_field_requirements.${prop}`;
553
+ return html `
554
+ <foxy-internal-select-control
555
+ json-template=${this.__defaultJSON}
556
+ json-path=${path}
557
+ property="json"
558
+ options=${prop === 'coupon_entry'
559
+ ? this.__customCheckoutFieldCouponEntryRequirementsOptions
560
+ : this.__customCheckoutFieldRequirementsOptions}
561
+ layout="summary-item"
562
+ infer="custom-checkout-field-requirements-${infer}"
684
563
  >
685
- <label
686
- class=${classMap({
687
- 'overflow-hidden transition-colors flex rounded-s border': true,
688
- 'border-primary bg-primary-10 text-primary': isChecked && !isReadonly,
689
- 'border-contrast bg-contrast-5 text-secondary': isChecked && isReadonly,
690
- 'hover-text-body': isChecked && !isDisabled && !isReadonly,
691
- 'border-contrast-10': !isChecked,
692
- 'hover-border-primary': !isChecked && !isDisabled && !isReadonly,
693
- 'hover-text-primary': !isChecked && !isDisabled && !isReadonly,
694
- })}
695
- >
696
- <div class="h-s">${logo}</div>
697
-
698
- <div class="text-s font-medium mx-s my-auto leading-none">
699
- ${typeToName[type]}
700
- </div>
701
-
702
- <input
703
- type="checkbox"
704
- class="sr-only"
705
- ?disabled=${isDisabled}
706
- ?readonly=${isReadonly}
707
- ?checked=${isChecked}
708
- @change=${(evt) => {
709
- if (isReadonly)
710
- return evt.preventDefault();
711
- evt.stopPropagation();
712
- if (evt.currentTarget.checked) {
713
- config.push(type);
714
- }
715
- else {
716
- config.splice(config.indexOf(type), 1);
717
- }
718
- this.edit({ json: JSON.stringify(json) });
719
- }}
720
- />
721
- </label>
722
- </div>
564
+ </foxy-internal-select-control>
723
565
  `;
566
+ })}
567
+ </foxy-internal-summary-control>
568
+ `;
724
569
  })}
725
- </div>
726
-
727
- <div class="flex flex-wrap p-s border-t border-contrast-10">
728
- <x-checkbox
729
- data-testid="cards-saved-check"
730
- class="m-s"
731
- ?disabled=${isDisabled || json.csc_requirements === 'new_cards_only'}
732
- ?readonly=${isReadonly}
733
- ?checked=${skipForSaved}
734
- @change=${(evt) => {
735
- json.csc_requirements = evt.detail ? 'sso_only' : 'all_cards';
736
- this.edit({ json: JSON.stringify(json) });
737
- }}
738
- >
739
- <foxy-i18n class="leading-s block" lang=${lang} key="skip_csc_for_saved" ns=${ns}>
740
- </foxy-i18n>
741
- </x-checkbox>
742
-
743
- <x-checkbox
744
- data-testid="cards-sso-check"
745
- class="m-s"
746
- ?disabled=${isDisabled}
747
- ?readonly=${isReadonly}
748
- ?checked=${skipForSSO}
749
- @change=${(evt) => {
750
- json.csc_requirements = evt.detail
751
- ? 'new_cards_only'
752
- : skipForSaved
753
- ? 'sso_only'
754
- : 'all_cards';
755
- this.edit({ json: JSON.stringify(json) });
756
- }}
757
- >
758
- <foxy-i18n class="leading-s block" lang=${lang} key="skip_csc_for_sso" ns=${ns}>
759
- </foxy-i18n>
760
- </x-checkbox>
761
- </div>
762
- </x-group>
763
-
764
- <foxy-i18n
765
- class="text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}"
766
- lang=${lang}
767
- key="supported_cards_disclaimer"
768
- ns=${ns}
769
- >
770
- </foxy-i18n>
771
- </div>
772
-
773
- ${this.renderTemplateOrSlot('cards:after')}
774
570
  </div>
775
- `;
776
- }
777
- __renderCheckoutType(json) {
778
- const { lang, ns } = this;
779
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('checkout-type', true);
780
- const isReadonly = this.readonlySelector.matches('checkout-type', true);
781
- return html `
782
- <div data-testid="checkout-type">
783
- ${this.renderTemplateOrSlot('checkout-type:before')}
784
571
 
785
- <div class="space-y-xs">
786
- <x-group frame>
787
- <foxy-i18n
788
- class=${isDisabled ? 'text-disabled' : ''}
789
- slot="header"
790
- lang=${lang}
791
- key="checkout_type"
792
- ns=${ns}
793
- >
794
- </foxy-i18n>
572
+ <foxy-internal-summary-control infer="analytics-config">
573
+ <foxy-internal-switch-control
574
+ json-template=${this.__defaultJSON}
575
+ false-alias="none"
576
+ true-alias="required"
577
+ json-path="analytics_config.usage"
578
+ property="json"
579
+ infer="analytics-config-usage"
580
+ >
581
+ </foxy-internal-switch-control>
582
+ </foxy-internal-summary-control>
583
+
584
+ <foxy-internal-summary-control infer="analytics-config-google-analytics">
585
+ <foxy-internal-switch-control
586
+ json-template=${this.__defaultJSON}
587
+ false-alias="none"
588
+ true-alias="required"
589
+ json-path="analytics_config.google_analytics.usage"
590
+ property="json"
591
+ infer="analytics-config-google-analytics-usage"
592
+ >
593
+ </foxy-internal-switch-control>
594
+
595
+ <foxy-internal-text-control
596
+ json-template=${this.__defaultJSON}
597
+ json-path="analytics_config.google_analytics.account_id"
598
+ property="json"
599
+ layout="summary-item"
600
+ infer="analytics-config-google-analytics-account-id"
601
+ >
602
+ </foxy-internal-text-control>
795
603
 
796
- <x-choice
797
- data-testid="checkout-type-choice"
798
- ?disabled=${isDisabled}
799
- ?readonly=${isReadonly}
800
- .items=${['default_account', 'default_guest', 'guest_only', 'account_only']}
801
- .value=${json.checkout_type}
802
- .getText=${(item) => this.t(`checkout_type_${item}`)}
803
- @change=${(evt) => {
804
- json.checkout_type = evt.detail;
805
- this.edit({ json: JSON.stringify(json) });
806
- }}
604
+ <foxy-internal-switch-control
605
+ json-template=${this.__defaultJSON}
606
+ json-path="analytics_config.google_analytics.include_on_site"
607
+ property="json"
608
+ infer="analytics-config-google-analytics-include-on-site"
609
+ >
610
+ </foxy-internal-switch-control>
611
+
612
+ <p class="flex items-start gap-s bg-error-10 text-error">
613
+ ${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>`}
614
+ <foxy-i18n infer="" key="deprecation_notice"></foxy-i18n>
615
+ </p>
616
+ </foxy-internal-summary-control>
617
+
618
+ <foxy-internal-summary-control infer="analytics-config-google-tag">
619
+ <foxy-internal-switch-control
620
+ json-template=${this.__defaultJSON}
621
+ false-alias="none"
622
+ true-alias="required"
623
+ json-path="analytics_config.google_tag.usage"
624
+ property="json"
625
+ infer="analytics-config-google-tag-usage"
626
+ >
627
+ </foxy-internal-switch-control>
628
+
629
+ <foxy-internal-text-control
630
+ json-template=${this.__defaultJSON}
631
+ json-path="analytics_config.google_tag.account_id"
632
+ property="json"
633
+ layout="summary-item"
634
+ infer="analytics-config-google-tag-account-id"
635
+ >
636
+ </foxy-internal-text-control>
637
+
638
+ <foxy-internal-text-control
639
+ json-template=${this.__defaultJSON}
640
+ json-path="analytics_config.google_tag.send_to"
641
+ property="json"
642
+ layout="summary-item"
643
+ infer="analytics-config-google-tag-send-to"
644
+ >
645
+ </foxy-internal-text-control>
646
+
647
+ <p class="flex items-start gap-s">
648
+ ${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>`}
649
+ <span>
650
+ <foxy-i18n infer="" key="usage_notice"></foxy-i18n>
651
+ <br />
652
+ <a
653
+ target="_blank"
654
+ class="cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50"
655
+ href="https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads"
656
+ rel="nofollow noreferrer noopener"
807
657
  >
808
- </x-choice>
809
- </x-group>
810
-
811
- <foxy-i18n
812
- class="text-xs leading-s block ${isDisabled ? 'text-disabled' : 'text-secondary'}"
813
- lang=${lang}
814
- key="checkout_type_helper_text"
815
- ns=${ns}
816
- >
817
- </foxy-i18n>
818
- </div>
819
-
820
- ${this.renderTemplateOrSlot('checkout-type:after')}
821
- </div>
822
- `;
823
- }
824
- __renderConsent(json) {
825
- const { lang, ns } = this;
826
- const tosConfig = json.tos_checkbox_settings;
827
- const mailConfig = json.newsletter_subscribe;
828
- const sdtaConfig = json.eu_secure_data_transfer_consent;
829
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('consent', true);
830
- const isReadonly = this.readonlySelector.matches('consent', true);
831
- const dividerStyle = 'margin-left: calc(1.125rem + (var(--lumo-space-m) * 2))';
832
- return html `
833
- <div data-testid="consent">
834
- ${this.renderTemplateOrSlot('consent:before')}
835
-
836
- <x-group frame>
837
- <foxy-i18n
838
- class=${isDisabled ? 'text-disabled' : ''}
839
- slot="header"
840
- lang=${lang}
841
- key="consent"
842
- ns=${ns}
843
- >
844
- </foxy-i18n>
845
-
846
- <x-checkbox
847
- data-testid="consent-tos-check"
848
- ?disabled=${isDisabled}
849
- ?readonly=${isReadonly}
850
- ?checked=${tosConfig.usage === 'required' || tosConfig.usage === 'optional'}
851
- class="m-m"
852
- @change=${(evt) => {
853
- tosConfig.initial_state = evt.detail ? tosConfig.initial_state : 'unchecked';
854
- tosConfig.is_hidden = false;
855
- tosConfig.usage = evt.detail ? 'required' : 'none';
856
- tosConfig.url = evt.detail ? tosConfig.url : '';
857
- this.edit({ json: JSON.stringify(json) });
858
- }}
859
- >
860
- <div class="flex flex-col">
861
- <foxy-i18n lang=${lang} key="display_tos_link" ns=${ns}></foxy-i18n>
862
- <foxy-i18n
863
- class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
864
- lang=${lang}
865
- key="display_tos_link_explainer"
866
- ns=${ns}
867
- >
658
+ <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="docs_link">
868
659
  </foxy-i18n>
869
- </div>
870
-
871
- <div slot="content" ?hidden=${tosConfig.usage === 'none'}>
872
- <vaadin-text-field
873
- data-testid="consent-tos-field"
874
- label=${this.t('location_url')}
875
- class="w-full mt-m"
876
- placeholder="https://example.com/path/to/tos"
877
- clear-button-visible
878
- ?disabled=${isDisabled}
879
- ?readonly=${isReadonly}
880
- .value=${tosConfig.url}
881
- @input=${(evt) => {
882
- tosConfig.url = evt.currentTarget.value;
883
- this.edit({ json: JSON.stringify(json) });
884
- }}
885
- >
886
- </vaadin-text-field>
887
-
888
- <div class="flex flex-wrap -mx-s -mb-s mt-s">
889
- <x-checkbox
890
- data-testid="consent-tos-require-check"
891
- class="m-s"
892
- ?disabled=${isDisabled}
893
- ?readonly=${isReadonly}
894
- ?checked=${tosConfig.usage === 'required'}
895
- @change=${(evt) => {
896
- tosConfig.usage = evt.detail ? 'required' : 'optional';
897
- this.edit({ json: JSON.stringify(json) });
898
- }}
899
- >
900
- <foxy-i18n class="leading-s block" lang=${lang} key="require_consent" ns=${ns}>
901
- </foxy-i18n>
902
- </x-checkbox>
903
-
904
- <x-checkbox
905
- data-testid="consent-tos-state-check"
906
- class="m-s"
907
- ?disabled=${isDisabled}
908
- ?readonly=${isReadonly}
909
- ?checked=${tosConfig.initial_state === 'checked'}
910
- @change=${(evt) => {
911
- tosConfig.initial_state = evt.detail ? 'checked' : 'unchecked';
912
- this.edit({ json: JSON.stringify(json) });
913
- }}
914
- >
915
- <foxy-i18n class="leading-s block" lang=${lang} key="checked_by_default" ns=${ns}>
916
- </foxy-i18n>
917
- </x-checkbox>
918
- </div>
919
- </div>
920
- </x-checkbox>
921
-
922
- <div style=${dividerStyle} class="border-b border-contrast-10"></div>
923
-
924
- <x-checkbox
925
- data-testid="consent-mail-check"
926
- ?disabled=${isDisabled}
927
- ?readonly=${isReadonly}
928
- ?checked=${mailConfig.usage === 'required'}
929
- class="m-m"
930
- @change=${(evt) => {
931
- mailConfig.usage = evt.detail ? 'required' : 'none';
932
- this.edit({ json: JSON.stringify(json) });
933
- }}
934
- >
935
- <div class="flex flex-col">
936
- <foxy-i18n lang=${lang} key="newsletter_subscribe" ns=${ns}></foxy-i18n>
937
- <foxy-i18n
938
- class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
939
- lang=${lang}
940
- key="newsletter_subscribe_explainer"
941
- ns=${ns}
942
- >
943
- </foxy-i18n>
944
- </div>
945
- </x-checkbox>
946
-
947
- <div style=${dividerStyle} class="border-b border-contrast-10"></div>
948
-
949
- <x-checkbox
950
- data-testid="consent-sdta-check"
951
- ?disabled=${isDisabled}
952
- ?readonly=${isReadonly}
953
- ?checked=${sdtaConfig.usage === 'required'}
954
- class="m-m"
955
- @change=${(evt) => {
956
- sdtaConfig.usage = evt.detail ? 'required' : 'none';
957
- this.edit({ json: JSON.stringify(json) });
958
- }}
959
- >
960
- <div class="flex flex-col">
961
- <foxy-i18n lang=${lang} key="display_sdta" ns=${ns}></foxy-i18n>
962
- <foxy-i18n
963
- class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
964
- lang=${lang}
965
- key="display_sdta_explainer"
966
- ns=${ns}
967
- >
968
- </foxy-i18n>
969
- </div>
970
- </x-checkbox>
971
- </x-group>
972
-
973
- ${this.renderTemplateOrSlot('consent:after')}
974
- </div>
975
- `;
976
- }
977
- __renderFields(json) {
978
- const { lang, ns } = this;
979
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('fields', true);
980
- const isReadonly = this.readonlySelector.matches('fields', true);
981
- const config = json.custom_checkout_field_requirements;
982
- const options = {
983
- cart_controls: ['enabled', 'disabled'],
984
- coupon_entry: ['enabled', 'disabled'],
985
- billing_first_name: ['default', 'optional', 'required', 'hidden'],
986
- billing_last_name: ['default', 'optional', 'required', 'hidden'],
987
- billing_company: ['default', 'optional', 'required', 'hidden'],
988
- billing_tax_id: ['default', 'optional', 'required', 'hidden'],
989
- billing_phone: ['default', 'optional', 'required', 'hidden'],
990
- billing_address1: ['default', 'optional', 'required', 'hidden'],
991
- billing_address2: ['default', 'optional', 'required', 'hidden'],
992
- billing_city: ['default', 'optional', 'required', 'hidden'],
993
- billing_region: ['default', 'optional', 'required', 'hidden'],
994
- billing_postal_code: ['default', 'optional', 'required', 'hidden'],
995
- billing_country: ['default', 'optional', 'required', 'hidden'],
996
- };
997
- return html `
998
- <div data-testid="fields">
999
- ${this.renderTemplateOrSlot('fields:before')}
660
+ </a>
661
+ </span>
662
+ </p>
663
+ </foxy-internal-summary-control>
664
+
665
+ <foxy-internal-summary-control infer="debug">
666
+ <foxy-internal-switch-control
667
+ json-template=${this.__defaultJSON}
668
+ false-alias="none"
669
+ true-alias="required"
670
+ json-path="debug.usage"
671
+ property="json"
672
+ infer="debug-usage"
673
+ >
674
+ </foxy-internal-switch-control>
675
+ </foxy-internal-summary-control>
1000
676
 
1001
- <x-group frame>
1002
- <foxy-i18n
1003
- class=${isDisabled ? 'text-disabled' : ''}
1004
- slot="header"
1005
- lang=${lang}
1006
- key="field_plural"
1007
- ns=${ns}
1008
- >
1009
- </foxy-i18n>
677
+ <foxy-internal-source-control
678
+ infer="custom-config"
679
+ .getValue=${this.__customConfigGetValue}
680
+ .setValue=${this.__customConfigSetValue}
681
+ >
682
+ </foxy-internal-source-control>
1010
683
 
1011
- <div class="bg-contrast-10 grid grid-cols-1 sm-grid-cols-2" style="gap: 1px">
1012
- ${Object.entries(options).map(([property, values]) => {
1013
- return html `
1014
- <label
1015
- class=${classMap({
1016
- 'flex items-center pl-m bg-base': true,
1017
- 'text-secondary': isReadonly,
1018
- 'text-disabled': isDisabled,
1019
- })}
1020
- >
1021
- <foxy-i18n
1022
- class="flex-1"
1023
- lang=${lang}
1024
- key=${property.replace('billing_', '')}
1025
- ns=${ns}
1026
- >
1027
- </foxy-i18n>
684
+ <foxy-internal-source-control
685
+ json-template=${this.__defaultJSON}
686
+ json-path="custom_script_values.header"
687
+ property="json"
688
+ infer="custom-script-values-header"
689
+ >
690
+ </foxy-internal-source-control>
1028
691
 
1029
- <div
1030
- class=${classMap({
1031
- 'flex items-center text-right font-medium h-s px-s m-xs': isReadonly,
1032
- 'hidden': !isReadonly,
1033
- })}
1034
- >
1035
- ${this.t(values.find(value => config[property] === value))}
1036
- </div>
692
+ <foxy-internal-source-control
693
+ json-template=${this.__defaultJSON}
694
+ json-path="custom_script_values.checkout_fields"
695
+ property="json"
696
+ infer="custom-script-values-checkout-fields"
697
+ >
698
+ </foxy-internal-source-control>
1037
699
 
1038
- <div
1039
- class=${classMap({
1040
- 'px-s m-xs flex items-center rounded leading-none': true,
1041
- 'ring-primary-50 ring-inset focus-within-ring-2': !isDisabled,
1042
- 'hover-text-primary': !isDisabled,
1043
- 'cursor-pointer': !isDisabled,
1044
- 'cursor-default': isDisabled,
1045
- 'flex': !isReadonly,
1046
- 'hidden': isReadonly,
1047
- })}
1048
- >
1049
- <select
1050
- data-testid="fields-${property}"
1051
- class=${classMap({
1052
- 'h-s mr-xs text-right appearance-none bg-transparent font-medium': true,
1053
- 'focus-outline-none cursor-pointer': !isDisabled,
1054
- 'cursor-default': isDisabled,
1055
- })}
1056
- ?disabled=${isDisabled}
1057
- ?readonly=${isReadonly}
1058
- @change=${(evt) => {
1059
- const select = evt.currentTarget;
1060
- const value = select.options[select.options.selectedIndex].value;
1061
- config[property] = value;
1062
- this.edit({ json: JSON.stringify(json) });
1063
- }}
1064
- >
1065
- ${values.map(value => {
1066
- return html `
1067
- <option
1068
- value=${value}
1069
- ?selected=${config[property] === value}
1070
- >
1071
- ${this.t(value)}
1072
- </option>
1073
- `;
1074
- })}
1075
- </select>
700
+ <foxy-internal-source-control
701
+ json-template=${this.__defaultJSON}
702
+ json-path="custom_script_values.multiship_checkout_fields"
703
+ property="json"
704
+ infer="custom-script-values-multiship-checkout-fields"
705
+ >
706
+ </foxy-internal-source-control>
1076
707
 
1077
- <iron-icon
1078
- class="pointer-events-none icon-inline text-xl"
1079
- icon="icons:expand-more"
1080
- >
1081
- </iron-icon>
1082
- </div>
1083
- </label>
1084
- `;
1085
- })}
708
+ <foxy-internal-source-control
709
+ json-template=${this.__defaultJSON}
710
+ json-path="custom_script_values.footer"
711
+ property="json"
712
+ infer="custom-script-values-footer"
713
+ >
714
+ </foxy-internal-source-control>
1086
715
 
1087
- <div class="bg-base hidden sm-block"></div>
1088
- </div>
1089
- </x-group>
716
+ ${super.renderBody()}
1090
717
 
1091
- ${this.renderTemplateOrSlot('fields:after')}
1092
- </div>
718
+ <foxy-nucleon
719
+ class="hidden"
720
+ infer=""
721
+ href=${ifDefined((_g = this.store) !== null && _g !== void 0 ? _g : (_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:store'].href)}
722
+ id="storeLoader"
723
+ @update=${() => this.requestUpdate()}
724
+ >
725
+ </foxy-nucleon>
1093
726
  `;
1094
727
  }
1095
- __renderGoogleAnalytics(json) {
1096
- const { lang, ns } = this;
1097
- const config = json.analytics_config;
1098
- const gtConfig = config.google_tag;
1099
- const gaConfig = config.google_analytics;
1100
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('google-analytics', true);
1101
- const isReadonly = this.readonlySelector.matches('google-analytics', true);
1102
- return html `
1103
- <div data-testid="google-analytics">
1104
- ${this.renderTemplateOrSlot('google-analytics:before')}
1105
-
1106
- <x-group frame>
1107
- <span class=${isDisabled ? 'text-disabled' : ''} slot="header">Google Analytics</span>
1108
-
1109
- <foxy-i18n
1110
- class="block bg-error-10 text-error font-medium rounded-t p-m"
1111
- infer=""
1112
- key="ga_deprecation_notice"
1113
- >
1114
- </foxy-i18n>
1115
-
1116
- <div class="p-m space-y-m">
1117
- <vaadin-text-field
1118
- data-testid="google-analytics-field"
1119
- style="--lumo-border-radius: var(--lumo-border-radius-s)"
1120
- class="w-full"
1121
- label=${this.t('ga_account_id')}
1122
- placeholder="UA-1234567-1"
1123
- helper-text=${this.t('ga_account_id_explainer')}
1124
- .value=${live(gaConfig.account_id)}
1125
- ?disabled=${isDisabled}
1126
- ?readonly=${isReadonly}
1127
- clear-button-visible
1128
- @keydown=${(evt) => evt.key === 'Enter' && this.submit()}
1129
- @input=${(evt) => {
1130
- gaConfig.account_id = evt.currentTarget.value;
1131
- gaConfig.usage = gaConfig.account_id ? 'required' : 'none';
1132
- config.usage = gaConfig.account_id || gtConfig.account_id ? 'required' : 'none';
1133
- this.edit({ json: JSON.stringify(json) });
1134
- }}
1135
- >
1136
- </vaadin-text-field>
1137
-
1138
- <x-checkbox
1139
- data-testid="google-analytics-check"
1140
- ?disabled=${isDisabled}
1141
- ?readonly=${isReadonly}
1142
- ?checked=${gaConfig.include_on_site}
1143
- @change=${(evt) => {
1144
- gaConfig.include_on_site = evt.detail;
1145
- this.edit({ json: JSON.stringify(json) });
1146
- }}
1147
- >
1148
- <div class="flex flex-col">
1149
- <foxy-i18n lang=${lang} key="ga_include_on_site" ns=${ns}></foxy-i18n>
1150
- <foxy-i18n
1151
- class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
1152
- lang=${lang}
1153
- key="ga_include_on_site_explainer"
1154
- ns=${ns}
1155
- >
1156
- </foxy-i18n>
1157
- </div>
1158
- </x-checkbox>
1159
- </div>
1160
- </x-group>
1161
-
1162
- ${this.renderTemplateOrSlot('google-analytics:after')}
1163
- </div>
1164
- `;
728
+ get __storeLoader() {
729
+ return this.renderRoot.querySelector('#storeLoader');
1165
730
  }
1166
- __renderGoogleTag(json) {
1167
- const config = json.analytics_config;
1168
- const gtConfig = config.google_tag;
1169
- const gaConfig = config.google_analytics;
1170
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('google-tag', true);
1171
- const isReadonly = this.readonlySelector.matches('google-tag', true);
1172
- return html `
1173
- <div data-testid="google-tag">
1174
- ${this.renderTemplateOrSlot('google-tag:before')}
1175
-
1176
- <x-group frame>
1177
- <span class=${isDisabled ? 'text-disabled' : ''} slot="header">Google Tag</span>
1178
-
1179
- <div class="p-m space-y-m">
1180
- <vaadin-text-field
1181
- data-testid="google-tag-account-id"
1182
- style="--lumo-border-radius: var(--lumo-border-radius-s)"
1183
- class="w-full"
1184
- label=${this.t('gt_account_id')}
1185
- placeholder="G-123456789"
1186
- helper-text=${this.t('gt_account_id_explainer')}
1187
- .value=${live(gtConfig.account_id)}
1188
- ?disabled=${isDisabled}
1189
- ?readonly=${isReadonly}
1190
- clear-button-visible
1191
- @keydown=${(evt) => evt.key === 'Enter' && this.submit()}
1192
- @input=${(evt) => {
1193
- gtConfig.account_id = evt.currentTarget.value;
1194
- gtConfig.usage = gtConfig.account_id ? 'required' : 'none';
1195
- config.usage = gtConfig.account_id || gaConfig.account_id ? 'required' : 'none';
1196
- this.edit({ json: JSON.stringify(json) });
1197
- }}
1198
- >
1199
- </vaadin-text-field>
1200
-
1201
- <vaadin-text-field
1202
- data-testid="google-tag-send-to"
1203
- style="--lumo-border-radius: var(--lumo-border-radius-s)"
1204
- class="w-full"
1205
- label=${this.t('gt_send_to')}
1206
- placeholder="AW-123456789/sABDCLqU3K2BEJb8cxDE"
1207
- helper-text=${this.t('gt_send_to_explainer')}
1208
- .value=${live(gtConfig.send_to)}
1209
- ?disabled=${isDisabled}
1210
- ?readonly=${isReadonly}
1211
- clear-button-visible
1212
- @keydown=${(evt) => evt.key === 'Enter' && this.submit()}
1213
- @input=${(evt) => {
1214
- gtConfig.send_to = evt.currentTarget.value;
1215
- gtConfig.usage = gtConfig.account_id ? 'required' : 'none';
1216
- config.usage = gtConfig.account_id || gaConfig.account_id ? 'required' : 'none';
1217
- this.edit({ json: JSON.stringify(json) });
1218
- }}
1219
- >
1220
- </vaadin-text-field>
1221
-
1222
- <p class="text-xs text-secondary">
1223
- <foxy-i18n infer="" key="gt_usage_notice"></foxy-i18n>
1224
- <a
1225
- target="_blank"
1226
- class="cursor-pointer group text-primary rounded-s font-medium focus-outline-none focus-ring-2 focus-ring-primary-50"
1227
- href="https://wiki.foxycart.com/v/2.0/analytics#google_tag_ga4_google_ads"
1228
- rel="nofollow noreferrer noopener"
1229
- >
1230
- <foxy-i18n
1231
- class="transition-opacity group-hover-opacity-80"
1232
- infer=""
1233
- key="gt_docs_link"
1234
- >
1235
- </foxy-i18n>
1236
- </a>
1237
- </p>
1238
- </div>
1239
- </x-group>
1240
-
1241
- ${this.renderTemplateOrSlot('google-tag:after')}
1242
- </div>
1243
- `;
731
+ get __formJson() {
732
+ return this.form.json ? JSON.parse(this.form.json) : getDefaultJSON();
1244
733
  }
1245
- __renderTroubleshooting(json) {
1246
- const { lang, ns } = this;
1247
- const config = json.debug;
1248
- const isDisabled = !this.in('idle') || this.disabledSelector.matches('troubleshooting', true);
1249
- const isReadonly = this.readonlySelector.matches('troubleshooting', true);
1250
- return html `
1251
- <div data-testid="troubleshooting">
1252
- ${this.renderTemplateOrSlot('troubleshooting:before')}
1253
-
1254
- <x-group frame>
1255
- <foxy-i18n
1256
- class=${isDisabled ? 'text-disabled' : ''}
1257
- slot="header"
1258
- lang=${lang}
1259
- key="troubleshooting"
1260
- ns=${ns}
1261
- >
1262
- </foxy-i18n>
1263
-
1264
- <div class="p-m space-y-m">
1265
- <x-checkbox
1266
- data-testid="troubleshooting-check"
1267
- ?disabled=${isDisabled}
1268
- ?readonly=${isReadonly}
1269
- ?checked=${config.usage === 'required'}
1270
- @change=${(evt) => {
1271
- config.usage = evt.detail ? 'required' : 'none';
1272
- this.edit({ json: JSON.stringify(json) });
1273
- }}
1274
- >
1275
- <div class="flex flex-col">
1276
- <foxy-i18n lang=${lang} key="troubleshooting_debug" ns=${ns}></foxy-i18n>
1277
- <foxy-i18n
1278
- class="text-xs leading-s ${isDisabled ? 'text-disabled' : 'text-secondary'}"
1279
- lang=${lang}
1280
- key="troubleshooting_debug_explainer"
1281
- ns=${ns}
1282
- >
1283
- </foxy-i18n>
1284
- </div>
1285
- </x-checkbox>
1286
- </div>
1287
- </x-group>
1288
-
1289
- ${this.renderTemplateOrSlot('troubleshooting:after')}
1290
- </div>
1291
- `;
734
+ get __dataJson() {
735
+ var _a;
736
+ return ((_a = this.data) === null || _a === void 0 ? void 0 : _a.json) ? JSON.parse(this.data.json) : null;
1292
737
  }
1293
738
  }
1294
739
  //# sourceMappingURL=TemplateConfigForm.js.map