@foxy.io/elements 1.17.0 → 1.18.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +3 -85
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-api-browser.js +1 -1
  5. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-card.js +1 -1
  7. package/dist/cdn/foxy-attribute-form.js +1 -1
  8. package/dist/cdn/foxy-cancellation-form.js +1 -1
  9. package/dist/cdn/foxy-collection-page.js +1 -1
  10. package/dist/cdn/foxy-collection-pages.js +1 -1
  11. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  12. package/dist/cdn/foxy-coupon-card.js +1 -1
  13. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  14. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  15. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  16. package/dist/cdn/foxy-coupon-form.js +1 -1
  17. package/dist/cdn/foxy-custom-field-card.js +1 -1
  18. package/dist/cdn/foxy-custom-field-form.js +1 -1
  19. package/dist/cdn/foxy-customer-api.js +1 -1
  20. package/dist/cdn/foxy-customer-card.js +1 -1
  21. package/dist/cdn/foxy-customer-form.js +1 -1
  22. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  23. package/dist/cdn/foxy-customer-portal.js +15 -15
  24. package/dist/cdn/foxy-customer.js +6 -6
  25. package/dist/cdn/foxy-customers-table.js +1 -1
  26. package/dist/cdn/foxy-discount-builder.js +1 -1
  27. package/dist/cdn/foxy-discount-card.js +1 -1
  28. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  29. package/dist/cdn/foxy-donation.js +1 -1
  30. package/dist/cdn/foxy-email-template-form.js +1 -1
  31. package/dist/cdn/foxy-error-entry-card.js +1 -1
  32. package/dist/cdn/foxy-form-dialog.js +1 -1
  33. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  34. package/dist/cdn/foxy-gift-card-card.js +1 -1
  35. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  36. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  37. package/dist/cdn/foxy-gift-card-form.js +1 -1
  38. package/dist/cdn/foxy-i18n.js +1 -1
  39. package/dist/cdn/foxy-item-card.js +1 -1
  40. package/dist/cdn/foxy-item-form.js +1 -1
  41. package/dist/cdn/foxy-item-option-card.js +1 -1
  42. package/dist/cdn/foxy-item-option-form.js +1 -1
  43. package/dist/cdn/foxy-items-form.js +1 -1
  44. package/dist/cdn/foxy-nucleon-element.js +1 -1
  45. package/dist/cdn/foxy-pagination.js +1 -1
  46. package/dist/cdn/foxy-payment-card.js +1 -1
  47. package/dist/cdn/foxy-payment-method-card.js +1 -1
  48. package/dist/cdn/foxy-query-builder.js +1 -1
  49. package/dist/cdn/foxy-report-form.js +4 -4
  50. package/dist/cdn/foxy-reports-table.js +5 -5
  51. package/dist/cdn/foxy-shipment-card.js +1 -1
  52. package/dist/cdn/foxy-sign-in-form.js +1 -1
  53. package/dist/cdn/foxy-spinner.js +1 -1
  54. package/dist/cdn/foxy-store-shipping-method-form.js +150 -0
  55. package/dist/cdn/foxy-subscription-card.js +1 -1
  56. package/dist/cdn/foxy-subscription-form.js +4 -4
  57. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  58. package/dist/cdn/foxy-table.js +1 -1
  59. package/dist/cdn/foxy-tax-card.js +1 -1
  60. package/dist/cdn/foxy-tax-form.js +1 -1
  61. package/dist/cdn/foxy-template-config-form.js +1 -1
  62. package/dist/cdn/foxy-template-form.js +1 -1
  63. package/dist/cdn/foxy-transaction-card.js +1 -1
  64. package/dist/cdn/foxy-transaction.js +1 -1
  65. package/dist/cdn/foxy-transactions-table.js +1 -1
  66. package/dist/cdn/foxy-user-form.js +1 -1
  67. package/dist/cdn/foxy-users-table.js +1 -1
  68. package/dist/cdn/foxy-webhook-card.js +1 -1
  69. package/dist/cdn/foxy-webhook-form.js +1 -1
  70. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  71. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  72. package/dist/cdn/{shared-26ce8d23.js → shared-023c287a.js} +1 -1
  73. package/dist/cdn/{shared-195fd5af.js → shared-084b6372.js} +1 -1
  74. package/dist/cdn/shared-11f0daea.js +169 -0
  75. package/dist/cdn/{shared-6d104622.js → shared-189dfb49.js} +1 -1
  76. package/dist/cdn/shared-23fd456c.js +134 -0
  77. package/dist/cdn/{shared-baf79b0b.js → shared-2ca6d676.js} +1 -1
  78. package/dist/cdn/{shared-c309e0ef.js → shared-2f0efb2c.js} +1 -1
  79. package/dist/cdn/{shared-dda2a74d.js → shared-37b61010.js} +1 -1
  80. package/dist/cdn/shared-381aa7fe.js +1 -0
  81. package/dist/cdn/shared-3a7cf739.js +15 -0
  82. package/dist/cdn/{shared-2188d5f7.js → shared-3e3c07ac.js} +1 -1
  83. package/dist/cdn/{shared-8e9a3bbb.js → shared-412670b8.js} +1 -1
  84. package/dist/cdn/{shared-31c43743.js → shared-4560425c.js} +1 -1
  85. package/dist/cdn/shared-4773b634.js +1 -0
  86. package/dist/cdn/{shared-7c8bb60c.js → shared-4c0520f6.js} +1 -1
  87. package/dist/cdn/{shared-5c3a88d2.js → shared-5482630e.js} +1 -1
  88. package/dist/cdn/{shared-322e7efb.js → shared-5e43b817.js} +1 -1
  89. package/dist/cdn/{shared-a0836fa5.js → shared-60c862aa.js} +1 -1
  90. package/dist/cdn/shared-619adfad.js +1 -0
  91. package/dist/cdn/{shared-b3df4f38.js → shared-68ab037d.js} +1 -1
  92. package/dist/cdn/{shared-7c612495.js → shared-6af95088.js} +1 -1
  93. package/dist/cdn/shared-6ce2acfa.js +1 -0
  94. package/dist/cdn/{shared-c8677ba3.js → shared-6f89d2e0.js} +1 -1
  95. package/dist/cdn/{shared-c5c60417.js → shared-71acf673.js} +1 -1
  96. package/dist/cdn/{shared-c89ba319.js → shared-74a27421.js} +1 -1
  97. package/dist/cdn/{shared-d699348f.js → shared-80b90eec.js} +2 -2
  98. package/dist/cdn/{shared-98497473.js → shared-85d45495.js} +1 -1
  99. package/dist/cdn/{shared-a5e52b8f.js → shared-872ceacf.js} +3 -3
  100. package/dist/cdn/{shared-4e201e09.js → shared-901ca702.js} +1 -1
  101. package/dist/cdn/{shared-ae415a98.js → shared-91b86bae.js} +1 -1
  102. package/dist/cdn/shared-9b392ba8.js +1 -0
  103. package/dist/cdn/{shared-1bbd9b73.js → shared-9be1a70f.js} +1 -1
  104. package/dist/cdn/{shared-8d4fef94.js → shared-9ef13805.js} +1 -1
  105. package/dist/cdn/{shared-bb686fc6.js → shared-9ef81b37.js} +1 -1
  106. package/dist/cdn/{shared-3b2dedf9.js → shared-a2a1193d.js} +1 -1
  107. package/dist/cdn/shared-a48a9dfc.js +82 -0
  108. package/dist/cdn/{shared-8d937ae4.js → shared-c0fb5a33.js} +3 -3
  109. package/dist/cdn/{shared-a052131e.js → shared-c63ba384.js} +1 -1
  110. package/dist/cdn/{shared-d28ac9dc.js → shared-c7280a24.js} +1 -1
  111. package/dist/cdn/{shared-e9a4a204.js → shared-c7c8d1b6.js} +1 -1
  112. package/dist/cdn/{shared-fadcb2e1.js → shared-ca0f14c1.js} +1 -1
  113. package/dist/cdn/{shared-7474af47.js → shared-d91ed0a8.js} +1 -1
  114. package/dist/cdn/{shared-39f2c345.js → shared-daa454bf.js} +1 -1
  115. package/dist/cdn/{shared-2bdd4f74.js → shared-ec7cfc23.js} +1 -1
  116. package/dist/cdn/{shared-bf6fb415.js → shared-f2639daf.js} +1 -1
  117. package/dist/cdn/{shared-62169210.js → shared-f31044b8.js} +1 -1
  118. package/dist/cdn/{shared-f84686a8.js → shared-fcbf9a41.js} +1 -1
  119. package/dist/cdn/{shared-dd6d3c18.js → shared-fd595d0a.js} +1 -1
  120. package/dist/cdn/{shared-dc23b751.js → shared-fe68657a.js} +1 -1
  121. package/dist/cdn/{shared-f1317609.js → shared-ff1d9854.js} +1 -1
  122. package/dist/cdn/translations/store-shipping-method-form/en.json +90 -0
  123. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.d.ts +3 -0
  124. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js +22 -0
  125. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js.map +1 -1
  126. package/dist/elements/internal/InternalCheckboxGroupControl/InternalCheckboxGroupControl.d.ts +17 -0
  127. package/dist/elements/internal/InternalCheckboxGroupControl/InternalCheckboxGroupControl.js +51 -0
  128. package/dist/elements/internal/InternalCheckboxGroupControl/InternalCheckboxGroupControl.js.map +1 -0
  129. package/dist/elements/internal/InternalCheckboxGroupControl/index.d.ts +6 -0
  130. package/dist/elements/internal/InternalCheckboxGroupControl/index.js +8 -0
  131. package/dist/elements/internal/InternalCheckboxGroupControl/index.js.map +1 -0
  132. package/dist/elements/internal/InternalCheckboxGroupControl/types.d.ts +6 -0
  133. package/dist/elements/internal/InternalCheckboxGroupControl/types.js +2 -0
  134. package/dist/elements/internal/InternalCheckboxGroupControl/types.js.map +1 -0
  135. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.d.ts +2 -0
  136. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +6 -4
  137. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
  138. package/dist/elements/internal/InternalTextAreaControl/InternalTextAreaControl.d.ts +13 -0
  139. package/dist/elements/internal/InternalTextAreaControl/InternalTextAreaControl.js +40 -0
  140. package/dist/elements/internal/InternalTextAreaControl/InternalTextAreaControl.js.map +1 -0
  141. package/dist/elements/internal/InternalTextAreaControl/index.d.ts +4 -0
  142. package/dist/elements/internal/InternalTextAreaControl/index.js +6 -0
  143. package/dist/elements/internal/InternalTextAreaControl/index.js.map +1 -0
  144. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js +10 -23
  145. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js.map +1 -1
  146. package/dist/elements/public/NucleonElement/NucleonElement.d.ts +2 -1
  147. package/dist/elements/public/NucleonElement/NucleonElement.js +12 -10
  148. package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
  149. package/dist/elements/public/ShipmentCard/ShipmentCard.js +1 -1
  150. package/dist/elements/public/ShipmentCard/ShipmentCard.js.map +1 -1
  151. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +25 -0
  152. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +201 -0
  153. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -0
  154. package/dist/elements/public/StoreShippingMethodForm/index.d.ts +11 -0
  155. package/dist/elements/public/StoreShippingMethodForm/index.js +13 -0
  156. package/dist/elements/public/StoreShippingMethodForm/index.js.map +1 -0
  157. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.d.ts +5 -0
  158. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.js +33 -0
  159. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.js.map +1 -0
  160. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/index.d.ts +6 -0
  161. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/index.js +8 -0
  162. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/index.js.map +1 -0
  163. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.d.ts +19 -0
  164. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.js +96 -0
  165. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.js.map +1 -0
  166. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/index.d.ts +5 -0
  167. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/index.js +7 -0
  168. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/index.js.map +1 -0
  169. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.d.ts +17 -0
  170. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.js +45 -0
  171. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.js.map +1 -0
  172. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/index.d.ts +3 -0
  173. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/index.js +5 -0
  174. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/index.js.map +1 -0
  175. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.d.ts +16 -0
  176. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.js +49 -0
  177. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.js.map +1 -0
  178. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/index.d.ts +3 -0
  179. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/index.js +5 -0
  180. package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/index.js.map +1 -0
  181. package/dist/elements/public/StoreShippingMethodForm/types.d.ts +5 -0
  182. package/dist/elements/public/StoreShippingMethodForm/types.js +2 -0
  183. package/dist/elements/public/StoreShippingMethodForm/types.js.map +1 -0
  184. package/dist/elements/public/index.d.ts +1 -0
  185. package/dist/elements/public/index.defined.d.ts +1 -0
  186. package/dist/elements/public/index.defined.js +1 -0
  187. package/dist/elements/public/index.defined.js.map +1 -1
  188. package/dist/elements/public/index.js +1 -0
  189. package/dist/elements/public/index.js.map +1 -1
  190. package/dist/mixins/configurable.js +16 -8
  191. package/dist/mixins/configurable.js.map +1 -1
  192. package/dist/mixins/inferrable.js +25 -23
  193. package/dist/mixins/inferrable.js.map +1 -1
  194. package/package.json +2 -2
  195. package/dist/cdn/shared-45feee83.js +0 -1
  196. package/dist/cdn/shared-63685d2e.js +0 -302
  197. package/dist/cdn/shared-92327224.js +0 -15
  198. package/dist/cdn/shared-ac44429d.js +0 -1
  199. package/dist/cdn/shared-dc1c6edd.js +0 -1
  200. package/dist/cdn/shared-dc3ffd38.js +0 -1
