@foxy.io/elements 1.29.0-beta.6 → 1.30.0-beta.1

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 (137) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-form.js +1 -1
  3. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  4. package/dist/cdn/foxy-api-browser.js +1 -1
  5. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  6. package/dist/cdn/foxy-attribute-form.js +1 -1
  7. package/dist/cdn/foxy-cancellation-form.js +1 -1
  8. package/dist/cdn/foxy-cart-form.js +2 -2
  9. package/dist/cdn/foxy-client-form.js +1 -1
  10. package/dist/cdn/foxy-collection-pages.js +1 -1
  11. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  12. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  13. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  14. package/dist/cdn/foxy-coupon-form.js +1 -1
  15. package/dist/cdn/foxy-custom-field-form.js +1 -1
  16. package/dist/cdn/foxy-customer-form.js +1 -1
  17. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  18. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  19. package/dist/cdn/foxy-customer-portal.js +1 -1
  20. package/dist/cdn/foxy-customer.js +1 -1
  21. package/dist/cdn/foxy-donation.js +1 -1
  22. package/dist/cdn/foxy-downloadable-form.js +1 -1
  23. package/dist/cdn/foxy-email-template-form.js +1 -1
  24. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  25. package/dist/cdn/foxy-form-dialog.js +1 -1
  26. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  27. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  28. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  29. package/dist/cdn/foxy-gift-card-form.js +1 -1
  30. package/dist/cdn/foxy-i18n-editor.js +1 -1
  31. package/dist/cdn/foxy-integration-form.js +1 -1
  32. package/dist/cdn/foxy-item-category-form.js +1 -1
  33. package/dist/cdn/foxy-item-form.js +3 -3
  34. package/dist/cdn/foxy-item-option-form.js +1 -1
  35. package/dist/cdn/foxy-items-form.js +1 -1
  36. package/dist/cdn/foxy-native-integration-form.js +1 -1
  37. package/dist/cdn/foxy-pagination.js +1 -1
  38. package/dist/cdn/foxy-passkey-form.js +1 -1
  39. package/dist/cdn/foxy-payment-method-card.js +1 -1
  40. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  41. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  42. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  43. package/dist/cdn/foxy-report-form.js +1 -1
  44. package/dist/cdn/foxy-sign-in-form.js +1 -1
  45. package/dist/cdn/foxy-store-form.js +1 -1
  46. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  47. package/dist/cdn/foxy-subscription-card.js +1 -1
  48. package/dist/cdn/foxy-subscription-form.js +1 -1
  49. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  50. package/dist/cdn/foxy-tax-form.js +1 -1
  51. package/dist/cdn/foxy-template-config-form.js +1 -1
  52. package/dist/cdn/foxy-template-form.js +1 -1
  53. package/dist/cdn/foxy-template-set-form.js +1 -1
  54. package/dist/cdn/foxy-transaction-card.js +1 -1
  55. package/dist/cdn/foxy-transaction.js +1 -1
  56. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  57. package/dist/cdn/foxy-user-form.js +1 -1
  58. package/dist/cdn/foxy-users-table.js +1 -1
  59. package/dist/cdn/foxy-webhook-card.js +1 -1
  60. package/dist/cdn/foxy-webhook-form.js +1 -1
  61. package/dist/cdn/{shared-cfb33387.js → shared-01f18104.js} +1 -1
  62. package/dist/cdn/{shared-3483c729.js → shared-09fc6fa0.js} +1 -1
  63. package/dist/cdn/{shared-8bb3eb45.js → shared-1729e19a.js} +1 -1
  64. package/dist/cdn/{shared-fe4a2e3d.js → shared-19f46691.js} +1 -1
  65. package/dist/cdn/{shared-38f0bda5.js → shared-2bd96ec7.js} +2 -2
  66. package/dist/cdn/{shared-a97c3129.js → shared-2d75f154.js} +1 -1
  67. package/dist/cdn/{shared-8526ed32.js → shared-3b975a29.js} +1 -1
  68. package/dist/cdn/{shared-ae00ce7c.js → shared-3cf043a7.js} +1 -1
  69. package/dist/cdn/{shared-0ad0fb9f.js → shared-41e7554e.js} +1 -1
  70. package/dist/cdn/{shared-ee2cda29.js → shared-471e77dd.js} +1 -1
  71. package/dist/cdn/{shared-1467a889.js → shared-476827c7.js} +1 -1
  72. package/dist/cdn/{shared-75331d5e.js → shared-4a652d60.js} +1 -1
  73. package/dist/cdn/{shared-22ba950a.js → shared-4d172731.js} +1 -1
  74. package/dist/cdn/{shared-70747a5c.js → shared-5721fb53.js} +1 -1
  75. package/dist/cdn/{shared-376784f0.js → shared-5bc86d84.js} +1 -1
  76. package/dist/cdn/shared-6d11abd7.js +280 -0
  77. package/dist/cdn/{shared-13203be0.js → shared-6f4fa343.js} +1 -1
  78. package/dist/cdn/{shared-f21254a3.js → shared-6f877b15.js} +1 -1
  79. package/dist/cdn/{shared-d0e4d7b1.js → shared-73045804.js} +1 -1
  80. package/dist/cdn/{shared-f4abc29a.js → shared-787e8da4.js} +1 -1
  81. package/dist/cdn/{shared-9a22d597.js → shared-7dd710e4.js} +1 -1
  82. package/dist/cdn/{shared-970d98db.js → shared-8fbebf38.js} +1 -1
  83. package/dist/cdn/{shared-cc808e01.js → shared-9637a2de.js} +1 -1
  84. package/dist/cdn/{shared-dfc47fd9.js → shared-96a392d9.js} +1 -1
  85. package/dist/cdn/{shared-4f183419.js → shared-97514fcb.js} +1 -1
  86. package/dist/cdn/{shared-c9845b4a.js → shared-9bf7d9a7.js} +1 -1
  87. package/dist/cdn/{shared-421a3ced.js → shared-a0efdc94.js} +1 -1
  88. package/dist/cdn/{shared-32e92c3b.js → shared-a8233033.js} +1 -1
  89. package/dist/cdn/{shared-edae6816.js → shared-ad76e640.js} +1 -1
  90. package/dist/cdn/{shared-6a8a40cc.js → shared-b38762ef.js} +1 -1
  91. package/dist/cdn/{shared-ce0465c6.js → shared-b980ba1d.js} +1 -1
  92. package/dist/cdn/{shared-afd7214a.js → shared-cb3b9d8b.js} +1 -1
  93. package/dist/cdn/{shared-ecf479f2.js → shared-d5ff9121.js} +1 -1
  94. package/dist/cdn/{shared-1ecfa77b.js → shared-deff3eda.js} +1 -1
  95. package/dist/cdn/{shared-301a779e.js → shared-e47bd38e.js} +1 -1
  96. package/dist/cdn/{shared-dbda59a0.js → shared-e5098b19.js} +1 -1
  97. package/dist/cdn/{shared-19768452.js → shared-e7bff5de.js} +1 -1
  98. package/dist/cdn/{shared-e4870c47.js → shared-ea5ff8bc.js} +1 -1
  99. package/dist/cdn/translations/admin-subscription-form/en.json +108 -0
  100. package/dist/cdn/translations/coupon-form/en.json +103 -50
  101. package/dist/cdn/translations/transaction/en.json +108 -0
  102. package/dist/cdn/translations/webhook-card/en.json +5 -1
  103. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.d.ts +9 -2
  104. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js +150 -32
  105. package/dist/elements/internal/InternalAsyncListControl/InternalAsyncListControl.js.map +1 -1
  106. package/dist/elements/internal/InternalAsyncListControl/index.d.ts +3 -0
  107. package/dist/elements/internal/InternalAsyncListControl/index.js +3 -0
  108. package/dist/elements/internal/InternalAsyncListControl/index.js.map +1 -1
  109. package/dist/elements/internal/InternalAsyncListControl/styles.d.ts +1 -0
  110. package/dist/elements/internal/InternalAsyncListControl/styles.js +12 -0
  111. package/dist/elements/internal/InternalAsyncListControl/styles.js.map +1 -0
  112. package/dist/elements/internal/InternalAsyncListControl/types.d.ts +5 -1
  113. package/dist/elements/internal/InternalAsyncListControl/types.js.map +1 -1
  114. package/dist/elements/public/CouponForm/CouponForm.d.ts +0 -3
  115. package/dist/elements/public/CouponForm/CouponForm.js +56 -76
  116. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  117. package/dist/elements/public/CouponForm/index.d.ts +2 -2
  118. package/dist/elements/public/CouponForm/index.js +2 -2
  119. package/dist/elements/public/CouponForm/index.js.map +1 -1
  120. package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
  121. package/dist/elements/public/Transaction/Transaction.d.ts +2 -0
  122. package/dist/elements/public/Transaction/Transaction.js +114 -19
  123. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  124. package/dist/elements/public/Transaction/index.d.ts +6 -0
  125. package/dist/elements/public/Transaction/index.js +6 -0
  126. package/dist/elements/public/Transaction/index.js.map +1 -1
  127. package/dist/elements/public/WebhookCard/WebhookCard.d.ts +8 -0
  128. package/dist/elements/public/WebhookCard/WebhookCard.js +73 -6
  129. package/dist/elements/public/WebhookCard/WebhookCard.js.map +1 -1
  130. package/dist/elements/public/WebhookCard/index.d.ts +2 -0
  131. package/dist/elements/public/WebhookCard/index.js +2 -0
  132. package/dist/elements/public/WebhookCard/index.js.map +1 -1
  133. package/dist/elements/public/WebhookForm/WebhookForm.d.ts +7 -0
  134. package/dist/elements/public/WebhookForm/WebhookForm.js +40 -4
  135. package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
  136. package/package.json +1 -1
  137. package/dist/cdn/shared-ba7354fa.js +0 -6
