@foxy.io/elements 1.18.0-beta.13 → 1.18.0-beta.15

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 (252) 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 +2 -2
  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 +5 -5
  62. package/dist/cdn/foxy-shipment-card.js +2 -2
  63. package/dist/cdn/foxy-shipping-method-card.js +1 -0
  64. package/dist/cdn/foxy-sign-in-form.js +1 -1
  65. package/dist/cdn/foxy-spinner.js +1 -1
  66. package/dist/cdn/foxy-store-form.js +1 -0
  67. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  68. package/dist/cdn/foxy-subscription-card.js +1 -1
  69. package/dist/cdn/foxy-subscription-form.js +3 -3
  70. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  71. package/dist/cdn/foxy-table.js +1 -1
  72. package/dist/cdn/foxy-tax-card.js +1 -1
  73. package/dist/cdn/foxy-tax-form.js +1 -1
  74. package/dist/cdn/foxy-template-card.js +1 -1
  75. package/dist/cdn/foxy-template-config-form.js +1 -1
  76. package/dist/cdn/foxy-template-form.js +1 -1
  77. package/dist/cdn/foxy-template-set-card.js +1 -0
  78. package/dist/cdn/foxy-template-set-form.js +1 -1
  79. package/dist/cdn/foxy-transaction-card.js +1 -1
  80. package/dist/cdn/foxy-transaction.js +1 -1
  81. package/dist/cdn/foxy-transactions-table.js +1 -1
  82. package/dist/cdn/foxy-user-form.js +1 -1
  83. package/dist/cdn/foxy-users-table.js +1 -1
  84. package/dist/cdn/foxy-webhook-card.js +1 -1
  85. package/dist/cdn/foxy-webhook-form.js +1 -1
  86. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  87. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  88. package/dist/cdn/{shared-a0f6e39c.js → shared-0565ecbc.js} +1 -1
  89. package/dist/cdn/{shared-d863e06b.js → shared-081ad02f.js} +1 -1
  90. package/dist/cdn/{shared-415c86b6.js → shared-0953a0e7.js} +1 -1
  91. package/dist/cdn/{shared-fff1815b.js → shared-0d91f648.js} +1 -1
  92. package/dist/cdn/{shared-8a34457d.js → shared-10dbb9d7.js} +1 -1
  93. package/dist/cdn/{shared-9f0606f2.js → shared-15278fe0.js} +1 -1
  94. package/dist/cdn/{shared-015e5cb9.js → shared-1d34726a.js} +1 -1
  95. package/dist/cdn/{shared-10e7ddf5.js → shared-23e0d67e.js} +1 -1
  96. package/dist/cdn/{shared-57412bac.js → shared-2a56246b.js} +1 -1
  97. package/dist/cdn/{shared-7c8b3ce0.js → shared-2af327d0.js} +1 -1
  98. package/dist/cdn/{shared-7e690245.js → shared-3425791b.js} +5 -5
  99. package/dist/cdn/{shared-26adbd9b.js → shared-34cd3a01.js} +1 -1
  100. package/dist/cdn/shared-38df92f3.js +1 -0
  101. package/dist/cdn/{shared-c7fad58c.js → shared-398b3c49.js} +1 -1
  102. package/dist/cdn/{shared-5382ccfa.js → shared-3ef5c283.js} +1 -1
  103. package/dist/cdn/{shared-68fad60e.js → shared-45418f3b.js} +1 -1
  104. package/dist/cdn/{shared-58445db9.js → shared-4610cbdb.js} +1 -1
  105. package/dist/cdn/{shared-b0ba62ff.js → shared-4a796610.js} +1 -1
  106. package/dist/cdn/{shared-f38a79cc.js → shared-4ff7174f.js} +1 -1
  107. package/dist/cdn/shared-5606cd36.js +1 -0
  108. package/dist/cdn/{shared-aecb20d0.js → shared-5c837b54.js} +1 -1
  109. package/dist/cdn/{shared-ba78987f.js → shared-63671948.js} +1 -1
  110. package/dist/cdn/{shared-8911c2e0.js → shared-6b471536.js} +1 -1
  111. package/dist/cdn/{shared-4382f0cd.js → shared-6dafebaf.js} +1 -1
  112. package/dist/cdn/{shared-53cdff0b.js → shared-74b7438a.js} +1 -1
  113. package/dist/cdn/shared-760cc838.js +1 -0
  114. package/dist/cdn/shared-779795c5.js +1 -0
  115. package/dist/cdn/{shared-68600caf.js → shared-7ab9beb2.js} +1 -1
  116. package/dist/cdn/{shared-45cc4f44.js → shared-7ca327ea.js} +1 -1
  117. package/dist/cdn/{shared-cbff5e58.js → shared-8033b140.js} +1 -1
  118. package/dist/cdn/{shared-0b67dae4.js → shared-8328826e.js} +7 -7
  119. package/dist/cdn/{shared-34db34b2.js → shared-86be537c.js} +1 -1
  120. package/dist/cdn/{shared-20b2223a.js → shared-8704e701.js} +1 -1
  121. package/dist/cdn/shared-88924652.js +169 -0
  122. package/dist/cdn/shared-890a22af.js +1 -0
  123. package/dist/cdn/shared-8ab29d7d.js +1 -0
  124. package/dist/cdn/{shared-465cdd03.js → shared-8dee6348.js} +2 -2
  125. package/dist/cdn/{shared-d8faafc7.js → shared-9195959e.js} +1 -1
  126. package/dist/cdn/{shared-8c8853ab.js → shared-93c15291.js} +1 -1
  127. package/dist/cdn/shared-a420358e.js +1 -0
  128. package/dist/cdn/{shared-6a2cf3b9.js → shared-a5000f1f.js} +2 -2
  129. package/dist/cdn/{shared-b54eb879.js → shared-a6339611.js} +1 -1
  130. package/dist/cdn/{shared-da126678.js → shared-a861c770.js} +1 -1
  131. package/dist/cdn/{shared-2ec256d5.js → shared-a8966936.js} +1 -1
  132. package/dist/cdn/{shared-cd1bc9f5.js → shared-a8ada44e.js} +1 -1
  133. package/dist/cdn/{shared-c47571a6.js → shared-abf68928.js} +1 -1
  134. package/dist/cdn/shared-b567541a.js +1 -0
  135. package/dist/cdn/{shared-ef792142.js → shared-b6a37360.js} +1 -1
  136. package/dist/cdn/{shared-c6f5602e.js → shared-b98f0ad9.js} +1 -1
  137. package/dist/cdn/{shared-e46eb641.js → shared-bd4b0759.js} +1 -1
  138. package/dist/cdn/shared-c29811ec.js +1 -0
  139. package/dist/cdn/{shared-2e33702b.js → shared-cd14b0cc.js} +1 -1
  140. package/dist/cdn/{shared-09a14740.js → shared-d1b62ccd.js} +17 -12
  141. package/dist/cdn/{shared-008ffb33.js → shared-d58e7670.js} +1 -1
  142. package/dist/cdn/shared-d82f3ba0.js +1 -0
  143. package/dist/cdn/{shared-5bf3f8f1.js → shared-d8b14272.js} +1 -1
  144. package/dist/cdn/{shared-27aeabd9.js → shared-dee53530.js} +1 -1
  145. package/dist/cdn/{shared-35e929aa.js → shared-eefa4103.js} +1 -1
  146. package/dist/cdn/{shared-0f137ff8.js → shared-f22d1ed9.js} +1 -1
  147. package/dist/cdn/{shared-f49ee631.js → shared-fd124dfd.js} +1 -1
  148. package/dist/cdn/shared-fdf6ca55.js +1 -0
  149. package/dist/cdn/{shared-fce199fa.js → shared-ffea7639.js} +1 -1
  150. package/dist/cdn/translations/email-template-card/en.json +1 -1
  151. package/dist/cdn/translations/shipping-method-card/en.json +11 -0
  152. package/dist/cdn/translations/store-form/en.json +316 -0
  153. package/dist/cdn/translations/template-config-form/en.json +0 -4
  154. package/dist/cdn/translations/template-set-card/en.json +7 -0
  155. package/dist/cdn/translations/template-set-form/en.json +8 -342
  156. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +6 -0
  157. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +47 -28
  158. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.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/InternalTextControl/InternalTextControl.d.ts +4 -1
  181. package/dist/elements/internal/InternalTextControl/InternalTextControl.js +15 -1
  182. package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
  183. package/dist/elements/private/Dialog/Dialog.d.ts +2 -0
  184. package/dist/elements/private/Dialog/Dialog.js +6 -1
  185. package/dist/elements/private/Dialog/Dialog.js.map +1 -1
  186. package/dist/elements/public/EmailTemplateCard/EmailTemplateCard.js +8 -1
  187. package/dist/elements/public/EmailTemplateCard/EmailTemplateCard.js.map +1 -1
  188. package/dist/elements/public/ShippingMethodCard/ShippingMethodCard.d.ts +15 -0
  189. package/dist/elements/public/ShippingMethodCard/ShippingMethodCard.js +78 -0
  190. package/dist/elements/public/ShippingMethodCard/ShippingMethodCard.js.map +1 -0
  191. package/dist/elements/public/ShippingMethodCard/index.d.ts +4 -0
  192. package/dist/elements/public/ShippingMethodCard/index.js +6 -0
  193. package/dist/elements/public/ShippingMethodCard/index.js.map +1 -0
  194. package/dist/elements/public/ShippingMethodCard/types.d.ts +10 -0
  195. package/dist/elements/public/ShippingMethodCard/types.js +2 -0
  196. package/dist/elements/public/ShippingMethodCard/types.js.map +1 -0
  197. package/dist/elements/public/StoreForm/StoreForm.d.ts +55 -0
  198. package/dist/elements/public/StoreForm/StoreForm.js +1030 -0
  199. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -0
  200. package/dist/elements/public/StoreForm/index.d.ts +15 -0
  201. package/dist/elements/public/StoreForm/index.js +17 -0
  202. package/dist/elements/public/StoreForm/index.js.map +1 -0
  203. package/dist/elements/public/StoreForm/types.d.ts +3 -0
  204. package/dist/elements/public/StoreForm/types.js +2 -0
  205. package/dist/elements/public/StoreForm/types.js.map +1 -0
  206. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +24 -0
  207. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  208. package/dist/elements/public/StoreShippingMethodForm/index.d.ts +1 -0
  209. package/dist/elements/public/StoreShippingMethodForm/index.js +1 -0
  210. package/dist/elements/public/StoreShippingMethodForm/index.js.map +1 -1
  211. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +0 -1
  212. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +9 -58
  213. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  214. package/dist/elements/public/TemplateConfigForm/index.d.ts +0 -1
  215. package/dist/elements/public/TemplateConfigForm/index.js +0 -1
  216. package/dist/elements/public/TemplateConfigForm/index.js.map +1 -1
  217. package/dist/elements/public/TemplateSetCard/TemplateSetCard.d.ts +10 -0
  218. package/dist/elements/public/TemplateSetCard/TemplateSetCard.js +18 -0
  219. package/dist/elements/public/TemplateSetCard/TemplateSetCard.js.map +1 -0
  220. package/dist/elements/public/TemplateSetCard/index.d.ts +3 -0
  221. package/dist/elements/public/TemplateSetCard/index.js +5 -0
  222. package/dist/elements/public/TemplateSetCard/index.js.map +1 -0
  223. package/dist/elements/public/TemplateSetCard/types.d.ts +3 -0
  224. package/dist/elements/public/TemplateSetCard/types.js +2 -0
  225. package/dist/elements/public/TemplateSetCard/types.js.map +1 -0
  226. package/dist/elements/public/TemplateSetForm/TemplateSetForm.d.ts +1 -20
  227. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js +21 -236
  228. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js.map +1 -1
  229. package/dist/elements/public/TemplateSetForm/index.d.ts +0 -8
  230. package/dist/elements/public/TemplateSetForm/index.js +0 -8
  231. package/dist/elements/public/TemplateSetForm/index.js.map +1 -1
  232. package/dist/elements/public/index.d.ts +3 -0
  233. package/dist/elements/public/index.defined.d.ts +3 -0
  234. package/dist/elements/public/index.defined.js +3 -0
  235. package/dist/elements/public/index.defined.js.map +1 -1
  236. package/dist/elements/public/index.js +3 -0
  237. package/dist/elements/public/index.js.map +1 -1
  238. package/dist/mixins/themeable.js +280 -88
  239. package/dist/mixins/themeable.js.map +1 -1
  240. package/package.json +1 -1
  241. package/dist/cdn/shared-0093ee59.js +0 -6
  242. package/dist/cdn/shared-156144ab.js +0 -1
  243. package/dist/cdn/shared-2a20ac6b.js +0 -1
  244. package/dist/cdn/shared-3909c1e5.js +0 -1
  245. package/dist/cdn/shared-3fb5f380.js +0 -1
  246. package/dist/cdn/shared-4cd53ea2.js +0 -1
  247. package/dist/cdn/shared-8c91f512.js +0 -169
  248. package/dist/cdn/shared-9eff0743.js +0 -1
  249. package/dist/cdn/shared-a03d948d.js +0 -1
  250. package/dist/cdn/shared-be043b54.js +0 -1
  251. package/dist/cdn/shared-c00bff9d.js +0 -1
  252. package/dist/cdn/shared-c60b6e1a.js +0 -1
