@foxy.io/elements 1.27.0 → 1.27.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 (201) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  5. package/dist/cdn/foxy-api-browser.js +1 -1
  6. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  7. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  8. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  9. package/dist/cdn/foxy-attribute-card.js +1 -1
  10. package/dist/cdn/foxy-attribute-form.js +1 -1
  11. package/dist/cdn/foxy-billing-address-card.js +1 -1
  12. package/dist/cdn/foxy-cancellation-form.js +1 -1
  13. package/dist/cdn/foxy-cart-card.js +1 -1
  14. package/dist/cdn/foxy-cart-form.js +1 -1
  15. package/dist/cdn/foxy-client-card.js +1 -1
  16. package/dist/cdn/foxy-client-form.js +1 -1
  17. package/dist/cdn/foxy-collection-page.js +1 -1
  18. package/dist/cdn/foxy-collection-pages.js +1 -1
  19. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  20. package/dist/cdn/foxy-coupon-card.js +1 -1
  21. package/dist/cdn/foxy-coupon-code-card.js +1 -1
  22. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  23. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  24. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  25. package/dist/cdn/foxy-coupon-form.js +1 -1
  26. package/dist/cdn/foxy-custom-field-card.js +1 -1
  27. package/dist/cdn/foxy-custom-field-form.js +1 -1
  28. package/dist/cdn/foxy-customer-card.js +1 -1
  29. package/dist/cdn/foxy-customer-form.js +1 -1
  30. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  31. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  32. package/dist/cdn/foxy-customer-portal.js +1 -1
  33. package/dist/cdn/foxy-customer.js +1 -1
  34. package/dist/cdn/foxy-customers-table.js +1 -1
  35. package/dist/cdn/foxy-discount-card.js +1 -1
  36. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  37. package/dist/cdn/foxy-donation.js +1 -1
  38. package/dist/cdn/foxy-downloadable-card.js +1 -1
  39. package/dist/cdn/foxy-downloadable-form.js +6 -6
  40. package/dist/cdn/foxy-email-template-card.js +1 -1
  41. package/dist/cdn/foxy-email-template-form.js +1 -1
  42. package/dist/cdn/foxy-filter-attribute-card.js +1 -1
  43. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  44. package/dist/cdn/foxy-form-dialog.js +1 -1
  45. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  46. package/dist/cdn/foxy-gift-card-card.js +1 -1
  47. package/dist/cdn/foxy-gift-card-code-card.js +1 -1
  48. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  49. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  50. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  51. package/dist/cdn/foxy-gift-card-form.js +1 -1
  52. package/dist/cdn/foxy-i18n-editor.js +2 -2
  53. package/dist/cdn/foxy-integration-card.js +1 -1
  54. package/dist/cdn/foxy-integration-form.js +1 -1
  55. package/dist/cdn/foxy-item-card.js +1 -1
  56. package/dist/cdn/foxy-item-category-card.js +1 -1
  57. package/dist/cdn/foxy-item-category-form.js +1 -1
  58. package/dist/cdn/foxy-item-form.js +2 -2
  59. package/dist/cdn/foxy-item-option-card.js +1 -1
  60. package/dist/cdn/foxy-item-option-form.js +1 -1
  61. package/dist/cdn/foxy-items-form.js +1 -1
  62. package/dist/cdn/foxy-native-integration-card.js +1 -1
  63. package/dist/cdn/foxy-native-integration-form.js +1 -1
  64. package/dist/cdn/foxy-pagination.js +1 -1
  65. package/dist/cdn/foxy-passkey-card.js +1 -1
  66. package/dist/cdn/foxy-passkey-form.js +1 -1
  67. package/dist/cdn/foxy-payment-card-embed.js +1 -0
  68. package/dist/cdn/foxy-payment-card.js +1 -1
  69. package/dist/cdn/foxy-payment-method-card.js +1 -1
  70. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  71. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  72. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  73. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  74. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  75. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  76. package/dist/cdn/foxy-query-builder.js +1 -1
  77. package/dist/cdn/foxy-report-form.js +2 -2
  78. package/dist/cdn/foxy-reports-table.js +1 -1
  79. package/dist/cdn/foxy-shipment-card.js +1 -1
  80. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  81. package/dist/cdn/foxy-sign-in-form.js +1 -1
  82. package/dist/cdn/foxy-spinner.js +1 -1
  83. package/dist/cdn/foxy-store-card.js +1 -1
  84. package/dist/cdn/foxy-store-form.js +1 -1
  85. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  86. package/dist/cdn/foxy-subscription-card.js +1 -1
  87. package/dist/cdn/foxy-subscription-form.js +1 -1
  88. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  89. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  90. package/dist/cdn/foxy-table.js +1 -1
  91. package/dist/cdn/foxy-tax-card.js +1 -1
  92. package/dist/cdn/foxy-tax-form.js +1 -1
  93. package/dist/cdn/foxy-template-config-form.js +1 -1
  94. package/dist/cdn/foxy-template-form.js +1 -1
  95. package/dist/cdn/foxy-template-set-card.js +1 -1
  96. package/dist/cdn/foxy-template-set-form.js +1 -1
  97. package/dist/cdn/foxy-transaction-card.js +1 -1
  98. package/dist/cdn/foxy-transaction.js +1 -1
  99. package/dist/cdn/foxy-transactions-table.js +7 -7
  100. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  101. package/dist/cdn/foxy-user-card.js +1 -1
  102. package/dist/cdn/foxy-user-form.js +1 -1
  103. package/dist/cdn/foxy-users-table.js +1 -1
  104. package/dist/cdn/foxy-webhook-card.js +1 -1
  105. package/dist/cdn/foxy-webhook-form.js +1 -1
  106. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  107. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  108. package/dist/cdn/{shared-30143820.js → shared-0ac853c6.js} +1 -1
  109. package/dist/cdn/{shared-0062cab1.js → shared-0e9ad70e.js} +1 -1
  110. package/dist/cdn/{shared-1ab8b12e.js → shared-0f4947e8.js} +1 -1
  111. package/dist/cdn/{shared-5758adbc.js → shared-157c52e5.js} +1 -1
  112. package/dist/cdn/{shared-7c819ebc.js → shared-15a947f3.js} +3 -3
  113. package/dist/cdn/{shared-91009494.js → shared-1602c9a4.js} +1 -1
  114. package/dist/cdn/{shared-8e59a71e.js → shared-213b9416.js} +1 -1
  115. package/dist/cdn/shared-21fec810.js +1 -0
  116. package/dist/cdn/{shared-2f2b5a28.js → shared-221d3788.js} +1 -1
  117. package/dist/cdn/{shared-b55f1de3.js → shared-28e988c6.js} +1 -1
  118. package/dist/cdn/{shared-15fe01fe.js → shared-3521ade9.js} +1 -1
  119. package/dist/cdn/shared-43928f5a.js +6 -0
  120. package/dist/cdn/{shared-b73fd633.js → shared-4a1ca2d3.js} +1 -1
  121. package/dist/cdn/shared-51c3bc09.js +1 -0
  122. package/dist/cdn/{shared-e4403332.js → shared-56b8e9ca.js} +1 -1
  123. package/dist/cdn/{shared-c0b1a51d.js → shared-5c4a29b9.js} +2 -2
  124. package/dist/cdn/{shared-84215d13.js → shared-5f65bdab.js} +14 -14
  125. package/dist/cdn/{shared-e2cbc382.js → shared-617dbd76.js} +4 -4
  126. package/dist/cdn/{shared-fd95cd52.js → shared-6c97a6b0.js} +1 -1
  127. package/dist/cdn/{shared-bac00622.js → shared-71782a9e.js} +1 -1
  128. package/dist/cdn/shared-741bfa42.js +1 -0
  129. package/dist/cdn/{shared-b2ce84fa.js → shared-75f3a59e.js} +2 -2
  130. package/dist/cdn/{shared-e10b5dca.js → shared-7a5adb55.js} +1 -1
  131. package/dist/cdn/shared-82423f8b.js +1 -0
  132. package/dist/cdn/{shared-328e5fdc.js → shared-849413bb.js} +2 -2
  133. package/dist/cdn/{shared-25fc0ceb.js → shared-85707e42.js} +1 -1
  134. package/dist/cdn/{shared-337f2fe9.js → shared-85f44e3e.js} +1 -1
  135. package/dist/cdn/{shared-8c5b4c81.js → shared-879fcb1f.js} +4 -4
  136. package/dist/cdn/{shared-40cbbbae.js → shared-891b33ad.js} +14 -14
  137. package/dist/cdn/{shared-f548d023.js → shared-8acb820f.js} +1 -1
  138. package/dist/cdn/{shared-1d12db26.js → shared-8b4ba63a.js} +1 -1
  139. package/dist/cdn/{shared-66a515e3.js → shared-96077b62.js} +1 -1
  140. package/dist/cdn/shared-98f85be1.js +1 -0
  141. package/dist/cdn/{shared-cb732375.js → shared-9bd371c7.js} +1 -1
  142. package/dist/cdn/{shared-036b25a3.js → shared-9c3b800b.js} +1 -1
  143. package/dist/cdn/{shared-b99daf13.js → shared-9e014b51.js} +1 -1
  144. package/dist/cdn/{shared-4128d453.js → shared-a006b7a9.js} +11 -11
  145. package/dist/cdn/shared-a6e383ac.js +31 -0
  146. package/dist/cdn/{shared-a33be18f.js → shared-a827bcc6.js} +1 -1
  147. package/dist/cdn/{shared-a911ab73.js → shared-b7cda8ba.js} +1 -1
  148. package/dist/cdn/{shared-432d66f4.js → shared-b91650ba.js} +1 -1
  149. package/dist/cdn/{shared-62f3fc5a.js → shared-c73f6e8a.js} +3 -3
  150. package/dist/cdn/{shared-6dfb57b1.js → shared-c9f4fe97.js} +4 -4
  151. package/dist/cdn/{shared-f2721fae.js → shared-d2a79509.js} +1 -1
  152. package/dist/cdn/{shared-4885670b.js → shared-d67d56c2.js} +6 -6
  153. package/dist/cdn/{shared-34f4330c.js → shared-d7bb413b.js} +1 -1
  154. package/dist/cdn/{shared-8540c2c7.js → shared-ec0fb97f.js} +3 -3
  155. package/dist/cdn/{shared-da2a367a.js → shared-ec636065.js} +1 -1
  156. package/dist/cdn/{shared-292585a0.js → shared-eeb2d7ab.js} +1 -1
  157. package/dist/cdn/{shared-c5106605.js → shared-eef50424.js} +1 -1
  158. package/dist/cdn/{shared-04d8a434.js → shared-f635c052.js} +1 -1
  159. package/dist/cdn/{shared-b1c7300a.js → shared-fca5f5e3.js} +1 -1
  160. package/dist/cdn/translations/customer-portal/de.json +3 -3
  161. package/dist/cdn/translations/customer-portal/en.json +3 -3
  162. package/dist/cdn/translations/customer-portal/es.json +3 -3
  163. package/dist/cdn/translations/customer-portal/fr.json +3 -3
  164. package/dist/cdn/translations/customer-portal/nl.json +3 -3
  165. package/dist/cdn/translations/customer-portal/pl.json +3 -3
  166. package/dist/cdn/translations/customer-portal/sv.json +3 -3
  167. package/dist/cdn/translations/customer-portal/zh-hk.json +3 -3
  168. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +4 -1
  169. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
  170. package/dist/elements/internal/InternalSelectControl/types.d.ts +5 -1
  171. package/dist/elements/internal/InternalSelectControl/types.js.map +1 -1
  172. package/dist/elements/public/CustomerPortal/CustomerPortal.d.ts +1 -1
  173. package/dist/elements/public/CustomerPortal/CustomerPortal.js +1 -1
  174. package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
  175. package/dist/elements/public/{PaymentCardEmbedElement/PaymentCardEmbedElement.d.ts → PaymentCardEmbed/PaymentCardEmbed.d.ts} +3 -3
  176. package/dist/elements/public/{PaymentCardEmbedElement/PaymentCardEmbedElement.js → PaymentCardEmbed/PaymentCardEmbed.js} +4 -4
  177. package/dist/elements/public/PaymentCardEmbed/PaymentCardEmbed.js.map +1 -0
  178. package/dist/elements/public/PaymentCardEmbed/index.d.ts +5 -0
  179. package/dist/elements/public/PaymentCardEmbed/index.js +7 -0
  180. package/dist/elements/public/PaymentCardEmbed/index.js.map +1 -0
  181. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js +1 -1
  182. package/dist/elements/public/TemplateSetForm/TemplateSetForm.js.map +1 -1
  183. package/dist/elements/public/UpdatePaymentMethodForm/internal/InternalUpdatePaymentMethodFormCcTokenControl/InternalUpdatePaymentMethodFormCcTokenControl.js.map +1 -1
  184. package/dist/elements/public/UpdatePaymentMethodForm/internal/InternalUpdatePaymentMethodFormCcTokenControl/index.d.ts +1 -1
  185. package/dist/elements/public/UpdatePaymentMethodForm/internal/InternalUpdatePaymentMethodFormCcTokenControl/index.js +1 -1
  186. package/dist/elements/public/UpdatePaymentMethodForm/internal/InternalUpdatePaymentMethodFormCcTokenControl/index.js.map +1 -1
  187. package/dist/elements/public/index.d.ts +1 -1
  188. package/dist/elements/public/index.defined.d.ts +1 -1
  189. package/dist/elements/public/index.defined.js +1 -1
  190. package/dist/elements/public/index.defined.js.map +1 -1
  191. package/dist/elements/public/index.js +1 -1
  192. package/dist/elements/public/index.js.map +1 -1
  193. package/package.json +1 -1
  194. package/dist/cdn/foxy-payment-card-embed-element.js +0 -1
  195. package/dist/cdn/shared-5a18985c.js +0 -32
  196. package/dist/cdn/shared-f14856e0.js +0 -6
  197. package/dist/elements/public/PaymentCardEmbedElement/PaymentCardEmbedElement.js.map +0 -1
  198. package/dist/elements/public/PaymentCardEmbedElement/index.d.ts +0 -4
  199. package/dist/elements/public/PaymentCardEmbedElement/index.js +0 -6
  200. package/dist/elements/public/PaymentCardEmbedElement/index.js.map +0 -1
  201. /package/dist/cdn/{shared-102dfbe0.js → shared-8bd53409.js} +0 -0
