@foxy.io/elements 1.25.0-beta.3 → 1.25.0-beta.5

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 (223) 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-api-browser.js +1 -1
  6. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  8. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  9. package/dist/cdn/foxy-attribute-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-form.js +1 -1
  11. package/dist/cdn/foxy-billing-address-card.js +1 -1
  12. package/dist/cdn/foxy-cancellation-form.js +1 -1
  13. package/dist/cdn/foxy-cart-card.js +1 -1
  14. package/dist/cdn/foxy-cart-form.js +1 -1
  15. package/dist/cdn/foxy-client-card.js +1 -1
  16. package/dist/cdn/foxy-client-form.js +1 -1
  17. package/dist/cdn/foxy-collection-page.js +1 -1
  18. package/dist/cdn/foxy-collection-pages.js +1 -1
  19. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  20. package/dist/cdn/foxy-coupon-card.js +1 -1
  21. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  22. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  23. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  24. package/dist/cdn/foxy-coupon-form.js +1 -1
  25. package/dist/cdn/foxy-custom-field-card.js +1 -1
  26. package/dist/cdn/foxy-custom-field-form.js +1 -1
  27. package/dist/cdn/foxy-customer-card.js +1 -1
  28. package/dist/cdn/foxy-customer-form.js +1 -1
  29. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  30. package/dist/cdn/foxy-customer-portal.js +3 -3
  31. package/dist/cdn/foxy-customer.js +1 -1
  32. package/dist/cdn/foxy-customers-table.js +1 -1
  33. package/dist/cdn/foxy-discount-builder.js +1 -1
  34. package/dist/cdn/foxy-discount-card.js +1 -1
  35. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  36. package/dist/cdn/foxy-donation.js +1 -1
  37. package/dist/cdn/foxy-downloadable-card.js +1 -1
  38. package/dist/cdn/foxy-downloadable-form.js +1 -1
  39. package/dist/cdn/foxy-email-template-card.js +1 -1
  40. package/dist/cdn/foxy-email-template-form.js +1 -1
  41. package/dist/cdn/foxy-error-entry-card.js +1 -1
  42. package/dist/cdn/foxy-filter-attribute-card.js +1 -1
  43. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  44. package/dist/cdn/foxy-form-dialog.js +1 -1
  45. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  46. package/dist/cdn/foxy-gift-card-card.js +1 -1
  47. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  48. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  49. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  50. package/dist/cdn/foxy-gift-card-form.js +1 -1
  51. package/dist/cdn/foxy-i18n-editor.js +2 -2
  52. package/dist/cdn/foxy-i18n.js +1 -1
  53. package/dist/cdn/foxy-integration-card.js +1 -1
  54. package/dist/cdn/foxy-integration-form.js +1 -1
  55. package/dist/cdn/foxy-item-card.js +1 -1
  56. package/dist/cdn/foxy-item-category-card.js +1 -1
  57. package/dist/cdn/foxy-item-category-form.js +1 -1
  58. package/dist/cdn/foxy-item-form.js +4 -4
  59. package/dist/cdn/foxy-item-option-card.js +1 -1
  60. package/dist/cdn/foxy-item-option-form.js +1 -1
  61. package/dist/cdn/foxy-items-form.js +1 -1
  62. package/dist/cdn/foxy-native-integration-card.js +1 -1
  63. package/dist/cdn/foxy-native-integration-form.js +1 -1
  64. package/dist/cdn/foxy-pagination.js +1 -1
  65. package/dist/cdn/foxy-passkey-card.js +1 -1
  66. package/dist/cdn/foxy-passkey-form.js +1 -1
  67. package/dist/cdn/foxy-payment-card.js +1 -1
  68. package/dist/cdn/foxy-payment-method-card.js +1 -1
  69. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  70. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  71. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  72. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  73. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  74. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  75. package/dist/cdn/foxy-query-builder.js +1 -1
  76. package/dist/cdn/foxy-report-form.js +5 -5
  77. package/dist/cdn/foxy-reports-table.js +1 -1
  78. package/dist/cdn/foxy-shipment-card.js +1 -1
  79. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  80. package/dist/cdn/foxy-sign-in-form.js +1 -1
  81. package/dist/cdn/foxy-spinner.js +2 -2
  82. package/dist/cdn/foxy-store-card.js +1 -1
  83. package/dist/cdn/foxy-store-form.js +1 -1
  84. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  85. package/dist/cdn/foxy-subscription-card.js +1 -1
  86. package/dist/cdn/foxy-subscription-form.js +2 -96
  87. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  88. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  89. package/dist/cdn/foxy-table.js +1 -1
  90. package/dist/cdn/foxy-tax-card.js +1 -1
  91. package/dist/cdn/foxy-tax-form.js +1 -1
  92. package/dist/cdn/foxy-template-config-form.js +1 -1
  93. package/dist/cdn/foxy-template-form.js +1 -1
  94. package/dist/cdn/foxy-template-set-card.js +1 -1
  95. package/dist/cdn/foxy-template-set-form.js +1 -1
  96. package/dist/cdn/foxy-transaction-card.js +95 -1
  97. package/dist/cdn/foxy-transaction.js +1 -1
  98. package/dist/cdn/foxy-transactions-table.js +7 -7
  99. package/dist/cdn/foxy-user-card.js +1 -1
  100. package/dist/cdn/foxy-user-form.js +1 -1
  101. package/dist/cdn/foxy-users-table.js +1 -1
  102. package/dist/cdn/foxy-webhook-card.js +1 -1
  103. package/dist/cdn/foxy-webhook-form.js +1 -1
  104. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  105. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  106. package/dist/cdn/{shared-b113467e.js → shared-00c2793e.js} +1 -1
  107. package/dist/cdn/{shared-15dfa16d.js → shared-029816d7.js} +1 -1
  108. package/dist/cdn/{shared-61b1fd60.js → shared-02bc0368.js} +1 -1
  109. package/dist/cdn/{shared-87f55237.js → shared-174f37e9.js} +1 -1
  110. package/dist/cdn/{shared-3f3903d4.js → shared-20ba4cdc.js} +1 -1
  111. package/dist/cdn/{shared-06916671.js → shared-268571df.js} +1 -1
  112. package/dist/cdn/{shared-8d99b885.js → shared-2b27e2e7.js} +1 -1
  113. package/dist/cdn/{shared-979e24ec.js → shared-2bdc99f4.js} +1 -1
  114. package/dist/cdn/{shared-3d95605f.js → shared-2c8c4b43.js} +3 -3
  115. package/dist/cdn/shared-2cf08dd4.js +1 -0
  116. package/dist/cdn/{shared-f8d1abc9.js → shared-2f09d4df.js} +4 -4
  117. package/dist/cdn/{shared-54cbd346.js → shared-30d00b64.js} +1 -1
  118. package/dist/cdn/{shared-d9f4138b.js → shared-32e736eb.js} +1 -1
  119. package/dist/cdn/{shared-a1d39ddd.js → shared-43f449bb.js} +1 -1
  120. package/dist/cdn/{shared-87824001.js → shared-4462dc70.js} +2 -2
  121. package/dist/cdn/{shared-02f8245a.js → shared-4aa4d980.js} +1 -1
  122. package/dist/cdn/{shared-63d11888.js → shared-4c124efc.js} +7 -7
  123. package/dist/cdn/shared-4c650e5c.js +1 -0
  124. package/dist/cdn/{shared-b984ab7c.js → shared-4e59fd48.js} +16 -16
  125. package/dist/cdn/{shared-69c3549d.js → shared-54b0e48f.js} +1 -1
  126. package/dist/cdn/{shared-ecd5eb1b.js → shared-5fa697c4.js} +1 -1
  127. package/dist/cdn/shared-61ade33e.js +6 -0
  128. package/dist/cdn/{shared-3bd99d11.js → shared-6a9ae42e.js} +1 -1
  129. package/dist/cdn/{shared-a95067d6.js → shared-76400719.js} +1 -1
  130. package/dist/cdn/{shared-ceec93fa.js → shared-7dd17943.js} +1 -1
  131. package/dist/cdn/{shared-ea1ab750.js → shared-7deff07c.js} +1 -1
  132. package/dist/cdn/{shared-fad099e6.js → shared-7e1953f5.js} +1 -1
  133. package/dist/cdn/shared-8201d0b5.js +1 -0
  134. package/dist/cdn/{shared-29e74661.js → shared-8952aeac.js} +1 -1
  135. package/dist/cdn/{shared-320fadbf.js → shared-896982f9.js} +1 -1
  136. package/dist/cdn/{shared-a5a03f4f.js → shared-8d8bed82.js} +1 -1
  137. package/dist/cdn/{shared-92dd9964.js → shared-99c0ae04.js} +1 -1
  138. package/dist/cdn/{shared-6ffa9f84.js → shared-9c08cfab.js} +1 -1
  139. package/dist/cdn/{shared-0ffe26d8.js → shared-9df8f842.js} +2 -2
  140. package/dist/cdn/{shared-0961f769.js → shared-a8dc23f1.js} +1 -1
  141. package/dist/cdn/{shared-3fee360a.js → shared-ac7c5a5e.js} +14 -14
  142. package/dist/cdn/{shared-5db2fec0.js → shared-ad34b6db.js} +1 -1
  143. package/dist/cdn/{shared-a1be9c27.js → shared-b1b8ea67.js} +1 -1
  144. package/dist/cdn/{shared-85712eed.js → shared-b509bc2c.js} +1 -1
  145. package/dist/cdn/{shared-de8bf756.js → shared-bc0d8d01.js} +2 -2
  146. package/dist/cdn/{shared-4105aacf.js → shared-be7bfbb0.js} +1 -1
  147. package/dist/cdn/{shared-745a575c.js → shared-bed7aae1.js} +1 -1
  148. package/dist/cdn/{shared-5291bdca.js → shared-c7b3d22b.js} +3 -3
  149. package/dist/cdn/{shared-264c82b8.js → shared-c9ba1b64.js} +3 -3
  150. package/dist/cdn/{shared-c43cd1fa.js → shared-ca4c5f0f.js} +1 -1
  151. package/dist/cdn/{shared-efbd62cb.js → shared-cdd2358f.js} +4 -4
  152. package/dist/cdn/{shared-d8ca5c87.js → shared-d21fa1a6.js} +1 -1
  153. package/dist/cdn/{shared-835cf735.js → shared-d57fac94.js} +1 -1
  154. package/dist/cdn/{shared-d600815d.js → shared-dbadd9cf.js} +1 -1
  155. package/dist/cdn/{shared-452e38da.js → shared-e39807f8.js} +1 -1
  156. package/dist/cdn/{shared-25edf241.js → shared-e83f2983.js} +1 -1
  157. package/dist/cdn/{shared-d1265ca0.js → shared-e91453df.js} +1 -1
  158. package/dist/cdn/{shared-5f1f0d8f.js → shared-ea527e98.js} +1 -1
  159. package/dist/cdn/shared-f9a3d1ff.js +6 -0
  160. package/dist/cdn/{shared-324665fd.js → shared-fa4f6cd3.js} +1 -1
  161. package/dist/cdn/shared-fc15a882.js +1 -0
  162. package/dist/cdn/{shared-2c92c192.js → shared-ff8ca16b.js} +1 -1
  163. package/dist/cdn/{shared-6d0be1e4.js → shared-ff9791cf.js} +1 -1
  164. package/dist/cdn/translations/cart-form/en.json +7 -6
  165. package/dist/cdn/translations/customer/en.json +23 -14
  166. package/dist/cdn/translations/customer-portal/en.json +22 -13
  167. package/dist/cdn/translations/item-card/en.json +1 -0
  168. package/dist/cdn/translations/item-form/en.json +2 -2
  169. package/dist/cdn/translations/payments-api-payment-preset-form/en.json +2 -2
  170. package/dist/cdn/translations/shipment-card/en.json +1 -0
  171. package/dist/cdn/translations/subscription-form/en.json +23 -14
  172. package/dist/cdn/translations/transaction/en.json +27 -26
  173. package/dist/cdn/translations/transaction-card/en.json +22 -22
  174. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +28 -23
  175. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
  176. package/dist/elements/internal/InternalControl/InternalControl.js +2 -1
  177. package/dist/elements/internal/InternalControl/InternalControl.js.map +1 -1
  178. package/dist/elements/private/Dialog/Dialog.js +7 -1
  179. package/dist/elements/private/Dialog/Dialog.js.map +1 -1
  180. package/dist/elements/public/BillingAddressCard/BillingAddressCard.d.ts +2 -1
  181. package/dist/elements/public/BillingAddressCard/BillingAddressCard.js.map +1 -1
  182. package/dist/elements/public/CouponForm/types.d.ts +3 -7
  183. package/dist/elements/public/CouponForm/types.js.map +1 -1
  184. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +2 -2
  185. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  186. package/dist/elements/public/ItemCard/ItemCard.js +4 -2
  187. package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
  188. package/dist/elements/public/ItemsForm/private/Item.js +1 -0
  189. package/dist/elements/public/ItemsForm/private/Item.js.map +1 -1
  190. package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
  191. package/dist/elements/public/PaymentCard/PaymentCard.js.map +1 -1
  192. package/dist/elements/public/PaymentsApi/api/types.d.ts +2 -0
  193. package/dist/elements/public/PaymentsApi/api/types.js.map +1 -1
  194. package/dist/elements/public/ShipmentCard/ShipmentCard.js +5 -2
  195. package/dist/elements/public/ShipmentCard/ShipmentCard.js.map +1 -1
  196. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +2 -2
  197. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  198. package/dist/elements/public/SubscriptionCard/types.d.ts +2 -2
  199. package/dist/elements/public/SubscriptionCard/types.js.map +1 -1
  200. package/dist/elements/public/Transaction/Transaction.d.ts +2 -3
  201. package/dist/elements/public/Transaction/Transaction.js +129 -127
  202. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  203. package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js +6 -4
  204. package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js.map +1 -1
  205. package/dist/elements/public/Transaction/types.d.ts +4 -17
  206. package/dist/elements/public/Transaction/types.js.map +1 -1
  207. package/dist/elements/public/TransactionCard/TransactionCard.d.ts +8 -10
  208. package/dist/elements/public/TransactionCard/TransactionCard.js +71 -51
  209. package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
  210. package/dist/elements/public/TransactionCard/index.d.ts +2 -1
  211. package/dist/elements/public/TransactionCard/index.js +2 -1
  212. package/dist/elements/public/TransactionCard/index.js.map +1 -1
  213. package/dist/elements/public/TransactionCard/types.d.ts +8 -2
  214. package/dist/elements/public/TransactionCard/types.js.map +1 -1
  215. package/dist/mixins/themeable.js +4 -0
  216. package/dist/mixins/themeable.js.map +1 -1
  217. package/package.json +2 -2
  218. package/dist/cdn/shared-4761cbda.js +0 -1
  219. package/dist/cdn/shared-87142858.js +0 -1
  220. package/dist/cdn/shared-e9276306.js +0 -1
  221. package/dist/cdn/shared-eacc4539.js +0 -1
  222. package/dist/cdn/shared-ec59505f.js +0 -12
  223. package/dist/cdn/shared-f3cd4d07.js +0 -1
