@foxy.io/elements 1.18.0-beta.17 → 1.18.0-beta.19

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 (418) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-admin-subscription-card.js +1 -0
  5. package/dist/cdn/foxy-api-browser.js +1 -1
  6. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -0
  7. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -0
  8. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  9. package/dist/cdn/foxy-attribute-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-form.js +1 -1
  11. package/dist/cdn/foxy-cancellation-form.js +1 -1
  12. package/dist/cdn/foxy-cart-card.js +1 -0
  13. package/dist/cdn/foxy-cart-form.js +1 -0
  14. package/dist/cdn/foxy-collection-page.js +1 -1
  15. package/dist/cdn/foxy-collection-pages.js +1 -1
  16. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  17. package/dist/cdn/foxy-coupon-card.js +1 -1
  18. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  19. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  20. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  21. package/dist/cdn/foxy-coupon-form.js +1 -1
  22. package/dist/cdn/foxy-custom-field-card.js +1 -1
  23. package/dist/cdn/foxy-custom-field-form.js +1 -1
  24. package/dist/cdn/foxy-customer-api.js +1 -1
  25. package/dist/cdn/foxy-customer-card.js +1 -1
  26. package/dist/cdn/foxy-customer-form.js +1 -1
  27. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  28. package/dist/cdn/foxy-customer-portal.js +3 -2
  29. package/dist/cdn/foxy-customer.js +1 -1
  30. package/dist/cdn/foxy-customers-table.js +1 -1
  31. package/dist/cdn/foxy-discount-builder.js +1 -1
  32. package/dist/cdn/foxy-discount-card.js +1 -1
  33. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  34. package/dist/cdn/foxy-donation.js +1 -1
  35. package/dist/cdn/foxy-email-template-card.js +1 -1
  36. package/dist/cdn/foxy-email-template-form.js +1 -1
  37. package/dist/cdn/foxy-error-entry-card.js +1 -1
  38. package/dist/cdn/foxy-form-dialog.js +1 -1
  39. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  40. package/dist/cdn/foxy-gift-card-card.js +1 -1
  41. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  42. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  43. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  44. package/dist/cdn/foxy-gift-card-form.js +1 -1
  45. package/dist/cdn/foxy-i18n-editor.js +2 -2
  46. package/dist/cdn/foxy-i18n.js +1 -1
  47. package/dist/cdn/foxy-integration-card.js +1 -1
  48. package/dist/cdn/foxy-integration-form.js +1 -1
  49. package/dist/cdn/foxy-item-card.js +1 -1
  50. package/dist/cdn/foxy-item-category-card.js +1 -1
  51. package/dist/cdn/foxy-item-category-form.js +1 -1
  52. package/dist/cdn/foxy-item-form.js +1 -1
  53. package/dist/cdn/foxy-item-option-card.js +1 -1
  54. package/dist/cdn/foxy-item-option-form.js +1 -1
  55. package/dist/cdn/foxy-items-form.js +1 -1
  56. package/dist/cdn/foxy-nucleon-element.js +1 -1
  57. package/dist/cdn/foxy-pagination.js +1 -1
  58. package/dist/cdn/foxy-payment-card.js +1 -1
  59. package/dist/cdn/foxy-payment-method-card.js +1 -1
  60. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  61. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  62. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  63. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  64. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  65. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  66. package/dist/cdn/foxy-payments-api.js +1 -1
  67. package/dist/cdn/foxy-query-builder.js +1 -1
  68. package/dist/cdn/foxy-report-form.js +2 -2
  69. package/dist/cdn/foxy-reports-table.js +1 -1
  70. package/dist/cdn/foxy-shipment-card.js +1 -1
  71. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  72. package/dist/cdn/foxy-sign-in-form.js +1 -1
  73. package/dist/cdn/foxy-spinner.js +2 -2
  74. package/dist/cdn/foxy-store-form.js +1 -1
  75. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  76. package/dist/cdn/foxy-subscription-card.js +1 -1
  77. package/dist/cdn/foxy-subscription-form.js +4 -16
  78. package/dist/cdn/foxy-subscription-settings-form.js +1 -0
  79. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  80. package/dist/cdn/foxy-table.js +1 -1
  81. package/dist/cdn/foxy-tax-card.js +1 -1
  82. package/dist/cdn/foxy-tax-form.js +1 -1
  83. package/dist/cdn/foxy-template-card.js +1 -1
  84. package/dist/cdn/foxy-template-config-form.js +1 -1
  85. package/dist/cdn/foxy-template-form.js +1 -1
  86. package/dist/cdn/foxy-template-set-card.js +1 -1
  87. package/dist/cdn/foxy-template-set-form.js +1 -1
  88. package/dist/cdn/foxy-transaction-card.js +1 -1
  89. package/dist/cdn/foxy-transaction.js +1 -1
  90. package/dist/cdn/foxy-transactions-table.js +60 -1
  91. package/dist/cdn/foxy-user-form.js +1 -1
  92. package/dist/cdn/foxy-users-table.js +1 -1
  93. package/dist/cdn/foxy-webhook-card.js +1 -1
  94. package/dist/cdn/foxy-webhook-form.js +1 -1
  95. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  96. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  97. package/dist/cdn/{shared-29e21467.js → shared-00752056.js} +1 -1
  98. package/dist/cdn/{shared-29376ba1.js → shared-01d2cae6.js} +1 -1
  99. package/dist/cdn/{shared-cced7800.js → shared-09c75a01.js} +1 -1
  100. package/dist/cdn/shared-09eb558f.js +1 -0
  101. package/dist/cdn/{shared-236d9b7e.js → shared-0a52b08c.js} +1 -1
  102. package/dist/cdn/{shared-55e20d5b.js → shared-0b17e9a6.js} +1 -1
  103. package/dist/cdn/{shared-f022673a.js → shared-124a17c1.js} +1 -1
  104. package/dist/cdn/{shared-74277a73.js → shared-15effede.js} +1 -1
  105. package/dist/cdn/{shared-e3ce88dc.js → shared-17cb43f3.js} +21 -11
  106. package/dist/cdn/shared-181f51bd.js +1 -0
  107. package/dist/cdn/shared-1936d1d5.js +1 -0
  108. package/dist/cdn/{shared-f2d19582.js → shared-1e9fd9f1.js} +1 -1
  109. package/dist/cdn/{shared-c52d3772.js → shared-2470973b.js} +1 -1
  110. package/dist/cdn/{shared-923da875.js → shared-254ef6a4.js} +1 -1
  111. package/dist/cdn/shared-2afc2d3b.js +1 -0
  112. package/dist/cdn/{shared-0672e78b.js → shared-2bce9f91.js} +1 -1
  113. package/dist/cdn/{shared-b5cbbdd8.js → shared-2c067e88.js} +1 -1
  114. package/dist/cdn/{shared-dcbf57e0.js → shared-2f7dcefa.js} +1 -1
  115. package/dist/cdn/{shared-4975f86f.js → shared-37d6c723.js} +1 -1
  116. package/dist/cdn/{shared-3a3878c9.js → shared-39549b4e.js} +1 -1
  117. package/dist/cdn/{shared-f23d122e.js → shared-3aecf4e3.js} +1 -1
  118. package/dist/cdn/{shared-4c338ca6.js → shared-3ba49bac.js} +1 -1
  119. package/dist/cdn/shared-436f4187.js +1 -0
  120. package/dist/cdn/{shared-5ad8c9a0.js → shared-43bcce74.js} +1 -1
  121. package/dist/cdn/{shared-34b11d34.js → shared-4c32f1ad.js} +1 -1
  122. package/dist/cdn/{shared-ea316e64.js → shared-4cf568d8.js} +1 -1
  123. package/dist/cdn/{shared-2215e6c8.js → shared-50f97405.js} +1 -1
  124. package/dist/cdn/shared-54c5d16b.js +1 -0
  125. package/dist/cdn/{shared-ff2f84c7.js → shared-63139d9e.js} +1 -1
  126. package/dist/cdn/{shared-ef0fc329.js → shared-6a53f85f.js} +1 -1
  127. package/dist/cdn/{shared-002b788f.js → shared-76b3d76a.js} +1 -1
  128. package/dist/cdn/shared-7a1de87a.js +1 -0
  129. package/dist/cdn/shared-7b6f4a11.js +1 -0
  130. package/dist/cdn/{shared-cfec6ec1.js → shared-7cc9cc71.js} +7 -7
  131. package/dist/cdn/{shared-162fc285.js → shared-7df6ee40.js} +1 -1
  132. package/dist/cdn/shared-7e2ea44c.js +1 -0
  133. package/dist/cdn/{shared-bb522838.js → shared-7ed14dc8.js} +1 -1
  134. package/dist/cdn/shared-839dd3a8.js +1 -0
  135. package/dist/cdn/shared-862b436d.js +1 -0
  136. package/dist/cdn/shared-873b14d1.js +1 -0
  137. package/dist/cdn/{shared-5b55627c.js → shared-875748d8.js} +1 -1
  138. package/dist/cdn/{shared-2d3027f4.js → shared-8b6addec.js} +1 -1
  139. package/dist/cdn/{shared-e119731e.js → shared-90b8ef49.js} +1 -1
  140. package/dist/cdn/{shared-b7f7f15f.js → shared-9923f00e.js} +1 -1
  141. package/dist/cdn/{shared-b28dbc68.js → shared-9c3934c8.js} +1 -1
  142. package/dist/cdn/{shared-6b8874a7.js → shared-9cba1b0e.js} +1 -1
  143. package/dist/cdn/{shared-ad8141c4.js → shared-a2e9009b.js} +1 -1
  144. package/dist/cdn/{shared-d43fc5cc.js → shared-a696c602.js} +1 -1
  145. package/dist/cdn/shared-a85afa33.js +1 -0
  146. package/dist/cdn/{shared-e396ec04.js → shared-ab687b1e.js} +1 -1
  147. package/dist/cdn/{shared-c484320b.js → shared-aef0c294.js} +1 -1
  148. package/dist/cdn/shared-b51997d1.js +1 -0
  149. package/dist/cdn/{shared-8a5e01ae.js → shared-b90ddfc1.js} +1 -1
  150. package/dist/cdn/shared-bcc6e13b.js +1 -0
  151. package/dist/cdn/{shared-b8e9b536.js → shared-bfc37e75.js} +1 -1
  152. package/dist/cdn/{shared-6d2064e9.js → shared-c434e6d6.js} +3 -3
  153. package/dist/cdn/{shared-a46a2f49.js → shared-cce2fc5a.js} +1 -1
  154. package/dist/cdn/{shared-40537775.js → shared-cd6381a5.js} +1 -1
  155. package/dist/cdn/{shared-a86761d3.js → shared-cef7c63d.js} +2 -2
  156. package/dist/cdn/{shared-7b167fe9.js → shared-cfae0154.js} +1 -1
  157. package/dist/cdn/{shared-8d533e0c.js → shared-d34586cb.js} +1 -1
  158. package/dist/cdn/shared-d4f80692.js +1 -0
  159. package/dist/cdn/{shared-2c842660.js → shared-d7e653ae.js} +1 -1
  160. package/dist/cdn/shared-d8b07f4f.js +1 -0
  161. package/dist/cdn/{shared-85f9051e.js → shared-db61a5e8.js} +1 -1
  162. package/dist/cdn/{shared-7661b51a.js → shared-ddf10c04.js} +1 -1
  163. package/dist/cdn/{shared-d302ad2c.js → shared-ea67b3f3.js} +1 -1
  164. package/dist/cdn/translations/admin-subscription-card/en.json +27 -0
  165. package/dist/cdn/translations/applied-coupon-code-card/en.json +7 -0
  166. package/dist/cdn/translations/applied-coupon-code-form/en.json +26 -0
  167. package/dist/cdn/translations/cart-card/en.json +15 -0
  168. package/dist/cdn/translations/cart-form/en.json +762 -0
  169. package/dist/cdn/translations/coupon-card/en.json +2 -2
  170. package/dist/cdn/translations/customer-portal/en.json +9 -9
  171. package/dist/cdn/translations/email-template-card/en.json +1 -1
  172. package/dist/cdn/translations/subscription-form/en.json +116 -21
  173. package/dist/cdn/translations/subscription-settings-form/en.json +92 -0
  174. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.d.ts +2 -0
  175. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js +4 -0
  176. package/dist/elements/internal/InternalAsyncComboBoxControl/InternalAsyncComboBoxControl.js.map +1 -1
  177. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +3 -3
  178. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +12 -10
  179. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
  180. package/dist/elements/internal/InternalAsyncListControl/index.d.ts +1 -1
  181. package/dist/elements/internal/InternalAsyncListControl/index.js +1 -1
  182. package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
  183. package/dist/elements/internal/InternalCard/InternalCard.d.ts +1 -0
  184. package/dist/elements/internal/InternalCard/InternalCard.js +12 -4
  185. package/dist/elements/internal/InternalCard/InternalCard.js.map +1 -1
  186. package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js +1 -1
  187. package/dist/elements/internal/InternalDeleteControl/InternalDeleteControl.js.map +1 -1
  188. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.d.ts +1 -0
  189. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js +18 -0
  190. package/dist/elements/internal/InternalEditableControl/InternalEditableControl.js.map +1 -1
  191. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.d.ts +1 -0
  192. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +15 -6
  193. package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
  194. package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +2 -1
  195. package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
  196. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.d.ts +2 -0
  197. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js +6 -0
  198. package/dist/elements/internal/InternalIntegerControl/InternalIntegerControl.js.map +1 -1
  199. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.d.ts +6 -1
  200. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +21 -0
  201. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
  202. package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js +32 -4
  203. package/dist/elements/internal/InternalRadioGroupControl/InternalRadioGroupControl.js.map +1 -1
  204. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.d.ts +1 -2
  205. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +19 -27
  206. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
  207. package/dist/elements/internal/InternalSelectControl/index.d.ts +1 -1
  208. package/dist/elements/internal/InternalSelectControl/index.js +1 -1
  209. package/dist/elements/internal/InternalSelectControl/index.js.map +1 -1
  210. package/dist/elements/private/Dialog/Dialog.js +1 -0
  211. package/dist/elements/private/Dialog/Dialog.js.map +1 -1
  212. package/dist/elements/public/AddressForm/AddressForm.js +1 -1
  213. package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
  214. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.d.ts +40 -0
  215. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +304 -0
  216. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -0
  217. package/dist/elements/public/AdminSubscriptionCard/index.d.ts +4 -0
  218. package/dist/elements/public/AdminSubscriptionCard/index.js +6 -0
  219. package/dist/elements/public/AdminSubscriptionCard/index.js.map +1 -0
  220. package/dist/elements/public/AdminSubscriptionCard/types.d.ts +9 -0
  221. package/dist/elements/public/AdminSubscriptionCard/types.js +2 -0
  222. package/dist/elements/public/AdminSubscriptionCard/types.js.map +1 -0
  223. package/dist/elements/public/AppliedCouponCodeCard/AppliedCouponCodeCard.d.ts +11 -0
  224. package/dist/elements/public/AppliedCouponCodeCard/AppliedCouponCodeCard.js +33 -0
  225. package/dist/elements/public/AppliedCouponCodeCard/AppliedCouponCodeCard.js.map +1 -0
  226. package/dist/elements/public/AppliedCouponCodeCard/index.d.ts +4 -0
  227. package/dist/elements/public/AppliedCouponCodeCard/index.js +6 -0
  228. package/dist/elements/public/AppliedCouponCodeCard/index.js.map +1 -0
  229. package/dist/elements/public/AppliedCouponCodeCard/types.d.ts +3 -0
  230. package/dist/elements/public/AppliedCouponCodeCard/types.js +2 -0
  231. package/dist/elements/public/AppliedCouponCodeCard/types.js.map +1 -0
  232. package/dist/elements/public/AppliedCouponCodeForm/AppliedCouponCodeForm.d.ts +18 -0
  233. package/dist/elements/public/AppliedCouponCodeForm/AppliedCouponCodeForm.js +54 -0
  234. package/dist/elements/public/AppliedCouponCodeForm/AppliedCouponCodeForm.js.map +1 -0
  235. package/dist/elements/public/AppliedCouponCodeForm/index.d.ts +5 -0
  236. package/dist/elements/public/AppliedCouponCodeForm/index.js +7 -0
  237. package/dist/elements/public/AppliedCouponCodeForm/index.js.map +1 -0
  238. package/dist/elements/public/AppliedCouponCodeForm/types.d.ts +5 -0
  239. package/dist/elements/public/AppliedCouponCodeForm/types.js +2 -0
  240. package/dist/elements/public/AppliedCouponCodeForm/types.js.map +1 -0
  241. package/dist/elements/public/AttributeCard/AttributeCard.js +5 -4
  242. package/dist/elements/public/AttributeCard/AttributeCard.js.map +1 -1
  243. package/dist/elements/public/AttributeForm/AttributeForm.js +1 -1
  244. package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
  245. package/dist/elements/public/CartCard/CartCard.d.ts +42 -0
  246. package/dist/elements/public/CartCard/CartCard.js +264 -0
  247. package/dist/elements/public/CartCard/CartCard.js.map +1 -0
  248. package/dist/elements/public/CartCard/index.d.ts +5 -0
  249. package/dist/elements/public/CartCard/index.js +7 -0
  250. package/dist/elements/public/CartCard/index.js.map +1 -0
  251. package/dist/elements/public/CartCard/types.d.ts +5 -0
  252. package/dist/elements/public/CartCard/types.js +2 -0
  253. package/dist/elements/public/CartCard/types.js.map +1 -0
  254. package/dist/elements/public/CartForm/CartForm.d.ts +59 -0
  255. package/dist/elements/public/CartForm/CartForm.js +603 -0
  256. package/dist/elements/public/CartForm/CartForm.js.map +1 -0
  257. package/dist/elements/public/CartForm/index.d.ts +19 -0
  258. package/dist/elements/public/CartForm/index.js +21 -0
  259. package/dist/elements/public/CartForm/index.js.map +1 -0
  260. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/InternalCartFormViewAsCustomerControl.d.ts +10 -0
  261. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/InternalCartFormViewAsCustomerControl.js +83 -0
  262. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/InternalCartFormViewAsCustomerControl.js.map +1 -0
  263. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/index.d.ts +4 -0
  264. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/index.js +6 -0
  265. package/dist/elements/public/CartForm/internal/InternalCartFormViewAsCustomerControl/index.js.map +1 -0
  266. package/dist/elements/public/CartForm/types.d.ts +3 -0
  267. package/dist/elements/public/CartForm/types.js +2 -0
  268. package/dist/elements/public/CartForm/types.js.map +1 -0
  269. package/dist/elements/public/CollectionPage/CollectionPage.js +11 -8
  270. package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
  271. package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +1 -1
  272. package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -1
  273. package/dist/elements/public/CouponForm/CouponForm.js +1 -1
  274. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  275. package/dist/elements/public/CustomFieldCard/TwoLineCard.js +5 -4
  276. package/dist/elements/public/CustomFieldCard/TwoLineCard.js.map +1 -1
  277. package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +1 -1
  278. package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
  279. package/dist/elements/public/CustomerCard/CustomerCard.js +1 -1
  280. package/dist/elements/public/CustomerCard/CustomerCard.js.map +1 -1
  281. package/dist/elements/public/CustomerForm/CustomerForm.js +1 -1
  282. package/dist/elements/public/CustomerForm/CustomerForm.js.map +1 -1
  283. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +3 -1
  284. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  285. package/dist/elements/public/DiscountCard/DiscountCard.js +2 -1
  286. package/dist/elements/public/DiscountCard/DiscountCard.js.map +1 -1
  287. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +2 -1
  288. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
  289. package/dist/elements/public/GiftCardCard/GiftCardCard.js +2 -2
  290. package/dist/elements/public/GiftCardCard/GiftCardCard.js.map +1 -1
  291. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +1 -1
  292. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
  293. package/dist/elements/public/GiftCardForm/GiftCardForm.js +1 -1
  294. package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
  295. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.d.ts +3 -3
  296. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.js +3 -2
  297. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/InternalGiftCardFormProvisioningControl.js.map +1 -1
  298. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.d.ts +1 -1
  299. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.js +1 -1
  300. package/dist/elements/public/GiftCardForm/internal/InternalGiftCardFormProvisioningControl/index.js.map +1 -1
  301. package/dist/elements/public/IntegrationCard/IntegrationCard.js +2 -2
  302. package/dist/elements/public/IntegrationCard/IntegrationCard.js.map +1 -1
  303. package/dist/elements/public/ItemCard/ItemCard.d.ts +26 -4
  304. package/dist/elements/public/ItemCard/ItemCard.js +216 -27
  305. package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
  306. package/dist/elements/public/ItemCard/index.d.ts +1 -0
  307. package/dist/elements/public/ItemCard/index.js +1 -0
  308. package/dist/elements/public/ItemCard/index.js.map +1 -1
  309. package/dist/elements/public/ItemCategoryCard/ItemCategoryCard.d.ts +3 -1
  310. package/dist/elements/public/ItemCategoryCard/ItemCategoryCard.js +4 -3
  311. package/dist/elements/public/ItemCategoryCard/ItemCategoryCard.js.map +1 -1
  312. package/dist/elements/public/ItemForm/ItemForm.d.ts +3 -0
  313. package/dist/elements/public/ItemForm/ItemForm.js +58 -8
  314. package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
  315. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.d.ts +2 -2
  316. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js +2 -2
  317. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js.map +1 -1
  318. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.d.ts +1 -1
  319. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js +1 -1
  320. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js.map +1 -1
  321. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.d.ts +2 -2
  322. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js +2 -2
  323. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js.map +1 -1
  324. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.d.ts +1 -1
  325. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js +1 -1
  326. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js.map +1 -1
  327. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.d.ts +2 -2
  328. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js +2 -2
  329. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js.map +1 -1
  330. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.d.ts +2 -2
  331. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js +2 -2
  332. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js.map +1 -1
  333. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.d.ts +2 -2
  334. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js +2 -2
  335. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js.map +1 -1
  336. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.d.ts +1 -1
  337. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js +1 -1
  338. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js.map +1 -1
  339. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.d.ts +2 -2
  340. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js +2 -2
  341. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js.map +1 -1
  342. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.d.ts +1 -1
  343. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js +1 -1
  344. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js.map +1 -1
  345. package/dist/elements/public/ItemOptionCard/ItemOptionCard.d.ts +25 -5
  346. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js +200 -17
  347. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js.map +1 -1
  348. package/dist/elements/public/ItemOptionCard/index.d.ts +1 -0
  349. package/dist/elements/public/ItemOptionCard/index.js +1 -0
  350. package/dist/elements/public/ItemOptionCard/index.js.map +1 -1
  351. package/dist/elements/public/NucleonElement/NucleonElement.d.ts +2 -0
  352. package/dist/elements/public/NucleonElement/NucleonElement.js +55 -14
  353. package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
  354. package/dist/elements/public/Pagination/Pagination.js +2 -2
  355. package/dist/elements/public/Pagination/Pagination.js.map +1 -1
  356. package/dist/elements/public/ReportForm/ReportForm.js +1 -1
  357. package/dist/elements/public/ReportForm/ReportForm.js.map +1 -1
  358. package/dist/elements/public/StoreForm/StoreForm.js +1 -1
  359. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
  360. package/dist/elements/public/SubscriptionForm/SubscriptionForm.d.ts +46 -14
  361. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +300 -156
  362. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  363. package/dist/elements/public/SubscriptionForm/index.d.ts +9 -4
  364. package/dist/elements/public/SubscriptionForm/index.js +9 -4
  365. package/dist/elements/public/SubscriptionForm/index.js.map +1 -1
  366. package/dist/elements/public/SubscriptionForm/types.d.ts +2 -5
  367. package/dist/elements/public/SubscriptionForm/types.js.map +1 -1
  368. package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.d.ts +33 -0
  369. package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js +208 -0
  370. package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js.map +1 -0
  371. package/dist/elements/public/SubscriptionSettingsForm/index.d.ts +9 -0
  372. package/dist/elements/public/SubscriptionSettingsForm/index.js +11 -0
  373. package/dist/elements/public/SubscriptionSettingsForm/index.js.map +1 -0
  374. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.d.ts +12 -0
  375. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js +128 -0
  376. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js.map +1 -0
  377. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.d.ts +2 -0
  378. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js +26 -0
  379. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js.map +1 -0
  380. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.d.ts +6 -0
  381. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js +12 -0
  382. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js.map +1 -0
  383. package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +3 -0
  384. package/dist/elements/public/SubscriptionSettingsForm/types.js +2 -0
  385. package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -0
  386. package/dist/elements/public/TaxForm/TaxForm.js +1 -1
  387. package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
  388. package/dist/elements/public/TemplateForm/TemplateForm.js +1 -1
  389. package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
  390. package/dist/elements/public/TransactionCard/TransactionCard.js +1 -1
  391. package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
  392. package/dist/elements/public/UserForm/UserForm.js +1 -1
  393. package/dist/elements/public/UserForm/UserForm.js.map +1 -1
  394. package/dist/elements/public/index.d.ts +6 -0
  395. package/dist/elements/public/index.defined.d.ts +6 -0
  396. package/dist/elements/public/index.defined.js +6 -0
  397. package/dist/elements/public/index.defined.js.map +1 -1
  398. package/dist/elements/public/index.js +6 -0
  399. package/dist/elements/public/index.js.map +1 -1
  400. package/dist/mixins/themeable.js +42 -7172
  401. package/dist/mixins/themeable.js.map +1 -1
  402. package/package.json +1 -1
  403. package/dist/cdn/shared-1b3e1a0d.js +0 -1
  404. package/dist/cdn/shared-2f1e04ae.js +0 -1
  405. package/dist/cdn/shared-40d82f6b.js +0 -1
  406. package/dist/cdn/shared-4457dc27.js +0 -1
  407. package/dist/cdn/shared-515f00b1.js +0 -1
  408. package/dist/cdn/shared-5504f415.js +0 -11
  409. package/dist/cdn/shared-6003864d.js +0 -1
  410. package/dist/cdn/shared-6bf8883f.js +0 -1
  411. package/dist/cdn/shared-6e6ed30a.js +0 -1
  412. package/dist/cdn/shared-71deb26e.js +0 -1
  413. package/dist/cdn/shared-92926b1d.js +0 -1
  414. package/dist/cdn/shared-92bd849f.js +0 -1
  415. package/dist/cdn/shared-b7423eab.js +0 -1
  416. package/dist/cdn/shared-bd194cdf.js +0 -1
  417. package/dist/cdn/shared-dc798bf4.js +0 -1
  418. package/dist/cdn/shared-facfe95a.js +0 -60