@@ -1 +1 @@
1
- import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{_ as r}from"./shared-3c58ddf1.js";import{a as s}from"./shared-e989e47e.js";import{T as e}from"./shared-8452c492.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-a911ab73.js";import"./shared-2f2b5a28.js";import"./shared-bac00622.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./shared-f090c63a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";let a,d,o=r=>r;const i=s(e,"store-card");class m extends i{constructor(){super(...arguments),this.defaultDomain=null}static get properties(){return r(r({},super.properties),{},{defaultDomain:{attribute:"default-domain"}})}renderBody(){return super.renderBody({title:r=>t(a||(a=o`${0}`),r.store_name),subtitle:r=>{const s=this.defaultDomain,e=null==r?void 0:r.store_domain;return t(d||(d=o`${0}`),(null==e?void 0:e.includes("."))||!s?e:`${e}.${s}`)}})}}customElements.define("foxy-store-card",m);export{m as StoreCard};
1
+ import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{_ as r}from"./shared-3c58ddf1.js";import{a as s}from"./shared-e989e47e.js";import{T as e}from"./shared-8452c492.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-b7cda8ba.js";import"./shared-221d3788.js";import"./shared-71782a9e.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./shared-f090c63a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";let d,a,o=r=>r;const i=s(e,"store-card");class m extends i{constructor(){super(...arguments),this.defaultDomain=null}static get properties(){return r(r({},super.properties),{},{defaultDomain:{attribute:"default-domain"}})}renderBody(){return super.renderBody({title:r=>t(d||(d=o`${0}`),r.store_name),subtitle:r=>{const s=this.defaultDomain,e=null==r?void 0:r.store_domain;return t(a||(a=o`${0}`),(null==e?void 0:e.includes("."))||!s?e:`${e}.${s}`)}})}}customElements.define("foxy-store-card",m);export{m as StoreCard};
@@ -1 +1 @@
1
- import"./shared-7c819ebc.js";import"./shared-8540c2c7.js";import"./shared-e10b5dca.js";import"./shared-66a515e3.js";import"./shared-6dfb57b1.js";import"./shared-30143820.js";import"./shared-da2a367a.js";import"./shared-91009494.js";import"./shared-b55f1de3.js";import"./shared-e4403332.js";import"./shared-292585a0.js";import{I as e}from"./shared-036b25a3.js";import"./foxy-nucleon-element.js";import"./shared-ecb7a183.js";import{_ as t}from"./shared-3c58ddf1.js";import{R as o,a as i}from"./shared-e989e47e.js";import{i as r}from"./shared-9803aa7c.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import{a}from"./shared-12e531b8.js";import"./shared-f14856e0.js";import"./shared-2f2b5a28.js";import"./shared-61ade33e.js";import"./shared-b2ce84fa.js";import"./shared-34f4330c.js";import"./shared-a911ab73.js";import"./shared-e5f6ca48.js";import"./shared-51c4a6dd.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-84215d13.js";import"./shared-8c5b4c81.js";import"./shared-41e9ef02.js";import"./shared-5a18985c.js";import"./shared-0062cab1.js";import"./shared-651c44fa.js";import"./shared-4885670b.js";import"./shared-1ab8b12e.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-62f3fc5a.js";import"./shared-b99daf13.js";import"./shared-c0b1a51d.js";import"./shared-15fe01fe.js";import"./shared-337f2fe9.js";import"./shared-8d7e2e2c.js";import"./foxy-copy-to-clipboard.js";import"./shared-bac00622.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(i(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=100||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=200||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,i,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(i=this.data)||void 0===i?void 0:i.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),ie=Y.map((([e,t])=>({label:t,value:e}))),re=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} `),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,r(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,re,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",ie,te,(e=>{var t;const o=X.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody(),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce))}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const i=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:i,xml_datafeed:i,api_legacy:i,sso:i}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",i=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),i,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],i=this.disabledSelector.matches("currency-style",!0),r=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style" class="sm-col-span-2"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,i,r,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=a(t)}const i=parseInt(o.start||"0"),r=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(i+Math.floor(Math.random()*Math.pow(10,r)),Math.pow(10,r)-1),l=`${o.prefix}${s.toString().padStart(r,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,i.toString().padStart(r,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&i/10<=r?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,i,r,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(i=a.password)&&void 0!==i?i:"",security:null!==(r=a.security)&&void 0!==r?r:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},i=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),i,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),i,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),i,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),i,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-medium hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>n(w||(w=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),r(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",C);export{C as StoreForm};
1
+ import"./shared-15a947f3.js";import"./shared-ec0fb97f.js";import"./shared-7a5adb55.js";import"./shared-96077b62.js";import"./shared-c9f4fe97.js";import"./shared-0ac853c6.js";import"./shared-ec636065.js";import"./shared-1602c9a4.js";import"./shared-28e988c6.js";import"./shared-56b8e9ca.js";import"./shared-eeb2d7ab.js";import{I as e}from"./shared-9c3b800b.js";import"./foxy-nucleon-element.js";import"./shared-ecb7a183.js";import{_ as t}from"./shared-3c58ddf1.js";import{R as o,a as r}from"./shared-e989e47e.js";import{i}from"./shared-9803aa7c.js";import{c as s}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import{a}from"./shared-12e531b8.js";import"./shared-98f85be1.js";import"./shared-221d3788.js";import"./shared-43928f5a.js";import"./shared-61ade33e.js";import"./shared-75f3a59e.js";import"./shared-d7bb413b.js";import"./shared-b7cda8ba.js";import"./shared-e5f6ca48.js";import"./shared-51c4a6dd.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-5f65bdab.js";import"./shared-879fcb1f.js";import"./shared-21fec810.js";import"./shared-41e9ef02.js";import"./shared-82423f8b.js";import"./shared-0e9ad70e.js";import"./shared-651c44fa.js";import"./shared-51c3bc09.js";import"./shared-d67d56c2.js";import"./shared-a6e383ac.js";import"./shared-0f4947e8.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-c73f6e8a.js";import"./shared-9e014b51.js";import"./shared-5c4a29b9.js";import"./shared-3521ade9.js";import"./shared-85f44e3e.js";import"./shared-8d7e2e2c.js";import"./foxy-copy-to-clipboard.js";import"./shared-71782a9e.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let l,c,d,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w,q=e=>e;const O=o(r(e,"store-form"));class C extends O{constructor(){super(...arguments),this.customerPasswordHashTypes=null,this.shippingAddressTypes=null,this.storeVersions=null,this.checkoutTypes=null,this.localeCodes=null,this.languages=null,this.timezones=null,this.countries=null,this.regions=null,this.templates={},this.__singleCheckboxGroupOptions=[{label:"option_checked",value:"checked"}],this.__appSessionTimeOptions=[{value:"s",label:"second"},{value:"m",label:"minute"},{value:"h",label:"hour"},{value:"d",label:"day"}],this.__getStoreEmailValue=()=>{var e;return(null!==(e=this.form.store_email)&&void 0!==e?e:"").split(",").map((e=>({value:e.trim()}))).filter((({value:e})=>e.length>0))},this.__setStoreEmailValue=e=>{this.edit({store_email:e.map((e=>e.value)).join(",")})},this.__getBccOnReceiptEmailValue=()=>this.form.bcc_on_receipt_email?["checked"]:[],this.__setBccOnReceiptEmailValue=e=>{this.edit({bcc_on_receipt_email:e.includes("checked")})},this.__getUseEmailDnsValue=()=>this.form.use_email_dns?["checked"]:[],this.__setUseEmailDnsValue=e=>{this.edit({use_email_dns:e.includes("checked")})},this.__getUseSmtpConfigValue=()=>this.form.smtp_config?["checked"]:[],this.__setUseSmtpConfigValue=e=>{e.includes("checked")?this.edit({smtp_config:JSON.stringify({username:"",password:"",security:"",host:"",port:""})}):this.edit({smtp_config:""})},this.__getFeaturesMultishipValue=()=>this.form.features_multiship?["checked"]:[],this.__setFeaturesMultishipValue=e=>{this.edit({features_multiship:e.includes("checked")})},this.__getRequireSignedShippingRatesValue=()=>this.form.require_signed_shipping_rates?["checked"]:[],this.__setRequireSignedShippingRatesValue=e=>{this.edit({require_signed_shipping_rates:e.includes("checked")})},this.__getAppSessionTimeValue=()=>{const e=this.form.app_session_time||43200;return e%86400==0?e/86400+"d":e%3600==0?e/3600+"h":e%60==0?e/60+"m":`${e}s`},this.__setAppSessionTimeValue=e=>{const t=e[e.length-1],o=parseInt(e.substring(0,e.length-1));this.edit({app_session_time:{d:86400,h:3600,m:60,s:1}[t]*o})},this.__getProductsRequireExpiresPropertyValue=()=>this.form.products_require_expires_property?["checked"]:[],this.__setProductsRequireExpiresPropertyValue=e=>{this.edit({products_require_expires_property:e.includes("checked")})},this.__getUseCartValidationValue=()=>this.form.use_cart_validation?["checked"]:[],this.__setUseCartValidationValue=e=>{this.edit({use_cart_validation:e.includes("checked")})},this.__getSingleSignOnUrlValue=()=>{var e;return this.form.use_single_sign_on&&null!==(e=this.form.single_sign_on_url)&&void 0!==e?e:""},this.__setSingleSignOnUrlValue=e=>{this.edit({use_single_sign_on:!!e,single_sign_on_url:e})},this.__getWebhookUrlValue=()=>{var e;return this.form.use_webhook&&null!==(e=this.form.webhook_url)&&void 0!==e?e:""},this.__setWebhookUrlValue=e=>{this.edit({use_webhook:!!e,webhook_url:e})},this.__setStoreDomainValue=e=>{if(e.endsWith(".foxycart.com")){const t=e.substring(0,e.length-13);this.edit({store_domain:t,use_remote_domain:t.includes(".")})}else this.edit({store_domain:e,use_remote_domain:e.includes(".")})}}static get properties(){return t(t({},super.properties),{},{customerPasswordHashTypes:{attribute:"customer-password-hash-types"},shippingAddressTypes:{attribute:"shipping-address-types"},storeVersions:{attribute:"store-versions"},checkoutTypes:{attribute:"checkout-types"},localeCodes:{attribute:"locale-codes"},languages:{},timezones:{},countries:{},regions:{}})}static get v8n(){return[({store_name:e})=>!!e||"store-name:v8n_required",({store_name:e})=>e&&e.length<=50||"store-name:v8n_too_long",({store_domain:e})=>!!e||"store-domain:v8n_required",({store_domain:e})=>e&&e.length<=100||"store-domain:v8n_too_long",({store_url:e})=>!!e||"store-url:v8n_required",({store_url:e})=>e&&e.length<=300||"store-url:v8n_too_long",({receipt_continue_url:e})=>!e||e.length<=300||"receipt-continue-url:v8n_too_long",({store_email:e})=>!!e||"store-email:v8n_required",({store_email:e})=>e&&e.length<=300||"store-email:v8n_too_long",({from_email:e})=>!e||e.length<=100||"from-email:v8n_too_long",({smtp_config:e})=>!e||e.length<=1e3||"use-smtp-config:v8n_too_long",({postal_code:e})=>!!e||"postal-code:v8n_required",({postal_code:e})=>e&&e.length<=50||"postal-code:v8n_too_long",({region:e})=>!!e||"region:v8n_required",({region:e})=>e&&e.length<=100||"region:v8n_too_long",({country:e})=>!!e||"country:v8n_required",({logo_url:e})=>!e||e.length<=200||"logo-url:v8n_too_long",({webhook_url:e,use_webhook:t})=>!t||!!e||"webhook-url:v8n_required",({webhook_url:e,use_webhook:t})=>!t||!e||e.length<=300||"webhook-url:v8n_too_long",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!!e||"webhook-key:v8n_required",({webhook_key:e,use_webhook:t,use_cart_validation:o})=>!t&&!o||!e||e.length<=200||"webhook-key:v8n_too_long",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!!e||"single-sign-on-url:v8n_required",({single_sign_on_url:e,use_single_sign_on:t})=>!t||!e||e.length<=300||"single-sign-on-url:v8n_too_long",({customer_password_hash_config:e})=>!e||String(e).length<=100||"customer-password-hash-config:v8n_too_long",({unified_order_entry_password:e})=>!e||String(e).length<=100||"unified-order-entry-password:v8n_too_long",({custom_display_id_config:e})=>!e||String(e).length<=100||"custom-display-id-config-enabled:v8n_too_long"]}renderBody(){var e,t,o,r,s,a,u,_,p,h,m,f,g,y,x,b,v,$,V,k,j,S,w;const O=this.form.use_email_dns&&!(null===(e=this.data)||void 0===e?void 0:e.use_email_dns)&&!this.hiddenSelector.matches("use-email-dns",!0),C=this.form.require_signed_shipping_rates&&!(null===(t=this.data)||void 0===t?void 0:t.require_signed_shipping_rates)&&!this.hiddenSelector.matches("require-signed-shipping-rates",!0),U=this.form.products_require_expires_property&&!(null===(o=this.data)||void 0===o?void 0:o.products_require_expires_property)&&!this.hiddenSelector.matches("products-require-expires-property",!0),N=this.form.use_cart_validation&&!(null===(r=this.data)||void 0===r?void 0:r.use_cart_validation)&&!this.hiddenSelector.matches("use-cart-validation",!0),R=this.t(this.form.use_remote_domain&&!(null===(s=this.data)||void 0===s?void 0:s.use_remote_domain)?"store-domain.custom_domain_note":"store-domain.helper_text"),E=!this.form.store_domain||this.form.store_domain.includes(".")?"":".foxycart.com",J=this.__renderLoader(1),M=this.__renderLoader(2),T=this.__renderLoader(3),P=this.__renderLoader(4),D=this.__renderLoader(5),L=this.__renderLoader(6),W=this.__renderLoader(7),A=this.__renderLoader(8),B=this.__renderLoader(9),G=Object.entries(null!==(u=null===(a=null==M?void 0:M.data)||void 0===a?void 0:a.values)&&void 0!==u?u:{}),I=null==P?void 0:P.data,z=null==D?void 0:D.data,F=null==L?void 0:L.data,H=null!==(p=null===(_=null==W?void 0:W.data)||void 0===_?void 0:_.values.timezone)&&void 0!==p?p:[],K=Object.values(null!==(m=null===(h=null==A?void 0:A.data)||void 0===h?void 0:h.values)&&void 0!==m?m:{}),Q=Object.values(null!==(g=null===(f=null==B?void 0:B.data)||void 0===f?void 0:f.values)&&void 0!==g?g:{}),X=Object.entries(null!==(x=null===(y=null==J?void 0:J.data)||void 0===y?void 0:y.values)&&void 0!==x?x:{}),Y=Object.entries(null!==(v=null===(b=null==T?void 0:T.data)||void 0===b?void 0:b.values)&&void 0!==v?v:{}),Z=Object.entries(null!==($=null==z?void 0:z.values)&&void 0!==$?$:{}),ee=Object.entries(null!==(V=null==F?void 0:F.values)&&void 0!==V?V:{}),te=X.map((e=>({label:e[1].description,value:e[0]}))),oe=G.map((([e,t])=>({label:t,value:e}))),re=Y.map((([e,t])=>({label:t,value:e}))),ie=Z.map((([e,t])=>({value:e,label:t}))),se=ee.map((([e,t])=>({value:e,label:t}))),ne=H.map((e=>({label:e.description,value:e.timezone}))),ae=K.map((e=>({label:e.default,value:e.cc2}))),le=Q.map((e=>({label:e.default,value:e.code})));let ce;try{const e=new URL(null!==(k=this.regions)&&void 0!==k?k:""),t=this.form.country;t&&e.searchParams.set("country_code",t),ce=e.toString()}catch(e){ce=void 0}return n(l||(l=q` <div class="grid gap-m grid-cols-1 sm-grid-cols-2"> <foxy-internal-text-control infer="store-name"></foxy-internal-text-control> <foxy-internal-text-control infer="logo-url"></foxy-internal-text-control> <foxy-internal-text-control helper-text="${0}" suffix="${0}" infer="store-domain" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="store-url"></foxy-internal-text-control> <foxy-internal-editable-list-control infer="store-email" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-select-control infer="timezone" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="version" item-value-path="_links.self.href" infer="store-version-uri" first="${0}" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="from-email" class="sm-col-span-2" placeholder="${0}"> </foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="bcc-on-receipt-email" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="use-email-dns" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-smtp-config" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-select-control infer="shipping-address-type" .options="${0}"> </foxy-internal-select-control> <foxy-internal-checkbox-group-control infer="features-multiship" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="require-signed-shipping-rates" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="locale-code" .options="${0}"> </foxy-internal-select-control> ${0} ${0} <foxy-internal-text-control class="sm-col-span-2" infer="receipt-continue-url"> </foxy-internal-text-control> <foxy-internal-frequency-control class="sm-col-span-2" infer="app-session-time" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-frequency-control> <foxy-internal-checkbox-group-control infer="products-require-expires-property" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-checkbox-group-control infer="use-cart-validation" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-select-control infer="checkout-type" class="sm-col-span-2" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="customer-password-hash-type" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-password-control infer="unified-order-entry-password"> </foxy-internal-password-control> <foxy-internal-text-control infer="single-sign-on-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webhook-url" class="sm-col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} ${0} </div> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} `),R,E,this.__setStoreDomainValue,this.__getStoreEmailValue,this.__setStoreEmailValue,ne,i(null!==(j=this.storeVersions)&&void 0!==j?j:void 0),I,null!==(w=null===(S=this.__getStoreEmailValue()[0])||void 0===S?void 0:S.value)&&void 0!==w?w:this.t("from-email.placeholder"),this.__getBccOnReceiptEmailValue,this.__setBccOnReceiptEmailValue,this.__singleCheckboxGroupOptions,this.__getUseEmailDnsValue,this.__setUseEmailDnsValue,this.__singleCheckboxGroupOptions,O?this.__renderWarning("use_email_dns_helper_text",{href:"https://wiki.foxycart.com/v/1.1/emails#how_emails_are_sent_spf_dkim_dmarc_etc",caption:"How Emails Are Sent (SPF, DKIM, DMARC, etc.)"}):"",this.__getUseSmtpConfigValue,this.__setUseSmtpConfigValue,this.__singleCheckboxGroupOptions,this.form.smtp_config&&!this.hiddenSelector.matches("smtp-config",!0)?this.__renderSmtpConfig():"",ae,le,oe,this.__getFeaturesMultishipValue,this.__setFeaturesMultishipValue,this.__singleCheckboxGroupOptions,this.__getRequireSignedShippingRatesValue,this.__setRequireSignedShippingRatesValue,this.__singleCheckboxGroupOptions,C?this.__renderWarning("require_signed_shipping_rates_helper_text"):"",se,ie,this.hiddenSelector.matches("currency-style",!0)?"":this.__renderCurrencyStyleSelector(),this.hiddenSelector.matches("custom-display-id-config",!0)?"":this.__renderCustomIDSettings(),this.__getAppSessionTimeValue,this.__setAppSessionTimeValue,this.__appSessionTimeOptions,this.__getProductsRequireExpiresPropertyValue,this.__setProductsRequireExpiresPropertyValue,this.__singleCheckboxGroupOptions,U?this.__renderWarning("products_require_expires_property_helper_text"):"",this.__getUseCartValidationValue,this.__setUseCartValidationValue,this.__singleCheckboxGroupOptions,N?this.__renderWarning("use_cart_validation_helper_text",{href:"https://wiki.foxycart.com/v/2.0/hmac_validation",caption:"HMAC Product Verification: Locking Down your Add-To-Cart Links and Forms"}):"",re,te,(e=>{var t;const o=X.find((([t])=>t===e));this.edit({customer_password_hash_type:e,customer_password_hash_config:null!==(t=null==o?void 0:o[1].config)&&void 0!==t?t:""})}),"number"==typeof this.form.customer_password_hash_config?n(c||(c=q` <foxy-internal-number-control infer="customer-password-hash-config"> </foxy-internal-number-control> `)):n(d||(d=q` <foxy-internal-text-control infer="customer-password-hash-config"> </foxy-internal-text-control> `)),this.__getSingleSignOnUrlValue,this.__setSingleSignOnUrlValue,this.__getWebhookUrlValue,this.__setWebhookUrlValue,this.__renderWebhookKey(),this.data&&!this.hiddenSelector.matches("is-maintenance-mode",!0)?this.__renderMaintenanceModeSwitch():"",super.renderBody(),J.render(this.customerPasswordHashTypes),M.render(this.shippingAddressTypes),T.render(this.checkoutTypes),P.render(this.form.store_version_uri),D.render(this.localeCodes),W.render(this.timezones),A.render(this.countries),L.render(this.languages),B.render(ce))}__renderWebhookKey(){var e,t;let o;try{o=JSON.parse(null!==(e=this.form.webhook_key)&&void 0!==e?e:"")}catch(e){const r=null!==(t=this.form.webhook_key)&&void 0!==t?t:"";o={cart_signing:r,xml_datafeed:r,api_legacy:r,sso:r}}return Object.keys(o).map((e=>n(u||(u=q` <foxy-internal-password-control infer="webhook-key-${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),e.replace("_","-"),(()=>o[e]),(t=>{o[e]=t,this.edit({webhook_key:JSON.stringify(o)})}))))}__renderMaintenanceModeSwitch(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.is_maintenance_mode),o=(t?"disable":"enable")+"_maintenance_mode",r=`maintenance_mode_${t?"on":"off"}_explainer`;return n(_||(_=q` <div data-testid="is-maintenance-mode" class="${0}"> <foxy-i18n infer="" class="block mb-s" key="${0}"></foxy-i18n> <vaadin-button theme="tertiary small ${0}" class="p-0" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}"></foxy-i18n> </vaadin-button> </div> `),s({"rounded leading-s text-s sm-col-span-2":!0,"text-tertiary":!t,"text-error":t}),r,t?"contrast":"",this.disabledSelector.matches("is-maintenance-mode",!0),(()=>{this.edit({is_maintenance_mode:!this.form.is_maintenance_mode}),this.submit()}),o)}__renderCurrencyStyleSelector(){const e={101:0,100:0,"001":1,"000":2,111:3,110:3,"011":4,"010":5},t=[this.form.hide_currency_symbol,this.form.hide_decimal_characters,this.form.use_international_currency_symbol].map((e=>Number(Boolean(e)))).join(""),o=e[t],r=this.disabledSelector.matches("currency-style",!0),i=this.readonlySelector.matches("currency-style",!0);return n(p||(p=q` <div data-testid="currency-style" class="sm-col-span-2"> ${0} <div class="grid grid-cols-1 gap-xs transition-colors text-secondary hover-text-body sm-col-span-2"> <foxy-i18n infer="" class="font-medium text-s" key="currency_style_label"></foxy-i18n> <div class="grid grid-cols-3 bg-contrast-10 rounded" style="gap:1px;padding:1px"> ${0} </div> <foxy-i18n infer="" class="text-xs" key="currency_style_helper_text"></foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("currency-style:before"),["12.34","USD 12.34","$12.34","12","USD 12","$12"].map(((t,a)=>n(h||(h=q` <label style="--lumo-border-radius:calc(var(--lumo-border-radius-m) - 1px)" class="${0}"> <span class="font-medium font-tnum">${0}</span> <input class="sr-only" value="${0}" type="radio" name="currency-style" ?checked="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </label> `),s({"relative z-0 px-s h-m flex items-center transition-colors":!0,"hover-cursor-pointer":!0,"focus-within-z-10 focus-within-ring-2 focus-within-ring-primary-50":!0,"bg-base text-body hover-bg-transparent":a!==o,"bg-primary text-primary-contrast":a===o,"rounded-tl":0===a,"rounded-tr":2===a,"rounded-bl":3===a,"rounded-br":5===a}),t,a,a===o,r,i,(()=>{const t=Object.entries(e).find((e=>e[1]===a))[0];this.edit({hide_currency_symbol:Boolean(Number(t[0])),hide_decimal_characters:Boolean(Number(t[1])),use_international_currency_symbol:Boolean(Number(t[2]))})})))),this.renderTemplateOrSlot("currency-style:after"))}__renderCustomIDSettings(){var e;const t={enabled:!1,start:"0",length:"0",prefix:"",suffix:"",transaction_journal_entries:{enabled:!1,transaction_separator:"",log_detail_request_types:{transaction_authcapture:{prefix:""},transaction_capture:{prefix:""},transaction_refund:{prefix:""},transaction_void:{prefix:""}}}};let o;try{o=JSON.parse(null!==(e=this.form.custom_display_id_config)&&void 0!==e?e:"")}catch(e){o=a(t)}const r=parseInt(o.start||"0"),i=parseInt(o.length||"0")-o.prefix.length-o.suffix.length,s=Math.min(r+Math.floor(Math.random()*Math.pow(10,i)),Math.pow(10,i)-1),l=`${o.prefix}${s.toString().padStart(i,"0")}${o.suffix}`,c=Math.floor(1e3*Math.random()),d=String(c).padStart(3,"0");return n(m||(m=q` <foxy-internal-checkbox-group-control infer="custom-display-id-config-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>o.enabled?["checked"]:[]),(e=>{o.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.enabled?n(f||(f=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-integer-control infer="custom-display-id-config-start" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="custom-display-id-config-length" min="0" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-text-control infer="custom-display-id-config-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-suffix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> <foxy-internal-checkbox-group-control infer="custom-display-id-config-transaction-journal-entries-enabled" class="-mt-xs -mb-m sm-col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),(()=>parseInt(o.start||"0")),(e=>{o.start=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>parseInt(o.length||"0")),(e=>{o.length=String(e),this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.prefix),(e=>{o.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.suffix),(e=>{o.suffix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&r/10<=i?n(g||(g=q` <table data-testid="custom-display-id-config-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-first-example"> </foxy-i18n> </td> <td> ${0}${0}${0} </td> </tr> <tr style="width:1%"> <td> <foxy-i18n infer="" key="custom-display-id-config-random-example"> </foxy-i18n> </td> <td>${0}</td> </tr> </tbody> </table> `),o.prefix,r.toString().padStart(i,"0"),o.suffix,l):"",(()=>o.transaction_journal_entries.enabled?["checked"]:[]),(e=>{o.transaction_journal_entries.enabled=e.includes("checked"),this.edit({custom_display_id_config:JSON.stringify(o)})}),this.__singleCheckboxGroupOptions,o.transaction_journal_entries.enabled?n(y||(y=q` <div class="rounded-t-l rounded-b-l border border-contrast-10 p-m grid grid-cols-2 gap-m sm-col-span-2"> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-transaction-separator" class="col-span-2" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-authcapture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-capture-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-void-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="custom-display-id-config-transaction-journal-entries-log-detail-request-types-transaction-refund-prefix" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> ${0} </div> `),(()=>o.transaction_journal_entries.transaction_separator),(e=>{o.transaction_journal_entries.transaction_separator=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),(()=>o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix),(e=>{o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix=e,this.edit({custom_display_id_config:JSON.stringify(o)})}),o.start&&o.length&&r/10<=i?n(x||(x=q` <table data-testid="custom-display-id-config-transaction-journal-entries-examples" style="font-family:monospace" class="col-span-2 text-xs text-secondary whitespace-nowrap"> <tbody> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-authcapture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-capture-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-void-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> <tr> <td style="width:1%"> <foxy-i18n infer="" key="custom-display-id-config-transaction-journal-entries-refund-example"> </foxy-i18n> </td> <td> ${0}${0}${0}${0} </td> </tr> </tbody> </table> `),l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_authcapture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_capture.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_void.prefix,d,l,o.transaction_journal_entries.transaction_separator,o.transaction_journal_entries.log_detail_request_types.transaction_refund.prefix,d):""):""):"")}__renderSmtpConfig(){return n(b||(b=q` <div class="grid grid-cols-2 gap-m p-m rounded-t-l rounded-b-l border border-contrast-10 sm-col-span-2"> ${0} </div> `),["host","port","username","password","security"].map((e=>{const t=()=>JSON.parse(this.form.smtp_config||"{}")[e],o=t=>{var o,r,i,s,n;const a=JSON.parse(this.form.smtp_config||"{}");this.edit({smtp_config:JSON.stringify({username:null!==(o=a.username)&&void 0!==o?o:"",password:null!==(r=a.password)&&void 0!==r?r:"",security:null!==(i=a.security)&&void 0!==i?i:"",host:null!==(s=a.host)&&void 0!==s?s:"",port:null!==(n=a.port)&&void 0!==n?n:"",[e]:t})})},r=`smtp-config-${e}`;return"password"===e?n(v||(v=q` <foxy-internal-password-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),r,t,o):"port"===e?n($||($=q` <foxy-internal-integer-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> `),r,t,o):"security"===e?n(V||(V=q` <foxy-internal-radio-group-control infer="${0}" class="-mt-xs -mx-xs -mb-m col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),r,t,o,[{label:"option_ssl",value:"ssl"},{label:"option_tls",value:"tls"},{label:"option_none",value:""}]):n(k||(k=q` <foxy-internal-text-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),r,t,o)})))}__renderWarning(e,t){return n(j||(j=q` <div class="p-s leading-m text-s rounded bg-primary-10 text-primary sm-col-span-2"> <foxy-i18n infer="" key="${0}"></foxy-i18n> ${0} </div> `),e,t?n(S||(S=q` <a target="_blank" class="font-medium hover-underline rounded focus-outline-none focus-ring-2 focus-ring-primary" href="${0}" lang="en"> ${0} <iron-icon class="icon-inline" icon="icons:open-in-new"></iron-icon> </a> `),t.href,t.caption):"")}__renderLoader(e){var t;const o=`loader-${e}`;return{data:null===(t=this.renderRoot.querySelector(`#${o}`))||void 0===t?void 0:t.data,render:e=>n(w||(w=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),i(null!=e?e:void 0),o,(()=>this.requestUpdate()))}}}customElements.define("foxy-store-form",C);export{C as StoreForm};
@@ -1 +1 @@
1
- import"./shared-e10b5dca.js";import"./shared-8540c2c7.js";import"./shared-cb732375.js";import"./shared-da2a367a.js";import"./shared-292585a0.js";import{I as e}from"./shared-036b25a3.js";import"./foxy-nucleon-element.js";import{a as i}from"./shared-e5f6ca48.js";import"./foxy-pagination.js";import"./shared-ecb7a183.js";import"./foxy-spinner.js";import"./shared-b2ce84fa.js";import{_ as t,B as r}from"./shared-3c58ddf1.js";import{C as s}from"./shared-bd99107c.js";import{N as n}from"./shared-272e7269.js";import{T as o,a as d}from"./shared-e989e47e.js";import{h as a}from"./shared-dc73b9a5.js";import{i as l}from"./shared-9803aa7c.js";import{c as p}from"./shared-4e709717.js";import"./shared-84215d13.js";import"./shared-f14856e0.js";import"./shared-2f2b5a28.js";import"./shared-8c5b4c81.js";import"./shared-a911ab73.js";import"./shared-41e9ef02.js";import"./shared-5a18985c.js";import"./shared-0062cab1.js";import"./shared-651c44fa.js";import"./shared-4885670b.js";import"./shared-34f4330c.js";import"./shared-61ade33e.js";import"./shared-1ab8b12e.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-328e5fdc.js";import"./shared-15fe01fe.js";import"./shared-7c819ebc.js";import"./shared-337f2fe9.js";import"./shared-8d7e2e2c.js";import"./shared-2808f43a.js";import"./foxy-copy-to-clipboard.js";import"./shared-bac00622.js";import"./shared-bab2ea2c.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-51c4a6dd.js";let h,c=e=>e;const m=s(o(n));customElements.define("foxy-internal-store-shipping-method-form-services-page-item-content",class extends m{constructor(){super(...arguments),this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{shippingServiceUri:{attribute:"shipping-service-uri"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){return a(h||(h=c` <div class="h-full flex items-center"> <vaadin-checkbox data-testid="checkbox" class="w-full" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </vaadin-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{var i,t;e.currentTarget.checked?(this.edit({shipping_service_uri:null!==(i=this.shippingServiceUri)&&void 0!==i?i:"",shipping_method_uri:null!==(t=this.shippingMethodUri)&&void 0!==t?t:""}),this.submit()):this.delete()}))}});let f,u=e=>e;const v=s(o(n));customElements.define("foxy-internal-store-shipping-method-form-services-page-item",class extends v{constructor(){super(...arguments),this.internationalAllowed=!1,this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingServiceUri:{attribute:"shipping-service-uri"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){var e,i,t;const r=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:store_shipping_services"][0],s=r?void 0:this.href,n=r?r._links.self.href:void 0;return a(f||(f=u` <foxy-internal-store-shipping-method-form-services-page-item-content shipping-service-uri="${0}" shipping-method-uri="${0}" data-testid="content" parent="${0}" class="h-full" infer="" href="${0}"> <slot></slot> <span class="${0}"> <slot name="suffix"></slot> </span> </foxy-internal-store-shipping-method-form-services-page-item-content> `),l(null!==(i=this.shippingServiceUri)&&void 0!==i?i:void 0),l(null!==(t=this.shippingMethodUri)&&void 0!==t?t:void 0),l(s),l(n),this.internationalAllowed||!n?"text-tertiary":"text-error")}});let g,_,x,y,b=e=>e;const j=s(o(d(n)));customElements.define("foxy-internal-store-shipping-method-form-services-page",class extends j{constructor(){super(...arguments),this.storeShippingServicesUri=null,this.internationalAllowed=!1,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{storeShippingServicesUri:{attribute:"store-shipping-services-uri"},internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){var e,i,t;const r=null!==(i=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:shipping_services"])&&void 0!==i?i:[];let s=20;try{const e=parseInt(null!==(t=new URL(this.href).searchParams.get("limit"))&&void 0!==t?t:"");isNaN(e)||(s=e)}catch(e){}return a(g||(g=b` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" infer=""> </foxy-spinner> </div> </div> `),new Array(s).fill(0).map(((e,i)=>{var t,s;const n=r[i];let o;if(n)try{const e=new URL(null!==(t=this.storeShippingServicesUri)&&void 0!==t?t:""),i=new URL(n._links.self.href).pathname.split("/").pop();e.searchParams.set("shipping_service_id",i),e.searchParams.set("limit","1"),o=e.toString()}catch(e){}return o?a(x||(x=b` <foxy-internal-store-shipping-method-form-services-page-item shipping-service-uri="${0}" shipping-method-uri="${0}" data-testclass="item" class="h-l truncate" infer="" href="${0}" ?international-allowed="${0}"> ${0} ${0} </foxy-internal-store-shipping-method-form-services-page-item> `),n._links.self.href,l(null!==(s=this.shippingMethodUri)&&void 0!==s?s:void 0),o,this.internationalAllowed,null==n?void 0:n.name,n.is_international?a(y||(y=b`<foxy-i18n infer="" slot="suffix" key="international_only"></foxy-i18n>`)):""):a(_||(_=b`<div class="h-l"></div>`))})),p({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy")}});let $,U,S=e=>e;customElements.define("foxy-internal-store-shipping-method-form-services-control",class extends i{renderControl(){var e,i;const t=null===(e=this.nucleon)||void 0===e?void 0:e.data,r=null===(i=this.nucleon)||void 0===i?void 0:i.form;if(!t)return a($||($=S``));const s=new URL(t._links["fx:shipping_services"].href);return s.searchParams.set("limit","10"),a(U||(U=S` <foxy-pagination first="${0}" infer=""> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="label"> </foxy-i18n> <foxy-internal-store-shipping-method-form-services-page store-shipping-services-uri="${0}" shipping-method-uri="${0}" class="border border-contrast-10 rounded mb-s" infer="" ?international-allowed="${0}"> </foxy-internal-store-shipping-method-form-services-page> </foxy-pagination> `),s.toString(),t._links["fx:store_shipping_services"].href,t._links["fx:shipping_method"].href,!!r.use_for_international)}});let k,w,M,T,P=e=>e;const E=d(e,"store-shipping-method-form"),O=e=>{try{return new URL(e),!0}catch(e){return!1}};class I extends E{constructor(){super(...arguments),this.shippingMethods=null,this.templates={},this.__destinations=[{value:"domestic",label:"domestic"},{value:"international",label:"international"}],this.__getDestinations=()=>{const e=[];return this.form.use_for_domestic&&e.push("domestic"),this.form.use_for_international&&e.push("international"),e},this.__setDestinations=e=>{this.edit({use_for_domestic:e.includes("domestic"),use_for_international:e.includes("international")})}}static get properties(){return t(t({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"}})}static get v8n(){return[({shipping_method_uri:e})=>e&&O(e)||"shipping-method-uri:v8n_required",({accountid:e})=>!e||e.length<=50||"accountid:v8n_too_long",({password:e})=>!e||e.length<=50||"password:v8n_too_long",({meter_number:e})=>!e||e.length<=50||"meter-number:v8n_too_long",({authentication_key:e})=>!e||e.length<=50||"authentication-key:v8n_too_long",({custom_code:e})=>!e||new Blob([e]).size/1024<=64||"custom-code:v8n_too_long",e=>{var i,t;return"CUSTOM-ENDPOINT-POST"!==(null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code)||(e.accountid&&O(e.accountid)||"endpoint:v8n_required")},e=>{var i,t;const r=e.shipping_container_uri,s=null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code;return!s||!["USPS","FedEx","UPS"].includes(s)||(r&&O(r)||"shipping-container-uri:v8n_required")},e=>{var i,t;const r=e.shipping_drop_type_uri,s=null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code;return!s||!["FedEx","UPS"].includes(s)||(r&&O(r)||"shipping-drop-type-uri:v8n_required")}]}get hiddenSelector(){var e;const i=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"].code;if(!i)return new r("not=shipping-method-uri,timestamps,create,delete");const t=["shipping-container-uri","shipping-drop-type-uri","destinations"],s=["authentication-key","meter-number","accountid","password"],n={"CUSTOM-ENDPOINT-POST":["endpoint"],"CUSTOM-CODE":["custom-code"],CUSTOM:["destinations","services"],FedEx:[...t,...s,"services"],USPS:[...t,"services"],UPS:[...t,...s,"services"]};if(n[i]){const e=["shipping-method-uri",...n[i],"timestamps","delete","create"];return new r(`not=${e.join()} ${super.hiddenSelector}`)}return super.hiddenSelector}renderBody(){var e,i,r,s,n,o,d,p,h;const c=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"];return a(k||(k=P` ${0} <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-method-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-container-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-drop-type-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-checkbox-group-control infer="destinations" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-text-control infer="authentication-key"></foxy-internal-text-control> <foxy-internal-text-control infer="meter-number"></foxy-internal-text-control> ${0} <foxy-internal-password-control infer="password"></foxy-internal-password-control> <foxy-internal-text-area-control infer="custom-code"></foxy-internal-text-area-control> <foxy-internal-store-shipping-method-form-services-control infer="services"> </foxy-internal-store-shipping-method-form-services-control> ${0} `),["method","container","drop_type"].map((e=>{var i;const r=`fx:shipping_${e}`,s=`shipping_${e}_uri`;if(!(null===(i=this.form._embedded)||void 0===i?void 0:i[r])&&this.form[s])return a(w||(w=P` <foxy-nucleon class="hidden" infer="" href="${0}" @update="${0}"> </foxy-nucleon> `),this.form[s],(e=>{const i=e.currentTarget.data;if(i){const e=t(t({},this.form._embedded),{},{[r]:i});this.edit({_embedded:e})}}))})),l(null!==(i=this.shippingMethods)&&void 0!==i?i:null===(r=this.form._links)||void 0===r?void 0:r["fx:shipping_methods"].href),null!==(n=null===(s=this.form._embedded)||void 0===s?void 0:s["fx:shipping_method"])&&void 0!==n?n:null,(e=>{var i,t;const{selectedItem:r}=e.currentTarget,s={"fx:shipping_method":r};this.edit({_embedded:s,shipping_container_uri:"",shipping_drop_type_uri:"",shipping_method_uri:null!==(t=null===(i=r)||void 0===i?void 0:i._links.self.href)&&void 0!==t?t:""})}),l(null==c?void 0:c._links["fx:shipping_containers"].href),null!==(d=null===(o=this.form._embedded)||void 0===o?void 0:o["fx:shipping_container"])&&void 0!==d?d:null,(e=>{var i,r;const{selectedItem:s}=e.currentTarget,n=t(t({},this.form._embedded),{},{"fx:shipping_container":s});this.edit({shipping_container_uri:null!==(r=null===(i=s)||void 0===i?void 0:i._links.self.href)&&void 0!==r?r:"",_embedded:n})}),l(null==c?void 0:c._links["fx:shipping_drop_types"].href),null!==(h=null===(p=this.form._embedded)||void 0===p?void 0:p["fx:shipping_drop_type"])&&void 0!==h?h:null,(e=>{var i,r;const{selectedItem:s}=e.currentTarget,n=t(t({},this.form._embedded),{},{"fx:shipping_drop_type":s});this.edit({shipping_drop_type_uri:null!==(r=null===(i=s)||void 0===i?void 0:i._links.self.href)&&void 0!==r?r:"",_embedded:n})}),this.__getDestinations,this.__setDestinations,this.__destinations,"CUSTOM-ENDPOINT-POST"===(null==c?void 0:c.code)?a(M||(M=P` <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> `)):a(T||(T=P`<foxy-internal-text-control infer="accountid"></foxy-internal-text-control>`)),super.renderBody())}}customElements.define("foxy-store-shipping-method-form",I);export{I as StoreShippingMethodForm};
1
+ import"./shared-7a5adb55.js";import"./shared-ec0fb97f.js";import"./shared-9bd371c7.js";import"./shared-ec636065.js";import"./shared-eeb2d7ab.js";import{I as e}from"./shared-9c3b800b.js";import"./foxy-nucleon-element.js";import{a as i}from"./shared-e5f6ca48.js";import"./foxy-pagination.js";import"./shared-ecb7a183.js";import"./foxy-spinner.js";import"./shared-75f3a59e.js";import{_ as t,B as r}from"./shared-3c58ddf1.js";import{C as s}from"./shared-bd99107c.js";import{N as n}from"./shared-272e7269.js";import{T as o,a as d}from"./shared-e989e47e.js";import{h as a}from"./shared-dc73b9a5.js";import{i as l}from"./shared-9803aa7c.js";import{c as p}from"./shared-4e709717.js";import"./shared-5f65bdab.js";import"./shared-98f85be1.js";import"./shared-221d3788.js";import"./shared-879fcb1f.js";import"./shared-21fec810.js";import"./shared-b7cda8ba.js";import"./shared-41e9ef02.js";import"./shared-43928f5a.js";import"./shared-82423f8b.js";import"./shared-0e9ad70e.js";import"./shared-651c44fa.js";import"./shared-51c3bc09.js";import"./shared-d67d56c2.js";import"./shared-d7bb413b.js";import"./shared-61ade33e.js";import"./shared-a6e383ac.js";import"./shared-0f4947e8.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-849413bb.js";import"./shared-3521ade9.js";import"./shared-15a947f3.js";import"./shared-85f44e3e.js";import"./shared-8d7e2e2c.js";import"./shared-2808f43a.js";import"./foxy-copy-to-clipboard.js";import"./shared-71782a9e.js";import"./shared-bab2ea2c.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-51c4a6dd.js";let h,c=e=>e;const m=s(o(n));customElements.define("foxy-internal-store-shipping-method-form-services-page-item-content",class extends m{constructor(){super(...arguments),this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{shippingServiceUri:{attribute:"shipping-service-uri"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){return a(h||(h=c` <div class="h-full flex items-center"> <vaadin-checkbox data-testid="checkbox" class="w-full" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </vaadin-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{var i,t;e.currentTarget.checked?(this.edit({shipping_service_uri:null!==(i=this.shippingServiceUri)&&void 0!==i?i:"",shipping_method_uri:null!==(t=this.shippingMethodUri)&&void 0!==t?t:""}),this.submit()):this.delete()}))}});let f,u=e=>e;const v=s(o(n));customElements.define("foxy-internal-store-shipping-method-form-services-page-item",class extends v{constructor(){super(...arguments),this.internationalAllowed=!1,this.shippingServiceUri=null,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingServiceUri:{attribute:"shipping-service-uri"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){var e,i,t;const r=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:store_shipping_services"][0],s=r?void 0:this.href,n=r?r._links.self.href:void 0;return a(f||(f=u` <foxy-internal-store-shipping-method-form-services-page-item-content shipping-service-uri="${0}" shipping-method-uri="${0}" data-testid="content" parent="${0}" class="h-full" infer="" href="${0}"> <slot></slot> <span class="${0}"> <slot name="suffix"></slot> </span> </foxy-internal-store-shipping-method-form-services-page-item-content> `),l(null!==(i=this.shippingServiceUri)&&void 0!==i?i:void 0),l(null!==(t=this.shippingMethodUri)&&void 0!==t?t:void 0),l(s),l(n),this.internationalAllowed||!n?"text-tertiary":"text-error")}});let g,_,x,b,y=e=>e;const j=s(o(d(n)));customElements.define("foxy-internal-store-shipping-method-form-services-page",class extends j{constructor(){super(...arguments),this.storeShippingServicesUri=null,this.internationalAllowed=!1,this.shippingMethodUri=null}static get properties(){return t(t({},super.properties),{},{storeShippingServicesUri:{attribute:"store-shipping-services-uri"},internationalAllowed:{type:Boolean,attribute:"international-allowed"},shippingMethodUri:{attribute:"shipping-method-uri"}})}render(){var e,i,t;const r=null!==(i=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:shipping_services"])&&void 0!==i?i:[];let s=20;try{const e=parseInt(null!==(t=new URL(this.href).searchParams.get("limit"))&&void 0!==t?t:"");isNaN(e)||(s=e)}catch(e){}return a(g||(g=y` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" infer=""> </foxy-spinner> </div> </div> `),new Array(s).fill(0).map(((e,i)=>{var t,s;const n=r[i];let o;if(n)try{const e=new URL(null!==(t=this.storeShippingServicesUri)&&void 0!==t?t:""),i=new URL(n._links.self.href).pathname.split("/").pop();e.searchParams.set("shipping_service_id",i),e.searchParams.set("limit","1"),o=e.toString()}catch(e){}return o?a(x||(x=y` <foxy-internal-store-shipping-method-form-services-page-item shipping-service-uri="${0}" shipping-method-uri="${0}" data-testclass="item" class="h-l truncate" infer="" href="${0}" ?international-allowed="${0}"> ${0} ${0} </foxy-internal-store-shipping-method-form-services-page-item> `),n._links.self.href,l(null!==(s=this.shippingMethodUri)&&void 0!==s?s:void 0),o,this.internationalAllowed,null==n?void 0:n.name,n.is_international?a(b||(b=y`<foxy-i18n infer="" slot="suffix" key="international_only"></foxy-i18n>`)):""):a(_||(_=y`<div class="h-l"></div>`))})),p({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy")}});let $,U,S=e=>e;customElements.define("foxy-internal-store-shipping-method-form-services-control",class extends i{renderControl(){var e,i;const t=null===(e=this.nucleon)||void 0===e?void 0:e.data,r=null===(i=this.nucleon)||void 0===i?void 0:i.form;if(!t)return a($||($=S``));const s=new URL(t._links["fx:shipping_services"].href);return s.searchParams.set("limit","10"),a(U||(U=S` <foxy-pagination first="${0}" infer=""> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="label"> </foxy-i18n> <foxy-internal-store-shipping-method-form-services-page store-shipping-services-uri="${0}" shipping-method-uri="${0}" class="border border-contrast-10 rounded mb-s" infer="" ?international-allowed="${0}"> </foxy-internal-store-shipping-method-form-services-page> </foxy-pagination> `),s.toString(),t._links["fx:store_shipping_services"].href,t._links["fx:shipping_method"].href,!!r.use_for_international)}});let k,w,M,T,P=e=>e;const E=d(e,"store-shipping-method-form"),O=e=>{try{return new URL(e),!0}catch(e){return!1}};class I extends E{constructor(){super(...arguments),this.shippingMethods=null,this.templates={},this.__destinations=[{value:"domestic",label:"domestic"},{value:"international",label:"international"}],this.__getDestinations=()=>{const e=[];return this.form.use_for_domestic&&e.push("domestic"),this.form.use_for_international&&e.push("international"),e},this.__setDestinations=e=>{this.edit({use_for_domestic:e.includes("domestic"),use_for_international:e.includes("international")})}}static get properties(){return t(t({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"}})}static get v8n(){return[({shipping_method_uri:e})=>e&&O(e)||"shipping-method-uri:v8n_required",({accountid:e})=>!e||e.length<=50||"accountid:v8n_too_long",({password:e})=>!e||e.length<=50||"password:v8n_too_long",({meter_number:e})=>!e||e.length<=50||"meter-number:v8n_too_long",({authentication_key:e})=>!e||e.length<=50||"authentication-key:v8n_too_long",({custom_code:e})=>!e||new Blob([e]).size/1024<=64||"custom-code:v8n_too_long",e=>{var i,t;return"CUSTOM-ENDPOINT-POST"!==(null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code)||(e.accountid&&O(e.accountid)||"endpoint:v8n_required")},e=>{var i,t;const r=e.shipping_container_uri,s=null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code;return!s||!["USPS","FedEx","UPS"].includes(s)||(r&&O(r)||"shipping-container-uri:v8n_required")},e=>{var i,t;const r=e.shipping_drop_type_uri,s=null===(t=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===t?void 0:t.code;return!s||!["FedEx","UPS"].includes(s)||(r&&O(r)||"shipping-drop-type-uri:v8n_required")}]}get hiddenSelector(){var e;const i=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"].code;if(!i)return new r("not=shipping-method-uri,timestamps,create,delete");const t=["shipping-container-uri","shipping-drop-type-uri","destinations"],s=["authentication-key","meter-number","accountid","password"],n={"CUSTOM-ENDPOINT-POST":["endpoint"],"CUSTOM-CODE":["custom-code"],CUSTOM:["destinations","services"],FedEx:[...t,...s,"services"],USPS:[...t,"services"],UPS:[...t,...s,"services"]};if(n[i]){const e=["shipping-method-uri",...n[i],"timestamps","delete","create"];return new r(`not=${e.join()} ${super.hiddenSelector}`)}return super.hiddenSelector}renderBody(){var e,i,r,s,n,o,d,p,h;const c=null===(e=this.form._embedded)||void 0===e?void 0:e["fx:shipping_method"];return a(k||(k=P` ${0} <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-method-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-container-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="shipping-drop-type-uri" .selectedItem="${0}" @selected-item-changed="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-checkbox-group-control infer="destinations" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-text-control infer="authentication-key"></foxy-internal-text-control> <foxy-internal-text-control infer="meter-number"></foxy-internal-text-control> ${0} <foxy-internal-password-control infer="password"></foxy-internal-password-control> <foxy-internal-text-area-control infer="custom-code"></foxy-internal-text-area-control> <foxy-internal-store-shipping-method-form-services-control infer="services"> </foxy-internal-store-shipping-method-form-services-control> ${0} `),["method","container","drop_type"].map((e=>{var i;const r=`fx:shipping_${e}`,s=`shipping_${e}_uri`;if(!(null===(i=this.form._embedded)||void 0===i?void 0:i[r])&&this.form[s])return a(w||(w=P` <foxy-nucleon class="hidden" infer="" href="${0}" @update="${0}"> </foxy-nucleon> `),this.form[s],(e=>{const i=e.currentTarget.data;if(i){const e=t(t({},this.form._embedded),{},{[r]:i});this.edit({_embedded:e})}}))})),l(null!==(i=this.shippingMethods)&&void 0!==i?i:null===(r=this.form._links)||void 0===r?void 0:r["fx:shipping_methods"].href),null!==(n=null===(s=this.form._embedded)||void 0===s?void 0:s["fx:shipping_method"])&&void 0!==n?n:null,(e=>{var i,t;const{selectedItem:r}=e.currentTarget,s={"fx:shipping_method":r};this.edit({_embedded:s,shipping_container_uri:"",shipping_drop_type_uri:"",shipping_method_uri:null!==(t=null===(i=r)||void 0===i?void 0:i._links.self.href)&&void 0!==t?t:""})}),l(null==c?void 0:c._links["fx:shipping_containers"].href),null!==(d=null===(o=this.form._embedded)||void 0===o?void 0:o["fx:shipping_container"])&&void 0!==d?d:null,(e=>{var i,r;const{selectedItem:s}=e.currentTarget,n=t(t({},this.form._embedded),{},{"fx:shipping_container":s});this.edit({shipping_container_uri:null!==(r=null===(i=s)||void 0===i?void 0:i._links.self.href)&&void 0!==r?r:"",_embedded:n})}),l(null==c?void 0:c._links["fx:shipping_drop_types"].href),null!==(h=null===(p=this.form._embedded)||void 0===p?void 0:p["fx:shipping_drop_type"])&&void 0!==h?h:null,(e=>{var i,r;const{selectedItem:s}=e.currentTarget,n=t(t({},this.form._embedded),{},{"fx:shipping_drop_type":s});this.edit({shipping_drop_type_uri:null!==(r=null===(i=s)||void 0===i?void 0:i._links.self.href)&&void 0!==r?r:"",_embedded:n})}),this.__getDestinations,this.__setDestinations,this.__destinations,"CUSTOM-ENDPOINT-POST"===(null==c?void 0:c.code)?a(M||(M=P` <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> `)):a(T||(T=P`<foxy-internal-text-control infer="accountid"></foxy-internal-text-control>`)),super.renderBody())}}customElements.define("foxy-store-shipping-method-form",I);export{I as StoreShippingMethodForm};
@@ -1 +1 @@
1
- import"./shared-432d66f4.js";import"./shared-bac00622.js";import"./shared-a911ab73.js";import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{_ as t}from"./shared-3c58ddf1.js";import{h as s}from"./shared-dc73b9a5.js";import{C as e}from"./shared-bd99107c.js";import{N as i}from"./shared-272e7269.js";import{R as a,T as n,a as r}from"./shared-e989e47e.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-66d2a0d7.js";import"./shared-2f2b5a28.js";import"./shared-f14856e0.js";import"./shared-1d12db26.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";let c,l=t=>t;const m=e(a(n(r(i,"subscription-card"))));class p extends m{render(){var t,e,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(c||(c=l` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 leading-xs mb-xs sm-mb-0 sm-text-right order-0 sm-order-1"> <foxy-i18n data-testid="price" options="${0}" class="text-xxs sm-text-l font-tnum tracking-wide sm-tracking-normal uppercase sm-normal-case font-medium text-secondary sm-text-body sm-block" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> <span class="text-secondary font-medium sm-font-normal sm-block text-xxs sm-text-s"> <span class="sm-hidden">(</span><span class="hidden sm-inline">*</span><foxy-i18n infer="" key="fees_hint"></foxy-i18n><span class="sm-hidden">)</span> <iron-icon id="hint" icon="icons:info-outline" class="icon-inline"></iron-icon> <vcf-tooltip for="hint" position="bottom"> <span class="text-s"><foxy-i18n infer="" key="fees_explainer"></foxy-i18n></span> </vcf-tooltip> <span> &#8203; </span></span></div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){const t=this.data;return null===t?{}:t.first_failed_transaction_date?{date:t.first_failed_transaction_date}:t.end_date?{date:t.end_date}:!1===t.is_active?{}:new Date(t.start_date)>new Date?{date:t.start_date}:{date:t.next_transaction_date}}__getPriceOptions(){if(null===this.data)return{};const s=this.data._embedded["fx:transaction_template"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){const t=this.data;if(null!==t){if(t.first_failed_transaction_date)return"subscription_failed";if(t.end_date){return new Date(t.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===t.is_active?"subscription_inactive":new Date(t.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}}customElements.define("foxy-subscription-card",p);export{p as SubscriptionCard};
1
+ import"./shared-b91650ba.js";import"./shared-71782a9e.js";import"./shared-b7cda8ba.js";import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{_ as t}from"./shared-3c58ddf1.js";import{h as s}from"./shared-dc73b9a5.js";import{C as e}from"./shared-bd99107c.js";import{N as i}from"./shared-272e7269.js";import{R as a,T as n,a as r}from"./shared-e989e47e.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-66d2a0d7.js";import"./shared-221d3788.js";import"./shared-43928f5a.js";import"./shared-98f85be1.js";import"./shared-8b4ba63a.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-9803aa7c.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";let c,l=t=>t;const m=e(a(n(r(i,"subscription-card"))));class p extends m{render(){var t,e,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(c||(c=l` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 leading-xs mb-xs sm-mb-0 sm-text-right order-0 sm-order-1"> <foxy-i18n data-testid="price" options="${0}" class="text-xxs sm-text-l font-tnum tracking-wide sm-tracking-normal uppercase sm-normal-case font-medium text-secondary sm-text-body sm-block" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> <span class="text-secondary font-medium sm-font-normal sm-block text-xxs sm-text-s"> <span class="sm-hidden">(</span><span class="hidden sm-inline">*</span><foxy-i18n infer="" key="fees_hint"></foxy-i18n><span class="sm-hidden">)</span> <iron-icon id="hint" icon="icons:info-outline" class="icon-inline"></iron-icon> <vcf-tooltip for="hint" position="bottom"> <span class="text-s"><foxy-i18n infer="" key="fees_explainer"></foxy-i18n></span> </vcf-tooltip> <span> &#8203; </span></span></div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){const t=this.data;return null===t?{}:t.first_failed_transaction_date?{date:t.first_failed_transaction_date}:t.end_date?{date:t.end_date}:!1===t.is_active?{}:new Date(t.start_date)>new Date?{date:t.start_date}:{date:t.next_transaction_date}}__getPriceOptions(){if(null===this.data)return{};const s=this.data._embedded["fx:transaction_template"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){const t=this.data;if(null!==t){if(t.first_failed_transaction_date)return"subscription_failed";if(t.end_date){return new Date(t.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===t.is_active?"subscription_inactive":new Date(t.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}}customElements.define("foxy-subscription-card",p);export{p as SubscriptionCard};
@@ -1 +1 @@
1
- import"./shared-432d66f4.js";import"./shared-84215d13.js";import"./shared-7c819ebc.js";import"./shared-bac00622.js";import"./shared-a911ab73.js";import{I as e}from"./shared-036b25a3.js";import"./shared-a33be18f.js";import"./shared-b55f1de3.js";import"./shared-f548d023.js";import"./shared-51c4a6dd.js";import"./foxy-transaction-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-ecb7a183.js";import{_ as t,B as s}from"./shared-3c58ddf1.js";import"./shared-f14856e0.js";import"./shared-1d12db26.js";import{h as a}from"./shared-dc73b9a5.js";import{S as i,R as r,a as n}from"./shared-e989e47e.js";import{c as o}from"./shared-4e709717.js";import{C as d}from"./shared-04d8a434.js";import"./shared-8d7e2e2c.js";import{S as l}from"./shared-4128d453.js";import{G as c}from"./shared-b6c1aa47.js";import"./shared-4885670b.js";import"./shared-5a18985c.js";import"./shared-8c5b4c81.js";import"./shared-34f4330c.js";import"./shared-0062cab1.js";import{p as u}from"./shared-66d2a0d7.js";import{s as m}from"./shared-79d0699c.js";import{i as f}from"./shared-9803aa7c.js";import{p as h}from"./shared-8e75c372.js";import{j as _}from"./shared-5e9395ec.js";import"./shared-2f2b5a28.js";import"./shared-651c44fa.js";import"./shared-61ade33e.js";import"./shared-1ab8b12e.js";import"./shared-e5f6ca48.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-337f2fe9.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-62f3fc5a.js";import"./shared-43e2c3f6.js";import"./shared-102dfbe0.js";import"./shared-f090c63a.js";import"./shared-6dfb57b1.js";import"./shared-739a8fe4.js";import"./shared-b99daf13.js";import"./shared-328e5fdc.js";import"./shared-c0b1a51d.js";import"./shared-fd95cd52.js";import"./shared-25fc0ceb.js";import"./shared-41e9ef02.js";function p(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(_(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class y extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function v(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const a=parseInt(e.substring(0,e.length-1));if(isNaN(a))throw new y(e);if(e.endsWith("y"))return 31536e6*a;if(e.endsWith("m"))return a*s;if(e.endsWith("w"))return 6048e5*a;if(e.endsWith("d"))return a*t;throw new y(e)}function x(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(_(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,a,i,r,n;if(t.min){const s=e.min?v(e.min):1/0;v(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?v(e.max):-1/0;v(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(a=e.allowedDaysOfWeek)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(i=t.allowedDays)||void 0===i?void 0:i.type)){const s=[...null!==(r=e.allowedDaysOfMonth)&&void 0!==r?r:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function g(e){const[t,s,a]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,a)}function b(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const a=g(e.value),i=a.getTime(),r=x(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof r)return r;if(!1===(null===(t=r.allowedDaysOfMonth)||void 0===t?void 0:t.includes(a.getDate())))return!1;if(!1===(null===(s=r.allowedDaysOfWeek)||void 0===s?void 0:s.includes(a.getDay())))return!1;if(r.disallowedDates&&r.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>g(e).getTime()));return i===t||void 0!==s&&i>=t&&i<=s})))return!1;if(r.min){const e=h(r.min);if(null!==e&&Date.now()+e>=i)return!1}if(r.max){const e=h(r.max);if(null!==e&&Date.now()+e<=i)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}let $,j,S,w,D,T,q,k,H,E,L,O,A,I,C,N,F,P,R=e=>e;const U=i(r(n(e,"subscription-form")));class V extends U{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.templates={},this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderHeaderSubtitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){let i,r,n="text-secondary";if(e.first_failed_transaction_date)n="text-error",i=e.first_failed_transaction_date,r="subscription_failed";else if(e.end_date){i=e.end_date;r=new Date(e.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else e.is_active?new Date(e.start_date)>new Date?(i=e.start_date,r="subscription_will_be_active"):(i=e.next_transaction_date,r="subscription_active"):(i="",r="subscription_inactive");const o=a($||($=R` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:i}),n,t,r,s);return e.first_failed_transaction_date?a(j||(j=R` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),n,o,e.error_message):o}return a(S||(S=R`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=(e,s)=>{const{data:i,lang:r,ns:n}=this;if(i){const o=u(i.frequency),d=this.__transactionTemplate,l=null==d?void 0:d.total_order;return"string"!=typeof e?a(w||(w=R`--`)):a(D||(D=R` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(t(t({},o),{},{amount:`${l} ${e}`,currencyDisplay:s})),r,".5m"===i.frequency?"twice_a_month":"recurring",n)}return a(T||(T=R`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=(e,t)=>a(q||(q=R` <div data-testid="header" class="sm-col-span-2"> ${0} <div class="leading-xs text-xxl font-medium truncate"> ${0} </div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(e,t),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>a(k||(k=R` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-s font-medium text-secondary" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const s=this.__transactionTemplate,a=new URL(null!==(e=null==s?void 0:s._links["fx:items"].href)&&void 0!==e?e:"");a.searchParams.set("zoom","item_options"),t=a.toString()}catch(e){t=void 0}return a(H||(H=R` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" limit="5" infer="items" item="foxy-item-card"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),f(t))},this.__renderEndDate=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(E||(E=R` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),i,s,f(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),f(null==t?void 0:t.end_date),s,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return b({value:m(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:s}=this;return a(L||(L=R` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),s,t,f(null==e?void 0:e.start_date.substr(0,10)),f(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return a(O||(O=R` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,f(null==e?void 0:e.next_transaction_date.substr(0,10)),f(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",u(e)),value:e})));return a(A||(A=R` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),f(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(I||(I=R` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>a(C||(C=R` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>a(N||(N=R` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const s=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,i=s?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,s):void 0;return a(F||(F=R` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!i,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!i,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!i}),f(i),f(s),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":l,"x-choice":d,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new s(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}renderBody(){var e,t,s,i,r,n,o,d,l;let c;try{const s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");s.searchParams.set("order","transaction_date desc"),s.searchParams.set("zoom","items"),c=s.toString()}catch(e){c=void 0}const u=(null===(s=this.__store)||void 0===s?void 0:s.use_international_currency_symbol)?"code":"symbol",m=this.__transactionTemplate;let h=null;if(null==m?void 0:m.currency_code)h=m.currency_code;else{const e=this.__localeCodesHelper,t=null===(r=null!==(i=this.__templateSet)&&void 0!==i?i:this.__defaultTemplateSet)||void 0===r?void 0:r.locale_code,s=t?null==e?void 0:e.values[t]:void 0;s&&(h=null!==(o=null===(n=/Currency: ([A-Z]{3})/g.exec(s))||void 0===n?void 0:n[1])&&void 0!==o?o:null)}return a(P||(P=R` <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <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> <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> ${0} ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),f(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),f(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),f(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),f(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),f(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(null!=h?h:void 0,u),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",f(null!=h?h:void 0),f(null===(l=null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"])||void 0===l?void 0:l.href),f(c),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,s;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(s=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==s?s:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t,s;const a=this.data,i=null===(e=null==a?void 0:a._embedded)||void 0===e?void 0:e["fx:transaction_template"],r=`#${this.__transactionTemplateLoaderId}`;return null!==(s=null!=i?i:null===(t=this.renderRoot.querySelector(r))||void 0===t?void 0:t.data)&&void 0!==s?s:null}get __defaultTemplateSet(){var e,t;const s=`#${this.__defaultTemplateSetLoaderId}`,a=this.renderRoot.querySelector(s);return null!==(t=null===(e=null==a?void 0:a.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const s=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const s=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const s=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),x(e,s)}(this.data,e)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!p({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=p({subscription:this.data,settings:this.settings});return Array.from(e)}}customElements.define("foxy-subscription-form",V);export{V as SubscriptionForm};
1
+ import"./shared-b91650ba.js";import"./shared-5f65bdab.js";import"./shared-15a947f3.js";import"./shared-71782a9e.js";import"./shared-b7cda8ba.js";import{I as e}from"./shared-9c3b800b.js";import"./shared-a827bcc6.js";import"./shared-28e988c6.js";import"./shared-8acb820f.js";import"./shared-51c4a6dd.js";import"./foxy-transaction-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-ecb7a183.js";import{_ as t,B as s}from"./shared-3c58ddf1.js";import"./shared-98f85be1.js";import"./shared-8b4ba63a.js";import{h as a}from"./shared-dc73b9a5.js";import{S as i,R as r,a as n}from"./shared-e989e47e.js";import{c as o}from"./shared-4e709717.js";import{C as l}from"./shared-f635c052.js";import"./shared-8d7e2e2c.js";import{S as d}from"./shared-a006b7a9.js";import{G as c}from"./shared-b6c1aa47.js";import"./shared-51c3bc09.js";import"./shared-82423f8b.js";import"./shared-21fec810.js";import"./shared-d7bb413b.js";import"./shared-741bfa42.js";import"./shared-0e9ad70e.js";import{p as u}from"./shared-66d2a0d7.js";import{s as m}from"./shared-79d0699c.js";import{i as h}from"./shared-9803aa7c.js";import{p as f}from"./shared-8e75c372.js";import{j as _}from"./shared-5e9395ec.js";import"./shared-221d3788.js";import"./shared-43928f5a.js";import"./shared-879fcb1f.js";import"./shared-41e9ef02.js";import"./shared-651c44fa.js";import"./shared-d67d56c2.js";import"./shared-61ade33e.js";import"./shared-a6e383ac.js";import"./shared-0f4947e8.js";import"./shared-e5f6ca48.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-85f44e3e.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./foxy-collection-page.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-c73f6e8a.js";import"./shared-43e2c3f6.js";import"./shared-8bd53409.js";import"./shared-f090c63a.js";import"./shared-c9f4fe97.js";import"./shared-739a8fe4.js";import"./shared-9e014b51.js";import"./shared-849413bb.js";import"./shared-5c4a29b9.js";import"./shared-6c97a6b0.js";import"./shared-85707e42.js";function p(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(_(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class y extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function v(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const a=parseInt(e.substring(0,e.length-1));if(isNaN(a))throw new y(e);if(e.endsWith("y"))return 31536e6*a;if(e.endsWith("m"))return a*s;if(e.endsWith("w"))return 6048e5*a;if(e.endsWith("d"))return a*t;throw new y(e)}function x(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(_(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,a,i,r,n;if(t.min){const s=e.min?v(e.min):1/0;v(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?v(e.max):-1/0;v(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(a=e.allowedDaysOfWeek)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(i=t.allowedDays)||void 0===i?void 0:i.type)){const s=[...null!==(r=e.allowedDaysOfMonth)&&void 0!==r?r:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function b(e){const[t,s,a]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,a)}function g(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const a=b(e.value),i=a.getTime(),r=x(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof r)return r;if(!1===(null===(t=r.allowedDaysOfMonth)||void 0===t?void 0:t.includes(a.getDate())))return!1;if(!1===(null===(s=r.allowedDaysOfWeek)||void 0===s?void 0:s.includes(a.getDay())))return!1;if(r.disallowedDates&&r.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>b(e).getTime()));return i===t||void 0!==s&&i>=t&&i<=s})))return!1;if(r.min){const e=f(r.min);if(null!==e&&Date.now()+e>=i)return!1}if(r.max){const e=f(r.max);if(null!==e&&Date.now()+e<=i)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}let $,j,S,w,D,T,q,k,H,E,L,O,A,I,C,N,F,P,R=e=>e;const U=i(r(n(e,"subscription-form")));class V extends U{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.templates={},this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderHeaderSubtitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){let i,r,n="text-secondary";if(e.first_failed_transaction_date)n="text-error",i=e.first_failed_transaction_date,r="subscription_failed";else if(e.end_date){i=e.end_date;r=new Date(e.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else e.is_active?new Date(e.start_date)>new Date?(i=e.start_date,r="subscription_will_be_active"):(i=e.next_transaction_date,r="subscription_active"):(i="",r="subscription_inactive");const o=a($||($=R` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:i}),n,t,r,s);return e.first_failed_transaction_date?a(j||(j=R` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),n,o,e.error_message):o}return a(S||(S=R`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=(e,s)=>{const{data:i,lang:r,ns:n}=this;if(i){const o=u(i.frequency),l=this.__transactionTemplate,d=null==l?void 0:l.total_order;return"string"!=typeof e?a(w||(w=R`--`)):a(D||(D=R` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(t(t({},o),{},{amount:`${d} ${e}`,currencyDisplay:s})),r,".5m"===i.frequency?"twice_a_month":"recurring",n)}return a(T||(T=R`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=(e,t)=>a(q||(q=R` <div data-testid="header" class="sm-col-span-2"> ${0} <div class="leading-xs text-xxl font-medium truncate"> ${0} </div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(e,t),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>a(k||(k=R` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-s font-medium text-secondary" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const s=this.__transactionTemplate,a=new URL(null!==(e=null==s?void 0:s._links["fx:items"].href)&&void 0!==e?e:"");a.searchParams.set("zoom","item_options"),t=a.toString()}catch(e){t=void 0}return a(H||(H=R` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" limit="5" infer="items" item="foxy-item-card"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),h(t))},this.__renderEndDate=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(E||(E=R` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),i,s,h(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),h(null==t?void 0:t.end_date),s,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return g({value:m(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:s}=this;return a(L||(L=R` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),s,t,h(null==e?void 0:e.start_date.substr(0,10)),h(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return a(O||(O=R` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,h(null==e?void 0:e.next_transaction_date.substr(0,10)),h(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",u(e)),value:e})));return a(A||(A=R` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),h(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return a(I||(I=R` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>a(C||(C=R` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>a(N||(N=R` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const s=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,i=s?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,s):void 0;return a(F||(F=R` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!i,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!i,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!i}),h(i),h(s),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":d,"x-choice":l,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new s(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}renderBody(){var e,t,s,i,r,n,o,l,d;let c;try{const s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");s.searchParams.set("order","transaction_date desc"),s.searchParams.set("zoom","items"),c=s.toString()}catch(e){c=void 0}const u=(null===(s=this.__store)||void 0===s?void 0:s.use_international_currency_symbol)?"code":"symbol",m=this.__transactionTemplate;let f=null;if(null==m?void 0:m.currency_code)f=m.currency_code;else{const e=this.__localeCodesHelper,t=null===(r=null!==(i=this.__templateSet)&&void 0!==i?i:this.__defaultTemplateSet)||void 0===r?void 0:r.locale_code,s=t?null==e?void 0:e.values[t]:void 0;s&&(f=null!==(o=null===(n=/Currency: ([A-Z]{3})/g.exec(s))||void 0===n?void 0:n[1])&&void 0!==o?o:null)}return a(P||(P=R` <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <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> <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> ${0} ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),h(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),h(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),h(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),h(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),h(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(null!=f?f:void 0,u),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",h(null!=f?f:void 0),h(null===(d=null===(l=this.data)||void 0===l?void 0:l._links["fx:attributes"])||void 0===d?void 0:d.href),h(c),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,s;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(s=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==s?s:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t,s;const a=this.data,i=null===(e=null==a?void 0:a._embedded)||void 0===e?void 0:e["fx:transaction_template"],r=`#${this.__transactionTemplateLoaderId}`;return null!==(s=null!=i?i:null===(t=this.renderRoot.querySelector(r))||void 0===t?void 0:t.data)&&void 0!==s?s:null}get __defaultTemplateSet(){var e,t;const s=`#${this.__defaultTemplateSetLoaderId}`,a=this.renderRoot.querySelector(s);return null!==(t=null===(e=null==a?void 0:a.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const s=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const s=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const s=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),x(e,s)}(this.data,e)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!p({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=p({subscription:this.data,settings:this.settings});return Array.from(e)}}customElements.define("foxy-subscription-form",V);export{V as SubscriptionForm};
@@ -1 +1 @@
1
- import"./shared-8540c2c7.js";import"./shared-66a515e3.js";import"./shared-6dfb57b1.js";import"./shared-91009494.js";import"./shared-292585a0.js";import{I as e}from"./shared-036b25a3.js";import{I as t}from"./shared-e5f6ca48.js";import"./shared-ecb7a183.js";import{c as s,h as a}from"./shared-dc73b9a5.js";import{w as i,a as r}from"./shared-e989e47e.js";import"./shared-b2ce84fa.js";import"./shared-f14856e0.js";import"./shared-2f2b5a28.js";import"./shared-61ade33e.js";import"./shared-34f4330c.js";import"./shared-a911ab73.js";import"./shared-3c58ddf1.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-62f3fc5a.js";import"./shared-0062cab1.js";import"./shared-4885670b.js";import"./shared-b99daf13.js";import"./shared-7c819ebc.js";import"./shared-337f2fe9.js";import"./shared-8d7e2e2c.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./foxy-copy-to-clipboard.js";import"./shared-bac00622.js";import"./foxy-spinner.js";import"./shared-272e7269.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";let o,n,l,p=e=>e;let u,d,m=e=>e;const c=s(u||(u=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{padding-bottom:var(--lumo-space-xs)}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=group-field]{display:flex;border:thin solid var(--lumo-contrast-10pct);border-radius:var(--lumo-border-radius);transition:border-color .15s ease}:host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover) [part=group-field]{border-color:var(--lumo-contrast-20pct)}`)),_=s(d||(d=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{display:flex}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=label]{flex:1}`));customElements.define("foxy-internal-subscription-settings-form-reattempt-bypass",class extends t{constructor(){super(...arguments),this.nucleon=null,this.__getReattemptBypassStringsValue=()=>{var e,t,s;return(null!==(s=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.reattempt_bypass_strings)||void 0===t?void 0:t.split(","))&&void 0!==s?s:[]).map((e=>e.trim())).filter(((e,t,s)=>e&&s.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{var t,s;const a=this.renderRoot.querySelector("vaadin-radio-group"),i=null!==(t=null==a?void 0:a.value)&&void 0!==t?t:"reattempt_if_exists";null===(s=this.nucleon)||void 0===s||s.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join(),reattempt_bypass_logic:i})}}static get styles(){return[super.styles,s(o||(o=p`.visible-if-checked{display:none}[checked] .visible-if-checked{display:block}`))]}renderControl(){const e=a(n||(n=p` <foxy-internal-editable-list-control infer="reattempt-bypass-strings" class="w-full visible-if-checked" .getValue="${0}" .setValue="${0}" @mousedown="${0}" @mouseup="${0}" @keydown="${0}" @click="${0}"> </foxy-internal-editable-list-control> `),this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>(e.preventDefault(),e.stopPropagation())));let t;const s=this.nucleon,i=null==s?void 0:s.form.reattempt_bypass_logic;return(null==s?void 0:s.form.reattempt_bypass_strings)?t=i:"reattempt_if_exists"===i?t="never_reattempt":"skip_if_exists"===i&&(t="always_reattempt"),a(l||(l=p` <vaadin-radio-group helper-text="${0}" label="${0}" class="foxy-internal-subscription-settings-form-reattempt-bypass w-full divide-y divide-contrast-10 group" theme="vertical" ?disabled="${0}" ?readonly="${0}" .value="${0}" @value-changed="${0}"> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="reattempt_if_exists"> <foxy-i18n infer="" key="option_reattempt_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="skip_if_exists"> <foxy-i18n infer="" key="option_skip_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="always_reattempt"> <foxy-i18n infer="" key="option_always_reattempt"></foxy-i18n> </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="never_reattempt"> <foxy-i18n infer="" key="option_never_reattempt"></foxy-i18n> </vaadin-radio-button> </vaadin-radio-group> `),this.helperText,this.label,this.disabled,this.readonly,t,this.__handleGroupValueChanged,e,e)}__handleGroupValueChanged(e){const t=e.currentTarget.value,s=this.nucleon;"never_reattempt"!==t&&"always_reattempt"!==t||("never_reattempt"===t?"reattempt_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"reattempt_if_exists"})):"skip_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"skip_if_exists"})),(null==s?void 0:s.form.reattempt_bypass_strings)&&(null==s||s.edit({reattempt_bypass_strings:""})))}}),i("vaadin-radio-group",c),i("vaadin-radio-button",_);let h,f,y=e=>e;const g=r(e,"subscription-settings-form");class b extends g{constructor(){super(...arguments),this.templates={},this.__sendEmailReceiptsForAutomatedBillingOptions=[{label:"option_checked",value:"checked"}],this.__automaticallyChargePastDueAmountOptions=[{label:"option_checked",value:"checked"}],this.__clearPastDueAmountsOnSuccessOptions=[{label:"option_checked",value:"checked"}],this.__resetNextDateOnMakeUpPaymentOptions=[{label:"option_checked",value:"checked"}],this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"},{label:"option_ignore",value:"ignore"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__sendEmailReceiptsForAutomatedBillingGetValue=()=>this.form.send_email_receipts_for_automated_billing?["checked"]:[],this.__sendEmailReceiptsForAutomatedBillingSetValue=e=>{this.edit({send_email_receipts_for_automated_billing:e.includes("checked")})},this.__expiringSoonPaymentReminderScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.expiring_soon_payment_reminder_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>t-e)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__expiringSoonPaymentReminderScheduleSetValue=e=>{this.edit({expiring_soon_payment_reminder_schedule:e.map((({value:e})=>e)).join()})},this.__automaticallyChargePastDueAmountGetValue=()=>this.form.automatically_charge_past_due_amount?["checked"]:[],this.__automaticallyChargePastDueAmountSetValue=e=>{const t=e.includes("checked");this.edit({automatically_charge_past_due_amount:t,clear_past_due_amounts_on_success:!t&&void 0,reset_nextdate_on_makeup_payment:!t&&void 0})},this.__clearPastDueAmountsOnSuccessGetValue=()=>this.form.clear_past_due_amounts_on_success?["checked"]:[],this.__clearPastDueAmountsOnSuccessSetValue=e=>{this.edit({clear_past_due_amounts_on_success:e.includes("checked")})},this.__resetNextDateOnMakeUpPaymentGetValue=()=>this.form.reset_nextdate_on_makeup_payment?["checked"]:[],this.__resetNextDateOnMakeUpPaymentSetValue=e=>{this.edit({reset_nextdate_on_makeup_payment:e.includes("checked")})},this.__reminderEmailScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reminder_email_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reminderEmailScheduleSetValue=e=>{this.edit({reminder_email_schedule:e.map((({value:e})=>e)).join()})},this.__reattemptScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reattemptScheduleSetValue=e=>{this.edit({reattempt_schedule:e.map((({value:e})=>e)).join()})}}static get v8n(){return[({expiring_soon_payment_reminder_schedule:e})=>!e||e.length<=100||"expiring-soon-payment-reminder-schedule:v8n_too_long",({reattempt_bypass_strings:e})=>!e||e.length<=400||"reattempt-bypass-strings:v8n_too_long",({reminder_email_schedule:e})=>!e||e.length<=100||"reminder-email-schedule:v8n_too_long",({reattempt_schedule:e})=>!e||e.length<=100||"reattempt-schedule:v8n_too_long"]}renderBody(){return a(h||(h=y` <foxy-internal-radio-group-control infer="past-due-amount-handling" theme="vertical list" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="automatically-charge-past-due-amount" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-subscription-settings-form-reattempt-bypass infer="reattempt-bypass"> </foxy-internal-subscription-settings-form-reattempt-bypass> <foxy-internal-editable-list-control infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="send-email-receipts-for-automated-billing" class="-mt-xs -mb-m" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-integer-control suffix="${0}" infer="cancellation-schedule" min="1"> </foxy-internal-integer-control> <foxy-internal-text-control infer="modification-url"></foxy-internal-text-control> ${0} `),this.__pastDueAmountHandlingOptions,this.__automaticallyChargePastDueAmountGetValue,this.__automaticallyChargePastDueAmountSetValue,this.__automaticallyChargePastDueAmountOptions,this.form.automatically_charge_past_due_amount?"":a(f||(f=y` <foxy-internal-checkbox-group-control infer="clear-past-due-amounts-on-success" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="reset-nextdate-on-makeup-payment" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__clearPastDueAmountsOnSuccessGetValue,this.__clearPastDueAmountsOnSuccessSetValue,this.__clearPastDueAmountsOnSuccessOptions,this.__resetNextDateOnMakeUpPaymentGetValue,this.__resetNextDateOnMakeUpPaymentSetValue,this.__resetNextDateOnMakeUpPaymentOptions),this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__sendEmailReceiptsForAutomatedBillingOptions,this.__sendEmailReceiptsForAutomatedBillingGetValue,this.__sendEmailReceiptsForAutomatedBillingSetValue,this.__cancellationScheduleSuffix,super.renderBody())}get __cancellationScheduleSuffix(){const e=this.form.cancellation_schedule;return e?this.t("day_suffix",{count:e}):""}}customElements.define("foxy-subscription-settings-form",b);export{b as SubscriptionSettingsForm};
1
+ import"./shared-ec0fb97f.js";import"./shared-96077b62.js";import"./shared-c9f4fe97.js";import"./shared-1602c9a4.js";import"./shared-eeb2d7ab.js";import{I as e}from"./shared-9c3b800b.js";import{I as t}from"./shared-e5f6ca48.js";import"./shared-ecb7a183.js";import{c as s,h as a}from"./shared-dc73b9a5.js";import{w as i,a as r}from"./shared-e989e47e.js";import"./shared-75f3a59e.js";import"./shared-98f85be1.js";import"./shared-221d3788.js";import"./shared-43928f5a.js";import"./shared-61ade33e.js";import"./shared-d7bb413b.js";import"./shared-b7cda8ba.js";import"./shared-3c58ddf1.js";import"./shared-9803aa7c.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-c73f6e8a.js";import"./shared-0e9ad70e.js";import"./shared-51c3bc09.js";import"./shared-d67d56c2.js";import"./shared-9e014b51.js";import"./shared-15a947f3.js";import"./shared-85f44e3e.js";import"./shared-8d7e2e2c.js";import"./shared-37391934.js";import"./shared-343d1fd7.js";import"./shared-bd99107c.js";import"./shared-2808f43a.js";import"./foxy-copy-to-clipboard.js";import"./shared-71782a9e.js";import"./foxy-spinner.js";import"./shared-272e7269.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";let o,n,l,p=e=>e;let u,d,m=e=>e;const c=s(u||(u=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{padding-bottom:var(--lumo-space-xs)}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=group-field]{display:flex;border:thin solid var(--lumo-contrast-10pct);border-radius:var(--lumo-border-radius);transition:border-color .15s ease}:host(.foxy-internal-subscription-settings-form-reattempt-bypass:not([disabled]):not([readonly]):hover) [part=group-field]{border-color:var(--lumo-contrast-20pct)}`)),_=s(d||(d=m`:host(.foxy-internal-subscription-settings-form-reattempt-bypass) label{display:flex}:host(.foxy-internal-subscription-settings-form-reattempt-bypass) [part=label]{flex:1}`));customElements.define("foxy-internal-subscription-settings-form-reattempt-bypass",class extends t{constructor(){super(...arguments),this.nucleon=null,this.__getReattemptBypassStringsValue=()=>{var e,t,s;return(null!==(s=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.reattempt_bypass_strings)||void 0===t?void 0:t.split(","))&&void 0!==s?s:[]).map((e=>e.trim())).filter(((e,t,s)=>e&&s.indexOf(e)===t)).map((e=>({value:e})))},this.__setReattemptBypassStringsValue=e=>{var t,s;const a=this.renderRoot.querySelector("vaadin-radio-group"),i=null!==(t=null==a?void 0:a.value)&&void 0!==t?t:"reattempt_if_exists";null===(s=this.nucleon)||void 0===s||s.edit({reattempt_bypass_strings:e.map((({value:e})=>e)).join(),reattempt_bypass_logic:i})}}static get styles(){return[super.styles,s(o||(o=p`.visible-if-checked{display:none}[checked] .visible-if-checked{display:block}`))]}renderControl(){const e=a(n||(n=p` <foxy-internal-editable-list-control infer="reattempt-bypass-strings" class="w-full visible-if-checked" .getValue="${0}" .setValue="${0}" @mousedown="${0}" @mouseup="${0}" @keydown="${0}" @click="${0}"> </foxy-internal-editable-list-control> `),this.__getReattemptBypassStringsValue,this.__setReattemptBypassStringsValue,(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>e.stopPropagation()),(e=>(e.preventDefault(),e.stopPropagation())));let t;const s=this.nucleon,i=null==s?void 0:s.form.reattempt_bypass_logic;return(null==s?void 0:s.form.reattempt_bypass_strings)?t=i:"reattempt_if_exists"===i?t="never_reattempt":"skip_if_exists"===i&&(t="always_reattempt"),a(l||(l=p` <vaadin-radio-group helper-text="${0}" label="${0}" class="foxy-internal-subscription-settings-form-reattempt-bypass w-full divide-y divide-contrast-10 group" theme="vertical" ?disabled="${0}" ?readonly="${0}" .value="${0}" @value-changed="${0}"> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="reattempt_if_exists"> <foxy-i18n infer="" key="option_reattempt_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="skip_if_exists"> <foxy-i18n infer="" key="option_skip_if_exists"></foxy-i18n> ${0} </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="always_reattempt"> <foxy-i18n infer="" key="option_always_reattempt"></foxy-i18n> </vaadin-radio-button> <vaadin-radio-button class="foxy-internal-subscription-settings-form-reattempt-bypass p-s w-full space-y-m transition-colors group-hover-divide-contrast-20" value="never_reattempt"> <foxy-i18n infer="" key="option_never_reattempt"></foxy-i18n> </vaadin-radio-button> </vaadin-radio-group> `),this.helperText,this.label,this.disabled,this.readonly,t,this.__handleGroupValueChanged,e,e)}__handleGroupValueChanged(e){const t=e.currentTarget.value,s=this.nucleon;"never_reattempt"!==t&&"always_reattempt"!==t||("never_reattempt"===t?"reattempt_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"reattempt_if_exists"})):"skip_if_exists"!==(null==s?void 0:s.form.reattempt_bypass_logic)&&(null==s||s.edit({reattempt_bypass_logic:"skip_if_exists"})),(null==s?void 0:s.form.reattempt_bypass_strings)&&(null==s||s.edit({reattempt_bypass_strings:""})))}}),i("vaadin-radio-group",c),i("vaadin-radio-button",_);let h,f,y=e=>e;const b=r(e,"subscription-settings-form");class g extends b{constructor(){super(...arguments),this.templates={},this.__sendEmailReceiptsForAutomatedBillingOptions=[{label:"option_checked",value:"checked"}],this.__automaticallyChargePastDueAmountOptions=[{label:"option_checked",value:"checked"}],this.__clearPastDueAmountsOnSuccessOptions=[{label:"option_checked",value:"checked"}],this.__resetNextDateOnMakeUpPaymentOptions=[{label:"option_checked",value:"checked"}],this.__pastDueAmountHandlingOptions=[{label:"option_increment",value:"increment"},{label:"option_replace",value:"replace"},{label:"option_ignore",value:"ignore"}],this.__positiveIntegerInputParams={type:"number",step:"1",min:"0"},this.__sendEmailReceiptsForAutomatedBillingGetValue=()=>this.form.send_email_receipts_for_automated_billing?["checked"]:[],this.__sendEmailReceiptsForAutomatedBillingSetValue=e=>{this.edit({send_email_receipts_for_automated_billing:e.includes("checked")})},this.__expiringSoonPaymentReminderScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.expiring_soon_payment_reminder_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>t-e)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__expiringSoonPaymentReminderScheduleSetValue=e=>{this.edit({expiring_soon_payment_reminder_schedule:e.map((({value:e})=>e)).join()})},this.__automaticallyChargePastDueAmountGetValue=()=>this.form.automatically_charge_past_due_amount?["checked"]:[],this.__automaticallyChargePastDueAmountSetValue=e=>{const t=e.includes("checked");this.edit({automatically_charge_past_due_amount:t,clear_past_due_amounts_on_success:!t&&void 0,reset_nextdate_on_makeup_payment:!t&&void 0})},this.__clearPastDueAmountsOnSuccessGetValue=()=>this.form.clear_past_due_amounts_on_success?["checked"]:[],this.__clearPastDueAmountsOnSuccessSetValue=e=>{this.edit({clear_past_due_amounts_on_success:e.includes("checked")})},this.__resetNextDateOnMakeUpPaymentGetValue=()=>this.form.reset_nextdate_on_makeup_payment?["checked"]:[],this.__resetNextDateOnMakeUpPaymentSetValue=e=>{this.edit({reset_nextdate_on_makeup_payment:e.includes("checked")})},this.__reminderEmailScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reminder_email_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reminderEmailScheduleSetValue=e=>{this.edit({reminder_email_schedule:e.map((({value:e})=>e)).join()})},this.__reattemptScheduleGetValue=()=>{var e,t;return(null!==(t=null===(e=this.form.reattempt_schedule)||void 0===e?void 0:e.split(","))&&void 0!==t?t:[]).map((e=>parseInt(e))).filter(((e,t,s)=>!isNaN(e)&&s.indexOf(e)===t)).sort(((e,t)=>e-t)).map((e=>({value:String(e),label:this.t("day",{count:e})})))},this.__reattemptScheduleSetValue=e=>{this.edit({reattempt_schedule:e.map((({value:e})=>e)).join()})}}static get v8n(){return[({expiring_soon_payment_reminder_schedule:e})=>!e||e.length<=100||"expiring-soon-payment-reminder-schedule:v8n_too_long",({reattempt_bypass_strings:e})=>!e||e.length<=400||"reattempt-bypass-strings:v8n_too_long",({reminder_email_schedule:e})=>!e||e.length<=100||"reminder-email-schedule:v8n_too_long",({reattempt_schedule:e})=>!e||e.length<=100||"reattempt-schedule:v8n_too_long"]}renderBody(){return a(h||(h=y` <foxy-internal-radio-group-control infer="past-due-amount-handling" theme="vertical list" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="automatically-charge-past-due-amount" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} <foxy-internal-subscription-settings-form-reattempt-bypass infer="reattempt-bypass"> </foxy-internal-subscription-settings-form-reattempt-bypass> <foxy-internal-editable-list-control infer="reattempt-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="reminder-email-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-editable-list-control infer="expiring-soon-payment-reminder-schedule" .inputParams="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="send-email-receipts-for-automated-billing" class="-mt-xs -mb-m" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-integer-control suffix="${0}" infer="cancellation-schedule" min="1"> </foxy-internal-integer-control> <foxy-internal-text-control infer="modification-url"></foxy-internal-text-control> ${0} `),this.__pastDueAmountHandlingOptions,this.__automaticallyChargePastDueAmountGetValue,this.__automaticallyChargePastDueAmountSetValue,this.__automaticallyChargePastDueAmountOptions,this.form.automatically_charge_past_due_amount?"":a(f||(f=y` <foxy-internal-checkbox-group-control infer="clear-past-due-amounts-on-success" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="reset-nextdate-on-makeup-payment" class="-mt-xs -mb-m" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__clearPastDueAmountsOnSuccessGetValue,this.__clearPastDueAmountsOnSuccessSetValue,this.__clearPastDueAmountsOnSuccessOptions,this.__resetNextDateOnMakeUpPaymentGetValue,this.__resetNextDateOnMakeUpPaymentSetValue,this.__resetNextDateOnMakeUpPaymentOptions),this.__positiveIntegerInputParams,this.__reattemptScheduleGetValue,this.__reattemptScheduleSetValue,this.__positiveIntegerInputParams,this.__reminderEmailScheduleGetValue,this.__reminderEmailScheduleSetValue,this.__positiveIntegerInputParams,this.__expiringSoonPaymentReminderScheduleGetValue,this.__expiringSoonPaymentReminderScheduleSetValue,this.__sendEmailReceiptsForAutomatedBillingOptions,this.__sendEmailReceiptsForAutomatedBillingGetValue,this.__sendEmailReceiptsForAutomatedBillingSetValue,this.__cancellationScheduleSuffix,super.renderBody())}get __cancellationScheduleSuffix(){const e=this.form.cancellation_schedule;return e?this.t("day_suffix",{count:e}):""}}customElements.define("foxy-subscription-settings-form",g);export{g as SubscriptionSettingsForm};
@@ -1 +1 @@
1
- import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{S as s}from"./shared-a30fcaf6.js";export{S as SubscriptionsTable}from"./shared-a30fcaf6.js";import"./shared-a911ab73.js";import"./shared-2f2b5a28.js";import"./shared-e989e47e.js";import"./shared-3c58ddf1.js";import"./shared-dc73b9a5.js";import"./shared-bac00622.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-7535b32d.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";import"./shared-66d2a0d7.js";customElements.define("foxy-subscriptions-table",s);
1
+ import"./foxy-spinner.js";import"./shared-ecb7a183.js";import{S as s}from"./shared-a30fcaf6.js";export{S as SubscriptionsTable}from"./shared-a30fcaf6.js";import"./shared-b7cda8ba.js";import"./shared-221d3788.js";import"./shared-e989e47e.js";import"./shared-3c58ddf1.js";import"./shared-dc73b9a5.js";import"./shared-71782a9e.js";import"./shared-2808f43a.js";import"./shared-343d1fd7.js";import"./shared-7535b32d.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";import"./shared-66d2a0d7.js";customElements.define("foxy-subscriptions-table",s);
@@ -1 +1 @@
1
- import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import{T as s}from"./shared-7535b32d.js";export{T as Table}from"./shared-7535b32d.js";import"./shared-dc73b9a5.js";import"./shared-a911ab73.js";import"./shared-2f2b5a28.js";import"./shared-e989e47e.js";import"./shared-3c58ddf1.js";import"./shared-bac00622.js";import"./shared-ecb7a183.js";import"./shared-343d1fd7.js";import"./shared-2808f43a.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";customElements.define("foxy-table",s);
1
+ import"./shared-51c4a6dd.js";import"./foxy-spinner.js";import{T as s}from"./shared-7535b32d.js";export{T as Table}from"./shared-7535b32d.js";import"./shared-dc73b9a5.js";import"./shared-b7cda8ba.js";import"./shared-221d3788.js";import"./shared-e989e47e.js";import"./shared-3c58ddf1.js";import"./shared-71782a9e.js";import"./shared-ecb7a183.js";import"./shared-343d1fd7.js";import"./shared-2808f43a.js";import"./shared-bd99107c.js";import"./shared-9803aa7c.js";import"./foxy-nucleon-element.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";customElements.define("foxy-table",s);
@@ -1 +1 @@
1
- import"./shared-102dfbe0.js";import{h as t}from"./shared-dc73b9a5.js";import{a}from"./shared-e989e47e.js";import{C as e}from"./shared-bd99107c.js";import{I as r}from"./shared-f090c63a.js";import"./foxy-spinner.js";import"./shared-a911ab73.js";import"./shared-2f2b5a28.js";import"./shared-bac00622.js";import"./shared-ecb7a183.js";import"./shared-3c58ddf1.js";import"./shared-343d1fd7.js";import"./shared-2808f43a.js";import"./shared-9803aa7c.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";let s,i=t=>t;class d extends(a(e(r),"tax-card")){renderBody(){const a=this.data;return t(s||(s=i` <div class="flex justify-between gap-s"> <div data-testid="title" class="font-medium truncate flex-shrink-0"> ${0}&ZeroWidthSpace; </div> <div data-testid="subtitle" class="truncate text-tertiary"> ${0} &bull; ${0} </div> </div> `),null==a?void 0:a.name,this.__typeLabel,this.__rateLabel)}get __typeLabel(){var t;const{type:a,country:e,region:r,city:s}=null!==(t=this.data)&&void 0!==t?t:{};return"global"===a?this.t("tax_global"):"union"===a?this.t("tax_union"):"country"===a?e:"region"===a?`${e}, ${r}`:"local"===a?`${e}, ${r}, ${s}`:void 0}get __rateLabel(){var t,a;if(!1===(null===(t=this.data)||void 0===t?void 0:t.is_live))return this.t("percent",{fraction:this.data.rate/100});const e=null===(a=this.data)||void 0===a?void 0:a.service_provider;return"onesource"===e?"Thomson Reuters ONESOURCE":"avalara"===e?"Avalara AvaTax 15":"taxjar"===e?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",d);export{d as TaxCard};
1
+ import"./shared-8bd53409.js";import{h as t}from"./shared-dc73b9a5.js";import{a}from"./shared-e989e47e.js";import{C as e}from"./shared-bd99107c.js";import{I as r}from"./shared-f090c63a.js";import"./foxy-spinner.js";import"./shared-b7cda8ba.js";import"./shared-221d3788.js";import"./shared-71782a9e.js";import"./shared-ecb7a183.js";import"./shared-3c58ddf1.js";import"./shared-343d1fd7.js";import"./shared-2808f43a.js";import"./shared-9803aa7c.js";import"./shared-272e7269.js";import"./shared-37391934.js";import"./shared-cd96ff03.js";import"./shared-12e531b8.js";import"./shared-90ddf541.js";import"./shared-39fc8fed.js";import"./shared-2e2d45c4.js";import"./shared-4e709717.js";let s,i=t=>t;class d extends(a(e(r),"tax-card")){renderBody(){const a=this.data;return t(s||(s=i` <div class="flex justify-between gap-s"> <div data-testid="title" class="font-medium truncate flex-shrink-0"> ${0}&ZeroWidthSpace; </div> <div data-testid="subtitle" class="truncate text-tertiary"> ${0} &bull; ${0} </div> </div> `),null==a?void 0:a.name,this.__typeLabel,this.__rateLabel)}get __typeLabel(){var t;const{type:a,country:e,region:r,city:s}=null!==(t=this.data)&&void 0!==t?t:{};return"global"===a?this.t("tax_global"):"union"===a?this.t("tax_union"):"country"===a?e:"region"===a?`${e}, ${r}`:"local"===a?`${e}, ${r}, ${s}`:void 0}get __rateLabel(){var t,a;if(!1===(null===(t=this.data)||void 0===t?void 0:t.is_live))return this.t("percent",{fraction:this.data.rate/100});const e=null===(a=this.data)||void 0===a?void 0:a.service_provider;return"onesource"===e?"Thomson Reuters ONESOURCE":"avalara"===e?"Avalara AvaTax 15":"taxjar"===e?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",d);export{d as TaxCard};