@@ -40,7 +40,8 @@ export class InternalControl extends ConfigurableMixin(TranslatableMixin(Themeab
40
40
  var _a, _b;
41
41
  super.applyInferredProperties(context);
42
42
  this.nucleon = (_a = context.get('nucleon')) !== null && _a !== void 0 ? _a : null;
43
- this.disabled = ((_b = this.nucleon) === null || _b === void 0 ? void 0 : _b.in('idle')) === false || super.disabled;
43
+ if (((_b = this.nucleon) === null || _b === void 0 ? void 0 : _b.in('idle')) === false)
44
+ this.disabled = true;
44
45
  }
45
46
  updated(changes) {
46
47
  super.updated(changes);
@@ -1 +1 @@
1
- {"version":3,"file":"InternalControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalControl/InternalControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,cAAc,EAAE,sDAAmD;AAC5E,OAAO,E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AC,gBAAgB,EAAE,IAAI,CAAC,CAAC;SAChC;IACH,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAE/B,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE;QACzE,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;KACnD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { html, LitElement } from 'lit-element';\nimport { InferrableMixin } from '../../../mixins/inferrable';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport { render } from 'lit-html';\n\n/**\n * An internal base class for any control in a Nucleon form. That control can be as simple as a text field bound\n * to a property or as complex as a query builder, and it infers property values from the\n * parent Nucleon/Configurable/Translatable element, saving the need to manually calculate\n * and bind properties in Lit templates. Each control renders before and after slots in the regular DOM + its\n * own layout in the shadow DOM. When hidden via `hiddencontrols` in the parent,\n * uses `display: none` to hide itself.\n *\n * @element foxy-internal-control\n * @since 1.17.0\n */\nexport class InternalControl extends ConfigurableMixin(\n TranslatableMixin(ThemeableMixin(InferrableMixin(LitElement)))\n) {\n static get inferredProperties(): string[] {\n return [...super.inferredProperties, 'nucleon'];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n nucleon: { attribute: false },\n };\n }\n\n /** NucleonElement instance this control is bound to. */\n nucleon: NucleonElement<any> | null = null;\n\n inferFromElement(key: string, element: HTMLElement): unknown | undefined {\n if (key === 'nucleon' && element instanceof NucleonElement) return element;\n return super.inferFromElement(key, element);\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n\n this.nucleon = (context.get('nucleon') as NucleonElement<any> | undefined) ?? null;\n this.disabled = this.nucleon?.in('idle') === false || super.disabled;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n if (typeof this.infer === 'string') {\n const lightDomTemplate = html`\n <slot name=\"${this.infer}:before\" slot=\"before\"></slot>\n <slot name=\"${this.infer}:after\" slot=\"after\"></slot>\n `;\n\n render(lightDomTemplate, this);\n }\n }\n\n /**\n * Renders the control itself. In most cases, you will need to implement\n * this method instead of `.render()` in your class to keep the before and after templates/slots.\n */\n renderControl(): TemplateResult {\n return html``;\n }\n\n /**\n * Renders the control (if visible) and the before/after templates/slots.\n * You should probably implement `.renderControl()` method instead of this one in your class.\n */\n render(): TemplateResult {\n if (this.hidden) return html``;\n\n return html`\n ${this.renderTemplateOrSlot('before', this.nucleon)} ${this.renderControl()}\n ${this.renderTemplateOrSlot('after', this.nucleon)}\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalControl/InternalControl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,cAAc,EAAE,sDAAmD;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB,CACpD,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAC/D;IAFD;;Q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O,IAAI,CAAA,EAAE,CAAC;QAE/B,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE;QACzE,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;KACnD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { html, LitElement } from 'lit-element';\nimport { InferrableMixin } from '../../../mixins/inferrable';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { NucleonElement } from '../../public/NucleonElement/NucleonElement';\nimport { render } from 'lit-html';\n\n/**\n * An internal base class for any control in a Nucleon form. That control can be as simple as a text field bound\n * to a property or as complex as a query builder, and it infers property values from the\n * parent Nucleon/Configurable/Translatable element, saving the need to manually calculate\n * and bind properties in Lit templates. Each control renders before and after slots in the regular DOM + its\n * own layout in the shadow DOM. When hidden via `hiddencontrols` in the parent,\n * uses `display: none` to hide itself.\n *\n * @element foxy-internal-control\n * @since 1.17.0\n */\nexport class InternalControl extends ConfigurableMixin(\n TranslatableMixin(ThemeableMixin(InferrableMixin(LitElement)))\n) {\n static get inferredProperties(): string[] {\n return [...super.inferredProperties, 'nucleon'];\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n nucleon: { attribute: false },\n };\n }\n\n /** NucleonElement instance this control is bound to. */\n nucleon: NucleonElement<any> | null = null;\n\n inferFromElement(key: string, element: HTMLElement): unknown | undefined {\n if (key === 'nucleon' && element instanceof NucleonElement) return element;\n return super.inferFromElement(key, element);\n }\n\n applyInferredProperties(context: Map<string, unknown>): void {\n super.applyInferredProperties(context);\n\n this.nucleon = (context.get('nucleon') as NucleonElement<any> | undefined) ?? null;\n if (this.nucleon?.in('idle') === false) this.disabled = true;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n if (typeof this.infer === 'string') {\n const lightDomTemplate = html`\n <slot name=\"${this.infer}:before\" slot=\"before\"></slot>\n <slot name=\"${this.infer}:after\" slot=\"after\"></slot>\n `;\n\n render(lightDomTemplate, this);\n }\n }\n\n /**\n * Renders the control itself. In most cases, you will need to implement\n * this method instead of `.render()` in your class to keep the before and after templates/slots.\n */\n renderControl(): TemplateResult {\n return html``;\n }\n\n /**\n * Renders the control (if visible) and the before/after templates/slots.\n * You should probably implement `.renderControl()` method instead of this one in your class.\n */\n render(): TemplateResult {\n if (this.hidden) return html``;\n\n return html`\n ${this.renderTemplateOrSlot('before', this.nucleon)} ${this.renderControl()}\n ${this.renderTemplateOrSlot('after', this.nucleon)}\n `;\n }\n}\n"]}
@@ -264,7 +264,13 @@ export class Dialog extends Base {
264
264
  // trigger exit transition
265
265
  new Promise(resolve => {
266
266
  const backdrop = this.renderRoot.querySelector('#backdrop');
267
- backdrop.addEventListener('transitionend', resolve, { once: true });
267
+ if (backdrop) {
268
+ backdrop.addEventListener('transitionend', () => resolve(), { once: true });
269
+ setTimeout(() => resolve(), 2000);
270
+ }
271
+ else {
272
+ resolve();
273
+ }
268
274
  this.__visible = Dialog.openDialogs.includes(this);
269
275
  }),
270
276
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/elements/private/Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAwB,GAAG,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,2CAAwC;AACtD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,6BAA0B;AACpD,OAAO,EAAE,eAAe,EAAE,6BAA0B;AACpD,OAAO,EAAE,YAAY,EAAE,0BAAuB;AAC9C,OAAO,EAAE,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AAS,GAAG,eAAe,CAAC;AAE5C;;;GAGG;AACa,gBAAS,GAAG,eAAe,CAAC;AA8S9C,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { CSSResultArray, LitElement, PropertyDeclarations, css } from 'lit-element';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../../public/NucleonElement/API';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from './DialogHideEvent';\nimport { DialogShowEvent } from './DialogShowEvent';\nimport { DialogWindow } from './DialogWindow';\nimport { FetchEvent } from '../../public/NucleonElement/FetchEvent';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport abstract class Dialog extends Base {\n /**\n * Selector of an element that will serve as a mounting point to all dialog windows.\n * It's `<body>` by default, but you can add your own element with `id=\"foxy-dialog-windows-host\"`\n * anywhere in the light DOM to render dialogs there.\n */\n static readonly dialogWindowsHost = '#foxy-dialog-windows-host, body';\n\n /** Map of all dialog windows linked to their dialog elements. */\n static readonly dialogWindows = new WeakMap<Dialog, DialogWindow>();\n\n /** List of all currently open dialogs. */\n static readonly openDialogs: Dialog[] = [];\n\n /**\n * Instance of this event will be dispatched on a dialog when it finishes entering the screen.\n * This event does not bubble and can't cross shadow DOM boundary.\n */\n static readonly ShowEvent = DialogShowEvent;\n\n /**\n * Instance of this event will be dispatched on a dialog when it finishes leaving the screen.\n * This event does not bubble and can't cross shadow DOM boundary.\n */\n static readonly HideEvent = DialogHideEvent;\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __connected: { attribute: false },\n __visible: { attribute: false },\n centered: { type: Boolean },\n closable: { type: Boolean },\n editable: { type: Boolean },\n header: { type: String },\n group: {},\n alert: { type: Boolean },\n wide: { type: Boolean },\n open: { type: Boolean, noAccessor: true },\n };\n }\n\n /** @readonly */\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .grid-cols-header {\n grid-template-columns: 1fr auto 1fr;\n }\n\n .scale-85 {\n --tw-scale-x: 0.85;\n --tw-scale-y: 0.85;\n }\n\n .max-h-alert {\n max-height: calc(100vh - var(--lumo-size-l) - var(--lumo-space-m) * 2);\n }\n `,\n ];\n }\n\n /** When true, renders Close button in the header. */\n closable = false;\n\n /** When true, renders Save button in the header. */\n editable = false;\n\n /** Header text or a i18next key for it. */\n header = '';\n\n /** NucleonElement's Rumour sync group. */\n group = '';\n\n /** When true, centers a dialog on the screen and does not animate the stack under. */\n alert = false;\n\n /** When true, dialog window will a larger maximum width. */\n wide = false;\n\n private __returnFocusTo?: HTMLElement;\n\n private __handleKeyDown = (evt: KeyboardEvent) => {\n if (evt.key === 'Escape' && Dialog.openDialogs[0] === this && this.closable)\n this.hide(this.editable);\n };\n\n private __connected = false;\n\n private __visible = false;\n\n /** True if dialog is mounted and has finished entering the screen. */\n get open(): boolean {\n return this.__visible && this.__connected;\n }\n\n set open(newValue: boolean) {\n newValue === this.open ? void 0 : newValue ? this.show() : this.hide(this.editable);\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n addEventListener('keydown', this.__handleKeyDown);\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n removeEventListener('keydown', this.__handleKeyDown);\n\n Dialog.dialogWindows.get(this)?.remove();\n Dialog.dialogWindows.delete(this);\n }\n\n /** @readonly */\n createRenderRoot(): Element | ShadowRoot {\n const dialogWindow = new DialogWindow();\n const dialogWindowsHosts = document.querySelectorAll(Dialog.dialogWindowsHost);\n const dialogWindowsHost = Array.from(dialogWindowsHosts).pop();\n\n dialogWindow.addEventListener('fetch', (evt: Event) => {\n if (evt instanceof FetchEvent) {\n evt.stopImmediatePropagation();\n evt.preventDefault();\n evt.respondWith(new API(this).fetch(evt.request));\n }\n });\n\n dialogWindowsHost?.appendChild(dialogWindow);\n Dialog.dialogWindows.set(this, dialogWindow);\n\n return dialogWindow.shadowRoot!;\n }\n\n /** @readonly */\n render(content?: () => TemplateResult): TemplateResult {\n if (!this.__connected) return html``;\n\n const isFirst = Dialog.openDialogs[0] === this;\n const isSecond = Dialog.openDialogs[1] === this;\n const isThird = Dialog.openDialogs[2] === this;\n const isForthAndGreater = !isFirst && !isSecond && !isThird;\n\n return html`\n <div\n class=${classMap({ 'z-50 fixed inset-0': true, 'pointer-events-none': !this.__visible })}\n >\n <div\n id=\"backdrop\"\n class=${classMap({\n 'select-none ease-in-out transition duration-500 absolute inset-0 bg-shade-50 focus-outline-none':\n true,\n 'opacity-100': this.__visible,\n 'opacity-0': !this.__visible,\n })}\n tabindex=\"-1\"\n @click=${() => this.closable && this.hide(this.editable)}\n ></div>\n\n <div\n tabindex=\"0\"\n role=\"dialog\"\n aria-labelledby=\"dialog-title\"\n class=${classMap({\n 'transform ease-in-out transition duration-500 relative h-full ml-auto': true,\n 'origin-bottom sm-origin-center': true,\n 'focus-outline-none': true,\n 'sm-max-w-modal': !this.wide,\n 'sm-max-w-modal-wide': this.wide,\n 'flex justify-center items-end sm-items-center mr-auto': this.alert,\n 'translate-y-full sm-translate-y-0': !this.__visible,\n 'sm-translate-x-full': !this.alert && !this.__visible,\n 'sm-opacity-0 sm-scale-110': this.alert && !this.__visible,\n 'translate-y-0 translate-x-0': isFirst && this.__visible,\n 'scale-95 -translate-y-s sm-translate-y-0': isSecond && this.__visible,\n 'scale-90 -translate-y-m sm-translate-y-0': isThird && this.__visible,\n 'opacity-0 scale-85 -translate-y-l sm-translate-y-0':\n isForthAndGreater && this.__visible,\n })}\n >\n <div\n class=${classMap({\n 'overflow-hidden flex flex-col bg-base rounded-t-l sm-rounded-b-l': true,\n 'absolute inset-0 mt-xl sm-m-xl': !this.alert,\n 'shadow-xxl': this.__visible,\n 'flex-1': this.alert,\n })}\n >\n <div\n class=\"h-l grid grid-cols-header text-m font-lumo font-medium border-b border-contrast-10\"\n >\n ${this.closable && !this.hiddenSelector.matches('close-button', true)\n ? html`\n <vaadin-button\n id=\"close-button\"\n theme=\"tertiary-inline\"\n class=\"mr-auto m-s px-s\"\n ?disabled=${this.disabledSelector.matches('close-button', true)}\n @click=${() => this.hide(this.editable)}\n >\n <foxy-i18n\n lang=${this.lang}\n key=${this.editable ? 'cancel' : 'close'}\n ns=${this.ns}\n >\n </foxy-i18n>\n </vaadin-button>\n `\n : html`<div></div>`}\n\n <h1 id=\"dialog-title\" class=\"truncate self-center text-center\">\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.header}></foxy-i18n>\n </h1>\n\n ${this.editable && !this.hiddenSelector.matches('save-button', true)\n ? html`\n <vaadin-button\n data-testid=\"save-button\"\n ?disabled=${this.disabledSelector.matches('save-button', true)}\n theme=\"primary\"\n class=\"ml-auto h-auto min-h-0 min-w-0 m-xs px-m\"\n @click=${this.save}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"save\"></foxy-i18n>\n </vaadin-button>\n `\n : html`<div></div>`}\n </div>\n\n <div\n class=${classMap({\n 'flex-1 overflow-y-auto overflow-x-hidden overscroll-contain': true,\n 'max-h-alert': this.alert,\n })}\n >\n <div class=\"p-m relative\">${content?.()}</div>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n const dialogWindow = Dialog.dialogWindows.get(this);\n\n if (dialogWindow) {\n dialogWindow.disabledControls = this.disabledControls;\n dialogWindow.disabled = this.disabled;\n\n dialogWindow.readonlyControls = this.readonlyControls;\n dialogWindow.readonly = this.readonly;\n\n dialogWindow.hiddenControls = this.hiddenControls;\n dialogWindow.hidden = this.hidden;\n\n dialogWindow.group = this.group;\n dialogWindow.lang = this.lang;\n dialogWindow.ns = this.ns;\n }\n }\n\n /**\n * Hides the dialog. Returns a promise that resolves when the dialog\n * finishes leaving the screen.\n *\n * @param cancelled Set this to `true` if closing an editable dialog without saving changes.\n */\n async hide(cancelled = false): Promise<void> {\n this.__returnFocusTo?.focus();\n\n await this.__setOpenDialogs(Dialog.openDialogs.filter(d => d !== this));\n await this.__setConnected(false);\n\n this.dispatchEvent(new Dialog.HideEvent(!!cancelled));\n }\n\n /**\n * Shows the dialog. Returns a promise that resolves when the dialog\n * finishes entering the screen.\n *\n * @param returnFocusTo If provided, the dialog will call `.focus()` on that element once it's closed.\n */\n async show(returnFocusTo?: HTMLElement): Promise<void> {\n this.__returnFocusTo = returnFocusTo;\n\n await this.__setConnected(true);\n await this.__setOpenDialogs([this, ...Dialog.openDialogs]);\n\n this.renderRoot.querySelector<HTMLDivElement>('[role=\"dialog\"]')?.focus();\n this.dispatchEvent(new Dialog.ShowEvent());\n }\n\n /** Alias for `dialog.hide(false)`. */\n async save(): Promise<void> {\n await this.hide(false);\n }\n\n private async __setOpenDialogs(newValue: Dialog[]) {\n Dialog.openDialogs.length = 0;\n Dialog.openDialogs.push(...newValue);\n\n await Promise.all([\n // animate dialog stack\n Promise.all(Dialog.openDialogs.map(dialog => dialog.requestUpdate())),\n\n // trigger exit transition\n new Promise(resolve => {\n const backdrop = this.renderRoot.querySelector('#backdrop') as HTMLDivElement;\n backdrop.addEventListener('transitionend', resolve, { once: true });\n this.__visible = Dialog.openDialogs.includes(this);\n }),\n ]);\n }\n\n private async __setConnected(newValue: boolean) {\n this.__connected = newValue;\n await this.updateComplete.then(() => this.getBoundingClientRect());\n }\n}\n\ncustomElements.define('foxy-dialog-window', DialogWindow);\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/elements/private/Dialog/Dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAwB,GAAG,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,2CAAwC;AACtD,OAAO,EAAE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,WAAW,GAAG,QAAQ,CAAC;QAC5B,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACrE,CAAC;;AAzUD;;;;GAIG;AACa,wBAAiB,GAAG,iCAAiC,CAAC;AAEtE,iEAAiE;AACjD,oBAAa,GAAG,IAAI,OAAO,EAAwB,CAAC;AAEpE,0CAA0C;AAC1B,kBAAW,GAAa,EAAE,CAAC;AAE3C;;;GAGG;AACa,gBAAS,GAAG,eAAe,CAAC;AAE5C;;;GAGG;AACa,gBAAS,GAAG,eAAe,CAAC;AAqT9C,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import { CSSResultArray, LitElement, PropertyDeclarations, css } from 'lit-element';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { API } from '../../public/NucleonElement/API';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { DialogHideEvent } from './DialogHideEvent';\nimport { DialogShowEvent } from './DialogShowEvent';\nimport { DialogWindow } from './DialogWindow';\nimport { FetchEvent } from '../../public/NucleonElement/FetchEvent';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport abstract class Dialog extends Base {\n /**\n * Selector of an element that will serve as a mounting point to all dialog windows.\n * It's `<body>` by default, but you can add your own element with `id=\"foxy-dialog-windows-host\"`\n * anywhere in the light DOM to render dialogs there.\n */\n static readonly dialogWindowsHost = '#foxy-dialog-windows-host, body';\n\n /** Map of all dialog windows linked to their dialog elements. */\n static readonly dialogWindows = new WeakMap<Dialog, DialogWindow>();\n\n /** List of all currently open dialogs. */\n static readonly openDialogs: Dialog[] = [];\n\n /**\n * Instance of this event will be dispatched on a dialog when it finishes entering the screen.\n * This event does not bubble and can't cross shadow DOM boundary.\n */\n static readonly ShowEvent = DialogShowEvent;\n\n /**\n * Instance of this event will be dispatched on a dialog when it finishes leaving the screen.\n * This event does not bubble and can't cross shadow DOM boundary.\n */\n static readonly HideEvent = DialogHideEvent;\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n __connected: { attribute: false },\n __visible: { attribute: false },\n centered: { type: Boolean },\n closable: { type: Boolean },\n editable: { type: Boolean },\n header: { type: String },\n group: {},\n alert: { type: Boolean },\n wide: { type: Boolean },\n open: { type: Boolean, noAccessor: true },\n };\n }\n\n /** @readonly */\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .grid-cols-header {\n grid-template-columns: 1fr auto 1fr;\n }\n\n .scale-85 {\n --tw-scale-x: 0.85;\n --tw-scale-y: 0.85;\n }\n\n .max-h-alert {\n max-height: calc(100vh - var(--lumo-size-l) - var(--lumo-space-m) * 2);\n }\n `,\n ];\n }\n\n /** When true, renders Close button in the header. */\n closable = false;\n\n /** When true, renders Save button in the header. */\n editable = false;\n\n /** Header text or a i18next key for it. */\n header = '';\n\n /** NucleonElement's Rumour sync group. */\n group = '';\n\n /** When true, centers a dialog on the screen and does not animate the stack under. */\n alert = false;\n\n /** When true, dialog window will a larger maximum width. */\n wide = false;\n\n private __returnFocusTo?: HTMLElement;\n\n private __handleKeyDown = (evt: KeyboardEvent) => {\n if (evt.key === 'Escape' && Dialog.openDialogs[0] === this && this.closable)\n this.hide(this.editable);\n };\n\n private __connected = false;\n\n private __visible = false;\n\n /** True if dialog is mounted and has finished entering the screen. */\n get open(): boolean {\n return this.__visible && this.__connected;\n }\n\n set open(newValue: boolean) {\n newValue === this.open ? void 0 : newValue ? this.show() : this.hide(this.editable);\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n addEventListener('keydown', this.__handleKeyDown);\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n removeEventListener('keydown', this.__handleKeyDown);\n\n Dialog.dialogWindows.get(this)?.remove();\n Dialog.dialogWindows.delete(this);\n }\n\n /** @readonly */\n createRenderRoot(): Element | ShadowRoot {\n const dialogWindow = new DialogWindow();\n const dialogWindowsHosts = document.querySelectorAll(Dialog.dialogWindowsHost);\n const dialogWindowsHost = Array.from(dialogWindowsHosts).pop();\n\n dialogWindow.addEventListener('fetch', (evt: Event) => {\n if (evt instanceof FetchEvent) {\n evt.stopImmediatePropagation();\n evt.preventDefault();\n evt.respondWith(new API(this).fetch(evt.request));\n }\n });\n\n dialogWindowsHost?.appendChild(dialogWindow);\n Dialog.dialogWindows.set(this, dialogWindow);\n\n return dialogWindow.shadowRoot!;\n }\n\n /** @readonly */\n render(content?: () => TemplateResult): TemplateResult {\n if (!this.__connected) return html``;\n\n const isFirst = Dialog.openDialogs[0] === this;\n const isSecond = Dialog.openDialogs[1] === this;\n const isThird = Dialog.openDialogs[2] === this;\n const isForthAndGreater = !isFirst && !isSecond && !isThird;\n\n return html`\n <div\n class=${classMap({ 'z-50 fixed inset-0': true, 'pointer-events-none': !this.__visible })}\n >\n <div\n id=\"backdrop\"\n class=${classMap({\n 'select-none ease-in-out transition duration-500 absolute inset-0 bg-shade-50 focus-outline-none':\n true,\n 'opacity-100': this.__visible,\n 'opacity-0': !this.__visible,\n })}\n tabindex=\"-1\"\n @click=${() => this.closable && this.hide(this.editable)}\n ></div>\n\n <div\n tabindex=\"0\"\n role=\"dialog\"\n aria-labelledby=\"dialog-title\"\n class=${classMap({\n 'transform ease-in-out transition duration-500 relative h-full ml-auto': true,\n 'origin-bottom sm-origin-center': true,\n 'focus-outline-none': true,\n 'sm-max-w-modal': !this.wide,\n 'sm-max-w-modal-wide': this.wide,\n 'flex justify-center items-end sm-items-center mr-auto': this.alert,\n 'translate-y-full sm-translate-y-0': !this.__visible,\n 'sm-translate-x-full': !this.alert && !this.__visible,\n 'sm-opacity-0 sm-scale-110': this.alert && !this.__visible,\n 'translate-y-0 translate-x-0': isFirst && this.__visible,\n 'scale-95 -translate-y-s sm-translate-y-0': isSecond && this.__visible,\n 'scale-90 -translate-y-m sm-translate-y-0': isThird && this.__visible,\n 'opacity-0 scale-85 -translate-y-l sm-translate-y-0':\n isForthAndGreater && this.__visible,\n })}\n >\n <div\n class=${classMap({\n 'overflow-hidden flex flex-col bg-base rounded-t-l sm-rounded-b-l': true,\n 'absolute inset-0 mt-xl sm-m-xl': !this.alert,\n 'shadow-xxl': this.__visible,\n 'flex-1': this.alert,\n })}\n >\n <div\n class=\"h-l grid grid-cols-header text-m font-lumo font-medium border-b border-contrast-10\"\n >\n ${this.closable && !this.hiddenSelector.matches('close-button', true)\n ? html`\n <vaadin-button\n id=\"close-button\"\n theme=\"tertiary-inline\"\n class=\"mr-auto m-s px-s\"\n ?disabled=${this.disabledSelector.matches('close-button', true)}\n @click=${() => this.hide(this.editable)}\n >\n <foxy-i18n\n lang=${this.lang}\n key=${this.editable ? 'cancel' : 'close'}\n ns=${this.ns}\n >\n </foxy-i18n>\n </vaadin-button>\n `\n : html`<div></div>`}\n\n <h1 id=\"dialog-title\" class=\"truncate self-center text-center\">\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.header}></foxy-i18n>\n </h1>\n\n ${this.editable && !this.hiddenSelector.matches('save-button', true)\n ? html`\n <vaadin-button\n data-testid=\"save-button\"\n ?disabled=${this.disabledSelector.matches('save-button', true)}\n theme=\"primary\"\n class=\"ml-auto h-auto min-h-0 min-w-0 m-xs px-m\"\n @click=${this.save}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"save\"></foxy-i18n>\n </vaadin-button>\n `\n : html`<div></div>`}\n </div>\n\n <div\n class=${classMap({\n 'flex-1 overflow-y-auto overflow-x-hidden overscroll-contain': true,\n 'max-h-alert': this.alert,\n })}\n >\n <div class=\"p-m relative\">${content?.()}</div>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n\n const dialogWindow = Dialog.dialogWindows.get(this);\n\n if (dialogWindow) {\n dialogWindow.disabledControls = this.disabledControls;\n dialogWindow.disabled = this.disabled;\n\n dialogWindow.readonlyControls = this.readonlyControls;\n dialogWindow.readonly = this.readonly;\n\n dialogWindow.hiddenControls = this.hiddenControls;\n dialogWindow.hidden = this.hidden;\n\n dialogWindow.group = this.group;\n dialogWindow.lang = this.lang;\n dialogWindow.ns = this.ns;\n }\n }\n\n /**\n * Hides the dialog. Returns a promise that resolves when the dialog\n * finishes leaving the screen.\n *\n * @param cancelled Set this to `true` if closing an editable dialog without saving changes.\n */\n async hide(cancelled = false): Promise<void> {\n this.__returnFocusTo?.focus();\n\n await this.__setOpenDialogs(Dialog.openDialogs.filter(d => d !== this));\n await this.__setConnected(false);\n\n this.dispatchEvent(new Dialog.HideEvent(!!cancelled));\n }\n\n /**\n * Shows the dialog. Returns a promise that resolves when the dialog\n * finishes entering the screen.\n *\n * @param returnFocusTo If provided, the dialog will call `.focus()` on that element once it's closed.\n */\n async show(returnFocusTo?: HTMLElement): Promise<void> {\n this.__returnFocusTo = returnFocusTo;\n\n await this.__setConnected(true);\n await this.__setOpenDialogs([this, ...Dialog.openDialogs]);\n\n this.renderRoot.querySelector<HTMLDivElement>('[role=\"dialog\"]')?.focus();\n this.dispatchEvent(new Dialog.ShowEvent());\n }\n\n /** Alias for `dialog.hide(false)`. */\n async save(): Promise<void> {\n await this.hide(false);\n }\n\n private async __setOpenDialogs(newValue: Dialog[]) {\n Dialog.openDialogs.length = 0;\n Dialog.openDialogs.push(...newValue);\n\n await Promise.all([\n // animate dialog stack\n Promise.all(Dialog.openDialogs.map(dialog => dialog.requestUpdate())),\n\n // trigger exit transition\n new Promise<void>(resolve => {\n const backdrop = this.renderRoot.querySelector('#backdrop');\n\n if (backdrop) {\n backdrop.addEventListener('transitionend', () => resolve(), { once: true });\n setTimeout(() => resolve(), 2000);\n } else {\n resolve();\n }\n\n this.__visible = Dialog.openDialogs.includes(this);\n }),\n ]);\n }\n\n private async __setConnected(newValue: boolean) {\n this.__connected = newValue;\n await this.updateComplete.then(() => this.getBoundingClientRect());\n }\n}\n\ncustomElements.define('foxy-dialog-window', DialogWindow);\n"]}
@@ -1,3 +1,4 @@
1
+ import type { TemplateResult } from 'lit-html';
1
2
  import type { Data } from './types';
