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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/README.md +4 -0
  2. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  3. package/dist/cdn/foxy-address-card.js +1 -1
  4. package/dist/cdn/foxy-address-form.js +1 -1
  5. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  6. package/dist/cdn/foxy-api-browser.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  8. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-card.js +1 -1
  11. package/dist/cdn/foxy-attribute-form.js +1 -1
  12. package/dist/cdn/foxy-cancellation-form.js +1 -1
  13. package/dist/cdn/foxy-cart-card.js +1 -1
  14. package/dist/cdn/foxy-cart-form.js +1 -1
  15. package/dist/cdn/foxy-collection-page.js +1 -1
  16. package/dist/cdn/foxy-collection-pages.js +1 -1
  17. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  18. package/dist/cdn/foxy-coupon-card.js +1 -1
  19. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  20. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  21. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  22. package/dist/cdn/foxy-coupon-form.js +1 -1
  23. package/dist/cdn/foxy-custom-field-card.js +1 -1
  24. package/dist/cdn/foxy-custom-field-form.js +1 -1
  25. package/dist/cdn/foxy-customer-api.js +1 -1
  26. package/dist/cdn/foxy-customer-card.js +1 -1
  27. package/dist/cdn/foxy-customer-form.js +1 -1
  28. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  29. package/dist/cdn/foxy-customer-portal.js +1 -1
  30. package/dist/cdn/foxy-customer.js +6 -6
  31. package/dist/cdn/foxy-customers-table.js +1 -1
  32. package/dist/cdn/foxy-discount-builder.js +1 -1
  33. package/dist/cdn/foxy-discount-card.js +1 -1
  34. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  35. package/dist/cdn/foxy-donation.js +1 -1
  36. package/dist/cdn/foxy-email-template-card.js +1 -1
  37. package/dist/cdn/foxy-email-template-form.js +1 -1
  38. package/dist/cdn/foxy-error-entry-card.js +1 -1
  39. package/dist/cdn/foxy-form-dialog.js +1 -1
  40. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  41. package/dist/cdn/foxy-gift-card-card.js +1 -1
  42. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  43. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  44. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  45. package/dist/cdn/foxy-gift-card-form.js +1 -1
  46. package/dist/cdn/foxy-i18n-editor.js +2 -2
  47. package/dist/cdn/foxy-i18n.js +1 -1
  48. package/dist/cdn/foxy-integration-card.js +1 -1
  49. package/dist/cdn/foxy-integration-form.js +1 -1
  50. package/dist/cdn/foxy-item-card.js +1 -1
  51. package/dist/cdn/foxy-item-category-card.js +1 -1
  52. package/dist/cdn/foxy-item-category-form.js +1 -1
  53. package/dist/cdn/foxy-item-form.js +1 -1
  54. package/dist/cdn/foxy-item-option-card.js +1 -1
  55. package/dist/cdn/foxy-item-option-form.js +1 -1
  56. package/dist/cdn/foxy-items-form.js +1 -1
  57. package/dist/cdn/foxy-nucleon-element.js +1 -1
  58. package/dist/cdn/foxy-pagination.js +1 -1
  59. package/dist/cdn/foxy-payment-card.js +1 -1
  60. package/dist/cdn/foxy-payment-method-card.js +1 -1
  61. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  62. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  63. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  64. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  65. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  66. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  67. package/dist/cdn/foxy-payments-api.js +1 -1
  68. package/dist/cdn/foxy-query-builder.js +1 -1
  69. package/dist/cdn/foxy-report-form.js +2 -2
  70. package/dist/cdn/foxy-reports-table.js +5 -5
  71. package/dist/cdn/foxy-shipment-card.js +1 -1
  72. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  73. package/dist/cdn/foxy-sign-in-form.js +1 -1
  74. package/dist/cdn/foxy-spinner.js +1 -1
  75. package/dist/cdn/foxy-store-form.js +1 -1
  76. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  77. package/dist/cdn/foxy-subscription-card.js +1 -1
  78. package/dist/cdn/foxy-subscription-form.js +2 -2
  79. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  80. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  81. package/dist/cdn/foxy-table.js +1 -1
  82. package/dist/cdn/foxy-tax-card.js +1 -1
  83. package/dist/cdn/foxy-tax-form.js +1 -1
  84. package/dist/cdn/foxy-template-config-form.js +1 -1
  85. package/dist/cdn/foxy-template-form.js +1 -1
  86. package/dist/cdn/foxy-template-set-card.js +1 -1
  87. package/dist/cdn/foxy-template-set-form.js +1 -1
  88. package/dist/cdn/foxy-transaction-card.js +1 -1
  89. package/dist/cdn/foxy-transaction.js +1 -1
  90. package/dist/cdn/foxy-transactions-table.js +7 -7
  91. package/dist/cdn/foxy-user-form.js +1 -1
  92. package/dist/cdn/foxy-users-table.js +1 -1
  93. package/dist/cdn/foxy-webhook-card.js +1 -1
  94. package/dist/cdn/foxy-webhook-form.js +1 -1
  95. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  96. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  97. package/dist/cdn/shared-11438c42.js +1 -0
  98. package/dist/cdn/{shared-868065de.js → shared-1433fc29.js} +1 -1
  99. package/dist/cdn/{shared-a37abe4c.js → shared-242b3ee9.js} +1 -1
  100. package/dist/cdn/{shared-988ec916.js → shared-274c49b0.js} +1 -1
  101. package/dist/cdn/{shared-ea67b3f3.js → shared-38b37888.js} +1 -1
  102. package/dist/cdn/{shared-8dd0af4d.js → shared-3d241b7f.js} +1 -1
  103. package/dist/cdn/{shared-d518bd55.js → shared-3dbe9aaa.js} +1 -1
  104. package/dist/cdn/{shared-de036570.js → shared-454f172e.js} +1 -1
  105. package/dist/cdn/shared-45926e43.js +1 -0
  106. package/dist/cdn/{shared-839dd3a8.js → shared-531bb690.js} +1 -1
  107. package/dist/cdn/{shared-d61b3e4f.js → shared-5c804971.js} +1 -1
  108. package/dist/cdn/{shared-4f9d2417.js → shared-61e74612.js} +2 -2
  109. package/dist/cdn/{shared-486d7bb5.js → shared-62d636b5.js} +1 -1
  110. package/dist/cdn/{shared-43bcce74.js → shared-67546e10.js} +1 -1
  111. package/dist/cdn/{shared-bb0e33c3.js → shared-6f5c3101.js} +1 -1
  112. package/dist/cdn/{shared-0821cfdc.js → shared-7097364f.js} +1 -1
  113. package/dist/cdn/{shared-2add595d.js → shared-747b6d74.js} +1 -1
  114. package/dist/cdn/{shared-8b6addec.js → shared-758859b5.js} +1 -1
  115. package/dist/cdn/{shared-af226a9a.js → shared-81f9dc9a.js} +1 -1
  116. package/dist/cdn/{shared-6581241a.js → shared-8c11a711.js} +1 -1
  117. package/dist/cdn/{shared-80fc2b6a.js → shared-8f8abcd6.js} +1 -1
  118. package/dist/cdn/shared-94fc438b.js +1 -0
  119. package/dist/cdn/{shared-a85afa33.js → shared-955db6b4.js} +1 -1
  120. package/dist/cdn/{shared-62a54a6c.js → shared-9f905d9f.js} +1 -1
  121. package/dist/cdn/{shared-39c10b22.js → shared-a01b5597.js} +1 -1
  122. package/dist/cdn/shared-a29b600a.js +1 -0
  123. package/dist/cdn/{shared-b40cf0dd.js → shared-a2d619b4.js} +1 -1
  124. package/dist/cdn/{shared-63139d9e.js → shared-a5364194.js} +1 -1
  125. package/dist/cdn/{shared-1c94a156.js → shared-be99323d.js} +1 -1
  126. package/dist/cdn/{shared-c774d080.js → shared-c6a01446.js} +1 -1
  127. package/dist/cdn/{shared-c95c17e6.js → shared-c8f5c306.js} +1 -1
  128. package/dist/cdn/{shared-a41234b4.js → shared-ca87cf22.js} +1 -1
  129. package/dist/cdn/{shared-4979dca4.js → shared-cbdf08d8.js} +1 -1
  130. package/dist/cdn/{shared-f80f402a.js → shared-d3bf404a.js} +1 -1
  131. package/dist/cdn/{shared-744cf66b.js → shared-d807ae5c.js} +1 -1
  132. package/dist/cdn/shared-dc91f7ae.js +1 -0
  133. package/dist/cdn/{shared-76b3d76a.js → shared-dcdb6ea1.js} +1 -1
  134. package/dist/cdn/{shared-9bdacf65.js → shared-e262920d.js} +1 -1
  135. package/dist/cdn/{shared-2f7dcefa.js → shared-e3ab56d1.js} +1 -1
  136. package/dist/cdn/{shared-cba08e1c.js → shared-ee5a7812.js} +1 -1
  137. package/dist/cdn/shared-efa137cd.js +1 -0
  138. package/dist/cdn/{shared-71f2ef1f.js → shared-efc1aeae.js} +1 -1
  139. package/dist/cdn/{shared-101d1234.js → shared-f621ccee.js} +1 -1
  140. package/dist/cdn/translations/cart-form/en.json +5 -5
  141. package/dist/cdn/translations/customer/en.json +2 -2
  142. package/dist/cdn/translations/customer-portal/de.json +1 -1
  143. package/dist/cdn/translations/customer-portal/en.json +1 -1
  144. package/dist/cdn/translations/customer-portal/es.json +1 -1
  145. package/dist/cdn/translations/customer-portal/fr.json +2 -2
  146. package/dist/cdn/translations/customer-portal/nl.json +1 -1
  147. package/dist/cdn/translations/customer-portal/pl.json +1 -1
  148. package/dist/cdn/translations/customer-portal/se.json +1 -1
  149. package/dist/cdn/translations/item-category-form/en.json +2 -2
  150. package/dist/cdn/translations/item-form/en.json +1 -1
  151. package/dist/cdn/translations/shipment-card/en.json +1 -1
  152. package/dist/cdn/translations/subscription-form/en.json +1 -1
  153. package/dist/cdn/translations/transaction/en.json +3 -3
  154. package/dist/cdn/translations/transaction-card/en.json +1 -1
  155. package/dist/cdn/translations/transactions-table/en.json +1 -1
  156. package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js +13 -7
  157. package/dist/elements/internal/InternalAsyncDetailsControl/InternalAsyncDetailsControl.js.map +1 -1
  158. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +2 -2
  159. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +33 -33
  160. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
  161. package/dist/elements/internal/InternalAsyncListControl/index.d.ts +0 -2
  162. package/dist/elements/internal/InternalAsyncListControl/index.js +0 -2
  163. package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
  164. package/dist/elements/internal/InternalCalendar/InternalCalendar.js +2 -2
  165. package/dist/elements/internal/InternalCalendar/InternalCalendar.js.map +1 -1
  166. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +2 -7
  167. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
  168. package/dist/elements/public/AppliedCouponCodeForm/types.d.ts +1 -3
  169. package/dist/elements/public/AppliedCouponCodeForm/types.js.map +1 -1
  170. package/dist/elements/public/CartCard/CartCard.js +2 -7
  171. package/dist/elements/public/CartCard/CartCard.js.map +1 -1
  172. package/dist/elements/public/CartForm/CartForm.js +1 -3
  173. package/dist/elements/public/CartForm/CartForm.js.map +1 -1
  174. package/dist/elements/public/CollectionPage/CollectionPage.d.ts +2 -2
  175. package/dist/elements/public/CollectionPage/CollectionPage.js +6 -5
  176. package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
  177. package/dist/elements/public/CouponForm/CouponForm.js +5 -1
  178. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  179. package/dist/elements/public/Customer/Customer.js +2 -2
  180. package/dist/elements/public/Customer/Customer.js.map +1 -1
  181. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +0 -1
  182. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  183. package/dist/elements/public/ItemCard/ItemCard.js +2 -7
  184. package/dist/elements/public/ItemCard/ItemCard.js.map +1 -1
  185. package/dist/elements/public/ItemForm/ItemForm.js +6 -23
  186. package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
  187. package/dist/elements/public/ItemOptionCard/ItemOptionCard.d.ts +3 -0
  188. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js +31 -27
  189. package/dist/elements/public/ItemOptionCard/ItemOptionCard.js.map +1 -1
  190. package/dist/elements/public/ItemOptionCard/index.d.ts +0 -2
  191. package/dist/elements/public/ItemOptionCard/index.js +0 -2
  192. package/dist/elements/public/ItemOptionCard/index.js.map +1 -1
  193. package/dist/elements/public/NucleonElement/NucleonElement.js +4 -4
  194. package/dist/elements/public/NucleonElement/NucleonElement.js.map +1 -1
  195. package/dist/elements/public/PaymentsApi/PaymentsApi.d.ts +21 -2
  196. package/dist/elements/public/PaymentsApi/PaymentsApi.js +22 -3
  197. package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
  198. package/dist/elements/public/QueryBuilder/components/RangeValue.js +6 -6
  199. package/dist/elements/public/QueryBuilder/components/RangeValue.js.map +1 -1
  200. package/dist/elements/public/ReportForm/utils.js +3 -2
  201. package/dist/elements/public/ReportForm/utils.js.map +1 -1
  202. package/dist/elements/public/StoreForm/StoreForm.js +1 -1
  203. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
  204. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +2 -1
  205. package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
  206. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +1 -0
  207. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  208. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +2 -7
  209. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  210. package/dist/elements/public/SubscriptionForm/types.d.ts +1 -1
  211. package/dist/elements/public/SubscriptionForm/types.js.map +1 -1
  212. package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js.map +1 -1
  213. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.d.ts +2 -2
  214. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +3 -2
  215. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
  216. package/dist/elements/public/SubscriptionsTable/types.d.ts +2 -2
  217. package/dist/elements/public/SubscriptionsTable/types.js.map +1 -1
  218. package/dist/elements/public/TaxCard/TaxCard.js +6 -2
  219. package/dist/elements/public/TaxCard/TaxCard.js.map +1 -1
  220. package/dist/elements/public/TransactionCard/TransactionCard.js +1 -0
  221. package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
  222. package/dist/elements/public/TransactionsTable/TransactionsTable.js +1 -0
  223. package/dist/elements/public/TransactionsTable/TransactionsTable.js.map +1 -1
  224. package/package.json +5 -4
  225. package/dist/cdn/shared-09eb558f.js +0 -1
  226. package/dist/cdn/shared-1000b848.js +0 -1
  227. package/dist/cdn/shared-181f51bd.js +0 -1
  228. package/dist/cdn/shared-21679ebd.js +0 -1
  229. package/dist/cdn/shared-a0c8faf2.js +0 -1
  230. package/dist/cdn/shared-bcc6e13b.js +0 -1
