@foxy.io/elements 1.18.0-beta.12 → 1.18.0-beta.14

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 (251) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +2 -2
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-api-browser.js +1 -1
  5. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-card.js +1 -1
  7. package/dist/cdn/foxy-attribute-form.js +1 -1
  8. package/dist/cdn/foxy-cancellation-form.js +1 -1
  9. package/dist/cdn/foxy-collection-page.js +1 -1
  10. package/dist/cdn/foxy-collection-pages.js +1 -1
  11. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  12. package/dist/cdn/foxy-coupon-card.js +1 -1
  13. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  14. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  15. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  16. package/dist/cdn/foxy-coupon-form.js +1 -1
  17. package/dist/cdn/foxy-custom-field-card.js +1 -1
  18. package/dist/cdn/foxy-custom-field-form.js +1 -1
  19. package/dist/cdn/foxy-customer-api.js +1 -1
  20. package/dist/cdn/foxy-customer-card.js +1 -1
  21. package/dist/cdn/foxy-customer-form.js +1 -1
  22. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  23. package/dist/cdn/foxy-customer-portal.js +1 -1
  24. package/dist/cdn/foxy-customer.js +2 -2
  25. package/dist/cdn/foxy-customers-table.js +1 -1
  26. package/dist/cdn/foxy-discount-builder.js +1 -1
  27. package/dist/cdn/foxy-discount-card.js +1 -1
  28. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  29. package/dist/cdn/foxy-donation.js +1 -1
  30. package/dist/cdn/foxy-email-template-card.js +1 -1
  31. package/dist/cdn/foxy-email-template-form.js +1 -1
  32. package/dist/cdn/foxy-error-entry-card.js +1 -1
  33. package/dist/cdn/foxy-form-dialog.js +1 -1
  34. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  35. package/dist/cdn/foxy-gift-card-card.js +1 -1
  36. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  37. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  38. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  39. package/dist/cdn/foxy-gift-card-form.js +1 -1
  40. package/dist/cdn/foxy-i18n.js +1 -1
  41. package/dist/cdn/foxy-item-card.js +1 -1
  42. package/dist/cdn/foxy-item-category-card.js +1 -1
  43. package/dist/cdn/foxy-item-category-form.js +1 -1
  44. package/dist/cdn/foxy-item-form.js +1 -1
  45. package/dist/cdn/foxy-item-option-card.js +1 -1
  46. package/dist/cdn/foxy-item-option-form.js +1 -1
  47. package/dist/cdn/foxy-items-form.js +1 -1
  48. package/dist/cdn/foxy-nucleon-element.js +1 -1
  49. package/dist/cdn/foxy-pagination.js +1 -1
  50. package/dist/cdn/foxy-payment-card.js +1 -1
  51. package/dist/cdn/foxy-payment-method-card.js +1 -1
  52. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  53. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  54. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  55. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  56. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  57. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  58. package/dist/cdn/foxy-payments-api.js +1 -1
  59. package/dist/cdn/foxy-query-builder.js +1 -1
  60. package/dist/cdn/foxy-report-form.js +12 -12
  61. package/dist/cdn/foxy-reports-table.js +1 -1
  62. package/dist/cdn/foxy-shipment-card.js +1 -1
  63. package/dist/cdn/foxy-sign-in-form.js +1 -1
  64. package/dist/cdn/foxy-spinner.js +2 -2
  65. package/dist/cdn/foxy-store-form.js +1 -0
  66. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  67. package/dist/cdn/foxy-subscription-card.js +1 -1
  68. package/dist/cdn/foxy-subscription-form.js +4 -4
  69. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  70. package/dist/cdn/foxy-table.js +1 -1
  71. package/dist/cdn/foxy-tax-card.js +1 -1
  72. package/dist/cdn/foxy-tax-form.js +1 -1
  73. package/dist/cdn/foxy-template-card.js +1 -0
  74. package/dist/cdn/foxy-template-config-form.js +1 -1
  75. package/dist/cdn/foxy-template-form.js +1 -1
  76. package/dist/cdn/foxy-template-set-form.js +1 -0
  77. package/dist/cdn/foxy-transaction-card.js +1 -1
  78. package/dist/cdn/foxy-transaction.js +1 -1
  79. package/dist/cdn/foxy-transactions-table.js +1 -1
  80. package/dist/cdn/foxy-user-form.js +1 -1
  81. package/dist/cdn/foxy-users-table.js +1 -1
  82. package/dist/cdn/foxy-webhook-card.js +1 -1
  83. package/dist/cdn/foxy-webhook-form.js +1 -1
  84. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  85. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  86. package/dist/cdn/{shared-14afc5c6.js → shared-04046e0e.js} +1 -1
  87. package/dist/cdn/{shared-4a2e1638.js → shared-0bbbc87f.js} +1 -1
  88. package/dist/cdn/shared-0cc4beec.js +6 -0
  89. package/dist/cdn/{shared-3ba0d0e8.js → shared-0ecc7d2c.js} +1 -1
  90. package/dist/cdn/{shared-4e2e233c.js → shared-119efeaa.js} +1 -1
  91. package/dist/cdn/shared-11be3c89.js +1 -0
  92. package/dist/cdn/{shared-5a823202.js → shared-14dc506c.js} +1 -1
  93. package/dist/cdn/shared-15278fe0.js +1 -0
  94. package/dist/cdn/{shared-1c9fd2b1.js → shared-19044260.js} +1 -1
  95. package/dist/cdn/{shared-d187b584.js → shared-19440ca2.js} +1 -1
  96. package/dist/cdn/shared-1eb24528.js +1 -0
  97. package/dist/cdn/shared-214c34b5.js +1 -0
  98. package/dist/cdn/{shared-dfdf021a.js → shared-23e0d67e.js} +1 -1
  99. package/dist/cdn/{shared-3214ee1b.js → shared-290769ea.js} +1 -1
  100. package/dist/cdn/{shared-7c8b3ce0.js → shared-2af327d0.js} +1 -1
  101. package/dist/cdn/{shared-0ca312eb.js → shared-35a7a4d6.js} +1 -1
  102. package/dist/cdn/{shared-0008cf8e.js → shared-36aaf815.js} +5 -5
  103. package/dist/cdn/{shared-f00d31e0.js → shared-3a84611d.js} +1 -1
  104. package/dist/cdn/{shared-dbb66347.js → shared-3e781cc9.js} +1 -1
  105. package/dist/cdn/{shared-de5fc645.js → shared-418e88da.js} +1 -1
  106. package/dist/cdn/{shared-5f751bfc.js → shared-435ab348.js} +1 -1
  107. package/dist/cdn/{shared-3d245899.js → shared-4a519a4a.js} +1 -1
  108. package/dist/cdn/{shared-b0ba62ff.js → shared-4a796610.js} +1 -1
  109. package/dist/cdn/{shared-ccb96675.js → shared-4c61787a.js} +1 -1
  110. package/dist/cdn/{shared-74e79000.js → shared-4ebfd7ef.js} +7 -7
  111. package/dist/cdn/{shared-ba4053b3.js → shared-4fa44231.js} +1 -1
  112. package/dist/cdn/{shared-ad70817d.js → shared-553e6472.js} +1 -1
  113. package/dist/cdn/{shared-dc891fc4.js → shared-5cb39f03.js} +1 -1
  114. package/dist/cdn/{shared-54deb3dc.js → shared-67f1821b.js} +1 -1
  115. package/dist/cdn/shared-682dbe0a.js +1 -0
  116. package/dist/cdn/{shared-19bdb896.js → shared-73a8b603.js} +1 -1
  117. package/dist/cdn/{shared-b1304f5b.js → shared-7415fa7e.js} +1 -1
  118. package/dist/cdn/shared-779795c5.js +1 -0
  119. package/dist/cdn/{shared-a6263179.js → shared-81d3ff30.js} +1 -1
  120. package/dist/cdn/{shared-8dd640bf.js → shared-8d9c0007.js} +1 -1
  121. package/dist/cdn/{shared-61174bec.js → shared-915fb0e4.js} +12 -17
  122. package/dist/cdn/{shared-d8faafc7.js → shared-9195959e.js} +1 -1
  123. package/dist/cdn/{shared-c566fe52.js → shared-93548d58.js} +1 -1
  124. package/dist/cdn/{shared-0ffa1afb.js → shared-93a1be98.js} +1 -1
  125. package/dist/cdn/{shared-9aab51c0.js → shared-96ebc59f.js} +1 -1
  126. package/dist/cdn/shared-9a0f97e5.js +1 -0
  127. package/dist/cdn/{shared-39cb3be1.js → shared-9afb80a6.js} +1 -1
  128. package/dist/cdn/{shared-3fd94d2f.js → shared-a0e71609.js} +1 -1
  129. package/dist/cdn/shared-a420358e.js +1 -0
  130. package/dist/cdn/{shared-3c7489d6.js → shared-a42a63aa.js} +1 -1
  131. package/dist/cdn/shared-a8966936.js +1 -0
  132. package/dist/cdn/{shared-c99a75d8.js → shared-aa4bf9ab.js} +1 -1
  133. package/dist/cdn/shared-b1201c2e.js +1 -0
  134. package/dist/cdn/{shared-b866f3a7.js → shared-b20753b8.js} +1 -1
  135. package/dist/cdn/shared-b2850d64.js +1 -0
  136. package/dist/cdn/{shared-b7787aae.js → shared-c3a3d9f6.js} +3 -3
  137. package/dist/cdn/shared-c7ab6598.js +1 -0
  138. package/dist/cdn/{shared-6d69487b.js → shared-c7cae9e6.js} +1 -1
  139. package/dist/cdn/{shared-a93f4ae9.js → shared-d24c3729.js} +1 -1
  140. package/dist/cdn/shared-d6276c83.js +1 -0
  141. package/dist/cdn/shared-d75c6072.js +1 -0
  142. package/dist/cdn/shared-d82f3ba0.js +1 -0
  143. package/dist/cdn/{shared-d9c5e26e.js → shared-d8bf2eac.js} +1 -1
  144. package/dist/cdn/{shared-66a0263f.js → shared-d9a3104e.js} +1 -1
  145. package/dist/cdn/shared-da285807.js +169 -0
  146. package/dist/cdn/shared-e1069291.js +1 -0
  147. package/dist/cdn/{shared-96695c93.js → shared-e32be255.js} +4 -4
  148. package/dist/cdn/{shared-f0591b3e.js → shared-e4383064.js} +1 -1
  149. package/dist/cdn/shared-e4e93604.js +1 -0
  150. package/dist/cdn/shared-eab81bf4.js +1 -0
  151. package/dist/cdn/shared-effdf59d.js +1 -0
  152. package/dist/cdn/translations/email-template-card/en.json +5 -1
  153. package/dist/cdn/translations/store-form/en.json +311 -0
  154. package/dist/cdn/translations/template-config-form/en.json +4 -0
  155. package/dist/cdn/translations/template-set-form/en.json +384 -0
  156. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.d.ts +1 -0
  157. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js +15 -15
  158. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js.map +1 -1
  159. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.d.ts +11 -0
  160. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +143 -0
  161. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -0
  162. package/dist/elements/internal/InternalEditableListControl/index.d.ts +3 -0
  163. package/dist/elements/internal/InternalEditableListControl/index.js +5 -0
  164. package/dist/elements/internal/InternalEditableListControl/index.js.map +1 -0
  165. package/dist/elements/internal/InternalEditableListControl/types.d.ts +9 -0
  166. package/dist/elements/internal/InternalEditableListControl/types.js +2 -0
  167. package/dist/elements/internal/InternalEditableListControl/types.js.map +1 -0
  168. package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.d.ts +6 -1
  169. package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +25 -12
  170. package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
  171. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +4 -1
  172. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +15 -0
  173. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
  174. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.d.ts +13 -0
  175. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js +40 -0
  176. package/dist/elements/internal/InternalPasswordControl/InternalPasswordControl.js.map +1 -0
  177. package/dist/elements/internal/InternalPasswordControl/index.d.ts +4 -0
  178. package/dist/elements/internal/InternalPasswordControl/index.js +6 -0
  179. package/dist/elements/internal/InternalPasswordControl/index.js.map +1 -0
  180. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.d.ts +2 -0
  181. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +20 -9
  182. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
  183. package/dist/elements/internal/InternalTextControl/InternalTextControl.d.ts +4 -1
  184. package/dist/elements/internal/InternalTextControl/InternalTextControl.js +15 -1
  185. package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
  186. package/dist/elements/public/EmailTemplateCard/EmailTemplateCard.js +11 -11
  187. package/dist/elements/public/EmailTemplateCard/EmailTemplateCard.js.map +1 -1
  188. package/dist/elements/public/NucleonElement/NucleonElement.js +13 -3
  189. package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
  190. package/dist/elements/public/NucleonElement/UpdateEvent.d.ts +10 -2
  191. package/dist/elements/public/NucleonElement/UpdateEvent.js +8 -2
  192. package/dist/elements/public/NucleonElement/UpdateEvent.js.map +1 -1
  193. package/dist/elements/public/StoreForm/StoreForm.d.ts +55 -0
  194. package/dist/elements/public/StoreForm/StoreForm.js +1023 -0
  195. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -0
  196. package/dist/elements/public/StoreForm/index.d.ts +15 -0
  197. package/dist/elements/public/StoreForm/index.js +17 -0
  198. package/dist/elements/public/StoreForm/index.js.map +1 -0
  199. package/dist/elements/public/StoreForm/types.d.ts +3 -0
  200. package/dist/elements/public/StoreForm/types.js +2 -0
  201. package/dist/elements/public/StoreForm/types.js.map +1 -0
  202. package/dist/elements/public/TemplateCard/TemplateCard.d.ts +10 -0
  203. package/dist/elements/public/TemplateCard/TemplateCard.js +18 -0
  204. package/dist/elements/public/TemplateCard/TemplateCard.js.map +1 -0
  205. package/dist/elements/public/TemplateCard/index.d.ts +4 -0
  206. package/dist/elements/public/TemplateCard/index.js +6 -0
  207. package/dist/elements/public/TemplateCard/index.js.map +1 -0
  208. package/dist/elements/public/TemplateCard/types.d.ts +3 -0
  209. package/dist/elements/public/TemplateCard/types.js +2 -0
  210. package/dist/elements/public/TemplateCard/types.js.map +1 -0
  211. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +1 -0
  212. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +56 -7
  213. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  214. package/dist/elements/public/TemplateConfigForm/index.d.ts +1 -0
  215. package/dist/elements/public/TemplateConfigForm/index.js +1 -0
  216. package/dist/elements/public/TemplateConfigForm/index.js.map +1 -1
  217. package/dist/elements/public/TemplateSetForm/TemplateSetForm.d.ts +44 -0
  218. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js +360 -0
  219. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js.map +1 -0
  220. package/dist/elements/public/TemplateSetForm/index.d.ts +15 -0
  221. package/dist/elements/public/TemplateSetForm/index.js +17 -0
  222. package/dist/elements/public/TemplateSetForm/index.js.map +1 -0
  223. package/dist/elements/public/TemplateSetForm/types.d.ts +3 -0
  224. package/dist/elements/public/TemplateSetForm/types.js +2 -0
  225. package/dist/elements/public/TemplateSetForm/types.js.map +1 -0
  226. package/dist/elements/public/index.d.ts +3 -0
  227. package/dist/elements/public/index.defined.d.ts +3 -0
  228. package/dist/elements/public/index.defined.js +3 -0
  229. package/dist/elements/public/index.defined.js.map +1 -1
  230. package/dist/elements/public/index.js +3 -0
  231. package/dist/elements/public/index.js.map +1 -1
  232. package/dist/mixins/configurable.js +9 -0
  233. package/dist/mixins/configurable.js.map +1 -1
  234. package/dist/mixins/themeable.js +304 -0
  235. package/dist/mixins/themeable.js.map +1 -1
  236. package/package.json +1 -1
  237. package/dist/cdn/shared-02c6c308.js +0 -169
  238. package/dist/cdn/shared-164a791e.js +0 -1
  239. package/dist/cdn/shared-24d650cd.js +0 -1
  240. package/dist/cdn/shared-27089ebf.js +0 -1
  241. package/dist/cdn/shared-425d906a.js +0 -1
  242. package/dist/cdn/shared-4a4eab8b.js +0 -1
  243. package/dist/cdn/shared-4cd53ea2.js +0 -1
  244. package/dist/cdn/shared-6d175df8.js +0 -1
  245. package/dist/cdn/shared-73ac094b.js +0 -1
  246. package/dist/cdn/shared-7684cb05.js +0 -1
  247. package/dist/cdn/shared-a03d948d.js +0 -1
  248. package/dist/cdn/shared-a2efb819.js +0 -1
  249. package/dist/cdn/shared-d5ef2683.js +0 -1
  250. package/dist/cdn/shared-ea58e244.js +0 -1
  251. package/dist/cdn/shared-ff31023c.js +0 -1
