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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +4 -0
  2. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  3. package/dist/cdn/foxy-address-card.js +1 -1
  4. package/dist/cdn/foxy-address-form.js +1 -1
  5. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  6. package/dist/cdn/foxy-api-browser.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  8. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-card.js +1 -1
  11. package/dist/cdn/foxy-attribute-form.js +1 -1
  12. package/dist/cdn/foxy-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-collection-page.js +1 -1
  16. package/dist/cdn/foxy-collection-pages.js +1 -1
  17. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  18. package/dist/cdn/foxy-coupon-card.js +1 -1
  19. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  20. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  21. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  22. package/dist/cdn/foxy-coupon-form.js +1 -1
  23. package/dist/cdn/foxy-custom-field-card.js +1 -1
  24. package/dist/cdn/foxy-custom-field-form.js +1 -1
  25. package/dist/cdn/foxy-customer-api.js +1 -1
  26. package/dist/cdn/foxy-customer-card.js +1 -1
  27. package/dist/cdn/foxy-customer-form.js +1 -1
  28. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  29. package/dist/cdn/foxy-customer-portal.js +1 -1
  30. package/dist/cdn/foxy-customer.js +6 -6
  31. package/dist/cdn/foxy-customers-table.js +1 -1
  32. package/dist/cdn/foxy-discount-builder.js +1 -1
  33. package/dist/cdn/foxy-discount-card.js +1 -1
  34. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  35. package/dist/cdn/foxy-donation.js +1 -1
  36. package/dist/cdn/foxy-email-template-card.js +1 -1
  37. package/dist/cdn/foxy-email-template-form.js +1 -1
  38. package/dist/cdn/foxy-error-entry-card.js +1 -1
  39. package/dist/cdn/foxy-form-dialog.js +1 -1
  40. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  41. package/dist/cdn/foxy-gift-card-card.js +1 -1
  42. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  43. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  44. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  45. package/dist/cdn/foxy-gift-card-form.js +1 -1
  46. package/dist/cdn/foxy-i18n-editor.js +2 -2
  47. package/dist/cdn/foxy-i18n.js +1 -1
  48. package/dist/cdn/foxy-integration-card.js +1 -1
  49. package/dist/cdn/foxy-integration-form.js +1 -1
  50. package/dist/cdn/foxy-item-card.js +1 -1
  51. package/dist/cdn/foxy-item-category-card.js +1 -1
  52. package/dist/cdn/foxy-item-category-form.js +1 -1
  53. package/dist/cdn/foxy-item-form.js +1 -1
  54. package/dist/cdn/foxy-item-option-card.js +1 -1
  55. package/dist/cdn/foxy-item-option-form.js +1 -1
  56. package/dist/cdn/foxy-items-form.js +1 -1
  57. package/dist/cdn/foxy-nucleon-element.js +1 -1
  58. package/dist/cdn/foxy-pagination.js +1 -1
  59. package/dist/cdn/foxy-payment-card.js +1 -1
  60. package/dist/cdn/foxy-payment-method-card.js +1 -1
  61. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  62. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  63. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  64. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  65. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  66. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  67. package/dist/cdn/foxy-payments-api.js +1 -1
  68. package/dist/cdn/foxy-query-builder.js +1 -1
  69. package/dist/cdn/foxy-report-form.js +1 -1
  70. package/dist/cdn/foxy-reports-table.js +5 -5
  71. package/dist/cdn/foxy-shipment-card.js +1 -1
  72. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  73. package/dist/cdn/foxy-sign-in-form.js +1 -1
  74. package/dist/cdn/foxy-spinner.js +1 -1
  75. package/dist/cdn/foxy-store-form.js +1 -1
  76. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  77. package/dist/cdn/foxy-subscription-card.js +1 -1
  78. package/dist/cdn/foxy-subscription-form.js +2 -2
  79. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  80. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  81. package/dist/cdn/foxy-table.js +1 -1
  82. package/dist/cdn/foxy-tax-card.js +1 -1
  83. package/dist/cdn/foxy-tax-form.js +1 -1
  84. package/dist/cdn/foxy-template-config-form.js +1 -1
  85. package/dist/cdn/foxy-template-form.js +1 -1
  86. package/dist/cdn/foxy-template-set-card.js +1 -1
  87. package/dist/cdn/foxy-template-set-form.js +1 -1
  88. package/dist/cdn/foxy-transaction-card.js +1 -1
  89. package/dist/cdn/foxy-transaction.js +1 -1
  90. package/dist/cdn/foxy-transactions-table.js +7 -7
  91. package/dist/cdn/foxy-user-form.js +1 -1
  92. package/dist/cdn/foxy-users-table.js +1 -1
  93. package/dist/cdn/foxy-webhook-card.js +1 -1
  94. package/dist/cdn/foxy-webhook-form.js +1 -1
  95. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  96. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  97. package/dist/cdn/shared-11438c42.js +1 -0
  98. package/dist/cdn/{shared-868065de.js → shared-1433fc29.js} +1 -1
  99. package/dist/cdn/{shared-a37abe4c.js → shared-242b3ee9.js} +1 -1
  100. package/dist/cdn/{shared-988ec916.js → shared-274c49b0.js} +1 -1
  101. package/dist/cdn/{shared-ea67b3f3.js → shared-38b37888.js} +1 -1
  102. package/dist/cdn/{shared-8dd0af4d.js → shared-3d241b7f.js} +1 -1
  103. package/dist/cdn/{shared-d518bd55.js → shared-3dbe9aaa.js} +1 -1
  104. package/dist/cdn/{shared-de036570.js → shared-454f172e.js} +1 -1
  105. package/dist/cdn/shared-45926e43.js +1 -0
  106. package/dist/cdn/{shared-839dd3a8.js → shared-531bb690.js} +1 -1
  107. package/dist/cdn/{shared-d61b3e4f.js → shared-5c804971.js} +1 -1
  108. package/dist/cdn/{shared-4393ad93.js → shared-61e74612.js} +1 -1
  109. package/dist/cdn/{shared-486d7bb5.js → shared-62d636b5.js} +1 -1
  110. package/dist/cdn/{shared-43bcce74.js → shared-67546e10.js} +1 -1
  111. package/dist/cdn/{shared-bb0e33c3.js → shared-6f5c3101.js} +1 -1
  112. package/dist/cdn/{shared-0821cfdc.js → shared-7097364f.js} +1 -1
  113. package/dist/cdn/{shared-2add595d.js → shared-747b6d74.js} +1 -1
  114. package/dist/cdn/{shared-8b6addec.js → shared-758859b5.js} +1 -1
  115. package/dist/cdn/{shared-af226a9a.js → shared-81f9dc9a.js} +1 -1
  116. package/dist/cdn/{shared-6581241a.js → shared-8c11a711.js} +1 -1
  117. package/dist/cdn/{shared-80fc2b6a.js → shared-8f8abcd6.js} +1 -1
  118. package/dist/cdn/shared-94fc438b.js +1 -0
  119. package/dist/cdn/{shared-a85afa33.js → shared-955db6b4.js} +1 -1
  120. package/dist/cdn/{shared-62a54a6c.js → shared-9f905d9f.js} +1 -1
  121. package/dist/cdn/{shared-39c10b22.js → shared-a01b5597.js} +1 -1
  122. package/dist/cdn/shared-a29b600a.js +1 -0
  123. package/dist/cdn/{shared-b40cf0dd.js → shared-a2d619b4.js} +1 -1
  124. package/dist/cdn/{shared-63139d9e.js → shared-a5364194.js} +1 -1
  125. package/dist/cdn/{shared-1c94a156.js → shared-be99323d.js} +1 -1
  126. package/dist/cdn/{shared-c774d080.js → shared-c6a01446.js} +1 -1
  127. package/dist/cdn/{shared-c95c17e6.js → shared-c8f5c306.js} +1 -1
  128. package/dist/cdn/{shared-a41234b4.js → shared-ca87cf22.js} +1 -1
  129. package/dist/cdn/{shared-4979dca4.js → shared-cbdf08d8.js} +1 -1
  130. package/dist/cdn/{shared-f80f402a.js → shared-d3bf404a.js} +1 -1
  131. package/dist/cdn/{shared-744cf66b.js → shared-d807ae5c.js} +1 -1
  132. package/dist/cdn/shared-dc91f7ae.js +1 -0
  133. package/dist/cdn/{shared-76b3d76a.js → shared-dcdb6ea1.js} +1 -1
  134. package/dist/cdn/{shared-9bdacf65.js → shared-e262920d.js} +1 -1
  135. package/dist/cdn/{shared-2f7dcefa.js → shared-e3ab56d1.js} +1 -1
  136. package/dist/cdn/{shared-cba08e1c.js → shared-ee5a7812.js} +1 -1
  137. package/dist/cdn/shared-efa137cd.js +1 -0
  138. package/dist/cdn/{shared-71f2ef1f.js → shared-efc1aeae.js} +1 -1
  139. package/dist/cdn/{shared-101d1234.js → shared-f621ccee.js} +1 -1
  140. package/dist/cdn/translations/cart-form/en.json +4 -4
  141. package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js +13 -7
  142. package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js.map +1 -1
  143. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +2 -2
  144. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +33 -33
  145. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
  146. package/dist/elements/internal/InternalAsyncListControl/index.d.ts +0 -2
  147. package/dist/elements/internal/InternalAsyncListControl/index.js +0 -2
  148. package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
  149. package/dist/elements/internal/InternalCalendar/InternalCalendar.js +2 -2
  150. package/dist/elements/internal/InternalCalendar/InternalCalendar.js.map +1 -1
  151. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +2 -7
  152. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
  153. package/dist/elements/public/AppliedCouponCodeForm/types.d.ts +1 -3
  154. package/dist/elements/public/AppliedCouponCodeForm/types.js.map +1 -1
  155. package/dist/elements/public/CartCard/CartCard.js +2 -7
  156. package/dist/elements/public/CartCard/CartCard.js.map +1 -1
  157. package/dist/elements/public/CartForm/CartForm.js +1 -3
  158. package/dist/elements/public/CartForm/CartForm.js.map +1 -1
  159. package/dist/elements/public/CollectionPage/CollectionPage.d.ts +2 -2
  160. package/dist/elements/public/CollectionPage/CollectionPage.js +6 -5
  161. package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
  162. package/dist/elements/public/CouponForm/CouponForm.js +5 -1
  163. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  164. package/dist/elements/public/Customer/Customer.js +2 -2
  165. package/dist/elements/public/Customer/Customer.js.map +1 -1
  166. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +0 -1
  167. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  168. package/dist/elements/public/ItemCard/ItemCard.js +2 -7
  169. package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
  170. package/dist/elements/public/ItemForm/ItemForm.js +6 -23
  171. package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
  172. package/dist/elements/public/ItemOptionCard/ItemOptionCard.d.ts +3 -0
  173. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js +31 -27
  174. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js.map +1 -1
  175. package/dist/elements/public/ItemOptionCard/index.d.ts +0 -2
  176. package/dist/elements/public/ItemOptionCard/index.js +0 -2
  177. package/dist/elements/public/ItemOptionCard/index.js.map +1 -1
  178. package/dist/elements/public/NucleonElement/NucleonElement.js +4 -4
  179. package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
  180. package/dist/elements/public/QueryBuilder/components/RangeValue.js +6 -6
  181. package/dist/elements/public/QueryBuilder/components/RangeValue.js.map +1 -1
  182. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +2 -1
  183. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  184. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +2 -7
  185. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  186. package/dist/elements/public/SubscriptionForm/types.d.ts +1 -1
  187. package/dist/elements/public/SubscriptionForm/types.js.map +1 -1
  188. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js.map +1 -1
  189. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.d.ts +2 -2
  190. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +2 -2
  191. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
  192. package/dist/elements/public/SubscriptionsTable/types.d.ts +2 -2
  193. package/dist/elements/public/SubscriptionsTable/types.js.map +1 -1
  194. package/dist/elements/public/TaxCard/TaxCard.js +6 -2
  195. package/dist/elements/public/TaxCard/TaxCard.js.map +1 -1
  196. package/package.json +6 -5
  197. package/dist/cdn/shared-09eb558f.js +0 -1
  198. package/dist/cdn/shared-1000b848.js +0 -1
  199. package/dist/cdn/shared-181f51bd.js +0 -1
  200. package/dist/cdn/shared-21679ebd.js +0 -1
  201. package/dist/cdn/shared-a0c8faf2.js +0 -1
  202. package/dist/cdn/shared-bcc6e13b.js +0 -1