@@ -1 +1 @@
1
- import{_ as t}from"./shared-a8ced8bf.js";import"./shared-bc814810.js";import{L as e,c as i,h as s}from"./shared-7f33a83a.js";import{p as r}from"./shared-0821cfdc.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as a,S as n,x as o}from"./shared-2cc638ad.js";import"./shared-1c94a156.js";import"./shared-62a54a6c.js";import{I as c,D as l}from"./shared-101d1234.js";import{E as h}from"./shared-de036570.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import"./shared-2092d86f.js";import{s as d}from"./shared-11c2efc8.js";import"./shared-0ce006b9.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-ed0dee03.js";import"./shared-2f7dcefa.js";import"./shared-a85afa33.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,E,I,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,c,l,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,c?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,l?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,e,t>102?s(E||(E=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(I||(I=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,j=t=>t;class L extends S{static get scopedElements(){return{"x-pic":f}}}class A extends S{static get scopedElements(){return{"x-pic":L}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":A}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=j`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=j`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class P extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends P{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":N,"x-i18n":c}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends P{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":l,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{R as Item,K as ItemsForm};
1
+ import{_ as t}from"./shared-a8ced8bf.js";import"./shared-bc814810.js";import{L as e,c as i,h as s}from"./shared-7f33a83a.js";import{p as r}from"./shared-7097364f.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as a,S as n,x as o}from"./shared-2cc638ad.js";import"./shared-be99323d.js";import"./shared-9f905d9f.js";import{I as c,D as l}from"./shared-f621ccee.js";import{E as h}from"./shared-454f172e.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import"./shared-2092d86f.js";import{s as d}from"./shared-11c2efc8.js";import"./shared-0ce006b9.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-ed0dee03.js";import"./shared-e3ab56d1.js";import"./shared-955db6b4.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,E,I,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,c,l,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,c?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,l?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,e,t>102?s(E||(E=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(I||(I=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,j=t=>t;class L extends S{static get scopedElements(){return{"x-pic":f}}}class A extends S{static get scopedElements(){return{"x-pic":L}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":A}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=j`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=j`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class P extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends P{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":N,"x-i18n":c}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends P{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":l,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{R as Item,K as ItemsForm};
@@ -1 +1 @@
1
- import{N as s}from"./shared-181f51bd.js";export{N as NucleonElement}from"./shared-181f51bd.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-76b3d76a.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-4f037e43.js";import"./shared-2f7dcefa.js";customElements.define("foxy-nucleon",s);
1
+ import{N as e}from"./shared-dc91f7ae.js";export{N as NucleonElement}from"./shared-dc91f7ae.js";import"./shared-a8ced8bf.js";import"./shared-7f33a83a.js";import"./shared-dcdb6ea1.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-4f037e43.js";import"./shared-e3ab56d1.js";customElements.define("foxy-nucleon",e);
@@ -1 +1 @@
1
- import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-bc814810.js";import"./shared-0821cfdc.js";import{_ as e}from"./shared-a8ced8bf.js";import{h as t,L as s}from"./shared-7f33a83a.js";import{C as i}from"./shared-43bcce74.js";import{N as n}from"./shared-181f51bd.js";import{R as a,T as r,a as o}from"./shared-2cc638ad.js";import{c}from"./shared-4e709717.js";import{Q as l}from"./shared-76b3d76a.js";import{I as d}from"./shared-4f037e43.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let m,_=e=>e;const h=a(i(r(o(d(s),"pagination"))));class f extends h{constructor(){super(...arguments),this.__pageElement=null,this.__rerender=()=>this.requestUpdate(),this.__first=""}static get properties(){return e(e({},super.properties),{},{first:{type:String},__pageElement:{attribute:!1}})}get first(){return this.__first}set first(e){this.__first=e,this.__pageElement&&(this.__pageElement.href=e)}connectedCallback(){super.connectedCallback(),this.__connectPageElement()}render(){var e;const s=null===(e=this.__pageElement)||void 0===e?void 0:e.data,{disabled:i,lang:n,ns:a}=this,r=Number(l(s,"returned_items")),o=Number.isNaN(r)?0:r,d=Number(l(s,"total_items")),h=Number.isNaN(d)?0:d,f=Number(l(s,"offset")),p=Number.isNaN(f)?0:f,g=!i&&p>0,u=!i&&p+o<h,b="sr-only sm-not-sr-only";return t(m||(m=_` <slot @slotchange="${0}"></slot> <div class="grid gap-s items-center -mx-xs" style="grid-template-columns:1fr auto 1fr"> <div class="flex items-center space-x-s"> <vaadin-button data-testid="first" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-s" icon="icons:first-page"></iron-icon> <foxy-i18n class="${0}" lang="${0}" key="first" ns="${0}"></foxy-i18n> </vaadin-button> <vaadin-button data-testid="prev" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-s" icon="icons:chevron-left"></iron-icon> <foxy-i18n class="${0}" lang="${0}" key="previous" ns="${0}"></foxy-i18n> </vaadin-button> </div> <foxy-i18n options="${0}" class="${0}" lang="${0}" key="pagination" ns="${0}"> </foxy-i18n> <div class="flex items-center justify-end space-x-s"> <vaadin-button data-testid="next" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="next" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:chevron-right"></iron-icon> </vaadin-button> <vaadin-button data-testid="last" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="last" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:last-page"></iron-icon> </vaadin-button> </div> </div> `),this.__connectPageElement,!g,(()=>this.__goTo("first")),b,n,a,!g,(()=>this.__goTo("prev")),b,n,a,JSON.stringify({total:h,from:p?p+1:0,to:p+o}),c({"flex-1 text-xs text-tertiary text-center leading-xs truncate":!0,"opacity-0":!s}),n,a,!u,(()=>this.__goTo("next")),b,n,a,!u,(()=>this.__goTo("last")),b,n,a)}disconnectedCallback(){super.disconnectedCallback(),this.__disconnectPageElement()}__goTo(e){var t;this.__pageElement.href=String(l(null===(t=this.__pageElement)||void 0===t?void 0:t.data,`_links.${e}.href`))}__disconnectPageElement(){var e;null===(e=this.__pageElement)||void 0===e||e.removeEventListener("update",this.__rerender),this.__pageElement=null}__connectPageElement(){var e;this.__disconnectPageElement();const t=this.renderRoot.querySelector("slot"),s=(null!==(e=null==t?void 0:t.assignedElements())&&void 0!==e?e:[]).find((e=>e instanceof n));s&&(this.__pageElement=s,this.__pageElement.addEventListener("update",this.__rerender),this.__pageElement.href=this.first)}}customElements.define("foxy-pagination",f);export{f as Pagination};
1
+ import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-bc814810.js";import"./shared-7097364f.js";import{_ as e}from"./shared-a8ced8bf.js";import{h as t,L as s}from"./shared-7f33a83a.js";import{C as i}from"./shared-67546e10.js";import{N as n}from"./shared-dc91f7ae.js";import{R as a,T as r,a as o}from"./shared-2cc638ad.js";import{c}from"./shared-4e709717.js";import{Q as l}from"./shared-dcdb6ea1.js";import{I as d}from"./shared-4f037e43.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-d3bf9ac0.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";let m,_=e=>e;const h=a(i(r(o(d(s),"pagination"))));class p extends h{constructor(){super(...arguments),this.__pageElement=null,this.__rerender=()=>this.requestUpdate(),this.__first=""}static get properties(){return e(e({},super.properties),{},{first:{type:String},__pageElement:{attribute:!1}})}get first(){return this.__first}set first(e){this.__first=e,this.__pageElement&&(this.__pageElement.href=e)}connectedCallback(){super.connectedCallback(),this.__connectPageElement()}render(){var e;const s=null===(e=this.__pageElement)||void 0===e?void 0:e.data,{disabled:i,lang:n,ns:a}=this,r=Number(l(s,"returned_items")),o=Number.isNaN(r)?0:r,d=Number(l(s,"total_items")),h=Number.isNaN(d)?0:d,p=Number(l(s,"offset")),f=Number.isNaN(p)?0:p,g=!i&&f>0,u=!i&&f+o<h,b="sr-only sm-not-sr-only";return t(m||(m=_` <slot @slotchange="${0}"></slot> <div class="grid gap-s items-center -mx-xs" style="grid-template-columns:1fr auto 1fr"> <div class="flex items-center space-x-s"> <vaadin-button data-testid="first" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-s" icon="icons:first-page"></iron-icon> <foxy-i18n class="${0}" lang="${0}" key="first" ns="${0}"></foxy-i18n> </vaadin-button> <vaadin-button data-testid="prev" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-s" icon="icons:chevron-left"></iron-icon> <foxy-i18n class="${0}" lang="${0}" key="previous" ns="${0}"></foxy-i18n> </vaadin-button> </div> <foxy-i18n options="${0}" class="${0}" lang="${0}" key="pagination" ns="${0}"> </foxy-i18n> <div class="flex items-center justify-end space-x-s"> <vaadin-button data-testid="next" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="next" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:chevron-right"></iron-icon> </vaadin-button> <vaadin-button data-testid="last" theme="contrast tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="last" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:last-page"></iron-icon> </vaadin-button> </div> </div> `),this.__connectPageElement,!g,(()=>this.__goTo("first")),b,n,a,!g,(()=>this.__goTo("prev")),b,n,a,JSON.stringify({total:h,from:f?f+1:0,to:f+o}),c({"flex-1 text-xs text-tertiary text-center leading-xs truncate":!0,"opacity-0":!s}),n,a,!u,(()=>this.__goTo("next")),b,n,a,!u,(()=>this.__goTo("last")),b,n,a)}disconnectedCallback(){super.disconnectedCallback(),this.__disconnectPageElement()}__goTo(e){var t;this.__pageElement.href=String(l(null===(t=this.__pageElement)||void 0===t?void 0:t.data,`_links.${e}.href`))}__disconnectPageElement(){var e;null===(e=this.__pageElement)||void 0===e||e.removeEventListener("update",this.__rerender),this.__pageElement=null}__connectPageElement(){var e;this.__disconnectPageElement();const t=this.renderRoot.querySelector("slot"),s=(null!==(e=null==t?void 0:t.assignedElements())&&void 0!==e?e:[]).find((e=>e instanceof n));s&&(this.__pageElement=s,this.__pageElement.addEventListener("update",this.__rerender),this.__pageElement.href=this.first)}}customElements.define("foxy-pagination",p);export{p as Pagination};
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./shared-0821cfdc.js";import"./foxy-spinner.js";import{l as e,u as t}from"./shared-99065f2a.js";import{h as s}from"./shared-7f33a83a.js";import{C as r}from"./shared-43bcce74.js";import{N as i}from"./shared-181f51bd.js";import{T as a,a as n}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import"./shared-a8ced8bf.js";import"./shared-76b3d76a.js";import"./shared-4f037e43.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-d3bf9ac0.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let d,l,c,p,u,f,h,m=e=>e;const v=a(r(n(i,"payment-card")));class _ extends v{constructor(){super(...arguments),this.templates={},this.__currencyDisplay="",this.__currency=""}render(){var e,t;const r=this.hiddenSelector,i=r.matches("card-info",!0),a=r.matches("fraud-risk",!0);return s(d||(d=m` <div aria-busy="${0}" aria-live="polite" class="relative text-body text-m font-lumo leading-m focus-outline-none"> <div class="${0}"> ${0} ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" class="m-auto" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),!this.data&&this.in("busy"),o({"relative transition duration-250 ease-in-out":!0,"opacity-0 pointer-events-none":!this.data}),r.matches("title",!0)?"":this.__renderTitle(),r.matches("subtitle",!0)?"":this.__renderSubtitle(),i&&a?"":s(l||(l=m` <div class="my-s flex space-x-s overflow-auto"> ${0} ${0} </div> `),i?"":this.__renderCardInfo(),a?"":this.__renderFraudRisk()),r.matches("processor-response",!0)?"":this.__renderProcessorResponse(),o({"transition duration-250 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),[t,s]=await Promise.all([super._fetch(e._links["fx:transaction"].href),super._fetch(e._links["fx:store"].href)]);return this.__currency=t.currency_code,this.__currencyDisplay=s.use_international_currency_symbol?"code":"symbol",e}__renderTitle(){const e=this.data?`gateways.${this.data.gateway_type}`:"",t=`${this.ns} gateways`;return s(c||(c=m` <div class="text-m flex text-secondary" data-testid="title"> ${0} <foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>&ZeroWidthSpace; ${0} </div> `),this.renderTemplateOrSlot("title:before"),this.lang,e,t,this.renderTemplateOrSlot("title:after"))}__renderSubtitle(){var e,t,r,i;const a=`${null!==(t=null===(e=this.data)||void 0===e?void 0:e.amount)&&void 0!==t?t:""} ${this.__currency}`,n=JSON.stringify({amount:a,currencyDisplay:this.__currencyDisplay}),o=null!==(i=null===(r=this.data)||void 0===r?void 0:r.date_created)&&void 0!==i?i:"",d=JSON.stringify({value:o}),l=this.lang,c=this.ns;return s(p||(p=m` <div class="flex font-semibold text-m" data-testid="subtitle"> ${0} <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"></foxy-i18n> <span>&nbsp;&bull;&nbsp;</span> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"></foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("subtitle:before"),n,l,c,d,l,c,this.renderTemplateOrSlot("subtitle:after"))}__renderCardInfo(){var r,i,a,n;const o=this.data,d=(null!==(r=null==o?void 0:o.cc_type)&&void 0!==r?r:"unknown").toLowerCase(),l=null===(i=null==o?void 0:o.cc_exp_year)||void 0===i?void 0:i.substring(2),c=null==o?void 0:o.cc_exp_month,p=null===(a=null==o?void 0:o.cc_number_masked)||void 0===a?void 0:a.replace(/x/gi,"");if(c&&l&&p)return s(u||(u=m` <div class="flex" data-testid="card-info"> ${0} <div class="truncate flex items-center h-s rounded overflow-hidden bg-contrast-5"> <div class="h-s">${0}</div> <div class="text-m font-semibold px-s">•••• ${0} ${0}/${0}</div> </div> ${0} </div> `),this.renderTemplateOrSlot("card-info:before"),null!==(n=e[d])&&void 0!==n?n:t,p,c,l,this.renderTemplateOrSlot("card-info:after"))}__renderFraudRisk(){var e,t;const r=null!==(t=null===(e=this.data)||void 0===e?void 0:e.fraud_protection_score)&&void 0!==t?t:0,i=r>0?"text-error":"text-success",a=r>0?"bg-error-10":"bg-success-10";return s(f||(f=m` <div class="flex" data-testid="fraud-risk"> ${0} <foxy-i18n options="${0}" class="truncate flex font-semibold h-s items-center px-s rounded text-m ${0} ${0}" lang="${0}" key="fraud_risk" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("fraud-risk:before"),JSON.stringify({score:r}),i,a,this.lang,this.ns,this.renderTemplateOrSlot("fraud-risk:after"))}__renderProcessorResponse(){var e;return s(h||(h=m` <div class="text-m text-tertiary" data-testid="processor-response"> ${0} ${0}&ZeroWidthSpace; ${0} </div> `),this.renderTemplateOrSlot("processor-response:before"),null===(e=this.data)||void 0===e?void 0:e.processor_response,this.renderTemplateOrSlot("processor-response:after"))}}customElements.define("foxy-payment-card",_);export{_ as PaymentCard};
1
+ import"./shared-0479553e.js";import"./shared-7097364f.js";import"./foxy-spinner.js";import{l as e,u as t}from"./shared-99065f2a.js";import{h as s}from"./shared-7f33a83a.js";import{C as r}from"./shared-67546e10.js";import{N as i}from"./shared-dc91f7ae.js";import{T as a,a as n}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import"./shared-a8ced8bf.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-d3bf9ac0.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";let d,l,c,p,u,h,f,m=e=>e;const v=a(r(n(i,"payment-card")));class _ extends v{constructor(){super(...arguments),this.templates={},this.__currencyDisplay="",this.__currency=""}render(){var e,t;const r=this.hiddenSelector,i=r.matches("card-info",!0),a=r.matches("fraud-risk",!0);return s(d||(d=m` <div aria-busy="${0}" aria-live="polite" class="relative text-body text-m font-lumo leading-m focus-outline-none"> <div class="${0}"> ${0} ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" class="m-auto" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),!this.data&&this.in("busy"),o({"relative transition duration-250 ease-in-out":!0,"opacity-0 pointer-events-none":!this.data}),r.matches("title",!0)?"":this.__renderTitle(),r.matches("subtitle",!0)?"":this.__renderSubtitle(),i&&a?"":s(l||(l=m` <div class="my-s flex space-x-s overflow-auto"> ${0} ${0} </div> `),i?"":this.__renderCardInfo(),a?"":this.__renderFraudRisk()),r.matches("processor-response",!0)?"":this.__renderProcessorResponse(),o({"transition duration-250 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),[t,s]=await Promise.all([super._fetch(e._links["fx:transaction"].href),super._fetch(e._links["fx:store"].href)]);return this.__currency=t.currency_code,this.__currencyDisplay=s.use_international_currency_symbol?"code":"symbol",e}__renderTitle(){const e=this.data?`gateways.${this.data.gateway_type}`:"",t=`${this.ns} gateways`;return s(c||(c=m` <div class="text-m flex text-secondary" data-testid="title"> ${0} <foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>&ZeroWidthSpace; ${0} </div> `),this.renderTemplateOrSlot("title:before"),this.lang,e,t,this.renderTemplateOrSlot("title:after"))}__renderSubtitle(){var e,t,r,i;const a=`${null!==(t=null===(e=this.data)||void 0===e?void 0:e.amount)&&void 0!==t?t:""} ${this.__currency}`,n=JSON.stringify({amount:a,currencyDisplay:this.__currencyDisplay}),o=null!==(i=null===(r=this.data)||void 0===r?void 0:r.date_created)&&void 0!==i?i:"",d=JSON.stringify({value:o}),l=this.lang,c=this.ns;return s(p||(p=m` <div class="flex font-semibold text-m" data-testid="subtitle"> ${0} <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"></foxy-i18n> <span>&nbsp;&bull;&nbsp;</span> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"></foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("subtitle:before"),n,l,c,d,l,c,this.renderTemplateOrSlot("subtitle:after"))}__renderCardInfo(){var r,i,a,n;const o=this.data,d=(null!==(r=null==o?void 0:o.cc_type)&&void 0!==r?r:"unknown").toLowerCase(),l=null===(i=null==o?void 0:o.cc_exp_year)||void 0===i?void 0:i.substring(2),c=null==o?void 0:o.cc_exp_month,p=null===(a=null==o?void 0:o.cc_number_masked)||void 0===a?void 0:a.replace(/x/gi,"");if(c&&l&&p)return s(u||(u=m` <div class="flex" data-testid="card-info"> ${0} <div class="truncate flex items-center h-s rounded overflow-hidden bg-contrast-5"> <div class="h-s">${0}</div> <div class="text-m font-semibold px-s">•••• ${0} ${0}/${0}</div> </div> ${0} </div> `),this.renderTemplateOrSlot("card-info:before"),null!==(n=e[d])&&void 0!==n?n:t,p,c,l,this.renderTemplateOrSlot("card-info:after"))}__renderFraudRisk(){var e,t;const r=null!==(t=null===(e=this.data)||void 0===e?void 0:e.fraud_protection_score)&&void 0!==t?t:0,i=r>0?"text-error":"text-success",a=r>0?"bg-error-10":"bg-success-10";return s(h||(h=m` <div class="flex" data-testid="fraud-risk"> ${0} <foxy-i18n options="${0}" class="truncate flex font-semibold h-s items-center px-s rounded text-m ${0} ${0}" lang="${0}" key="fraud_risk" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("fraud-risk:before"),JSON.stringify({score:r}),i,a,this.lang,this.ns,this.renderTemplateOrSlot("fraud-risk:after"))}__renderProcessorResponse(){var e;return s(f||(f=m` <div class="text-m text-tertiary" data-testid="processor-response"> ${0} ${0}&ZeroWidthSpace; ${0} </div> `),this.renderTemplateOrSlot("processor-response:before"),null===(e=this.data)||void 0===e?void 0:e.processor_response,this.renderTemplateOrSlot("processor-response:after"))}}customElements.define("foxy-payment-card",_);export{_ as PaymentCard};
@@ -1 +1 @@
1
- import"./shared-62c088b7.js";import"./shared-2092d86f.js";import"./shared-bc814810.js";import"./shared-8dd0af4d.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{l as e,u as t}from"./shared-99065f2a.js";import{u as s,h as a,c as i}from"./shared-7f33a83a.js";import{B as r}from"./shared-76b3d76a.js";import{C as n}from"./shared-43bcce74.js";import"./foxy-nucleon-element.js";import{T as d,a as o}from"./shared-2cc638ad.js";import{c as l}from"./shared-4e709717.js";import{N as c}from"./shared-181f51bd.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-a8ced8bf.js";import"./shared-62a54a6c.js";import"./shared-a85afa33.js";import"./shared-4f037e43.js";import"./shared-d3bf9ac0.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";const m=s("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),h=s(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${m} }`)).join(" "));let p,f,u,b,v,y,_,g=e=>e;const j=d(n(o(c,"payment-method-card")));class $ extends j{constructor(){super(...arguments),this.templates={},this.__renderActionsDelete=()=>a(p||(p=g` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>a(f||(f=g` <div class="flex" data-testid="actions"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),this.hiddenSelector.matches("actions:delete",!0)?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}static get styles(){return[super.styles,h,i(u||(u=g`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var s,i,n,d,o,c;const{data:m,lang:h,ns:p}=this;if(this.in({idle:"template"})||!(null==m?void 0:m.save_cc)||!this.in("idle")){const e=this.in("fail")?"error":this.in("busy")?"busy":"empty";return a(b||(b=g` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),e,this.lang,p,null!==(i=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==i?i:"")}const f=null!==(d=null===(n=m.cc_type)||void 0===n?void 0:n.toLowerCase())&&void 0!==d?d:"unknown",u=null!==(o=e[f])&&void 0!==o?o:t,j=null===(c=m.cc_number_masked)||void 0===c?void 0:c.substring(m.cc_number_masked.length-4);return a(v||(v=g` <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> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> ${0} <div class="ml-auto rounded h-m">${0}</div> </div> <div class="font-tnum leading-none flex justify-between"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),h,p,this.__handleConfirmHide,this.in("busy"),f,l({"flex items-start":!0,"justify-between":this.readonlyControls===r.False,"justify-end":this.readonlyControls===r.True}),this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),u,m.cc_exp_month&&m.cc_exp_year?a(y||(y=g` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),m.cc_exp_month,m.cc_exp_year):"",j?a(_||(_=g` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),j):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return c.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",$);export{$ as PaymentMethodCard};
1
+ import"./shared-62c088b7.js";import"./shared-2092d86f.js";import"./shared-bc814810.js";import"./shared-3d241b7f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{l as e,u as t}from"./shared-99065f2a.js";import{u as s,h as i,c as a}from"./shared-7f33a83a.js";import{B as r}from"./shared-dcdb6ea1.js";import{C as n}from"./shared-67546e10.js";import"./foxy-nucleon-element.js";import{T as d,a as o}from"./shared-2cc638ad.js";import{c as l}from"./shared-4e709717.js";import{N as c}from"./shared-dc91f7ae.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-a8ced8bf.js";import"./shared-9f905d9f.js";import"./shared-955db6b4.js";import"./shared-4f037e43.js";import"./shared-d3bf9ac0.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";const m=s("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),h=s(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${m} }`)).join(" "));let p,f,u,b,v,y,_,g=e=>e;const j=d(n(o(c,"payment-method-card")));class $ extends j{constructor(){super(...arguments),this.templates={},this.__renderActionsDelete=()=>i(p||(p=g` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>i(f||(f=g` <div class="flex" data-testid="actions"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),this.hiddenSelector.matches("actions:delete",!0)?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}static get styles(){return[super.styles,h,a(u||(u=g`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var s,a,n,d,o,c;const{data:m,lang:h,ns:p}=this;if(this.in({idle:"template"})||!(null==m?void 0:m.save_cc)||!this.in("idle")){const e=this.in("fail")?"error":this.in("busy")?"busy":"empty";return i(b||(b=g` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),e,this.lang,p,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}const f=null!==(d=null===(n=m.cc_type)||void 0===n?void 0:n.toLowerCase())&&void 0!==d?d:"unknown",u=null!==(o=e[f])&&void 0!==o?o:t,j=null===(c=m.cc_number_masked)||void 0===c?void 0:c.substring(m.cc_number_masked.length-4);return i(v||(v=g` <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> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> ${0} <div class="ml-auto rounded h-m">${0}</div> </div> <div class="font-tnum leading-none flex justify-between"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),h,p,this.__handleConfirmHide,this.in("busy"),f,l({"flex items-start":!0,"justify-between":this.readonlyControls===r.False,"justify-end":this.readonlyControls===r.True}),this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),u,m.cc_exp_month&&m.cc_exp_year?i(y||(y=g` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),m.cc_exp_month,m.cc_exp_year):"",j?i(_||(_=g` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),j):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return c.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",$);export{$ as PaymentMethodCard};
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{_ as r}from"./shared-a8ced8bf.js";import{a as e}from"./shared-2cc638ad.js";import{T as s}from"./shared-868065de.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-486d7bb5.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";let a,i,o,d=r=>r;const m=e(s,"payments-api-fraud-protection-card");class l extends m{constructor(){super(...arguments),this.getImageSrc=null}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='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return r(r({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var r,e;const s=super.renderBody({title:r=>t(a||(a=d`${0}`),r.helper.name),subtitle:r=>t(i||(i=d`${0}`),r.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,c=this.data;return t(o||(o=d` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <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">${0}</figcaption> </figure> `),null!==(e=c?null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,c.type):null)&&void 0!==e?e:m,this.t("image_alt"),(r=>r.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-fraud-protection-card",l);export{l as PaymentsApiFraudProtectionCard};
1
+ import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{_ as r}from"./shared-a8ced8bf.js";import{a as e}from"./shared-2cc638ad.js";import{T as s}from"./shared-1433fc29.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-62d636b5.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-4e709717.js";let a,i,o,d=r=>r;const m=e(s,"payments-api-fraud-protection-card");class l extends m{constructor(){super(...arguments),this.getImageSrc=null}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='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return r(r({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var r,e;const s=super.renderBody({title:r=>t(a||(a=d`${0}`),r.helper.name),subtitle:r=>t(i||(i=d`${0}`),r.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(o||(o=d` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <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">${0}</figcaption> </figure> `),null!==(e=p?null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,p.type):null)&&void 0!==e?e:m,this.t("image_alt"),(r=>r.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-fraud-protection-card",l);export{l as PaymentsApiFraudProtectionCard};
@@ -1 +1 @@
1
- import"./shared-bc814810.js";import"./shared-2add595d.js";import"./shared-988ec916.js";import"./shared-cba08e1c.js";import"./shared-80fc2b6a.js";import{I as e}from"./shared-6581241a.js";import"./foxy-nucleon-element.js";import"./shared-0821cfdc.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as o}from"./shared-2cc638ad.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as i}from"./shared-7f33a83a.js";import{Q as s}from"./shared-76b3d76a.js";import{s as l}from"./shared-bcc6e13b.js";import{h as n}from"./shared-09eb558f.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-88c4cfec.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-39c10b22.js";import"./shared-9bdacf65.js";import"./shared-0479553e.js";import"./shared-43bcce74.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-839dd3a8.js";let d,c,h,p,f,u,m,v,b,_,g=e=>e;const j=o(e,"payments-api-fraud-protection-form");class x extends j{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availableFraudProtectionsLoaderId="availableFraudProtections"}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='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)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(!n(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderFraudProtectionConfig(this.form.type):this.__renderFraudProtectionSelector()}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,o=e.exec(t).groups.presetId;return new URL(`/payment_presets/${o}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=x.defaultImageSrc;return i(d||(d=g` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_protection_title"> </foxy-i18n> <div data-testid="select-protection-list"> <ul class="-my-s grid grid-cols-1"> ${0} </ul> </div> `),a(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,r])=>{var o,a;return i(c||(c=g` <li class="-mx-s"> <button class="w-full block text-left hover-bg-contrast-5 p-s rounded" @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 font-semibold"> ${0}&ZeroWidthSpace; </figcaption> </figure> </button> </li> `),(()=>this.edit({type:e,helper:r})),null!==(a=null===(o=this.getImageSrc)||void 0===o?void 0:o.call(this,e))&&void 0!==a?a:t,(e=>{e.currentTarget.src=t}),r.name)})))}__renderFraudProtectionConfig(e){var t,r,o,a,s,l,n,d;const c=x.defaultImageSrc;return i(h||(h=g` <figure data-testid="logo" 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> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:c,(e=>e.currentTarget.src=c),null!==(a=null===(o=this.form.helper)||void 0===o?void 0:o.name)&&void 0!==a?a:this.form.type,(null===(s=this.form.helper)||void 0===s?void 0:s.uses_rejection_threshold)?i(p||(p=g` <foxy-internal-integer-control infer="score-threshold-reject"> </foxy-internal-integer-control> `)):"",null===(n=null===(l=this.form.helper)||void 0===l?void 0:l.json)||void 0===n?void 0:n.blocks.map((e=>this.__renderBlock(e))),(null===(d=this.data)||void 0===d?void 0:d.type)?"":i(f||(f=g` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderBlock(e){return i(u||(u=g`${0}`),e.fields.map((t=>{var r,o,a,n,d,c;const h=()=>{var r,o;let a;try{a=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=s(a,i))&&void 0!==o?o:a.default_value},p=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(l(a,i,r))})},f=t.options,u=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return i(m||(m=g` ${0} `),"checkbox"===t.type?i(v||(v=g` <foxy-internal-checkbox-group-control helper-text="${0}" label="" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",u,[{label:t.name,value:"checked"}],(()=>h()?["checked"]:[]),(e=>p(e.includes("checked")))):"select"===t.type?i(b||(b=g` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",null!==(d=null===(n=null===(a=t.options)||void 0===a?void 0:a.find((e=>e.value===t.default_value)))||void 0===n?void 0:n.name)&&void 0!==d?d:this.t("default_additional_field_placeholder"),t.name,u,f.map((({name:e,value:t})=>({label:e,value:t}))),h,p):i(_||(_=g` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(c=t.description)&&void 0!==c?c:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,u,h,p))})))}}customElements.define("foxy-payments-api-fraud-protection-form",x);export{x as PaymentsApiFraudProtectionForm};
1
+ import"./shared-bc814810.js";import"./shared-747b6d74.js";import"./shared-274c49b0.js";import"./shared-ee5a7812.js";import"./shared-8f8abcd6.js";import{I as e}from"./shared-8c11a711.js";import"./foxy-nucleon-element.js";import"./shared-7097364f.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as o}from"./shared-2cc638ad.js";import{i}from"./shared-d3bf9ac0.js";import{h as a}from"./shared-7f33a83a.js";import{Q as s}from"./shared-dcdb6ea1.js";import{s as l}from"./shared-efa137cd.js";import{h as n}from"./shared-11438c42.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-88c4cfec.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-a01b5597.js";import"./shared-e262920d.js";import"./shared-0479553e.js";import"./shared-67546e10.js";import"./shared-4f037e43.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-531bb690.js";let d,c,h,p,f,u,m,v,b,_,g=e=>e;const j=o(e,"payments-api-fraud-protection-form");class x extends j{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availableFraudProtectionsLoaderId="availableFraudProtections"}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='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(i=e.json)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of a)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(!n(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderFraudProtectionConfig(this.form.type):this.__renderFraudProtectionSelector()}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,o=e.exec(t).groups.presetId;return new URL(`/payment_presets/${o}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=x.defaultImageSrc;return a(d||(d=g` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_protection_title"> </foxy-i18n> <div data-testid="select-protection-list"> <ul class="-my-s grid grid-cols-1"> ${0} </ul> </div> `),i(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,r])=>{var o,i;return a(c||(c=g` <li class="-mx-s"> <button class="w-full block text-left hover-bg-contrast-5 p-s rounded" @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 font-semibold"> ${0}&ZeroWidthSpace; </figcaption> </figure> </button> </li> `),(()=>this.edit({type:e,helper:r})),null!==(i=null===(o=this.getImageSrc)||void 0===o?void 0:o.call(this,e))&&void 0!==i?i:t,(e=>{e.currentTarget.src=t}),r.name)})))}__renderFraudProtectionConfig(e){var t,r,o,i,s,l,n,d;const c=x.defaultImageSrc;return a(h||(h=g` <figure data-testid="logo" 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> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:c,(e=>e.currentTarget.src=c),null!==(i=null===(o=this.form.helper)||void 0===o?void 0:o.name)&&void 0!==i?i:this.form.type,(null===(s=this.form.helper)||void 0===s?void 0:s.uses_rejection_threshold)?a(p||(p=g` <foxy-internal-integer-control infer="score-threshold-reject"> </foxy-internal-integer-control> `)):"",null===(n=null===(l=this.form.helper)||void 0===l?void 0:l.json)||void 0===n?void 0:n.blocks.map((e=>this.__renderBlock(e))),(null===(d=this.data)||void 0===d?void 0:d.type)?"":a(f||(f=g` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderBlock(e){return a(u||(u=g`${0}`),e.fields.map((t=>{var r,o,i,n,d,c;const h=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const a=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=s(i,a))&&void 0!==o?o:i.default_value},p=r=>{var o;let i;try{i=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){i={}}const a=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(l(i,a,r))})},f=t.options,u=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return a(m||(m=g` ${0} `),"checkbox"===t.type?a(v||(v=g` <foxy-internal-checkbox-group-control helper-text="${0}" label="" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",u,[{label:t.name,value:"checked"}],(()=>h()?["checked"]:[]),(e=>p(e.includes("checked")))):"select"===t.type?a(b||(b=g` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",null!==(d=null===(n=null===(i=t.options)||void 0===i?void 0:i.find((e=>e.value===t.default_value)))||void 0===n?void 0:n.name)&&void 0!==d?d:this.t("default_additional_field_placeholder"),t.name,u,f.map((({name:e,value:t})=>({label:e,value:t}))),h,p):a(_||(_=g` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(c=t.description)&&void 0!==c?c:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,u,h,p))})))}}customElements.define("foxy-payments-api-fraud-protection-form",x);export{x as PaymentsApiFraudProtectionForm};
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{_ as e}from"./shared-a8ced8bf.js";import{a as r}from"./shared-2cc638ad.js";import{T as s}from"./shared-868065de.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-486d7bb5.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-4e709717.js";let a,i,d,o=e=>e;const m=r(s,"payments-api-payment-method-card");class l extends m{constructor(){super(...arguments),this.getImageSrc=null}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 e(e({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var e,r;const s=super.renderBody({title:e=>t(a||(a=o`${0}`),e.helper.name),subtitle:e=>t(i||(i=o`${0}`),e.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(d||(d=o` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <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">${0}</figcaption> </figure> `),null!==(r=p?null===(e=this.getImageSrc)||void 0===e?void 0:e.call(this,p.type):null)&&void 0!==r?r:m,this.t("image_alt"),(e=>e.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-payment-method-card",l);export{l as PaymentsApiPaymentMethodCard};
1
+ import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{_ as e}from"./shared-a8ced8bf.js";import{a as r}from"./shared-2cc638ad.js";import{T as s}from"./shared-1433fc29.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-62d636b5.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-4e709717.js";let a,i,d,o=e=>e;const m=r(s,"payments-api-payment-method-card");class l extends m{constructor(){super(...arguments),this.getImageSrc=null}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 e(e({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var e,r;const s=super.renderBody({title:e=>t(a||(a=o`${0}`),e.helper.name),subtitle:e=>t(i||(i=o`${0}`),e.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(d||(d=o` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <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">${0}</figcaption> </figure> `),null!==(r=p?null===(e=this.getImageSrc)||void 0===e?void 0:e.call(this,p.type):null)&&void 0!==r?r:m,this.t("image_alt"),(e=>e.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-payment-method-card",l);export{l as PaymentsApiPaymentMethodCard};
@@ -1 +1 @@
1
- import"./shared-bc814810.js";import"./shared-639c666f.js";import"./shared-c95c17e6.js";import"./shared-2add595d.js";import"./shared-a37abe4c.js";import"./shared-cba08e1c.js";import"./shared-80fc2b6a.js";import{I as e}from"./shared-6581241a.js";import"./foxy-nucleon-element.js";import"./shared-0821cfdc.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as o}from"./shared-2cc638ad.js";import{i}from"./shared-d3bf9ac0.js";import{c as a}from"./shared-4e709717.js";import{h as l}from"./shared-7f33a83a.js";import{h as s}from"./shared-09eb558f.js";import{Q as n}from"./shared-76b3d76a.js";import{s as d}from"./shared-bcc6e13b.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-5ea18e60.js";import"./shared-404aa9cc.js";import"./shared-62c088b7.js";import"./shared-08e27fe9.js";import"./shared-6cb1015f.js";import"./shared-08156595.js";import"./shared-39c10b22.js";import"./shared-9bdacf65.js";import"./shared-0479553e.js";import"./shared-43bcce74.js";import"./shared-4f037e43.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-88c4cfec.js";import"./shared-8dd0af4d.js";import"./shared-62a54a6c.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-839dd3a8.js";let c,h,p,f,u,_,m,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,o=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${o}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{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"},this.__threeDSecureToggleSetValue=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})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],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,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let l;try{l=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){l={}}for(const e of a)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(!s(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const o=t.charAt(0).toUpperCase(),i=!/\w/.test(o)?"#":o,a=e.find((e=>e.name===i));return a?a.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,o=e.exec(t).groups.presetId;return new URL(`/payment_presets/${o}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}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:[]}__renderPaymentMethodSelector(){return l(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),i(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(h||(h=w` <p class="w-m text-center font-semibold text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>l(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,o,i,s,n;const d=P.defaultImageSrc;return l(f||(f=w` <figure data-testid="logo" 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 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" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(i=null===(o=this.form.helper)||void 0===o?void 0:o.name)&&void 0!==i?i:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),a({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,o,i;const s=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return l(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),a({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?l(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,s):"",(null===(o=this.form.helper)||void 0===o?void 0:o.third_party_key_description)?l(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,s):"",(null===(i=this.form.helper)||void 0===i?void 0:i.key_description)?l(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,s):"",n.map((e=>this.__renderBlock(e))))})),(null===(s=this.form.helper)||void 0===s?void 0:s.supports_3d_secure)?l(y||(y=w` <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} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":l(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,o;const i=P.defaultImageSrc;return l(x||(x=w` <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="${0}"> <div class="font-semibold">${0}&ZeroWidthSpace;</div> ${0} </figcaption> </figure> </button> `),a({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:i,(e=>e.currentTarget.src=i),a({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?l($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return l(j||(j=w`${0}`),e.fields.map((t=>{var r,o,i;const a=[e.parent_id,e.id,t.id].filter((e=>!!e)),s=["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}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,a,e))})}catch(e){return""}},p=t.options;return l(k||(k=w` ${0} `),"checkbox"===t.type?l(S||(S=w` <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:"",s,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?l(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,s,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):l(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,s,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
1
+ import"./shared-bc814810.js";import"./shared-639c666f.js";import"./shared-c8f5c306.js";import"./shared-747b6d74.js";import"./shared-242b3ee9.js";import"./shared-ee5a7812.js";import"./shared-8f8abcd6.js";import{I as e}from"./shared-8c11a711.js";import"./foxy-nucleon-element.js";import"./shared-7097364f.js";import{_ as t,l as r}from"./shared-a8ced8bf.js";import{a as o}from"./shared-2cc638ad.js";import{i}from"./shared-d3bf9ac0.js";import{c as a}from"./shared-4e709717.js";import{h as l}from"./shared-7f33a83a.js";import{h as s}from"./shared-11438c42.js";import{Q as n}from"./shared-dcdb6ea1.js";import{s as d}from"./shared-efa137cd.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-5ea18e60.js";import"./shared-404aa9cc.js";import"./shared-62c088b7.js";import"./shared-08e27fe9.js";import"./shared-6cb1015f.js";import"./shared-08156595.js";import"./shared-a01b5597.js";import"./shared-e262920d.js";import"./shared-0479553e.js";import"./shared-67546e10.js";import"./shared-4f037e43.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-88c4cfec.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-531bb690.js";let c,h,p,f,u,_,m,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,o=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${o}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{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"},this.__threeDSecureToggleSetValue=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})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],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,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let l;try{l=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){l={}}for(const e of a)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(!s(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const o=t.charAt(0).toUpperCase(),i=!/\w/.test(o)?"#":o,a=e.find((e=>e.name===i));return a?a.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,o=e.exec(t).groups.presetId;return new URL(`/payment_presets/${o}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}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:[]}__renderPaymentMethodSelector(){return l(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-bold border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),i(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(h||(h=w` <p class="w-m text-center font-semibold text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>l(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,o,i,s,n;const d=P.defaultImageSrc;return l(f||(f=w` <figure data-testid="logo" 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 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" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(i=null===(o=this.form.helper)||void 0===o?void 0:o.name)&&void 0!==i?i:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),a({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,o,i;const s=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return l(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),a({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?l(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,s):"",(null===(o=this.form.helper)||void 0===o?void 0:o.third_party_key_description)?l(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,s):"",(null===(i=this.form.helper)||void 0===i?void 0:i.key_description)?l(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,s):"",n.map((e=>this.__renderBlock(e))))})),(null===(s=this.form.helper)||void 0===s?void 0:s.supports_3d_secure)?l(y||(y=w` <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} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":l(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,o;const i=P.defaultImageSrc;return l(x||(x=w` <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="${0}"> <div class="font-semibold">${0}&ZeroWidthSpace;</div> ${0} </figcaption> </figure> </button> `),a({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:i,(e=>e.currentTarget.src=i),a({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?l($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return l(j||(j=w`${0}`),e.fields.map((t=>{var r,o,i;const a=[e.parent_id,e.id,t.id].filter((e=>!!e)),s=["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}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,a,e))})}catch(e){return""}},p=t.options;return l(k||(k=w` ${0} `),"checkbox"===t.type?l(S||(S=w` <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:"",s,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?l(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,s,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):l(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,s,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-0821cfdc.js";import{a as s}from"./shared-2cc638ad.js";import{T as e}from"./shared-868065de.js";import{c as r}from"./shared-4e709717.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-76b3d76a.js";import"./shared-43bcce74.js";import"./shared-d3bf9ac0.js";import"./shared-486d7bb5.js";import"./shared-181f51bd.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";let t,d,i=s=>s;const o=s(e,"payments-api-payment-preset-card");class p extends o{renderBody(){return super.renderBody({title:s=>a(t||(t=i`${0}`),s.description),subtitle:({is_live:s})=>a(d||(d=i` <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> `),r({"text-success":s}),s?"live":"test")})}}customElements.define("foxy-payments-api-payment-preset-card",p);export{p as PaymentsApiPaymentPresetCard};
1
+ import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{a as s}from"./shared-2cc638ad.js";import{T as e}from"./shared-1433fc29.js";import{c as r}from"./shared-4e709717.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-62d636b5.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";let a,d,i=s=>s;const o=s(e,"payments-api-payment-preset-card");class p extends o{renderBody(){return super.renderBody({title:s=>t(a||(a=i`${0}`),s.description),subtitle:({is_live:s})=>t(d||(d=i` <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> `),r({"text-success":s}),s?"live":"test")})}}customElements.define("foxy-payments-api-payment-preset-card",p);export{p as PaymentsApiPaymentPresetCard};
@@ -1 +1 @@
1
- import"./shared-2add595d.js";import"./shared-1000b848.js";import"./shared-80fc2b6a.js";import{I as e}from"./shared-6581241a.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-2cc638ad.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-88c4cfec.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-39c10b22.js";import"./shared-9bdacf65.js";import"./shared-0479553e.js";import"./shared-0821cfdc.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-bc814810.js";import"./shared-2092d86f.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-8dd0af4d.js";import"./shared-62a54a6c.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-868065de.js";import"./shared-486d7bb5.js";import"./shared-988ec916.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-cba08e1c.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./foxy-nucleon-element.js";import"./shared-bcc6e13b.js";import"./shared-839dd3a8.js";import"./shared-09eb558f.js";import"./shared-639c666f.js";import"./shared-404aa9cc.js";import"./shared-c95c17e6.js";import"./shared-a37abe4c.js";let s,o,i,p,n,d,m=e=>e;const c=r(e,"payments-api-payment-preset-form");class h extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.templates={},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` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),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" 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" 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())}}h.__isPOEnabledOptions=[{label:"option_true",value:"true"}],h.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",h);export{h as PaymentsApiPaymentPresetForm};
1
+ import"./shared-747b6d74.js";import"./shared-a29b600a.js";import"./shared-8f8abcd6.js";import{I as e}from"./shared-8c11a711.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-2cc638ad.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-88c4cfec.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-62c088b7.js";import"./shared-a01b5597.js";import"./shared-e262920d.js";import"./shared-0479553e.js";import"./shared-7097364f.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-bc814810.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-2092d86f.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-1433fc29.js";import"./shared-62d636b5.js";import"./shared-274c49b0.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-ee5a7812.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./foxy-nucleon-element.js";import"./shared-efa137cd.js";import"./shared-531bb690.js";import"./shared-11438c42.js";import"./shared-639c666f.js";import"./shared-404aa9cc.js";import"./shared-c8f5c306.js";import"./shared-242b3ee9.js";let s,o,i,p,n,d,m=e=>e;const c=r(e,"payments-api-payment-preset-form");class h extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.templates={},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` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),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" 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" 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())}}h.__isPOEnabledOptions=[{label:"option_true",value:"true"}],h.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",h);export{h as PaymentsApiPaymentPresetForm};
@@ -1 +1 @@
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
+ import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-dcdb6ea1.js";import{l as a,_ as s,k as n}from"./shared-a8ced8bf.js";import{A as r}from"./shared-955db6b4.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await o(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),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(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 d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=n(r,m),p=l({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 s(s({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,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 h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(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 p({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(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(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=p({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 y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),_=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=n(o,f),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}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return s(s({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function u(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=_.searchParams.get("limit"))&&void 0!==s?s:"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(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(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),u=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 c(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:u,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});i=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 o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(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=c({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});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const _=["_links"];function w(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=n(t,_),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 s({_links:{self:{href:l.toString()},"fx:store":r["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 g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=w({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=n(t,g),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,s(s({},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":r["fx:payment_method_sets"].map((e=>w({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(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 S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/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 o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(w({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,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=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,_=u.startsWith("H"),w=d(f),g=u.substring(1,_?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(_){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(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,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.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,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b 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 r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:s,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p}=this;if(null===s)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===l)return;if(null===m)return;if(null===p)return;const f=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),u],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];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:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:f(s),getHostedPaymentGatewayUrl:f(o),getPaymentMethodSetUrl:f(l),getFraudProtectionUrl:f(m),getPaymentGatewayUrl:f(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)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
@@ -1 +1 @@
1
- import"./shared-2092d86f.js";import"./shared-62c088b7.js";export{Q as QueryBuilder}from"./shared-744cf66b.js";import"./shared-0ce006b9.js";import"./shared-2cc638ad.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-2092d86f.js";import"./shared-62c088b7.js";export{Q as QueryBuilder}from"./shared-d807ae5c.js";import"./shared-0ce006b9.js";import"./shared-2cc638ad.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";