@@ -1 +1 @@
1
- import{_ as t}from"./shared-0f6e4584.js";import"./shared-cc808e01.js";import{L as e,c as i,h as s}from"./shared-dc73b9a5.js";import{p as r}from"./shared-49ecea83.js";import"./shared-887e1795.js";import"./shared-fb1602a2.js";import"./shared-6be24929.js";import{y as a,S as n,x as o}from"./shared-25502f01.js";import"./shared-22ba950a.js";import"./shared-c11df800.js";import{I as h,D as c}from"./shared-6a8a40cc.js";import{E as d}from"./shared-421a3ced.js";import"./shared-0f00d4d8.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-ff7b2af6.js";import"./shared-edae6816.js";import"./shared-fe4a2e3d.js";import"./shared-13203be0.js";import"./shared-59b7fcc0.js";import{s as l}from"./shared-99940888.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-1ecfa77b.js";import"./shared-301a779e.js";import"./shared-970d98db.js";import"./shared-c9845b4a.js";import"./shared-e7232c2b.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-ee36b83f.js";import"./shared-c286c5ad.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-70747a5c.js";import"./shared-fb1dd186.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 f;!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"}(f||(f={}));class y 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(f.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(f.Default);this.quantity>1&&this.__insertImage(f.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,f.Previous),e&&(this.__setImageState(e,f.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(f.BeforeEnter),f.Default)):t&&this.__setImageState(t,f.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,f.Default),i=t):(t&&this.__setImageState(t,f.Excluded),i=e),i&&(this.__setImageState(i,f.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(f.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,f.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=y.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(" ")}}y.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=l({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,h,c,d]=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,h?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,r,c?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",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),d?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,d):"",i,e,i,e)}}let j,D,k=t=>t;class A extends S{static get scopedElements(){return{"x-pic":y}}}class L extends S{static get scopedElements(){return{"x-pic":A}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":y,"x-bundle-grid":L}}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=l({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(j||(j=k`<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(D||(D=k`<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":d,"x-preview":N,"x-i18n":h}}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,t.setAttribute("data-bundled",""),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":d,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":c,"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-0f6e4584.js";import"./shared-9637a2de.js";import{L as e,c as i,h as s}from"./shared-dc73b9a5.js";import{p as r}from"./shared-49ecea83.js";import"./shared-887e1795.js";import"./shared-fb1602a2.js";import"./shared-6be24929.js";import{y as a,S as n,x as o}from"./shared-25502f01.js";import"./shared-4d172731.js";import"./shared-c11df800.js";import{I as d,D as h}from"./shared-b38762ef.js";import{E as c}from"./shared-a0efdc94.js";import"./shared-0f00d4d8.js";import"./shared-2c1dff50.js";import"./shared-9b895561.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-ff7b2af6.js";import"./shared-ad76e640.js";import"./shared-19f46691.js";import"./shared-6f4fa343.js";import"./shared-59b7fcc0.js";import{s as l}from"./shared-99940888.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-deff3eda.js";import"./shared-e47bd38e.js";import"./shared-8fbebf38.js";import"./shared-9bf7d9a7.js";import"./shared-e7232c2b.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-ee36b83f.js";import"./shared-c286c5ad.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-5721fb53.js";import"./shared-fb1dd186.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 f;!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"}(f||(f={}));class y 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(f.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(f.Default);this.quantity>1&&this.__insertImage(f.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,f.Previous),e&&(this.__setImageState(e,f.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(f.BeforeEnter),f.Default)):t&&this.__setImageState(t,f.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,f.Default),i=t):(t&&this.__setImageState(t,f.Excluded),i=e),i&&(this.__setImageState(i,f.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(f.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,f.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=y.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(" ")}}y.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=l({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,d,h,c]=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,d?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,d):"",i,r,h?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",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),c?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,e,i,e)}}let j,D,k=t=>t;class A extends S{static get scopedElements(){return{"x-pic":y}}}class L extends S{static get scopedElements(){return{"x-pic":A}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":y,"x-bundle-grid":L}}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=l({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(j||(j=k`<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(D||(D=k`<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":c,"x-preview":N,"x-i18n":d}}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,t.setAttribute("data-bundled",""),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":c,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":h,"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"./shared-e4870c47.js";import"./shared-9a22d597.js";import"./shared-ee2cda29.js";import"./shared-dfc47fd9.js";import"./shared-376784f0.js";import"./shared-cfb33387.js";import{I as e}from"./shared-4f183419.js";import{m as r,B as t,_ as o}from"./shared-0f6e4584.js";import{a as i}from"./shared-25502f01.js";import{h as a,s as n}from"./shared-dc73b9a5.js";import"./shared-ae00ce7c.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-75331d5e.js";import"./shared-ff7b2af6.js";import"./shared-fe4a2e3d.js";import"./shared-0f00d4d8.js";import"./shared-1ecfa77b.js";import"./shared-cc808e01.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const l={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},s={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},_={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},c={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},d={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},u={service:"zapier",events:[],url:""},f={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let p,v,g,h,x,y,m,b,w,C,V,$,k,j,F=e=>e;const S=i(e,"native-integration-form");class G extends S{constructor(){super(...arguments),this.__createConfigGetterFor=r((e=>()=>{var r;return null===(r=this.__config)||void 0===r?void 0:r[e]})),this.__createConfigSetterFor=r((e=>r=>this.__config={[e]:r})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,r=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&r.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&r.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&r.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&r.push("use_ava_tax"),r},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,r;const t=null!==(r=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==r?r:{};return Object.entries(t).map((([e,r])=>({value:`${e}:${r}`})))},this.__codeMappingsSetValue=e=>{const r={};for(const{value:t}of e){const[e,o]=t.split(":");e&&o&&(r[e]=o)}this.__config={category_to_product_tax_code_mappings:r}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,r;return(null!==(r=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==r?r:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=r(JSON.parse),t=r((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==r||!a||`avalara-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).id||"avalara-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).key||"avalara-key:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).company_code||"avalara-company-code:v8n_required",({provider:r="avalara",config:t="{}"})=>{if("avalara"!==r)return!0;const o=e(t).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:r="avalara",config:t="{}"})=>"taxjar"!==r||!!e(t).api_token||"taxjar-api-token:v8n_required",({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==r||!a||`onesource-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).external_company_id||"onesource-external-company-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).from_city||"onesource-from-city:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).host_system||"onesource-host-system:v8n_required",({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:o,encryption_key:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"json"!==i||!n||`webhook-json-url:${n}`},({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_id||"webflow-site-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_name||"webflow-site-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_id||"webflow-collection-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_name||"webflow-collection-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new t(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const r=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(p||(p=F` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(v||(v=F` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===r?this.__renderAvalaraConfig():"taxjar"===r?this.__renderTaxJarConfig():"onesource"===r?this.__renderOneSourceConfig():"webflow"===r?this.__renderWebflowConfig():"zapier"===r?this.__renderZapierConfig():"webhook"===r?this.__renderWebhookConfig():"apple_pay"===r?this.__renderApplePayConfig():"custom_tax"===r?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var r;const t=this.__config,i=null!==(r=this.form.provider)&&void 0!==r?r:"avalara",a="avalara"===i?c:"taxjar"===i?f:"onesource"===i?_:"webflow"===i?d:"zapier"===i?u:"webhook"===i?"legacy_xml"===(null==t?void 0:t.service)?l:s:void 0,n=JSON.stringify(o(o(o({},a),t),e));this.edit({provider:i,config:n})}__renderAvalaraConfig(){var e;return a(g||(g=F` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(h||(h=F` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(x||(x=F` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=F` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,r;return a(m||(m=F` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),n(b||(b=F`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(r=this.__config)||void 0===r?void 0:r.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(w||(w=F` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(C||(C=F` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(V||(V=F` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"))}__renderZapierConfig(){return a($||($=F` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(k||(k=F` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a(j||(j=F` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",G);export{G as NativeIntegrationForm};
1
+ import"./shared-ea5ff8bc.js";import"./shared-7dd710e4.js";import"./shared-471e77dd.js";import"./shared-96a392d9.js";import"./shared-5bc86d84.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import{m as r,B as t,_ as o}from"./shared-0f6e4584.js";import{a as i}from"./shared-25502f01.js";import{h as a,s as n}from"./shared-dc73b9a5.js";import"./shared-3cf043a7.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-77e15843.js";import"./shared-887e1795.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-4a652d60.js";import"./shared-ff7b2af6.js";import"./shared-19f46691.js";import"./shared-0f00d4d8.js";import"./shared-deff3eda.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const l={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},s={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},_={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},c={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},d={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},f={service:"zapier",events:[],url:""},u={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let p,v,g,h,x,y,m,b,w,C,V,$,k,j,F=e=>e;const S=i(e,"native-integration-form");class G extends S{constructor(){super(...arguments),this.__createConfigGetterFor=r((e=>()=>{var r;return null===(r=this.__config)||void 0===r?void 0:r[e]})),this.__createConfigSetterFor=r((e=>r=>this.__config={[e]:r})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,r=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&r.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&r.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&r.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&r.push("use_ava_tax"),r},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,r;const t=null!==(r=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==r?r:{};return Object.entries(t).map((([e,r])=>({value:`${e}:${r}`})))},this.__codeMappingsSetValue=e=>{const r={};for(const{value:t}of e){const[e,o]=t.split(":");e&&o&&(r[e]=o)}this.__config={category_to_product_tax_code_mappings:r}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,r;return(null!==(r=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==r?r:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=r(JSON.parse),t=r((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==r||!a||`avalara-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).id||"avalara-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).key||"avalara-key:v8n_required",({provider:r="avalara",config:t="{}"})=>"avalara"!==r||!!e(t).company_code||"avalara-company-code:v8n_required",({provider:r="avalara",config:t="{}"})=>{if("avalara"!==r)return!0;const o=e(t).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:r="avalara",config:t="{}"})=>"taxjar"!==r||!!e(t).api_token||"taxjar-api-token:v8n_required",({provider:r="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?t(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==r||!a||`onesource-service-url:${a}`},({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).external_company_id||"onesource-external-company-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).from_city||"onesource-from-city:v8n_required",({provider:r="avalara",config:t="{}"})=>"onesource"!==r||!!e(t).host_system||"onesource-host-system:v8n_required",({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:o,encryption_key:i}=e(t);return"webhook"!==r||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"json"!==i||!n||`webhook-json-url:${n}`},({provider:r="avalara",config:t="{}"})=>{const{service:o,title:i}=e(t);return"webhook"!==r||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:r="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?t(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_id||"webflow-site-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).site_name||"webflow-site-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_id||"webflow-collection-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).collection_name||"webflow-collection-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:r="avalara",config:t="{}"})=>"webflow"!==r||!!e(t).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new t(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const r=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(p||(p=F` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(v||(v=F` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===r?this.__renderAvalaraConfig():"taxjar"===r?this.__renderTaxJarConfig():"onesource"===r?this.__renderOneSourceConfig():"webflow"===r?this.__renderWebflowConfig():"zapier"===r?this.__renderZapierConfig():"webhook"===r?this.__renderWebhookConfig():"apple_pay"===r?this.__renderApplePayConfig():"custom_tax"===r?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var r;const t=this.__config,i=null!==(r=this.form.provider)&&void 0!==r?r:"avalara",a="avalara"===i?c:"taxjar"===i?u:"onesource"===i?_:"webflow"===i?d:"zapier"===i?f:"webhook"===i?"legacy_xml"===(null==t?void 0:t.service)?l:s:void 0,n=JSON.stringify(o(o(o({},a),t),e));this.edit({provider:i,config:n})}__renderAvalaraConfig(){var e;return a(g||(g=F` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(h||(h=F` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(x||(x=F` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=F` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,r;return a(m||(m=F` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),n(b||(b=F`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(r=this.__config)||void 0===r?void 0:r.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(w||(w=F` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(C||(C=F` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(V||(V=F` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"))}__renderZapierConfig(){return a($||($=F` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(k||(k=F` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a(j||(j=F` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",G);export{G as NativeIntegrationForm};
@@ -1 +1 @@
1
- import"./shared-59b7fcc0.js";import"./shared-887e1795.js";import"./shared-cc808e01.js";import"./shared-49ecea83.js";import{_ as e,l as t}from"./shared-0f6e4584.js";import{h as s,L as i}from"./shared-dc73b9a5.js";import{C as n}from"./shared-0b01f721.js";import{N as a}from"./shared-24d71d01.js";import{R as r,T as o,a as d}from"./shared-25502f01.js";import{c}from"./shared-4e709717.js";import{I as l}from"./shared-f7a1193f.js";import"./shared-98ddb87c.js";import"./shared-fb1602a2.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";let m,h,p=e=>e;const _=r(n(o(d(l(i),"pagination"))));class f extends _{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 i=null===(e=this.__pageElement)||void 0===e?void 0:e.data,{disabled:n,lang:a,ns:r}=this,o=Number(t(i,"returned_items")),d=Number.isNaN(o)?0:o,l=Number(t(i,"total_items")),_=Number.isNaN(l)?0:l,f=Number(t(i,"offset")),g=Number.isNaN(f)?0:f,u=!n&&g>0,v=!n&&g+d<_,x="sr-only sm-not-sr-only",b=g+1,y=g+d;return s(m||(m=p` <slot @slotchange="${0}"></slot> ${0} `),this.__connectPageElement,g>0||g+d<_?s(h||(h=p` <div class="mt-s 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> `),!u,(()=>this.__goTo("first")),x,a,r,!u,(()=>this.__goTo("prev")),x,a,r,JSON.stringify({total:_,from:b,to:y}),c({"flex-1 text-xs text-tertiary text-center leading-xs truncate":!0,"opacity-0":!i}),a,r,!v,(()=>this.__goTo("next")),x,a,r,!v,(()=>this.__goTo("last")),x,a,r):"")}disconnectedCallback(){super.disconnectedCallback(),this.__disconnectPageElement()}__goTo(e){var s;this.__pageElement.href=String(t(null===(s=this.__pageElement)||void 0===s?void 0:s.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 a));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-59b7fcc0.js";import"./shared-887e1795.js";import"./shared-9637a2de.js";import"./shared-49ecea83.js";import{_ as e,l as t}from"./shared-0f6e4584.js";import{h as s,L as i}from"./shared-dc73b9a5.js";import{C as n}from"./shared-0b01f721.js";import{N as a}from"./shared-24d71d01.js";import{R as r,T as o,a as d}from"./shared-25502f01.js";import{c as l}from"./shared-4e709717.js";import{I as c}from"./shared-f7a1193f.js";import"./shared-98ddb87c.js";import"./shared-fb1602a2.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";let m,h,p=e=>e;const _=r(n(o(d(c(i),"pagination"))));class f extends _{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 i=null===(e=this.__pageElement)||void 0===e?void 0:e.data,{disabled:n,lang:a,ns:r}=this,o=Number(t(i,"returned_items")),d=Number.isNaN(o)?0:o,c=Number(t(i,"total_items")),_=Number.isNaN(c)?0:c,f=Number(t(i,"offset")),g=Number.isNaN(f)?0:f,u=!n&&g>0,v=!n&&g+d<_,x="sr-only sm-not-sr-only",b=g+1,y=g+d;return s(m||(m=p` <slot @slotchange="${0}"></slot> ${0} `),this.__connectPageElement,g>0||g+d<_?s(h||(h=p` <div class="mt-s 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> `),!u,(()=>this.__goTo("first")),x,a,r,!u,(()=>this.__goTo("prev")),x,a,r,JSON.stringify({total:_,from:b,to:y}),l({"flex-1 text-xs text-tertiary text-center leading-xs truncate":!0,"opacity-0":!i}),a,r,!v,(()=>this.__goTo("next")),x,a,r,!v,(()=>this.__goTo("last")),x,a,r):"")}disconnectedCallback(){super.disconnectedCallback(),this.__disconnectPageElement()}__goTo(e){var s;this.__pageElement.href=String(t(null===(s=this.__pageElement)||void 0===s?void 0:s.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 a));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 +1 @@
1
- import"./shared-376784f0.js";import"./shared-cfb33387.js";import{I as r}from"./shared-4f183419.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-25502f01.js";import{B as a}from"./shared-0f6e4584.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-1ecfa77b.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-fe4a2e3d.js";import"./shared-77e15843.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-61ade33e.js";import"./shared-38f0bda5.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-cc808e01.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-8bb3eb45.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./shared-bab2ea2c.js";let o,d,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(d||(d=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(o||(o=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
1
+ import"./shared-5bc86d84.js";import"./shared-01f18104.js";import{I as r}from"./shared-97514fcb.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-25502f01.js";import{B as a}from"./shared-0f6e4584.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-deff3eda.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-61ade33e.js";import"./shared-2bd96ec7.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-59b7fcc0.js";import"./shared-bab2ea2c.js";let d,o,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(o||(o=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(d||(d=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
@@ -1 +1 @@
1
- import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-cc808e01.js";import"./shared-3483c729.js";import"./shared-51c4a6dd.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-49ecea83.js";import{_ as e,B as t}from"./shared-0f6e4584.js";import{l as s,u as r}from"./shared-2bf89a21.js";import{C as a}from"./shared-0b01f721.js";import{T as i,a as o}from"./shared-25502f01.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c as l}from"./shared-dc73b9a5.js";import{i as c}from"./shared-9803aa7c.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-24d71d01.js";import"./shared-98ddb87c.js";import"./shared-fb1602a2.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-ecf479f2.js";import"./shared-ba7354fa.js";import"./shared-c9845b4a.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-4f183419.js";import"./foxy-copy-to-clipboard.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-0f00d4d8.js";import"./shared-ff7b2af6.js";import"./shared-2c1dff50.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";const h=d("\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"),f=d(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} ${h} }`)).join(" "));let u,b,j,y,v,g,$,x,_,S,w=e=>e;const T=i(a(o(p,"payment-method-card")));class k extends T{constructor(){super(...arguments),this.embedUrl=null,this.__renderActionsUpdate=()=>{var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.save_cc),s=t?"--lumo-primary-text-color: #fff; --lumo-primary-color-50pct: rgba(255, 255, 255, 0.5); --lumo-contrast-5pct: rgba(255, 255, 255, 0.05)":void 0;return n(u||(u=w` <div class="flex"> ${0} <foxy-form-dialog data-testid="update-dialog" readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="status ${0}" header="${0}" group="${0}" form="foxy-update-payment-method-form" href="${0}" lang="${0}" ns="${0} dialog" alert close-on-patch .props="${0}"> </foxy-form-dialog> <vaadin-button class="${0}" theme="${0}" style="${0}" aria-label="${0}" data-testid="actions:update" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:update:before"),this.readonlySelector.zoom("actions:update:form"),this.disabledSelector.zoom("actions:update:form"),this.hiddenSelector.zoom("actions:update:form"),t?"dialog_header_update":"dialog_header_add",this.group,this.href,this.lang,this.ns,{".embedUrl":this.embedUrl},c(t?"px-xs rounded":void 0),t?"icon":"contrast small",c(s),this.t(t?"update":"add"),this.disabledSelector.matches("actions:update",!0),(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),n(t?b||(b=w`<iron-icon icon="icons:create"></iron-icon>`):j||(j=w`<foxy-i18n infer="" key="add"></foxy-i18n>`)),this.renderTemplateOrSlot("actions:update:after"))},this.__renderActionsDelete=()=>n(y||(y=w` <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=()=>{const e=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl,t=this.hiddenSelector.matches("actions:delete",!0);return n(v||(v=w` <div class="flex gap-s" data-testid="actions"> ${0} ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),e?"":this.__renderActionsUpdate(),t?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}}static get properties(){return e(e({},super.properties),{},{embedUrl:{attribute:"embed-url"}})}static get styles(){return[super.styles,f,l(g||(g=w`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var e,a,i,o,d,l;const{data:c,lang:p,ns:h}=this;if(this.in({idle:"template"})||!(null==c?void 0:c.save_cc)||!this.in("idle")){const t=this.in("fail")?"error":this.in("busy")?"busy":"empty",s=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl||!this.data;return n($||($=w` <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 flex-col gap-m items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> ${0} </div> </div> `),this.in("busy"),t,this.lang,h,null!==(a=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==a?a:"",s?"":this.__renderActionsUpdate())}const f=null!==(o=null===(i=c.cc_type)||void 0===i?void 0:i.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=s[f])&&void 0!==d?d:r,b=null===(l=c.cc_number_masked)||void 0===l?void 0:l.substring(c.cc_number_masked.length-4);return n(x||(x=w` <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}"> <div class="mr-auto rounded h-m">${0}</div> ${0} </div> <div class="font-tnum leading-none flex justify-between" style="color:#fff"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),p,h,this.__handleConfirmHide,this.in("busy"),f,m({"flex items-start":!0,"justify-between":this.readonlyControls===t.False,"justify-end":this.readonlyControls===t.True}),u,this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),c.cc_exp_month&&c.cc_exp_year?n(_||(_=w` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),c.cc_exp_month,c.cc_exp_year):"",b?n(S||(S=w` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),b):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return p.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",k);export{k as PaymentMethodCard};
1
+ import"./shared-887e1795.js";import"./shared-59b7fcc0.js";import"./shared-9637a2de.js";import"./shared-09fc6fa0.js";import"./shared-51c4a6dd.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-49ecea83.js";import{_ as e,B as t}from"./shared-0f6e4584.js";import{l as s,u as r}from"./shared-2bf89a21.js";import{C as a}from"./shared-0b01f721.js";import{T as i,a as o}from"./shared-25502f01.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c as l}from"./shared-dc73b9a5.js";import{i as c}from"./shared-9803aa7c.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-24d71d01.js";import"./shared-98ddb87c.js";import"./shared-fb1602a2.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-c11df800.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-d5ff9121.js";import"./shared-6d11abd7.js";import"./shared-3cf043a7.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-97514fcb.js";import"./foxy-copy-to-clipboard.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./foxy-payment-card-embed.js";import"./shared-0f00d4d8.js";import"./shared-ff7b2af6.js";import"./shared-2c1dff50.js";import"./shared-77e15843.js";import"./shared-8cb35eb4.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";const h=d("\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"),f=d(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} ${h} }`)).join(" "));let u,b,j,y,v,g,$,x,_,S,w=e=>e;const T=i(a(o(p,"payment-method-card")));class k extends T{constructor(){super(...arguments),this.embedUrl=null,this.__renderActionsUpdate=()=>{var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.save_cc),s=t?"--lumo-primary-text-color: #fff; --lumo-primary-color-50pct: rgba(255, 255, 255, 0.5); --lumo-contrast-5pct: rgba(255, 255, 255, 0.05)":void 0;return n(u||(u=w` <div class="flex"> ${0} <foxy-form-dialog data-testid="update-dialog" readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="status ${0}" header="${0}" group="${0}" form="foxy-update-payment-method-form" href="${0}" lang="${0}" ns="${0} dialog" alert close-on-patch .props="${0}"> </foxy-form-dialog> <vaadin-button class="${0}" theme="${0}" style="${0}" aria-label="${0}" data-testid="actions:update" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:update:before"),this.readonlySelector.zoom("actions:update:form"),this.disabledSelector.zoom("actions:update:form"),this.hiddenSelector.zoom("actions:update:form"),t?"dialog_header_update":"dialog_header_add",this.group,this.href,this.lang,this.ns,{".embedUrl":this.embedUrl},c(t?"px-xs rounded":void 0),t?"icon":"contrast small",c(s),this.t(t?"update":"add"),this.disabledSelector.matches("actions:update",!0),(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),n(t?b||(b=w`<iron-icon icon="icons:create"></iron-icon>`):j||(j=w`<foxy-i18n infer="" key="add"></foxy-i18n>`)),this.renderTemplateOrSlot("actions:update:after"))},this.__renderActionsDelete=()=>n(y||(y=w` <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=()=>{const e=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl,t=this.hiddenSelector.matches("actions:delete",!0);return n(v||(v=w` <div class="flex gap-s" data-testid="actions"> ${0} ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),e?"":this.__renderActionsUpdate(),t?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}}static get properties(){return e(e({},super.properties),{},{embedUrl:{attribute:"embed-url"}})}static get styles(){return[super.styles,f,l(g||(g=w`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var e,a,i,o,d,l;const{data:c,lang:p,ns:h}=this;if(this.in({idle:"template"})||!(null==c?void 0:c.save_cc)||!this.in("idle")){const t=this.in("fail")?"error":this.in("busy")?"busy":"empty",s=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl||!this.data;return n($||($=w` <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 flex-col gap-m items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> ${0} </div> </div> `),this.in("busy"),t,this.lang,h,null!==(a=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==a?a:"",s?"":this.__renderActionsUpdate())}const f=null!==(o=null===(i=c.cc_type)||void 0===i?void 0:i.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=s[f])&&void 0!==d?d:r,b=null===(l=c.cc_number_masked)||void 0===l?void 0:l.substring(c.cc_number_masked.length-4);return n(x||(x=w` <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}"> <div class="mr-auto rounded h-m">${0}</div> ${0} </div> <div class="font-tnum leading-none flex justify-between" style="color:#fff"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),p,h,this.__handleConfirmHide,this.in("busy"),f,m({"flex items-start":!0,"justify-between":this.readonlyControls===t.False,"justify-end":this.readonlyControls===t.True}),u,this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),c.cc_exp_month&&c.cc_exp_year?n(_||(_=w` <span class="sr-only">${0}&nbsp;</span> <span>${0} / ${0}</span> `),this.t("expires").toString(),c.cc_exp_month,c.cc_exp_year):"",b?n(S||(S=w` <span class="sr-only">${0}&nbsp;</span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),b):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return p.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",k);export{k as PaymentMethodCard};
@@ -1 +1 @@
1
- import"./shared-cc808e01.js";import"./shared-40c6b1f6.js";import"./shared-f4abc29a.js";import"./shared-19768452.js";import"./shared-dbda59a0.js";import"./shared-cfb33387.js";import{I as e}from"./shared-4f183419.js";import"./foxy-nucleon-element.js";import"./shared-49ecea83.js";import{_ as t,B as r,aM as o,l as a}from"./shared-0f6e4584.js";import{a as i}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-6474675f.js";import{h as c}from"./shared-9db46672.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-8bb3eb45.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-edae6816.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-fe4a2e3d.js";import"./shared-77e15843.js";import"./shared-970d98db.js";import"./shared-c9845b4a.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-22ba9566.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let p,f,h,u,m,v,j,y,b,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,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(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(p||(p=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(f||(f=P``)):l(h||(h=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/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=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(j||(j=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(y||(y=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(b||(b=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=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(d(a,i,r))})},c=t.options,p=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,p,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,p,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" 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,p,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
1
+ import"./shared-9637a2de.js";import"./shared-40c6b1f6.js";import"./shared-787e8da4.js";import"./shared-e7bff5de.js";import"./shared-e5098b19.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-nucleon-element.js";import"./shared-49ecea83.js";import{_ as t,B as r,aM as o,l as a}from"./shared-0f6e4584.js";import{a as i}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-dc73b9a5.js";import{s as d}from"./shared-6474675f.js";import{h as c}from"./shared-9db46672.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-ad76e640.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-8fbebf38.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-22ba9566.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let f,p,h,u,m,v,j,y,_,b,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,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(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(f||(f=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=P``)):l(h||(h=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/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=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(j||(j=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(y||(y=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(_||(_=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(b||(b=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=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(d(a,i,r))})},c=t.options,f=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,f,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,f,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" 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,f,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
@@ -1 +1 @@
1
- import"./shared-cc808e01.js";import"./shared-40c6b1f6.js";import"./shared-f4abc29a.js";import"./shared-dbda59a0.js";import"./shared-cfb33387.js";import{I as e}from"./shared-4f183419.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-49ecea83.js";import{_ as t,B as r,l as i}from"./shared-0f6e4584.js";import{g as o}from"./shared-bab2ea2c.js";import{a}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{h as l,s as n}from"./shared-dc73b9a5.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-9db46672.js";import{s as h}from"./shared-6474675f.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-38f0bda5.js";import"./shared-61ade33e.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-8bb3eb45.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-970d98db.js";import"./shared-c9845b4a.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-2c1dff50.js";import"./shared-ff7b2af6.js";import"./shared-651c44fa.js";import"./shared-0f00d4d8.js";import"./shared-fe4a2e3d.js";import"./shared-77e15843.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-22ba9566.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";let u,m,p,f,_,v,y,g,x,$,b,j,L,S,k,w,P,V,M,I,B,C,q,Z,H,D,O,R=e=>e;const T=a(e,"payments-api-payment-method-form");class W extends T{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},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"}]}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),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=R` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(m||(m=R``)):l(p||(p=R` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=R` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=R`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}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])=>{if(r.is_deprecated)return e;const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}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 __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}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(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=R` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=R` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=R`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=R` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=R` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=R` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?l(L||(L=R` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=R` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,o,a,d,c,h,u,m,p,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=R``));if("live"===e&&!(null===(o=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===o?void 0:o.is_active))return l(w||(w=R` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(P||(P=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(m=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===m?void 0:m.is_live));return l(V||(V=R` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?l(M||(M=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(I||(I=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(B||(B=R` <foxy-internal-text-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=W.defaultImageSrc,a=null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,s=e=>e.currentTarget.src=o;return l(C||(C=R` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(q||(q=R`${0}`),e.fields.map((e=>{var t,r,o;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const o=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(o,e.id))&&void 0!==r?r:o.default_value}catch(t){return e.default_value}},n=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},d=e.options;return l(Z||(Z=R` ${0} `),"checkbox"===e.type?l(H||(H=R` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(D||(D=R` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(O||(O=R` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=e.description)&&void 0!==o?o:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",W);export{W as PaymentsApiPaymentMethodForm};
1
+ import"./shared-9637a2de.js";import"./shared-40c6b1f6.js";import"./shared-787e8da4.js";import"./shared-e5098b19.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-49ecea83.js";import{_ as t,B as r,l as i}from"./shared-0f6e4584.js";import{g as o}from"./shared-bab2ea2c.js";import{a}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{h as l,s as n}from"./shared-dc73b9a5.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-9db46672.js";import{s as h}from"./shared-6474675f.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-2bd96ec7.js";import"./shared-61ade33e.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-1729e19a.js";import"./shared-887e1795.js";import"./shared-6be24929.js";import"./shared-8fbebf38.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-2c1dff50.js";import"./shared-ff7b2af6.js";import"./shared-651c44fa.js";import"./shared-0f00d4d8.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./shared-22ba9566.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./foxy-copy-to-clipboard.js";import"./shared-59b7fcc0.js";let u,m,p,f,_,v,y,g,x,$,b,j,L,S,k,w,P,V,M,I,B,C,q,Z,H,D,O,R=e=>e;const T=a(e,"payments-api-payment-method-form");class W extends T{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},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"}]}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),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=R` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(m||(m=R``)):l(p||(p=R` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=R` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=R`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}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])=>{if(r.is_deprecated)return e;const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}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 __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}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(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=R` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=R` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=R`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=R` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=R` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=R` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?l(L||(L=R` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=R` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,o,a,d,c,h,u,m,p,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=R``));if("live"===e&&!(null===(o=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===o?void 0:o.is_active))return l(w||(w=R` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(P||(P=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(m=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===m?void 0:m.is_live));return l(V||(V=R` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?l(M||(M=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(I||(I=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(B||(B=R` <foxy-internal-text-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=W.defaultImageSrc,a=null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,s=e=>e.currentTarget.src=o;return l(C||(C=R` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(q||(q=R`${0}`),e.fields.map((e=>{var t,r,o;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const o=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(o,e.id))&&void 0!==r?r:o.default_value}catch(t){return e.default_value}},n=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},d=e.options;return l(Z||(Z=R` ${0} `),"checkbox"===e.type?l(H||(H=R` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(D||(D=R` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(O||(O=R` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=e.description)&&void 0!==o?o:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",W);export{W as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-ba7354fa.js";import"./shared-40c6b1f6.js";import"./shared-f4abc29a.js";import"./shared-cfb33387.js";import{I as e}from"./shared-4f183419.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 r,B as t}from"./shared-0f6e4584.js";import{a as o}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-c9845b4a.js";import"./shared-9b895561.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-887e1795.js";import"./shared-e7232c2b.js";import"./shared-38f0bda5.js";import"./shared-cc808e01.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-3483c729.js";import"./shared-c11df800.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-8bb3eb45.js";import"./shared-6be24929.js";import"./shared-fe4a2e3d.js";import"./shared-77e15843.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-19768452.js";import"./shared-edae6816.js";import"./shared-dbda59a0.js";import"./shared-970d98db.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./foxy-nucleon-element.js";import"./shared-9db46672.js";let i,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},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"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return a(i||(i=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
1
+ import"./shared-6d11abd7.js";import"./shared-40c6b1f6.js";import"./shared-787e8da4.js";import"./shared-01f18104.js";import{I as e}from"./shared-97514fcb.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 r,B as t}from"./shared-0f6e4584.js";import{a as o}from"./shared-25502f01.js";import{i as s}from"./shared-9803aa7c.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-fb1602a2.js";import"./shared-98ddb87c.js";import"./shared-887e1795.js";import"./shared-2bd96ec7.js";import"./shared-3cf043a7.js";import"./shared-61ade33e.js";import"./shared-9bf7d9a7.js";import"./shared-9b895561.js";import"./shared-e7232c2b.js";import"./shared-9637a2de.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-59b7fcc0.js";import"./shared-49ecea83.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-09fc6fa0.js";import"./shared-c11df800.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-226dd830.js";import"./shared-51c4a6dd.js";import"./shared-1729e19a.js";import"./shared-6be24929.js";import"./shared-19f46691.js";import"./shared-77e15843.js";import"./shared-ff7b2af6.js";import"./shared-0f00d4d8.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-63192750.js";import"./shared-df42c94f.js";import"./shared-e7bff5de.js";import"./shared-ad76e640.js";import"./shared-e5098b19.js";import"./shared-8fbebf38.js";import"./shared-2c1dff50.js";import"./shared-651c44fa.js";import"./shared-ea8f9a88.js";import"./shared-5c4d786c.js";import"./foxy-nucleon-element.js";import"./shared-9db46672.js";let i,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},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"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return a(i||(i=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};