@@ -423,9 +423,7 @@ export class SubscriptionForm extends Base {
423
423
  const currencyDisplay = ((_c = this.__store) === null || _c === void 0 ? void 0 : _c.use_international_currency_symbol) ? 'code' : 'symbol';
424
424
  const cart = this.__transactionTemplate;
425
425
  let currencyCode = null;
426
- if (cart && 'currency_code' in cart) {
427
- // TODO: remove the directive below once the SDK is updated
428
- // @ts-expect-error SDK types are incomplete
426
+ if (cart === null || cart === void 0 ? void 0 : cart.currency_code) {
429
427
  currencyCode = cart.currency_code;
430
428
  }
431
429
  else {
@@ -552,10 +550,7 @@ export class SubscriptionForm extends Base {
552
550
  }
553
551
  get __templateSetHref() {
554
552
  const cart = this.__transactionTemplate;
555
- // TODO: remove the directive below once SDK is updated
556
- // @ts-expect-error SDK types are incomplete
557
- const currencyCode = cart === null || cart === void 0 ? void 0 : cart.currency_code;
558
- if (!currencyCode)
553
+ if (!(cart === null || cart === void 0 ? void 0 : cart.currency_code))
559
554
  return (cart === null || cart === void 0 ? void 0 : cart.template_set_uri) || void 0;
560
555
  }
561
556
  get __storeHref() {
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,mBAAmB,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvF;;;;;;;;;;;;;;;;;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C,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { Data, Settings, Templates, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\nimport type { FormDialog } from '../FormDialog';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @slot attributes:before - **new in v1.20.0**\n * @slot attributes:after - **new in v1.20.0**\n *\n * @slot timestamps:before - **new in v1.20.0**\n * @slot timestamps:after - **new in v1.20.0**\n *\n * @slot past-due-amount:before - **new in v1.20.0**\n * @slot past-due-amount:after - **new in v1.20.0**\n *\n * @slot start-date:before - **new in v1.20.0**\n * @slot start-date:after - **new in v1.20.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n templates: Templates = {};\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = (\n currency: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n\n if (typeof currency !== 'string') return html`--`;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({\n ...frequency,\n amount: `${total} ${currency}`,\n currencyDisplay,\n })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = (\n currencyCode: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n return html`\n <div data-testid=\"header\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold truncate\">\n ${this.__renderHeaderTitle(currencyCode, currencyDisplay)}\n </div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1 text-s font-medium text-secondary\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n limit=\"5\"\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${ns}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const cart = this.__transactionTemplate;\n\n let currencyCode: string | null = null;\n\n if (cart && 'currency_code' in cart) {\n // TODO: remove the directive below once the SDK is updated\n // @ts-expect-error SDK types are incomplete\n currencyCode = 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) currencyCode = /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n }\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.__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 <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n ${this.hiddenSelector.matches('header', true)\n ? ''\n : this.__renderHeader(currencyCode ?? void 0, currencyDisplay)}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n return this.data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = 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 __templateSetHref() {\n const cart = this.__transactionTemplate;\n // TODO: remove the directive below once SDK is updated\n // @ts-expect-error SDK types are incomplete\n const currencyCode = cart?.currency_code as string | undefined;\n\n if (!currencyCode) 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 __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? 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 __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 __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
1
+ {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,mBAAmB,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAU;IAAhD;;QAoCE,2BAAsB,GAA0B,CAAC,CAAC,EAAE,IAAS,EAAE,EAAE;YAC/D,OAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC;QACzC,CAAC,CAAC;QAEF,sBAAiB,GAAkB,IAAI,CAAC;QAExC,mBAAc,GAAkB,IAAI,CAAC;QAErC,gBAAW,GAAkB,IAAI,CAAC;QAElC,cAAS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QAAQ,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE;YAAE,OAAO,KAAK,CAAC;QAC7F,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAChD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAExC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;IACzC,CAAC;IAED,IAAY,aAAa;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAE7D,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { Data, Settings, Templates, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\nimport type { FormDialog } from '../FormDialog';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @slot attributes:before - **new in v1.20.0**\n * @slot attributes:after - **new in v1.20.0**\n *\n * @slot timestamps:before - **new in v1.20.0**\n * @slot timestamps:after - **new in v1.20.0**\n *\n * @slot past-due-amount:before - **new in v1.20.0**\n * @slot past-due-amount:after - **new in v1.20.0**\n *\n * @slot start-date:before - **new in v1.20.0**\n * @slot start-date:after - **new in v1.20.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n templates: Templates = {};\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = (\n currency: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n\n if (typeof currency !== 'string') return html`--`;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({\n ...frequency,\n amount: `${total} ${currency}`,\n currencyDisplay,\n })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = (\n currencyCode: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n return html`\n <div data-testid=\"header\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold truncate\">\n ${this.__renderHeaderTitle(currencyCode, currencyDisplay)}\n </div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1 text-s font-medium text-secondary\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n limit=\"5\"\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${ns}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const cart = this.__transactionTemplate;\n\n let currencyCode: string | null = null;\n\n if (cart?.currency_code) {\n currencyCode = 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) currencyCode = /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n }\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.__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 <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n ${this.hiddenSelector.matches('header', true)\n ? ''\n : this.__renderHeader(currencyCode ?? void 0, currencyDisplay)}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n return this.data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = 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 __templateSetHref() {\n const 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 __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? 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 __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 __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
@@ -4,7 +4,7 @@ import { Resource } from '@foxy.io/sdk/core';
4
4
  import { Renderer } from '../../../mixins/configurable';
5
5
  import { SubscriptionForm } from '.';
6
6
  import { CancellationForm } from '../CancellationForm/CancellationForm';
7
- export declare type TransactionPageGetter = (href: string, data: Resource<Rels.Transaction> | null) => string;
7
+ export declare type TransactionPageGetter = (href: string, data: Resource<Rels.Transaction> | Resource<BackendRels.Transaction> | null) => string;
8
8
  export declare type Settings = Resource<Rels.CustomerPortalSettings>;
9
9
  export declare type Item = Resource<Rels.Item>;
10
10
  export declare type Data = Resource<BackendRels.Subscription>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels as BackendRels } from '@foxy.io/sdk/backend';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Renderer } from '../../../mixins/configurable';\nimport { SubscriptionForm } from '.';\nimport { CancellationForm } from '../CancellationForm/CancellationForm';\n\nexport type TransactionPageGetter = (\n href: string,\n data: Resource<Rels.Transaction> | null\n) => string;\n\nexport type Settings = Resource<Rels.CustomerPortalSettings>;\nexport type Item = Resource<Rels.Item>;\nexport type Data = Resource<BackendRels.Subscription>;\n\nexport type Templates = {\n 'header:before'?: Renderer<SubscriptionForm>;\n 'header:after'?: Renderer<SubscriptionForm>;\n 'items:before'?: Renderer<SubscriptionForm>;\n 'items:after'?: Renderer<SubscriptionForm>;\n 'items:actions:before'?: Renderer<SubscriptionForm>;\n 'items:actions:after'?: Renderer<SubscriptionForm>;\n 'end-date:before'?: Renderer<SubscriptionForm>;\n 'end-date:after'?: Renderer<SubscriptionForm>;\n 'end-date:form:warning:before'?: Renderer<CancellationForm>;\n 'end-date:form:warning:after'?: Renderer<CancellationForm>;\n 'end-date:form:end-date:before'?: Renderer<CancellationForm>;\n 'end-date:form:end-date:after'?: Renderer<CancellationForm>;\n 'end-date:form:submit:before'?: Renderer<CancellationForm>;\n 'end-date:form:submit:after'?: Renderer<CancellationForm>;\n 'next-transaction-date:before'?: Renderer<SubscriptionForm>;\n 'next-transaction-date:after'?: Renderer<SubscriptionForm>;\n 'frequency:before'?: Renderer<SubscriptionForm>;\n 'frequency:after'?: Renderer<SubscriptionForm>;\n 'transactions:before'?: Renderer<SubscriptionForm>;\n 'transactions:after'?: Renderer<SubscriptionForm>;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels as BackendRels } from '@foxy.io/sdk/backend';\nimport { Rels } from '@foxy.io/sdk/customer';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { Renderer } from '../../../mixins/configurable';\nimport { SubscriptionForm } from '.';\nimport { CancellationForm } from '../CancellationForm/CancellationForm';\n\nexport type TransactionPageGetter = (\n href: string,\n data: Resource<Rels.Transaction> | Resource<BackendRels.Transaction> | null\n) => string;\n\nexport type Settings = Resource<Rels.CustomerPortalSettings>;\nexport type Item = Resource<Rels.Item>;\nexport type Data = Resource<BackendRels.Subscription>;\n\nexport type Templates = {\n 'header:before'?: Renderer<SubscriptionForm>;\n 'header:after'?: Renderer<SubscriptionForm>;\n 'items:before'?: Renderer<SubscriptionForm>;\n 'items:after'?: Renderer<SubscriptionForm>;\n 'items:actions:before'?: Renderer<SubscriptionForm>;\n 'items:actions:after'?: Renderer<SubscriptionForm>;\n 'end-date:before'?: Renderer<SubscriptionForm>;\n 'end-date:after'?: Renderer<SubscriptionForm>;\n 'end-date:form:warning:before'?: Renderer<CancellationForm>;\n 'end-date:form:warning:after'?: Renderer<CancellationForm>;\n 'end-date:form:end-date:before'?: Renderer<CancellationForm>;\n 'end-date:form:end-date:after'?: Renderer<CancellationForm>;\n 'end-date:form:submit:before'?: Renderer<CancellationForm>;\n 'end-date:form:submit:after'?: Renderer<CancellationForm>;\n 'next-transaction-date:before'?: Renderer<SubscriptionForm>;\n 'next-transaction-date:after'?: Renderer<SubscriptionForm>;\n 'frequency:before'?: Renderer<SubscriptionForm>;\n 'frequency:after'?: Renderer<SubscriptionForm>;\n 'transactions:before'?: Renderer<SubscriptionForm>;\n 'transactions:after'?: Renderer<SubscriptionForm>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"globalStyles.js","sourceRoot":"","sources":["../../../../../../src/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG;;;;;;;;;;;;;;;CAgBxC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG;;;;;;;CAQzC,CAAC","sourcesContent":["import { css } from 'lit-element';\n\nexport const vaadinRadioGroupStyles = css`\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) label {\n padding-bottom: var(--lumo-space-xs);\n }\n\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part='group-field'] {\n display: flex;\n border: thin solid var(--lumo-contrast-10pct);\n border-radius: var(--lumo-border-radius);\n transition: border-color 0.15s ease;\n }\n\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover)\n [part='group-field'] {\n border-color: var(--lumo-contrast-20pct);\n }\n`;\n\nexport const vaadinRadioButtonStyles = css`\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) label {\n display: flex;\n }\n\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part='label'] {\n flex: 1;\n }\n`;\n"]}
1
+ {"version":3,"file":"globalStyles.js","sourceRoot":"","sources":["../../../../../../src/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG;;;;;;;;;;;;;;;CAiBxC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG;;;;;;;CAQzC,CAAC","sourcesContent":["import { css } from 'lit-element';\n\nexport const vaadinRadioGroupStyles = css`\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) label {\n padding-bottom: var(--lumo-space-xs);\n }\n\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part='group-field'] {\n display: flex;\n border: thin solid var(--lumo-contrast-10pct);\n border-radius: var(--lumo-border-radius);\n transition: border-color 0.15s ease;\n }\n\n /* prettier-ignore */\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover)\n [part='group-field'] {\n border-color: var(--lumo-contrast-20pct);\n }\n`;\n\nexport const vaadinRadioButtonStyles = css`\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) label {\n display: flex;\n }\n\n :host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part='label'] {\n flex: 1;\n }\n`;\n"]}
@@ -10,9 +10,9 @@ export declare class SubscriptionsTable extends SubscriptionsTable_base<Data> {
10
10
  static statusColumn: Column<Data>;
11
11
  static subTokenURLColumn: Column<Data>;
12
12
  columns: Column<import("@foxy.io/sdk/core").Resource<import("@foxy.io/sdk/dist/types/backend/Rels").Subscriptions, {
13
- zoom: [{
13
+ zoom: {
14
14
  transaction_template: "items";
15
- }, "last_transaction"];
15
+ };
16
16
  }>>[];
17
17
  }
18
18
  export {};
@@ -14,8 +14,8 @@ export class SubscriptionsTable extends TranslatableMixin(Table, 'subscriptions-
14
14
  }
15
15
  SubscriptionsTable.priceColumn = {
16
16
  cell: ctx => {
17
- const transaction = ctx.data._embedded['fx:last_transaction'];
18
- const amount = `${transaction.total_order} ${transaction.currency_code}`;
17
+ const cart = ctx.data._embedded['fx:transaction_template'];
18
+ const amount = `${cart.total_order} ${cart.currency_code}`;
19
19
  return ctx.html `
20
20
  <foxy-i18n
21
21
  data-testclass="i18n frequencies"
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionsTable.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/SubscriptionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,0BAAuB;AACvC,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,CAAO;IAA7F;;QA2GE,YAAO,GAAG;YACR,kBAAkB,CAAC,WAAW;YAC9B,kBAAkB,CAAC,aAAa;YAChC,kBAAkB,CAAC,YAAY;YAC/B,kBAAkB,CAAC,iBAAiB;SACrC,CAAC;IACJ,CAAC;;AAhHQ,8BAAW,GAAiB;IACjC,I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C,CAAC,IAAI;;;;mBAItC,GAAG,CAAC,IAAI;;iBAEV,GAAG,CAAC,EAAE;;;;OAIhB,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { Column } from '../Table/types';\nimport { Data } from './types';\nimport { Table } from '../Table/Table';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\n\nexport class SubscriptionsTable extends TranslatableMixin(Table, 'subscriptions-table')<Data> {\n static priceColumn: Column<Data> = {\n cell: ctx => {\n const transaction = ctx.data._embedded['fx:last_transaction'];\n const amount = `${transaction.total_order} ${transaction.currency_code}`;\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n frequencies\"\n class=\"font-semibold text-m font-tnum\"\n lang=${ctx.lang}\n key=\"price_${ctx.data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ctx.ns}\n .options=${{ ...parseFrequency(ctx.data.frequency), amount }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static summaryColumn: Column<Data> = {\n cell: ctx => {\n const items = ctx.data._embedded['fx:transaction_template']._embedded['fx:items'];\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n summaries\"\n class=\"text-m\"\n lang=${ctx.lang}\n key=\"transaction_summary\"\n ns=${ctx.ns}\n .options=${options}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static statusColumn: Column<Data> = {\n hideBelow: 'md',\n cell: ctx => {\n let color: string;\n let date: string;\n let key: string;\n\n if (ctx.data.first_failed_transaction_date) {\n date = ctx.data.first_failed_transaction_date;\n key = 'subscription_failed';\n color = 'bg-error-10 text-error';\n } else if (ctx.data.end_date) {\n date = ctx.data.end_date;\n const dateAsObject = new Date(date);\n const hasEnded = dateAsObject.getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n color = hasEnded ? 'bg-success-10 text-success' : 'bg-contrast-5 text-tertiary';\n } else {\n date = ctx.data.next_transaction_date;\n\n if (ctx.data.is_active) {\n key = 'subscription_active';\n color = 'bg-success-10 text-success';\n } else {\n key = 'subscription_inactive';\n color = 'bg-contrast-5 text-tertiary';\n }\n }\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n statuses\"\n class=\"px-s py-xs text-m font-semibold rounded ${color}\"\n lang=${ctx.lang}\n key=${key}\n ns=${ctx.ns}\n .options=${{ date }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static subTokenURLColumn: Column<Data> = {\n cell: ctx => {\n return ctx.html`\n <a\n data-testclass=\"links\"\n target=\"_blank\"\n class=\"text-m font-semibold text-primary rounded hover-underline focus-outline-none focus-shadow-outline\"\n href=${ctx.data._links['fx:sub_token_url'].href}\n >\n <foxy-i18n\n data-testclass=\"i18n\"\n lang=${ctx.lang}\n key=\"update\"\n ns=${ctx.ns}\n >\n </foxy-i18n>\n </a>\n `;\n },\n };\n\n columns = [\n SubscriptionsTable.priceColumn,\n SubscriptionsTable.summaryColumn,\n SubscriptionsTable.statusColumn,\n SubscriptionsTable.subTokenURLColumn,\n ];\n}\n"]}
1
+ {"version":3,"file":"SubscriptionsTable.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/SubscriptionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,0BAAuB;AACvC,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,CAAO;IAA7F;;QA2GE,YAAO,GAAG;YACR,kBAAkB,CAAC,WAAW;YAC9B,kBAAkB,CAAC,aAAa;YAChC,kBAAkB,CAAC,YAAY;YAC/B,kBAAkB,CAAC,iBAAiB;SACrC,CAAC;IACJ,CAAC;;AAhHQ,8BAAW,GAAiB;IACjC,IAAI,E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C,IAAI;;;;mBAItC,GAAG,CAAC,IAAI;;iBAEV,GAAG,CAAC,EAAE;;;;OAIhB,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { Column } from '../Table/types';\nimport { Data } from './types';\nimport { Table } from '../Table/Table';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { parseFrequency } from '../../../utils/parse-frequency';\n\nexport class SubscriptionsTable extends TranslatableMixin(Table, 'subscriptions-table')<Data> {\n static priceColumn: Column<Data> = {\n cell: ctx => {\n const cart = ctx.data._embedded['fx:transaction_template'];\n const amount = `${cart.total_order} ${cart.currency_code}`;\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n frequencies\"\n class=\"font-semibold text-m font-tnum\"\n lang=${ctx.lang}\n key=\"price_${ctx.data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ctx.ns}\n .options=${{ ...parseFrequency(ctx.data.frequency), amount }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static summaryColumn: Column<Data> = {\n cell: ctx => {\n const items = ctx.data._embedded['fx:transaction_template']._embedded['fx:items'];\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n summaries\"\n class=\"text-m\"\n lang=${ctx.lang}\n key=\"transaction_summary\"\n ns=${ctx.ns}\n .options=${options}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static statusColumn: Column<Data> = {\n hideBelow: 'md',\n cell: ctx => {\n let color: string;\n let date: string;\n let key: string;\n\n if (ctx.data.first_failed_transaction_date) {\n date = ctx.data.first_failed_transaction_date;\n key = 'subscription_failed';\n color = 'bg-error-10 text-error';\n } else if (ctx.data.end_date) {\n date = ctx.data.end_date;\n const dateAsObject = new Date(date);\n const hasEnded = dateAsObject.getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n color = hasEnded ? 'bg-success-10 text-success' : 'bg-contrast-5 text-tertiary';\n } else {\n date = ctx.data.next_transaction_date;\n\n if (ctx.data.is_active) {\n key = 'subscription_active';\n color = 'bg-success-10 text-success';\n } else {\n key = 'subscription_inactive';\n color = 'bg-contrast-5 text-tertiary';\n }\n }\n\n return ctx.html`\n <foxy-i18n\n data-testclass=\"i18n statuses\"\n class=\"px-s py-xs text-m font-semibold rounded ${color}\"\n lang=${ctx.lang}\n key=${key}\n ns=${ctx.ns}\n .options=${{ date }}\n >\n </foxy-i18n>\n `;\n },\n };\n\n static subTokenURLColumn: Column<Data> = {\n cell: ctx => {\n return ctx.html`\n <a\n data-testclass=\"links\"\n target=\"_blank\"\n class=\"text-m font-semibold text-primary rounded hover-underline focus-outline-none focus-shadow-outline\"\n href=${ctx.data._links['fx:sub_token_url'].href}\n >\n <foxy-i18n\n data-testclass=\"i18n\"\n lang=${ctx.lang}\n key=\"update\"\n ns=${ctx.ns}\n >\n </foxy-i18n>\n </a>\n `;\n },\n };\n\n columns = [\n SubscriptionsTable.priceColumn,\n SubscriptionsTable.summaryColumn,\n SubscriptionsTable.statusColumn,\n SubscriptionsTable.subTokenURLColumn,\n ];\n}\n"]}
@@ -2,8 +2,8 @@ import type * as FoxySDK from '@foxy.io/sdk';
2
2
  import { Templates as TableTemplates } from '../Table/types';
3
3
  export declare type Rel = FoxySDK.Backend.Rels.Subscriptions;
4
4
  export declare type Data = FoxySDK.Core.Resource<Rel, {
5
- zoom: [{
5
+ zoom: {
6
6
  transaction_template: 'items';
7
- }, 'last_transaction'];
7
+ };
8
8
  }>;
9
9
  export declare type Templates = TableTemplates<Data>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as FoxySDK from '@foxy.io/sdk';\n\nimport { Templates as TableTemplates } from '../Table/types';\n\nexport type Rel = FoxySDK.Backend.Rels.Subscriptions;\nexport type Data = FoxySDK.Core.Resource<\n Rel,\n { zoom: [{ transaction_template: 'items' }, 'last_transaction'] }\n>;\n\nexport type Templates = TableTemplates<Data>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionsTable/types.ts"],"names":[],"mappings":"","sourcesContent":["import type * as FoxySDK from '@foxy.io/sdk';\n\nimport { Templates as TableTemplates } from '../Table/types';\n\nexport type Rel = FoxySDK.Backend.Rels.Subscriptions;\nexport type Data = FoxySDK.Core.Resource<Rel, { zoom: { transaction_template: 'items' } }>;\nexport type Templates = TableTemplates<Data>;\n"]}
@@ -19,8 +19,12 @@ export class TaxCard extends TranslatableMixin(ConfigurableMixin(InternalCard),
19
19
  const data = this.data;
20
20
  return html `
21
21
  <div class="flex justify-between gap-s">
22
- <div class="font-semibold truncate flex-shrink-0">${data === null || data === void 0 ? void 0 : data.name}&ZeroWidthSpace;</div>
23
- <div class="truncate text-tertiary">${this.__typeLabel} &bull; ${this.__rateLabel}</div>
22
+ <div data-testid="title" class="font-semibold truncate flex-shrink-0">
23
+ ${data === null || data === void 0 ? void 0 : data.name}&ZeroWidthSpace;
24
+ </div>
25
+ <div data-testid="subtitle" class="truncate text-tertiary">
26
+ ${this.__typeLabel} &bull; ${this.__rateLabel}
27
+ </div>
24
28
  </div>
25
29
  `;
26
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TaxCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxCard/TaxCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,OAAQ,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,UAAU,CAAO;IAC/F,UAAU;QACR,MAAM,IAAI,G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C,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { Data } from './types';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\n\n/**\n * Basic card displaying a tax.\n *\n * @slot title:before\n * @slot title:after\n *\n * @slot subtitle:before\n * @slot subtitle:after\n *\n * @element foxy-tax-card\n * @since 1.13.0\n */\nexport class TaxCard extends TranslatableMixin(ConfigurableMixin(InternalCard), 'tax-card')<Data> {\n renderBody(): TemplateResult {\n const data = this.data;\n\n return html`\n <div class=\"flex justify-between gap-s\">\n <div class=\"font-semibold truncate flex-shrink-0\">${data?.name}&ZeroWidthSpace;</div>\n <div class=\"truncate text-tertiary\">${this.__typeLabel} &bull; ${this.__rateLabel}</div>\n </div>\n `;\n }\n\n private get __typeLabel() {\n const { type, country, region, city } = this.data ?? {};\n\n if (type === 'global') return this.t('tax_global');\n if (type === 'union') return this.t('tax_union');\n if (type === 'country') return country;\n if (type === 'region') return `${country}, ${region}`;\n if (type === 'local') return `${country}, ${region}, ${city}`;\n }\n\n private get __rateLabel() {\n if (this.data?.is_live === false) {\n return this.t('percent', { fraction: this.data.rate / 100 });\n }\n\n const provider = this.data?.service_provider as string | undefined;\n\n if (provider === 'onesource') return 'Thomson Reuters ONESOURCE';\n if (provider === 'avalara') return 'Avalara AvaTax 15';\n if (provider === 'taxjar') return 'TaxJar';\n\n return this.t('tax_rate_provider_default');\n }\n}\n"]}
1
+ {"version":3,"file":"TaxCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxCard/TaxCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AAExE;;;;;;;;;;;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,OAAO,mBAAmB,CAAC;QACvD,IAAI,QAAQ,KAAK,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE3C,OAAO,IAAI,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { Data } from './types';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\n\n/**\n * Basic card displaying a tax.\n *\n * @slot title:before\n * @slot title:after\n *\n * @slot subtitle:before\n * @slot subtitle:after\n *\n * @element foxy-tax-card\n * @since 1.13.0\n */\nexport class TaxCard extends TranslatableMixin(ConfigurableMixin(InternalCard), 'tax-card')<Data> {\n renderBody(): TemplateResult {\n const data = this.data;\n\n return html`\n <div class=\"flex justify-between gap-s\">\n <div data-testid=\"title\" class=\"font-semibold truncate flex-shrink-0\">\n ${data?.name}&ZeroWidthSpace;\n </div>\n <div data-testid=\"subtitle\" class=\"truncate text-tertiary\">\n ${this.__typeLabel} &bull; ${this.__rateLabel}\n </div>\n </div>\n `;\n }\n\n private get __typeLabel() {\n const { type, country, region, city } = this.data ?? {};\n\n if (type === 'global') return this.t('tax_global');\n if (type === 'union') return this.t('tax_union');\n if (type === 'country') return country;\n if (type === 'region') return `${country}, ${region}`;\n if (type === 'local') return `${country}, ${region}, ${city}`;\n }\n\n private get __rateLabel() {\n if (this.data?.is_live === false) {\n return this.t('percent', { fraction: this.data.rate / 100 });\n }\n\n const provider = this.data?.service_provider as string | undefined;\n\n if (provider === 'onesource') return 'Thomson Reuters ONESOURCE';\n if (provider === 'avalara') return 'Avalara AvaTax 15';\n if (provider === 'taxjar') return 'TaxJar';\n\n return this.t('tax_rate_provider_default');\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.21.0-beta.2",
4
+ "version": "1.21.0",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -14,20 +14,21 @@
14
14
  "scripts": {
15
15
  "wca": "wca analyze \"src/elements/public/*/index.ts\" --outFile custom-elements.json --format json",
16
16
  "generate-schemas": "node \"./.scripts/generate-schemas.js\" && prettier \"./src/static/schemas/*.json\" \"./.vscode/settings.json\" --write",
17
+ "generate-groups": "node \"./.scripts/generate-groups.js\" && prettier \"./web-test-runner-groups.config.js\" --write",
17
18
  "storybook": "wds --watch",
18
- "storybook:build": "build-storybook",
19
+ "storybook:build": "NODE_OPTIONS=--openssl-legacy-provider build-storybook",
19
20
  "lint": "npm run lint:eslint && npm run lint:prettier",
20
21
  "lint:eslint": "eslint --ext .ts,.html . --ignore-path .gitignore",
21
22
  "lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --check --ignore-path .gitignore",
22
23
  "format": "npm run format:eslint && npm run format:prettier",
23
24
  "format:eslint": "eslint --ext .ts,.html . --fix --ignore-path .gitignore",
24
25
  "format:prettier": "prettier \"**/*.js\" \"**/*.ts\" --write --ignore-path .gitignore",
25
- "test": "wtr src/**/*.test.ts",
26
- "test:watch": "wtr src/**/*.test.ts --watch",
26
+ "test": "NODE_OPTIONS=--no-experimental-fetch wtr",
27
+ "test:watch": "NODE_OPTIONS=--no-experimental-fetch wtr --watch",
27
28
  "prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
28
29
  },
29
30
  "dependencies": {
30
- "@foxy.io/sdk": "^1.9.4",
31
+ "@foxy.io/sdk": "^1.9.5",
31
32
  "@open-wc/lit-helpers": "^0.3.11",
32
33
  "@open-wc/scoped-elements": "1.2.1",
33
34
  "@polymer/iron-icons": "^3.0.1",
@@ -1 +0,0 @@
1
- import{a8 as a,a9 as r,ay as n,aa as t,au as l,az as e}from"./shared-76b3d76a.js";var u=Object.prototype.hasOwnProperty;function o(a,r){return null!=a&&u.call(a,r)}function s(u,s){return null!=u&&function(u,o,s){for(var f=-1,c=(o=a(o,u)).length,h=!1;++f<c;){var i=r(o[f]);if(!(h=null!=u&&s(u,i)))break;u=u[i]}return h||++f!=c?h:!!(c=null==u?0:u.length)&&n(c)&&t(i,c)&&(l(u)||e(u))}(u,s,o)}export{s as h};
@@ -1 +0,0 @@
1
- import"./shared-bc814810.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-0821cfdc.js";import{I as e}from"./shared-39c10b22.js";import"./shared-8dd0af4d.js";import{_ as t}from"./shared-a8ced8bf.js";import{c as r}from"./shared-4e709717.js";import{h as i}from"./shared-7f33a83a.js";let o,a,s,n,l,d,c,h,f,m,u=e=>e;customElements.define("foxy-internal-async-list-control",class extends e{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.wide=!1,this.alert=!1,this.hideDeleteButton=!1,this.hideCreateButton=!1,this.getPageHref=null,this.__deletionConfimationCallback=null,this.__cachedCardRenderer=null,this.__itemRenderer=e=>{if(!this.form&&!this.getPageHref||!e.data)return this.__cardRenderer(e);const t=this.disabledSelector.matches("card",!0),l=this.__cardRenderer(e);let d;const c=r({"rounded-t":!e.previous,"rounded-b":!e.next,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t});if(this.getPageHref)if(t)d=i(o||(o=u`<div class="${0}">${0}</div>`),c,l);else{const t=this.getPageHref(e.href,e.data);d=i(a||(a=u`<a class="${0}" href="${0}">${0}</a>`),c,t,l)}else{d=i(s||(s=u` <button ?disabled="${0}" class="${0}" @click="${0}">${0}</button> `),t,c,(t=>{const r=t.currentTarget,i=this.__dialog;i.header="header_update",i.href=e.href,i.show(r)}),l)}return this.hideDeleteButton?d:i(n||(n=u` <foxy-swipe-actions class="block"> ${0} <vaadin-button theme="primary error" class="h-full" slot="action" @click="${0}"> <foxy-i18n infer="" key="delete_button_text"></foxy-i18n> </vaadin-button> </foxy-swipe-actions> `),d,(e=>{const t=e.currentTarget;this.renderRoot.querySelector("#confirm").show(t),this.__deletionConfimationCallback=()=>{const e=t.previousElementSibling.querySelector("[href]");null==e||e.delete(),this.__deletionConfimationCallback=null}}))}}static get properties(){return t(t({},super.properties),{},{hideDeleteButton:{type:Boolean,attribute:"hide-delete-button"},hideCreateButton:{type:Boolean,attribute:"hide-create-button"},getPageHref:{attribute:!1},related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},wide:{type:Boolean},alert:{type:Boolean}})}renderControl(){let e;try{const t=new URL(this.first);t.searchParams.set("limit",String(this.limit)),e=t.toString()}catch(t){e=this.first}return i(l||(l=u` ${0} ${0} <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="mb-s block divide-y divide-contrast-5 rounded overflow-hidden bg-contrast-5" infer="card" .related="${0}" .item="${0}"> </foxy-collection-page> ${0} </foxy-pagination> `),this.form?i(d||(d=u` <foxy-form-dialog parent="${0}" infer="dialog" id="form" ?wide="${0}" ?alert="${0}" .related="${0}" .form="${0}"> </foxy-form-dialog> ${0} `),e,this.wide,this.alert,this.related,this.form,this.hideDeleteButton?"":i(c||(c=u` <foxy-internal-confirm-dialog message="delete_message" confirm="delete_confirm" cancel="delete_cancel" header="delete_header" theme="error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> `),this.lang,this.ns,(e=>{var t;e.detail.cancelled||null===(t=this.__deletionConfimationCallback)||void 0===t||t.call(this)}))):"",this.label&&"label"!==this.label?i(h||(h=u`<div class="font-medium text-secondary text-s mb-xs">${0}</div>`),this.label):"",e,this.related,this.__itemRenderer,!this.form||this.readonly||this.hideCreateButton?"":i(f||(f=u` <vaadin-button class="mb-s w-full" theme="success" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="create_button_text"></foxy-i18n> </vaadin-button> `),this.disabled,(e=>{e.preventDefault(),e.stopPropagation();const t=this.__dialog,r=e.currentTarget;t.header="header_create",t.href="",t.show(r)})))}get __dialog(){return this.renderRoot.querySelector("#form")}get __cardRenderer(){var e;const t=this.item;return(null===(e=this.__cachedCardRenderer)||void 0===e?void 0:e.item)!==t&&(this.__cachedCardRenderer={item:t,render:"string"==typeof t?new Function("ctx",`return ctx.html\`<${t} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} style="padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)" infer href=\${ctx.href}></${t}>\``):e=>i(m||(m=u` <div style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} </div> `),t(e))}),this.__cachedCardRenderer.render}});
@@ -1 +0,0 @@
1
- import{_ as e}from"./shared-a8ced8bf.js";import{L as t,h as s}from"./shared-7f33a83a.js";import{t as r,m as i,a as n,b as o,R as a,F as h}from"./shared-76b3d76a.js";import{A as d}from"./shared-a85afa33.js";import{U as u,a as l}from"./shared-d6276c83.js";import{I as c}from"./shared-4f037e43.js";import{i as _}from"./shared-2f7dcefa.js";function f(e,t){let s=null;return r(t).forEach((function(){var t,r,i,n,o,a,h,d,u,l,c;if(null===(i=null===(r=null===(t=this.node)||void 0===t?void 0:t._links)||void 0===r?void 0:r.self)||void 0===i?void 0:i.href){const t=null===(a=null===(o=null===(n=this.node)||void 0===n?void 0:n._links)||void 0===o?void 0:o.self)||void 0===a?void 0:a.href,r=new URL(null===(u=null===(d=null===(h=this.node)||void 0===h?void 0:h._links)||void 0===d?void 0:d.self)||void 0===u?void 0:u.href);if(r.searchParams.delete("zoom"),e===t||e===r.toString())return s=JSON.stringify(this.node),void this.stop()}Object.entries(null!==(c=null===(l=this.node)||void 0===l?void 0:l._links)&&void 0!==c?c:{}).some((([t,r])=>{var i,n;if(r.href!==e)return!1;const o=null===(n=null===(i=this.node)||void 0===i?void 0:i._embedded)||void 0===n?void 0:n[t];if(!o||!Array.isArray(o))return!1;const a=o.length<20?o.length:21,h=new URL(e),d=new URL(e);return h.searchParams.set("offset",o.length.toString()),d.searchParams.set("offset",a.toString()),s=JSON.stringify({returned_items:o.length,total_items:a,offset:0,limit:20,_embedded:{[t]:o},_links:{curies:this.node._links.curies,first:{href:e},last:{href:d.toString()},prev:{href:e},next:{href:h.toString()},self:{href:e}}}),this.stop(),!0}))})),new Response(s,{status:s?200:404})}let v,p=e=>e;class m extends(c(t)){constructor(){super(),this.lang="",this.parent="",this.related=[],this.__hrefToLoad=null,this.__group="",this.__unsubscribeFromRumour=null,this.__fetchEventQueue=[],this.__service=_(n.withConfig({services:{sendDelete:()=>this._sendDelete(),sendPatch:({edits:e})=>this._sendPatch(e),sendPost:({edits:e})=>this._sendPost(e),sendGet:()=>this._sendGet()},actions:{validate:o({errors:t=>{const s=this.constructor.v8n,r=e(e({},t.data),t.edits);return s.map((e=>e(r))).filter((e=>"string"==typeof e)).filter(((e,t,s)=>s.indexOf(e)===t))}})}})),this.__createService()}static get inferredProperties(){return[...super.inferredProperties,"group","lang"]}static get properties(){return{__state:{type:String,reflect:!0,attribute:"state"},related:{type:Array},parent:{type:String},group:{type:String,noAccessor:!0},href:{type:String,noAccessor:!0},lang:{type:String}}}static get v8n(){return[]}get failure(){return this.__service.state.context.failure}get errors(){return this.__service.state.context.errors}get form(){const{data:t,edits:s}=this.__service.state.context;return e(e({},t),s)}get data(){return this.__service.state.context.data}set data(e){this.__destroyRumour(),this.__service.send({type:"SET_DATA",data:e}),this.__hrefToLoad=null,e&&this.__createRumour()}get group(){return this.__group}set group(e){this.__group=e,this.__destroyRumour(),this.__createRumour()}get href(){var e,t,s;return null!==(s=null!==(t=null===(e=this.form._links)||void 0===e?void 0:e.self.href)&&void 0!==t?t:this.__hrefToLoad)&&void 0!==s?s:""}set href(e){e?(this.__hrefToLoad=e,this.__service.send({type:"FETCH"})):this.data=null}in(e){return this.__service.state.matches(e)}undo(){this.__service.send({type:"UNDO"})}edit(e){var t;"string"==typeof(null===(t=e._links)||void 0===t?void 0:t.self.href)&&(this.__hrefToLoad=null),this.__service.send({type:"EDIT",data:e})}submit(){this.reportValidity(),this.__service.send({type:"SUBMIT"})}checkValidity(){const e=this.in({idle:{template:{dirty:"valid"}}}),t=this.in({idle:{snapshot:{dirty:"valid"}}}),s=this.in({idle:{template:{clean:"valid"}}}),r=this.in({idle:{snapshot:{clean:"valid"}}});return s||e||(r||t)}reportValidity(){const e=this.ownerDocument.createTreeWalker(this.renderRoot,NodeFilter.SHOW_ELEMENT);do{const t=e.currentNode,s=["reportValidity","validate"];for(const e of s)if(e in t)try{t[e]();break}catch(e){continue}}while(e.nextNode());return this.checkValidity()}delete(){this.__service.send({type:"DELETE"})}refresh(){this.__service.send({type:"REFRESH"})}render(){return s(v||(v=p`<slot></slot>`))}connectedCallback(){super.connectedCallback(),this.href&&this.refresh(),this.__createRumour(),this.__createServer(),this.__processFetchEventQueue(),this.dispatchEvent(new u)}disconnectedCallback(){super.disconnectedCallback(),this.__destroyRumour(),this.__destroyServer(),this.__flushFetchEventQueue("parent element was disconnected"),this.dispatchEvent(new u)}applyInferredProperties(e){var t,s;super.applyInferredProperties(e),null!==this.infer&&(this.group=null!==(t=e.get("group"))&&void 0!==t?t:"",this.lang=null!==(s=e.get("lang"))&&void 0!==s?s:"")}async _fetch(...e){const t=await new d(this).fetch(...e);if(!t.ok)throw t;return t.json()}async _sendPost(e){let t;this.__destroyRumour();try{const s=JSON.stringify(e),r=await this._fetch(this.parent,{body:s,method:"POST"});t=await this._fetch(r._links.self.href);const i=m.Rumour(this.group),n=[...this.related,this.parent];i.share({data:t,related:n,source:t._links.self.href})}finally{this.__createRumour()}return t}async _sendGet(){let e;this.__destroyRumour();try{e=await this._fetch(this.href),m.Rumour(this.group).share({data:e,source:this.href})}finally{this.__createRumour()}return e}async _sendPatch(e){let t;this.__destroyRumour();try{const s=JSON.stringify(e);t=await this._fetch(this.href,{body:s,method:"PATCH"});m.Rumour(this.group).share({data:t,source:this.href,related:this.related})}finally{this.__createRumour()}return t}async _sendDelete(){this.__destroyRumour();try{await this._fetch(this.href,{method:"DELETE"});const e=m.Rumour(this.group),t=[...this.related,this.parent];e.share({data:null,source:this.href,related:t})}finally{this.__createRumour()}return null}get __state(){const e=this.__service.state.toStrings().reduce(((e,t)=>[...e,...t.split(".")]),[]);return[...new Set(e)].join(" ")}__createService(){this.__service.onTransition((e=>{var t,s;if(!e.changed)return;let r;e.matches("idle")&&((null===(t=e.history)||void 0===t?void 0:t.matches({busy:"deleting"}))?r=l.ResourceDeleted:(null===(s=e.history)||void 0===s?void 0:s.matches({busy:"creating"}))&&(r=l.ResourceCreated)),this.requestUpdate(),this.dispatchEvent(new u("update",{detail:{result:r}})),e.matches("busy")||this.__processFetchEventQueue()})),this.__service.onChange((()=>{this.requestUpdate(),this.dispatchEvent(new u)})),this.__service.start()}__createRumour(){const e=m.Rumour(this.group);this.__unsubscribeFromRumour=e.track((e=>this.__handleRumourUpdate(e)))}__destroyRumour(){var e;null===(e=this.__unsubscribeFromRumour)||void 0===e||e.call(this),this.__unsubscribeFromRumour=null}__createServer(){this.__fetchEventHandler=this.__handleFetchEvent.bind(this),this.addEventListener("fetch",this.__fetchEventHandler)}__destroyServer(){this.removeEventListener("fetch",this.__fetchEventHandler)}__handleRumourUpdate(e){var t;try{const s=null===(t=this.__service.state)||void 0===t?void 0:t.context.data,r=s?e(s):s;if(r!==s&&(this.data=r,!r)){const e=l.ResourceDeleted,t=new u("update",{detail:{result:e}});this.dispatchEvent(t)}}catch(e){if(!(e instanceof a.UpdateError))throw e;this.__service.send({type:"REFRESH"})}}__processFetchEventQueue(){const e=new m.API(this);this.__fetchEventQueue.forEach((t=>{const s=t.request,r=f(s.url,this.data),i=r.ok?r:e.fetch(s);t.respondWith(Promise.resolve(i)),r.ok&&console.debug(`%c@foxy.io/elements::${this.localName}\n%c200%c GET ${s.url}`,"color: gray","background: gray; padding: 0 .2em; border-radius: .2em; color: white;","")})),this.__fetchEventQueue=[]}__flushFetchEventQueue(e){this.__fetchEventQueue.forEach((t=>{t.respondWith(Promise.reject(new Error(e)))})),this.__fetchEventQueue=[]}__handleFetchEvent(e){e instanceof h&&(e.defaultPrevented||"GET"===e.request.method&&(e.request.url.startsWith("foxy://")||e.composedPath()[0]!==this&&(e.preventDefault(),this.__fetchEventQueue.push(e),this.__service.state.matches("busy")||this.__processFetchEventQueue())))}}m.UpdateEvent=u,m.Rumour=i((()=>new a)),m.API=d;export{m as N,f as s};
@@ -1 +0,0 @@
1
- import"./foxy-spinner.js";import{I as e}from"./shared-486d7bb5.js";customElements.define("foxy-internal-card",e);
@@ -1 +0,0 @@
1
- import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-0821cfdc.js";import{I as e}from"./shared-9bdacf65.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import{_ as t}from"./shared-a8ced8bf.js";import{L as r,h as i}from"./shared-7f33a83a.js";import{I as s}from"./shared-4f037e43.js";import{T as o}from"./shared-2cc638ad.js";import{c as n}from"./shared-4e709717.js";let a,c=e=>e;class d extends(o(s(r))){constructor(){super(...arguments),this.summary=null,this.open=!1}static get properties(){return t(t({},super.properties),{},{summary:{type:String},open:{type:Boolean}})}render(){var e;return i(a||(a=c` <details class="w-full border border-contrast-10 rounded" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center h-m pl-m pr-s"> <div class="flex items-center flex-1"> <foxy-i18n class="flex items-center text-xs tracking-wide uppercase font-bold text-body" infer="" key="${0}"> </foxy-i18n> <slot name="actions"></slot> </div> <iron-icon class="icon-inline text-xl text-body" icon="icons:expand-${0}"> </iron-icon> </div> </summary> <div class="border-t border-contrast-10"> <slot></slot> </div> </details> `),this.open,(e=>{this.open=e.currentTarget.open}),n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"transition-colors cursor-pointer hover-bg-contrast-5":!0,"rounded-t":!0,"rounded-b":!this.open}),null!==(e=this.summary)&&void 0!==e?e:"",this.open?"less":"more")}}customElements.define("foxy-internal-details",d);let l,f,m,h,p=e=>e;customElements.define("foxy-internal-async-details-control",class extends e{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.open=!1,this.__cachedCardRenderer=null,this.__itemRenderer=e=>{if(!this.form||!e.data)return this.__cardRenderer(e);const t=this.disabledSelector.matches("card",!0);return i(l||(l=p` <button ?disabled="${0}" class="${0}" @click="${0}"> ${0} </button> `),t,n({"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t}),(t=>{const r=t.currentTarget,i=this.__dialog;i.header="header_update",i.href=e.href,i.show(r)}),this.__cardRenderer(e))}}static get properties(){return t(t({},super.properties),{},{related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},open:{type:Boolean}})}renderControl(){let e;try{const t=new URL(this.first);t.searchParams.set("limit",String(this.limit)),e=t.toString()}catch(t){e=this.first}return i(f||(f=p` <foxy-internal-details summary="title" infer="" ?open="${0}" @toggle="${0}"> ${0} <foxy-pagination class="px-m pb-s" first="${0}" infer="pagination"> <foxy-collection-page class="-mx-m block divide-y divide-contrast-10 mb-s" infer="card" .related="${0}" .item="${0}"> </foxy-collection-page> </foxy-pagination> </foxy-internal-details> `),this.open,(e=>this.open=e.currentTarget.open),this.form?i(m||(m=p` <foxy-form-dialog parent="${0}" infer="dialog" id="form" .related="${0}" .form="${0}"> </foxy-form-dialog> ${0} `),e,this.related,this.form,this.readonly?"":i(h||(h=p` <button class="h-xs w-xs rounded-full text-success flex items-center justify-center text-l focus-outline-none focus-ring-2 focus-ring-primary-50" slot="actions" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </button> `),this.disabled,(e=>{e.preventDefault(),e.stopPropagation();const t=this.__dialog,r=e.currentTarget;t.header="header_create",t.href="",t.show(r)}))):"",e,this.related,this.__itemRenderer)}get __dialog(){return this.renderRoot.querySelector("#form")}get __cardRenderer(){var e;return(null===(e=this.__cachedCardRenderer)||void 0===e?void 0:e.item)!==this.item&&(this.__cachedCardRenderer={item:this.item,render:"string"==typeof this.item?new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``):this.item}),this.__cachedCardRenderer.render}});
@@ -1 +0,0 @@
1
- import{a as r}from"./shared-839dd3a8.js";import{a8 as a,a9 as o,aa as t}from"./shared-76b3d76a.js";import{e as s}from"./shared-a8ced8bf.js";function e(e,n,f){return null==e?e:function(e,n,f,i){if(!s(e))return e;for(var d=-1,u=(n=a(n,e)).length,p=u-1,m=e;null!=m&&++d<u;){var c=o(n[d]),l=f;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(d!=p){var v=m[c];void 0===(l=i?i(v,c,m):void 0)&&(l=s(v)?v:t(n[d+1])?[]:{})}r(m,c,l),m=m[c]}return e}(e,n,f)}export{e as s};