@foxy.io/elements 1.29.0-beta.3 → 1.29.0-beta.4

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 (61) hide show
  1. package/dist/cdn/foxy-address-form.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  4. package/dist/cdn/foxy-cart-form.js +2 -2
  5. package/dist/cdn/foxy-client-form.js +1 -1
  6. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  7. package/dist/cdn/foxy-coupon-form.js +1 -1
  8. package/dist/cdn/foxy-customer-form.js +1 -1
  9. package/dist/cdn/foxy-customer-portal.js +1 -1
  10. package/dist/cdn/foxy-customer.js +1 -1
  11. package/dist/cdn/foxy-downloadable-form.js +1 -1
  12. package/dist/cdn/foxy-email-template-form.js +1 -1
  13. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  14. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  15. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  16. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  17. package/dist/cdn/foxy-gift-card-form.js +1 -1
  18. package/dist/cdn/foxy-integration-form.js +1 -1
  19. package/dist/cdn/foxy-item-category-form.js +1 -1
  20. package/dist/cdn/foxy-item-form.js +1 -1
  21. package/dist/cdn/foxy-item-option-form.js +1 -1
  22. package/dist/cdn/foxy-native-integration-form.js +1 -1
  23. package/dist/cdn/foxy-passkey-form.js +1 -1
  24. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  25. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  26. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  27. package/dist/cdn/foxy-store-form.js +1 -1
  28. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  29. package/dist/cdn/foxy-subscription-form.js +1 -1
  30. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  31. package/dist/cdn/foxy-template-set-form.js +1 -1
  32. package/dist/cdn/foxy-transaction.js +1 -1
  33. package/dist/cdn/foxy-user-form.js +1 -1
  34. package/dist/cdn/foxy-users-table.js +1 -1
  35. package/dist/cdn/foxy-webhook-form.js +1 -1
  36. package/dist/cdn/shared-3ea78c8d.js +1 -0
  37. package/dist/cdn/shared-a8170f94.js +1 -0
  38. package/dist/cdn/shared-cdf20ded.js +1 -0
  39. package/dist/cdn/shared-e96c5384.js +1 -0
  40. package/dist/cdn/shared-f07d15d6.js +1 -0
  41. package/dist/cdn/translations/item-category-form/en.json +181 -148
  42. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.d.ts +3 -0
  43. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +23 -8
  44. package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
  45. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.d.ts +2 -0
  46. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +11 -1
  47. package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
  48. package/dist/elements/internal/InternalTextControl/InternalTextControl.d.ts +2 -0
  49. package/dist/elements/internal/InternalTextControl/InternalTextControl.js +13 -2
  50. package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
  51. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +1 -7
  52. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +109 -135
  53. package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
  54. package/dist/elements/public/ItemCategoryForm/index.d.ts +4 -3
  55. package/dist/elements/public/ItemCategoryForm/index.js +4 -3
  56. package/dist/elements/public/ItemCategoryForm/index.js.map +1 -1
  57. package/package.json +1 -1
  58. package/dist/cdn/shared-18cb3cfc.js +0 -1
  59. package/dist/cdn/shared-588c6b15.js +0 -1
  60. package/dist/cdn/shared-666bdabd.js +0 -1
  61. package/dist/cdn/shared-b9138e9f.js +0 -1