@@ -0,0 +1,1030 @@
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
+ <div class="grid gap-m grid-cols-1 sm-grid-cols-2">
276
+ <foxy-internal-text-control infer="store-name"></foxy-internal-text-control>
277
+
278
+ <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control>
279
+
280
+ <foxy-internal-text-control
281
+ helper-text=${storeDomainHelperText}
282
+ suffix=${storeDomainSuffix}
283
+ infer="store-domain"
284
+ .setValue=${this.__setStoreDomainValue}
285
+ >
286
+ </foxy-internal-text-control>
287
+
288
+ <foxy-internal-text-control infer="store-url"></foxy-internal-text-control>
289
+
290
+ <foxy-internal-editable-list-control
291
+ infer="store-email"
292
+ class="sm-col-span-2"
293
+ .getValue=${this.__getStoreEmailValue}
294
+ .setValue=${this.__setStoreEmailValue}
295
+ >
296
+ </foxy-internal-editable-list-control>
297
+
298
+ <foxy-internal-select-control
299
+ infer="timezone"
300
+ class="sm-col-span-2"
301
+ .options=${timezoneOptions}
302
+ >
303
+ </foxy-internal-select-control>
304
+
305
+ <foxy-internal-async-combo-box-control
306
+ item-label-path="version"
307
+ item-value-path="_links.self.href"
308
+ infer="store-version-uri"
309
+ first=${ifDefined((_w = this.storeVersions) !== null && _w !== void 0 ? _w : undefined)}
310
+ .selectedItem=${storeVersion}
311
+ >
312
+ </foxy-internal-async-combo-box-control>
313
+
314
+ <foxy-internal-text-control
315
+ infer="from-email"
316
+ class="sm-col-span-2"
317
+ placeholder=${(_y = (_x = this.__getStoreEmailValue()[0]) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : this.t('from-email.placeholder')}
318
+ >
319
+ </foxy-internal-text-control>
320
+
321
+ <foxy-internal-checkbox-group-control
322
+ infer="bcc-on-receipt-email"
323
+ class="-mt-xs -mb-m sm-col-span-2"
324
+ .getValue=${this.__getBccOnReceiptEmailValue}
325
+ .setValue=${this.__setBccOnReceiptEmailValue}
326
+ .options=${this.__singleCheckboxGroupOptions}
327
+ >
328
+ </foxy-internal-checkbox-group-control>
329
+
330
+ <foxy-internal-checkbox-group-control
331
+ infer="use-email-dns"
332
+ class="-mt-xs -mb-m sm-col-span-2"
333
+ .getValue=${this.__getUseEmailDnsValue}
334
+ .setValue=${this.__setUseEmailDnsValue}
335
+ .options=${this.__singleCheckboxGroupOptions}
336
+ >
337
+ </foxy-internal-checkbox-group-control>
338
+
339
+ ${isUseEmailDnsWarningVisible
340
+ ? this.__renderWarning('use_email_dns_helper_text', {
341
+ href: 'https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc',
342
+ caption: 'How Emails Are Sent (SPF, DKIM, DMARC, etc.)',
343
+ })
344
+ : ''}
345
+
346
+ <foxy-internal-checkbox-group-control
347
+ infer="use-smtp-config"
348
+ class="-mt-xs -mb-m sm-col-span-2"
349
+ .getValue=${this.__getUseSmtpConfigValue}
350
+ .setValue=${this.__setUseSmtpConfigValue}
351
+ .options=${this.__singleCheckboxGroupOptions}
352
+ >
353
+ </foxy-internal-checkbox-group-control>
354
+
355
+ ${this.form.smtp_config && !this.hiddenSelector.matches('smtp-config', true)
356
+ ? this.__renderSmtpConfig()
357
+ : ''}
358
+
359
+ <foxy-internal-select-control infer="country" .options=${countryOptions}>
360
+ </foxy-internal-select-control>
361
+
362
+ <foxy-internal-select-control infer="region" .options=${regionOptions}>
363
+ </foxy-internal-select-control>
364
+
365
+ <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control>
366
+
367
+ <foxy-internal-select-control
368
+ infer="shipping-address-type"
369
+ .options=${shippingAddressTypeOptions}
370
+ >
371
+ </foxy-internal-select-control>
372
+
373
+ <foxy-internal-checkbox-group-control
374
+ infer="features-multiship"
375
+ class="-mt-xs -mb-m sm-col-span-2"
376
+ .getValue=${this.__getFeaturesMultishipValue}
377
+ .setValue=${this.__setFeaturesMultishipValue}
378
+ .options=${this.__singleCheckboxGroupOptions}
379
+ >
380
+ </foxy-internal-checkbox-group-control>
381
+
382
+ <foxy-internal-checkbox-group-control
383
+ infer="require-signed-shipping-rates"
384
+ class="-mt-xs -mb-m sm-col-span-2"
385
+ .getValue=${this.__getRequireSignedShippingRatesValue}
386
+ .setValue=${this.__setRequireSignedShippingRatesValue}
387
+ .options=${this.__singleCheckboxGroupOptions}
388
+ >
389
+ </foxy-internal-checkbox-group-control>
390
+
391
+ ${isRequireSignedShippingRatesWarningVisible
392
+ ? this.__renderWarning('require_signed_shipping_rates_helper_text')
393
+ : ''}
394
+
395
+ <foxy-internal-select-control infer="language" .options=${languageOptions}>
396
+ </foxy-internal-select-control>
397
+
398
+ <foxy-internal-select-control infer="locale-code" .options=${localeCodeOptions}>
399
+ </foxy-internal-select-control>
400
+
401
+ ${!this.hiddenSelector.matches('currency-style', true)
402
+ ? this.__renderCurrencyStyleSelector()
403
+ : ''}
404
+
405
+ <!-- -->
406
+
407
+ ${!this.hiddenSelector.matches('custom-display-id-config', true)
408
+ ? this.__renderCustomIDSettings()
409
+ : ''}
410
+
411
+ <!-- -->
412
+
413
+ <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url">
414
+ </foxy-internal-text-control>
415
+
416
+ <foxy-internal-frequency-control
417
+ class="sm-col-span-2"
418
+ infer="app-session-time"
419
+ .getValue=${this.__getAppSessionTimeValue}
420
+ .setValue=${this.__setAppSessionTimeValue}
421
+ .options=${this.__appSessionTimeOptions}
422
+ >
423
+ </foxy-internal-frequency-control>
424
+
425
+ <foxy-internal-checkbox-group-control
426
+ infer="products-require-expires-property"
427
+ class="-mt-xs -mb-m sm-col-span-2"
428
+ .getValue=${this.__getProductsRequireExpiresPropertyValue}
429
+ .setValue=${this.__setProductsRequireExpiresPropertyValue}
430
+ .options=${this.__singleCheckboxGroupOptions}
431
+ >
432
+ </foxy-internal-checkbox-group-control>
433
+
434
+ ${isProductsRequireExpiresPropertyWarningVisible
435
+ ? this.__renderWarning('products_require_expires_property_helper_text')
436
+ : ''}
437
+
438
+ <foxy-internal-checkbox-group-control
439
+ infer="use-cart-validation"
440
+ class="-mt-xs -mb-m sm-col-span-2"
441
+ .getValue=${this.__getUseCartValidationValue}
442
+ .setValue=${this.__setUseCartValidationValue}
443
+ .options=${this.__singleCheckboxGroupOptions}
444
+ >
445
+ </foxy-internal-checkbox-group-control>
446
+
447
+ ${isUseCartValidationWarningVisible
448
+ ? this.__renderWarning('use_cart_validation_helper_text', {
449
+ href: 'https://wiki.foxycart.com/v/2.0/hmac_validation',
450
+ caption: 'HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms',
451
+ })
452
+ : ''}
453
+
454
+ <foxy-internal-select-control
455
+ infer="checkout-type"
456
+ class="sm-col-span-2"
457
+ .options=${checkoutTypeOptions}
458
+ >
459
+ </foxy-internal-select-control>
460
+
461
+ <foxy-internal-select-control
462
+ infer="customer-password-hash-type"
463
+ .options=${customerPasswordHashTypeOptions}
464
+ .setValue=${(newValue) => {
465
+ var _a;
466
+ const entry = customerPasswordHashTypeEntries.find(([v]) => v === newValue);
467
+ this.edit({
468
+ customer_password_hash_type: newValue,
469
+ customer_password_hash_config: (_a = entry === null || entry === void 0 ? void 0 : entry[1].config) !== null && _a !== void 0 ? _a : '',
470
+ });
471
+ }}
472
+ >
473
+ </foxy-internal-select-control>
474
+
475
+ ${typeof this.form.customer_password_hash_config === 'number'
476
+ ? html `
477
+ <foxy-internal-number-control infer="customer-password-hash-config">
478
+ </foxy-internal-number-control>
479
+ `
480
+ : html `
481
+ <foxy-internal-text-control infer="customer-password-hash-config">
482
+ </foxy-internal-text-control>
483
+ `}
484
+
485
+ <foxy-internal-password-control infer="unified-order-entry-password">
486
+ </foxy-internal-password-control>
487
+
488
+ <foxy-internal-text-control
489
+ infer="single-sign-on-url"
490
+ .getValue=${this.__getSingleSignOnUrlValue}
491
+ .setValue=${this.__setSingleSignOnUrlValue}
492
+ >
493
+ </foxy-internal-text-control>
494
+
495
+ <foxy-internal-text-control
496
+ infer="webhook-url"
497
+ class="sm-col-span-2"
498
+ .getValue=${this.__getWebhookUrlValue}
499
+ .setValue=${this.__setWebhookUrlValue}
500
+ >
501
+ </foxy-internal-text-control>
502
+
503
+ ${this.__renderWebhookKey()}
504
+
505
+ <!-- -->
506
+
507
+ ${this.data && !this.hiddenSelector.matches('is-maintenance-mode', true)
508
+ ? this.__renderMaintenanceModeSwitch()
509
+ : ''}
510
+ </div>
511
+
512
+ ${super.renderBody()}
513
+ `;
514
+ }
515
+ __renderWebhookKey() {
516
+ var _a, _b;
517
+ let parsedKey;
518
+ try {
519
+ parsedKey = JSON.parse((_a = this.form.webhook_key) !== null && _a !== void 0 ? _a : '');
520
+ }
521
+ catch (_c) {
522
+ const v = (_b = this.form.webhook_key) !== null && _b !== void 0 ? _b : '';
523
+ parsedKey = { cart_signing: v, xml_datafeed: v, api_legacy: v, sso: v };
524
+ }
525
+ return Object.keys(parsedKey).map(key => {
526
+ return html `
527
+ <foxy-internal-password-control
528
+ infer="webhook-key-${key.replace('_', '-')}"
529
+ .getValue=${() => parsedKey[key]}
530
+ .setValue=${(newValue) => {
531
+ parsedKey[key] = newValue;
532
+ this.edit({ webhook_key: JSON.stringify(parsedKey) });
533
+ }}
534
+ >
535
+ </foxy-internal-password-control>
536
+ `;
537
+ });
538
+ }
539
+ __renderMaintenanceModeSwitch() {
540
+ var _a;
541
+ const isActive = !!((_a = this.data) === null || _a === void 0 ? void 0 : _a.is_maintenance_mode);
542
+ const buttonKey = `${isActive ? 'disable' : 'enable'}_maintenance_mode`;
543
+ const explainerKey = `maintenance_mode_${isActive ? 'on' : 'off'}_explainer`;
544
+ return html `
545
+ <div
546
+ class=${classMap({
547
+ 'rounded-t-l rounded-b-l leading-s text-s sm-col-span-2': true,
548
+ 'text-tertiary': !isActive,
549
+ 'text-error': isActive,
550
+ })}
551
+ >
552
+ <foxy-i18n infer="" class="block mb-s" key=${explainerKey}></foxy-i18n>
553
+
554
+ <vaadin-button
555
+ theme="tertiary small ${isActive ? 'contrast' : ''}"
556
+ class="p-0"
557
+ @click=${() => {
558
+ this.edit({ is_maintenance_mode: !this.form.is_maintenance_mode });
559
+ this.submit();
560
+ }}
561
+ >
562
+ <foxy-i18n infer="" key=${buttonKey}></foxy-i18n>
563
+ </vaadin-button>
564
+ </div>
565
+ `;
566
+ }
567
+ __renderCurrencyStyleSelector() {
568
+ const map = {
569
+ '101': 0,
570
+ '100': 0,
571
+ '001': 1,
572
+ '000': 2,
573
+ '111': 3,
574
+ '110': 3,
575
+ '011': 4,
576
+ '010': 5,
577
+ };
578
+ const selectionCode = [
579
+ this.form.hide_currency_symbol,
580
+ this.form.hide_decimal_characters,
581
+ this.form.use_international_currency_symbol,
582
+ ]
583
+ .map(v => Number(Boolean(v)))
584
+ .join('');
585
+ const selectionIndex = map[selectionCode];
586
+ return html `
587
+ <div
588
+ class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"
589
+ >
590
+ <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"> </foxy-i18n>
591
+
592
+ <div
593
+ class="grid grid-cols-3 bg-contrast-10"
594
+ style="gap: 1px; padding: 1px; border-radius: calc(var(--lumo-border-radius-m) + 1px)"
595
+ >
596
+ ${['12.34', '$12.34', 'USD 12.34', '12', '$12', 'USD 12'].map((example, index) => {
597
+ return html `
598
+ <label
599
+ class=${classMap({
600
+ 'relative z-0 px-s h-m flex items-center transition-colors': true,
601
+ 'hover-cursor-pointer': true,
602
+ 'focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50': true,
603
+ 'bg-base text-body hover-bg-transparent': index !== selectionIndex,
604
+ 'bg-primary text-primary-contrast': index === selectionIndex,
605
+ 'rounded-tl': index === 0,
606
+ 'rounded-tr': index === 2,
607
+ 'rounded-bl': index === 3,
608
+ 'rounded-br': index === 5,
609
+ })}
610
+ >
611
+ <span class="font-medium font-tnum">${example}</span>
612
+ <input
613
+ class="sr-only"
614
+ value=${index}
615
+ type="radio"
616
+ name="currency-style"
617
+ ?checked=${index === selectionIndex}
618
+ @change=${() => {
619
+ const set = Object.entries(map).find(v => v[1] === index)[0];
620
+ this.edit({
621
+ hide_currency_symbol: Boolean(Number(set[0])),
622
+ hide_decimal_characters: Boolean(Number(set[1])),
623
+ use_international_currency_symbol: Boolean(Number(set[2])),
624
+ });
625
+ }}
626
+ />
627
+ </label>
628
+ `;
629
+ })}
630
+ </div>
631
+
632
+ <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"> </foxy-i18n>
633
+ </div>
634
+ `;
635
+ }
636
+ __renderCustomIDSettings() {
637
+ var _a;
638
+ const defaultConfig = {
639
+ enabled: false,
640
+ start: '0',
641
+ length: '0',
642
+ prefix: '',
643
+ suffix: '',
644
+ transaction_journal_entries: {
645
+ enabled: false,
646
+ transaction_separator: '',
647
+ log_detail_request_types: {
648
+ transaction_authcapture: { prefix: '' },
649
+ transaction_capture: { prefix: '' },
650
+ transaction_refund: { prefix: '' },
651
+ transaction_void: { prefix: '' },
652
+ },
653
+ },
654
+ };
655
+ let config;
656
+ try {
657
+ config = JSON.parse((_a = this.form.custom_display_id_config) !== null && _a !== void 0 ? _a : '');
658
+ }
659
+ catch (_b) {
660
+ config = cloneDeep(defaultConfig);
661
+ }
662
+ const startAsInt = parseInt(config.start || '0');
663
+ const lengthAsInt = parseInt(config.length || '0');
664
+ const numericLength = lengthAsInt - config.prefix.length - config.suffix.length;
665
+ const randomExampleNumericId = Math.min(startAsInt + Math.floor(Math.random() * Math.pow(10, numericLength)), Math.pow(10, numericLength) - 1);
666
+ const randomExampleId = `${config.prefix}${randomExampleNumericId
667
+ .toString()
668
+ .padStart(numericLength, '0')}${config.suffix}`;
669
+ const randomNumericEntryId = Math.floor(Math.random() * 1000);
670
+ const randomEntryId = String(randomNumericEntryId).padStart(3, '0');
671
+ return html `
672
+ <foxy-internal-checkbox-group-control
673
+ infer="custom-display-id-config-enabled"
674
+ class="-mt-xs -mb-m sm-col-span-2"
675
+ .getValue=${() => (config.enabled ? ['checked'] : [])}
676
+ .setValue=${(newValue) => {
677
+ config.enabled = newValue.includes('checked');
678
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
679
+ }}
680
+ .options=${this.__singleCheckboxGroupOptions}
681
+ >
682
+ </foxy-internal-checkbox-group-control>
683
+
684
+ ${config.enabled
685
+ ? html `
686
+ <div
687
+ class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"
688
+ >
689
+ <foxy-internal-integer-control
690
+ infer="custom-display-id-config-start"
691
+ min="0"
692
+ .getValue=${() => parseInt(config.start || '0')}
693
+ .setValue=${(newValue) => {
694
+ config.start = String(newValue);
695
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
696
+ }}
697
+ >
698
+ </foxy-internal-integer-control>
699
+
700
+ <foxy-internal-integer-control
701
+ infer="custom-display-id-config-length"
702
+ min="0"
703
+ .getValue=${() => parseInt(config.length || '0')}
704
+ .setValue=${(newValue) => {
705
+ config.length = String(newValue);
706
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
707
+ }}
708
+ >
709
+ </foxy-internal-integer-control>
710
+
711
+ <foxy-internal-text-control
712
+ infer="custom-display-id-config-prefix"
713
+ .getValue=${() => config.prefix}
714
+ .setValue=${(newValue) => {
715
+ config.prefix = newValue;
716
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
717
+ }}
718
+ >
719
+ </foxy-internal-text-control>
720
+
721
+ <foxy-internal-text-control
722
+ infer="custom-display-id-config-suffix"
723
+ .getValue=${() => config.suffix}
724
+ .setValue=${(newValue) => {
725
+ config.suffix = newValue;
726
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
727
+ }}
728
+ >
729
+ </foxy-internal-text-control>
730
+
731
+ ${config.start && config.length && startAsInt / 10 <= numericLength
732
+ ? html `
733
+ <table
734
+ style="font-family: monospace"
735
+ class="col-span-2 text-xs text-secondary whitespace-nowrap"
736
+ >
737
+ <tbody>
738
+ <tr>
739
+ <td style="width: 1%">
740
+ <foxy-i18n infer="" key="custom-display-id-config-first-example">
741
+ </foxy-i18n>
742
+ </td>
743
+ <td>
744
+ ${config.prefix}${startAsInt
745
+ .toString()
746
+ .padStart(numericLength, '0')}${config.suffix}
747
+ </td>
748
+ </tr>
749
+ <tr style="width: 1%">
750
+ <td>
751
+ <foxy-i18n infer="" key="custom-display-id-config-random-example">
752
+ </foxy-i18n>
753
+ </td>
754
+ <td>${randomExampleId}</td>
755
+ </tr>
756
+ </tbody>
757
+ </table>
758
+ `
759
+ : ''}
760
+ </div>
761
+
762
+ <foxy-internal-checkbox-group-control
763
+ infer="custom-display-id-config-transaction-journal-entries-enabled"
764
+ class="-mt-xs -mb-m sm-col-span-2"
765
+ .getValue=${() => (config.transaction_journal_entries.enabled ? ['checked'] : [])}
766
+ .setValue=${(newValue) => {
767
+ config.transaction_journal_entries.enabled = newValue.includes('checked');
768
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
769
+ }}
770
+ .options=${this.__singleCheckboxGroupOptions}
771
+ >
772
+ </foxy-internal-checkbox-group-control>
773
+
774
+ ${config.transaction_journal_entries.enabled
775
+ ? html `
776
+ <div
777
+ class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"
778
+ >
779
+ <foxy-internal-text-control
780
+ infer="custom-display-id-config-transaction-journal-entries-transaction-separator"
781
+ class="col-span-2"
782
+ .getValue=${() => config.transaction_journal_entries.transaction_separator}
783
+ .setValue=${(newValue) => {
784
+ config.transaction_journal_entries.transaction_separator = 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-authcapture-prefix"
792
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
793
+ .transaction_authcapture.prefix}
794
+ .setValue=${(newValue) => {
795
+ config.transaction_journal_entries.log_detail_request_types.transaction_authcapture.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-capture-prefix"
804
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
805
+ .transaction_capture.prefix}
806
+ .setValue=${(newValue) => {
807
+ config.transaction_journal_entries.log_detail_request_types.transaction_capture.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-void-prefix"
816
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types.transaction_void
817
+ .prefix}
818
+ .setValue=${(newValue) => {
819
+ config.transaction_journal_entries.log_detail_request_types.transaction_void.prefix =
820
+ newValue;
821
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
822
+ }}
823
+ >
824
+ </foxy-internal-text-control>
825
+
826
+ <foxy-internal-text-control
827
+ infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix"
828
+ .getValue=${() => config.transaction_journal_entries.log_detail_request_types
829
+ .transaction_refund.prefix}
830
+ .setValue=${(newValue) => {
831
+ config.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix =
832
+ newValue;
833
+ this.edit({ custom_display_id_config: JSON.stringify(config) });
834
+ }}
835
+ >
836
+ </foxy-internal-text-control>
837
+
838
+ ${config.start && config.length && startAsInt / 10 <= numericLength
839
+ ? html `
840
+ <table
841
+ style="font-family: monospace"
842
+ class="col-span-2 text-xs text-secondary whitespace-nowrap"
843
+ >
844
+ <tbody>
845
+ <tr>
846
+ <td style="width: 1%">
847
+ <foxy-i18n
848
+ infer=""
849
+ key="custom-display-id-config-transaction-journal-entries-authcapture-example"
850
+ >
851
+ </foxy-i18n>
852
+ </td>
853
+ <td>
854
+ ${randomExampleId}${config.transaction_journal_entries
855
+ .transaction_separator}${config.transaction_journal_entries
856
+ .log_detail_request_types.transaction_authcapture
857
+ .prefix}${randomEntryId}
858
+ </td>
859
+ </tr>
860
+ <tr>
861
+ <td style="width: 1%">
862
+ <foxy-i18n
863
+ infer=""
864
+ key="custom-display-id-config-transaction-journal-entries-capture-example"
865
+ >
866
+ </foxy-i18n>
867
+ </td>
868
+ <td>
869
+ ${randomExampleId}${config.transaction_journal_entries
870
+ .transaction_separator}${config.transaction_journal_entries
871
+ .log_detail_request_types.transaction_capture
872
+ .prefix}${randomEntryId}
873
+ </td>
874
+ </tr>
875
+ <tr>
876
+ <td style="width: 1%">
877
+ <foxy-i18n
878
+ infer=""
879
+ key="custom-display-id-config-transaction-journal-entries-void-example"
880
+ >
881
+ </foxy-i18n>
882
+ </td>
883
+ <td>
884
+ ${randomExampleId}${config.transaction_journal_entries
885
+ .transaction_separator}${config.transaction_journal_entries
886
+ .log_detail_request_types.transaction_void
887
+ .prefix}${randomEntryId}
888
+ </td>
889
+ </tr>
890
+ <tr>
891
+ <td style="width: 1%">
892
+ <foxy-i18n
893
+ infer=""
894
+ key="custom-display-id-config-transaction-journal-entries-refund-example"
895
+ >
896
+ </foxy-i18n>
897
+ </td>
898
+ <td>
899
+ ${randomExampleId}${config.transaction_journal_entries
900
+ .transaction_separator}${config.transaction_journal_entries
901
+ .log_detail_request_types.transaction_refund
902
+ .prefix}${randomEntryId}
903
+ </td>
904
+ </tr>
905
+ </tbody>
906
+ </table>
907
+ `
908
+ : ''}
909
+ </div>
910
+ `
911
+ : ''}
912
+ `
913
+ : ''}
914
+ `;
915
+ }
916
+ __renderSmtpConfig() {
917
+ return html `
918
+ <div
919
+ class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"
920
+ >
921
+ ${['host', 'port', 'username', 'password', 'security'].map(prop => {
922
+ const getValue = () => {
923
+ const config = JSON.parse(this.form.smtp_config || '{}');
924
+ return config[prop];
925
+ };
926
+ const setValue = (newValue) => {
927
+ var _a, _b, _c, _d, _e;
928
+ const config = JSON.parse(this.form.smtp_config || '{}');
929
+ this.edit({
930
+ smtp_config: JSON.stringify({
931
+ username: (_a = config.username) !== null && _a !== void 0 ? _a : '',
932
+ password: (_b = config.password) !== null && _b !== void 0 ? _b : '',
933
+ security: (_c = config.security) !== null && _c !== void 0 ? _c : '',
934
+ host: (_d = config.host) !== null && _d !== void 0 ? _d : '',
935
+ port: (_e = config.port) !== null && _e !== void 0 ? _e : '',
936
+ [prop]: newValue,
937
+ }),
938
+ });
939
+ };
940
+ const infer = `smtp-config-${prop}`;
941
+ if (prop === 'password') {
942
+ return html `
943
+ <foxy-internal-password-control
944
+ infer=${infer}
945
+ .getValue=${getValue}
946
+ .setValue=${setValue}
947
+ >
948
+ </foxy-internal-password-control>
949
+ `;
950
+ }
951
+ else if (prop === 'port') {
952
+ return html `
953
+ <foxy-internal-integer-control
954
+ infer=${infer}
955
+ .getValue=${getValue}
956
+ .setValue=${setValue}
957
+ >
958
+ </foxy-internal-integer-control>
959
+ `;
960
+ }
961
+ else if (prop === 'security') {
962
+ return html `
963
+ <foxy-internal-radio-group-control
964
+ infer=${infer}
965
+ class="-mt-xs -mx-xs -mb-m col-span-2"
966
+ .getValue=${getValue}
967
+ .setValue=${setValue}
968
+ .options=${[
969
+ { label: 'option_ssl', value: 'ssl' },
970
+ { label: 'option_tls', value: 'tls' },
971
+ { label: 'option_none', value: '' },
972
+ ]}
973
+ >
974
+ </foxy-internal-radio-group-control>
975
+ `;
976
+ }
977
+ else {
978
+ return html `
979
+ <foxy-internal-text-control
980
+ infer=${infer}
981
+ .getValue=${getValue}
982
+ .setValue=${setValue}
983
+ >
984
+ </foxy-internal-text-control>
985
+ `;
986
+ }
987
+ })}
988
+ </div>
989
+ `;
990
+ }
991
+ __renderWarning(key, link) {
992
+ return html `
993
+ <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2">
994
+ <foxy-i18n infer="" key=${key}></foxy-i18n>
995
+
996
+ ${link
997
+ ? html `
998
+ <a
999
+ target="_blank"
1000
+ class="font-semibold hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary"
1001
+ href=${link.href}
1002
+ lang="en"
1003
+ >
1004
+ ${link.caption}
1005
+ <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon>
1006
+ </a>
1007
+ `
1008
+ : ''}
1009
+ </div>
1010
+ `;
1011
+ }
1012
+ __renderLoader(index) {
1013
+ var _a;
1014
+ const id = `loader-${index}`;
1015
+ return {
1016
+ data: (_a = this.renderRoot.querySelector(`#${id}`)) === null || _a === void 0 ? void 0 : _a.data,
1017
+ render: (href) => html `
1018
+ <foxy-nucleon
1019
+ class="hidden"
1020
+ infer=""
1021
+ href=${ifDefined(href !== null && href !== void 0 ? href : undefined)}
1022
+ id=${id}
1023
+ @update=${() => this.requestUpdate()}
1024
+ >
1025
+ </foxy-nucleon>
1026
+ `,
1027
+ };
1028
+ }
1029
+ }
1030
+ //# sourceMappingURL=StoreForm.js.map