@@ -1 +1 @@
1
- import"./shared-f022673a.js";import"./shared-2f1e04ae.js";import"./shared-ad8141c4.js";import"./shared-cfec6ec1.js";import"./shared-bd194cdf.js";import"./shared-71deb26e.js";import{I as e}from"./shared-92bd849f.js";import"./shared-0672e78b.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as i}from"./shared-29e21467.js";import{c as o}from"./shared-4e709717.js";import{h as l}from"./shared-7f33a83a.js";import{h as a,s}from"./shared-515f00b1.js";import{Q as n}from"./shared-002b788f.js";import"./shared-7b167fe9.js";import"./shared-c52d3772.js";import"./shared-6b8874a7.js";import"./shared-923da875.js";import"./shared-c484320b.js";import"./shared-e396ec04.js";import"./shared-b28dbc68.js";import"./shared-2215e6c8.js";import"./shared-d3bf9ac0.js";import"./shared-dc798bf4.js";import"./shared-85f9051e.js";import"./shared-e3ce88dc.js";import"./shared-4c338ca6.js";import"./shared-0479553e.js";import"./shared-5ad8c9a0.js";import"./shared-4f037e43.js";import"./shared-b7423eab.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";import"./shared-b8e9b536.js";import"./shared-ef0fc329.js";import"./shared-4975f86f.js";import"./foxy-spinner.js";import"./shared-ea316e64.js";import"./shared-92926b1d.js";let d,c,p,f,h,m,u,v,_,y,x,b,g,$,j,k,w,V,S,Z,L=e=>e;class B extends(i(e,"payments-api-payment-method-form")){constructor(){super(...arguments),this.getImageSrc=null,this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const l=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of l)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!a(s,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){var e,t,i,a,s,n,k,w,V,S,Z,H,I,q;let C;try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}).exec(new URL(this.href||this.parent).pathname).groups.presetId;C=new URL(`/payment_presets/${e}/available_payment_methods`,this.href||this.parent).toString()}catch(e){C=""}const W=null===(e=this.renderRoot.querySelector("#available-payment-methods"))||void 0===e?void 0:e.data,E=B.defaultImageSrc,M=Object.entries(null!==(t=null==W?void 0:W.values)&&void 0!==t?t:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,l=e.find((e=>e.name===o));return l?l.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[]);return l(d||(d=L` <foxy-nucleon class="hidden" href="${0}" id="available-payment-methods" @update="${0}"> </foxy-nucleon> ${0} `),C,(()=>this.requestUpdate()),this.form.type?l(c||(c=L` <figure class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-bold text-xl text-center"> ${0}&ZeroWidthSpace; </figcaption> </figure> <div class="rounded-t-l rounded-b-l border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden"> <div class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="width:calc(200% + var(--lumo-space-m));--tw-translate-x:${0}"> <div class="grid grid-cols-1 gap-m p-m transition-opacity duration-300 ${0}"> ${0} ${0} ${0} ${0} </div> <div class="grid grid-cols-1 gap-m p-m transition-opacity duration-300 ${0}"> ${0} ${0} ${0} ${0} </div> </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(a=null===(i=this.getImageSrc)||void 0===i?void 0:i.call(this,this.form.type))&&void 0!==a?a:E,(e=>e.currentTarget.src=E),null!==(n=null===(s=this.form.helper)||void 0===s?void 0:s.name)&&void 0!==n?n:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),0===this.__tab?"0":"calc(-50% - (var(--lumo-space-m) / 2))",0===this.__tab?"opacity-100":"opacity-0",(null===(k=this.form.helper)||void 0===k?void 0:k.id_description)?l(p||(p=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description):"",(null===(w=this.form.helper)||void 0===w?void 0:w.third_party_key_description)?l(f||(f=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description):"",(null===(V=this.form.helper)||void 0===V?void 0:V.key_description)?l(h||(h=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description):"",this.__liveBlocks.map((e=>this.__renderBlock(e))),1===this.__tab?"opacity-100":"opacity-0",(null===(S=this.form.helper)||void 0===S?void 0:S.id_description)?l(m||(m=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description):"",(null===(Z=this.form.helper)||void 0===Z?void 0:Z.third_party_key_description)?l(u||(u=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description):"",(null===(H=this.form.helper)||void 0===H?void 0:H.key_description)?l(v||(v=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description):"",this.__testBlocks.map((e=>this.__renderBlock(e))),(null===(I=this.form.helper)||void 0===I?void 0:I.supports_3d_secure)?l(_||(_=L` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),(()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"}),(e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})}),[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.form.config_3d_secure?l(y||(y=L` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),[{value:"valid_only",label:"option_valid_only"}],(()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]}),(e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})})):""):"",(null===(q=this.data)||void 0===q?void 0:q.type)?"":l(x||(x=L` <vaadin-button theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody()):l(b||(b=L` <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <div> <div class="-my-s grid grid-cols-1"> ${0} </div> </div> `),M.map((e=>l(g||(g=L` <div class="w-m text-center font-semibold text-tertiary py-s"> ${0} </div> ${0} `),e.name,e.items.map((({type:e,helper:t})=>{var r,i;return l($||($=L` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="min-w-0 flex-1 truncate leading-s ${0}"> <div class="font-semibold">${0}&ZeroWidthSpace;</div> ${0} </figcaption> </figure> </button> `),o({"block text-left p-s rounded-t-l rounded-b-l -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:E,(e=>e.currentTarget.src=E),t.conflict?"text-tertiary":"",t.name,t.conflict?l(j||(j=L` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")})))))))}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderBlock(e){return l(k||(k=L`${0}`),e.fields.map((t=>{var r,i,o;const a=[e.parent_id,e.id,t.id].filter((e=>!!e)),d=["additional-fields",...a].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=n(t,a))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},p=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(s(r,a,e))})}catch(e){return""}},f=t.options;return l(w||(w=L` ${0} `),"checkbox"===t.type?l(V||(V=L` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",d,[{label:t.name,value:"checked"}],c,(e=>{p(e.includes("checked"))})):"select"===t.type?l(S||(S=L` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.name,d,f.map((({name:e,value:t})=>({label:e,value:t}))),c,p):l(Z||(Z=L` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,d,c,p))})))}}customElements.define("foxy-payments-api-payment-method-form",B);export{B as PaymentsApiPaymentMethodForm};
1
+ import"./shared-124a17c1.js";import"./shared-7e2ea44c.js";import"./shared-a2e9009b.js";import"./shared-7cc9cc71.js";import"./shared-873b14d1.js";import"./shared-2afc2d3b.js";import{I as e}from"./shared-862b436d.js";import"./shared-2bce9f91.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as i}from"./shared-00752056.js";import{c as o}from"./shared-4e709717.js";import{h as l}from"./shared-7f33a83a.js";import{h as a}from"./shared-09eb558f.js";import{Q as s}from"./shared-76b3d76a.js";import{s as n}from"./shared-bcc6e13b.js";import"./shared-cfae0154.js";import"./shared-2470973b.js";import"./shared-9cba1b0e.js";import"./shared-254ef6a4.js";import"./shared-aef0c294.js";import"./shared-ab687b1e.js";import"./shared-9c3934c8.js";import"./shared-50f97405.js";import"./shared-7a1de87a.js";import"./shared-3ba49bac.js";import"./shared-0479553e.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-db61a5e8.js";import"./shared-bfc37e75.js";import"./shared-6a53f85f.js";import"./shared-37d6c723.js";import"./foxy-spinner.js";import"./shared-4cf568d8.js";import"./shared-839dd3a8.js";let d,c,p,f,h,m,u,v,_,y,x,b,g,$,j,k,w,V,S,Z,L=e=>e;class B extends(i(e,"payments-api-payment-method-form")){constructor(){super(...arguments),this.getImageSrc=null,this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const l=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of l)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!a(s,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){var e,t,i,a,s,n,k,w,V,S,Z,H,I,q;let C;try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}).exec(new URL(this.href||this.parent).pathname).groups.presetId;C=new URL(`/payment_presets/${e}/available_payment_methods`,this.href||this.parent).toString()}catch(e){C=""}const W=null===(e=this.renderRoot.querySelector("#available-payment-methods"))||void 0===e?void 0:e.data,E=B.defaultImageSrc,M=Object.entries(null!==(t=null==W?void 0:W.values)&&void 0!==t?t:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,l=e.find((e=>e.name===o));return l?l.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[]);return l(d||(d=L` <foxy-nucleon class="hidden" href="${0}" id="available-payment-methods" @update="${0}"> </foxy-nucleon> ${0} `),C,(()=>this.requestUpdate()),this.form.type?l(c||(c=L` <figure class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-bold text-xl text-center"> ${0}&ZeroWidthSpace; </figcaption> </figure> <div class="rounded-t-l rounded-b-l border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden"> <div class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="width:calc(200% + var(--lumo-space-m));--tw-translate-x:${0}"> <div class="grid grid-cols-1 gap-m p-m transition-opacity duration-300 ${0}"> ${0} ${0} ${0} ${0} </div> <div class="grid grid-cols-1 gap-m p-m transition-opacity duration-300 ${0}"> ${0} ${0} ${0} ${0} </div> </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(a=null===(i=this.getImageSrc)||void 0===i?void 0:i.call(this,this.form.type))&&void 0!==a?a:E,(e=>e.currentTarget.src=E),null!==(n=null===(s=this.form.helper)||void 0===s?void 0:s.name)&&void 0!==n?n:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),0===this.__tab?"0":"calc(-50% - (var(--lumo-space-m) / 2))",0===this.__tab?"opacity-100":"opacity-0",(null===(k=this.form.helper)||void 0===k?void 0:k.id_description)?l(p||(p=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description):"",(null===(w=this.form.helper)||void 0===w?void 0:w.third_party_key_description)?l(f||(f=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description):"",(null===(V=this.form.helper)||void 0===V?void 0:V.key_description)?l(h||(h=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description):"",this.__liveBlocks.map((e=>this.__renderBlock(e))),1===this.__tab?"opacity-100":"opacity-0",(null===(S=this.form.helper)||void 0===S?void 0:S.id_description)?l(m||(m=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description):"",(null===(Z=this.form.helper)||void 0===Z?void 0:Z.third_party_key_description)?l(u||(u=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description):"",(null===(H=this.form.helper)||void 0===H?void 0:H.key_description)?l(v||(v=L` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="test-account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description):"",this.__testBlocks.map((e=>this.__renderBlock(e))),(null===(I=this.form.helper)||void 0===I?void 0:I.supports_3d_secure)?l(_||(_=L` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),(()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"}),(e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})}),[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.form.config_3d_secure?l(y||(y=L` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),[{value:"valid_only",label:"option_valid_only"}],(()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]}),(e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})})):""):"",(null===(q=this.data)||void 0===q?void 0:q.type)?"":l(x||(x=L` <vaadin-button theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody()):l(b||(b=L` <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <div> <div class="-my-s grid grid-cols-1"> ${0} </div> </div> `),M.map((e=>l(g||(g=L` <div class="w-m text-center font-semibold text-tertiary py-s"> ${0} </div> ${0} `),e.name,e.items.map((({type:e,helper:t})=>{var r,i;return l($||($=L` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="min-w-0 flex-1 truncate leading-s ${0}"> <div class="font-semibold">${0}&ZeroWidthSpace;</div> ${0} </figcaption> </figure> </button> `),o({"block text-left p-s rounded-t-l rounded-b-l -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:E,(e=>e.currentTarget.src=E),t.conflict?"text-tertiary":"",t.name,t.conflict?l(j||(j=L` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")})))))))}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderBlock(e){return l(k||(k=L`${0}`),e.fields.map((t=>{var r,i,o;const a=[e.parent_id,e.id,t.id].filter((e=>!!e)),d=["additional-fields",...a].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=s(t,a))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},p=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(n(r,a,e))})}catch(e){return""}},f=t.options;return l(w||(w=L` ${0} `),"checkbox"===t.type?l(V||(V=L` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",d,[{label:t.name,value:"checked"}],c,(e=>{p(e.includes("checked"))})):"select"===t.type?l(S||(S=L` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.name,d,f.map((({name:e,value:t})=>({label:e,value:t}))),c,p):l(Z||(Z=L` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,d,c,p))})))}}customElements.define("foxy-payments-api-payment-method-form",B);export{B as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import{I as s}from"./shared-6e6ed30a.js";import"./foxy-nucleon-element.js";import{a as e}from"./shared-29e21467.js";import{c as i}from"./shared-4e709717.js";import{h as t}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-c484320b.js";import"./shared-c52d3772.js";import"./shared-ea316e64.js";import"./shared-0672e78b.js";import"./shared-a8ced8bf.js";import"./shared-002b788f.js";import"./shared-4f037e43.js";import"./shared-b7423eab.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";let r,a=s=>s;const d=e(s,"payments-api-payment-preset-card");class o extends d{renderBody(){var s,e,d,o;return t(r||(r=a` <div class="flex items-center justify-between"> <div class="font-semibold"> <foxy-i18n infer="" class="sr-only" key="description_title"></foxy-i18n> <span>${0}&ZeroWidthSpace;</span> </div> <div class="${0}"> <foxy-i18n class="sr-only" infer="" key="status_title"></foxy-i18n> <foxy-i18n infer="" key="status_${0}"></foxy-i18n> </div> </div> `),null===(s=this.data)||void 0===s?void 0:s.description,i({"uppercase text-xs font-bold tracking-wide rounded-t-l rounded-b-l px-s py-xs":!0,"bg-success-10 text-success":!!(null===(e=this.data)||void 0===e?void 0:e.is_live),"bg-contrast-5":!(null===(d=this.data)||void 0===d?void 0:d.is_live)}),(null===(o=this.data)||void 0===o?void 0:o.is_live)?"live":"test")}}customElements.define("foxy-payments-api-payment-preset-card",o);export{o as PaymentsApiPaymentPresetCard};
1
+ import{I as s}from"./shared-436f4187.js";import"./foxy-nucleon-element.js";import{a as e}from"./shared-00752056.js";import{c as i}from"./shared-4e709717.js";import{h as t}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-aef0c294.js";import"./shared-2470973b.js";import"./shared-4cf568d8.js";import"./shared-2bce9f91.js";import"./shared-a8ced8bf.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let r,a=s=>s;const d=e(s,"payments-api-payment-preset-card");class o extends d{renderBody(){var s,e,d,o;return t(r||(r=a` <div class="flex items-center justify-between"> <div class="font-semibold"> <foxy-i18n infer="" class="sr-only" key="description_title"></foxy-i18n> <span>${0}&ZeroWidthSpace;</span> </div> <div class="${0}"> <foxy-i18n class="sr-only" infer="" key="status_title"></foxy-i18n> <foxy-i18n infer="" key="status_${0}"></foxy-i18n> </div> </div> `),null===(s=this.data)||void 0===s?void 0:s.description,i({"uppercase text-xs font-bold tracking-wide rounded-t-l rounded-b-l px-s py-xs":!0,"bg-success-10 text-success":!!(null===(e=this.data)||void 0===e?void 0:e.is_live),"bg-contrast-5":!(null===(d=this.data)||void 0===d?void 0:d.is_live)}),(null===(o=this.data)||void 0===o?void 0:o.is_live)?"live":"test")}}customElements.define("foxy-payments-api-payment-preset-card",o);export{o as PaymentsApiPaymentPresetCard};
@@ -1 +1 @@
1
- import"./shared-ad8141c4.js";import"./shared-b8e9b536.js";import"./shared-ea316e64.js";import"./shared-c484320b.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-0672e78b.js";import"./shared-ef0fc329.js";import{I as e}from"./shared-4c338ca6.js";import{_ as t}from"./shared-a8ced8bf.js";import{c as r}from"./shared-4e709717.js";import{h as i}from"./shared-7f33a83a.js";import"./shared-71deb26e.js";import{I as s}from"./shared-92bd849f.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{a as o}from"./shared-29e21467.js";import"./shared-85f9051e.js";import"./shared-7b167fe9.js";import"./shared-c52d3772.js";import"./shared-2215e6c8.js";import"./shared-6b8874a7.js";import"./shared-d3bf9ac0.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-002b788f.js";import"./shared-5ad8c9a0.js";import"./shared-b7423eab.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-4975f86f.js";import"./shared-0479553e.js";import"./shared-6e6ed30a.js";import"./shared-f022673a.js";import"./shared-923da875.js";import"./shared-e396ec04.js";import"./shared-2f1e04ae.js";import"./shared-b28dbc68.js";import"./shared-cfec6ec1.js";import"./shared-40d82f6b.js";import"./shared-d43fc5cc.js";import"./shared-34b11d34.js";import"./shared-bd194cdf.js";import"./shared-e3ce88dc.js";import"./shared-515f00b1.js";import"./shared-92926b1d.js";let a,n,d,l,c,h,m,p,f=e=>e;customElements.define("foxy-internal-async-list-control",class extends e{constructor(){super(...arguments),this.related=[],this.limit=20,this.first="",this.form="",this.item="",this.wide=!1,this.alert=!1,this.hideDeleteButton=!1,this.hideCreateButton=!1,this.getPageHref=null,this.__deletionConfimationCallback=null,this.__cachedCardRenderer=null,this.__itemRenderer=e=>{if(!this.form&&!this.getPageHref||!e.data)return this.__cardRenderer(e);const t=this.disabledSelector.matches("card",!0),s=this.__cardRenderer(e);let o;const c=r({"rounded-t-l":!e.previous,"rounded-b-l":!e.next,"focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50":!0,"text-left w-full block transition-colors":!0,"hover-bg-contrast-5":!t});if(this.getPageHref)if(t)o=i(a||(a=f`<div class="${0}">${0}</div>`),c,s);else{const t=this.getPageHref(e.href);o=i(n||(n=f`<a class="${0}" href="${0}">${0}</a>`),c,t,s)}else{o=i(d||(d=f` <button ?disabled="${0}" class="${0}" @click="${0}">${0}</button> `),t,c,(t=>{const r=t.currentTarget,i=this.__dialog;i.header="header_update",i.href=e.href,i.show(r)}),s)}return this.hideDeleteButton?o:i(l||(l=f` <foxy-swipe-actions class="block"> ${0} <vaadin-button theme="primary error" class="h-full rounded-t-l rounded-b-l" slot="action" @click="${0}"> <foxy-i18n infer="" key="delete_button_text"></foxy-i18n> </vaadin-button> </foxy-swipe-actions> `),o,(e=>{const t=e.currentTarget;this.renderRoot.querySelector("#confirm").show(t),this.__deletionConfimationCallback=()=>{const e=t.previousElementSibling.querySelector("[href]");null==e||e.delete(),this.__deletionConfimationCallback=null}}))}}static get properties(){return t(t({},super.properties),{},{hideDeleteButton:{type:Boolean,attribute:"hide-delete-button"},hideCreateButton:{type:Boolean,attribute:"hide-create-button"},getPageHref:{attribute:!1},related:{type:Array},first:{type:String},limit:{type:Number},form:{type:String},item:{type:String},wide:{type:Boolean},alert:{type:Boolean}})}renderControl(){let e;try{const t=new URL(this.first);t.searchParams.set("limit",String(this.limit)),e=t.toString()}catch(t){e=this.first}return i(c||(c=f` ${0} <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="mb-s block divide-y divide-contrast-5 rounded-t-l rounded-b-l overflow-hidden bg-contrast-5" infer="card" .related="${0}" .item="${0}"> </foxy-collection-page> ${0} </foxy-pagination> `),this.form?i(h||(h=f` <foxy-form-dialog parent="${0}" infer="dialog" id="form" ?wide="${0}" ?alert="${0}" .related="${0}" .form="${0}"> </foxy-form-dialog> ${0} `),e,this.wide,this.alert,this.related,this.form,this.hideDeleteButton?"":i(m||(m=f` <foxy-internal-confirm-dialog message="delete_message" confirm="delete_confirm" cancel="delete_cancel" header="delete_header" theme="error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> `),this.lang,this.ns,(e=>{var t;e.detail.cancelled||null===(t=this.__deletionConfimationCallback)||void 0===t||t.call(this)}))):"",e,this.related,this.__itemRenderer,!this.form||this.readonly||this.hideCreateButton?"":i(p||(p=f` <vaadin-button class="mb-s bg-success-10 w-full rounded-t-l rounded-b-l" theme="success" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="create_button_text"></foxy-i18n> <iron-icon class="icon-inline" icon="icons:add"></iron-icon> </vaadin-button> `),this.disabled,(e=>{e.preventDefault(),e.stopPropagation();const t=this.__dialog,r=e.currentTarget;t.header="header_create",t.href="",t.show(r)})))}get __dialog(){return this.renderRoot.querySelector("#form")}get __cardRenderer(){var e;return(null===(e=this.__cachedCardRenderer)||void 0===e?void 0:e.item)!==this.item&&(this.__cachedCardRenderer={item:this.item,render:"string"==typeof this.item?new Function("ctx",`return ctx.html\`<${this.item} related=\${JSON.stringify(ctx.related)} parent=\${ctx.parent} class="p-m" infer href=\${ctx.href}></${this.item}>\``):this.item}),this.__cachedCardRenderer.render}});let u,y,g,_,b,x,$=e=>e;const j=o(s,"payments-api-payment-preset-form");class v extends j{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return t(t({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}renderBody(){const e=this.constructor;return i(u||(u=$` <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?i(y||(y=$` <div class="grid grid-cols-1 gap-s"> <foxy-i18n class="text-s font-medium text-secondary" infer="payment-methods" key="title"> </foxy-i18n> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> </div> <div class="grid grid-cols-1 gap-s"> <foxy-i18n class="text-s font-medium text-secondary" infer="fraud-protections" key="title"> </foxy-i18n> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> </div> `),this.data._links["fx:payment_methods"].href,(e=>i(g||(g=$` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" class="px-m py-s" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>i(_||(_=$` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>i(b||(b=$` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" class="px-m py-s" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>i(x||(x=$` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}v.__isPOEnabledOptions=[{label:"option_true",value:"true"}],v.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",v);export{v as PaymentsApiPaymentPresetForm};
1
+ import"./shared-a2e9009b.js";import"./shared-b51997d1.js";import"./shared-2afc2d3b.js";import{I as e}from"./shared-862b436d.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as t}from"./shared-a8ced8bf.js";import{a as r}from"./shared-00752056.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-db61a5e8.js";import"./shared-cfae0154.js";import"./shared-2470973b.js";import"./shared-50f97405.js";import"./shared-9cba1b0e.js";import"./shared-aef0c294.js";import"./shared-7a1de87a.js";import"./shared-3ba49bac.js";import"./shared-0479553e.js";import"./shared-2bce9f91.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-bfc37e75.js";import"./shared-4cf568d8.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-6a53f85f.js";import"./shared-37d6c723.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-436f4187.js";import"./shared-124a17c1.js";import"./shared-254ef6a4.js";import"./shared-ab687b1e.js";import"./shared-7e2ea44c.js";import"./shared-9c3934c8.js";import"./shared-7cc9cc71.js";import"./shared-1936d1d5.js";import"./shared-a696c602.js";import"./shared-4c32f1ad.js";import"./shared-873b14d1.js";import"./shared-bcc6e13b.js";import"./shared-839dd3a8.js";import"./shared-09eb558f.js";let s,o,i,p,n,d,m=e=>e;const c=r(e,"payments-api-payment-preset-form");class f extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return t(t({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}renderBody(){const e=this.constructor;return a(s||(s=m` <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?a(o||(o=m` <div class="grid grid-cols-1 gap-s"> <foxy-i18n class="text-s font-medium text-secondary" infer="payment-methods" key="title"> </foxy-i18n> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> </div> <div class="grid grid-cols-1 gap-s"> <foxy-i18n class="text-s font-medium text-secondary" infer="fraud-protections" key="title"> </foxy-i18n> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> </div> `),this.data._links["fx:payment_methods"].href,(e=>a(i||(i=m` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" class="px-m py-s" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>a(p||(p=m` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>a(n||(n=m` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" class="px-m py-s" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>a(d||(d=m` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}f.__isPOEnabledOptions=[{label:"option_true",value:"true"}],f.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",f);export{f as PaymentsApiPaymentPresetForm};
@@ -1 +1 @@
1
- import{L as e,h as t}from"./shared-7f33a83a.js";import{F as a}from"./shared-002b788f.js";import{l as s,_ as n,k as r}from"./shared-a8ced8bf.js";import{A as o}from"./shared-dc798bf4.js";async function i(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function l(e){var t;let a,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw a=405,new Error("Method not allowed. Allowed methods: GET.");const p=s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=i(m(r)),y=i(m(o)),f=null===(t=(await i(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await i(m(f)):void 0,u=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:c,base:new URL(d.url).origin});n=JSON.stringify(u),a=200}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}function d(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function m(e){let t,a;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=d({paymentPresetId:s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});a=JSON.stringify(r),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const p=["_links"];function h(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:s,base:o}=e,{_links:i}=s,l=r(s,p),m=d({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},l),{},{helper:m.values[s.type]})}async function y(e){var t,a;let n,r;try{const{fraudProtectionsUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const p=new URL(d.url),y=s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(p.pathname).groups.presetId,f=await i(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=p.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=p.searchParams.get("limit"))&&void 0!==a?a:"20"),o=new URL(f._links["fx:payment_method_set_fraud_protections"].href);o.searchParams.set("offset",String(Math.max(0,e-1))),o.searchParams.set("limit",String(s));const l=await i(m(o.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>i(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return h({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(o,{method:"POST",body:JSON.stringify(e)}),a=await i(t),s=await i(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=h({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function f(e){let t,a;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:o,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:p}=d.exec(o.url).groups,y=n(m),f=p.substring(0,p.indexOf("C"));if("DELETE"===o.method){const e=(await i(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await i(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>i(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await o.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:o.method,body:"PATCH"===o.method?c:null}),_=await i(u);a="DELETE"===o.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(h({paymentMethodSetFraudProtectionId:p.substring(p.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(o.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const c=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:s}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=r(o,c),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,s),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,s);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function _(e){var t,a,n,r;let o,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw o=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([i(c(d)),i(c(m)),i(c(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=_.searchParams.get("limit"))&&void 0!==a?a:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(s));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?i(c(d)):null,i(c(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>i(c(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),_=new URL(`/payment_presets/${i}/payment_methods`,m);_.search=d;const w=new URL(_.toString()),g=new URL(_.toString()),P=new URL(_.toString()),S=new URL(_.toString());w.searchParams.set("limit",String(y)),w.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:w.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:_.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:w,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});o=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await i(c(p,{method:"POST",body:JSON.stringify(e)})),a=await i(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:w,helper:g.values[t.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(s)}else{const t=c(y,{method:f.method,body:JSON.stringify(e)}),a=await i(t),s={gateway_uri:a._links.self.href};await Promise.all([i(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?i(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),o=null!=o?o:500}return new Response(l,{status:o})}const w=["_links"];function g(e){const{paymentMethodSet:t,base:a}=e,{_links:s}=t,o=r(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":s["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const P=["_embedded","_links"];async function S(e){let t,a;try{const{paymentMethodSetsUrl:s,request:o,fetch:l}=e;if(!["GET","POST"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(o.url),m=new URL(s);let p;if(m.search=d.search,"POST"===o.method){const e=l(m.toString(),{method:"POST",body:await o.text()});p=g({paymentMethodSet:await i(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:s,_links:o}=t,i=r(t,P),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),_=new URL(o.self.href);return u.search=_.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":s["fx:payment_method_sets"].map((e=>g({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await i(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function U(e){let t,a;try{const{getPaymentMethodSetUrl:n,request:r,fetch:o}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=s(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await i(o(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));a="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(g({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function b(e){let t,a;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:o,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=y.exec(p.url).groups,_=c.startsWith("H"),w=d(f),g=c.substring(1,_?c.indexOf("C"):void 0),P=i(h(n)),S=i(h(r));if("DELETE"===p.method)if(_){const e=o(c.substring(c.indexOf("C")+1));await i(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await i(h(w,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(_){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}let L,E=e=>e;class G extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewaysUrl=null,this.__api=new o(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof a))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:t,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p}=this;if(null===t)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===i)return;if(null===d)return;if(null===p)return;const h=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),b],[s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),m],[s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),l],[s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),f],[s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),y],[s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),_],[s(/\/payment_presets\/(.+)/,{presetId:1}),U],[/\/payment_presets/,S]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:h(t),getHostedPaymentGatewayUrl:h(o),getPaymentMethodSetUrl:h(i),getFraudProtectionUrl:h(d),getPaymentGatewayUrl:h(p),request:e.request,fetch:this.__fetch});c&&(e.preventDefault(),e.respondWith(c))}}static get properties(){return{paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}render(){return t(L||(L=E`<slot></slot>`))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",G);export{G as PaymentsApi};
1
+ import{L as e,h as t}from"./shared-7f33a83a.js";import{F as a}from"./shared-76b3d76a.js";import{l as s,_ as n,k as r}from"./shared-a8ced8bf.js";import{A as o}from"./shared-a85afa33.js";async function i(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function l(e){var t;let a,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw a=405,new Error("Method not allowed. Allowed methods: GET.");const p=s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=i(m(r)),y=i(m(o)),f=null===(t=(await i(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await i(m(f)):void 0,u=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:c,base:new URL(d.url).origin});n=JSON.stringify(u),a=200}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}function d(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function m(e){let t,a;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=d({paymentPresetId:s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});a=JSON.stringify(r),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const p=["_links"];function h(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:s,base:o}=e,{_links:i}=s,l=r(s,p),m=d({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},l),{},{helper:m.values[s.type]})}async function y(e){var t,a;let n,r;try{const{fraudProtectionsUrl:o,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const p=new URL(d.url),y=s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(p.pathname).groups.presetId,f=await i(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=p.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=p.searchParams.get("limit"))&&void 0!==a?a:"20"),o=new URL(f._links["fx:payment_method_set_fraud_protections"].href);o.searchParams.set("offset",String(Math.max(0,e-1))),o.searchParams.set("limit",String(s));const l=await i(m(o.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>i(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return h({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(o,{method:"POST",body:JSON.stringify(e)}),a=await i(t),s=await i(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=h({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function f(e){let t,a;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:o,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:p}=d.exec(o.url).groups,y=n(m),f=p.substring(0,p.indexOf("C"));if("DELETE"===o.method){const e=(await i(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await i(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>i(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await o.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:o.method,body:"PATCH"===o.method?c:null}),_=await i(u);a="DELETE"===o.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(h({paymentMethodSetFraudProtectionId:p.substring(p.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(o.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}const c=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:s}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=r(o,c),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,s),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,s);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function _(e){var t,a,n,r;let o,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw o=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([i(c(d)),i(c(m)),i(c(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),s=parseInt(null!==(a=_.searchParams.get("limit"))&&void 0!==a?a:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(s));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?i(c(d)):null,i(c(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>i(c(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),_=new URL(`/payment_presets/${i}/payment_methods`,m);_.search=d;const w=new URL(_.toString()),g=new URL(_.toString()),P=new URL(_.toString()),S=new URL(_.toString());w.searchParams.set("limit",String(y)),w.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:w.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:_.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:w,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});o=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await i(c(p,{method:"POST",body:JSON.stringify(e)})),a=await i(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:w,helper:g.values[t.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(s)}else{const t=c(y,{method:f.method,body:JSON.stringify(e)}),a=await i(t),s={gateway_uri:a._links.self.href};await Promise.all([i(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?i(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});o=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),o=null!=o?o:500}return new Response(l,{status:o})}const w=["_links"];function g(e){const{paymentMethodSet:t,base:a}=e,{_links:s}=t,o=r(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":s["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const P=["_embedded","_links"];async function S(e){let t,a;try{const{paymentMethodSetsUrl:s,request:o,fetch:l}=e;if(!["GET","POST"].includes(o.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(o.url),m=new URL(s);let p;if(m.search=d.search,"POST"===o.method){const e=l(m.toString(),{method:"POST",body:await o.text()});p=g({paymentMethodSet:await i(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:s,_links:o}=t,i=r(t,P),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),_=new URL(o.self.href);return u.search=_.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":s["fx:payment_method_sets"].map((e=>g({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await i(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function U(e){let t,a;try{const{getPaymentMethodSetUrl:n,request:r,fetch:o}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=s(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await i(o(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));a="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(g({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function b(e){let t,a;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:o,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=y.exec(p.url).groups,_=c.startsWith("H"),w=d(f),g=c.substring(1,_?c.indexOf("C"):void 0),P=i(h(n)),S=i(h(r));if("DELETE"===p.method)if(_){const e=o(c.substring(c.indexOf("C")+1));await i(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await i(h(w,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(_){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,s=await i(e);a="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:s,paymentPresetId:f,helper:t.values[s.type],base:new URL(p.url).origin}))}}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}let L,E=e=>e;class G extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewaysUrl=null,this.__api=new o(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof a))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:t,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p}=this;if(null===t)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===i)return;if(null===d)return;if(null===p)return;const h=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[s(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),b],[s(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),m],[s(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),l],[s(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),f],[s(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),y],[s(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),_],[s(/\/payment_presets\/(.+)/,{presetId:1}),U],[/\/payment_presets/,S]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:i,fraudProtectionsUrl:d,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:h(t),getHostedPaymentGatewayUrl:h(o),getPaymentMethodSetUrl:h(i),getFraudProtectionUrl:h(d),getPaymentGatewayUrl:h(p),request:e.request,fetch:this.__fetch});c&&(e.preventDefault(),e.respondWith(c))}}static get properties(){return{paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}render(){return t(L||(L=E`<slot></slot>`))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",G);export{G as PaymentsApi};
@@ -1 +1 @@
1
- import"./shared-ea316e64.js";import"./shared-c484320b.js";export{Q as QueryBuilder}from"./shared-a86761d3.js";import"./shared-c52d3772.js";import"./shared-29e21467.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-e6f3e9f0.js";import"./shared-4e709717.js";import"./shared-d3bf9ac0.js";import"./shared-bc7f58ef.js";import"./shared-d519a301.js";import"./shared-4f037e43.js";
1
+ import"./shared-4cf568d8.js";import"./shared-aef0c294.js";export{Q as QueryBuilder}from"./shared-cef7c63d.js";import"./shared-2470973b.js";import"./shared-00752056.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-e6f3e9f0.js";import"./shared-4e709717.js";import"./shared-d3bf9ac0.js";import"./shared-bc7f58ef.js";import"./shared-d519a301.js";import"./shared-4f037e43.js";
@@ -1,4 +1,4 @@
1
- import{C as e}from"./shared-bb522838.js";import{D as t,a as i}from"./shared-7661b51a.js";import{C as a,b as s,a as n}from"./shared-b28dbc68.js";import{h as r,B as d,P as l}from"./shared-c52d3772.js";import{T as o,E as h,C as m}from"./shared-7b167fe9.js";import{T as _}from"./shared-2215e6c8.js";import"./shared-6b8874a7.js";import"./shared-85f9051e.js";import"./shared-b8e9b536.js";import"./shared-e3ce88dc.js";import"./shared-ef0fc329.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0672e78b.js";import{_ as c}from"./shared-a8ced8bf.js";import"./shared-c484320b.js";import"./shared-f2d19582.js";import{h as u,f as p}from"./shared-7f33a83a.js";import{S as g,R as v,T as f,a as b}from"./shared-29e21467.js";import{c as y}from"./shared-4e709717.js";import{C as k,a as T}from"./shared-1b3e1a0d.js";import"./shared-4975f86f.js";import"./shared-5504f415.js";import"./shared-d43fc5cc.js";import"./shared-34b11d34.js";import{G as x}from"./shared-3a3878c9.js";import{P as $}from"./shared-162fc285.js";import{C as D}from"./shared-5ad8c9a0.js";import{N as E}from"./shared-b7423eab.js";import{i as w}from"./shared-d3bf9ac0.js";import{l as S}from"./shared-f3b35364.js";import"./shared-e396ec04.js";import"./shared-923da875.js";import"./shared-ea316e64.js";import"./shared-4f037e43.js";import"./shared-002b788f.js";import"./shared-6d2064e9.js";import"./shared-11c2efc8.js";import"./shared-dcbf57e0.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";
1
+ import{C as e}from"./shared-7ed14dc8.js";import{D as t,a as i}from"./shared-ddf10c04.js";import{C as a,b as s,a as n}from"./shared-9c3934c8.js";import{h as r,B as d,P as l}from"./shared-2470973b.js";import{T as o,E as h,C as m}from"./shared-cfae0154.js";import{T as _}from"./shared-50f97405.js";import"./shared-9cba1b0e.js";import"./shared-db61a5e8.js";import"./shared-bfc37e75.js";import"./shared-17cb43f3.js";import"./shared-6a53f85f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-2bce9f91.js";import{_ as c}from"./shared-a8ced8bf.js";import"./shared-aef0c294.js";import"./shared-1e9fd9f1.js";import{h as u,f as p}from"./shared-7f33a83a.js";import{S as g,R as v,T as f,a as b}from"./shared-00752056.js";import{c as y}from"./shared-4e709717.js";import{C as k,a as T}from"./shared-7b6f4a11.js";import"./shared-37d6c723.js";import"./shared-a696c602.js";import"./shared-4c32f1ad.js";import{G as x}from"./shared-39549b4e.js";import{P as $}from"./shared-7df6ee40.js";import{C as D}from"./shared-43bcce74.js";import{N as E}from"./shared-181f51bd.js";import{i as w}from"./shared-d3bf9ac0.js";import{l as S}from"./shared-f3b35364.js";import"./shared-ab687b1e.js";import"./shared-254ef6a4.js";import"./shared-4cf568d8.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-c434e6d6.js";import"./shared-11c2efc8.js";import"./shared-2f7dcefa.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2017 Vaadin Ltd.
@@ -192,4 +192,4 @@ const Y=document.createElement("template");Y.innerHTML='<dom-module id="date-tim
192
192
  </div>
193
193
  <slot name="helper" slot="helper">[[helperText]]</slot>
194
194
  </vaadin-date-time-picker-custom-field>
195
- `}static get is(){return"vaadin-date-time-picker"}static get version(){return"1.4.0"}static get properties(){return{name:{type:String},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,value:!1},errorMessage:String,value:{type:String,notify:!0,value:"",observer:"__valueChanged"},min:{type:String,observer:"__minChanged"},max:{type:String,observer:"__maxChanged"},__minDateTime:{type:Date,value:""},__maxDateTime:{type:Date,value:""},datePlaceholder:{type:String},timePlaceholder:{type:String},helperText:{type:String,value:""},step:{type:Number},initialPosition:String,showWeekNumbers:{type:Boolean},label:{type:String,value:""},autoOpenDisabled:Boolean,disabled:{type:Boolean,value:!1,reflectToAttribute:!0},readonly:{type:Boolean,value:!1,reflectToAttribute:!0},autofocus:{type:Boolean},__selectedDateTime:{type:Date},__customFieldValueFormat:{type:Object,value:()=>({parseValue:e=>e.split("T"),formatValue:e=>e.join("T")})},i18n:{type:Object,value:()=>Object.assign({},U,G)}}}static get observers(){return["__selectedDateTimeChanged(__selectedDateTime)","__datePlaceholderChanged(datePlaceholder)","__timePlaceholderChanged(timePlaceholder)","__stepChanged(step)","__initialPositionChanged(initialPosition)","__showWeekNumbersChanged(showWeekNumbers)","__requiredChanged(required)","__invalidChanged(invalid)","__disabledChanged(disabled)","__readonlyChanged(readonly)","__i18nChanged(i18n.*)","__autoOpenDisabledChanged(autoOpenDisabled)"]}constructor(){super(),this.__defaultDateMinMaxValue=void 0,this.__defaultTimeMinValue="00:00:00.000",this.__defaultTimeMaxValue="23:59:59.999"}ready(){super.ready(),this.addEventListener("focusout",(e=>{e.relatedTarget!==this.__datePicker.$.overlay&&this.validate()})),this.__changeEventHandler=this.__changeEventHandler.bind(this),this.__filterElements=e=>e.nodeType===Node.ELEMENT_NODE,this.__datePickerChanged(),this.__timePickerChanged(),this.$.dateSlot.addEventListener("slotchange",this.__datePickerChanged.bind(this)),this.$.timeSlot.addEventListener("slotchange",this.__timePickerChanged.bind(this)),this.autofocus&&!this.disabled&&window.requestAnimationFrame((()=>this.focus()))}focus(){this.$.customField.focus()}__syncI18n(e,t,i){(i=i||Object.keys(t.i18n)).forEach((i=>{t.i18n.hasOwnProperty(i)&&e.set(`i18n.${i}`,t.i18n[i])}))}__updateCustomFieldInputs(){const e=this.$.customField.inputs;this.__datePicker&&this.__timePicker&&(e[0]!==this.__datePicker||e[1]!==this.__timePicker)&&this.$.customField._setInputs([this.__datePicker,this.__timePicker])}__changeEventHandler(e){this.__doDispatchChange=!0}__removeChangeListener(e){e&&e.removeEventListener("change",this.__changeEventHandler,!1)}__addChangeListener(e){e.addEventListener("change",this.__changeEventHandler,!1)}__datePickerChanged(){const e=this.shadowRoot.querySelector('[part="date"]'),t=this.$.dateSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__datePicker!==t&&(this.__removeChangeListener(this.__datePicker),this.__addChangeListener(t),this.__datePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.datePlaceholder,t.invalid=this.invalid,t.initialPosition=this.initialPosition,t.showWeekNumbers=this.showWeekNumbers,this.__syncI18n(t,this,z)):(this.datePlaceholder=t.placeholder,this.initialPosition=t.initialPosition,this.showWeekNumbers=t.showWeekNumbers,this.__syncI18n(this,t,z)),t.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue),t.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{},t._validateInput=()=>{})}__timePickerChanged(){const e=this.shadowRoot.querySelector('[part="time"]'),t=this.$.timeSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__timePicker!==t&&(this.__removeChangeListener(this.__timePicker),this.__addChangeListener(t),this.__timePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.timePlaceholder,t.step=this.step,t.invalid=this.invalid,this.__syncI18n(t,this,J)):(this.timePlaceholder=t.placeholder,this.step=t.step,this.__syncI18n(this,t,J)),this.__updateTimePickerMinMax(),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{})}__updateTimePickerMinMax(){if(this.__timePicker&&this.__datePicker){const e=i._dateEquals,t=this.__parseDate(this.__datePicker.value),a=e(this.__minDateTime,this.__maxDateTime),s=this.__timePicker.value;this.__minDateTime&&e(t,this.__minDateTime)||a?this.__timePicker.min=this.__dateToIsoTimeString(this.__minDateTime):this.__timePicker.min=this.__defaultTimeMinValue,this.__maxDateTime&&e(t,this.__maxDateTime)||a?this.__timePicker.max=this.__dateToIsoTimeString(this.__maxDateTime):this.__timePicker.max=this.__defaultTimeMaxValue,this.__timePicker.value!==s&&(this.__timePicker.value=s)}}__i18nChanged(e){this.__datePicker&&this.__datePicker.set(e.path,e.value),this.__timePicker&&this.__timePicker.set(e.path,e.value)}__datePlaceholderChanged(e){this.__datePicker&&(this.__datePicker.placeholder=e)}__timePlaceholderChanged(e){this.__timePicker&&(this.__timePicker.placeholder=e)}__stepChanged(e){if(this.__timePicker&&this.__timePicker.step!==e){const t=this.__timePicker.value;this.__timePicker.step=e,this.__timePicker.value!==t&&this.__triggerCustomFieldValueUpdate()}}__triggerCustomFieldValueUpdate(){this.__timePicker&&this.__timePicker.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__initialPositionChanged(e){this.__datePicker&&(this.__datePicker.initialPosition=e)}__showWeekNumbersChanged(e){this.__datePicker&&(this.__datePicker.showWeekNumbers=e)}__invalidChanged(e){this.__datePicker&&(this.__datePicker.invalid=e),this.__timePicker&&(this.__timePicker.invalid=e)}__requiredChanged(e){this.__datePicker&&(this.__datePicker.required=e),this.__timePicker&&(this.__timePicker.required=e)}__disabledChanged(e){this.__datePicker&&(this.__datePicker.disabled=e),this.__timePicker&&(this.__timePicker.disabled=e)}__readonlyChanged(e){this.__datePicker&&(this.__datePicker.readonly=e),this.__timePicker&&(this.__timePicker.readonly=e)}__parseDate(e){return W.prototype._parseDate(e)}__formatDateISO(e,t){return e?W.prototype._formatISO(e):t}__formatTimeISO(e){return G.formatTime(e)}__parseTimeISO(e){return G.parseTime(e)}__parseDateTime(e){const[t,i]=e.split("T");if(!t||!i)return;const a=this.__parseDate(t);if(!a)return;const s=this.__parseTimeISO(i);return s?(a.setHours(parseInt(s.hours)),a.setMinutes(parseInt(s.minutes||0)),a.setSeconds(parseInt(s.seconds||0)),a.setMilliseconds(parseInt(s.milliseconds||0)),a):void 0}__formatDateTime(e){if(!e)return"";return`${this.__formatDateISO(e,"")}T${this.__dateToIsoTimeString(e)}`}__dateToIsoTimeString(e){return this.__formatTimeISO(this.__validateTime({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}))}__validateTime(e){return e&&(e.seconds=this.__stepSegment<3?void 0:e.seconds,e.milliseconds=this.__stepSegment<4?void 0:e.milliseconds),e}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){const e=this.$.customField.inputs.filter((e=>!e.checkValidity.call(e))).length>0,t=this.required&&this.$.customField.inputs.filter((e=>!e.value)).length>0;return!e&&!t}get __stepSegment(){const e=null==this.step?60:parseFloat(this.step);return e%3600==0?1:e%60!=0&&e?e%1==0?3:e<1?4:void 0:2}__dateTimeEquals(e,t){return!!i._dateEquals(e,t)&&(e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds())}__handleDateTimeChange(e,t,i,a){if(!i)return this[e]="",void(this[t]="");const s=this.__parseDateTime(i);s?this.__dateTimeEquals(this[t],s)||(this[t]=s):this[e]=a}__valueChanged(e,t){this.__handleDateTimeChange("value","__selectedDateTime",e,t),this.__doDispatchChange&&(this.__dispatchChange(),this.validate())}__dispatchChange(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__minChanged(e,t){this.__handleDateTimeChange("min","__minDateTime",e,t),this.__datePicker&&(this.__datePicker.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__maxChanged(e,t){this.__handleDateTimeChange("max","__maxDateTime",e,t),this.__datePicker&&(this.__datePicker.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__selectedDateTimeChanged(e){const t=this.__formatDateTime(e);this.value!==t&&(this.value=t);if(!!this.$.customField.inputs[0].$){const e=this.__doDispatchChange;this.$.customField.value=""!==this.value?this.value:"T",this.__doDispatchChange=e}}__customFieldValueChanged(e){const t=e.detail.value;if("T"===t&&!this.__customFieldInitialValueChangeReceived)return void(this.__customFieldInitialValueChangeReceived=!0);const[i,a]=t.split("T");this.__oldDateValue!==i&&(this.__oldDateValue=i,this.__updateTimePickerMinMax()),i&&a?t!==this.value&&(this.value=t):this.value="",this.__doDispatchChange=!1}__autoOpenDisabledChanged(e){this.__datePicker&&(this.__datePicker.autoOpenDisabled=e),this.__timePicker&&(this.__timePicker.autoOpenDisabled=e)}}customElements.define(Q.is,Q);const X=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function Z(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=0===i?X.length-1:i-1,s=X[a][0],n=new Date(e.getFullYear(),s),r=X[a][2];return{start:n,end:new Date(new Date(e.getFullYear(),r+1).getTime()-1)}}function ee(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=X[i][0],s=new Date(e.getFullYear(),a),n=X[i][2];return{start:s,end:new Date(new Date(e.getFullYear(),n+1).getTime()-1)}}function te(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()-1),end:new Date(new Date(e.getFullYear(),e.getMonth()).getTime()-1)}}function ie(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()),end:new Date(new Date(e.getFullYear(),e.getMonth()+1).getTime()-1)}}function ae(e=new Date){return{start:new Date(e.getFullYear()-1,0),end:new Date(new Date(e.getFullYear(),0).getTime()-1)}}function se(e=new Date){return{start:new Date(e.getFullYear(),0),end:new Date(new Date(e.getFullYear()+1,0).getTime()-1)}}function ne(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function re(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function de(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}let le,oe,he,me,_e,ce,ue,pe,ge,ve,fe,be,ye,ke,Te,xe=e=>e;const $e=g(v(f(D(b(E,"report-form")))));class De extends $e{constructor(){super(...arguments),this.templates={},this.__showRangeTime=!1}static get scopedElements(){return{"vaadin-date-time-picker":customElements.get("vaadin-date-time-picker"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"vaadin-select":customElements.get("vaadin-select"),"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":$,"x-choice":k,"x-group":x}}static get properties(){return c(c({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({datetime_start:e})=>!!e||"datetime_start_required",({datetime_end:e})=>!!e||"datetime_end_required"]}render(){var e,t;const i=this.hiddenSelector;return u(le||(le=xe` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="space-y-m"> ${0} ${0} ${0} ${0} ${0} </div> <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.in("busy"),i.matches("name",!0)?"":this.__renderName(),i.matches("range",!0)?"":this.__renderRange(),i.matches("timestamps",!0)||!this.data?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),y({"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:"")}__renderName(){const e="name",t=["complete","customers","customers_ltv"],i=!this.in("idle")||this.disabledSelector.matches(e),a=this.readonlySelector.matches(e);return u(oe||(oe=xe` <div data-testid="${0}"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="name" ns="${0}"></foxy-i18n> <x-choice data-testid="name-choice" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),e,this.renderTemplateOrSlot("name:before"),this.lang,this.ns,this.form.name,t,a,i,(e=>{e instanceof T&&this.edit({name:e.detail})}),t.map((e=>u(he||(he=xe` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="name_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="name_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),this.renderTemplateOrSlot("name:after"))}__renderRangePreset(){var e;const t=[[c({value:"0",label:"preset_previous_quarter"},Z()),c({value:"1",label:"preset_previous_month"},te()),c({value:"2",label:"preset_previous_year"},ae())],[c({value:"3",label:"preset_this_quarter"},ee()),c({value:"4",label:"preset_this_month"},ie()),c({value:"5",label:"preset_this_year"},se())],[c({value:"6",label:"preset_last_365_days"},ne()),c({value:"7",label:"preset_last_30_days"},re())]],i=t.flat(1).find((e=>{const{datetime_end:t,datetime_start:i}=this.form;return i&&t&&de(e.start)===i&&de(e.end)===t}));return u(ge||(ge=xe` <div> <vaadin-select data-testid="range:preset" label="${0}" class="w-full -mt-m -mb-xs" ?disabled="${0}" ?readonly="${0}" .value="${0}" .renderer="${0}" @change="${0}"> </vaadin-select> </div> `),this.t("preset"),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),S(null!==(e=null==i?void 0:i.value)&&void 0!==e?e:"custom"),(e=>{const i=u(me||(me=xe`<vaadin-item value="custom">${0}</vaadin-item>`),this.t("preset_custom")),a=u(_e||(_e=xe`<hr>`)),s=t.map((e=>{const t=e.map((({value:e,label:t})=>u(ce||(ce=xe`<vaadin-item value="${0}">${0}</vaadin-item>`),e,this.t(t))));return u(ue||(ue=xe`${0}${0}`),t,a)}));e.firstElementChild||e.appendChild(document.createElement("vaadin-list-box")),p(u(pe||(pe=xe`${0}${0}`),s,i),e.firstElementChild)}),(e=>{const i=e.currentTarget,a=t.flat(1).find((e=>e.value===i.value));a&&this.edit({datetime_start:de(a.start),datetime_end:de(a.end)})}))}__renderRangeDateTimePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(ve||(ve=xe` <vaadin-date-time-picker date-placeholder="${0}" time-placeholder="${0}" error-message="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-time-picker> `),this.t("select_date"),this.t("select_time"),w(i?this.t(i):void 0),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(e=>{const i=e.currentTarget;this.edit({[t]:i.value})}));var s,n}__renderRangeDatePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(fe||(fe=xe` <vaadin-date-picker error-message="${0}" placeholder="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),w(i?this.t(i):void 0),this.t("select_date"),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(i=>{const a=i.currentTarget,s="end"===e?"23:59:59":"00:00:00";this.edit({[t]:`${a.value}T${s}`})}));var s,n}__renderRange(){const e=this.__showRangeTime?this.__renderRangeDateTimePicker:this.__renderRangeDatePicker;return u(be||(be=xe` <div data-testid="range"> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="range" ns="${0}"></foxy-i18n> <div class="p-m grid gap-m ${0}"> <div class="${0}"> ${0} </div> ${0} ${0} <vaadin-checkbox data-testid="range:toggle" class="-my-xs w-full ${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="use_precise_time" ns="${0}"></foxy-i18n> </vaadin-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("range:before"),this.lang,this.ns,this.__showRangeTime?"grid-cols-1":"sm-grid-cols-2",this.__showRangeTime?"col-span-1":"sm-col-span-2",this.__renderRangePreset(),e.call(this,"start"),e.call(this,"end"),this.__showRangeTime?"col-span-1":"sm-col-span-2",!this.in("idle")||this.disabledSelector.matches("range",!0),this.__showRangeTime,(e=>{const t=e.currentTarget;this.__showRangeTime=t.checked}),this.lang,this.ns,this.renderTemplateOrSlot("range:after"))}__renderTimestamps(){return u(ye||(ye=xe` <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"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),n=this.in("idle");return u(ke||(ke=xe` <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||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return u(Te||(Te=xe` <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"))}}customElements.define("foxy-report-form",De);export{De as ReportForm};
195
+ `}static get is(){return"vaadin-date-time-picker"}static get version(){return"1.4.0"}static get properties(){return{name:{type:String},invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,value:!1},errorMessage:String,value:{type:String,notify:!0,value:"",observer:"__valueChanged"},min:{type:String,observer:"__minChanged"},max:{type:String,observer:"__maxChanged"},__minDateTime:{type:Date,value:""},__maxDateTime:{type:Date,value:""},datePlaceholder:{type:String},timePlaceholder:{type:String},helperText:{type:String,value:""},step:{type:Number},initialPosition:String,showWeekNumbers:{type:Boolean},label:{type:String,value:""},autoOpenDisabled:Boolean,disabled:{type:Boolean,value:!1,reflectToAttribute:!0},readonly:{type:Boolean,value:!1,reflectToAttribute:!0},autofocus:{type:Boolean},__selectedDateTime:{type:Date},__customFieldValueFormat:{type:Object,value:()=>({parseValue:e=>e.split("T"),formatValue:e=>e.join("T")})},i18n:{type:Object,value:()=>Object.assign({},U,G)}}}static get observers(){return["__selectedDateTimeChanged(__selectedDateTime)","__datePlaceholderChanged(datePlaceholder)","__timePlaceholderChanged(timePlaceholder)","__stepChanged(step)","__initialPositionChanged(initialPosition)","__showWeekNumbersChanged(showWeekNumbers)","__requiredChanged(required)","__invalidChanged(invalid)","__disabledChanged(disabled)","__readonlyChanged(readonly)","__i18nChanged(i18n.*)","__autoOpenDisabledChanged(autoOpenDisabled)"]}constructor(){super(),this.__defaultDateMinMaxValue=void 0,this.__defaultTimeMinValue="00:00:00.000",this.__defaultTimeMaxValue="23:59:59.999"}ready(){super.ready(),this.addEventListener("focusout",(e=>{e.relatedTarget!==this.__datePicker.$.overlay&&this.validate()})),this.__changeEventHandler=this.__changeEventHandler.bind(this),this.__filterElements=e=>e.nodeType===Node.ELEMENT_NODE,this.__datePickerChanged(),this.__timePickerChanged(),this.$.dateSlot.addEventListener("slotchange",this.__datePickerChanged.bind(this)),this.$.timeSlot.addEventListener("slotchange",this.__timePickerChanged.bind(this)),this.autofocus&&!this.disabled&&window.requestAnimationFrame((()=>this.focus()))}focus(){this.$.customField.focus()}__syncI18n(e,t,i){(i=i||Object.keys(t.i18n)).forEach((i=>{t.i18n.hasOwnProperty(i)&&e.set(`i18n.${i}`,t.i18n[i])}))}__updateCustomFieldInputs(){const e=this.$.customField.inputs;this.__datePicker&&this.__timePicker&&(e[0]!==this.__datePicker||e[1]!==this.__timePicker)&&this.$.customField._setInputs([this.__datePicker,this.__timePicker])}__changeEventHandler(e){this.__doDispatchChange=!0}__removeChangeListener(e){e&&e.removeEventListener("change",this.__changeEventHandler,!1)}__addChangeListener(e){e.addEventListener("change",this.__changeEventHandler,!1)}__datePickerChanged(){const e=this.shadowRoot.querySelector('[part="date"]'),t=this.$.dateSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__datePicker!==t&&(this.__removeChangeListener(this.__datePicker),this.__addChangeListener(t),this.__datePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.datePlaceholder,t.invalid=this.invalid,t.initialPosition=this.initialPosition,t.showWeekNumbers=this.showWeekNumbers,this.__syncI18n(t,this,z)):(this.datePlaceholder=t.placeholder,this.initialPosition=t.initialPosition,this.showWeekNumbers=t.showWeekNumbers,this.__syncI18n(this,t,z)),t.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue),t.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{},t._validateInput=()=>{})}__timePickerChanged(){const e=this.shadowRoot.querySelector('[part="time"]'),t=this.$.timeSlot.assignedNodes({flatten:!0}).filter(this.__filterElements)[0];this.__timePicker!==t&&(this.__removeChangeListener(this.__timePicker),this.__addChangeListener(t),this.__timePicker=t,this.__updateCustomFieldInputs(),t===e?(t.placeholder=this.timePlaceholder,t.step=this.step,t.invalid=this.invalid,this.__syncI18n(t,this,J)):(this.timePlaceholder=t.placeholder,this.step=t.step,this.__syncI18n(this,t,J)),this.__updateTimePickerMinMax(),t.required=this.required,t.disabled=this.disabled,t.readonly=this.readonly,t.autoOpenDisabled=this.autoOpenDisabled,t.validate=()=>{})}__updateTimePickerMinMax(){if(this.__timePicker&&this.__datePicker){const e=i._dateEquals,t=this.__parseDate(this.__datePicker.value),a=e(this.__minDateTime,this.__maxDateTime),s=this.__timePicker.value;this.__minDateTime&&e(t,this.__minDateTime)||a?this.__timePicker.min=this.__dateToIsoTimeString(this.__minDateTime):this.__timePicker.min=this.__defaultTimeMinValue,this.__maxDateTime&&e(t,this.__maxDateTime)||a?this.__timePicker.max=this.__dateToIsoTimeString(this.__maxDateTime):this.__timePicker.max=this.__defaultTimeMaxValue,this.__timePicker.value!==s&&(this.__timePicker.value=s)}}__i18nChanged(e){this.__datePicker&&this.__datePicker.set(e.path,e.value),this.__timePicker&&this.__timePicker.set(e.path,e.value)}__datePlaceholderChanged(e){this.__datePicker&&(this.__datePicker.placeholder=e)}__timePlaceholderChanged(e){this.__timePicker&&(this.__timePicker.placeholder=e)}__stepChanged(e){if(this.__timePicker&&this.__timePicker.step!==e){const t=this.__timePicker.value;this.__timePicker.step=e,this.__timePicker.value!==t&&this.__triggerCustomFieldValueUpdate()}}__triggerCustomFieldValueUpdate(){this.__timePicker&&this.__timePicker.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__initialPositionChanged(e){this.__datePicker&&(this.__datePicker.initialPosition=e)}__showWeekNumbersChanged(e){this.__datePicker&&(this.__datePicker.showWeekNumbers=e)}__invalidChanged(e){this.__datePicker&&(this.__datePicker.invalid=e),this.__timePicker&&(this.__timePicker.invalid=e)}__requiredChanged(e){this.__datePicker&&(this.__datePicker.required=e),this.__timePicker&&(this.__timePicker.required=e)}__disabledChanged(e){this.__datePicker&&(this.__datePicker.disabled=e),this.__timePicker&&(this.__timePicker.disabled=e)}__readonlyChanged(e){this.__datePicker&&(this.__datePicker.readonly=e),this.__timePicker&&(this.__timePicker.readonly=e)}__parseDate(e){return W.prototype._parseDate(e)}__formatDateISO(e,t){return e?W.prototype._formatISO(e):t}__formatTimeISO(e){return G.formatTime(e)}__parseTimeISO(e){return G.parseTime(e)}__parseDateTime(e){const[t,i]=e.split("T");if(!t||!i)return;const a=this.__parseDate(t);if(!a)return;const s=this.__parseTimeISO(i);return s?(a.setHours(parseInt(s.hours)),a.setMinutes(parseInt(s.minutes||0)),a.setSeconds(parseInt(s.seconds||0)),a.setMilliseconds(parseInt(s.milliseconds||0)),a):void 0}__formatDateTime(e){if(!e)return"";return`${this.__formatDateISO(e,"")}T${this.__dateToIsoTimeString(e)}`}__dateToIsoTimeString(e){return this.__formatTimeISO(this.__validateTime({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}))}__validateTime(e){return e&&(e.seconds=this.__stepSegment<3?void 0:e.seconds,e.milliseconds=this.__stepSegment<4?void 0:e.milliseconds),e}validate(){return!(this.invalid=!this.checkValidity())}checkValidity(){const e=this.$.customField.inputs.filter((e=>!e.checkValidity.call(e))).length>0,t=this.required&&this.$.customField.inputs.filter((e=>!e.value)).length>0;return!e&&!t}get __stepSegment(){const e=null==this.step?60:parseFloat(this.step);return e%3600==0?1:e%60!=0&&e?e%1==0?3:e<1?4:void 0:2}__dateTimeEquals(e,t){return!!i._dateEquals(e,t)&&(e.getHours()===t.getHours()&&e.getMinutes()===t.getMinutes()&&e.getSeconds()===t.getSeconds()&&e.getMilliseconds()===t.getMilliseconds())}__handleDateTimeChange(e,t,i,a){if(!i)return this[e]="",void(this[t]="");const s=this.__parseDateTime(i);s?this.__dateTimeEquals(this[t],s)||(this[t]=s):this[e]=a}__valueChanged(e,t){this.__handleDateTimeChange("value","__selectedDateTime",e,t),this.__doDispatchChange&&(this.__dispatchChange(),this.validate())}__dispatchChange(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}__minChanged(e,t){this.__handleDateTimeChange("min","__minDateTime",e,t),this.__datePicker&&(this.__datePicker.min=this.__formatDateISO(this.__minDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__maxChanged(e,t){this.__handleDateTimeChange("max","__maxDateTime",e,t),this.__datePicker&&(this.__datePicker.max=this.__formatDateISO(this.__maxDateTime,this.__defaultDateMinMaxValue)),this.__updateTimePickerMinMax()}__selectedDateTimeChanged(e){const t=this.__formatDateTime(e);this.value!==t&&(this.value=t);if(!!this.$.customField.inputs[0].$){const e=this.__doDispatchChange;this.$.customField.value=""!==this.value?this.value:"T",this.__doDispatchChange=e}}__customFieldValueChanged(e){const t=e.detail.value;if("T"===t&&!this.__customFieldInitialValueChangeReceived)return void(this.__customFieldInitialValueChangeReceived=!0);const[i,a]=t.split("T");this.__oldDateValue!==i&&(this.__oldDateValue=i,this.__updateTimePickerMinMax()),i&&a?t!==this.value&&(this.value=t):this.value="",this.__doDispatchChange=!1}__autoOpenDisabledChanged(e){this.__datePicker&&(this.__datePicker.autoOpenDisabled=e),this.__timePicker&&(this.__timePicker.autoOpenDisabled=e)}}customElements.define(Q.is,Q);const X=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function Z(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=0===i?X.length-1:i-1,s=X[a][0],n=new Date(e.getFullYear(),s),r=X[a][2];return{start:n,end:new Date(new Date(e.getFullYear(),r+1).getTime()-1)}}function ee(e=new Date){const t=e.getMonth(),i=X.findIndex((e=>e.includes(t))),a=X[i][0],s=new Date(e.getFullYear(),a),n=X[i][2];return{start:s,end:new Date(new Date(e.getFullYear(),n+1).getTime()-1)}}function te(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()-1),end:new Date(new Date(e.getFullYear(),e.getMonth()).getTime()-1)}}function ie(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth()),end:new Date(new Date(e.getFullYear(),e.getMonth()+1).getTime()-1)}}function ae(e=new Date){return{start:new Date(e.getFullYear()-1,0),end:new Date(new Date(e.getFullYear(),0).getTime()-1)}}function se(e=new Date){return{start:new Date(e.getFullYear(),0),end:new Date(new Date(e.getFullYear()+1,0).getTime()-1)}}function ne(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function re(e=new Date){return{start:new Date(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function de(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}let le,oe,he,me,_e,ce,ue,pe,ge,ve,fe,be,ye,ke,Te,xe=e=>e;const $e=g(v(f(D(b(E,"report-form")))));class De extends $e{constructor(){super(...arguments),this.templates={},this.__showRangeTime=!1}static get scopedElements(){return{"vaadin-date-time-picker":customElements.get("vaadin-date-time-picker"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-checkbox":customElements.get("vaadin-checkbox"),"vaadin-select":customElements.get("vaadin-select"),"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":$,"x-choice":k,"x-group":x}}static get properties(){return c(c({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({datetime_start:e})=>!!e||"datetime_start_required",({datetime_end:e})=>!!e||"datetime_end_required"]}render(){var e,t;const i=this.hiddenSelector;return u(le||(le=xe` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="space-y-l relative"> <div class="space-y-m"> ${0} ${0} ${0} ${0} ${0} </div> <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.in("busy"),i.matches("name",!0)?"":this.__renderName(),i.matches("range",!0)?"":this.__renderRange(),i.matches("timestamps",!0)||!this.data?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),y({"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:"")}__renderName(){const e="name",t=["complete","customers","customers_ltv"],i=!this.in("idle")||this.disabledSelector.matches(e),a=this.readonlySelector.matches(e);return u(oe||(oe=xe` <div data-testid="${0}"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="name" ns="${0}"></foxy-i18n> <x-choice data-testid="name-choice" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),e,this.renderTemplateOrSlot("name:before"),this.lang,this.ns,this.form.name,t,a,i,(e=>{e instanceof T&&this.edit({name:e.detail})}),t.map((e=>u(he||(he=xe` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="name_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="name_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),this.renderTemplateOrSlot("name:after"))}__renderRangePreset(){var e;const t=[[c({value:"0",label:"preset_previous_quarter"},Z()),c({value:"1",label:"preset_previous_month"},te()),c({value:"2",label:"preset_previous_year"},ae())],[c({value:"3",label:"preset_this_quarter"},ee()),c({value:"4",label:"preset_this_month"},ie()),c({value:"5",label:"preset_this_year"},se())],[c({value:"6",label:"preset_last_365_days"},ne()),c({value:"7",label:"preset_last_30_days"},re())]],i=t.flat(1).find((e=>{const{datetime_end:t,datetime_start:i}=this.form;return i&&t&&de(e.start)===i&&de(e.end)===t}));return u(ge||(ge=xe` <div> <vaadin-select data-testid="range:preset" label="${0}" class="w-full -mt-m -mb-xs" ?disabled="${0}" ?readonly="${0}" .value="${0}" .renderer="${0}" @change="${0}"> </vaadin-select> </div> `),this.t("preset"),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),S(null!==(e=null==i?void 0:i.value)&&void 0!==e?e:"custom"),(e=>{const i=u(me||(me=xe`<vaadin-item value="custom">${0}</vaadin-item>`),this.t("preset_custom")),a=u(_e||(_e=xe`<hr>`)),s=t.map((e=>{const t=e.map((({value:e,label:t})=>u(ce||(ce=xe`<vaadin-item value="${0}">${0}</vaadin-item>`),e,this.t(t))));return u(ue||(ue=xe`${0}${0}`),t,a)}));e.firstElementChild||e.appendChild(document.createElement("vaadin-list-box")),p(u(pe||(pe=xe`${0}${0}`),s,i),e.firstElementChild)}),(e=>{const i=e.currentTarget,a=t.flat(1).find((e=>e.value===i.value));a&&this.edit({datetime_start:de(a.start),datetime_end:de(a.end)})}))}__renderRangeDateTimePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(ve||(ve=xe` <vaadin-date-time-picker date-placeholder="${0}" time-placeholder="${0}" error-message="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-time-picker> `),this.t("select_date"),this.t("select_time"),w(i?this.t(i):void 0),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(e=>{const i=e.currentTarget;this.edit({[t]:i.value})}));var s,n}__renderRangeDatePicker(e){const t="end"===e?"datetime_end":"datetime_start",i=this.errors.find((e=>e.startsWith(`${t}_`))),a=this.form[t];return u(fe||(fe=xe` <vaadin-date-picker error-message="${0}" placeholder="${0}" data-testid="range:${0}" class="w-full" label="${0}" step="1" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),w(i?this.t(i):void 0),this.t("select_date"),e,this.t(e),!this.in("idle")||this.disabledSelector.matches("range",!0),this.readonlySelector.matches("range",!0),(()=>!i),a?null!==(n=null===(s=/^\d{4}-\d{2}-\d{2}/.exec(a))||void 0===s?void 0:s[0])&&void 0!==n?n:"":"",(e=>"Enter"===e.key&&this.submit()),(i=>{const a=i.currentTarget,s="end"===e?"23:59:59":"00:00:00";this.edit({[t]:`${a.value}T${s}`})}));var s,n}__renderRange(){const e=this.__showRangeTime?this.__renderRangeDateTimePicker:this.__renderRangeDatePicker;return u(be||(be=xe` <div data-testid="range"> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="range" ns="${0}"></foxy-i18n> <div class="p-m grid gap-m ${0}"> <div class="${0}"> ${0} </div> ${0} ${0} <vaadin-checkbox data-testid="range:toggle" class="-my-xs w-full ${0}" ?disabled="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="use_precise_time" ns="${0}"></foxy-i18n> </vaadin-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("range:before"),this.lang,this.ns,this.__showRangeTime?"grid-cols-1":"sm-grid-cols-2",this.__showRangeTime?"col-span-1":"sm-col-span-2",this.__renderRangePreset(),e.call(this,"start"),e.call(this,"end"),this.__showRangeTime?"col-span-1":"sm-col-span-2",!this.in("idle")||this.disabledSelector.matches("range",!0),this.__showRangeTime,(e=>{const t=e.currentTarget;this.__showRangeTime=t.checked}),this.lang,this.ns,this.renderTemplateOrSlot("range:after"))}__renderTimestamps(){return u(ye||(ye=xe` <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"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),n=this.in("idle");return u(ke||(ke=xe` <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||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return u(Te||(Te=xe` <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="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"))}}customElements.define("foxy-report-form",De);export{De as ReportForm};
@@ -1,4 +1,4 @@
1
- import"./foxy-spinner.js";import"./shared-0672e78b.js";import{T as n}from"./shared-cced7800.js";import{a as e}from"./shared-29e21467.js";import"./shared-c484320b.js";import"./shared-c52d3772.js";import"./shared-ea316e64.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-4f037e43.js";import"./shared-002b788f.js";import"./shared-5ad8c9a0.js";import"./shared-d3bf9ac0.js";import"./foxy-nucleon-element.js";import"./shared-b7423eab.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";import"./shared-4e709717.js";let a,s,o,r,t,l,i,d,m,f,y,h=n=>n;class p extends(e(n,"reports-table")){constructor(){super(...arguments),this.columns=[p.nameColumn,p.startColumn,p.endColumn,p.createdOnColumn,p.linkColumn]}}p.nameColumn={header:({html:n,lang:e,ns:s})=>n(a||(a=h`<foxy-i18n lang=${0} key="report_name" ns=${0}></foxy-i18n>`),e,s),cell:({html:n,data:e,lang:a,ns:o})=>{const r=`report_name_${e.name}`;return n(s||(s=h`<foxy-i18n class="font-semibold" lang=${0} key=${0} ns=${0}></foxy-i18n>`),a,r,o)}},p.startColumn={hideBelow:"md",header:({html:n,lang:e,ns:a})=>n(o||(o=h`<foxy-i18n lang=${0} key="range_start" ns=${0}></foxy-i18n>`),e,a),cell:({html:n,data:e,lang:a,ns:s})=>n(r||(r=h`
1
+ import"./foxy-spinner.js";import"./shared-2bce9f91.js";import{T as n}from"./shared-09c75a01.js";import{a as e}from"./shared-00752056.js";import"./shared-aef0c294.js";import"./shared-2470973b.js";import"./shared-4cf568d8.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./foxy-nucleon-element.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";let a,s,o,r,t,l,i,d,m,f,y,h=n=>n;class p extends(e(n,"reports-table")){constructor(){super(...arguments),this.columns=[p.nameColumn,p.startColumn,p.endColumn,p.createdOnColumn,p.linkColumn]}}p.nameColumn={header:({html:n,lang:e,ns:s})=>n(a||(a=h`<foxy-i18n lang=${0} key="report_name" ns=${0}></foxy-i18n>`),e,s),cell:({html:n,data:e,lang:a,ns:o})=>{const r=`report_name_${e.name}`;return n(s||(s=h`<foxy-i18n class="font-semibold" lang=${0} key=${0} ns=${0}></foxy-i18n>`),a,r,o)}},p.startColumn={hideBelow:"md",header:({html:n,lang:e,ns:a})=>n(o||(o=h`<foxy-i18n lang=${0} key="range_start" ns=${0}></foxy-i18n>`),e,a),cell:({html:n,data:e,lang:a,ns:s})=>n(r||(r=h`
2
2
  <foxy-i18n
3
3
  options=${0}
4
4
  lang=${0}
@@ -1,4 +1,4 @@
1
- import"./foxy-address-card.js";import"./foxy-item-form.js";import"./foxy-item-card.js";import"./shared-0672e78b.js";import"./shared-40537775.js";import{I as s}from"./shared-6e6ed30a.js";import{_ as r}from"./shared-a8ced8bf.js";import{h as e}from"./shared-7f33a83a.js";import{i as t}from"./shared-d3bf9ac0.js";import{a as i}from"./shared-29e21467.js";import{B as o}from"./shared-002b788f.js";import{C as a}from"./shared-5ad8c9a0.js";import"./shared-c484320b.js";import"./shared-c52d3772.js";import"./shared-ea316e64.js";import"./shared-b5cbbdd8.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-b7423eab.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";import"./shared-4e709717.js";import"./shared-40d82f6b.js";import"./shared-d43fc5cc.js";import"./shared-6b8874a7.js";import"./shared-7b167fe9.js";import"./shared-2215e6c8.js";import"./shared-34b11d34.js";import"./shared-71deb26e.js";import"./shared-4c338ca6.js";import"./shared-4457dc27.js";import"./shared-92bd849f.js";import"./shared-b8e9b536.js";import"./shared-ef0fc329.js";import"./shared-4975f86f.js";import"./foxy-discount-detail-card.js";import"./shared-6003864d.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-6d2064e9.js";import"./shared-f2d19582.js";import"./shared-1b3e1a0d.js";import"./shared-bb522838.js";import"./shared-b28dbc68.js";import"./shared-e396ec04.js";import"./shared-11c2efc8.js";import"./shared-5504f415.js";import"./shared-e3ce88dc.js";import"./shared-923da875.js";import"./shared-3a3878c9.js";import"./shared-162fc285.js";import"./foxy-coupon-card.js";import"./shared-2f1e04ae.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-29376ba1.js";import"./shared-7661b51a.js";import"./shared-bc7f58ef.js";import"./shared-5b55627c.js";import"./foxy-subscription-card.js";import"./shared-236d9b7e.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./shared-6bf8883f.js";import"./shared-e119731e.js";import"./foxy-table.js";import"./shared-cced7800.js";import"./foxy-nucleon-element.js";import"./shared-d302ad2c.js";import"./shared-75e78c70.js";import"./shared-facfe95a.js";import"./foxy-pagination.js";let d,c,m=s=>s;const p=a(i(s,"shipment-card"));class n extends p{constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return r(r({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new o(`address:not=full-address ${super.hiddenSelector.toString()}`)}get readonlySelector(){return this.__editable?super.readonlySelector:o.True}renderBody(){var s,r,i;let o;if(this.data)try{const s=new URL(this.data._links["fx:items"].href);s.searchParams.set("zoom","item_options"),o=s.toString()}catch(s){}return e(c||(c=m` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer=""> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-async-details-control infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-async-details-control> </div> `),t(null===(s=this.data)||void 0===s?void 0:s._links["fx:customer_address"].href),null===(r=this.data)||void 0===r?void 0:r.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),t(o),(({html:s,dialog:r,handleFetch:e,handleUpdate:t})=>s(d||(d=m`
1
+ import"./foxy-address-card.js";import"./foxy-item-form.js";import"./foxy-item-card.js";import"./shared-2bce9f91.js";import"./shared-cd6381a5.js";import{I as s}from"./shared-436f4187.js";import{_ as r}from"./shared-a8ced8bf.js";import{h as e}from"./shared-7f33a83a.js";import{i as t}from"./shared-d3bf9ac0.js";import{a as i}from"./shared-00752056.js";import{B as o}from"./shared-76b3d76a.js";import{C as a}from"./shared-43bcce74.js";import"./shared-aef0c294.js";import"./shared-2470973b.js";import"./shared-4cf568d8.js";import"./shared-2c067e88.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";import"./shared-1936d1d5.js";import"./shared-a696c602.js";import"./shared-9cba1b0e.js";import"./shared-cfae0154.js";import"./shared-50f97405.js";import"./shared-4c32f1ad.js";import"./shared-7a1de87a.js";import"./shared-3ba49bac.js";import"./shared-d4f80692.js";import"./shared-2afc2d3b.js";import"./shared-862b436d.js";import"./shared-bfc37e75.js";import"./shared-6a53f85f.js";import"./shared-37d6c723.js";import"./foxy-discount-detail-card.js";import"./shared-d8b07f4f.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-nucleon-element.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-c434e6d6.js";import"./shared-1e9fd9f1.js";import"./shared-7b6f4a11.js";import"./shared-7ed14dc8.js";import"./shared-9c3934c8.js";import"./shared-ab687b1e.js";import"./shared-11c2efc8.js";import"./shared-17cb43f3.js";import"./shared-254ef6a4.js";import"./shared-39549b4e.js";import"./shared-7df6ee40.js";import"./foxy-coupon-card.js";import"./shared-7e2ea44c.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-01d2cae6.js";import"./shared-ddf10c04.js";import"./shared-bc7f58ef.js";import"./shared-875748d8.js";import"./foxy-subscription-card.js";import"./shared-0a52b08c.js";import"./foxy-subscription-form.js";import"./shared-b51997d1.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./shared-ea67b3f3.js";import"./shared-75e78c70.js";let d,c,m=s=>s;const p=a(i(s,"shipment-card"));class n extends p{constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return r(r({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new o(`address:not=full-address ${super.hiddenSelector.toString()}`)}get readonlySelector(){return this.__editable?super.readonlySelector:o.True}renderBody(){var s,r,i;let o;if(this.data)try{const s=new URL(this.data._links["fx:items"].href);s.searchParams.set("zoom","item_options"),o=s.toString()}catch(s){}return e(c||(c=m` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer=""> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-async-details-control infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-async-details-control> </div> `),t(null===(s=this.data)||void 0===s?void 0:s._links["fx:customer_address"].href),null===(r=this.data)||void 0===r?void 0:r.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),t(o),(({html:s,dialog:r,handleFetch:e,handleUpdate:t})=>s(d||(d=m`
2
2
  <foxy-item-form
3
3
  customer-addresses=${0}
4
4
  item-categories=${0}
@@ -1 +1 @@
1
- import{I as t}from"./shared-6e6ed30a.js";import"./foxy-nucleon-element.js";import{_ as e}from"./shared-a8ced8bf.js";import{a as s}from"./shared-29e21467.js";import{i}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-c484320b.js";import"./shared-c52d3772.js";import"./shared-ea316e64.js";import"./shared-0672e78b.js";import"./shared-002b788f.js";import"./shared-4f037e43.js";import"./shared-b7423eab.js";import"./shared-dc798bf4.js";import"./shared-d6276c83.js";import"./shared-dcbf57e0.js";import"./shared-4e709717.js";let a,d,o,h=t=>t;const l=s(t,"shipping-method-card");class c extends l{constructor(){super(...arguments),this.storeShippingMethods=null,this.getImageSrc=null}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' fill='none' viewBox='0 0 40 40'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill='%23E8E8E8' d='M0 0h40v40H0z'/%3E%3Cpath fill='%23fff' d='M0 14.81V7.88L7.88 0h6.93L0 14.81ZM0 0h6.47L0 6.47V0Zm16.22 0L0 16.22v6.93l9-9V14c0-.55.2-1.02.59-1.41.39-.4.86-.59 1.41-.59h.15l12-12h-6.93ZM9 15.57l-9 9v6.93l9-9v-6.93Zm.15 8.19L0 32.91v6.93l12.33-12.33a3.28 3.28 0 0 1-.46-.39A2.9 2.9 0 0 1 11 25c-.55 0-1.02-.2-1.41-.59a2 2 0 0 1-.44-.65Zm4.17 4.17L1.26 40h6.92L23 25.18V25h-6c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 14 28a3.2 3.2 0 0 1-.68-.07Zm11.85-3.5.26-.26A.98.98 0 0 1 26 24c.28 0 .52.1.71.29.2.19.29.43.29.71 0 .28-.1.52-.29.71A.94.94 0 0 1 26 26a.97.97 0 0 1-.71-.29A.97.97 0 0 1 25 25a1 1 0 0 1 .17-.57Z'/%3E%3Cpath fill='%23fff' d='M23.29 26.31 9.59 40h6.94L40 16.53V9.6l-9.6 9.6.4.53c.07.08.12.17.15.27s.05.2.05.32V24c0 .28-.1.52-.29.71A.94.94 0 0 1 30 25h-1c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 26 28a3 3 0 0 1-2.71-1.69Zm6.51-7.92L40 8.19V1.25L25.26 16h2.24a1 1 0 0 1 .45.1 1 1 0 0 1 .35.3l1.5 1.99ZM25 14.84 39.84 0h-6.93l-12 12H23c.55 0 1.02.2 1.41.59.4.39.59.86.59 1.41v.84ZM19.5 12l12-12h-6.93l-12 12h6.93Zm-1.56 28L40 17.94v6.93L24.87 40h-6.93ZM40 26.29 26.29 40h6.93L40 33.22v-6.93ZM34.63 40 40 34.63V40h-5.37ZM13 25c0 .28.1.52.29.71.19.2.43.29.71.29.28 0 .52-.1.71-.29.2-.19.29-.43.29-.71 0-.28-.1-.52-.29-.71A.97.97 0 0 0 14 24c-.07 0-.14 0-.2.02a.95.95 0 0 0-.51.27.95.95 0 0 0-.29.71Z'/%3E%3Cpath fill='%23fff' d='M25 18v3h4.21l-.85-1.18-.68-.91L27 18h-2Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h40v40H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"}static get properties(){return e(e({},super.properties),{},{storeShippingMethods:{type:String,attribute:"store-shipping-methods"},getImageSrc:{attribute:!1}})}renderBody(){var t,e,s,l,n;const p=c.defaultImageSrc,m=this.data,f=this.renderRoot.querySelector("#methods"),g=1===(null===(s=null===(e=null===(t=null==f?void 0:f.data)||void 0===t?void 0:t._embedded)||void 0===e?void 0:e["fx:store_shipping_methods"])||void 0===s?void 0:s.length);let u;try{const t=new URL(this.storeShippingMethods);t.searchParams.set("shipping_method_id",this.href.split("/").pop()),t.searchParams.set("limit","1"),u=t.toString()}catch(t){u=void 0}return r(a||(a=h` ${0} <figure class="flex items-center gap-m h-m"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1"> <dl class="flex justify-between gap-s"> <dt class="sr-only">${0}</dt> <dd class="font-semibold truncate flex-shrink-0">${0}&ZeroWidthSpace;</dd> ${0} </dl> </figcaption> </figure> `),"string"==typeof u?r(d||(d=h` <foxy-nucleon class="hidden" infer="" href="${0}" id="methods" @update="${0}"> </foxy-nucleon> `),i(u),(()=>this.requestUpdate())):"",null!==(n=m?null===(l=this.getImageSrc)||void 0===l?void 0:l.call(this,m.code):null)&&void 0!==n?n:p,this.t("image_alt"),(t=>t.currentTarget.src=p),this.t("title_description"),null==m?void 0:m.name,g?r(o||(o=h` <dt class="sr-only">${0}</dt> <dd class="truncate text-tertiary">${0}</dd> `),this.t("subtitle_description"),this.t("status_active")):"")}}customElements.define("foxy-shipping-method-card",c);export{c as ShippingMethodCard};
1
+ import{I as t}from"./shared-436f4187.js";import"./foxy-nucleon-element.js";import{_ as e}from"./shared-a8ced8bf.js";import{a as s}from"./shared-00752056.js";import{i}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-aef0c294.js";import"./shared-2470973b.js";import"./shared-4cf568d8.js";import"./shared-2bce9f91.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";let a,d,o,h=t=>t;const l=s(t,"shipping-method-card");class c extends l{constructor(){super(...arguments),this.storeShippingMethods=null,this.getImageSrc=null}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' fill='none' viewBox='0 0 40 40'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill='%23E8E8E8' d='M0 0h40v40H0z'/%3E%3Cpath fill='%23fff' d='M0 14.81V7.88L7.88 0h6.93L0 14.81ZM0 0h6.47L0 6.47V0Zm16.22 0L0 16.22v6.93l9-9V14c0-.55.2-1.02.59-1.41.39-.4.86-.59 1.41-.59h.15l12-12h-6.93ZM9 15.57l-9 9v6.93l9-9v-6.93Zm.15 8.19L0 32.91v6.93l12.33-12.33a3.28 3.28 0 0 1-.46-.39A2.9 2.9 0 0 1 11 25c-.55 0-1.02-.2-1.41-.59a2 2 0 0 1-.44-.65Zm4.17 4.17L1.26 40h6.92L23 25.18V25h-6c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 14 28a3.2 3.2 0 0 1-.68-.07Zm11.85-3.5.26-.26A.98.98 0 0 1 26 24c.28 0 .52.1.71.29.2.19.29.43.29.71 0 .28-.1.52-.29.71A.94.94 0 0 1 26 26a.97.97 0 0 1-.71-.29A.97.97 0 0 1 25 25a1 1 0 0 1 .17-.57Z'/%3E%3Cpath fill='%23fff' d='M23.29 26.31 9.59 40h6.94L40 16.53V9.6l-9.6 9.6.4.53c.07.08.12.17.15.27s.05.2.05.32V24c0 .28-.1.52-.29.71A.94.94 0 0 1 30 25h-1c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 26 28a3 3 0 0 1-2.71-1.69Zm6.51-7.92L40 8.19V1.25L25.26 16h2.24a1 1 0 0 1 .45.1 1 1 0 0 1 .35.3l1.5 1.99ZM25 14.84 39.84 0h-6.93l-12 12H23c.55 0 1.02.2 1.41.59.4.39.59.86.59 1.41v.84ZM19.5 12l12-12h-6.93l-12 12h6.93Zm-1.56 28L40 17.94v6.93L24.87 40h-6.93ZM40 26.29 26.29 40h6.93L40 33.22v-6.93ZM34.63 40 40 34.63V40h-5.37ZM13 25c0 .28.1.52.29.71.19.2.43.29.71.29.28 0 .52-.1.71-.29.2-.19.29-.43.29-.71 0-.28-.1-.52-.29-.71A.97.97 0 0 0 14 24c-.07 0-.14 0-.2.02a.95.95 0 0 0-.51.27.95.95 0 0 0-.29.71Z'/%3E%3Cpath fill='%23fff' d='M25 18v3h4.21l-.85-1.18-.68-.91L27 18h-2Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h40v40H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"}static get properties(){return e(e({},super.properties),{},{storeShippingMethods:{type:String,attribute:"store-shipping-methods"},getImageSrc:{attribute:!1}})}renderBody(){var t,e,s,l,n;const p=c.defaultImageSrc,f=this.data,m=this.renderRoot.querySelector("#methods"),g=1===(null===(s=null===(e=null===(t=null==m?void 0:m.data)||void 0===t?void 0:t._embedded)||void 0===e?void 0:e["fx:store_shipping_methods"])||void 0===s?void 0:s.length);let u;try{const t=new URL(this.storeShippingMethods);t.searchParams.set("shipping_method_id",this.href.split("/").pop()),t.searchParams.set("limit","1"),u=t.toString()}catch(t){u=void 0}return r(a||(a=h` ${0} <figure class="flex items-center gap-m h-m"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1"> <dl class="flex justify-between gap-s"> <dt class="sr-only">${0}</dt> <dd class="font-semibold truncate flex-shrink-0">${0}&ZeroWidthSpace;</dd> ${0} </dl> </figcaption> </figure> `),"string"==typeof u?r(d||(d=h` <foxy-nucleon class="hidden" infer="" href="${0}" id="methods" @update="${0}"> </foxy-nucleon> `),i(u),(()=>this.requestUpdate())):"",null!==(n=f?null===(l=this.getImageSrc)||void 0===l?void 0:l.call(this,f.code):null)&&void 0!==n?n:p,this.t("image_alt"),(t=>t.currentTarget.src=p),this.t("title_description"),null==f?void 0:f.name,g?r(o||(o=h` <dt class="sr-only">${0}</dt> <dd class="truncate text-tertiary">${0}</dd> `),this.t("subtitle_description"),this.t("status_active")):"")}}customElements.define("foxy-shipping-method-card",c);export{c as ShippingMethodCard};