@@ -0,0 +1,1023 @@
1
+ import { TranslatableMixin } from "../../../mixins/translatable.js";
2
+ import { ResponsiveMixin } from "../../../mixins/responsive.js";
3
+ import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
4
+ import { ifDefined } from 'lit-html/directives/if-defined';
5
+ import { classMap } from "../../../utils/class-map.js";
6
+ import { html } from 'lit-html';
7
+ import cloneDeep from 'lodash-es/cloneDeep';
8
+ const NS = 'store-form';
9
+ const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
10
+ export class StoreForm extends Base {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.customerPasswordHashTypes = null;
14
+ this.shippingAddressTypes = null;
15
+ this.storeVersions = null;
16
+ this.checkoutTypes = null;
17
+ this.localeCodes = null;
18
+ this.languages = null;
19
+ this.timezones = null;
20
+ this.countries = null;
21
+ this.regions = null;
22
+ this.__singleCheckboxGroupOptions = [{ label: 'option_checked', value: 'checked' }];
23
+ this.__appSessionTimeOptions = [
24
+ { value: 's', label: 'second' },
25
+ { value: 'm', label: 'minute' },
26
+ { value: 'h', label: 'hour' },
27
+ { value: 'd', label: 'day' },
28
+ ];
29
+ this.__getStoreEmailValue = () => {
30
+ var _a;
31
+ const emails = (_a = this.form.store_email) !== null && _a !== void 0 ? _a : '';
32
+ return emails
33
+ .split(',')
34
+ .map(v => ({ value: v.trim() }))
35
+ .filter(({ value }) => value.length > 0);
36
+ };
37
+ this.__setStoreEmailValue = (newValue) => {
38
+ this.edit({ store_email: newValue.map(v => v.value).join(',') });
39
+ };
40
+ this.__getBccOnReceiptEmailValue = () => {
41
+ return this.form.bcc_on_receipt_email ? ['checked'] : [];
42
+ };
43
+ this.__setBccOnReceiptEmailValue = (newValue) => {
44
+ this.edit({
45
+ // TODO: remove the directive below when SDK types are fixed
46
+ // @ts-expect-error SDK types are incorrect
47
+ bcc_on_receipt_email: newValue.includes('checked'),
48
+ });
49
+ };
50
+ this.__getUseEmailDnsValue = () => {
51
+ return this.form.use_email_dns ? ['checked'] : [];
52
+ };
53
+ this.__setUseEmailDnsValue = (newValue) => {
54
+ this.edit({
55
+ // TODO: remove the directive below when SDK types are fixed
56
+ // @ts-expect-error SDK types are incorrect
57
+ use_email_dns: newValue.includes('checked'),
58
+ });
59
+ };
60
+ this.__getUseSmtpConfigValue = () => {
61
+ return this.form.smtp_config ? ['checked'] : [];
62
+ };
63
+ this.__setUseSmtpConfigValue = (newValue) => {
64
+ if (newValue.includes('checked')) {
65
+ this.edit({
66
+ smtp_config: JSON.stringify({
67
+ username: '',
68
+ password: '',
69
+ security: '',
70
+ host: '',
71
+ port: '',
72
+ }),
73
+ });
74
+ }
75
+ else {
76
+ this.edit({ smtp_config: '' });
77
+ }
78
+ };
79
+ this.__getFeaturesMultishipValue = () => {
80
+ return this.form.features_multiship ? ['checked'] : [];
81
+ };
82
+ this.__setFeaturesMultishipValue = (newValue) => {
83
+ this.edit({ features_multiship: newValue.includes('checked') });
84
+ };
85
+ this.__getRequireSignedShippingRatesValue = () => {
86
+ return this.form.require_signed_shipping_rates ? ['checked'] : [];
87
+ };
88
+ this.__setRequireSignedShippingRatesValue = (newValue) => {
89
+ this.edit({ require_signed_shipping_rates: newValue.includes('checked') });
90
+ };
91
+ this.__getAppSessionTimeValue = () => {
92
+ const valueInSeconds = this.form.app_session_time || 43200;
93
+ if (valueInSeconds % 86400 === 0)
94
+ return `${valueInSeconds / 86400}d`;
95
+ if (valueInSeconds % 3600 === 0)
96
+ return `${valueInSeconds / 3600}h`;
97
+ if (valueInSeconds % 60 === 0)
98
+ return `${valueInSeconds / 60}m`;
99
+ return `${valueInSeconds}s`;
100
+ };
101
+ this.__setAppSessionTimeValue = (newValue) => {
102
+ const units = newValue[newValue.length - 1];
103
+ const count = parseInt(newValue.substring(0, newValue.length - 1));
104
+ const map = { d: 86400, h: 3600, m: 60, s: 1 };
105
+ this.edit({ app_session_time: map[units] * count });
106
+ };
107
+ this.__getProductsRequireExpiresPropertyValue = () => {
108
+ return this.form.products_require_expires_property ? ['checked'] : [];
109
+ };
110
+ this.__setProductsRequireExpiresPropertyValue = (newValue) => {
111
+ this.edit({ products_require_expires_property: newValue.includes('checked') });
112
+ };
113
+ this.__getUseCartValidationValue = () => {
114
+ return this.form.use_cart_validation ? ['checked'] : [];
115
+ };
116
+ this.__setUseCartValidationValue = (newValue) => {
117
+ this.edit({ use_cart_validation: newValue.includes('checked') });
118
+ };
119
+ this.__getSingleSignOnUrlValue = () => {
120
+ var _a;
121
+ return this.form.use_single_sign_on ? (_a = this.form.single_sign_on_url) !== null && _a !== void 0 ? _a : '' : '';
122
+ };
123
+ this.__setSingleSignOnUrlValue = (newValue) => {
124
+ this.edit({ use_single_sign_on: !!newValue, single_sign_on_url: newValue });
125
+ };
126
+ this.__getWebhookUrlValue = () => {
127
+ var _a;
128
+ return this.form.use_webhook ? (_a = this.form.webhook_url) !== null && _a !== void 0 ? _a : '' : '';
129
+ };
130
+ this.__setWebhookUrlValue = (newValue) => {
131
+ this.edit({ use_webhook: !!newValue, webhook_url: newValue });
132
+ };
133
+ this.__setStoreDomainValue = (newValue) => {
134
+ if (newValue.endsWith('.foxycart.com')) {
135
+ const domain = newValue.substring(0, newValue.length - 13);
136
+ this.edit({ store_domain: domain, use_remote_domain: domain.includes('.') });
137
+ }
138
+ else {
139
+ this.edit({ store_domain: newValue, use_remote_domain: newValue.includes('.') });
140
+ }
141
+ };
142
+ }
143
+ static get properties() {
144
+ return {
145
+ ...super.properties,
146
+ customerPasswordHashTypes: { attribute: 'customer-password-hash-types' },
147
+ shippingAddressTypes: { attribute: 'shipping-address-types' },
148
+ storeVersions: { attribute: 'store-versions' },
149
+ checkoutTypes: { attribute: 'checkout-types' },
150
+ localeCodes: { attribute: 'locale-codes' },
151
+ languages: {},
152
+ timezones: {},
153
+ countries: {},
154
+ regions: {},
155
+ };
156
+ }
157
+ static get v8n() {
158
+ return [
159
+ ({ store_name: v }) => !!v || 'store-name:v8n_required',
160
+ ({ store_name: v }) => (v && v.length <= 50) || 'store-name:v8n_too_long',
161
+ ({ store_domain: v }) => !!v || 'store-domain:v8n_required',
162
+ ({ store_domain: v }) => (v && v.length <= 50) || 'store-domain:v8n_too_long',
163
+ ({ store_url: v }) => !!v || 'store-url:v8n_required',
164
+ ({ store_url: v }) => (v && v.length <= 300) || 'store-url:v8n_too_long',
165
+ ({ receipt_continue_url: v }) => !v || v.length <= 300 || 'receipt-continue-url:v8n_too_long',
166
+ ({ store_email: v }) => !!v || 'store-email:v8n_required',
167
+ ({ store_email: v }) => (v && v.length <= 300) || 'store-email:v8n_too_long',
168
+ ({ from_email: v }) => !v || v.length <= 100 || 'from-email:v8n_too_long',
169
+ ({ smtp_config: v }) => !v || v.length <= 1000 || 'use-smtp-config:v8n_too_long',
170
+ ({ postal_code: v }) => !!v || 'postal-code:v8n_required',
171
+ ({ postal_code: v }) => (v && v.length <= 50) || 'postal-code:v8n_too_long',
172
+ ({ region: v }) => !!v || 'region:v8n_required',
173
+ ({ region: v }) => (v && v.length <= 100) || 'region:v8n_too_long',
174
+ ({ country: v }) => !!v || 'country:v8n_required',
175
+ ({ logo_url: v }) => !v || v.length <= 100 || 'logo-url:v8n_too_long',
176
+ ({ webhook_url: v, use_webhook }) => !use_webhook || !!v || 'webhook-url:v8n_required',
177
+ ({ webhook_url: v, use_webhook }) => {
178
+ return !use_webhook || (v && v.length <= 300) || 'webhook-url:too_long';
179
+ },
180
+ ({ webhook_key: v, use_webhook: on, use_cart_validation: hmac }) => {
181
+ return (!on && !hmac) || !!v || 'webhook-key:v8n_required';
182
+ },
183
+ ({ webhook_url: v, use_webhook: on, use_cart_validation: hmac }) => {
184
+ return (!on && !hmac) || (v && v.length <= 200) || 'webhook-key:v8n_too_long';
185
+ },
186
+ ({ single_sign_on_url: v, use_single_sign_on: on }) => {
187
+ return !on || !!v || 'single-sign-on-url:v8n_required';
188
+ },
189
+ ({ single_sign_on_url: v, use_single_sign_on: on }) => {
190
+ return !on || (v && v.length <= 300) || 'single-sign-on-url:too_long';
191
+ },
192
+ ({ customer_password_hash_config: v }) => {
193
+ return !v || String(v).length <= 100 || 'customer-password-hash-config:v8n_too_long';
194
+ },
195
+ ({ unified_order_entry_password: v }) => {
196
+ return !v || String(v).length <= 100 || 'unified-order-entry-password:v8n_too_long';
197
+ },
198
+ ({ custom_display_id_config: v }) => {
199
+ return !v || String(v).length <= 100 || 'custom-display-id-config-enabled:v8n_too_long';
200
+ },
201
+ ];
202
+ }
203
+ renderBody() {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
205
+ const isUseEmailDnsWarningVisible = this.form.use_email_dns &&
206
+ !((_a = this.data) === null || _a === void 0 ? void 0 : _a.use_email_dns) &&
207
+ !this.hiddenSelector.matches('use-email-dns', true);
208
+ const isRequireSignedShippingRatesWarningVisible = this.form.require_signed_shipping_rates &&
209
+ !((_b = this.data) === null || _b === void 0 ? void 0 : _b.require_signed_shipping_rates) &&
210
+ !this.hiddenSelector.matches('require-signed-shipping-rates', true);
211
+ const isProductsRequireExpiresPropertyWarningVisible = this.form.products_require_expires_property &&
212
+ !((_c = this.data) === null || _c === void 0 ? void 0 : _c.products_require_expires_property) &&
213
+ !this.hiddenSelector.matches('products-require-expires-property', true);
214
+ const isUseCartValidationWarningVisible = this.form.use_cart_validation &&
215
+ !((_d = this.data) === null || _d === void 0 ? void 0 : _d.use_cart_validation) &&
216
+ !this.hiddenSelector.matches('use-cart-validation', true);
217
+ const storeDomainHelperText = this.t(this.form.use_remote_domain && !((_e = this.data) === null || _e === void 0 ? void 0 : _e.use_remote_domain)
218
+ ? 'store-domain.custom_domain_note'
219
+ : 'store-domain.helper_text');
220
+ const storeDomainSuffix = !this.form.store_domain || this.form.store_domain.includes('.') ? '' : '.foxycart.com';
221
+ const customerPasswordHashTypesLoader = this.__renderLoader(1);
222
+ const shippingAddressTypesLoader = this.__renderLoader(2);
223
+ const checkoutTypesLoader = this.__renderLoader(3);
224
+ const storeVersionLoader = this.__renderLoader(4);
225
+ const localeCodesLoader = this.__renderLoader(5);
226
+ const languagesLoader = this.__renderLoader(6);
227
+ const timezonesLoader = this.__renderLoader(7);
228
+ const countriesLoader = this.__renderLoader(8);
229
+ const regionsLoader = this.__renderLoader(9);
230
+ const shippingAddressTypeEntries = Object.entries((_g = (_f = shippingAddressTypesLoader === null || shippingAddressTypesLoader === void 0 ? void 0 : shippingAddressTypesLoader.data) === null || _f === void 0 ? void 0 : _f.values) !== null && _g !== void 0 ? _g : {});
231
+ const storeVersion = storeVersionLoader === null || storeVersionLoader === void 0 ? void 0 : storeVersionLoader.data;
232
+ const localeCodes = localeCodesLoader === null || localeCodesLoader === void 0 ? void 0 : localeCodesLoader.data;
233
+ const languages = languagesLoader === null || languagesLoader === void 0 ? void 0 : languagesLoader.data;
234
+ const timezones = (_j = (_h = timezonesLoader === null || timezonesLoader === void 0 ? void 0 : timezonesLoader.data) === null || _h === void 0 ? void 0 : _h.values.timezone) !== null && _j !== void 0 ? _j : [];
235
+ const countries = Object.values((_l = (_k = countriesLoader === null || countriesLoader === void 0 ? void 0 : countriesLoader.data) === null || _k === void 0 ? void 0 : _k.values) !== null && _l !== void 0 ? _l : {});
236
+ const regions = Object.values((_o = (_m = regionsLoader === null || regionsLoader === void 0 ? void 0 : regionsLoader.data) === null || _m === void 0 ? void 0 : _m.values) !== null && _o !== void 0 ? _o : {});
237
+ const customerPasswordHashTypeEntries = Object.entries((_q = (_p = customerPasswordHashTypesLoader === null || customerPasswordHashTypesLoader === void 0 ? void 0 : customerPasswordHashTypesLoader.data) === null || _p === void 0 ? void 0 : _p.values) !== null && _q !== void 0 ? _q : {});
238
+ const checkoutTypeEntries = Object.entries((_s = (_r = checkoutTypesLoader === null || checkoutTypesLoader === void 0 ? void 0 : checkoutTypesLoader.data) === null || _r === void 0 ? void 0 : _r.values) !== null && _s !== void 0 ? _s : {});
239
+ const localeCodeEntries = Object.entries((_t = localeCodes === null || localeCodes === void 0 ? void 0 : localeCodes.values) !== null && _t !== void 0 ? _t : {});
240
+ const languageEntries = Object.entries((_u = languages === null || languages === void 0 ? void 0 : languages.values) !== null && _u !== void 0 ? _u : {});
241
+ const customerPasswordHashTypeOptions = customerPasswordHashTypeEntries.map(v => ({
242
+ label: v[1].description,
243
+ value: v[0],
244
+ }));
245
+ const shippingAddressTypeOptions = shippingAddressTypeEntries.map(([value, label]) => ({
246
+ label,
247
+ value,
248
+ }));
249
+ const checkoutTypeOptions = checkoutTypeEntries.map(([value, label]) => ({ label, value }));
250
+ const localeCodeOptions = localeCodeEntries.map(([value, label]) => ({ value, label }));
251
+ const languageOptions = languageEntries.map(([value, label]) => ({ value, label }));
252
+ const timezoneOptions = timezones.map(t => ({ label: t.description, value: t.timezone }));
253
+ const countryOptions = countries.map(c => ({ label: c.default, value: c.cc2 }));
254
+ const regionOptions = regions.map(r => ({ label: r.default, value: r.code }));
255
+ let regionsUrl;
256
+ try {
257
+ const regionsURL = new URL((_v = this.regions) !== null && _v !== void 0 ? _v : '');
258
+ const country = this.form.country;
259
+ if (country)
260
+ regionsURL.searchParams.set('country_code', country);
261
+ regionsUrl = regionsURL.toString();
262
+ }
263
+ catch (_z) {
264
+ regionsUrl = undefined;
265
+ }
266
+ return html `
267
+ ${customerPasswordHashTypesLoader.render(this.customerPasswordHashTypes)}
268
+ ${shippingAddressTypesLoader.render(this.shippingAddressTypes)}
269
+ ${checkoutTypesLoader.render(this.checkoutTypes)}
270
+ ${storeVersionLoader.render(this.form.store_version_uri)}
271
+ ${localeCodesLoader.render(this.localeCodes)} ${timezonesLoader.render(this.timezones)}
272
+ ${countriesLoader.render(this.countries)} ${languagesLoader.render(this.languages)}
273
+ ${regionsLoader.render(regionsUrl)}
274
+
275
+ <!-- -->
276
+
277
+ ${this.data ? this.__renderMaintenanceModeSwitch() : ''}
278
+
279
+ <div class="grid gap-m grid-cols-1 sm-grid-cols-2">
280
+ ${this.__renderTitle('general_title')}
281
+
282
+ <foxy-internal-text-control infer="store-name"></foxy-internal-text-control>
283
+
284
+ <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control>
285
+
286
+ <foxy-internal-text-control
287
+ helper-text=${storeDomainHelperText}
288
+ suffix=${storeDomainSuffix}
289
+ infer="store-domain"
290
+ .setValue=${this.__setStoreDomainValue}
291
+ >
292
+ </foxy-internal-text-control>
293
+
294
+ <foxy-internal-text-control infer="store-url"></foxy-internal-text-control>
295
+
296
+ <foxy-internal-editable-list-control
297
+ infer="store-email"
298
+ class="sm-col-span-2"
299
+ .getValue=${this.__getStoreEmailValue}
300
+ .setValue=${this.__setStoreEmailValue}
301
+ >
302
+ </foxy-internal-editable-list-control>
303
+
304
+ <foxy-internal-select-control
305
+ infer="timezone"
306
+ class="sm-col-span-2"
307
+ .options=${timezoneOptions}
308
+ >
309
+ </foxy-internal-select-control>
310
+
311
+ <foxy-internal-password-control infer="webhook-key"></foxy-internal-password-control>
312
+
313
+ <foxy-internal-async-combo-box-control
314
+ item-label-path="version"
315
+ item-value-path="_links.self.href"
316
+ infer="store-version-uri"
317
+ first=${ifDefined((_w = this.storeVersions) !== null && _w !== void 0 ? _w : undefined)}
318
+ .selectedItem=${storeVersion}
319
+ >
320
+ </foxy-internal-async-combo-box-control>
321
+
322
+ ${this.__renderTitle('emails_title')}
323
+
324
+ <foxy-internal-text-control
325
+ infer="from-email"
326
+ class="sm-col-span-2"
327
+ placeholder=${(_y = (_x = this.__getStoreEmailValue()[0]) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : this.t('from-email.placeholder')}
328
+ >
329
+ </foxy-internal-text-control>
330
+
331
+ <foxy-internal-checkbox-group-control
332
+ infer="bcc-on-receipt-email"
333
+ class="-mt-xs -mb-m sm-col-span-2"
334
+ .getValue=${this.__getBccOnReceiptEmailValue}
335
+ .setValue=${this.__setBccOnReceiptEmailValue}
336
+ .options=${this.__singleCheckboxGroupOptions}
337
+ >
338
+ </foxy-internal-checkbox-group-control>
339
+
340
+ <foxy-internal-checkbox-group-control
341
+ infer="use-email-dns"
342
+ class="-mt-xs -mb-m sm-col-span-2"
343
+ .getValue=${this.__getUseEmailDnsValue}
344
+ .setValue=${this.__setUseEmailDnsValue}
345
+ .options=${this.__singleCheckboxGroupOptions}
346
+ >
347
+ </foxy-internal-checkbox-group-control>
348
+
349
+ ${isUseEmailDnsWarningVisible
350
+ ? this.__renderWarning('use_email_dns_helper_text', {
351
+ href: 'https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc',
352
+ caption: 'How Emails Are Sent (SPF, DKIM, DMARC, etc.)',
353
+ })
354
+ : ''}
355
+
356
+ <foxy-internal-checkbox-group-control
357
+ infer="use-smtp-config"
358
+ class="-mt-xs -mb-m sm-col-span-2"
359
+ .getValue=${this.__getUseSmtpConfigValue}
360
+ .setValue=${this.__setUseSmtpConfigValue}
361
+ .options=${this.__singleCheckboxGroupOptions}
362
+ >
363
+ </foxy-internal-checkbox-group-control>
364
+
365
+ ${this.form.smtp_config ? this.__renderSmtpConfig() : ''}
366
+
367
+ <!-- -->
368
+
369
+ ${this.__renderTitle('shipping_title')}
370
+
371
+ <foxy-internal-select-control infer="country" .options=${countryOptions}>
372
+ </foxy-internal-select-control>
373
+
374
+ <foxy-internal-select-control infer="region" .options=${regionOptions}>
375
+ </foxy-internal-select-control>
376
+
377
+ <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control>
378
+
379
+ <foxy-internal-select-control
380
+ infer="shipping-address-type"
381
+ .options=${shippingAddressTypeOptions}
382
+ >
383
+ </foxy-internal-select-control>
384
+
385
+ <foxy-internal-checkbox-group-control
386
+ infer="features-multiship"
387
+ class="-mt-xs -mb-m sm-col-span-2"
388
+ .getValue=${this.__getFeaturesMultishipValue}
389
+ .setValue=${this.__setFeaturesMultishipValue}
390
+ .options=${this.__singleCheckboxGroupOptions}
391
+ >
392
+ </foxy-internal-checkbox-group-control>
393
+
394
+ <foxy-internal-checkbox-group-control
395
+ infer="require-signed-shipping-rates"
396
+ class="-mt-xs -mb-m sm-col-span-2"
397
+ .getValue=${this.__getRequireSignedShippingRatesValue}
398
+ .setValue=${this.__setRequireSignedShippingRatesValue}
399
+ .options=${this.__singleCheckboxGroupOptions}
400
+ >
401
+ </foxy-internal-checkbox-group-control>
402
+
403
+ ${isRequireSignedShippingRatesWarningVisible
404
+ ? this.__renderWarning('require_signed_shipping_rates_helper_text')
405
+ : ''}
406
+
407
+ <!-- -->
408
+
409
+ ${this.__renderTitle('language_and_format_title')}
410
+
411
+ <foxy-internal-select-control infer="language" .options=${languageOptions}>
412
+ </foxy-internal-select-control>
413
+
414
+ <foxy-internal-select-control infer="locale-code" .options=${localeCodeOptions}>
415
+ </foxy-internal-select-control>
416
+
417
+ ${this.__renderCurrencyStyleSelector()}
418
+
419
+ <!-- -->
420
+
421
+ ${this.__renderCustomIDSettings()}
422
+
423
+ <!-- -->
424
+
425
+ ${this.__renderTitle('cart_and_checkout_title')}
426
+
427
+ <foxy-internal-text-control infer="receipt-continue-url"></foxy-internal-text-control>
428
+
429
+ <foxy-internal-frequency-control
430
+ infer="app-session-time"
431
+ .getValue=${this.__getAppSessionTimeValue}
432
+ .setValue=${this.__setAppSessionTimeValue}
433
+ .options=${this.__appSessionTimeOptions}
434
+ >
435
+ </foxy-internal-frequency-control>
436
+
437
+ <foxy-internal-checkbox-group-control
438
+ infer="products-require-expires-property"
439
+ class="-mt-xs -mb-m sm-col-span-2"
440
+ .getValue=${this.__getProductsRequireExpiresPropertyValue}
441
+ .setValue=${this.__setProductsRequireExpiresPropertyValue}
442
+ .options=${this.__singleCheckboxGroupOptions}
443
+ >
444
+ </foxy-internal-checkbox-group-control>
445
+
446
+ ${isProductsRequireExpiresPropertyWarningVisible
447
+ ? this.__renderWarning('products_require_expires_property_helper_text')
448
+ : ''}
449
+
450
+ <foxy-internal-checkbox-group-control
451
+ infer="use-cart-validation"
452
+ class="-mt-xs -mb-m sm-col-span-2"
453
+ .getValue=${this.__getUseCartValidationValue}
454
+ .setValue=${this.__setUseCartValidationValue}
455
+ .options=${this.__singleCheckboxGroupOptions}
456
+ >
457
+ </foxy-internal-checkbox-group-control>
458
+
459
+ ${isUseCartValidationWarningVisible
460
+ ? this.__renderWarning('use_cart_validation_helper_text', {
461
+ href: 'https://wiki.foxycart.com/v/2.0/hmac_validation',
462
+ caption: 'HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms',
463
+ })
464
+ : ''}
465
+
466
+ <!-- -->
467
+
468
+ ${this.__renderTitle('customer_login_title')}
469
+
470
+ <foxy-internal-select-control
471
+ infer="checkout-type"
472
+ class="sm-col-span-2"
473
+ .options=${checkoutTypeOptions}
474
+ >
475
+ </foxy-internal-select-control>
476
+
477
+ <foxy-internal-select-control
478
+ infer="customer-password-hash-type"
479
+ .options=${customerPasswordHashTypeOptions}
480
+ .setValue=${(newValue) => {
481
+ var _a;
482
+ const entry = customerPasswordHashTypeEntries.find(([v]) => v === newValue);
483
+ this.edit({
484
+ customer_password_hash_type: newValue,
485
+ customer_password_hash_config: (_a = entry === null || entry === void 0 ? void 0 : entry[1].config) !== null && _a !== void 0 ? _a : '',
486
+ });
487
+ }}
488
+ >
489
+ </foxy-internal-select-control>
490
+
491
+ ${typeof this.form.customer_password_hash_config === 'number'
492
+ ? html `
493
+ <foxy-internal-number-control infer="customer-password-hash-config">
494
+ </foxy-internal-number-control>
495
+ `
496
+ : html `
497
+ <foxy-internal-text-control infer="customer-password-hash-config">
498
+ </foxy-internal-text-control>
499
+ `}
500
+
501
+ <foxy-internal-password-control infer="unified-order-entry-password">
502
+ </foxy-internal-password-control>
503
+
504
+ <foxy-internal-text-control
505
+ infer="single-sign-on-url"
506
+ .getValue=${this.__getSingleSignOnUrlValue}
507
+ .setValue=${this.__setSingleSignOnUrlValue}
508
+ >
509
+ </foxy-internal-text-control>
510
+
511
+ ${this.__renderTitle('legacy_title')}
512
+
513
+ <foxy-internal-text-control
514
+ infer="webhook-url"
515
+ class="sm-col-span-2"
516
+ .getValue=${this.__getWebhookUrlValue}
517
+ .setValue=${this.__setWebhookUrlValue}
518
+ >
519
+ </foxy-internal-text-control>
520
+ </div>
521
+
522
+ ${super.renderBody()}
523
+ `;
524
+ }
525
+ __renderMaintenanceModeSwitch() {
526
+ var _a;
527
+ const isActive = !!((_a = this.data) === null || _a === void 0 ? void 0 : _a.is_maintenance_mode);
528
+ const buttonKey = `${isActive ? 'disable' : 'enable'}_maintenance_mode`;
529
+ const explainerKey = `maintenance_mode_${isActive ? 'on' : 'off'}_explainer`;
530
+ return html `
531
+ <div
532
+ class=${classMap({
533
+ 'rounded-t-l rounded-b-l p-m leading-m': true,
534
+ 'bg-contrast-5 text-contrast': !isActive,
535
+ 'bg-primary-10 text-primary': isActive,
536
+ })}
537
+ >
538
+ <foxy-i18n infer="" class="block font-semibold mb-s" key="maintenance_mode_title">
539
+ </foxy-i18n>
540
+
541
+ <foxy-i18n infer="" class="block mb-m" key=${explainerKey}></foxy-i18n>
542
+
543
+ <vaadin-button
544
+ theme=${isActive ? 'primary' : 'contrast'}
545
+ @click=${() => {
546
+ this.edit({ is_maintenance_mode: !this.form.is_maintenance_mode });
547
+ this.submit();
548
+ }}
549
+ >
550
+ <foxy-i18n infer="" key=${buttonKey}></foxy-i18n>
551
+ </vaadin-button>
552
+ </div>
553
+ `;
554
+ }
555
+ __renderCurrencyStyleSelector() {
556
+ const map = {
557
+ '101': 0,
558
+ '100': 0,
559
+ '001': 1,
560
+ '000': 2,
561
+ '111': 3,
562
+ '110': 3,
563
+ '011': 4,
564
+ '010': 5,
565
+ };
566
+ const selectionCode = [
567
+ this.form.hide_currency_symbol,
568
+ this.form.hide_decimal_characters,
569
+ this.form.use_international_currency_symbol,
570
+ ]
571
+ .map(v => Number(Boolean(v)))
572
+ .join('');
573
+ const selectionIndex = map[selectionCode];
574
+ return html `
575
+ <div
576
+ class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"
577
+ >
578
+ <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"> </foxy-i18n>
579
+
580
+ <div
581
+ class="grid grid-cols-3 bg-contrast-10"
582
+ style="gap: 1px; padding: 1px; border-radius: calc(var(--lumo-border-radius-m) + 1px)"
583
+ >
584
+ ${['12.34', '$12.34', 'USD 12.34', '12', '$12', 'USD 12'].map((example, index) => {
585
+ return html `
586
+ <label
587
+ class=${classMap({
588
+ 'relative z-0 px-s h-m flex items-center transition-colors': true,
589
+ 'hover-cursor-pointer': true,
590
+ 'focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50': true,
591
+ 'bg-base text-body hover-bg-transparent': index !== selectionIndex,
592
+ 'bg-primary text-primary-contrast': index === selectionIndex,
593
+ 'rounded-tl': index === 0,
594
+ 'rounded-tr': index === 2,
595
+ 'rounded-bl': index === 3,
596
+ 'rounded-br': index === 5,
597
+ })}
598
+ >
599
+ <span class="font-medium font-tnum">${example}</span>
600
+ <input
601
+ class="sr-only"
602
+ value=${index}
603
+ type="radio"
604
+ name="currency-style"
605
+ ?checked=${index === selectionIndex}
606
+ @change=${() => {
607
+ const set = Object.entries(map).find(v => v[1] === index)[0];
608
+ this.edit({
609
+ hide_currency_symbol: Boolean(Number(set[0])),
610
+ hide_decimal_characters: Boolean(Number(set[1])),
611
+ use_international_currency_symbol: Boolean(Number(set[2])),
612
+ });
613
+ }}
614
+ />
615
+ </label>
616
+ `;
617
+ })}
618
+ </div>
619
+
620
+ <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"> </foxy-i18n>
621
+ </div>
622
+ `;
623
+ }
624
+ __renderCustomIDSettings() {
625
+ var _a;
626
+ const defaultConfig = {
627
+ enabled: false,
628
+ start: '0',
629
+ length: '0',
630
+ prefix: '',
631
+ suffix: '',
632
+ transaction_journal_entries: {
633
+ enabled: false,
634
+ transaction_separator: '',
635
+ log_detail_request_types: {
636
+ transaction_authcapture: { prefix: '' },
637
+ transaction_capture: { prefix: '' },
638
+ transaction_refund: { prefix: '' },
639
+ transaction_void: { prefix: '' },
640
+ },
641
+ },
642
+ };
643
+ let config;
644
+ try {
645
+ config = JSON.parse((_a = this.form.custom_display_id_config) !== null && _a !== void 0 ? _a : '');
646
+ }
647
+ catch (_b) {
648
+ config = cloneDeep(defaultConfig);
649
+ }
650
+ const startAsInt = parseInt(config.start || '0');
651
+ const lengthAsInt = parseInt(config.length || '0');
652
+ const numericLength = lengthAsInt - config.prefix.length - config.suffix.length;
653
+ const randomExampleNumericId = Math.min(startAsInt + Math.floor(Math.random() * Math.pow(10, numericLength)), Math.pow(10, numericLength) - 1);
654
+ const randomExampleId = `${config.prefix}${randomExampleNumericId
655
+ .toString()
656
+ .padStart(numericLength, '0')}${config.suffix}`;
657
+ const randomNumericEntryId = Math.floor(Math.random() * 1000);
658
+ const randomEntryId = String(randomNumericEntryId).padStart(3, '0');
659
+ return html `
660
+ <foxy-internal-checkbox-group-control
661
+ infer="custom-display-id-config-enabled"
662
+ class="-mt-xs -mb-m sm-col-span-2"
663
+ .getValue=${() => (config.enabled ? ['checked'] : [])}
664
+ .setValue=${(newValue) => {
665
+ config.enabled = newValue.includes('checked');
666
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
667
+ }}
668
+ .options=${this.__singleCheckboxGroupOptions}
669
+ >
670
+ </foxy-internal-checkbox-group-control>
671
+
672
+ ${config.enabled
673
+ ? html `
674
+ <div
675
+ class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"
676
+ >
677
+ <foxy-internal-integer-control
678
+ infer="custom-display-id-config-start"
679
+ min="0"
680
+ .getValue=${() => parseInt(config.start || '0')}
681
+ .setValue=${(newValue) => {
682
+ config.start = String(newValue);
683
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
684
+ }}
685
+ >
686
+ </foxy-internal-integer-control>
687
+
688
+ <foxy-internal-integer-control
689
+ infer="custom-display-id-config-length"
690
+ min="0"
691
+ .getValue=${() => parseInt(config.length || '0')}
692
+ .setValue=${(newValue) => {
693
+ config.length = String(newValue);
694
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
695
+ }}
696
+ >
697
+ </foxy-internal-integer-control>
698
+
699
+ <foxy-internal-text-control
700
+ infer="custom-display-id-config-prefix"
701
+ .getValue=${() => config.prefix}
702
+ .setValue=${(newValue) => {
703
+ config.prefix = newValue;
704
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
705
+ }}
706
+ >
707
+ </foxy-internal-text-control>
708
+
709
+ <foxy-internal-text-control
710
+ infer="custom-display-id-config-suffix"
711
+ .getValue=${() => config.suffix}
712
+ .setValue=${(newValue) => {
713
+ config.suffix = newValue;
714
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
715
+ }}
716
+ >
717
+ </foxy-internal-text-control>
718
+
719
+ ${config.start && config.length && startAsInt / 10 <= numericLength
720
+ ? html `
721
+ <table
722
+ style="font-family: monospace"
723
+ class="col-span-2 text-xs text-secondary whitespace-nowrap"
724
+ >
725
+ <tbody>
726
+ <tr>
727
+ <td style="width: 1%">
728
+ <foxy-i18n infer="" key="custom-display-id-config-first-example">
729
+ </foxy-i18n>
730
+ </td>
731
+ <td>
732
+ ${config.prefix}${startAsInt
733
+ .toString()
734
+ .padStart(numericLength, '0')}${config.suffix}
735
+ </td>
736
+ </tr>
737
+ <tr style="width: 1%">
738
+ <td>
739
+ <foxy-i18n infer="" key="custom-display-id-config-random-example">
740
+ </foxy-i18n>
741
+ </td>
742
+ <td>${randomExampleId}</td>
743
+ </tr>
744
+ </tbody>
745
+ </table>
746
+ `
747
+ : ''}
748
+ </div>
749
+
750
+ <foxy-internal-checkbox-group-control
751
+ infer="custom-display-id-config-transaction-journal-entries-enabled"
752
+ class="-mt-xs -mb-m sm-col-span-2"
753
+ .getValue=${() => (config.transaction_journal_entries.enabled ? ['checked'] : [])}
754
+ .setValue=${(newValue) => {
755
+ config.transaction_journal_entries.enabled = newValue.includes('checked');
756
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
757
+ }}
758
+ .options=${this.__singleCheckboxGroupOptions}
759
+ >
760
+ </foxy-internal-checkbox-group-control>
761
+
762
+ ${config.transaction_journal_entries.enabled
763
+ ? html `
764
+ <div
765
+ class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"
766
+ >
767
+ <foxy-internal-text-control
768
+ infer="custom-display-id-config-transaction-journal-entries-transaction-separator"
769
+ class="col-span-2"
770
+ .getValue=${() => config.transaction_journal_entries.transaction_separator}
771
+ .setValue=${(newValue) => {
772
+ config.transaction_journal_entries.transaction_separator = newValue;
773
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
774
+ }}
775
+ >
776
+ </foxy-internal-text-control>
777
+
778
+ <foxy-internal-text-control
779
+ infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix"
780
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
781
+ .transaction_authcapture.prefix}
782
+ .setValue=${(newValue) => {
783
+ config.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix =
784
+ newValue;
785
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
786
+ }}
787
+ >
788
+ </foxy-internal-text-control>
789
+
790
+ <foxy-internal-text-control
791
+ infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix"
792
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
793
+ .transaction_capture.prefix}
794
+ .setValue=${(newValue) => {
795
+ config.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix =
796
+ newValue;
797
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
798
+ }}
799
+ >
800
+ </foxy-internal-text-control>
801
+
802
+ <foxy-internal-text-control
803
+ infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix"
804
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types.transaction_void
805
+ .prefix}
806
+ .setValue=${(newValue) => {
807
+ config.transaction_journal_entries.log_detail_request_types.transaction_void.prefix =
808
+ newValue;
809
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
810
+ }}
811
+ >
812
+ </foxy-internal-text-control>
813
+
814
+ <foxy-internal-text-control
815
+ infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix"
816
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
817
+ .transaction_refund.prefix}
818
+ .setValue=${(newValue) => {
819
+ config.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix =
820
+ newValue;
821
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
822
+ }}
823
+ >
824
+ </foxy-internal-text-control>
825
+
826
+ ${config.start && config.length && startAsInt / 10 <= numericLength
827
+ ? html `
828
+ <table
829
+ style="font-family: monospace"
830
+ class="col-span-2 text-xs text-secondary whitespace-nowrap"
831
+ >
832
+ <tbody>
833
+ <tr>
834
+ <td style="width: 1%">
835
+ <foxy-i18n
836
+ infer=""
837
+ key="custom-display-id-config-transaction-journal-entries-authcapture-example"
838
+ >
839
+ </foxy-i18n>
840
+ </td>
841
+ <td>
842
+ ${randomExampleId}${config.transaction_journal_entries
843
+ .transaction_separator}${config.transaction_journal_entries
844
+ .log_detail_request_types.transaction_authcapture
845
+ .prefix}${randomEntryId}
846
+ </td>
847
+ </tr>
848
+ <tr>
849
+ <td style="width: 1%">
850
+ <foxy-i18n
851
+ infer=""
852
+ key="custom-display-id-config-transaction-journal-entries-capture-example"
853
+ >
854
+ </foxy-i18n>
855
+ </td>
856
+ <td>
857
+ ${randomExampleId}${config.transaction_journal_entries
858
+ .transaction_separator}${config.transaction_journal_entries
859
+ .log_detail_request_types.transaction_capture
860
+ .prefix}${randomEntryId}
861
+ </td>
862
+ </tr>
863
+ <tr>
864
+ <td style="width: 1%">
865
+ <foxy-i18n
866
+ infer=""
867
+ key="custom-display-id-config-transaction-journal-entries-void-example"
868
+ >
869
+ </foxy-i18n>
870
+ </td>
871
+ <td>
872
+ ${randomExampleId}${config.transaction_journal_entries
873
+ .transaction_separator}${config.transaction_journal_entries
874
+ .log_detail_request_types.transaction_void
875
+ .prefix}${randomEntryId}
876
+ </td>
877
+ </tr>
878
+ <tr>
879
+ <td style="width: 1%">
880
+ <foxy-i18n
881
+ infer=""
882
+ key="custom-display-id-config-transaction-journal-entries-refund-example"
883
+ >
884
+ </foxy-i18n>
885
+ </td>
886
+ <td>
887
+ ${randomExampleId}${config.transaction_journal_entries
888
+ .transaction_separator}${config.transaction_journal_entries
889
+ .log_detail_request_types.transaction_refund
890
+ .prefix}${randomEntryId}
891
+ </td>
892
+ </tr>
893
+ </tbody>
894
+ </table>
895
+ `
896
+ : ''}
897
+ </div>
898
+ `
899
+ : ''}
900
+ `
901
+ : ''}
902
+ `;
903
+ }
904
+ __renderSmtpConfig() {
905
+ return html `
906
+ <div
907
+ class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"
908
+ >
909
+ ${['host', 'port', 'username', 'password', 'security'].map(prop => {
910
+ const getValue = () => {
911
+ const config = JSON.parse(this.form.smtp_config || '{}');
912
+ return config[prop];
913
+ };
914
+ const setValue = (newValue) => {
915
+ var _a, _b, _c, _d, _e;
916
+ const config = JSON.parse(this.form.smtp_config || '{}');
917
+ this.edit({
918
+ smtp_config: JSON.stringify({
919
+ username: (_a = config.username) !== null && _a !== void 0 ? _a : '',
920
+ password: (_b = config.password) !== null && _b !== void 0 ? _b : '',
921
+ security: (_c = config.security) !== null && _c !== void 0 ? _c : '',
922
+ host: (_d = config.host) !== null && _d !== void 0 ? _d : '',
923
+ port: (_e = config.port) !== null && _e !== void 0 ? _e : '',
924
+ [prop]: newValue,
925
+ }),
926
+ });
927
+ };
928
+ const infer = `smtp-config-${prop}`;
929
+ if (prop === 'password') {
930
+ return html `
931
+ <foxy-internal-password-control
932
+ infer=${infer}
933
+ .getValue=${getValue}
934
+ .setValue=${setValue}
935
+ >
936
+ </foxy-internal-password-control>
937
+ `;
938
+ }
939
+ else if (prop === 'port') {
940
+ return html `
941
+ <foxy-internal-integer-control
942
+ infer=${infer}
943
+ .getValue=${getValue}
944
+ .setValue=${setValue}
945
+ >
946
+ </foxy-internal-integer-control>
947
+ `;
948
+ }
949
+ else if (prop === 'security') {
950
+ return html `
951
+ <foxy-internal-radio-group-control
952
+ infer=${infer}
953
+ class="-mt-xs -mx-xs -mb-m col-span-2"
954
+ .getValue=${getValue}
955
+ .setValue=${setValue}
956
+ .options=${[
957
+ { label: 'option_ssl', value: 'ssl' },
958
+ { label: 'option_tls', value: 'tls' },
959
+ { label: 'option_none', value: '' },
960
+ ]}
961
+ >
962
+ </foxy-internal-radio-group-control>
963
+ `;
964
+ }
965
+ else {
966
+ return html `
967
+ <foxy-internal-text-control
968
+ infer=${infer}
969
+ .getValue=${getValue}
970
+ .setValue=${setValue}
971
+ >
972
+ </foxy-internal-text-control>
973
+ `;
974
+ }
975
+ })}
976
+ </div>
977
+ `;
978
+ }
979
+ __renderWarning(key, link) {
980
+ return html `
981
+ <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2">
982
+ <foxy-i18n infer="" key=${key}></foxy-i18n>
983
+
984
+ ${link
985
+ ? html `
986
+ <a
987
+ target="_blank"
988
+ class="font-semibold hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary"
989
+ href=${link.href}
990
+ lang="en"
991
+ >
992
+ ${link.caption}
993
+ <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon>
994
+ </a>
995
+ `
996
+ : ''}
997
+ </div>
998
+ `;
999
+ }
1000
+ __renderLoader(index) {
1001
+ var _a;
1002
+ const id = `loader-${index}`;
1003
+ return {
1004
+ data: (_a = this.renderRoot.querySelector(`#${id}`)) === null || _a === void 0 ? void 0 : _a.data,
1005
+ render: (href) => html `
1006
+ <foxy-nucleon
1007
+ class="hidden"
1008
+ infer=""
1009
+ href=${ifDefined(href !== null && href !== void 0 ? href : undefined)}
1010
+ id=${id}
1011
+ @update=${() => this.requestUpdate()}
1012
+ >
1013
+ </foxy-nucleon>
1014
+ `,
1015
+ };
1016
+ }
1017
+ __renderTitle(key) {
1018
+ return html `
1019
+ <foxy-i18n infer="" class="font-bold text-xl my-s sm-col-span-2" key=${key}></foxy-i18n>
1020
+ `;
1021
+ }
1022
+ }
1023
+ //# sourceMappingURL=StoreForm.js.map