@@ -0,0 +1,150 @@
1
+ import"./shared-a48a9dfc.js";import{F as e}from"./shared-3e3c07ac.js";import"./shared-381aa7fe.js";import{C as t}from"./shared-80b90eec.js";import{T as i,D as r}from"./shared-084b6372.js";import"./shared-c7280a24.js";import{h as s,P as o}from"./shared-91b86bae.js";import{I as n}from"./shared-4773b634.js";import"./shared-2f0efb2c.js";import{_ as a}from"./shared-ca0f14c1.js";import{i as l}from"./shared-9803aa7c.js";import{h as d}from"./shared-dc73b9a5.js";import"./shared-23fd456c.js";import{a as h,I as p}from"./shared-9ef13805.js";import"./foxy-pagination.js";import"./foxy-spinner.js";import{C as c}from"./shared-85d45495.js";import{N as u}from"./shared-619adfad.js";import{T as m,a as f}from"./shared-f31044b8.js";import{c as v}from"./shared-4e709717.js";import{B as g}from"./shared-3a7cf739.js";import"./shared-c63ba384.js";import"./shared-9b392ba8.js";import"./shared-e1c1e8e2.js";import"./shared-71acf673.js";import"./shared-9ef81b37.js";import"./shared-6f89d2e0.js";import"./shared-412670b8.js";import"./shared-7684cb05.js";import"./shared-4c0520f6.js";const b=s`<dom-module id="lumo-checkbox-group" theme-for="vaadin-checkbox-group">
2
+ <template>
3
+ <style include="lumo-required-field">
4
+ :host {
5
+ color: var(--lumo-body-text-color);
6
+ font-size: var(--lumo-font-size-m);
7
+ font-family: var(--lumo-font-family);
8
+ -webkit-font-smoothing: antialiased;
9
+ -moz-osx-font-smoothing: grayscale;
10
+ -webkit-tap-highlight-color: transparent;
11
+ padding: var(--lumo-space-xs) 0;
12
+ }
13
+
14
+ :host::before {
15
+ height: var(--lumo-size-m);
16
+ box-sizing: border-box;
17
+ display: inline-flex;
18
+ align-items: center;
19
+ }
20
+
21
+ :host([theme~="vertical"]) [part="group-field"] {
22
+ display: flex;
23
+ flex-direction: column;
24
+ }
25
+
26
+ [part="label"] {
27
+ padding-bottom: 0.7em;
28
+ }
29
+
30
+ :host([disabled]) [part="label"] {
31
+ color: var(--lumo-disabled-text-color);
32
+ -webkit-text-fill-color: var(--lumo-disabled-text-color);
33
+ }
34
+
35
+ :host([focused]:not([disabled])) [part="label"] {
36
+ color: var(--lumo-primary-text-color);
37
+ }
38
+
39
+ :host(:hover:not([disabled]):not([focused])) [part="label"],
40
+ :host(:hover:not([disabled]):not([focused])) [part="helper-text"],
41
+ :host(:hover:not([disabled]):not([focused])) [part="helper-text"] ::slotted(*) {
42
+ color: var(--lumo-body-text-color);
43
+ }
44
+
45
+ :host([has-helper]) [part="helper-text"]::before {
46
+ content: "";
47
+ display: block;
48
+ height: 0.4em;
49
+ }
50
+
51
+ [part="helper-text"],
52
+ [part="helper-text"] ::slotted(*) {
53
+ display: block;
54
+ color: var(--lumo-secondary-text-color);
55
+ font-size: var(--lumo-font-size-xs);
56
+ line-height: var(--lumo-line-height-xs);
57
+ margin-left: calc(var(--lumo-border-radius-m) / 4);
58
+ transition: color 0.2s;
59
+ }
60
+
61
+ /* helper-text position */
62
+
63
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"]::before {
64
+ display: none;
65
+ }
66
+
67
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"]::after {
68
+ content: "";
69
+ display: block;
70
+ height: 0.4em;
71
+ }
72
+
73
+ :host([has-helper][theme~="helper-above-field"]) [part="label"] {
74
+ order: 0;
75
+ padding-bottom: 0.4em;
76
+ }
77
+
78
+ :host([has-helper][theme~="helper-above-field"]) [part="helper-text"] {
79
+ order: 1;
80
+ }
81
+
82
+ :host([has-helper][theme~="helper-above-field"]) [part="group-field"] {
83
+ order: 2;
84
+ }
85
+
86
+ :host([has-helper][theme~="helper-above-field"]) [part="error-message"] {
87
+ order: 3;
88
+ }
89
+
90
+ /* Touch device adjustment */
91
+ @media (pointer: coarse) {
92
+ :host(:hover:not([disabled]):not([focused])) [part="label"] {
93
+ color: var(--lumo-secondary-text-color);
94
+ }
95
+ }
96
+ </style>
97
+ </template>
98
+ </dom-module>`;document.head.appendChild(b.content);
99
+ /**
100
+ @license
101
+ Copyright (c) 2017 Vaadin Ltd.
102
+ This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
103
+ */
104
+ class x extends(i(r(o))){static get template(){return s`
105
+ <style>
106
+ :host {
107
+ display: inline-flex;
108
+
109
+ /* Prevent horizontal overflow in IE 11 instead of wrapping checkboxes */
110
+ max-width: 100%;
111
+ }
112
+
113
+ :host::before {
114
+ content: "\\2003";
115
+ width: 0;
116
+ display: inline-block;
117
+ }
118
+
119
+ :host([hidden]) {
120
+ display: none !important;
121
+ }
122
+
123
+ .vaadin-group-field-container {
124
+ display: flex;
125
+ flex-direction: column;
126
+
127
+ /* Prevent horizontal overflow in IE 11 instead of wrapping checkboxes */
128
+ width: 100%;
129
+ }
130
+
131
+ [part="label"]:empty {
132
+ display: none;
133
+ }
134
+ </style>
135
+
136
+ <div class="vaadin-group-field-container">
137
+ <label part="label">[[label]]</label>
138
+
139
+ <div part="group-field">
140
+ <slot id="slot"></slot>
141
+ </div>
142
+
143
+ <div part="helper-text" aria-live="assertive" aria-hidden\$="[[_getHelperTextAriaHidden(helperText, _hasSlottedHelper)]]">
144
+ <slot name="helper">[[helperText]]</slot>
145
+ </div>
146
+
147
+ <div part="error-message" aria-live="assertive" aria-hidden\$="[[_getErrorMessageAriaHidden(invalid, errorMessage)]]">[[errorMessage]]</div>
148
+
149
+ </div>
150
+ `}static get is(){return"vaadin-checkbox-group"}static get properties(){return{disabled:{type:Boolean,reflectToAttribute:!0,observer:"_disabledChanged"},label:{type:String,value:"",observer:"_labelChanged"},value:{type:Array,value:()=>[],notify:!0},errorMessage:{type:String,value:"",observer:"_errorMessageChanged"},helperText:{type:String,value:"",observer:"_helperTextChanged"},required:{type:Boolean,reflectToAttribute:!0},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},_hasSlottedHelper:Boolean}}static get observers(){return["_updateValue(value, value.splices)"]}ready(){super.ready(),this.addEventListener("focusin",(()=>this._setFocused(this._containsFocus()))),this.addEventListener("focusout",(e=>{this._checkboxes.some((t=>e.relatedTarget===t||t.shadowRoot.contains(e.relatedTarget)))||(this.validate(),this._setFocused(!1))}));const t=e=>{this._changeSelectedCheckbox(e.target)};this._observer=new e(this,(e=>{const i=this._filterCheckboxes(e.addedNodes);i.forEach((e=>{e.addEventListener("checked-changed",t),this.disabled&&(e.disabled=!0),e.checked?this._addCheckboxToValue(e.value):this.value.indexOf(e.value)>-1&&(e.checked=!0)})),this._filterCheckboxes(e.removedNodes).forEach((e=>{e.removeEventListener("checked-changed",t),e.checked&&this._removeCheckboxFromValue(e.value)})),this._setOrToggleHasHelperAttribute();i.every((e=>{const{value:t}=e;return e.hasAttribute("value")||t&&"on"!==t}))||console.warn("Please add value attribute to all checkboxes in checkbox group")}))}validate(){return this.invalid=this.required&&0===this.value.length,!this.invalid}get _checkboxes(){return this._filterCheckboxes(this.querySelectorAll("*"))}_filterCheckboxes(e){return Array.from(e).filter((e=>e instanceof t))}_disabledChanged(e){this.setAttribute("aria-disabled",e),this._checkboxes.forEach((t=>t.disabled=e))}_addCheckboxToValue(e){-1===this.value.indexOf(e)&&(this.value=this.value.concat(e))}_removeCheckboxFromValue(e){this.value=this.value.filter((t=>t!==e))}_changeSelectedCheckbox(e){this._updatingValue||(e.checked?this._addCheckboxToValue(e.value):this._removeCheckboxFromValue(e.value))}_updateValue(e,t){0===e.length&&void 0===this._oldValue||(e.length?this.setAttribute("has-value",""):this.removeAttribute("has-value"),this._oldValue=e,this._updatingValue=!0,this._checkboxes.forEach((t=>{t.checked=e.indexOf(t.value)>-1})),this._updatingValue=!1,this.validate())}_labelChanged(e){this._setOrToggleAttribute("has-label",!!e)}_errorMessageChanged(e){this._setOrToggleAttribute("has-error-message",!!e)}_helperTextChanged(e){this._setOrToggleAttribute("has-helper",!!e)}_setOrToggleAttribute(e,t){e&&(t?this.setAttribute(e,"boolean"==typeof t?"":t):this.removeAttribute(e))}_getErrorMessageAriaHidden(e,t){return(!t||!e).toString()}_containsFocus(){const e=this.getRootNode(),t=void 0!==e._activeElement?e._activeElement:e.activeElement;return this.contains(t)}_setFocused(e){e?this.setAttribute("focused",""):this.removeAttribute("focused")}_setOrToggleHasHelperAttribute(){const e=this.shadowRoot.querySelector('[name="helper"]').assignedNodes();this._hasSlottedHelper=e.filter((e=>3!==e.nodeType)).length>0,this._setOrToggleAttribute("has-helper",this._hasSlottedHelper?"slotted":!!this.helperText)}_getHelperTextAriaHidden(e,t){return(!(e||t)).toString()}}customElements.define(x.is,x);let _,y,k=e=>e;customElements.define("foxy-internal-checkbox-group-control",class extends n{constructor(){super(...arguments),this.options=[],this.theme=null}static get properties(){return a(a({},super.properties),{},{options:{type:Array},theme:{type:String}})}renderControl(){var e;return d(_||(_=k` <vaadin-checkbox-group error-message="${0}" helper-text="${0}" label="${0}" class="w-full" theme="${0}" ?disabled="${0}" .checkValidity="${0}" .value="${0}" @change="${0}"> ${0} </vaadin-checkbox-group> `),l(this._errorMessage),this.helperText,this.label,l(null!==(e=this.theme)&&void 0!==e?e:void 0),this.disabled||this.readonly,this._checkValidity,this._value,(e=>{const t=e.currentTarget;this._value=t.value}),this.options.map((e=>d(y||(y=k` <vaadin-checkbox value="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-checkbox> `),e.value,e.label))))}});let $,S=e=>e;customElements.define("foxy-internal-text-area-control",class extends n{renderControl(){return d($||($=S` <vaadin-text-area error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-area> `),l(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{const t=e.currentTarget;this._value=t.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});let T,w=e=>e;const A=c(m(u));customElements.define("foxy-internal-store-shipping-method-form-services-page-item-content",class extends A{constructor(){super(...arguments),this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return a(a({},super.properties),{},{shippingServiceUri:{type:String,attribute:"shipping-service-uri"},shippingMethodUri:{type:String,attribute:"shipping-method-uri"}})}render(){return d(T||(T=w` <div class="h-full flex items-center"> <vaadin-checkbox data-testid="checkbox" class="w-full" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </vaadin-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{var t,i;e.currentTarget.checked?(this.edit({shipping_service_uri:null!==(t=this.shippingServiceUri)&&void 0!==t?t:"",shipping_method_uri:null!==(i=this.shippingMethodUri)&&void 0!==i?i:""}),this.submit()):this.delete()}))}});let U,j=e=>e;const C=c(m(u));customElements.define("foxy-internal-store-shipping-method-form-services-page-item",class extends C{constructor(){super(...arguments),this.internationalAllowed=!1,this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return a(a({},super.properties),{},{internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingServiceUri:{type:String,attribute:"shipping-service-uri"},shippingMethodUri:{type:String,attribute:"shipping-method-uri"}})}render(){var e,t,i;const r=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:store_shipping_services"][0],s=r?void 0:this.href,o=r?r._links.self.href:void 0;return d(U||(U=j` <foxy-internal-store-shipping-method-form-services-page-item-content shipping-service-uri="${0}" shipping-method-uri="${0}" data-testid="content" parent="${0}" class="h-full" infer="" href="${0}"> <slot></slot> <span class="${0}"> <slot name="suffix"></slot> </span> </foxy-internal-store-shipping-method-form-services-page-item-content> `),l(null!==(t=this.shippingServiceUri)&&void 0!==t?t:void 0),l(null!==(i=this.shippingMethodUri)&&void 0!==i?i:void 0),l(s),l(o),this.internationalAllowed||!o?"text-tertiary":"text-error")}});let E,M,O,P,V=e=>e;const H=c(m(f(u)));customElements.define("foxy-internal-store-shipping-method-form-services-page",class extends H{constructor(){super(...arguments),this.storeShippingServicesUri=null,this.internationalAllowed=!1,this.shippingMethodUri=null}static get properties(){return a(a({},super.properties),{},{storeShippingServicesUri:{type:String,attribute:"store-shipping-services-uri"},internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingMethodUri:{type:String,attribute:"shipping-method-uri"}})}render(){var e,t,i;const r=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:shipping_services"])&&void 0!==t?t:[];let s=20;try{const e=parseInt(null!==(i=new URL(this.href).searchParams.get("limit"))&&void 0!==i?i:"");isNaN(e)||(s=e)}catch(e){}return d(E||(E=V` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" infer=""> </foxy-spinner> </div> </div> `),new Array(s).fill(0).map(((e,t)=>{var i,s;const o=r[t];let n;if(o)try{const e=new URL(null!==(i=this.storeShippingServicesUri)&&void 0!==i?i:""),t=new URL(o._links.self.href).pathname.split("/").pop();e.searchParams.set("shipping_service_id",t),e.searchParams.set("limit","1"),n=e.toString()}catch(e){}return n?d(O||(O=V` <foxy-internal-store-shipping-method-form-services-page-item shipping-service-uri="${0}" shipping-method-uri="${0}" data-testclass="item" class="h-l truncate" infer="" href="${0}" ?international-allowed="${0}"> ${0} ${0} </foxy-internal-store-shipping-method-form-services-page-item> `),o._links.self.href,l(null!==(s=this.shippingMethodUri)&&void 0!==s?s:void 0),n,this.internationalAllowed,null==o?void 0:o.name,o.is_international?d(P||(P=V`<foxy-i18n infer="" slot="suffix" key="international_only"></foxy-i18n>`)):""):d(M||(M=V`<div class="h-l"></div>`))})),v({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy")}});let I,N,F=e=>e;customElements.define("foxy-internal-store-shipping-method-form-services-control",class extends h{renderControl(){var e,t;const i=null===(e=this.nucleon)||void 0===e?void 0:e.data,r=null===(t=this.nucleon)||void 0===t?void 0:t.form;if(!i)return d(I||(I=F``));const s=new URL(i._links["fx:shipping_services"].href);return s.searchParams.set("limit","10"),d(N||(N=F` <foxy-pagination first="${0}" infer=""> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="header"> </foxy-i18n> <foxy-internal-store-shipping-method-form-services-page store-shipping-services-uri="${0}" shipping-method-uri="${0}" class="border border-contrast-10 rounded-t-l rounded-b-l mb-s" infer="" ?international-allowed="${0}"> </foxy-internal-store-shipping-method-form-services-page> </foxy-pagination> `),s.toString(),i._links["fx:store_shipping_services"].href,i._links["fx:shipping_method"].href,!!r.use_for_international)}});let z,B=e=>e;const q=f(p,"store-shipping-method-form"),D=e=>{try{return new URL(e),!0}catch(e){return!1}};class L extends q{constructor(){super(...arguments),this.shippingMethods=null,this.__destinations=[{value:"domestic",label:"domestic"},{value:"international",label:"international"}],this.__getDestinations=()=>{const e=[];return this.form.use_for_domestic&&e.push("domestic"),this.form.use_for_international&&e.push("international"),e},this.__setDestinations=e=>{this.edit({use_for_domestic:e.includes("domestic"),use_for_international:e.includes("international")})}}static get properties(){return a(a({},super.properties),{},{shippingMethods:{type:String,attribute:"shipping-methods"}})}static get v8n(){return[({shipping_method_uri:e})=>e&&D(e)||"shipping-method-uri:required",({accountid:e})=>!e||e.length<=50||"accountid:too_long",({password:e})=>!e||e.length<=50||"password:too_long",({meter_number:e})=>!e||e.length<=50||"meter-number:too_long",({authentication_key:e})=>!e||e.length<=50||"authentication-key:too_long",({custom_code:e})=>!e||new Blob([e]).size/1024<=64||"custom-code:too_long",e=>{var t;return"CUSTOM-ENDPOINT-POST"!==(null===(t=e._embedded)||void 0===t?void 0:t["fx:shipping_method"].code)||(e.accountid&&D(e.accountid)||"endpoint:required")},e=>{var t;const i=e.shipping_container_uri,r=null===(t=e._embedded)||void 0===t?void 0:t["fx:shipping_method"].code;return!r||!["USPS","FedEx","UPS"].includes(r)||(i&&D(i)||"shipping-container-uri:required")},e=>{var t;const i=e.shipping_drop_type_uri,r=null===(t=e._embedded)||void 0===t?void 0:t["fx:shipping_method"].code;return!r||!["FedEx","UPS"].includes(r)||(i&&D(i)||"shipping-drop-type-uri:required")}]}get hiddenSelector(){var e;const t=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"].code;if(!t)return new g("not=shipping-method-uri,timestamps,create,delete");const i=["shipping-container-uri","shipping-drop-type-uri","destinations"],r=["authentication-key","meter-number","accountid","password"],s={"CUSTOM-ENDPOINT-POST":["endpoint"],"CUSTOM-CODE":["custom-code"],CUSTOM:["destinations","services"],FedEx:[...i,...r,"services"],USPS:[...i,"services"],UPS:[...i,...r,"services"]};if(s[t]){const e=["shipping-method-uri",...s[t],"timestamps","delete","create"];return new g(`not=${e.join()} ${super.hiddenSelector}`)}return super.hiddenSelector}renderBody(){var e,t,i,r,s,o;const n=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"];return d(z||(z=B` <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-method-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-container-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-drop-type-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-checkbox-group-control infer="destinations" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-text-control infer="authentication-key"> </foxy-internal-text-control> <foxy-internal-text-control infer="meter-number"></foxy-internal-text-control> <foxy-internal-text-control infer="${0}" property="accountid"> </foxy-internal-text-control> <foxy-internal-text-control infer="password"></foxy-internal-text-control> <foxy-internal-text-area-control infer="custom-code"></foxy-internal-text-area-control> <foxy-internal-store-shipping-method-form-services-control infer="services"> </foxy-internal-store-shipping-method-form-services-control> ${0} `),l(null!==(t=this.shippingMethods)&&void 0!==t?t:null===(i=this.form._links)||void 0===i?void 0:i["fx:shipping_methods"].href),null===(r=this.form._embedded)||void 0===r?void 0:r["fx:shipping_method"],(e=>{const{selectedItem:t}=e.currentTarget,i={"fx:shipping_method":t};this.edit({_embedded:i,shipping_container_uri:"",shipping_drop_type_uri:""})}),l(null==n?void 0:n._links["fx:shipping_containers"].href),null===(s=this.form._embedded)||void 0===s?void 0:s["fx:shipping_container"],(e=>{const{selectedItem:t}=e.currentTarget,i=a(a({},this.form._embedded),{},{"fx:shipping_container":t});this.edit({_embedded:i})}),l(null==n?void 0:n._links["fx:shipping_drop_types"].href),null===(o=this.form._embedded)||void 0===o?void 0:o["fx:shipping_drop_type"],(e=>{const{selectedItem:t}=e.currentTarget,i=a(a({},this.form._embedded),{},{"fx:shipping_drop_type":t});this.edit({_embedded:i})}),this.__getDestinations,this.__setDestinations,this.__destinations,"CUSTOM-ENDPOINT-POST"===(null==n?void 0:n.code)?"endpoint":"accountid",super.renderBody())}}customElements.define("foxy-store-shipping-method-form",L);export{L as StoreShippingMethodForm};
@@ -1 +1 @@
1
- import"./shared-8e9a3bbb.js";import"./shared-2188d5f7.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{_ as t}from"./shared-fadcb2e1.js";import{h as s}from"./shared-dc73b9a5.js";import{C as e}from"./shared-98497473.js";import{N as i}from"./shared-ac44429d.js";import{R as a,T as r,a as n}from"./shared-62169210.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-dc1c6edd.js";import"./shared-ae415a98.js";import"./shared-92327224.js";import"./shared-9803aa7c.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";let l,c=t=>t;const m=e(a(r(n(i,"subscription-card"))));class p extends m{render(){var t,e,i,a,r;const n=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(l||(l=c` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-semibold origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-semibold leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":n&&!d,"text-body bg-contrast-5":!n&&!d,"text-error bg-error-10":d}),d?"error-outline":n?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!n&&!d,"text-success":n&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(r=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(!this.in({idle:"snapshot"}))return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count:t.length}}__getStatusOptions(){var t,s;return this.in({idle:"snapshot"})?{date:null!==(s=null!==(t=this.data.first_failed_transaction_date)&&void 0!==t?t:this.data.end_date)&&void 0!==s?s:this.data.next_transaction_date}:{}}__getPriceOptions(){if(!this.in({idle:"snapshot"}))return{};const s=this.data._embedded["fx:last_transaction"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){var t,s,e;if(null===(t=this.data)||void 0===t?void 0:t.first_failed_transaction_date)return"subscription_failed";if(null===(s=this.data)||void 0===s?void 0:s.end_date){return new Date(this.data.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return"subscription_"+((null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive")}}customElements.define("foxy-subscription-card",p);export{p as SubscriptionCard};
1
+ import"./shared-412670b8.js";import"./shared-3e3c07ac.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-2f0efb2c.js";import{_ as t}from"./shared-ca0f14c1.js";import{h as s}from"./shared-dc73b9a5.js";import{C as e}from"./shared-85d45495.js";import{N as i}from"./shared-619adfad.js";import{R as a,T as r,a as n}from"./shared-f31044b8.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-6ce2acfa.js";import"./shared-91b86bae.js";import"./shared-3a7cf739.js";import"./shared-9803aa7c.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";import"./shared-4c0520f6.js";let l,c=t=>t;const m=e(a(r(n(i,"subscription-card"))));class f extends m{render(){var t,e,i,a,r;const n=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(l||(l=c` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-semibold origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-semibold leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":n&&!d,"text-body bg-contrast-5":!n&&!d,"text-error bg-error-10":d}),d?"error-outline":n?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!n&&!d,"text-success":n&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(r=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(!this.in({idle:"snapshot"}))return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count:t.length}}__getStatusOptions(){var t,s;return this.in({idle:"snapshot"})?{date:null!==(s=null!==(t=this.data.first_failed_transaction_date)&&void 0!==t?t:this.data.end_date)&&void 0!==s?s:this.data.next_transaction_date}:{}}__getPriceOptions(){if(!this.in({idle:"snapshot"}))return{};const s=this.data._embedded["fx:last_transaction"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){var t,s,e;if(null===(t=this.data)||void 0===t?void 0:t.first_failed_transaction_date)return"subscription_failed";if(null===(s=this.data)||void 0===s?void 0:s.end_date){return new Date(this.data.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return"subscription_"+((null===(e=this.data)||void 0===e?void 0:e.is_active)?"active":"inactive")}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
@@ -1,4 +1,4 @@
1
- import{P as e,h as t}from"./shared-ae415a98.js";import{E as s,T as i}from"./shared-195fd5af.js";import"./shared-2188d5f7.js";import"./shared-31c43743.js";import{z as a,S as n,T as o,a as r}from"./shared-62169210.js";import{c as l,h as d}from"./shared-dc73b9a5.js";import"./shared-a052131e.js";import"./shared-c5c60417.js";import"./shared-8e9a3bbb.js";import"./foxy-cancellation-form.js";import"./shared-e1c1e8e2.js";import"./foxy-collection-pages.js";import"./foxy-form-dialog.js";import{P as c}from"./shared-39f2c345.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-c309e0ef.js";import{_ as u,k as h}from"./shared-fadcb2e1.js";import{c as m}from"./shared-4e709717.js";import{C as f}from"./shared-63685d2e.js";import"./shared-c8677ba3.js";import{S as p}from"./shared-2bdd4f74.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import{G as y}from"./shared-6d104622.js";import{p as b}from"./shared-26ce8d23.js";import{j as g}from"./shared-1bbd9b73.js";import{C as _}from"./shared-98497473.js";import"./foxy-nucleon-element.js";import{T as v}from"./shared-f84686a8.js";import{i as x}from"./shared-9803aa7c.js";import{p as $}from"./shared-dc1c6edd.js";import{s as w}from"./shared-2061be9a.js";import{N as E}from"./shared-ac44429d.js";import"./shared-c89ba319.js";import"./shared-92327224.js";import"./shared-99940888.js";import"./shared-7c8bb60c.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-bb686fc6.js";import"./shared-a0836fa5.js";import"./shared-7474af47.js";a("vcf-tooltip",l`
1
+ import{P as e,h as t}from"./shared-91b86bae.js";import{E as s,T as i}from"./shared-084b6372.js";import"./shared-3e3c07ac.js";import"./shared-4560425c.js";import{z as a,S as n,T as o,a as r}from"./shared-f31044b8.js";import{c as l,h as d}from"./shared-dc73b9a5.js";import"./shared-c63ba384.js";import"./shared-71acf673.js";import"./shared-412670b8.js";import"./foxy-cancellation-form.js";import"./shared-e1c1e8e2.js";import"./foxy-collection-pages.js";import"./foxy-form-dialog.js";import{P as c}from"./shared-daa454bf.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-2f0efb2c.js";import{_ as h,k as u}from"./shared-ca0f14c1.js";import{c as m}from"./shared-4e709717.js";import{C as f}from"./shared-11f0daea.js";import"./shared-6f89d2e0.js";import{S as p}from"./shared-ec7cfc23.js";import"./shared-901ca702.js";import"./shared-c7280a24.js";import"./shared-fe68657a.js";import{G as y}from"./shared-189dfb49.js";import{p as b}from"./shared-023c287a.js";import{j as g}from"./shared-9be1a70f.js";import{C as _}from"./shared-85d45495.js";import"./foxy-nucleon-element.js";import{T as v}from"./shared-fcbf9a41.js";import{i as x}from"./shared-9803aa7c.js";import{p as $}from"./shared-6ce2acfa.js";import{s as w}from"./shared-2061be9a.js";import{N as E}from"./shared-619adfad.js";import"./shared-74a27421.js";import"./shared-3a7cf739.js";import"./shared-23fd456c.js";import"./shared-99940888.js";import"./shared-4c0520f6.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-9ef81b37.js";import"./shared-60c862aa.js";import"./shared-d91ed0a8.js";a("vcf-tooltip",l`
2
2
  :host {
3
3
  /* Sizing */
4
4
  --lumo-tooltip-size: var(--lumo-size-m);
@@ -92,10 +92,10 @@ import{P as e,h as t}from"./shared-ae415a98.js";import{E as s,T as i}from"./shar
92
92
  <iron-icon icon="lumo:cross"></iron-icon>
93
93
  </vaadin-button>
94
94
  </div>
95
- `}static get is(){return"vcf-tooltip"}static get version(){return"1.3.15"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:e,hidden:t,position:s}=this;this.hidden||this._setPosition(e,t,s)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(e,t){t&&(this._removeTargetEvents(t),t.describedby&&(t.removeAttribute("aria-describedby"),delete t.describedby)),e&&(this._addEvents(),e.getAttribute("aria-describedby")||(e.setAttribute("aria-describedby",this.id),e.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(e){e.removeEventListener("mouseenter",this._boundShow),e.removeEventListener("focus",this._boundShow),e.removeEventListener("mouseleave",this._boundHide),e.removeEventListener("blur",this._boundHide),e.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(e,t,s){if(e&&!t){let e=window.innerHeight,t=window.innerWidth;this.offsetParent&&(e=this.offsetParent.scrollHeight,t=this.offsetParent.scrollWidth);const i=this.targetElement.getBoundingClientRect(),a=this.getBoundingClientRect(),n=(i.width-a.width)/2,o=(i.height-a.height)/2;let r,l,d=i.left,c=i.top,u=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,u=0),s){case"top":l=c-a.height+u,r=this._calculateLeft(d,i,a,n);break;case"bottom":l=c+i.height+u,r=this._calculateLeft(d,i,a,n);break;case"left":r=d-a.width,l=this._calculateTop(c,i,a,o,u);break;case"right":r=d+i.width,l=this._calculateTop(c,i,a,o,u)}this._setPositionInVisibleBounds(e,t,r,l,a)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(e,t,s,i,a){s+a.width>t?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,s)+"px",this.style.right="auto"),i+a.height>e?(this.style.bottom=e+"px",this.style.top="auto"):(this.style.top=Math.max(0,i)+"px",this.style.bottom="auto")}_calculateLeft(e,t,s,i){switch(this.align){case"left":return e;case"right":return t.left+t.width-s.width;default:return e+i}}_calculateTop(e,t,s,i,a){switch(this.align){case"top":return e+a;case"bottom":return e+t.height-s.height+a;default:return e+i+a}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(e){e?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(e){27===e.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function T(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(g(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}customElements.define(S.is,S),window.Vaadin.VcfTooltip=S;class j extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function q(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const i=parseInt(e.substring(0,e.length-1));if(isNaN(i))throw new j(e);if(e.endsWith("y"))return 31536e6*i;if(e.endsWith("m"))return i*s;if(e.endsWith("w"))return 6048e5*i;if(e.endsWith("d"))return i*t;throw new j(e)}function D(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(g(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,i,a,n,o;if(t.min){const s=e.min?q(e.min):1/0;q(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?q(e.max):-1/0;q(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(i=e.allowedDaysOfWeek)&&void 0!==i?i:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(a=t.allowedDays)||void 0===a?void 0:a.type)){const s=[...null!==(n=e.allowedDaysOfMonth)&&void 0!==n?n:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(o=e.disallowedDates)&&void 0!==o?o:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function k(e){const[t,s,i]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,i)}function O(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const i=k(e.value),a=i.getTime(),n=D(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof n)return n;if(!1===(null===(t=n.allowedDaysOfMonth)||void 0===t?void 0:t.includes(i.getDate())))return!1;if(!1===(null===(s=n.allowedDaysOfWeek)||void 0===s?void 0:s.includes(i.getDay())))return!1;if(n.disallowedDates&&n.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>k(e).getTime()));return a===t||void 0!==s&&a>=t&&a<=s})))return!1;if(n.min){const e=b(n.min);if(null!==e&&Date.now()+e>=a)return!1}if(n.max){const e=b(n.max);if(null!==e&&Date.now()+e<=a)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}const A=["html"];let L,z,I,C,N,H,P,F,V,B,M,W,K,Q,R,J,G,Y,U,X,Z,ee=e=>e;const te=n(o(_(r(E,"subscription-form"))));class se extends te{constructor(){super(...arguments),this.settings=null,this.templates={},this.__renderHeaderSubtitle=()=>{var e;const{data:t,lang:s,ns:i}=this;if(t){let a,n,o="text-secondary";if(t.first_failed_transaction_date)o="text-error",a=t.first_failed_transaction_date,n="subscription_failed";else if(t.end_date){a=t.end_date;n=new Date(a).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else a=null!==(e=t.next_transaction_date)&&void 0!==e?e:(new Date).toISOString(),n="subscription_"+(t.is_active?"active":"inactive");const r=d(L||(L=ee` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:a}),o,s,n,i);return t.first_failed_transaction_date?d(z||(z=ee` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,r,t.error_message):r}return d(I||(I=ee`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){const i=$(e.frequency),a=e._embedded["fx:last_transaction"].currency_code,n=e._embedded["fx:last_transaction"].total_order;return d(C||(C=ee` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(u({},i),{},{amount:`${n} ${a}`})),t,".5m"===e.frequency?"twice_a_month":"recurring",s)}return d(N||(N=ee`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=()=>d(H||(H=ee` <div data-testid="header"> ${0} <div class="leading-xs text-xxl font-bold">${0}</div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>d(P||(P=ee` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItemsItem=e=>{const t=e.price.toLocaleString(this.lang||"en",{style:"currency",currency:this.data._embedded["fx:last_transaction"].currency_code});let s;return s=e.quantity>1?d(F||(F=ee` <div data-testclass="item-quantity" class="px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold"> ${0} </div> `),e.quantity):d(V||(V=ee``)),d(B||(B=ee` <figure class="flex items-center space-x-m py-s pr-m" data-testclass="item"> <x-preview data-testclass="item-preview" class="w-l h-l" .quantity="${0}" .image="${0}"> </x-preview> <figcaption class="leading-s flex-1 flex justify-between items-center"> <div class="flex flex-col"> <span class="font-medium" data-testclass="item-name">${0}</span> <span class="text-secondary text-s" data-testclass="item-price">${0}</span> </div> ${0} </figcaption> </figure> `),e.quantity,e.image,e.name,t,s)},this.__renderItems=()=>{var e,t;const s=this.hiddenSelector,i=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:transaction_template"]._embedded["fx:items"])&&void 0!==t?t:[],a=s.matches("items:actions",!0)?"":this.__renderItemsActions();return d(M||(M=ee` <div data-testid="items"> ${0} <x-group frame> <div slot="header">${0}</div> <div class="divide-y divide-contrast-10 pl-s">${0}</div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("items:before"),a,i.map(this.__renderItemsItem),this.renderTemplateOrSlot("items:after"))},this.__renderEndDate=()=>{const{disabledSelector:e,lang:t,ns:s}=this,i=this.hiddenSelector.zoom("end-date:form").toString();return d(W||(W=ee` <div> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),e.zoom("end-date:form").toString(),i,this.parent,this.href,t,s,this.getNestedTemplates("end-date:form"),!this.data||e.matches("end-date",!0),(e=>{this.renderRoot.querySelector("#end-date-form").show(e.currentTarget)}),s,t,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return O({value:w(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return d(K||(K=ee` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,x(null==e?void 0:e.next_transaction_date.substr(0,10)),x(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",$(e)),value:e})));return d(Q||(Q=ee` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),x(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return d(R||(R=ee` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>d(J||(J=ee` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify($(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>d(G||(G=ee` <div> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__transactionsTableColumns=[{cell(e){var t;const s=v.statusColumn.cell(e),i=v.priceColumn.cell(e),a=null!==(t={declined:"text-error",rejected:"text-error"}[e.data.status])&&void 0!==t?t:"text-body";return e.html(Y||(Y=ee`
95
+ `}static get is(){return"vcf-tooltip"}static get version(){return"1.3.15"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:e,hidden:t,position:s}=this;this.hidden||this._setPosition(e,t,s)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(e,t){t&&(this._removeTargetEvents(t),t.describedby&&(t.removeAttribute("aria-describedby"),delete t.describedby)),e&&(this._addEvents(),e.getAttribute("aria-describedby")||(e.setAttribute("aria-describedby",this.id),e.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(e){e.removeEventListener("mouseenter",this._boundShow),e.removeEventListener("focus",this._boundShow),e.removeEventListener("mouseleave",this._boundHide),e.removeEventListener("blur",this._boundHide),e.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(e,t,s){if(e&&!t){let e=window.innerHeight,t=window.innerWidth;this.offsetParent&&(e=this.offsetParent.scrollHeight,t=this.offsetParent.scrollWidth);const i=this.targetElement.getBoundingClientRect(),a=this.getBoundingClientRect(),n=(i.width-a.width)/2,o=(i.height-a.height)/2;let r,l,d=i.left,c=i.top,h=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,h=0),s){case"top":l=c-a.height+h,r=this._calculateLeft(d,i,a,n);break;case"bottom":l=c+i.height+h,r=this._calculateLeft(d,i,a,n);break;case"left":r=d-a.width,l=this._calculateTop(c,i,a,o,h);break;case"right":r=d+i.width,l=this._calculateTop(c,i,a,o,h)}this._setPositionInVisibleBounds(e,t,r,l,a)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(e,t,s,i,a){s+a.width>t?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,s)+"px",this.style.right="auto"),i+a.height>e?(this.style.bottom=e+"px",this.style.top="auto"):(this.style.top=Math.max(0,i)+"px",this.style.bottom="auto")}_calculateLeft(e,t,s,i){switch(this.align){case"left":return e;case"right":return t.left+t.width-s.width;default:return e+i}}_calculateTop(e,t,s,i,a){switch(this.align){case"top":return e+a;case"bottom":return e+t.height-s.height+a;default:return e+i+a}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(e){e?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(e){27===e.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function T(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(g(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}customElements.define(S.is,S),window.Vaadin.VcfTooltip=S;class j extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function q(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const i=parseInt(e.substring(0,e.length-1));if(isNaN(i))throw new j(e);if(e.endsWith("y"))return 31536e6*i;if(e.endsWith("m"))return i*s;if(e.endsWith("w"))return 6048e5*i;if(e.endsWith("d"))return i*t;throw new j(e)}function D(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(g(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,i,a,n,o;if(t.min){const s=e.min?q(e.min):1/0;q(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?q(e.max):-1/0;q(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(i=e.allowedDaysOfWeek)&&void 0!==i?i:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(a=t.allowedDays)||void 0===a?void 0:a.type)){const s=[...null!==(n=e.allowedDaysOfMonth)&&void 0!==n?n:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(o=e.disallowedDates)&&void 0!==o?o:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function k(e){const[t,s,i]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,i)}function O(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const i=k(e.value),a=i.getTime(),n=D(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof n)return n;if(!1===(null===(t=n.allowedDaysOfMonth)||void 0===t?void 0:t.includes(i.getDate())))return!1;if(!1===(null===(s=n.allowedDaysOfWeek)||void 0===s?void 0:s.includes(i.getDay())))return!1;if(n.disallowedDates&&n.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>k(e).getTime()));return a===t||void 0!==s&&a>=t&&a<=s})))return!1;if(n.min){const e=b(n.min);if(null!==e&&Date.now()+e>=a)return!1}if(n.max){const e=b(n.max);if(null!==e&&Date.now()+e<=a)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}const A=["html"];let L,z,I,C,N,H,P,F,V,B,M,W,K,Q,R,J,G,Y,U,X,Z,ee=e=>e;const te=n(o(_(r(E,"subscription-form"))));class se extends te{constructor(){super(...arguments),this.settings=null,this.templates={},this.__renderHeaderSubtitle=()=>{var e;const{data:t,lang:s,ns:i}=this;if(t){let a,n,o="text-secondary";if(t.first_failed_transaction_date)o="text-error",a=t.first_failed_transaction_date,n="subscription_failed";else if(t.end_date){a=t.end_date;n=new Date(a).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else a=null!==(e=t.next_transaction_date)&&void 0!==e?e:(new Date).toISOString(),n="subscription_"+(t.is_active?"active":"inactive");const r=d(L||(L=ee` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:a}),o,s,n,i);return t.first_failed_transaction_date?d(z||(z=ee` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,r,t.error_message):r}return d(I||(I=ee`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){const i=$(e.frequency),a=e._embedded["fx:last_transaction"].currency_code,n=e._embedded["fx:last_transaction"].total_order;return d(C||(C=ee` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(h(h({},i),{},{amount:`${n} ${a}`})),t,".5m"===e.frequency?"twice_a_month":"recurring",s)}return d(N||(N=ee`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=()=>d(H||(H=ee` <div data-testid="header"> ${0} <div class="leading-xs text-xxl font-bold">${0}</div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>d(P||(P=ee` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItemsItem=e=>{const t=e.price.toLocaleString(this.lang||"en",{style:"currency",currency:this.data._embedded["fx:last_transaction"].currency_code});let s;return s=e.quantity>1?d(F||(F=ee` <div data-testclass="item-quantity" class="px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold"> ${0} </div> `),e.quantity):d(V||(V=ee``)),d(B||(B=ee` <figure class="flex items-center space-x-m py-s pr-m" data-testclass="item"> <x-preview data-testclass="item-preview" class="w-l h-l" .quantity="${0}" .image="${0}"> </x-preview> <figcaption class="leading-s flex-1 flex justify-between items-center"> <div class="flex flex-col"> <span class="font-medium" data-testclass="item-name">${0}</span> <span class="text-secondary text-s" data-testclass="item-price">${0}</span> </div> ${0} </figcaption> </figure> `),e.quantity,e.image,e.name,t,s)},this.__renderItems=()=>{var e,t;const s=this.hiddenSelector,i=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:transaction_template"]._embedded["fx:items"])&&void 0!==t?t:[],a=s.matches("items:actions",!0)?"":this.__renderItemsActions();return d(M||(M=ee` <div data-testid="items"> ${0} <x-group frame> <div slot="header">${0}</div> <div class="divide-y divide-contrast-10 pl-s">${0}</div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("items:before"),a,i.map(this.__renderItemsItem),this.renderTemplateOrSlot("items:after"))},this.__renderEndDate=()=>{const{disabledSelector:e,lang:t,ns:s}=this,i=this.hiddenSelector.zoom("end-date:form").toString();return d(W||(W=ee` <div> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),e.zoom("end-date:form").toString(),i,this.parent,this.href,t,s,this.getNestedTemplates("end-date:form"),!this.data||e.matches("end-date",!0),(e=>{this.renderRoot.querySelector("#end-date-form").show(e.currentTarget)}),s,t,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return O({value:w(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return d(K||(K=ee` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,x(null==e?void 0:e.next_transaction_date.substr(0,10)),x(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",$(e)),value:e})));return d(Q||(Q=ee` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),x(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return d(R||(R=ee` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>d(J||(J=ee` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify($(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>d(G||(G=ee` <div> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__transactionsTableColumns=[{cell(e){var t;const s=v.statusColumn.cell(e),i=v.priceColumn.cell(e),a=null!==(t={declined:"text-error",rejected:"text-error"}[e.data.status])&&void 0!==t?t:"text-body";return e.html(Y||(Y=ee`
96
96
  <span class="sr-only">${0}</span>
97
97
  <span class="${0} text-s">${0}</span>
98
- `),s,a,i)}},{cell:v.idColumn.cell,hideBelow:"sm"},{cell:v.dateColumn.cell},{cell:v.receiptColumn.cell}],this.__renderTransactionsPage=e=>{let{html:t}=e,s=h(e,A);var i,a;return t(U||(U=ee`
98
+ `),s,a,i)}},{cell:v.idColumn.cell,hideBelow:"sm"},{cell:v.dateColumn.cell},{cell:v.receiptColumn.cell}],this.__renderTransactionsPage=e=>{let{html:t}=e,s=u(e,A);var i,a;return t(U||(U=ee`
99
99
  <foxy-table
100
100
  group=${0}
101
101
  lang=${0}
@@ -104,7 +104,7 @@ import{P as e,h as t}from"./shared-ae415a98.js";import{E as s,T as i}from"./shar
104
104
  .columns=${0}
105
105
  >
106
106
  </foxy-table>
107
- `),s.group,s.lang,s.href,s.ns,null!==(a=null===(i=customElements.get("foxy-transactions-table"))||void 0===i?void 0:i.defaultNS)&&void 0!==a?a:"",this.__transactionsTableColumns)},this.__renderTransactions=()=>{var e,t;const{lang:s,ns:i}=this;return d(X||(X=ee` <div data-testid="transactions"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="transaction_plural" ns="${0}"></foxy-i18n> <foxy-collection-pages group="${0}" class="block divide-y divide-contrast-10 px-m" first="${0}" lang="${0}" ns="${0}" .page="${0}"> </foxy-collection-pages> </x-group> ${0} </div> `),this.renderTemplateOrSlot("transactions:before"),s,i,this.group,null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"",s,i,this.__renderTransactionsPage,this.renderTemplateOrSlot("transactions:after"))}}static get scopedElements(){return{"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-collection-pages":customElements.get("foxy-collection-pages"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":p,"x-preview":c,"x-choice":f,"x-group":y}}static get properties(){return u(u({},super.properties),{},{settings:{type:Object}})}render(){var e,t;const s=this.in("busy"),i=this.in("fail");return d(Z||(Z=ee` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative space-y-l text-body font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),s,this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.hiddenSelector.matches("end-date",!0)?"":this.__renderEndDate(),this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isFrequencyVisible?this.__renderFrequency():"",this.hiddenSelector.matches("transactions",!0)?"":this.__renderTransactions(),m({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!s&&!i}),i?"error":s?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),D(e,s)}(this.data,e)}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!T({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=T({subscription:this.data,settings:this.settings});return Array.from(e)}}let ie;a("vcf-tooltip",l(ie||(ie=(e=>e)`
107
+ `),s.group,s.lang,s.href,s.ns,null!==(a=null===(i=customElements.get("foxy-transactions-table"))||void 0===i?void 0:i.defaultNS)&&void 0!==a?a:"",this.__transactionsTableColumns)},this.__renderTransactions=()=>{var e,t;const{lang:s,ns:i}=this;return d(X||(X=ee` <div data-testid="transactions"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="transaction_plural" ns="${0}"></foxy-i18n> <foxy-collection-pages group="${0}" class="block divide-y divide-contrast-10 px-m" first="${0}" lang="${0}" ns="${0}" .page="${0}"> </foxy-collection-pages> </x-group> ${0} </div> `),this.renderTemplateOrSlot("transactions:before"),s,i,this.group,null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"",s,i,this.__renderTransactionsPage,this.renderTemplateOrSlot("transactions:after"))}}static get scopedElements(){return{"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-collection-pages":customElements.get("foxy-collection-pages"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":p,"x-preview":c,"x-choice":f,"x-group":y}}static get properties(){return h(h({},super.properties),{},{settings:{type:Object}})}render(){var e,t;const s=this.in("busy"),i=this.in("fail");return d(Z||(Z=ee` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative space-y-l text-body font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),s,this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.hiddenSelector.matches("end-date",!0)?"":this.__renderEndDate(),this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isFrequencyVisible?this.__renderFrequency():"",this.hiddenSelector.matches("transactions",!0)?"":this.__renderTransactions(),m({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!s&&!i}),i?"error":s?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),D(e,s)}(this.data,e)}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!T({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=T({subscription:this.data,settings:this.settings});return Array.from(e)}}let ie;a("vcf-tooltip",l(ie||(ie=(e=>e)`
108
108
  :host([hidden]) [part='container']{
109
109
  display:none !important;
110
110
  }
@@ -1 +1 @@
1
- import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{S as s}from"./shared-322e7efb.js";export{S as SubscriptionsTable}from"./shared-322e7efb.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-dc73b9a5.js";import"./shared-8e9a3bbb.js";import"./shared-92327224.js";import"./shared-7474af47.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";import"./shared-dc1c6edd.js";customElements.define("foxy-subscriptions-table",s);
1
+ import"./foxy-spinner.js";import"./shared-2f0efb2c.js";import{S as s}from"./shared-5e43b817.js";export{S as SubscriptionsTable}from"./shared-5e43b817.js";import"./shared-3e3c07ac.js";import"./shared-91b86bae.js";import"./shared-f31044b8.js";import"./shared-ca0f14c1.js";import"./shared-dc73b9a5.js";import"./shared-412670b8.js";import"./shared-3a7cf739.js";import"./shared-d91ed0a8.js";import"./shared-85d45495.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-619adfad.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";import"./shared-4c0520f6.js";import"./shared-4e709717.js";import"./shared-6ce2acfa.js";customElements.define("foxy-subscriptions-table",s);
@@ -1 +1 @@
1
- import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import{T as s}from"./shared-7474af47.js";export{T as Table}from"./shared-7474af47.js";import"./shared-dc73b9a5.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-62169210.js";import"./shared-fadcb2e1.js";import"./shared-8e9a3bbb.js";import"./shared-c309e0ef.js";import"./shared-92327224.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";customElements.define("foxy-table",s);
1
+ import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import{T as s}from"./shared-d91ed0a8.js";export{T as Table}from"./shared-d91ed0a8.js";import"./shared-dc73b9a5.js";import"./shared-3e3c07ac.js";import"./shared-91b86bae.js";import"./shared-f31044b8.js";import"./shared-ca0f14c1.js";import"./shared-412670b8.js";import"./shared-2f0efb2c.js";import"./shared-3a7cf739.js";import"./shared-85d45495.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-619adfad.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";import"./shared-4c0520f6.js";import"./shared-4e709717.js";customElements.define("foxy-table",s);
@@ -1 +1 @@
1
- import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import{h as r}from"./shared-dc73b9a5.js";import{a as e}from"./shared-62169210.js";import{T as a}from"./shared-baf79b0b.js";import"./shared-2188d5f7.js";import"./shared-ae415a98.js";import"./shared-8e9a3bbb.js";import"./shared-fadcb2e1.js";import"./shared-92327224.js";import"./shared-98497473.js";import"./shared-9803aa7c.js";import"./shared-ac44429d.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";import"./shared-7c8bb60c.js";import"./shared-4e709717.js";let t,s,i=r=>r;class o extends(e(a,"tax-card")){render(){return super.render({title:({name:e})=>r(t||(t=i`${0}`),e),subtitle:()=>r(s||(s=i`${0} &bull; ${0}`),this.__typeLabel,this.__rateLabel)})}get __typeLabel(){var r;const{type:e,country:a,region:t,city:s}=null!==(r=this.data)&&void 0!==r?r:{};return"global"===e?this.t("tax_global"):"union"===e?this.t("tax_union"):"country"===e?a:"region"===e?`${a}, ${t}`:"local"===e?`${a}, ${t}, ${s}`:void 0}get __rateLabel(){var r,e;if(!1===(null===(r=this.data)||void 0===r?void 0:r.is_live))return this.t("percent",{fraction:this.data.rate/100});const a=null===(e=this.data)||void 0===e?void 0:e.service_provider;return"onesource"===a?"Thomson Reuters ONESOURCE":"avalara"===a?"Avalara AvaTax 15":"taxjar"===a?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",o);export{o as TaxCard};
1
+ import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-2f0efb2c.js";import{h as r}from"./shared-dc73b9a5.js";import{a}from"./shared-f31044b8.js";import{T as t}from"./shared-2ca6d676.js";import"./shared-3e3c07ac.js";import"./shared-91b86bae.js";import"./shared-412670b8.js";import"./shared-ca0f14c1.js";import"./shared-3a7cf739.js";import"./shared-85d45495.js";import"./shared-9803aa7c.js";import"./shared-619adfad.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";import"./shared-4c0520f6.js";import"./shared-4e709717.js";let e,s,i=r=>r;class o extends(a(t,"tax-card")){render(){return super.render({title:({name:a})=>r(e||(e=i`${0}`),a),subtitle:()=>r(s||(s=i`${0} &bull; ${0}`),this.__typeLabel,this.__rateLabel)})}get __typeLabel(){var r;const{type:a,country:t,region:e,city:s}=null!==(r=this.data)&&void 0!==r?r:{};return"global"===a?this.t("tax_global"):"union"===a?this.t("tax_union"):"country"===a?t:"region"===a?`${t}, ${e}`:"local"===a?`${t}, ${e}, ${s}`:void 0}get __rateLabel(){var r,a;if(!1===(null===(r=this.data)||void 0===r?void 0:r.is_live))return this.t("percent",{fraction:this.data.rate/100});const t=null===(a=this.data)||void 0===a?void 0:a.service_provider;return"onesource"===t?"Thomson Reuters ONESOURCE":"avalara"===t?"Avalara AvaTax 15":"taxjar"===t?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",o);export{o as TaxCard};
@@ -1 +1 @@
1
- import"./shared-bb686fc6.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-c309e0ef.js";import"./shared-4e201e09.js";import"./shared-d28ac9dc.js";import"./shared-dc23b751.js";import"./shared-a052131e.js";import"./shared-c5c60417.js";import{D as e}from"./shared-2bdd4f74.js";import{_ as t}from"./shared-fadcb2e1.js";import{C as i}from"./shared-f1317609.js";import"./shared-63685d2e.js";import"./shared-c8677ba3.js";import{h as r}from"./shared-dc73b9a5.js";import{T as s,S as a,a as n}from"./shared-62169210.js";import"./shared-195fd5af.js";import"./shared-2188d5f7.js";import"./shared-31c43743.js";import{P as o}from"./shared-dd6d3c18.js";import{c as d}from"./shared-4e709717.js";import{a as l}from"./shared-92327224.js";import{C as h}from"./shared-98497473.js";import{N as c}from"./shared-ac44429d.js";import{i as _}from"./shared-9803aa7c.js";import{i as m}from"./shared-7c8bb60c.js";import"./shared-8e9a3bbb.js";import"./shared-ae415a98.js";import"./shared-99940888.js";import"./shared-45feee83.js";import"./shared-7684cb05.js";let p,u,y,g,v,f,$,x,b,S,T,E,k,O,C=e=>e;const w=["US","CA","AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IM","IT","LT","LU","LV","MC","MT","NL","PL","PT","RO","SE","SI","SK"],j=[...w,"AU"],H=h(s(a(n(c,"tax-form"))));class A extends H{constructor(){var e;super(...arguments),e=this,this.templates={},this.__previousCountry=void 0,this.__countries="",this.__regions="",this.__countriesService=m(l.withConfig({services:{sendGet:async function(){const t=await new A.API(e).fetch(e.countries);if(!t.ok)throw new Error(await t.text());return await t.json()}}})),this.__regionsService=m(l.withConfig({services:{sendGet:async function(){var t;const i=new URL(e.regions);i.searchParams.set("country_code",null!==(t=e.form.country)&&void 0!==t?t:"US");const r=await new A.API(e).fetch(i.toString());if(!r.ok)throw new Error(await r.text());return await r.json()}}}))}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"vaadin-button":customElements.get("vaadin-button"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":o,"x-checkbox":i,"x-dropdown":e}}static get properties(){return t(t({},super.properties),{},{countries:{type:String,noAccessor:!0},regions:{type:String,noAccessor:!0}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=30||"name_too_long",({country:e,type:t})=>"country"!==t||!!e||"country_required",({country:e,type:t})=>"region"!==t||!!e||"country_required",({country:e,use_origin_rates:t})=>!t||!!e||"country_required",({country:e})=>!e||!!e.match(/[A-Z]{2}/)||"country_invalid",({region:e,type:t})=>"region"!=t||!!e||"region_required",({region:e})=>!e||e.length<=20||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({city:e,type:t})=>"local"!=t||!!e||"city_required",({rate:e})=>!e||e<=100||"rate_invalid"]}get countries(){return this.__countries}set countries(e){this.__countries=e,e?this.__countriesService.send({type:"FETCH"}):this.__countriesService.send({type:"SET_DATA",data:null})}get regions(){return this.__regions}set regions(e){this.__regions=e,e?this.__regionsService.send({type:"FETCH"}):this.__regionsService.send({type:"SET_DATA",data:null})}connectedCallback(){super.connectedCallback(),this.__countriesService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__countriesService.onChange((()=>this.requestUpdate())),this.__countriesService.start(),this.__regionsService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__regionsService.onChange((()=>this.requestUpdate())),this.__regionsService.start()}render(){var e,t;return r(p||(p=C` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isNameHidden?null:this.__renderName(),this.__isTypeHidden?null:this.__renderType(),this.__isCountryHidden?null:this.__renderCountry(),this.__isRegionHidden?null:this.__renderRegion(),this.__isCityHidden?null:this.__renderCity(),this.__isProviderHidden?null:this.__renderProvider(),this.__isRateHidden?null:this.__renderRate(),this.__isApplyToShippingHidden?null:this.__renderApplyToShipping(),this.__isUseOriginRatesHidden?null:this.__renderUseOriginRates(),this.__isExemptAllCustomerTaxIdsHidden?null:this.__renderExemptAllCustomerTaxIds(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}updated(e){super.updated(e),this.form.country!==this.__previousCountry&&(this.__previousCountry=this.form.country,this.__regionsService.send({type:"FETCH"})),this.renderRoot.querySelectorAll("vaadin-combo-box").forEach((e=>e.validate()))}disconnectedCallback(){super.disconnectedCallback(),this.__countriesService.stop(),this.__regionsService.stop()}get __isNameHidden(){return this.hiddenSelector.matches("name",!0)}get __isTypeHidden(){return this.hiddenSelector.matches("type",!0)}get __isCountryHidden(){return!!this.hiddenSelector.matches("country",!0)||("union"===this.form.type?!this.form.use_origin_rates:!["country","region","local"].includes(this.form.type))}get __isRegionHidden(){return!!this.hiddenSelector.matches("region",!0)||"local"!==this.form.type&&"region"!==this.form.type}get __isCityHidden(){return!!this.hiddenSelector.matches("city",!0)||"local"!==this.form.type}get __isProviderHidden(){return!!this.hiddenSelector.matches("provider",!0)||(!this.form.type||"global"===this.form.type||"local"===this.form.type)}get __isRateHidden(){return!!this.hiddenSelector.matches("rate",!0)||(!this.form.type||!0===this.form.is_live)}get __isApplyToShippingHidden(){return!!this.hiddenSelector.matches("apply-to-shipping",!0)||(void 0===this.form.type||!!this.form.is_live&&w.includes(this.form.country))}get __isUseOriginRatesHidden(){return!!this.hiddenSelector.matches("use-origin-rates",!0)||("union"!==this.form.type||!this.form.is_live||!!this.form.service_provider)}get __isExemptAllCustomerTaxIdsHidden(){if(this.hiddenSelector.matches("exempt-all-customer-tax-ids",!0))return!0;const e=this.form.service_provider;return void 0===e||"onesource"===e||"avalara"===e}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return r(u||(u=C` <div> ${0} <vaadin-text-field data-testid="name" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.t("name"),_(this.form.name),this.__getValidator("name"),this.__getErrorMessage("name"),!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderType(){return this.form.type||this.edit({type:"global"}),r(y||(y=C` <div> ${0} <x-dropdown data-testid="type" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("type:before"),this.t("type"),_(this.form.type),["global","union","country","region","local"],(e=>this.t(`tax_${e}`)),!this.in("idle")||this.disabledSelector.matches("type",!0),this.readonlySelector.matches("type",!0),(e=>{this.edit({type:e.detail,country:"",region:"",city:"",service_provider:"",apply_to_shipping:!1,use_origin_rates:!1,exempt_all_customer_tax_ids:!1,is_live:!1,rate:0})}),this.renderTemplateOrSlot("type:after"))}__renderCountry(){var e;const t=this.__countriesService.state.matches("busy"),i=this.in("busy"),s=t||i,a=this.in("fail"),n=this.__countriesService.state.context.data,o=Object.values(null!==(e=null==n?void 0:n.values)&&void 0!==e?e:{});return r(g||(g=C` <div> ${0} <vaadin-combo-box item-value-path="cc2" item-label-path="default" item-id-path="cc2" data-testid="country" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("country:before"),this.t("country"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.country),this.__getValidator("country"),this.__getErrorMessage("country"),o,0===o.length,a||s||this.disabledSelector.matches("country",!0),this.readonlySelector.matches("country",!0),(e=>{this.edit({country:e.currentTarget.value,region:"",city:"",is_live:!1,service_provider:""}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__regionsService.send({type:"FETCH"})}),this.renderTemplateOrSlot("country:after"))}__renderRegion(){var e;const t=this.__regionsService.state.matches("busy"),i=this.in("busy"),s=t||i,a=this.in("fail"),n=this.__regionsService.state.context.data,o=Object.values(null!==(e=null==n?void 0:n.values)&&void 0!==e?e:{});return r(v||(v=C` <div> ${0} <vaadin-combo-box item-value-path="code" item-label-path="default" item-id-path="code" data-testid="region" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("region:before"),this.t("region"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.region),this.__getValidator("region"),this.__getErrorMessage("region"),o,0===o.length,a||s||this.disabledSelector.matches("region",!0),this.readonlySelector.matches("region",!0),(e=>{const t=e.currentTarget.value;this.edit({region:t,city:""})}),this.renderTemplateOrSlot("region:after"))}__renderCity(){return r(f||(f=C` <div> ${0} <vaadin-text-field data-testid="city" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("city:before"),this.t("city"),_(this.form.city),this.__getValidator("city"),this.__getErrorMessage("city"),!this.in("idle")||this.disabledSelector.matches("city",!0),this.readonlySelector.matches("city",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({city:t})}),this.renderTemplateOrSlot("city:after"))}__renderProvider(){const e=[{label:this.t("tax_rate_provider_none"),value:"none"},{label:"Avalara AvaTax 15",value:"avalara"},{label:"Thomson Reuters ONESOURCE",value:"onesource"}];return("union"===this.form.type||w.includes(this.form.country))&&e.push({label:this.t("tax_rate_provider_default"),value:"default"}),j.includes(this.form.country)&&e.push({label:"TaxJar",value:"taxjar"}),r($||($=C` <div> ${0} <x-dropdown data-testid="provider" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("provider:before"),this.t("tax_rate_provider"),this.form.service_provider||(this.form.is_live?"default":"none"),e.map((e=>e.value)),(t=>{var i;return null===(i=e.find((e=>e.value===t)))||void 0===i?void 0:i.label}),!this.in("idle")||this.disabledSelector.matches("provider",!0),this.readonlySelector.matches("provider",!0),(e=>{const t=e.detail,i=["none","default"].includes(t)?"":t;this.edit({service_provider:i,is_live:"none"!==t}),this.__isExemptAllCustomerTaxIdsHidden&&this.edit({exempt_all_customer_tax_ids:!1}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__isUseOriginRatesHidden&&this.edit({use_origin_rates:!1})}),this.renderTemplateOrSlot("provider:after"))}__renderRate(){return r(x||(x=C` <div> ${0} <vaadin-integer-field data-testid="rate" class="w-full" label="${0}" value="${0}" min="0" prevent-invalid-input has-controls .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @change="${0}"> </vaadin-integer-field> ${0} </div> `),this.renderTemplateOrSlot("rate:before"),this.t("tax_rate"),_(this.form.rate),this.__getValidator("rate"),this.__getErrorMessage("rate"),!this.in("idle")||this.disabledSelector.matches("rate",!0),this.readonlySelector.matches("rate",!0),this.__submitOnEnter,(e=>{const t=parseInt(e.currentTarget.value);this.edit({rate:t})}),this.renderTemplateOrSlot("rate:after"))}__renderApplyToShipping(){return r(b||(b=C` <div> ${0} <x-checkbox data-testid="apply-to-shipping" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_apply_to_shipping" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_apply_to_shipping_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("apply-to-shipping:before"),!this.in("idle")||this.disabledSelector.matches("apply-to-shipping",!0),this.readonlySelector.matches("apply-to-shipping",!0),!!this.form.apply_to_shipping,(e=>this.edit({apply_to_shipping:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("apply-to-shipping:after"))}__renderUseOriginRates(){return r(S||(S=C` <div> ${0} <x-checkbox data-testid="use-origin-rates" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_use_origin_rates" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_use_origin_rates_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("use-origin-rates:before"),!this.in("idle")||this.disabledSelector.matches("use-origin-rates",!0),this.readonlySelector.matches("use-origin-rates",!0),!!this.form.use_origin_rates,(e=>this.edit({use_origin_rates:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("use-origin-rates:after"))}__renderExemptAllCustomerTaxIds(){const e="exempt-all-customer-tax-ids";return r(T||(T=C` <div> ${0} <x-checkbox data-testid="${0}" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_exempt_all_customer_tax_ids" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_exempt_all_customer_tax_ids_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),e,!this.in("idle")||this.disabledSelector.matches(e,!0),this.readonlySelector.matches(e,!0),!!this.form.exempt_all_customer_tax_ids,(e=>{this.edit({exempt_all_customer_tax_ids:e.detail})}),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot(`${e}:after`))}__renderTimestamps(){return r(E||(E=C` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),s=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=e||t||(i||s),n=this.in("idle");return r(k||(k=C` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!n||a||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return r(O||(O=C` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="primary error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}__submitOnEnter(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-tax-form",A);export{A as TaxForm};
1
+ import"./shared-9ef81b37.js";import"./shared-e1c1e8e2.js";import"./foxy-spinner.js";import"./shared-2f0efb2c.js";import"./shared-901ca702.js";import"./shared-c7280a24.js";import"./shared-fe68657a.js";import"./shared-c63ba384.js";import"./shared-71acf673.js";import{D as e}from"./shared-ec7cfc23.js";import{_ as t}from"./shared-ca0f14c1.js";import{C as i}from"./shared-ff1d9854.js";import"./shared-11f0daea.js";import"./shared-6f89d2e0.js";import{h as r}from"./shared-dc73b9a5.js";import{T as s,S as a,a as n}from"./shared-f31044b8.js";import"./shared-084b6372.js";import"./shared-3e3c07ac.js";import"./shared-4560425c.js";import{P as o}from"./shared-fd595d0a.js";import{c as d}from"./shared-4e709717.js";import{a as l}from"./shared-3a7cf739.js";import{C as h}from"./shared-85d45495.js";import{N as c}from"./shared-619adfad.js";import{i as _}from"./shared-9803aa7c.js";import{i as m}from"./shared-4c0520f6.js";import"./shared-412670b8.js";import"./shared-91b86bae.js";import"./shared-23fd456c.js";import"./shared-99940888.js";import"./shared-9b392ba8.js";import"./shared-7684cb05.js";let p,u,y,g,v,f,$,x,b,S,T,E,k,O,C=e=>e;const j=["US","CA","AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IM","IT","LT","LU","LV","MC","MT","NL","PL","PT","RO","SE","SI","SK"],w=[...j,"AU"],H=h(s(a(n(c,"tax-form"))));class A extends H{constructor(){var e;super(...arguments),e=this,this.templates={},this.__previousCountry=void 0,this.__countries="",this.__regions="",this.__countriesService=m(l.withConfig({services:{sendGet:async function(){const t=await new A.API(e).fetch(e.countries);if(!t.ok)throw new Error(await t.text());return await t.json()}}})),this.__regionsService=m(l.withConfig({services:{sendGet:async function(){var t;const i=new URL(e.regions);i.searchParams.set("country_code",null!==(t=e.form.country)&&void 0!==t?t:"US");const r=await new A.API(e).fetch(i.toString());if(!r.ok)throw new Error(await r.text());return await r.json()}}}))}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"vaadin-button":customElements.get("vaadin-button"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":o,"x-checkbox":i,"x-dropdown":e}}static get properties(){return t(t({},super.properties),{},{countries:{type:String,noAccessor:!0},regions:{type:String,noAccessor:!0}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=30||"name_too_long",({country:e,type:t})=>"country"!==t||!!e||"country_required",({country:e,type:t})=>"region"!==t||!!e||"country_required",({country:e,use_origin_rates:t})=>!t||!!e||"country_required",({country:e})=>!e||!!e.match(/[A-Z]{2}/)||"country_invalid",({region:e,type:t})=>"region"!=t||!!e||"region_required",({region:e})=>!e||e.length<=20||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({city:e,type:t})=>"local"!=t||!!e||"city_required",({rate:e})=>!e||e<=100||"rate_invalid"]}get countries(){return this.__countries}set countries(e){this.__countries=e,e?this.__countriesService.send({type:"FETCH"}):this.__countriesService.send({type:"SET_DATA",data:null})}get regions(){return this.__regions}set regions(e){this.__regions=e,e?this.__regionsService.send({type:"FETCH"}):this.__regionsService.send({type:"SET_DATA",data:null})}connectedCallback(){super.connectedCallback(),this.__countriesService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__countriesService.onChange((()=>this.requestUpdate())),this.__countriesService.start(),this.__regionsService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__regionsService.onChange((()=>this.requestUpdate())),this.__regionsService.start()}render(){var e,t;return r(p||(p=C` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isNameHidden?null:this.__renderName(),this.__isTypeHidden?null:this.__renderType(),this.__isCountryHidden?null:this.__renderCountry(),this.__isRegionHidden?null:this.__renderRegion(),this.__isCityHidden?null:this.__renderCity(),this.__isProviderHidden?null:this.__renderProvider(),this.__isRateHidden?null:this.__renderRate(),this.__isApplyToShippingHidden?null:this.__renderApplyToShipping(),this.__isUseOriginRatesHidden?null:this.__renderUseOriginRates(),this.__isExemptAllCustomerTaxIdsHidden?null:this.__renderExemptAllCustomerTaxIds(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}updated(e){super.updated(e),this.form.country!==this.__previousCountry&&(this.__previousCountry=this.form.country,this.__regionsService.send({type:"FETCH"})),this.renderRoot.querySelectorAll("vaadin-combo-box").forEach((e=>e.validate()))}disconnectedCallback(){super.disconnectedCallback(),this.__countriesService.stop(),this.__regionsService.stop()}get __isNameHidden(){return this.hiddenSelector.matches("name",!0)}get __isTypeHidden(){return this.hiddenSelector.matches("type",!0)}get __isCountryHidden(){return!!this.hiddenSelector.matches("country",!0)||("union"===this.form.type?!this.form.use_origin_rates:!["country","region","local"].includes(this.form.type))}get __isRegionHidden(){return!!this.hiddenSelector.matches("region",!0)||"local"!==this.form.type&&"region"!==this.form.type}get __isCityHidden(){return!!this.hiddenSelector.matches("city",!0)||"local"!==this.form.type}get __isProviderHidden(){return!!this.hiddenSelector.matches("provider",!0)||(!this.form.type||"global"===this.form.type||"local"===this.form.type)}get __isRateHidden(){return!!this.hiddenSelector.matches("rate",!0)||(!this.form.type||!0===this.form.is_live)}get __isApplyToShippingHidden(){return!!this.hiddenSelector.matches("apply-to-shipping",!0)||(void 0===this.form.type||!!this.form.is_live&&j.includes(this.form.country))}get __isUseOriginRatesHidden(){return!!this.hiddenSelector.matches("use-origin-rates",!0)||("union"!==this.form.type||!this.form.is_live||!!this.form.service_provider)}get __isExemptAllCustomerTaxIdsHidden(){if(this.hiddenSelector.matches("exempt-all-customer-tax-ids",!0))return!0;const e=this.form.service_provider;return void 0===e||"onesource"===e||"avalara"===e}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return r(u||(u=C` <div> ${0} <vaadin-text-field data-testid="name" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.t("name"),_(this.form.name),this.__getValidator("name"),this.__getErrorMessage("name"),!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderType(){return this.form.type||this.edit({type:"global"}),r(y||(y=C` <div> ${0} <x-dropdown data-testid="type" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("type:before"),this.t("type"),_(this.form.type),["global","union","country","region","local"],(e=>this.t(`tax_${e}`)),!this.in("idle")||this.disabledSelector.matches("type",!0),this.readonlySelector.matches("type",!0),(e=>{this.edit({type:e.detail,country:"",region:"",city:"",service_provider:"",apply_to_shipping:!1,use_origin_rates:!1,exempt_all_customer_tax_ids:!1,is_live:!1,rate:0})}),this.renderTemplateOrSlot("type:after"))}__renderCountry(){var e;const t=this.__countriesService.state.matches("busy"),i=this.in("busy"),s=t||i,a=this.in("fail"),n=this.__countriesService.state.context.data,o=Object.values(null!==(e=null==n?void 0:n.values)&&void 0!==e?e:{});return r(g||(g=C` <div> ${0} <vaadin-combo-box item-value-path="cc2" item-label-path="default" item-id-path="cc2" data-testid="country" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("country:before"),this.t("country"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.country),this.__getValidator("country"),this.__getErrorMessage("country"),o,0===o.length,a||s||this.disabledSelector.matches("country",!0),this.readonlySelector.matches("country",!0),(e=>{this.edit({country:e.currentTarget.value,region:"",city:"",is_live:!1,service_provider:""}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__regionsService.send({type:"FETCH"})}),this.renderTemplateOrSlot("country:after"))}__renderRegion(){var e;const t=this.__regionsService.state.matches("busy"),i=this.in("busy"),s=t||i,a=this.in("fail"),n=this.__regionsService.state.context.data,o=Object.values(null!==(e=null==n?void 0:n.values)&&void 0!==e?e:{});return r(v||(v=C` <div> ${0} <vaadin-combo-box item-value-path="code" item-label-path="default" item-id-path="code" data-testid="region" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("region:before"),this.t("region"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.region),this.__getValidator("region"),this.__getErrorMessage("region"),o,0===o.length,a||s||this.disabledSelector.matches("region",!0),this.readonlySelector.matches("region",!0),(e=>{const t=e.currentTarget.value;this.edit({region:t,city:""})}),this.renderTemplateOrSlot("region:after"))}__renderCity(){return r(f||(f=C` <div> ${0} <vaadin-text-field data-testid="city" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("city:before"),this.t("city"),_(this.form.city),this.__getValidator("city"),this.__getErrorMessage("city"),!this.in("idle")||this.disabledSelector.matches("city",!0),this.readonlySelector.matches("city",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({city:t})}),this.renderTemplateOrSlot("city:after"))}__renderProvider(){const e=[{label:this.t("tax_rate_provider_none"),value:"none"},{label:"Avalara AvaTax 15",value:"avalara"},{label:"Thomson Reuters ONESOURCE",value:"onesource"}];return("union"===this.form.type||j.includes(this.form.country))&&e.push({label:this.t("tax_rate_provider_default"),value:"default"}),w.includes(this.form.country)&&e.push({label:"TaxJar",value:"taxjar"}),r($||($=C` <div> ${0} <x-dropdown data-testid="provider" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("provider:before"),this.t("tax_rate_provider"),this.form.service_provider||(this.form.is_live?"default":"none"),e.map((e=>e.value)),(t=>{var i;return null===(i=e.find((e=>e.value===t)))||void 0===i?void 0:i.label}),!this.in("idle")||this.disabledSelector.matches("provider",!0),this.readonlySelector.matches("provider",!0),(e=>{const t=e.detail,i=["none","default"].includes(t)?"":t;this.edit({service_provider:i,is_live:"none"!==t}),this.__isExemptAllCustomerTaxIdsHidden&&this.edit({exempt_all_customer_tax_ids:!1}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__isUseOriginRatesHidden&&this.edit({use_origin_rates:!1})}),this.renderTemplateOrSlot("provider:after"))}__renderRate(){return r(x||(x=C` <div> ${0} <vaadin-integer-field data-testid="rate" class="w-full" label="${0}" value="${0}" min="0" prevent-invalid-input has-controls .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @change="${0}"> </vaadin-integer-field> ${0} </div> `),this.renderTemplateOrSlot("rate:before"),this.t("tax_rate"),_(this.form.rate),this.__getValidator("rate"),this.__getErrorMessage("rate"),!this.in("idle")||this.disabledSelector.matches("rate",!0),this.readonlySelector.matches("rate",!0),this.__submitOnEnter,(e=>{const t=parseInt(e.currentTarget.value);this.edit({rate:t})}),this.renderTemplateOrSlot("rate:after"))}__renderApplyToShipping(){return r(b||(b=C` <div> ${0} <x-checkbox data-testid="apply-to-shipping" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_apply_to_shipping" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_apply_to_shipping_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("apply-to-shipping:before"),!this.in("idle")||this.disabledSelector.matches("apply-to-shipping",!0),this.readonlySelector.matches("apply-to-shipping",!0),!!this.form.apply_to_shipping,(e=>this.edit({apply_to_shipping:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("apply-to-shipping:after"))}__renderUseOriginRates(){return r(S||(S=C` <div> ${0} <x-checkbox data-testid="use-origin-rates" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_use_origin_rates" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_use_origin_rates_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("use-origin-rates:before"),!this.in("idle")||this.disabledSelector.matches("use-origin-rates",!0),this.readonlySelector.matches("use-origin-rates",!0),!!this.form.use_origin_rates,(e=>this.edit({use_origin_rates:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("use-origin-rates:after"))}__renderExemptAllCustomerTaxIds(){const e="exempt-all-customer-tax-ids";return r(T||(T=C` <div> ${0} <x-checkbox data-testid="${0}" class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_exempt_all_customer_tax_ids" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_exempt_all_customer_tax_ids_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),e,!this.in("idle")||this.disabledSelector.matches(e,!0),this.readonlySelector.matches(e,!0),!!this.form.exempt_all_customer_tax_ids,(e=>{this.edit({exempt_all_customer_tax_ids:e.detail})}),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot(`${e}:after`))}__renderTimestamps(){return r(E||(E=C` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),s=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=e||t||(i||s),n=this.in("idle");return r(k||(k=C` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!n||a||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return r(O||(O=C` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="primary error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}__submitOnEnter(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-tax-form",A);export{A as TaxForm};