@@ -1 +1 @@
1
- import"./shared-10b5e78f.js";import"./shared-d393bcd8.js";import"./shared-cc79152c.js";import"./shared-a159ccff.js";import"./shared-72f41a65.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import{m as t,B as r,_ as o}from"./shared-0f6e4584.js";import{a as i}from"./shared-075796e2.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./shared-77c4acdd.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const n={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},l={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},s={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},_={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},c={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},d={service:"zapier",events:[],url:""},f={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let u,p,v,g,h,y,x,m,b,w,C,V,$,j=e=>e;const k=i(e,"native-integration-form");class F extends k{constructor(){super(...arguments),this.__createConfigGetterFor=t((e=>()=>{var t;return null===(t=this.__config)||void 0===t?void 0:t[e]})),this.__createConfigSetterFor=t((e=>t=>this.__config={[e]:t})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,t=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&t.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&t.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&t.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&t.push("use_ava_tax"),t},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,t;const r=null!==(t=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==t?t:{};return Object.entries(r).map((([e,t])=>({value:`${e}:${t}`})))},this.__codeMappingsSetValue=e=>{const t={};for(const{value:r}of e){const[e,o]=r.split(":");e&&o&&(t[e]=o)}this.__config={category_to_product_tax_code_mappings:t}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,t;return(null!==(t=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==t?t:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=t(JSON.parse),r=t((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:t="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?r(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==t||!a||`avalara-service-url:${a}`},({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).id||"avalara-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).key||"avalara-key:v8n_required",({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).company_code||"avalara-company-code:v8n_required",({provider:t="avalara",config:r="{}"})=>{if("avalara"!==t)return!0;const o=e(r).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:t="avalara",config:r="{}"})=>"taxjar"!==t||!!e(r).api_token||"taxjar-api-token:v8n_required",({provider:t="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?r(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==t||!a||`onesource-service-url:${a}`},({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).external_company_id||"onesource-external-company-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).from_city||"onesource-from-city:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).host_system||"onesource-host-system:v8n_required",({provider:t="avalara",config:r="{}"})=>{const{service:o,title:i}=e(r);return"webhook"!==t||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:t="avalara",config:r="{}"})=>{const{service:o,encryption_key:i}=e(r);return"webhook"!==t||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:t="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==t||"json"!==i||!n||`webhook-json-url:${n}`},({provider:t="avalara",config:r="{}"})=>{const{service:o,title:i}=e(r);return"webhook"!==t||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:t="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==t||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).site_id||"webflow-site-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).site_name||"webflow-site-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).collection_id||"webflow-collection-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).collection_name||"webflow-collection-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new r(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const t=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(u||(u=j` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(p||(p=j` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===t?this.__renderAvalaraConfig():"taxjar"===t?this.__renderTaxJarConfig():"onesource"===t?this.__renderOneSourceConfig():"webflow"===t?this.__renderWebflowConfig():"zapier"===t?this.__renderZapierConfig():"webhook"===t?this.__renderWebhookConfig():"apple_pay"===t?this.__renderApplePayConfig():"custom_tax"===t?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t;try{t=(await e.json())._embedded["fx:errors"][0].message}catch(t){throw e}throw t.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var t;const r=this.__config,i=null!==(t=this.form.provider)&&void 0!==t?t:"avalara",a="avalara"===i?_:"taxjar"===i?f:"onesource"===i?s:"webflow"===i?c:"zapier"===i?d:"webhook"===i?"legacy_xml"===(null==r?void 0:r.service)?n:l:void 0,u=JSON.stringify(o(o(o({},a),r),e));this.edit({provider:i,config:u})}__renderAvalaraConfig(){var e;return a(v||(v=j` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(g||(g=j` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(h||(h=j` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=j` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,t;return a(x||(x=j` <p style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" class="rounded bg-error-10 text-error font-medium"> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <br> <a target="_blank" class="text-body rounded hover-underline hover-cursor-pointer focus-outline-none focus-ring-2 focus-ring-error-50" lang="en" rel="noopener" href="https://www.foxy.io/blog/new-feature-json-webhook/"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> ${0} `),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(t=this.__config)||void 0===t?void 0:t.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(m||(m=j` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(b||(b=j` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(w||(w=j` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> <foxy-internal-password-control infer="webflow-auth" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"),this.__createConfigGetterFor("auth"),this.__createConfigSetterFor("auth"))}__renderZapierConfig(){return a(C||(C=j` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(V||(V=j` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a($||($=j` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",F);export{F as NativeIntegrationForm};
1
+ import"./shared-10b5e78f.js";import"./shared-d393bcd8.js";import"./shared-cc79152c.js";import"./shared-a159ccff.js";import"./shared-72f41a65.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import{m as t,B as r,_ as o}from"./shared-0f6e4584.js";import{a as i}from"./shared-075796e2.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./shared-77c4acdd.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const n={service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""},l={encryption_key:"",service:"json",version:1,events:[],title:"",url:""},s={part_number_product_option:"",product_order_priority:"",calling_system_number:"",external_company_id:"",audit_settings:"never",company_role:"B",service_url:"",host_system:"",from_city:""},_={category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""},c={inventory_field_name:"",inventory_field_id:"",collection_name:"",sku_field_name:"",collection_id:"",sku_field_id:"",site_name:"",service:"webflow",version:1,site_id:"",events:["transaction/created"],auth:""},d={service:"zapier",events:[],url:""},f={category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""};let u,p,v,g,h,y,x,m,b,w,C,V,$,j=e=>e;const k=i(e,"native-integration-form");class F extends k{constructor(){super(...arguments),this.__createConfigGetterFor=t((e=>()=>{var t;return null===(t=this.__config)||void 0===t?void 0:t[e]})),this.__createConfigSetterFor=t((e=>t=>this.__config={[e]:t})),this.__providerGetValue=()=>{var e;return null!==(e=this.form.provider)&&void 0!==e?e:"avalara"},this.__providerSetValue=e=>{this.edit({provider:e,config:"{}"}),this.__config={}},this.__templateProviderOptions=[{value:"avalara",label:"option_avalara"},{value:"onesource",label:"option_onesource"},{value:"taxjar",label:"option_taxjar"}],this.__avalaraConfigOptions=[{value:"use_ava_tax",label:"option_use_ava_tax"},{value:"enable_colorado_delivery_fee",label:"option_enable_colorado_delivery_fee"},{value:"create_invoice",label:"option_create_invoice"},{value:"use_address_validation",label:"option_use_address_validation"}],this.__taxjarConfigOptions=[{value:"create_invoice",label:"option_create_invoice"}],this.__configOptionsGetValue=()=>{const e=this.__config,t=[];return(null==e?void 0:e.enable_colorado_delivery_fee)&&t.push("enable_colorado_delivery_fee"),(null==e?void 0:e.use_address_validation)&&t.push("use_address_validation"),(null==e?void 0:e.create_invoice)&&t.push("create_invoice"),(null==e?void 0:e.use_ava_tax)&&t.push("use_ava_tax"),t},this.__configOptionsSetValue=e=>{this.__config={enable_colorado_delivery_fee:e.includes("enable_colorado_delivery_fee"),use_address_validation:e.includes("use_address_validation"),create_invoice:e.includes("create_invoice"),use_ava_tax:e.includes("use_ava_tax")}},this.__avalaraAddressValidationCountriesOptions=[{value:"US",label:"option_US"},{value:"CA",label:"option_CA"}],this.__codeMappingsGetValue=()=>{var e,t;const r=null!==(t=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==t?t:{};return Object.entries(r).map((([e,t])=>({value:`${e}:${t}`})))},this.__codeMappingsSetValue=e=>{const t={};for(const{value:r}of e){const[e,o]=r.split(":");e&&o&&(t[e]=o)}this.__config={category_to_product_tax_code_mappings:t}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,t;return(null!==(t=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==t?t:[]).filter((e=>!!e)).map((e=>({value:e})))},this.__onesourceProductOrderPrioritySetValue=e=>{this.__config={product_order_priority:e.map((e=>e.value)).join(",")}},this.__onesourceAuditSettingsOptions=[{value:"capture_only",label:"option_capture_only"},{value:"auth_and_capture",label:"option_auth_and_capture"},{value:"never",label:"option_never"}],this.__webhookServiceOptions=[{value:"json",label:"option_json"},{value:"legacy_xml",label:"option_legacy_xml"}],this.__webhookJsonEventsOptions=[{value:"transaction/created",label:"option_transaction_created"},{value:"subscription/cancelled",label:"option_subscription_cancelled"}]}static get v8n(){const e=t(JSON.parse),r=t((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:t="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?r(i)?null:"v8n_invalid":"v8n_required";return"avalara"!==t||!a||`avalara-service-url:${a}`},({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).id||"avalara-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).key||"avalara-key:v8n_required",({provider:t="avalara",config:r="{}"})=>"avalara"!==t||!!e(r).company_code||"avalara-company-code:v8n_required",({provider:t="avalara",config:r="{}"})=>{if("avalara"!==t)return!0;const o=e(r).category_to_product_tax_code_mappings;return o&&Object.entries(o).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:t="avalara",config:r="{}"})=>"taxjar"!==t||!!e(r).api_token||"taxjar-api-token:v8n_required",({provider:t="avalara",config:o="{}"})=>{const i=e(o).service_url,a=i?r(i)?null:"v8n_invalid":"v8n_required";return"onesource"!==t||!a||`onesource-service-url:${a}`},({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).external_company_id||"onesource-external-company-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).from_city||"onesource-from-city:v8n_required",({provider:t="avalara",config:r="{}"})=>"onesource"!==t||!!e(r).host_system||"onesource-host-system:v8n_required",({provider:t="avalara",config:r="{}"})=>{const{service:o,title:i}=e(r);return"webhook"!==t||"json"!==o||!!i||"webhook-json-title:v8n_required"},({provider:t="avalara",config:r="{}"})=>{const{service:o,encryption_key:i}=e(r);return"webhook"!==t||"json"!==o||!!i||"webhook-json-encryption-key:v8n_required"},({provider:t="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==t||"json"!==i||!n||`webhook-json-url:${n}`},({provider:t="avalara",config:r="{}"})=>{const{service:o,title:i}=e(r);return"webhook"!==t||"legacy_xml"!==o||!!i||"webhook-legacy-xml-title:v8n_required"},({provider:t="avalara",config:o="{}"})=>{const{service:i,url:a}=e(o),n=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==t||"legacy_xml"!==i||!n||`webhook-legacy-xml-url:${n}`},({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).site_id||"webflow-site-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).site_name||"webflow-site-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).collection_id||"webflow-collection-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).collection_name||"webflow-collection-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:t="avalara",config:r="{}"})=>"webflow"!==t||!!e(r).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-merchant-id","custom-tax-url","zapier-events","zapier-url","provider"),new r(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const t=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return a(u||(u=j` ${0} ${0} ${0} ${0} `),this.renderHeader(),this.href?"":a(p||(p=j` <foxy-internal-radio-group-control infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===t?this.__renderAvalaraConfig():"taxjar"===t?this.__renderTaxJarConfig():"onesource"===t?this.__renderOneSourceConfig():"webflow"===t?this.__renderWebflowConfig():"zapier"===t?this.__renderZapierConfig():"webhook"===t?this.__renderWebhookConfig():"apple_pay"===t?this.__renderApplePayConfig():"custom_tax"===t?this.__renderCustomTaxConfig():"",super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let t;try{t=(await e.json())._embedded["fx:errors"][0].message}catch(t){throw e}throw t.includes("has already been configured")?["error:already_configured"]:e}}get __config(){try{return JSON.parse(this.form.config)}catch(e){return null}}set __config(e){var t;const r=this.__config,i=null!==(t=this.form.provider)&&void 0!==t?t:"avalara",a="avalara"===i?_:"taxjar"===i?f:"onesource"===i?s:"webflow"===i?c:"zapier"===i?d:"webhook"===i?"legacy_xml"===(null==r?void 0:r.service)?n:l:void 0,u=JSON.stringify(o(o(o({},a),r),e));this.edit({provider:i,config:u})}__renderAvalaraConfig(){var e;return a(v||(v=j` <foxy-internal-text-control infer="avalara-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="avalara-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-password-control infer="avalara-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-text-control infer="avalara-company-code" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="avalara-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("id"),this.__createConfigSetterFor("id"),this.__createConfigGetterFor("key"),this.__createConfigSetterFor("key"),this.__createConfigGetterFor("company_code"),this.__createConfigSetterFor("company_code"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__avalaraConfigOptions,(null===(e=this.__config)||void 0===e?void 0:e.use_address_validation)?a(g||(g=j` <foxy-internal-checkbox-group-control infer="avalara-address-validation-countries" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("address_validation_countries"),this.__createConfigSetterFor("address_validation_countries"),this.__avalaraAddressValidationCountriesOptions):"")}__renderTaxJarConfig(){return a(h||(h=j` <foxy-internal-password-control infer="taxjar-api-token" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> <foxy-internal-editable-list-control infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-checkbox-group-control infer="taxjar-options" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__createConfigGetterFor("api_token"),this.__createConfigSetterFor("api_token"),this.__codeMappingsGetValue,this.__codeMappingsSetValue,this.__configOptionsGetValue,this.__configOptionsSetValue,this.__taxjarConfigOptions)}__renderOneSourceConfig(){return a(y||(y=j` <foxy-internal-text-control infer="onesource-service-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-external-company-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-calling-system-number" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-from-city" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="onesource-host-system" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="onesource-company-role" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-text-control infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-editable-list-control infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-radio-group-control infer="onesource-audit-settings" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("service_url"),this.__createConfigSetterFor("service_url"),this.__createConfigGetterFor("external_company_id"),this.__createConfigSetterFor("external_company_id"),this.__createConfigGetterFor("calling_system_number"),this.__createConfigSetterFor("calling_system_number"),this.__createConfigGetterFor("from_city"),this.__createConfigSetterFor("from_city"),this.__createConfigGetterFor("host_system"),this.__createConfigSetterFor("host_system"),this.__createConfigGetterFor("company_role"),this.__createConfigSetterFor("company_role"),this.__onesourceCompanyRoleOptions,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue,this.__createConfigGetterFor("audit_settings"),this.__createConfigSetterFor("audit_settings"),this.__onesourceAuditSettingsOptions)}__renderWebhookConfig(){var e,t;return a(x||(x=j` <p style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" class="rounded bg-error-10 text-error font-medium"> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <br> <a target="_blank" class="text-body rounded hover-underline hover-cursor-pointer focus-outline-none focus-ring-2 focus-ring-error-50" lang="en" rel="noopener" href="https://www.foxy.io/blog/new-feature-json-webhook/"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> ${0} `),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(t=this.__config)||void 0===t?void 0:t.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return a(m||(m=j` <foxy-internal-text-control infer="webhook-json-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-json-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-checkbox-group-control infer="webhook-json-events" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-password-control infer="webhook-json-encryption-key" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions,this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__webhookJsonEventsOptions,this.__createConfigGetterFor("encryption_key"),this.__createConfigSetterFor("encryption_key"))}__renderWebhookLegacyXmlConfig(){return a(b||(b=j` <foxy-internal-text-control infer="webhook-legacy-xml-title" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-area-control infer="webhook-legacy-xml-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <foxy-internal-radio-group-control infer="webhook-service" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> `),this.__createConfigGetterFor("title"),this.__createConfigSetterFor("title"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"),this.__createConfigGetterFor("service"),this.__createConfigSetterFor("service"),this.__webhookServiceOptions)}__renderWebflowConfig(){return a(w||(w=j` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="webflow-site-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-site-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-collection-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-sku-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <foxy-internal-text-control infer="webflow-inventory-field-name" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </div> <foxy-internal-password-control infer="webflow-auth" .getValue="${0}" .setValue="${0}"> </foxy-internal-password-control> `),this.__createConfigGetterFor("site_id"),this.__createConfigSetterFor("site_id"),this.__createConfigGetterFor("site_name"),this.__createConfigSetterFor("site_name"),this.__createConfigGetterFor("collection_id"),this.__createConfigSetterFor("collection_id"),this.__createConfigGetterFor("collection_name"),this.__createConfigSetterFor("collection_name"),this.__createConfigGetterFor("sku_field_id"),this.__createConfigSetterFor("sku_field_id"),this.__createConfigGetterFor("sku_field_name"),this.__createConfigSetterFor("sku_field_name"),this.__createConfigGetterFor("inventory_field_id"),this.__createConfigSetterFor("inventory_field_id"),this.__createConfigGetterFor("inventory_field_name"),this.__createConfigSetterFor("inventory_field_name"),this.__createConfigGetterFor("auth"),this.__createConfigSetterFor("auth"))}__renderZapierConfig(){return a(C||(C=j` <foxy-internal-editable-list-control infer="zapier-events" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-text-area-control infer="zapier-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-area-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("events"),this.__createConfigSetterFor("events"),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}__renderApplePayConfig(){return a(V||(V=j` <foxy-internal-text-control infer="apple-pay-merchant-id" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("merchantID"),this.__createConfigSetterFor("merchantID"))}__renderCustomTaxConfig(){return a($||($=j` <foxy-internal-text-control infer="custom-tax-url" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <p class="text-xs text-secondary leading-xs"> <foxy-i18n infer="custom-tax-warning" key="warning_text"></foxy-i18n> </p> `),this.__createConfigGetterFor("url"),this.__createConfigSetterFor("url"))}}customElements.define("foxy-native-integration-form",F);export{F as NativeIntegrationForm};
@@ -1 +1 @@
1
- import"./shared-72f41a65.js";import"./shared-588c6b15.js";import{I as r}from"./shared-8c1df97c.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-075796e2.js";import{B as a}from"./shared-0f6e4584.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-77c4acdd.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-61ade33e.js";import"./shared-8f7a31e0.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-fb56178f.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./shared-bab2ea2c.js";let o,d,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(d||(d=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(o||(o=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
1
+ import"./shared-72f41a65.js";import"./shared-3ea78c8d.js";import{I as r}from"./shared-8c1df97c.js";import"./foxy-spinner.js";import{R as e,a as s}from"./shared-075796e2.js";import{B as a}from"./shared-0f6e4584.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-77c4acdd.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-61ade33e.js";import"./shared-8f7a31e0.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-fb56178f.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./shared-bab2ea2c.js";let o,d,i=r=>r;const p=e(s(r,"passkey-form"));class m extends p{get readonlySelector(){return new a(`credential-id last-login-date last-login-ua ${super.readonlySelector.toString()}`)}renderBody(){return this.data?t(d||(d=i` ${0} <foxy-internal-text-control infer="credential-id"></foxy-internal-text-control> <foxy-internal-text-area-control infer="last-login-ua"></foxy-internal-text-area-control> ${0} `),this.renderHeader(),super.renderBody()):t(o||(o=i` <div class="p-xl flex items-center justify-center"> <foxy-spinner infer="spinner" state="empty" layout="vertical"></foxy-spinner> </div> `))}}customElements.define("foxy-passkey-form",m);export{m as PasskeyForm};
@@ -1 +1 @@
1
- import"./shared-2d723710.js";import"./shared-10b5e78f.js";import"./shared-3fa791ca.js";import"./shared-18cb3cfc.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./shared-f1d2b5bb.js";import{_ as r,B as t,aM as o,l as a}from"./shared-0f6e4584.js";import{a as i}from"./shared-075796e2.js";import{i as s}from"./shared-9803aa7c.js";import{h as d}from"./shared-dc73b9a5.js";import{s as n}from"./shared-6474675f.js";import{h as l}from"./shared-9db46672.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e6e84ff5.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-df00a537.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-339bbd50.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2fc671cd.js";import"./shared-651c44fa.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-4e709717.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let c,h,p,f,u,m,v,j,_,b,g,y,x=e=>e;const $=i(e,"payments-api-fraud-protection-form");class L extends ${constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return r(r({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var r,t,o,a;const i=null!==(o=null===(t=null===(r=e.helper)||void 0===r?void 0:r.json)||void 0===t?void 0:t.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const r of e.fields)if("optional"in r&&!r.optional){const t=[e.parent_id,e.id,r.id].filter((e=>!!e));if(!l(s,t)&&"checkbox"!==r.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new t(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return r(r({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var r;return d(c||(c=x` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(r=this.data)||void 0===r?void 0:r.type)||!this.form.type?d(h||(h=x``)):d(p||(p=x` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){return this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector()}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),r=new URL(this.href||this.parent).pathname,t=e.exec(r).groups.presetId;return new URL(`/payment_presets/${t}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,r;return null===(r=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.values}__renderFraudProtectionSelector(){var e;return d(f||(f=x` ${0} <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,r])=>this.__renderFraudProtectionButton({type:e,helper:r}))),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()))}__renderFraudProtectionButton({type:e,helper:r}){var t,o;const a=L.defaultImageSrc,i=null!==(o=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==o?o:a,s=e=>e.currentTarget.src=a;return d(u||(u=x` <button class="relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden transition-colors hover-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="min-w-0 flex-1 truncate leading-s"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs text-secondary">${0}</div> </figcaption> </figure> </button> `),(()=>this.edit({type:e,helper:r})),i,s,i,s,r.name,e)}__renderFraudProtectionConfig(){var e,r,t;return d(m||(m=x` ${0} <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),this.renderHeader(),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?d(v||(v=x` <foxy-internal-integer-control infer="score-threshold-reject"> </foxy-internal-integer-control> `)):"",null===(t=null===(r=this.form.helper)||void 0===r?void 0:r.json)||void 0===t?void 0:t.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return d(j||(j=x`${0}`),e.fields.map((r=>{var t,o,i,s,l,c;const h=()=>{var t,o;let i;try{i=JSON.parse(null!==(t=this.form.json)&&void 0!==t?t:"")}catch(e){i={}}const s=[e.parent_id,e.id,r.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},p=t=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,r.id].filter((e=>!!e));this.edit({json:JSON.stringify(n(a,i,t))})},f=r.options,u=["json",...[e.parent_id,e.id,r.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return d(_||(_=x` ${0} `),"checkbox"===r.type?d(b||(b=x` <foxy-internal-checkbox-group-control helper-text="${0}" label="" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(t=r.description)&&void 0!==t?t:"",u,[{label:r.name,value:"checked"}],(()=>h()?["checked"]:[]),(e=>p(e.includes("checked")))):"select"===r.type?d(g||(g=x` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=r.description)&&void 0!==o?o:"",null!==(l=null===(s=null===(i=r.options)||void 0===i?void 0:i.find((e=>e.value===r.default_value)))||void 0===s?void 0:s.name)&&void 0!==l?l:this.t("default_additional_field_placeholder"),r.name,u,f.map((({name:e,value:r})=>({label:e,value:r}))),h,p):d(y||(y=x` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(c=r.description)&&void 0!==c?c:"",r.default_value||this.t("default_additional_field_placeholder"),r.name,u,h,p))})))}}customElements.define("foxy-payments-api-fraud-protection-form",L);export{L as PaymentsApiFraudProtectionForm};
1
+ import"./shared-2d723710.js";import"./shared-10b5e78f.js";import"./shared-3fa791ca.js";import"./shared-e96c5384.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./shared-f1d2b5bb.js";import{_ as r,B as t,aM as o,l as a}from"./shared-0f6e4584.js";import{a as i}from"./shared-075796e2.js";import{i as s}from"./shared-9803aa7c.js";import{h as d}from"./shared-dc73b9a5.js";import{s as n}from"./shared-6474675f.js";import{h as l}from"./shared-9db46672.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e6e84ff5.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-df00a537.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-339bbd50.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2fc671cd.js";import"./shared-651c44fa.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let c,h,p,f,u,m,v,j,_,b,g,y,x=e=>e;const $=i(e,"payments-api-fraud-protection-form");class L extends ${constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return r(r({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var r,t,o,a;const i=null!==(o=null===(t=null===(r=e.helper)||void 0===r?void 0:r.json)||void 0===t?void 0:t.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const r of e.fields)if("optional"in r&&!r.optional){const t=[e.parent_id,e.id,r.id].filter((e=>!!e));if(!l(s,t)&&"checkbox"!==r.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new t(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return r(r({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var r;return d(c||(c=x` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(r=this.data)||void 0===r?void 0:r.type)||!this.form.type?d(h||(h=x``)):d(p||(p=x` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){return this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector()}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),r=new URL(this.href||this.parent).pathname,t=e.exec(r).groups.presetId;return new URL(`/payment_presets/${t}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,r;return null===(r=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.values}__renderFraudProtectionSelector(){var e;return d(f||(f=x` ${0} <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,r])=>this.__renderFraudProtectionButton({type:e,helper:r}))),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()))}__renderFraudProtectionButton({type:e,helper:r}){var t,o;const a=L.defaultImageSrc,i=null!==(o=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==o?o:a,s=e=>e.currentTarget.src=a;return d(u||(u=x` <button class="relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden transition-colors hover-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="min-w-0 flex-1 truncate leading-s"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs text-secondary">${0}</div> </figcaption> </figure> </button> `),(()=>this.edit({type:e,helper:r})),i,s,i,s,r.name,e)}__renderFraudProtectionConfig(){var e,r,t;return d(m||(m=x` ${0} <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),this.renderHeader(),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?d(v||(v=x` <foxy-internal-integer-control infer="score-threshold-reject"> </foxy-internal-integer-control> `)):"",null===(t=null===(r=this.form.helper)||void 0===r?void 0:r.json)||void 0===t?void 0:t.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return d(j||(j=x`${0}`),e.fields.map((r=>{var t,o,i,s,l,c;const h=()=>{var t,o;let i;try{i=JSON.parse(null!==(t=this.form.json)&&void 0!==t?t:"")}catch(e){i={}}const s=[e.parent_id,e.id,r.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},p=t=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,r.id].filter((e=>!!e));this.edit({json:JSON.stringify(n(a,i,t))})},f=r.options,u=["json",...[e.parent_id,e.id,r.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return d(_||(_=x` ${0} `),"checkbox"===r.type?d(b||(b=x` <foxy-internal-checkbox-group-control helper-text="${0}" label="" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(t=r.description)&&void 0!==t?t:"",u,[{label:r.name,value:"checked"}],(()=>h()?["checked"]:[]),(e=>p(e.includes("checked")))):"select"===r.type?d(g||(g=x` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=r.description)&&void 0!==o?o:"",null!==(l=null===(s=null===(i=r.options)||void 0===i?void 0:i.find((e=>e.value===r.default_value)))||void 0===s?void 0:s.name)&&void 0!==l?l:this.t("default_additional_field_placeholder"),r.name,u,f.map((({name:e,value:r})=>({label:e,value:r}))),h,p):d(y||(y=x` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(c=r.description)&&void 0!==c?c:"",r.default_value||this.t("default_additional_field_placeholder"),r.name,u,h,p))})))}}customElements.define("foxy-payments-api-fraud-protection-form",L);export{L as PaymentsApiFraudProtectionForm};
@@ -1 +1 @@
1
- import"./shared-2d723710.js";import"./shared-81d3a9ae.js";import"./shared-fa9e5c7f.js";import"./shared-10b5e78f.js";import"./shared-cc79152c.js";import"./shared-18cb3cfc.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-f1d2b5bb.js";import{_ as t,B as r,aM as a,l as i}from"./shared-0f6e4584.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-075796e2.js";import{i as l}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as d}from"./shared-dc73b9a5.js";import{h as c}from"./shared-9db46672.js";import{s as h}from"./shared-6474675f.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e5d37737.js";import"./shared-644ee296.js";import"./shared-fb56178f.js";import"./shared-634b670e.js";import"./shared-651c44fa.js";import"./shared-2099544a.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2fc671cd.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-b6814728.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-e6e84ff5.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";let p,f,u,m,_,v,y,b,g,$,x,j,S,k,V,M,w,L,P,H,I,Z,B=e=>e;const C=s(e,"payments-api-payment-method-form");class D extends C{constructor(){super(...arguments),this.getImageSrc=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,a=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${a}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,a,i;const o=null!==(a=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==a?a:[];let s;try{s=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of o)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return d(p||(p=B` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?d(f||(f=B``)):d(u||(u=B` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){const e=d(m||(m=B` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),l(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()));return d(_||(_=B`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),e)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const a=t.charAt(0).toUpperCase(),i=!/\w/.test(a)?"#":a,o=e.find((e=>e.name===i));return o?o.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=a(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?d(y||(y=B` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>d(b||(b=B` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>d(g||(g=B`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):d(v||(v=B` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return d($||($=B` <div class="rounded-t-l rounded-b-l border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} `),this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),n({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,a,i;const o=0===t?"":`${e}-`,s=0===t?this.__liveBlocks:this.__testBlocks;return d(x||(x=B` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),n({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?d(j||(j=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,o):"",(null===(a=this.form.helper)||void 0===a?void 0:a.third_party_key_description)?d(S||(S=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,o):"",(null===(i=this.form.helper)||void 0===i?void 0:i.key_description)?d(k||(k=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,o):"",s.map((e=>this.__renderBlock(e))))})),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?d(V||(V=B` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?d(M||(M=B` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,a;const i=D.defaultImageSrc,o=null!==(a=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==a?a:i,s=e=>e.currentTarget.src=i;return d(w||(w=B` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),o,!!t.conflict,s,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),o,s,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return d(L||(L=B`${0}`),e.fields.map((e=>{var t,r,a;const o=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const a=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(a,e.id))&&void 0!==r?r:a.default_value}catch(t){return e.default_value}},l=t=>{var r;try{const a=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"{}");this.edit({additional_fields:JSON.stringify(h(a,e.id,t))})}catch(e){return""}},n=e.options;return d(P||(P=B` ${0} `),"checkbox"===e.type?d(H||(H=B` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(t=e.description)&&void 0!==t?t:"",o,[{label:e.name,value:"checked"}],(()=>s()?["checked"]:[]),(e=>{l(e.includes("checked"))})):"select"===e.type?d(I||(I=B` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(r=e.description)&&void 0!==r?r:"",e.name,o,n.map((({name:e,value:t})=>({label:e,value:t}))),s,l):d(Z||(Z=B` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=e.description)&&void 0!==a?a:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,o,s,l))})))}}customElements.define("foxy-payments-api-payment-method-form",D);export{D as PaymentsApiPaymentMethodForm};
1
+ import"./shared-2d723710.js";import"./shared-81d3a9ae.js";import"./shared-fa9e5c7f.js";import"./shared-10b5e78f.js";import"./shared-cc79152c.js";import"./shared-e96c5384.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-f1d2b5bb.js";import{_ as t,B as r,aM as a,l as i}from"./shared-0f6e4584.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-075796e2.js";import{i as l}from"./shared-9803aa7c.js";import{c as n}from"./shared-4e709717.js";import{h as d}from"./shared-dc73b9a5.js";import{h as c}from"./shared-9db46672.js";import{s as h}from"./shared-6474675f.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e5d37737.js";import"./shared-644ee296.js";import"./shared-fb56178f.js";import"./shared-634b670e.js";import"./shared-651c44fa.js";import"./shared-2099544a.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2fc671cd.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-b6814728.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-ee36b83f.js";import"./shared-e6e84ff5.js";import"./shared-22ba9566.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";let p,f,u,m,_,v,y,b,g,$,x,j,S,k,V,M,w,L,P,H,I,Z,B=e=>e;const C=s(e,"payments-api-payment-method-form");class D extends C{constructor(){super(...arguments),this.getImageSrc=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,a=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${a}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,a,i;const o=null!==(a=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==a?a:[];let s;try{s=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of o)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return d(p||(p=B` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?d(f||(f=B``)):d(u||(u=B` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){const e=d(m||(m=B` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),l(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()));return d(_||(_=B`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),e)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const a=t.charAt(0).toUpperCase(),i=!/\w/.test(a)?"#":a,o=e.find((e=>e.name===i));return o?o.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=a(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?d(y||(y=B` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>d(b||(b=B` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>d(g||(g=B`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):d(v||(v=B` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return d($||($=B` <div class="rounded-t-l rounded-b-l border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} `),this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),n({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,a,i;const o=0===t?"":`${e}-`,s=0===t?this.__liveBlocks:this.__testBlocks;return d(x||(x=B` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),n({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?d(j||(j=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,o):"",(null===(a=this.form.helper)||void 0===a?void 0:a.third_party_key_description)?d(S||(S=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,o):"",(null===(i=this.form.helper)||void 0===i?void 0:i.key_description)?d(k||(k=B` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,o):"",s.map((e=>this.__renderBlock(e))))})),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?d(V||(V=B` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?d(M||(M=B` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,a;const i=D.defaultImageSrc,o=null!==(a=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==a?a:i,s=e=>e.currentTarget.src=i;return d(w||(w=B` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}&ZeroWidthSpace;</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),o,!!t.conflict,s,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),o,s,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return d(L||(L=B`${0}`),e.fields.map((e=>{var t,r,a;const o=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const a=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(a,e.id))&&void 0!==r?r:a.default_value}catch(t){return e.default_value}},l=t=>{var r;try{const a=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"{}");this.edit({additional_fields:JSON.stringify(h(a,e.id,t))})}catch(e){return""}},n=e.options;return d(P||(P=B` ${0} `),"checkbox"===e.type?d(H||(H=B` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(t=e.description)&&void 0!==t?t:"",o,[{label:e.name,value:"checked"}],(()=>s()?["checked"]:[]),(e=>{l(e.includes("checked"))})):"select"===e.type?d(I||(I=B` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(r=e.description)&&void 0!==r?r:"",e.name,o,n.map((({name:e,value:t})=>({label:e,value:t}))),s,l):d(Z||(Z=B` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=e.description)&&void 0!==a?a:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,o,s,l))})))}}customElements.define("foxy-payments-api-payment-method-form",D);export{D as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-10b5e78f.js";import"./shared-b98b8d02.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-0f6e4584.js";import{a}from"./shared-075796e2.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2d723710.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5c05ac06.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-3e03c988.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-bab2ea2c.js";import"./shared-77051754.js";import"./shared-a6273e4a.js";import"./shared-3fa791ca.js";import"./shared-df00a537.js";import"./shared-339bbd50.js";import"./shared-18cb3cfc.js";import"./shared-797ba64a.js";import"./shared-2fc671cd.js";import"./shared-651c44fa.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./foxy-nucleon-element.js";import"./shared-9db46672.js";import"./shared-81d3a9ae.js";import"./shared-644ee296.js";import"./shared-fa9e5c7f.js";import"./shared-cc79152c.js";let o,i,d,p,n,m,h=e=>e;const c=a(e,"payments-api-payment-preset-form");class f extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get hiddenSelector(){return new t(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderBody(){const e=this.constructor;return s(o||(o=h` ${0} <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.renderHeader(),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?s(i||(i=h` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" alert .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" alert .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),this.data._links["fx:payment_methods"].href,(e=>s(d||(d=h` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>s(p||(p=h` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>s(n||(n=h` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>s(m||(m=h` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}f.__isPOEnabledOptions=[{label:"option_true",value:"true"}],f.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",f);export{f as PaymentsApiPaymentPresetForm};
1
+ import"./shared-10b5e78f.js";import"./shared-b98b8d02.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-0f6e4584.js";import{a}from"./shared-075796e2.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2d723710.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5c05ac06.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-3e03c988.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-bab2ea2c.js";import"./shared-77051754.js";import"./shared-a6273e4a.js";import"./shared-3fa791ca.js";import"./shared-df00a537.js";import"./shared-339bbd50.js";import"./shared-e96c5384.js";import"./shared-797ba64a.js";import"./shared-2fc671cd.js";import"./shared-651c44fa.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./foxy-nucleon-element.js";import"./shared-9db46672.js";import"./shared-81d3a9ae.js";import"./shared-644ee296.js";import"./shared-fa9e5c7f.js";import"./shared-cc79152c.js";let o,i,d,p,n,m,h=e=>e;const c=a(e,"payments-api-payment-preset-form");class f extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get hiddenSelector(){return new t(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderBody(){const e=this.constructor;return s(o||(o=h` ${0} <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.renderHeader(),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?s(i||(i=h` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" alert .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" alert .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),this.data._links["fx:payment_methods"].href,(e=>s(d||(d=h` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>s(p||(p=h` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>s(n||(n=h` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>s(m||(m=h` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}f.__isPOEnabledOptions=[{label:"option_true",value:"true"}],f.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",f);export{f as PaymentsApiPaymentPresetForm};
@@ -1 +1 @@
1
- import"./shared-2d723710.js";import"./shared-10b5e78f.js";import"./shared-fa9e5c7f.js";import"./shared-d393bcd8.js";import"./shared-cc79152c.js";import"./shared-f8723f3f.js";import"./shared-a159ccff.js";import"./shared-3fa791ca.js";import"./shared-b9138e9f.js";import"./shared-18cb3cfc.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./shared-f1d2b5bb.js";import{_ as t}from"./shared-0f6e4584.js";import{R as o,a as r}from"./shared-075796e2.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-522a172d.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e6e84ff5.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2fc671cd.js";import"./shared-e5d37737.js";import"./shared-651c44fa.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-df00a537.js";import"./shared-339bbd50.js";import"./shared-e2a61f69.js";import"./shared-f5366dda.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-5c05ac06.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.__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` ${0} <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} `),this.renderHeader(),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
+ import"./shared-2d723710.js";import"./shared-10b5e78f.js";import"./shared-fa9e5c7f.js";import"./shared-d393bcd8.js";import"./shared-cc79152c.js";import"./shared-f8723f3f.js";import"./shared-a159ccff.js";import"./shared-3fa791ca.js";import"./shared-f07d15d6.js";import"./shared-e96c5384.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-nucleon-element.js";import"./shared-f1d2b5bb.js";import{_ as t}from"./shared-0f6e4584.js";import{R as o,a as r}from"./shared-075796e2.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-522a172d.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-e6e84ff5.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2fc671cd.js";import"./shared-e5d37737.js";import"./shared-651c44fa.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-df00a537.js";import"./shared-339bbd50.js";import"./shared-e2a61f69.js";import"./shared-f5366dda.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-5c05ac06.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.__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` ${0} <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} `),this.renderHeader(),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-7fd9a30f.js";import"./shared-7ce91c80.js";import"./shared-10b5e78f.js";import"./shared-a159ccff.js";import"./shared-a036e345.js";import"./shared-588c6b15.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-shipping-container-card.js";import"./foxy-shipping-drop-type-card.js";import"./foxy-shipping-service-card.js";import"./foxy-shipping-method-card.js";import"./foxy-nucleon-element.js";import{_ as i,B as o}from"./shared-0f6e4584.js";import{a as t}from"./shared-075796e2.js";import{i as r}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-fb56178f.js";import"./shared-5c05ac06.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-2d723710.js";import"./shared-4e709717.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-bab2ea2c.js";import"./shared-b98b8d02.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-fe77f6f6.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-61f4e91a.js";import"./shared-a6273e4a.js";import"./shared-77051754.js";let n,d,p,a=e=>e;const h=t(e,"store-shipping-method-form"),c=e=>{try{return new URL(e),!0}catch(e){return!1}};class l extends h{constructor(){super(...arguments),this.shippingMethods=null,this.__shippingMethodLoaderId="shippingMethodLoader",this.__shippingMethodUriSetValue=e=>{this.undo(),this.edit({shipping_method_uri:e})},this.__destinationsGetValue=()=>{const e=[];return this.form.use_for_domestic&&e.push("domestic"),this.form.use_for_international&&e.push("international"),e},this.__destinationsSetValue=e=>{this.edit({use_for_domestic:e.includes("domestic"),use_for_international:e.includes("international")})},this.__destinationsOptions=[{value:"domestic",label:"domestic"},{value:"international",label:"international"}]}static get properties(){return i(i({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"}})}static get v8n(){return[({shipping_method_uri:e})=>e&&c(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,o;return"CUSTOM-ENDPOINT-POST"!==(null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code)||(e.accountid&&c(e.accountid)||"endpoint:v8n_required")},e=>{var i,o;const t=e.shipping_container_uri,r=null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code;return!r||!["USPS","FedEx","UPS"].includes(r)||(t&&c(t)||"shipping-container-uri:v8n_required")},e=>{var i,o;const t=e.shipping_drop_type_uri,r=null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code;return!r||!["FedEx","UPS"].includes(r)||(t&&c(t)||"shipping-drop-type-uri:v8n_required")}]}get hiddenSelector(){var e;const i=!!this.data,t=null===(e=this.__shippingMethod)||void 0===e?void 0:e.code;let r="shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password endpoint custom-code";if(t){const e={"CUSTOM-ENDPOINT-POST":"shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password custom-code","CUSTOM-CODE":"shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password endpoint",CUSTOM:"shipping-container-uri shipping-drop-type-uri authentication-key meter-number accountid password endpoint custom-code",FedEx:"endpoint custom-code",USPS:"authentication-key meter-number accountid password endpoint custom-code",UPS:"endpoint custom-code"};e[t]&&(r=e[t])}return i&&!(null==t?void 0:t.startsWith("CUSTOM"))||(r+=" services"),i&&(r=`shipping-method-uri ${r}`),new o(`${r} ${super.hiddenSelector}`.trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}get headerTitleOptions(){var e;return i(i({},super.headerTitleOptions),{},{provider:null===(e=this.__shippingMethod)||void 0===e?void 0:e.name})}renderBody(){var e,i,o,t;const h=this.__shippingMethod;return s(n||(n=a` ${0} <foxy-internal-resource-picker-control infer="shipping-method-uri" first="${0}" item="foxy-shipping-method-card" .setValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="shipping-container-uri" first="${0}" item="foxy-shipping-container-card"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="shipping-drop-type-uri" first="${0}" item="foxy-shipping-drop-type-card"> </foxy-internal-resource-picker-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-source-control infer="custom-code"></foxy-internal-source-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="shipping_service_uri" foreign-key-for-id="shipping_service_id" own-key-for-uri="shipping_method_uri" own-uri="${0}" embed-key="fx:store_shipping_services" options-href="${0}" links-href="${0}" infer="services" item="foxy-shipping-service-card"> </foxy-internal-async-resource-link-list-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} `),this.renderHeader(),r(null!==(e=this.shippingMethods)&&void 0!==e?e:null===(i=this.form._links)||void 0===i?void 0:i["fx:shipping_methods"].href),this.__shippingMethodUriSetValue,r(null==h?void 0:h._links["fx:shipping_containers"].href),r(null==h?void 0:h._links["fx:shipping_drop_types"].href),this.__destinationsGetValue,this.__destinationsSetValue,this.__destinationsOptions,"CUSTOM-ENDPOINT-POST"===(null==h?void 0:h.code)?s(d||(d=a` <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> `)):s(p||(p=a`<foxy-internal-text-control infer="accountid"></foxy-internal-text-control>`)),r(null===(o=this.data)||void 0===o?void 0:o._links.self.href),r(null==h?void 0:h._links["fx:shipping_services"].href),r(null===(t=this.data)||void 0===t?void 0:t._links["fx:store_shipping_services"].href),r(this.form.shipping_method_uri||void 0),this.__shippingMethodLoaderId,(e=>{const i=e.target.data;this.edit({_embedded:i?{"fx:shipping_method":i}:{}})}),super.renderBody())}get __shippingMethodLoader(){return this.renderRoot.querySelector(`#${this.__shippingMethodLoaderId}`)}get __shippingMethod(){var e,i,o;return null!==(i=null===(e=this.__shippingMethodLoader)||void 0===e?void 0:e.data)&&void 0!==i?i:null===(o=this.form._embedded)||void 0===o?void 0:o["fx:shipping_method"]}}customElements.define("foxy-store-shipping-method-form",l);export{l as StoreShippingMethodForm};
1
+ import"./shared-7fd9a30f.js";import"./shared-7ce91c80.js";import"./shared-10b5e78f.js";import"./shared-a159ccff.js";import"./shared-a036e345.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-shipping-container-card.js";import"./foxy-shipping-drop-type-card.js";import"./foxy-shipping-service-card.js";import"./foxy-shipping-method-card.js";import"./foxy-nucleon-element.js";import{_ as i,B as o}from"./shared-0f6e4584.js";import{a as r}from"./shared-075796e2.js";import{i as t}from"./shared-9803aa7c.js";import{h as s}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-fb56178f.js";import"./shared-5c05ac06.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-2d723710.js";import"./shared-4e709717.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-bab2ea2c.js";import"./shared-b98b8d02.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-fe77f6f6.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-61f4e91a.js";import"./shared-a6273e4a.js";import"./shared-77051754.js";let n,d,p,a=e=>e;const h=r(e,"store-shipping-method-form"),c=e=>{try{return new URL(e),!0}catch(e){return!1}};class l extends h{constructor(){super(...arguments),this.shippingMethods=null,this.__shippingMethodLoaderId="shippingMethodLoader",this.__shippingMethodUriSetValue=e=>{this.undo(),this.edit({shipping_method_uri:e})},this.__destinationsGetValue=()=>{const e=[];return this.form.use_for_domestic&&e.push("domestic"),this.form.use_for_international&&e.push("international"),e},this.__destinationsSetValue=e=>{this.edit({use_for_domestic:e.includes("domestic"),use_for_international:e.includes("international")})},this.__destinationsOptions=[{value:"domestic",label:"domestic"},{value:"international",label:"international"}]}static get properties(){return i(i({},super.properties),{},{shippingMethods:{attribute:"shipping-methods"}})}static get v8n(){return[({shipping_method_uri:e})=>e&&c(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,o;return"CUSTOM-ENDPOINT-POST"!==(null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code)||(e.accountid&&c(e.accountid)||"endpoint:v8n_required")},e=>{var i,o;const r=e.shipping_container_uri,t=null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code;return!t||!["USPS","FedEx","UPS"].includes(t)||(r&&c(r)||"shipping-container-uri:v8n_required")},e=>{var i,o;const r=e.shipping_drop_type_uri,t=null===(o=null===(i=e._embedded)||void 0===i?void 0:i["fx:shipping_method"])||void 0===o?void 0:o.code;return!t||!["FedEx","UPS"].includes(t)||(r&&c(r)||"shipping-drop-type-uri:v8n_required")}]}get hiddenSelector(){var e;const i=!!this.data,r=null===(e=this.__shippingMethod)||void 0===e?void 0:e.code;let t="shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password endpoint custom-code";if(r){const e={"CUSTOM-ENDPOINT-POST":"shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password custom-code","CUSTOM-CODE":"shipping-container-uri shipping-drop-type-uri destinations authentication-key meter-number accountid password endpoint",CUSTOM:"shipping-container-uri shipping-drop-type-uri authentication-key meter-number accountid password endpoint custom-code",FedEx:"endpoint custom-code",USPS:"authentication-key meter-number accountid password endpoint custom-code",UPS:"endpoint custom-code"};e[r]&&(t=e[r])}return i&&!(null==r?void 0:r.startsWith("CUSTOM"))||(t+=" services"),i&&(t=`shipping-method-uri ${t}`),new o(`${t} ${super.hiddenSelector}`.trim())}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}get headerTitleOptions(){var e;return i(i({},super.headerTitleOptions),{},{provider:null===(e=this.__shippingMethod)||void 0===e?void 0:e.name})}renderBody(){var e,i,o,r;const h=this.__shippingMethod;return s(n||(n=a` ${0} <foxy-internal-resource-picker-control infer="shipping-method-uri" first="${0}" item="foxy-shipping-method-card" .setValue="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="shipping-container-uri" first="${0}" item="foxy-shipping-container-card"> </foxy-internal-resource-picker-control> <foxy-internal-resource-picker-control infer="shipping-drop-type-uri" first="${0}" item="foxy-shipping-drop-type-card"> </foxy-internal-resource-picker-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-source-control infer="custom-code"></foxy-internal-source-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="shipping_service_uri" foreign-key-for-id="shipping_service_id" own-key-for-uri="shipping_method_uri" own-uri="${0}" embed-key="fx:store_shipping_services" options-href="${0}" links-href="${0}" infer="services" item="foxy-shipping-service-card"> </foxy-internal-async-resource-link-list-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> ${0} `),this.renderHeader(),t(null!==(e=this.shippingMethods)&&void 0!==e?e:null===(i=this.form._links)||void 0===i?void 0:i["fx:shipping_methods"].href),this.__shippingMethodUriSetValue,t(null==h?void 0:h._links["fx:shipping_containers"].href),t(null==h?void 0:h._links["fx:shipping_drop_types"].href),this.__destinationsGetValue,this.__destinationsSetValue,this.__destinationsOptions,"CUSTOM-ENDPOINT-POST"===(null==h?void 0:h.code)?s(d||(d=a` <foxy-internal-text-control infer="endpoint" property="accountid"> </foxy-internal-text-control> `)):s(p||(p=a`<foxy-internal-text-control infer="accountid"></foxy-internal-text-control>`)),t(null===(o=this.data)||void 0===o?void 0:o._links.self.href),t(null==h?void 0:h._links["fx:shipping_services"].href),t(null===(r=this.data)||void 0===r?void 0:r._links["fx:store_shipping_services"].href),t(this.form.shipping_method_uri||void 0),this.__shippingMethodLoaderId,(e=>{const i=e.target.data;this.edit({_embedded:i?{"fx:shipping_method":i}:{}})}),super.renderBody())}get __shippingMethodLoader(){return this.renderRoot.querySelector(`#${this.__shippingMethodLoaderId}`)}get __shippingMethod(){var e,i,o;return null!==(i=null===(e=this.__shippingMethodLoader)||void 0===e?void 0:e.data)&&void 0!==i?i:null===(o=this.form._embedded)||void 0===o?void 0:o["fx:shipping_method"]}}customElements.define("foxy-store-shipping-method-form",l);export{l as StoreShippingMethodForm};