@foxy.io/elements 1.35.0-beta.1 → 1.35.0-beta.3

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 (234) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  5. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  6. package/dist/cdn/foxy-api-browser.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  8. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-card.js +1 -1
  11. package/dist/cdn/foxy-attribute-form.js +1 -1
  12. package/dist/cdn/foxy-billing-address-card.js +1 -1
  13. package/dist/cdn/foxy-cancellation-form.js +1 -1
  14. package/dist/cdn/foxy-cart-card.js +1 -1
  15. package/dist/cdn/foxy-cart-form.js +1 -1
  16. package/dist/cdn/foxy-client-card.js +1 -1
  17. package/dist/cdn/foxy-client-form.js +1 -1
  18. package/dist/cdn/foxy-collection-page.js +1 -1
  19. package/dist/cdn/foxy-collection-pages.js +1 -1
  20. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  21. package/dist/cdn/foxy-coupon-card.js +1 -1
  22. package/dist/cdn/foxy-coupon-code-card.js +1 -1
  23. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  24. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  25. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  26. package/dist/cdn/foxy-coupon-form.js +1 -1
  27. package/dist/cdn/foxy-custom-field-card.js +1 -1
  28. package/dist/cdn/foxy-custom-field-form.js +1 -1
  29. package/dist/cdn/foxy-customer-api.js +1 -1
  30. package/dist/cdn/foxy-customer-card.js +1 -1
  31. package/dist/cdn/foxy-customer-form.js +1 -1
  32. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  33. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  34. package/dist/cdn/foxy-customer-portal.js +2 -2
  35. package/dist/cdn/foxy-customer.js +1 -1
  36. package/dist/cdn/foxy-customers-table.js +1 -1
  37. package/dist/cdn/foxy-discount-builder.js +1 -1
  38. package/dist/cdn/foxy-discount-card.js +1 -1
  39. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  40. package/dist/cdn/foxy-donation.js +1 -1
  41. package/dist/cdn/foxy-downloadable-card.js +1 -1
  42. package/dist/cdn/foxy-downloadable-form.js +1 -1
  43. package/dist/cdn/foxy-email-template-card.js +1 -1
  44. package/dist/cdn/foxy-email-template-form.js +1 -1
  45. package/dist/cdn/foxy-error-entry-card.js +1 -1
  46. package/dist/cdn/foxy-experimental-add-to-cart-builder.js +14 -1
  47. package/dist/cdn/foxy-filter-attribute-card.js +1 -1
  48. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  49. package/dist/cdn/foxy-form-dialog.js +1 -1
  50. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  51. package/dist/cdn/foxy-gift-card-card.js +1 -1
  52. package/dist/cdn/foxy-gift-card-code-card.js +1 -1
  53. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  54. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  55. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  56. package/dist/cdn/foxy-gift-card-form.js +1 -1
  57. package/dist/cdn/foxy-i18n-editor.js +1 -1
  58. package/dist/cdn/foxy-i18n.js +1 -1
  59. package/dist/cdn/foxy-integration-card.js +1 -1
  60. package/dist/cdn/foxy-integration-form.js +1 -1
  61. package/dist/cdn/foxy-item-card.js +1 -1
  62. package/dist/cdn/foxy-item-category-card.js +1 -1
  63. package/dist/cdn/foxy-item-category-form.js +1 -1
  64. package/dist/cdn/foxy-item-form.js +1 -1
  65. package/dist/cdn/foxy-item-option-card.js +1 -1
  66. package/dist/cdn/foxy-item-option-form.js +1 -1
  67. package/dist/cdn/foxy-items-form.js +1 -1
  68. package/dist/cdn/foxy-native-integration-card.js +1 -1
  69. package/dist/cdn/foxy-native-integration-form.js +1 -1
  70. package/dist/cdn/foxy-nucleon-element.js +1 -1
  71. package/dist/cdn/foxy-pagination.js +1 -1
  72. package/dist/cdn/foxy-passkey-card.js +1 -1
  73. package/dist/cdn/foxy-passkey-form.js +1 -1
  74. package/dist/cdn/foxy-payment-card-embed.js +1 -1
  75. package/dist/cdn/foxy-payment-card.js +1 -1
  76. package/dist/cdn/foxy-payment-method-card.js +1 -1
  77. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  78. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  79. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  80. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  81. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  82. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  83. package/dist/cdn/foxy-payments-api.js +1 -1
  84. package/dist/cdn/foxy-query-builder.js +1 -1
  85. package/dist/cdn/foxy-report-form.js +1 -1
  86. package/dist/cdn/foxy-reports-table.js +1 -1
  87. package/dist/cdn/foxy-shipment-card.js +1 -1
  88. package/dist/cdn/foxy-shipping-container-card.js +1 -1
  89. package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
  90. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  91. package/dist/cdn/foxy-shipping-service-card.js +1 -1
  92. package/dist/cdn/foxy-sign-in-form.js +1 -1
  93. package/dist/cdn/foxy-spinner.js +1 -1
  94. package/dist/cdn/foxy-store-card.js +1 -1
  95. package/dist/cdn/foxy-store-form.js +1 -1
  96. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  97. package/dist/cdn/foxy-subscription-card.js +1 -1
  98. package/dist/cdn/foxy-subscription-form.js +1 -1
  99. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  100. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  101. package/dist/cdn/foxy-swipe-actions.js +1 -1
  102. package/dist/cdn/foxy-table.js +1 -1
  103. package/dist/cdn/foxy-tax-card.js +1 -1
  104. package/dist/cdn/foxy-tax-form.js +1 -1
  105. package/dist/cdn/foxy-template-config-form.js +1 -1
  106. package/dist/cdn/foxy-template-form.js +1 -1
  107. package/dist/cdn/foxy-template-set-card.js +1 -1
  108. package/dist/cdn/foxy-template-set-form.js +1 -1
  109. package/dist/cdn/foxy-transaction-card.js +1 -1
  110. package/dist/cdn/foxy-transaction.js +1 -1
  111. package/dist/cdn/foxy-transactions-table.js +7 -7
  112. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  113. package/dist/cdn/foxy-user-card.js +1 -1
  114. package/dist/cdn/foxy-user-form.js +1 -1
  115. package/dist/cdn/foxy-user-invitation-card.js +1 -1
  116. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  117. package/dist/cdn/foxy-users-table.js +1 -1
  118. package/dist/cdn/foxy-webhook-card.js +1 -1
  119. package/dist/cdn/foxy-webhook-form.js +1 -1
  120. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  121. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  122. package/dist/cdn/{shared-2f02918d.js → shared-059d1e79.js} +1 -1
  123. package/dist/cdn/{shared-53caa399.js → shared-0e1d094b.js} +1 -1
  124. package/dist/cdn/{shared-018166d0.js → shared-0e59bad9.js} +1 -1
  125. package/dist/cdn/{shared-b16829cd.js → shared-120413cd.js} +1 -1
  126. package/dist/cdn/{shared-0ae33cf9.js → shared-139024d1.js} +1 -1
  127. package/dist/cdn/{shared-257389e5.js → shared-19ebb715.js} +5 -5
  128. package/dist/cdn/{shared-fc6bcfc5.js → shared-21254863.js} +1 -1
  129. package/dist/cdn/{shared-c5cb7e8a.js → shared-2256b8b1.js} +1 -1
  130. package/dist/cdn/{shared-cf0ca582.js → shared-247297ce.js} +1 -1
  131. package/dist/cdn/{shared-57a98543.js → shared-2565fed8.js} +1 -1
  132. package/dist/cdn/{shared-297e8531.js → shared-2676836d.js} +1 -1
  133. package/dist/cdn/{shared-504f3c65.js → shared-2868b35f.js} +1 -1
  134. package/dist/cdn/{shared-ebc72d69.js → shared-2b25aedd.js} +1 -1
  135. package/dist/cdn/{shared-80688cd4.js → shared-2ca4d459.js} +1 -1
  136. package/dist/cdn/{shared-066fb69f.js → shared-2eebd7bc.js} +1 -1
  137. package/dist/cdn/{shared-5d308dd7.js → shared-3023dfb2.js} +3 -3
  138. package/dist/cdn/shared-303cf36c.js +1 -0
  139. package/dist/cdn/{shared-525c1936.js → shared-3149ab8d.js} +1 -1
  140. package/dist/cdn/{shared-bb3c9e23.js → shared-33ed0fe7.js} +1 -1
  141. package/dist/cdn/{shared-68fdcf24.js → shared-349a42e1.js} +1 -1
  142. package/dist/cdn/{shared-112e521b.js → shared-35a2aabc.js} +1 -1
  143. package/dist/cdn/{shared-d8bffb38.js → shared-37bdd118.js} +1 -1
  144. package/dist/cdn/{shared-c5326ab8.js → shared-37c52c4c.js} +1 -1
  145. package/dist/cdn/{shared-32440b17.js → shared-37dc0b85.js} +1 -1
  146. package/dist/cdn/{shared-c7740aa2.js → shared-3b1fc10b.js} +1 -1
  147. package/dist/cdn/{shared-ce055dce.js → shared-40bed8c1.js} +1 -1
  148. package/dist/cdn/shared-433b15f9.js +1 -0
  149. package/dist/cdn/{shared-96886940.js → shared-481eb635.js} +1 -1
  150. package/dist/cdn/{shared-eadddff6.js → shared-4bcb2368.js} +1 -1
  151. package/dist/cdn/{shared-c532d615.js → shared-4fdc63d9.js} +1 -1
  152. package/dist/cdn/{shared-0e2a0b21.js → shared-50f2497c.js} +1 -1
  153. package/dist/cdn/{shared-51c4a6dd.js → shared-5212ef4f.js} +1 -1
  154. package/dist/cdn/{shared-9803aa7c.js → shared-53e42a77.js} +1 -1
  155. package/dist/cdn/shared-53e476fd.js +1 -0
  156. package/dist/cdn/{shared-51fd39fa.js → shared-544b7d4b.js} +1 -1
  157. package/dist/cdn/{shared-eb7bf7ba.js → shared-56271b15.js} +1 -1
  158. package/dist/cdn/{shared-238d397f.js → shared-5741ba29.js} +1 -1
  159. package/dist/cdn/{shared-4c4b87c2.js → shared-59d9d6ca.js} +1 -1
  160. package/dist/cdn/{shared-87b5a6aa.js → shared-5a9e9e89.js} +1 -1
  161. package/dist/cdn/shared-5fd5805c.js +15 -0
  162. package/dist/cdn/{shared-2cb3cb3a.js → shared-602ed877.js} +1 -1
  163. package/dist/cdn/{shared-b1fa0b61.js → shared-61e50856.js} +1 -1
  164. package/dist/cdn/{shared-a585bfd3.js → shared-639dbd3f.js} +1 -1
  165. package/dist/cdn/{shared-8438d4ca.js → shared-63c32024.js} +1 -1
  166. package/dist/cdn/{shared-44fd89ce.js → shared-64d48bc6.js} +1 -1
  167. package/dist/cdn/{shared-8af5a4f2.js → shared-6b06d5c1.js} +1 -1
  168. package/dist/cdn/{shared-ec5b614e.js → shared-6cb26d12.js} +1 -1
  169. package/dist/cdn/{shared-1c4ddc9b.js → shared-6fa216e7.js} +1 -1
  170. package/dist/cdn/{shared-573d6e21.js → shared-7439665e.js} +1 -1
  171. package/dist/cdn/{shared-70487b4c.js → shared-751c9f1e.js} +1 -1
  172. package/dist/cdn/{shared-01f85a69.js → shared-7f68743e.js} +1 -1
  173. package/dist/cdn/{shared-d3a5cb85.js → shared-831f5042.js} +1 -1
  174. package/dist/cdn/{shared-b0d76785.js → shared-84ada96e.js} +1 -1
  175. package/dist/cdn/{shared-9fcd36e5.js → shared-8d92dd6e.js} +1 -1
  176. package/dist/cdn/{shared-6de0e9f3.js → shared-900fd54f.js} +1 -1
  177. package/dist/cdn/{shared-e77d8d01.js → shared-927f1a51.js} +1 -1
  178. package/dist/cdn/{shared-da393323.js → shared-939f50c2.js} +1 -1
  179. package/dist/cdn/{shared-8b838d83.js → shared-9c82e27f.js} +2 -2
  180. package/dist/cdn/{shared-95a7dab8.js → shared-a4d773a3.js} +1 -1
  181. package/dist/cdn/{shared-80a7903f.js → shared-a5bd0da6.js} +1 -1
  182. package/dist/cdn/{shared-84761b5b.js → shared-a81a1cc3.js} +1 -1
  183. package/dist/cdn/shared-aa54bc96.js +29 -0
  184. package/dist/cdn/{shared-363dce45.js → shared-acdf3166.js} +1 -1
  185. package/dist/cdn/{shared-7889f2f2.js → shared-afa402dc.js} +1 -1
  186. package/dist/cdn/{shared-dc73b9a5.js → shared-ba5c42c7.js} +1 -1
  187. package/dist/cdn/{shared-31d8e958.js → shared-bf7baab5.js} +1 -1
  188. package/dist/cdn/{shared-b77e1a8a.js → shared-c5972323.js} +1 -1
  189. package/dist/cdn/{shared-d973155b.js → shared-cdb5ad48.js} +1 -1
  190. package/dist/cdn/{shared-2bf89a21.js → shared-cf613436.js} +1 -1
  191. package/dist/cdn/{shared-22ba9566.js → shared-d0aed1c1.js} +1 -1
  192. package/dist/cdn/{shared-3713f047.js → shared-d4e7383e.js} +1 -1
  193. package/dist/cdn/shared-d9393c31.js +1 -0
  194. package/dist/cdn/{shared-9f97643d.js → shared-d9f38239.js} +1 -1
  195. package/dist/cdn/{shared-ffc84c84.js → shared-db92bb31.js} +1 -1
  196. package/dist/cdn/{shared-27e2e59a.js → shared-e14930ce.js} +1 -1
  197. package/dist/cdn/{shared-28b0e29a.js → shared-ebd077b5.js} +1 -1
  198. package/dist/cdn/{shared-d1cb97c6.js → shared-eeb2bd18.js} +1 -1
  199. package/dist/cdn/{shared-b04e9753.js → shared-f0a38941.js} +1 -1
  200. package/dist/cdn/translations/experimental-add-to-cart-builder/en.json +447 -433
  201. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -1
  202. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +3 -3
  203. package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
  204. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +1 -0
  205. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
  206. package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.d.ts +6 -0
  207. package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js +209 -125
  208. package/dist/elements/public/ExperimentalAddToCartBuilder/ExperimentalAddToCartBuilder.js.map +1 -1
  209. package/dist/elements/public/ExperimentalAddToCartBuilder/index.d.ts +2 -0
  210. package/dist/elements/public/ExperimentalAddToCartBuilder/index.js +2 -0
  211. package/dist/elements/public/ExperimentalAddToCartBuilder/index.js.map +1 -1
  212. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/InternalExperimentalAddToCartBuilderCustomOptionCard.js +2 -2
  213. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/InternalExperimentalAddToCartBuilderCustomOptionCard.js.map +1 -1
  214. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/types.d.ts +1 -1
  215. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionCard/types.js.map +1 -1
  216. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.d.ts +2 -1
  217. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.js +50 -49
  218. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/InternalExperimentalAddToCartBuilderCustomOptionForm.js.map +1 -1
  219. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/types.d.ts +1 -1
  220. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderCustomOptionForm/types.js.map +1 -1
  221. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.d.ts +4 -0
  222. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js +109 -91
  223. package/dist/elements/public/ExperimentalAddToCartBuilder/internal/InternalExperimentalAddToCartBuilderItemControl/InternalExperimentalAddToCartBuilderItemControl.js.map +1 -1
  224. package/dist/elements/public/ExperimentalAddToCartBuilder/types.d.ts +30 -27
  225. package/dist/elements/public/ExperimentalAddToCartBuilder/types.js.map +1 -1
  226. package/dist/mixins/themeable.js +20 -0
  227. package/dist/mixins/themeable.js.map +1 -1
  228. package/package.json +4 -3
  229. package/dist/cdn/shared-19cd0786.js +0 -1
  230. package/dist/cdn/shared-5e0b71a2.js +0 -29
  231. package/dist/cdn/shared-99940888.js +0 -1
  232. package/dist/cdn/shared-a0c6a159.js +0 -15
  233. package/dist/cdn/shared-a7617e76.js +0 -1
  234. package/dist/cdn/shared-ab26c69f.js +0 -1