2
3
  import { InternalCard } from '../../internal/InternalCard/InternalCard';
3
4
  declare const Base: typeof InternalCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
@@ -10,6 +11,6 @@ declare const Base: typeof InternalCard & import("lit-element").Constructor<impo
10
11
  * @since 1.25.0
11
12
  */
12
13
  export declare class BillingAddressCard extends Base<Data> {
13
- renderBody(): import("lit-html").TemplateResult;
14
+ renderBody(): TemplateResult;
14
15
  }
15
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"BillingAddressCard.js","sourceRoot":"","sources":["../../../../src/elements/public/BillingAddressCard/BillingAddressCard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAChD,UAAU;QACR,OAAO,IAAI,CAAA;;;yDAG0C,IAAI,CAAC,IAAI;;;;4DAIN,IAAI,CAAC,IAAI;;;;KAIhE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\nconst NS = 'billing-address-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Card element representing a `fx:billing_address` resource.\n *\n * @element foxy-billing-address-card\n * @since 1.25.0\n */\nexport class BillingAddressCard extends Base<Data> {\n renderBody() {\n return html`\n <section class=\"leading-none space-y-xs font-lumo\">\n <p class=\"text-m text-body font-medium truncate\">\n <foxy-i18n infer=\"\" key=\"full_name\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n <p class=\"text-s text-secondary truncate\">\n <foxy-i18n infer=\"\" key=\"full_address\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n </section>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"BillingAddressCard.js","sourceRoot":"","sources":["../../../../src/elements/public/BillingAddressCard/BillingAddressCard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAChD,UAAU;QACR,OAAO,IAAI,CAAA;;;yDAG0C,IAAI,CAAC,IAAI;;;;4DAIN,IAAI,CAAC,IAAI;;;;KAIhE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\nconst NS = 'billing-address-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Card element representing a `fx:billing_address` resource.\n *\n * @element foxy-billing-address-card\n * @since 1.25.0\n */\nexport class BillingAddressCard extends Base<Data> {\n renderBody(): TemplateResult {\n return html`\n <section class=\"leading-none space-y-xs font-lumo\">\n <p class=\"text-m text-body font-medium truncate\">\n <foxy-i18n infer=\"\" key=\"full_name\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n <p class=\"text-s text-secondary truncate\">\n <foxy-i18n infer=\"\" key=\"full_address\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n </section>\n `;\n }\n}\n"]}
@@ -1,7 +1,3 @@
1
- import { Rels } from '@foxy.io/sdk/backend';
2
- import { Resource } from '@foxy.io/sdk/core';
3
- export declare type Data = Resource<Rels.Coupon> & {
4
- customer_auto_apply: boolean;
5
- customer_attribute_restrictions: string;
6
- customer_subscription_restrictions: string;
7
- };
1
+ import type { Resource } from '@foxy.io/sdk/core';
2
+ import type { Rels } from '@foxy.io/sdk/backend';
3
+ export declare type Data = Resource<Rels.Coupon>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\n// TODO: simplify the type below once the SDK is updated\n\nexport type Data = Resource<Rels.Coupon> & {\n customer_auto_apply: boolean;\n customer_attribute_restrictions: string;\n customer_subscription_restrictions: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.Coupon>;\n"]}
@@ -160,7 +160,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
160
160
  ?disabled=${ctx.data === null}
161
161
  @click=${(evt) => {
162
162
  const url = new URL(ctx.href);
163
- url.searchParams.set('zoom', 'last_transaction,transaction_template:items');
163
+ url.searchParams.set('zoom', 'transaction_template:items');
164
164
  this.__subscriptionDialog.href = url.toString();
165
165
  this.__subscriptionDialog.show(evt.currentTarget);
166
166
  }}
@@ -269,7 +269,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
269
269
  get __activeSubscriptionsLink() {
270
270
  try {
271
271
  const url = new URL(this.customer._links['fx:subscriptions'].href);
272
- url.searchParams.set('zoom', 'last_transaction,transaction_template:items');
272
+ url.searchParams.set('zoom', 'transaction_template:items');
273
273
  return url.toString();
274
274
  }
275
275
  catch (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC/F,IAAI,WAAW,GAAG,EAAE,CAAC;YAErB,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,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAA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QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
@@ -119,7 +119,9 @@ export class ItemCard extends Base {
119
119
  <div class="h-s flex items-center">
120
120
  <div class="min-w-0 flex-1 leading-s">
121
121
  <div class="flex items-center justify-between">
122
- <div class="truncate text-m font-medium">${(_h = this.data) === null || _h === void 0 ? void 0 : _h.name}</div>
122
+ <div class="truncate text-m font-medium">
123
+ ${((_h = this.data) === null || _h === void 0 ? void 0 : _h.name) || html `<foxy-i18n infer="" key="no_code"></foxy-i18n>`}
124
+ </div>
123
125
  <span class="text-s text-tertiary whitespace-nowrap">
124
126
  ${quantity} &times;
125
127
  <foxy-i18n
@@ -132,7 +134,7 @@ export class ItemCard extends Base {
132
134
  </div>
133
135
 
134
136
  <div class="truncate text-secondary text-s">
135
- ${(_j = this.data) === null || _j === void 0 ? void 0 : _j.code}
137
+ ${((_j = this.data) === null || _j === void 0 ? void 0 : _j.code) || undefined}
136
138
  ${((_k = this.data) === null || _k === void 0 ? void 0 : _k.subscription_frequency) &&
137
139
  !this.hiddenSelector.matches('autorenew-icon', true)
138
140
  ? html `
@@ -1 +1 @@
1
- {"version":3,"file":"ItemCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/ItemCard.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,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ropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'item-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Basic card displaying an item.\n *\n * @element foxy-item-card\n * @since 1.17.0\n */\nexport class ItemCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { type: String, attribute: 'locale-codes' },\n };\n }\n\n localeCodes: string | null = null;\n\n private static readonly __placeholder =\n 'data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E';\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __cartLoaderId = 'cartLoader';\n\n renderBody(): TemplateResult {\n const quantity = this.data?.quantity ?? 0;\n const options = this.data?._embedded?.['fx:item_options'];\n const price = this.data?.price ?? 0;\n\n const currencyDisplay = this.__currencyDisplay;\n const currencyCode = this.__currencyCode;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionHref)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__cartHref)}\n id=${this.__cartLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div\n class=\"flex items-start leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-s bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${ifDefined(this.data?.image)}\n alt=\"\"\n @error=${(evt: Event) => {\n const img = evt.currentTarget as HTMLImageElement;\n img.src = ItemCard.__placeholder;\n }}\n />\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"h-s flex items-center\">\n <div class=\"min-w-0 flex-1 leading-s\">\n <div class=\"flex items-center justify-between\">\n <div class=\"truncate text-m font-medium\">${this.data?.name}</div>\n <span class=\"text-s text-tertiary whitespace-nowrap\">\n ${quantity} &times;\n <foxy-i18n\n .options=${{ amount: `${price} ${currencyCode}`, currencyDisplay }}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </span>\n </div>\n\n <div class=\"truncate text-secondary text-s\">\n ${this.data?.code}\n ${this.data?.subscription_frequency &&\n !this.hiddenSelector.matches('autorenew-icon', true)\n ? html`\n <span> &bull; </span>\n <foxy-i18n\n infer=\"\"\n key=${this.__subinfoKey}\n .options=${this.__subinfoOptions}\n >\n </foxy-i18n>\n `\n : ''}\n &ZeroWidthSpace;\n </div>\n </div>\n </div>\n\n ${options && options.length > 0\n ? html`\n <div class=\"mt-m\">\n ${options.map(\n option => html`\n <div data-testclass=\"option\" class=\"flex items-center gap-s text-s leading-s\">\n <div class=\"truncate text-secondary\">\n ${option.name}: <span class=\"font-medium text-body\">${option.value}</span>\n </div>\n\n ${option.price_mod\n ? html`\n <div class=\"border-t border-dashed border-contrast-10 flex-1\"></div>\n <div class=\"whitespace-nowrap text-tertiary\">\n <foxy-i18n\n options=${JSON.stringify({\n amount: `${option.price_mod} ${currencyCode}`,\n signDisplay: 'exceptZero',\n currencyDisplay: currencyDisplay,\n })}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n const isLoaded = !!this.__currencyDisplay && !!this.__currencyCode;\n return super.isBodyReady && isLoaded;\n }\n\n private get __transactionTemplateHref() {\n try {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n const url = new URL(links?.['fx:subscription']?.href ?? '');\n url.searchParams.set('zoom', 'transaction_template');\n return url.toString();\n } catch {\n //\n }\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = (this.__cart ?? this.__transactionTemplate)?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __transactionHref() {\n return this.data?._links['fx:transaction']?.href;\n }\n\n private get __templateSetHref() {\n const cart = this.__cart ?? this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __cartHref() {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n return links?.['fx:cart']?.href;\n }\n\n private get __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.Subscription, { zoom: 'transaction_template' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:transaction_template'] ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __transaction() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n const selector = `#${this.__transactionLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __cart() {\n type Loader = NucleonElement<Resource<Rels.Cart>>;\n const selector = `#${this.__cartLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n if (this.data && !this.data._links['fx:store']) return 'symbol';\n }\n\n private get __currencyCode() {\n const transaction = this.__transaction;\n\n if (transaction) {\n return transaction.currency_code;\n } else {\n const cart = this.__cart ?? this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n }\n\n private get __subinfoOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.subscription_frequency;\n if (frequency === undefined) return;\n\n const startDate = this.data?.subscription_start_date;\n if (startDate === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n startDate,\n };\n }\n\n private get __subinfoKey() {\n const frequency = this.data?.subscription_frequency;\n if (frequency) return `subinfo_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n}\n"]}
1
+ {"version":3,"file":"ItemCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCard/ItemCard.ts"],"names":[],"mappings":"AAOA,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W,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACzF,CAAC;;AA3UuB,sBAAa,GACnC,+wDAA+wD,CAAC","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'item-card';\nconst Base = ConfigurableMixin(TranslatableMixin(InternalCard, NS));\n\n/**\n * Basic card displaying an item.\n *\n * @element foxy-item-card\n * @since 1.17.0\n */\nexport class ItemCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n localeCodes: { type: String, attribute: 'locale-codes' },\n };\n }\n\n localeCodes: string | null = null;\n\n private static readonly __placeholder =\n 'data:image/svg+xml,%3Csvg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"%3E%3Crect width=\"40\" height=\"40\" fill=\"%23E8E8E8\"/%3E%3Cpath d=\"M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z\" fill=\"white\"/%3E%3Cpath d=\"M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z\" fill=\"white\"/%3E%3Cpath d=\"M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z\" fill=\"white\"/%3E%3Cpath d=\"M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z\" fill=\"white\"/%3E%3Cpath d=\"M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z\" fill=\"white\"/%3E%3Cpath d=\"M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z\" fill=\"white\"/%3E%3Cpath d=\"M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z\" fill=\"white\"/%3E%3Cpath d=\"M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z\" fill=\"white\"/%3E%3Cpath d=\"M40 40H34.8333L40 34.8333V40Z\" fill=\"white\"/%3E%3Cpath d=\"M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z\" fill=\"white\"/%3E%3Cpath d=\"M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z\" fill=\"white\"/%3E%3Cpath d=\"M0 0H6.37152L0 6.37151V0Z\" fill=\"white\"/%3E%3Cpath d=\"M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z\" fill=\"white\"/%3E%3Cpath d=\"M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z\" fill=\"white\"/%3E%3C/svg%3E';\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __cartLoaderId = 'cartLoader';\n\n renderBody(): TemplateResult {\n const quantity = this.data?.quantity ?? 0;\n const options = this.data?._embedded?.['fx:item_options'];\n const price = this.data?.price ?? 0;\n\n const currencyDisplay = this.__currencyDisplay;\n const currencyCode = this.__currencyCode;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionHref)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__cartHref)}\n id=${this.__cartLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div\n class=\"flex items-start leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-s bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${ifDefined(this.data?.image)}\n alt=\"\"\n @error=${(evt: Event) => {\n const img = evt.currentTarget as HTMLImageElement;\n img.src = ItemCard.__placeholder;\n }}\n />\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"h-s flex items-center\">\n <div class=\"min-w-0 flex-1 leading-s\">\n <div class=\"flex items-center justify-between\">\n <div class=\"truncate text-m font-medium\">\n ${this.data?.name || html`<foxy-i18n infer=\"\" key=\"no_code\"></foxy-i18n>`}\n </div>\n <span class=\"text-s text-tertiary whitespace-nowrap\">\n ${quantity} &times;\n <foxy-i18n\n .options=${{ amount: `${price} ${currencyCode}`, currencyDisplay }}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </span>\n </div>\n\n <div class=\"truncate text-secondary text-s\">\n ${this.data?.code || undefined}\n ${this.data?.subscription_frequency &&\n !this.hiddenSelector.matches('autorenew-icon', true)\n ? html`\n <span> &bull; </span>\n <foxy-i18n\n infer=\"\"\n key=${this.__subinfoKey}\n .options=${this.__subinfoOptions}\n >\n </foxy-i18n>\n `\n : ''}\n &ZeroWidthSpace;\n </div>\n </div>\n </div>\n\n ${options && options.length > 0\n ? html`\n <div class=\"mt-m\">\n ${options.map(\n option => html`\n <div data-testclass=\"option\" class=\"flex items-center gap-s text-s leading-s\">\n <div class=\"truncate text-secondary\">\n ${option.name}: <span class=\"font-medium text-body\">${option.value}</span>\n </div>\n\n ${option.price_mod\n ? html`\n <div class=\"border-t border-dashed border-contrast-10 flex-1\"></div>\n <div class=\"whitespace-nowrap text-tertiary\">\n <foxy-i18n\n options=${JSON.stringify({\n amount: `${option.price_mod} ${currencyCode}`,\n signDisplay: 'exceptZero',\n currencyDisplay: currencyDisplay,\n })}\n key=\"price\"\n infer=\"\"\n >\n </foxy-i18n>\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n const isLoaded = !!this.__currencyDisplay && !!this.__currencyCode;\n return super.isBodyReady && isLoaded;\n }\n\n private get __transactionTemplateHref() {\n try {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n const url = new URL(links?.['fx:subscription']?.href ?? '');\n url.searchParams.set('zoom', 'transaction_template');\n return url.toString();\n } catch {\n //\n }\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = (this.__cart ?? this.__transactionTemplate)?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __transactionHref() {\n return this.data?._links['fx:transaction']?.href;\n }\n\n private get __templateSetHref() {\n const cart = this.__cart ?? this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __cartHref() {\n const links = this.data?._links as Partial<Record<string, { href: string }>> | undefined;\n return links?.['fx:cart']?.href;\n }\n\n private get __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.Subscription, { zoom: 'transaction_template' }>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:transaction_template'] ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __transaction() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n const selector = `#${this.__transactionLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __cart() {\n type Loader = NucleonElement<Resource<Rels.Cart>>;\n const selector = `#${this.__cartLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __currencyDisplay() {\n const useCode = this.__store?.use_international_currency_symbol;\n\n if (useCode === true) return 'code';\n if (useCode === false) return 'symbol';\n if (this.data && !this.data._links['fx:store']) return 'symbol';\n }\n\n private get __currencyCode() {\n const transaction = this.__transaction;\n\n if (transaction) {\n return transaction.currency_code;\n } else {\n const cart = this.__cart ?? this.__transactionTemplate;\n\n if (cart?.currency_code) {\n return cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) return /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1];\n }\n }\n }\n\n private get __subinfoOptions() {\n const currencyDisplay = this.__currencyDisplay;\n if (currencyDisplay === undefined) return;\n\n const currencyCode = this.__currencyCode;\n if (currencyCode === undefined) return;\n\n const totalOrder = this.__transactionTemplate?.total_order;\n if (totalOrder === undefined) return;\n\n const frequency = this.data?.subscription_frequency;\n if (frequency === undefined) return;\n\n const startDate = this.data?.subscription_start_date;\n if (startDate === undefined) return;\n\n return {\n ...parseFrequency(frequency),\n amount: `${totalOrder} ${currencyCode}`,\n currencyDisplay,\n startDate,\n };\n }\n\n private get __subinfoKey() {\n const frequency = this.data?.subscription_frequency;\n if (frequency) return `subinfo_${frequency === '.5m' ? 'twice_a_month' : 'recurring'}`;\n }\n}\n"]}
@@ -481,6 +481,7 @@ export class Item extends SignableFields {
481
481
  e.currency = this.currency;
482
482
  e.isItem = false;
483
483
  e.isChildItem = true;
484
+ e.setAttribute('data-bundled', '');
484
485
  if (this.code) {
485
486
  e.parent_code = this.code;
486
487
  }