@@ -1,14 +1,19 @@
1
1
  import { TranslatableMixin } from "../../../mixins/translatable.js";
2
2
  import { ResponsiveMixin } from "../../../mixins/responsive.js";
3
+ import { BooleanSelector } from '@foxy.io/sdk/core';
3
4
  import { decode, encode } from 'html-entities';
4
5
  import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
5
6
  import { previewCSS } from './preview.css';
7
+ import { unsafeHTML } from 'lit-html/directives/unsafe-html';
6
8
  import { html, svg } from 'lit-element';
7
9
  import { ifDefined } from 'lit-html/directives/if-defined';
8
10
  import { classMap } from "../../../utils/class-map.js";
9
11
  import debounce from 'lodash-es/debounce';
12
+ import hljsxml from 'highlight.js/lib/languages/xml.js';
13
+ import hljs from 'highlight.js/lib/core.js';
10
14
  const NS = 'experimental-add-to-cart-builder';
11
15
  const Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));
16
+ hljs.registerLanguage('xml', hljsxml);
12
17
  /**
13
18
  * WARNING: this element is marked as experimental and is subject to change in future releases.
14
19
  * We will not be maintaining backwards compatibility for elements in the experimental namespace.
@@ -30,6 +35,16 @@ export class ExperimentalAddToCartBuilder extends Base {
30
35
  /** URL of the store this add-to-cart code is created for. */
31
36
  this.store = null;
32
37
  this.__signingSeparator = `--${Date.now()}${(Math.random() * 100000).toFixed(0)}--`;
38
+ this.__emptyOptions = [
39
+ { label: 'option_false', value: 'false' },
40
+ { label: 'option_true', value: 'true' },
41
+ { label: 'option_reset', value: 'reset' },
42
+ ];
43
+ this.__cartOptions = [
44
+ { label: 'option_add', value: 'add' },
45
+ { label: 'option_checkout', value: 'checkout' },
46
+ { label: 'option_redirect', value: 'redirect' },
47
+ ];
33
48
  this.__signAsync = debounce(async (html, encodeHelper) => {
34
49
  if (html === this.__previousUnsignedCode && this.__previousSignedCode)
35
50
  return;
@@ -77,21 +92,26 @@ export class ExperimentalAddToCartBuilder extends Base {
77
92
  __openState: { attribute: false },
78
93
  };
79
94
  }
95
+ get hiddenSelector() {
96
+ const alwaysMatch = [super.hiddenSelector.toString()];
97
+ alwaysMatch.unshift('header:copy-id', 'header:copy-json', 'undo');
98
+ return new BooleanSelector(alwaysMatch.join(' ').trim());
99
+ }
80
100
  renderBody() {
81
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
101
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
82
102
  const addToCartCode = this.__getAddToCartCode();
83
103
  const storeUrl = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:store'].href) !== null && _b !== void 0 ? _b : this.store) !== null && _c !== void 0 ? _c : void 0;
84
104
  const store = (_d = this.__storeLoader) === null || _d === void 0 ? void 0 : _d.data;
85
105
  return html `
86
106
  <div class="grid gap-m items-start sm-grid-cols-2 md-grid-cols-3 h-full overflow-auto">
87
- <div class="space-y-m">
107
+ <foxy-internal-summary-control layout="section" class="space-y-s" infer="items">
88
108
  ${(_e = this.form.items) === null || _e === void 0 ? void 0 : _e.map((product, index) => {
89
109
  var _a;
90
110
  return html `
91
111
  <foxy-internal-summary-control
92
112
  layout="details"
93
113
  label=${ifDefined(product.name.trim() || void 0)}
94
- infer="item"
114
+ infer="item-group"
95
115
  ?open=${ifDefined(this.__openState[index])}
96
116
  @toggle=${(evt) => {
97
117
  const details = evt.currentTarget;
@@ -104,7 +124,8 @@ export class ExperimentalAddToCartBuilder extends Base {
104
124
  currency-code=${ifDefined((_a = this.__resolvedCurrencyCode) !== null && _a !== void 0 ? _a : void 0)}
105
125
  store=${ifDefined(storeUrl)}
106
126
  index=${index}
107
- infer=""
127
+ infer="item"
128
+ .defaultItemCategory=${this.__defaultItemCategory}
108
129
  @remove=${() => {
109
130
  var _a;
110
131
  const newProducts = (_a = this.form.items) === null || _a === void 0 ? void 0 : _a.filter((_, i) => i !== index);
@@ -119,10 +140,11 @@ export class ExperimentalAddToCartBuilder extends Base {
119
140
 
120
141
  <vaadin-button
121
142
  class="w-full"
143
+ theme="success"
122
144
  ?disabled=${this.disabled}
123
145
  @click=${() => {
124
146
  var _a;
125
- const newItem = { name: '', price: 0, custom_options: [] };
147
+ const newItem = { name: '', price: 0, custom_options: [], sub_frequency: '1m' };
126
148
  const existingItems = (_a = this.form.items) !== null && _a !== void 0 ? _a : [];
127
149
  this.edit({ items: [...existingItems, newItem] });
128
150
  this.__openState = [...new Array(existingItems.length).fill(false), true];
@@ -130,7 +152,7 @@ export class ExperimentalAddToCartBuilder extends Base {
130
152
  >
131
153
  <foxy-i18n infer="add-product" key="caption"></foxy-i18n>
132
154
  </vaadin-button>
133
- </div>
155
+ </foxy-internal-summary-control>
134
156
 
135
157
  <div class="space-y-m md-col-span-2 sticky top-0">
136
158
  ${addToCartCode
@@ -166,7 +188,9 @@ export class ExperimentalAddToCartBuilder extends Base {
166
188
  'blur-sm': this.__signingState !== 'idle',
167
189
  })}
168
190
  >
169
- <code class="whitespace-pre">${addToCartCode.formHTML}</code>
191
+ <code class="whitespace-pre"
192
+ >${unsafeHTML(hljs.highlight(addToCartCode.formHTML, { language: 'xml' }).value)}</code
193
+ >
170
194
  </div>
171
195
 
172
196
  <div
@@ -212,66 +236,71 @@ export class ExperimentalAddToCartBuilder extends Base {
212
236
  </foxy-internal-summary-control>
213
237
 
214
238
  <foxy-internal-summary-control infer="link">
215
- <div
216
- class="flex items-center leading-s min-w-0 relative"
217
- style="gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
218
- >
219
- <foxy-i18n infer="" key="direct_link"></foxy-i18n>
220
-
221
- <a
222
- target="_blank"
223
- style="max-width: 30rem"
224
- href=${addToCartCode.linkHref}
225
- class=${classMap({
226
- 'font-medium truncate ml-auto min-w-0 rounded-s': true,
227
- 'transition-all filter': true,
228
- 'hover-underline': true,
229
- 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
230
- 'blur-sm': this.__signingState !== 'idle',
231
- })}
232
- >
233
- ${addToCartCode.linkHref}
234
- </a>
235
-
236
- <div
237
- style="top: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); right: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
238
- class=${classMap({
239
- 'absolute right-0 bg-base rounded-s transition-opacity': true,
240
- 'opacity-0 pointer-events-none': this.__signingState !== 'busy',
241
- })}
242
- >
243
- <div class="bg-contrast-10 rounded-s">
244
- <foxy-spinner
245
- infer="spinner"
246
- state=${this.__signingState === 'fail' ? 'error' : 'busy'}
247
- class="-mx-xs"
248
- style="transform: scale(0.8)"
239
+ ${addToCartCode.linkHref
240
+ ? html `
241
+ <div
242
+ class="flex items-center leading-s min-w-0 relative"
243
+ style="gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
249
244
  >
250
- </foxy-spinner>
251
- </div>
252
- </div>
253
-
254
- <foxy-copy-to-clipboard
255
- infer="copy-to-clipboard"
256
- text=${addToCartCode.linkHref}
257
- class=${classMap({
258
- 'flex-shrink-0 text-m transition-opacity': true,
259
- 'opacity-0 pointer-events-none': this.__signingState === 'busy',
260
- })}
261
- >
262
- </foxy-copy-to-clipboard>
263
- </div>
245
+ <foxy-i18n infer="" key="direct_link"></foxy-i18n>
246
+ <a
247
+ target="_blank"
248
+ style="max-width: 30rem"
249
+ href=${addToCartCode.linkHref}
250
+ class=${classMap({
251
+ 'font-medium truncate ml-auto min-w-0 rounded-s': true,
252
+ 'transition-all filter': true,
253
+ 'hover-underline': true,
254
+ 'focus-outline-none focus-ring-2 focus-ring-primary-50': true,
255
+ 'blur-sm': this.__signingState !== 'idle',
256
+ })}
257
+ >
258
+ ${addToCartCode.linkHref}
259
+ </a>
260
+ <div
261
+ style="top: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); right: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
262
+ class=${classMap({
263
+ 'absolute right-0 bg-base rounded-s transition-opacity': true,
264
+ 'opacity-0 pointer-events-none': this.__signingState !== 'busy',
265
+ })}
266
+ >
267
+ <div class="bg-contrast-10 rounded-s">
268
+ <foxy-spinner
269
+ infer="spinner"
270
+ state=${this.__signingState === 'fail' ? 'error' : 'busy'}
271
+ class="-mx-xs"
272
+ style="transform: scale(0.8)"
273
+ >
274
+ </foxy-spinner>
275
+ </div>
276
+ </div>
277
+ <foxy-copy-to-clipboard
278
+ infer="copy-to-clipboard"
279
+ text=${addToCartCode.linkHref}
280
+ class=${classMap({
281
+ 'flex-shrink-0 text-m transition-opacity': true,
282
+ 'opacity-0 pointer-events-none': this.__signingState === 'busy',
283
+ })}
284
+ >
285
+ </foxy-copy-to-clipboard>
286
+ </div>
287
+ `
288
+ : html `
289
+ <p class="text-disabled">
290
+ <foxy-i18n infer="" key="unavailable"></foxy-i18n>
291
+ </p>
292
+ `}
264
293
  </foxy-internal-summary-control>
265
294
  `
266
295
  : html `
267
296
  <foxy-internal-summary-control infer="preview">
268
297
  <div class="flex items-center justify-center p-xl">
269
- <foxy-spinner infer="unavailable" state="empty"></foxy-spinner>
298
+ <foxy-spinner infer="unavailable"></foxy-spinner>
270
299
  </div>
271
300
  </foxy-internal-summary-control>
272
301
  `}
273
302
 
274
- <foxy-internal-summary-control infer="cart-settings-group">
303
+ <foxy-internal-summary-control infer="cart-settings">
275
304
  <foxy-internal-resource-picker-control
276
305
  layout="summary-item"
277
306
  first=${ifDefined((_g = (_f = this.__storeLoader) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g._links['fx:template_sets'].href)}
@@ -283,21 +312,26 @@ export class ExperimentalAddToCartBuilder extends Base {
283
312
  <foxy-internal-select-control
284
313
  layout="summary-item"
285
314
  infer="empty"
286
- .options=${[
287
- { label: 'option_false', value: 'false' },
288
- { label: 'option_true', value: 'true' },
289
- { label: 'option_reset', value: 'reset' },
290
- ]}
315
+ .options=${this.__emptyOptions}
291
316
  >
292
317
  </foxy-internal-select-control>
293
318
 
294
- <foxy-internal-switch-control
295
- false-alias="add"
296
- true-alias="checkout"
319
+ <foxy-internal-select-control
297
320
  layout="summary-item"
298
321
  infer="cart"
322
+ .options=${this.__cartOptions}
299
323
  >
300
- </foxy-internal-switch-control>
324
+ </foxy-internal-select-control>
325
+
326
+ ${this.form.cart === 'redirect'
327
+ ? html `
328
+ <foxy-internal-text-control layout="summary-item" infer="redirect">
329
+ </foxy-internal-text-control>
330
+ `
331
+ : ''}
332
+
333
+ <foxy-internal-text-control layout="summary-item" infer="coupon">
334
+ </foxy-internal-text-control>
301
335
  </foxy-internal-summary-control>
302
336
  </div>
303
337
  </div>
@@ -314,7 +348,16 @@ export class ExperimentalAddToCartBuilder extends Base {
314
348
  <foxy-nucleon
315
349
  class="hidden"
316
350
  infer=""
317
- href=${ifDefined(this.localeCodes)}
351
+ href=${ifDefined(this.__defaultItemCategoryHref)}
352
+ id="defaultItemCategoryLoader"
353
+ @update=${() => this.requestUpdate()}
354
+ >
355
+ </foxy-nucleon>
356
+
357
+ <foxy-nucleon
358
+ class="hidden"
359
+ infer=""
360
+ href=${ifDefined((_h = this.localeCodes) !== null && _h !== void 0 ? _h : void 0)}
318
361
  id="localeCodesHelperLoader"
319
362
  @update=${() => this.requestUpdate()}
320
363
  >
@@ -323,7 +366,7 @@ export class ExperimentalAddToCartBuilder extends Base {
323
366
  <foxy-nucleon
324
367
  class="hidden"
325
368
  infer=""
326
- href=${ifDefined((_h = this.form.template_set_uri) !== null && _h !== void 0 ? _h : void 0)}
369
+ href=${ifDefined((_j = this.form.template_set_uri) !== null && _j !== void 0 ? _j : void 0)}
327
370
  id="templateSetLoader"
328
371
  @update=${() => this.requestUpdate()}
329
372
  >
@@ -332,29 +375,31 @@ export class ExperimentalAddToCartBuilder extends Base {
332
375
  <foxy-nucleon
333
376
  class="hidden"
334
377
  infer=""
335
- href=${ifDefined((_l = (_k = (_j = this.data) === null || _j === void 0 ? void 0 : _j._links['fx:store'].href) !== null && _k !== void 0 ? _k : this.store) !== null && _l !== void 0 ? _l : void 0)}
378
+ href=${ifDefined((_m = (_l = (_k = this.data) === null || _k === void 0 ? void 0 : _k._links['fx:store'].href) !== null && _l !== void 0 ? _l : this.store) !== null && _m !== void 0 ? _m : void 0)}
336
379
  id="storeLoaderId"
337
380
  @update=${() => this.requestUpdate()}
338
381
  >
339
382
  </foxy-nucleon>
340
383
 
341
- ${(_m = this.form.items) === null || _m === void 0 ? void 0 : _m.map((product, index) => {
384
+ ${(_o = this.form.items) === null || _o === void 0 ? void 0 : _o.map((product, index) => {
385
+ var _a;
342
386
  return html `
343
387
  <foxy-nucleon
344
388
  class="hidden"
345
389
  infer=""
346
- href=${ifDefined(product.item_category_uri)}
390
+ href=${ifDefined((_a = product.item_category_uri) !== null && _a !== void 0 ? _a : void 0)}
347
391
  id="itemCategoryLoaderProduct${index}"
348
392
  @update=${() => this.requestUpdate()}
349
393
  >
350
394
  </foxy-nucleon>
351
395
 
352
396
  ${product.custom_options.map((option, i) => {
397
+ var _a;
353
398
  return html `
354
399
  <foxy-nucleon
355
400
  class="hidden"
356
401
  infer=""
357
- href=${ifDefined(option.item_category_uri)}
402
+ href=${ifDefined((_a = option.item_category_uri) !== null && _a !== void 0 ? _a : void 0)}
358
403
  id="itemCategoryLoaderProduct${index}Option${i}"
359
404
  @update=${() => this.requestUpdate()}
360
405
  >
@@ -369,7 +414,7 @@ export class ExperimentalAddToCartBuilder extends Base {
369
414
  var _a, _b;
370
415
  super.updated(changes);
371
416
  if (this.in('idle') && !((_a = this.form.items) === null || _a === void 0 ? void 0 : _a.length)) {
372
- this.edit({ items: [{ name: '', price: 0, custom_options: [] }] });
417
+ this.edit({ items: [{ name: '', price: 0, sub_frequency: '1m', custom_options: [] }] });
373
418
  this.__openState = [true];
374
419
  }
375
420
  if (((_b = this.form.items) === null || _b === void 0 ? void 0 : _b.length) && !this.__openState.length) {
@@ -377,7 +422,7 @@ export class ExperimentalAddToCartBuilder extends Base {
377
422
  }
378
423
  }
379
424
  submit() {
380
- // Do nothing – in this version of the element, this form is not meant to be submitted.
425
+ // Do nothing – this form is not meant to be submitted.
381
426
  }
382
427
  get __defaultTemplateSetHref() {
383
428
  var _a, _b, _c;
@@ -390,6 +435,17 @@ export class ExperimentalAddToCartBuilder extends Base {
390
435
  return undefined;
391
436
  }
392
437
  }
438
+ get __defaultItemCategoryHref() {
439
+ var _a, _b, _c;
440
+ try {
441
+ const url = new URL((_c = (_b = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:item_categories'].href) !== null && _c !== void 0 ? _c : '');
442
+ url.searchParams.set('code', 'DEFAULT');
443
+ return url.toString();
444
+ }
445
+ catch (_d) {
446
+ return undefined;
447
+ }
448
+ }
393
449
  get __resolvedCurrencyCode() {
394
450
  var _a, _b, _c, _d;
395
451
  const localeCodesLoader = this.renderRoot.querySelector('#localeCodesHelperLoader');
@@ -403,6 +459,10 @@ export class ExperimentalAddToCartBuilder extends Base {
403
459
  const $ = (s) => this.renderRoot.querySelector(s);
404
460
  return ((_b = (_a = $('#templateSetLoader')) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : (_d = (_c = $('#defaultTemplateSetLoader')) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d._embedded['fx:template_sets'][0]);
405
461
  }
462
+ get __defaultItemCategory() {
463
+ var _a, _b;
464
+ return (_b = (_a = this.renderRoot.querySelector('#defaultItemCategoryLoader')) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._embedded['fx:item_categories'][0];
465
+ }
406
466
  get __resolvedCartUrl() {
407
467
  var _a;
408
468
  const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
@@ -425,13 +485,14 @@ export class ExperimentalAddToCartBuilder extends Base {
425
485
  return this.renderRoot.querySelector(selector);
426
486
  }
427
487
  __getAddToCartFormHTML() {
428
- var _a, _b, _c, _d, _e, _f, _g;
488
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
429
489
  const currencyCode = this.__resolvedCurrencyCode;
430
490
  const templateSet = this.__resolvedTemplateSet;
431
491
  const cartUrl = this.__resolvedCartUrl;
432
492
  const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
433
493
  if (!this.defaultDomain || !templateSet || !store || !currencyCode || !cartUrl)
434
494
  return '';
495
+ let hasAtLeastOneFieldset = false;
435
496
  let output = `<form action="${encode(cartUrl)}" method="post" target="_blank">`;
436
497
  let level = 1;
437
498
  const newline = () => `\n${' '.repeat(level * 2)}`;
@@ -442,43 +503,50 @@ export class ExperimentalAddToCartBuilder extends Base {
442
503
  };
443
504
  if (templateSet.code !== 'DEFAULT')
444
505
  addHiddenInput('template_set', templateSet.code);
445
- if (this.form.empty)
506
+ if (this.form.empty && this.form.empty !== 'false')
446
507
  addHiddenInput('empty', this.form.empty);
447
508
  if (this.form.cart === 'checkout')
448
509
  addHiddenInput('cart', 'checkout');
510
+ if (this.form.redirect)
511
+ addHiddenInput('redirect', this.form.redirect);
512
+ if (this.form.coupon)
513
+ addHiddenInput('coupon', this.form.coupon);
449
514
  const items = (_b = this.form.items) !== null && _b !== void 0 ? _b : [];
450
515
  const hasMoreThanOneProduct = items.length > 1;
451
516
  for (let productIndex = 0; productIndex < items.length; ++productIndex) {
452
517
  const itemCategoryLoader = this.__getItemCategoryLoader(productIndex);
453
518
  const itemCategory = itemCategoryLoader === null || itemCategoryLoader === void 0 ? void 0 : itemCategoryLoader.data;
454
519
  const product = items[productIndex];
455
- if (!product.name || !product.price)
456
- return '';
457
520
  if (product.item_category_uri && !itemCategory)
458
521
  return '';
459
- const hasConfigurableQuantity = product.quantity_min !== product.quantity_max;
460
- const hasConfigurablePrice = product.price_configurable;
461
- const hasConfigurableOptions = product.custom_options.some((v, i, a) => v.value_configurable || a.findIndex(vv => vv.name === v.name) !== i);
462
- const useFieldset = hasMoreThanOneProduct &&
463
- (hasConfigurablePrice || hasConfigurableQuantity || hasConfigurableOptions);
464
- if (useFieldset) {
522
+ const resolvedMinQty = Math.max(1, (_c = product.quantity_min) !== null && _c !== void 0 ? _c : 1);
523
+ const resolvedMaxQty = Math.max(resolvedMinQty, (_d = product.quantity_max) !== null && _d !== void 0 ? _d : Infinity);
524
+ const varyQty = resolvedMinQty !== resolvedMaxQty &&
525
+ product.expires_format !== 'minutes' &&
526
+ !product.hide_quantity;
527
+ const varyPrice = product.price_configurable;
528
+ const varyptions = product.custom_options.some((v, i, a) => v.value_configurable || a.findIndex(vv => vv.name === v.name) !== i);
529
+ const resolvedName = product.name.trim() || this.t('items.item-group.item.basics-group.name.placeholder');
530
+ const needsFieldset = hasAtLeastOneFieldset || (hasMoreThanOneProduct && (varyPrice || varyQty || varyptions));
531
+ if (needsFieldset) {
532
+ hasAtLeastOneFieldset = true;
465
533
  output += `${newline()}<fieldset>`;
466
534
  level++;
467
- output += `${newline()}<legend>${encode(product.name)}</legend>`;
535
+ output += `${newline()}<legend>${encode(resolvedName)}</legend>`;
468
536
  }
469
537
  const prefix = productIndex === 0 ? '' : `${productIndex + 1}:`;
470
- addHiddenInput(`${prefix}name`, product.name);
538
+ addHiddenInput(`${prefix}name`, resolvedName);
471
539
  const price = `${product.price}${currencyCode}`;
472
540
  if (product.price_configurable) {
473
- const encodedPrice = encode(price);
541
+ const encodedNoCurrencyPrice = encode(product.price.toFixed(2));
474
542
  output += `${newline()}<label>`;
475
543
  level++;
476
544
  output += `${newline()}<span>${encode(this.t('preview.price_label'))}</span>`;
477
545
  if (store.use_cart_validation) {
478
- output += `${newline()}<input required name="${prefix}price" value="--OPEN--" data-replace="${encodedPrice}">`;
546
+ output += `${newline()}<input required name="${prefix}price" value="--OPEN--" data-replace="${encodedNoCurrencyPrice}">`;
479
547
  }
480
548
  else {
481
- output += `${newline()}<input required name="${prefix}price" value="${encodedPrice}">`;
549
+ output += `${newline()}<input required name="${prefix}price" value="${encodedNoCurrencyPrice}">`;
482
550
  }
483
551
  level--;
484
552
  output += `${newline()}</label>`;
@@ -522,7 +590,7 @@ export class ExperimentalAddToCartBuilder extends Base {
522
590
  addHiddenInput(`${prefix}sub_enddate`, `${year}${month}${day}`);
523
591
  }
524
592
  else {
525
- addHiddenInput(`${prefix}sub_enddate`, product.sub_enddate);
593
+ addHiddenInput(`${prefix}sub_enddate`, String(product.sub_enddate));
526
594
  }
527
595
  }
528
596
  }
@@ -532,41 +600,38 @@ export class ExperimentalAddToCartBuilder extends Base {
532
600
  }
533
601
  if (product.expires_value) {
534
602
  if (product.expires_format === 'timestamp') {
535
- addHiddenInput(`${prefix}expires`, (product.expires_value / 1000).toFixed(0));
603
+ addHiddenInput(`${prefix}expires`, product.expires_value.toFixed(0));
536
604
  }
537
605
  else {
538
606
  addHiddenInput(`${prefix}expires`, product.expires_value.toFixed(0));
539
607
  }
540
608
  }
541
- if (product.quantity_min || product.quantity_max) {
609
+ if (varyQty) {
542
610
  output += `${newline()}<label>`;
543
611
  level++;
544
612
  output += `${newline()}<span>${encode(this.t('preview.quantity_label'))}</span>`;
545
613
  output += `${newline()}<input type="number" name="${encode(`${prefix}quantity`)}"`;
546
- if (product.expires_format !== 'minutes') {
547
- if (product.quantity_min)
548
- output += ` min="${encode(String(product.quantity_min))}"`;
549
- if (product.quantity_max)
550
- output += ` max="${encode(String(product.quantity_max))}"`;
551
- }
614
+ output += ` min="${encode(String(resolvedMinQty))}"`;
615
+ if (resolvedMaxQty !== Infinity)
616
+ output += ` max="${encode(String(resolvedMaxQty))}"`;
552
617
  if (store.use_cart_validation) {
553
- output += ` value="--OPEN--" data-replace="${encode(String((_c = product.quantity) !== null && _c !== void 0 ? _c : 1))}">`;
618
+ output += ` value="--OPEN--" data-replace="${encode(String((_e = product.quantity) !== null && _e !== void 0 ? _e : 1))}">`;
554
619
  }
555
620
  else {
556
- output += ` value="${encode(String((_d = product.quantity) !== null && _d !== void 0 ? _d : 1))}">`;
621
+ output += ` value="${encode(String((_f = product.quantity) !== null && _f !== void 0 ? _f : 1))}">`;
557
622
  }
558
623
  level--;
559
624
  output += `${newline()}</label>`;
560
625
  }
561
- else if (((_e = product.quantity) !== null && _e !== void 0 ? _e : 1) > 1) {
562
- addHiddenInput(`${prefix}quantity`, ((_f = product.quantity) !== null && _f !== void 0 ? _f : 1).toString());
626
+ else if (((_g = product.quantity) !== null && _g !== void 0 ? _g : 1) > 1) {
627
+ addHiddenInput(`${prefix}quantity`, ((_h = product.quantity) !== null && _h !== void 0 ? _h : 1).toString());
563
628
  }
564
629
  if (product.expires_format !== 'minutes') {
565
- if (product.quantity_min) {
566
- addHiddenInput(`${prefix}quantity_min`, product.quantity_min.toFixed(0));
630
+ if (resolvedMinQty !== 1) {
631
+ addHiddenInput(`${prefix}quantity_min`, resolvedMinQty.toFixed(0));
567
632
  }
568
- if (product.quantity_max) {
569
- addHiddenInput(`${prefix}quantity_max`, product.quantity_max.toFixed(0));
633
+ if (resolvedMaxQty !== Infinity) {
634
+ addHiddenInput(`${prefix}quantity_max`, resolvedMaxQty.toFixed(0));
570
635
  }
571
636
  }
572
637
  if (product.length)
@@ -600,7 +665,7 @@ export class ExperimentalAddToCartBuilder extends Base {
600
665
  const group = groupedCustomOptions[optionName];
601
666
  if (group.length === 1) {
602
667
  const optionIndex = product.custom_options.indexOf(group[0]);
603
- const itemCategory = (_g = this.__getItemCategoryLoader(productIndex, optionIndex)) === null || _g === void 0 ? void 0 : _g.data;
668
+ const itemCategory = (_j = this.__getItemCategoryLoader(productIndex, optionIndex)) === null || _j === void 0 ? void 0 : _j.data;
604
669
  const modifiers = this.__getOptionModifiers(group[0], itemCategory !== null && itemCategory !== void 0 ? itemCategory : null, currencyCode);
605
670
  const value = `${group[0].value}${modifiers}`;
606
671
  const name = `${prefix}${optionName}`;
@@ -643,19 +708,20 @@ export class ExperimentalAddToCartBuilder extends Base {
643
708
  output += `${newline()}</label>`;
644
709
  }
645
710
  }
646
- if (useFieldset) {
711
+ if (needsFieldset) {
647
712
  level--;
648
713
  output += `${newline()}</fieldset>`;
649
714
  }
650
715
  }
651
- const encodedSubmitCaption = encode(this.t('preview.submit_caption'));
716
+ const submitCaptionSuffix = this.form.cart === 'checkout' ? 'checkout' : 'cart';
717
+ const encodedSubmitCaption = encode(this.t(`preview.submit_caption_${submitCaptionSuffix}`));
652
718
  output += `${newline()}<button type="submit">${encodedSubmitCaption}</button>`;
653
719
  level--;
654
720
  output += `${newline()}</form>`;
655
721
  return output;
656
722
  }
657
723
  __getAddToCartLinkHref() {
658
- var _a, _b, _c, _d, _e, _f;
724
+ var _a, _b, _c, _d, _e, _f, _g, _h;
659
725
  const currencyCode = this.__resolvedCurrencyCode;
660
726
  const templateSet = this.__resolvedTemplateSet;
661
727
  const cartUrl = this.__resolvedCartUrl;
@@ -665,16 +731,26 @@ export class ExperimentalAddToCartBuilder extends Base {
665
731
  const url = new URL(cartUrl);
666
732
  if (templateSet.code !== 'DEFAULT')
667
733
  url.searchParams.set('template_set', templateSet.code);
668
- if (this.form.empty)
669
- url.searchParams.set('empty', this.form.empty);
670
734
  if (this.form.cart === 'checkout')
671
735
  url.searchParams.set('cart', 'checkout');
736
+ if (this.form.redirect)
737
+ url.searchParams.set('redirect', this.form.redirect);
738
+ if (this.form.coupon)
739
+ url.searchParams.set('coupon', this.form.coupon);
740
+ if (this.form.empty && this.form.empty !== 'false') {
741
+ url.searchParams.set('empty', this.form.empty);
742
+ }
672
743
  for (let index = 0; index < ((_c = (_b = this.form.items) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0); ++index) {
673
744
  const product = this.form.items[index];
674
745
  const prefix = index === 0 ? '' : `${index + 1}:`;
675
746
  const itemCategory = (_d = this.__getItemCategoryLoader(index)) === null || _d === void 0 ? void 0 : _d.data;
676
747
  if (product.item_category_uri && !itemCategory)
677
748
  return '';
749
+ if (product.price_configurable)
750
+ return '';
751
+ if (new Set(product.custom_options.map(v => v.name)).size < product.custom_options.length) {
752
+ return '';
753
+ }
678
754
  if (itemCategory && itemCategory.code !== 'DEFAULT') {
679
755
  url.searchParams.set(`${prefix}category`, itemCategory.code);
680
756
  }
@@ -713,7 +789,7 @@ export class ExperimentalAddToCartBuilder extends Base {
713
789
  url.searchParams.set(`${prefix}sub_enddate`, `${year}${month}${day}`);
714
790
  }
715
791
  else {
716
- url.searchParams.set(`${prefix}sub_enddate`, product.sub_enddate);
792
+ url.searchParams.set(`${prefix}sub_enddate`, String(product.sub_enddate));
717
793
  }
718
794
  }
719
795
  }
@@ -723,7 +799,7 @@ export class ExperimentalAddToCartBuilder extends Base {
723
799
  }
724
800
  if (product.expires_value) {
725
801
  if (product.expires_format === 'timestamp') {
726
- url.searchParams.set(`${prefix}expires`, (product.expires_value / 1000).toFixed(0));
802
+ url.searchParams.set(`${prefix}expires`, product.expires_value.toFixed(0));
727
803
  }
728
804
  else {
729
805
  url.searchParams.set(`${prefix}expires`, product.expires_value.toFixed(0));
@@ -748,12 +824,14 @@ export class ExperimentalAddToCartBuilder extends Base {
748
824
  url.searchParams.set(`${prefix}width`, product.width.toFixed(3));
749
825
  if (product.height)
750
826
  url.searchParams.set(`${prefix}height`, product.height.toFixed(3));
751
- product.custom_options.forEach((option, optionIndex) => {
752
- var _a, _b;
753
- const itemCategory = (_a = this.__getItemCategoryLoader(index, optionIndex)) === null || _a === void 0 ? void 0 : _a.data;
827
+ for (let optionIndex = 0; optionIndex < product.custom_options.length; ++optionIndex) {
828
+ const option = product.custom_options[optionIndex];
829
+ if (option.value_configurable)
830
+ return '';
831
+ const itemCategory = (_g = this.__getItemCategoryLoader(index, optionIndex)) === null || _g === void 0 ? void 0 : _g.data;
754
832
  const modifiers = this.__getOptionModifiers(option, itemCategory !== null && itemCategory !== void 0 ? itemCategory : null, currencyCode);
755
- url.searchParams.set(`${prefix}${option.name}`, `${(_b = option.value) !== null && _b !== void 0 ? _b : ''}${modifiers}`);
756
- });
833
+ url.searchParams.set(`${prefix}${option.name}`, `${(_h = option.value) !== null && _h !== void 0 ? _h : ''}${modifiers}`);
834
+ }
757
835
  }
758
836
  return url.toString();
759
837
  }
@@ -764,15 +842,21 @@ export class ExperimentalAddToCartBuilder extends Base {
764
842
  return null;
765
843
  const formHTML = this.__getAddToCartFormHTML();
766
844
  const linkHref = this.__getAddToCartLinkHref();
767
- if (!formHTML || !linkHref)
845
+ if (!formHTML && !linkHref)
768
846
  return null;
769
- const linkHTML = `<a href="${encode(linkHref)}">Add to cart</a>`;
770
- const unsignedCode = `${formHTML}${this.__signingSeparator}${linkHTML}`;
847
+ let unsignedCode;
848
+ if (linkHref) {
849
+ const linkHTML = `<a href="${encode(linkHref)}">Add to cart</a>`;
850
+ unsignedCode = `${formHTML}${this.__signingSeparator}${linkHTML}`;
851
+ }
852
+ else {
853
+ unsignedCode = formHTML;
854
+ }
771
855
  if (unsignedCode === this.__previousUnsignedCode && this.__previousSignedCode) {
772
- const signedCode = this.__previousSignedCode.split(this.__signingSeparator);
856
+ const [formHTML, linkHTML] = this.__previousSignedCode.split(this.__signingSeparator);
773
857
  return {
774
- formHTML: signedCode[0],
775
- linkHref: decode(signedCode[1].substring(9, signedCode[1].length - 17)),
858
+ linkHref: linkHTML ? decode(linkHTML.substring(9, linkHTML.length - 17)) : '',
859
+ formHTML,
776
860
  };
777
861
  }
778
862
  this.__previousUnsignedCode = unsignedCode;