@foxy.io/elements 1.40.0-beta.2 → 1.40.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.
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -14
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/{shared-0c134ce7.js → shared-0098edce.js} +1 -1
- package/dist/cdn/shared-511fcf8e.js +15 -0
- package/dist/cdn/shared-653368ea.js +1 -0
- package/dist/cdn/translations/native-integration-form/en.json +82 -17
- package/dist/cdn/translations/template-config-form/en.json +6 -6
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.d.ts +1 -0
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +24 -2
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.d.ts +1 -2
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js +32 -52
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/index.d.ts +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js +1 -0
- package/dist/elements/public/NativeIntegrationForm/index.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.d.ts +12 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js +123 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/InternalNativeIntegrationFormCodeMapControl.js.map +1 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.d.ts +8 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js +10 -0
- package/dist/elements/public/NativeIntegrationForm/internal/InternalNativeIntegrationFormCodeMapControl/index.js.map +1 -0
- package/dist/elements/public/TaxForm/TaxForm.js +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +2 -2
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +6 -9
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.d.ts +0 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js +40 -66
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControl.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.d.ts +8 -12
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js +69 -91
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/InternalTemplateConfigFormFilterValuesControlItem.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.d.ts +1 -0
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js +1 -0
- package/dist/elements/public/TemplateConfigForm/internal/InternalTemplateConfigFormFilterValuesControl/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-80a1bf6f.js +0 -1
- package/dist/cdn/shared-aca2705d.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-653368ea.js";import"./shared-0098edce.js";import"./shared-e21ddeae.js";import"./shared-511fcf8e.js";import"./shared-e0da7113.js";import"./shared-4a32f76a.js";import"./shared-e4119ddc.js";import{I as t}from"./shared-5b4e2567.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import{_ as e,B as r}from"./shared-cb58dfcd.js";import{a as o}from"./shared-11351c00.js";import{i}from"./shared-53e42a77.js";import{c as n}from"./shared-4e709717.js";import{h as s}from"./shared-ba5c42c7.js";import"./shared-8ef0ca65.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-c18f681b.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-5afb584d.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./shared-f83207fb.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5fd5805c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-b65d169b.js";import"./shared-8b0f00fa.js";import"./shared-be442f26.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-83c5e004.js";import"./shared-6683daed.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d0aed1c1.js";import"./shared-29f60d2f.js";import"./shared-a587fd4b.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./shared-63c32024.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";let a,l=t=>t;class m extends(o(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.store=null,this.__itemsLink=""}static get properties(){return e(e({},super.properties),{},{customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{},store:{}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}get headerSubtitleOptions(){var t;return{context:(null===(t=this.data)||void 0===t?void 0:t.is_future_line_item)?"future_line_item":"regular"}}get readonlySelector(){const t=[super.readonlySelector.toString()];return this.href&&t.unshift("subscriptions"),new r(t.join(" ").trim())}get hiddenSelector(){var t,e;const o=[super.hiddenSelector.toString()];return(null===(e=null===(t=this.__storeLoader)||void 0===t?void 0:t.data)||void 0===e?void 0:e.features_multiship)||o.unshift("general:shipto"),this.data&&!this.data.subscription_frequency&&o.unshift("subscriptions"),this.form.discount_name||o.unshift("discount:discount-builder"),this.href||o.unshift("discount-details","coupon-details","item-options","attributes"),new r(o.join(" ").trim())}renderBody(){var t,e,r,o,m,d,f;return s(a||(a=l` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="price" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="item-category-uri" item="foxy-item-category-card"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="code"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="parent-code"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="shipto"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="subscriptions"> <foxy-internal-frequency-control layout="summary-item" infer="subscription-frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="subscription-start-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="subscription-end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="item-options" first="${0}" form="foxy-item-option-form" item="foxy-item-option-card" alert .related="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="dimensions"> <foxy-internal-number-control layout="summary-item" infer="weight" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="length" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="width" min="0"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="height" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="meta"> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="image"> </foxy-internal-text-control> <foxy-internal-number-control layout="summary-item" infer="quantity-max" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="quantity-min" step="1" min="1"> </foxy-internal-number-control> <foxy-internal-date-control layout="summary-item" infer="expires" format="unix"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="discount"> <foxy-internal-text-control layout="summary-item" infer="discount-name"> </foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" class="${0}" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="discount-details" first="${0}" item="foxy-discount-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="coupon-details" first="${0}" item="foxy-coupon-detail-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),i(null!==(t=null==this?void 0:this.itemCategories)&&void 0!==t?t:void 0),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:item_options"].href),this.__itemOptionRelatedUrls,{"locale-codes":null!==(r=this.localeCodes)&&void 0!==r?r:""},n({hidden:this.hiddenSelector.matches("discount-builder",!0)}),this.__discountBuilderParsedValue,this.__handleDiscountBuilderChange,i(null===(o=this.data)||void 0===o?void 0:o._links["fx:discount_details"].href),i(null===(m=this.data)||void 0===m?void 0:m._links["fx:coupon_details"].href),i(null===(d=this.data)||void 0===d?void 0:d._links["fx:attributes"].href),super.renderBody(),i(null!==(f=this.store)&&void 0!==f?f:void 0),(()=>this.requestUpdate()))}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const e=t._links["fx:subscription"].href,r=(await super._fetch(e))._links["fx:transaction_template"].href,o=await super._fetch(r);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const e=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=e._links["fx:items"].href,t}if(t._links["fx:cart"]){const e=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=e._links["fx:items"].href,t}return t}get __discountBuilderParsedValue(){return{details:this.form.discount_details,type:this.form.discount_type,name:this.form.discount_name}}get __itemOptionRelatedUrls(){var t,e;const r=null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{},o=[];return r["fx:subscription"]&&o.push(r["fx:subscription"].href),r["fx:transaction"]&&o.push(r["fx:transaction"].href),r["fx:shipment"]&&o.push(r["fx:shipment"].href),r["fx:cart"]&&o.push(r["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}__handleDiscountBuilderChange(t){const e=t.currentTarget.parsedValue;this.edit({discount_details:e.details,discount_type:e.type,discount_name:e.name})}}customElements.define("foxy-item-form",m);export{m as ItemForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-511fcf8e.js";import"./shared-e0da7113.js";import"./shared-4a32f76a.js";import{I as r}from"./shared-5b4e2567.js";import{a as e}from"./shared-11351c00.js";import{h as o}from"./shared-ba5c42c7.js";import"./shared-4d32d19e.js";import"./shared-cb58dfcd.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-b65d169b.js";import"./shared-8b0f00fa.js";import"./shared-21e68b72.js";import"./shared-f9ac8763.js";import"./shared-be442f26.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-8ef0ca65.js";import"./shared-315d7620.js";import"./shared-53e42a77.js";import"./shared-4e709717.js";import"./shared-d0aed1c1.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-c18f681b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let t,a=r=>r;class s extends(e(r,"item-option-form")){static get v8n(){return[({name:r})=>!!r||"name:v8n_required",({name:r})=>!!r&&r.length<=100||"name:v8n_too_long",({value:r})=>!!r||"value:v8n_required",({value:r})=>!!r&&r.length<=1024||"value:v8n_too_long"]}renderBody(){return o(t||(t=a` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="value"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="mods"> <foxy-internal-number-control layout="summary-item" infer="price-mod"> </foxy-internal-number-control> <foxy-internal-number-control layout="summary-item" infer="weight-mod"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),super.renderBody())}}customElements.define("foxy-item-option-form",s);export{s as ItemOptionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-eef73355.js";import"./shared-4a4f6eb9.js";import"./shared-80a1bf6f.js";import"./shared-5cd33249.js";import"./shared-00e02b35.js";import"./shared-4a32f76a.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-nucleon-element.js";import{m as o,_ as r,B as t}from"./shared-cb58dfcd.js";import{a as n}from"./shared-11351c00.js";import{i as a}from"./shared-53e42a77.js";import{h as i,s as l}from"./shared-ba5c42c7.js";import"./shared-d807cb20.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-f9ac8763.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-4e709717.js";import"./shared-5fd5805c.js";import"./shared-d0aed1c1.js";import"./shared-53e476fd.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-8ef0ca65.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-243456aa.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-c18f681b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const s=JSON.stringify({service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""}),c=JSON.stringify({encryption_key:"",service:"json",version:1,events:[],title:"",url:""}),p=JSON.stringify({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:""}),f=JSON.stringify({url:""}),u=JSON.stringify({merchantID:""}),y=JSON.stringify({category_to_product_tax_code_mappings:{},enable_colorado_delivery_fee:!1,address_validation_countries:[],use_address_validation:!1,create_invoice:!1,company_code:"",service_url:"",use_ava_tax:!1,key:"",id:""}),d=JSON.stringify({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:""}),m=JSON.stringify({service:"zapier",events:[],url:""}),_=JSON.stringify({category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""});let v,x,h,g,j,b,w,$,k,O,S,C,V,q,J,N=e=>e;const P=n(e,"native-integration-form");class z extends P{constructor(){super(...arguments),this.store=null,this.__createConfigGetterFor=o((e=>()=>{var o;return null===(o=this.__config)||void 0===o?void 0:o[e]})),this.__createConfigSetterFor=o((e=>o=>this.__config={[e]:o})),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"},{value:"custom_tax",label:"option_custom_tax"}],this.__avalaraAddressValidationCountriesOptions=[{value:"US"},{value:"CA"}],this.__codeMappingsGetValue=()=>{var e,o;const r=null!==(o=null===(e=this.__config)||void 0===e?void 0:e.category_to_product_tax_code_mappings)&&void 0!==o?o:{};return Object.entries(r).map((([e,o])=>({value:`${e}:${o}`})))},this.__codeMappingsSetValue=e=>{const o={};for(const{value:r}of e){const[e,t]=r.split(":");e&&t&&(o[e]=t)}this.__config={category_to_product_tax_code_mappings:o}},this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,o;return(null!==(o=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==o?o:[]).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 properties(){return r(r({},super.properties),{},{store:{}})}static get v8n(){const e=o(JSON.parse),r=o((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:o="avalara",config:t="{}"})=>{const n=e(t).service_url,a=n?r(n)?null:"v8n_invalid":"v8n_required";return"avalara"!==o||!a||`avalara-service-url:${a}`},({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).id||"avalara-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).key||"avalara-key:v8n_required",({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).company_code||"avalara-company-code:v8n_required",({provider:o="avalara",config:r="{}"})=>{if("avalara"!==o)return!0;const t=e(r).category_to_product_tax_code_mappings;return t&&Object.entries(t).length>0||"avalara-category-to-product-tax-code-mappings:v8n_required"},({provider:o="avalara",config:r="{}"})=>"taxjar"!==o||!!e(r).api_token||"taxjar-api-token:v8n_required",({provider:o="avalara",config:t="{}"})=>{const n=e(t).service_url,a=n?r(n)?null:"v8n_invalid":"v8n_required";return"onesource"!==o||!a||`onesource-service-url:${a}`},({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).external_company_id||"onesource-external-company-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).from_city||"onesource-from-city:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).host_system||"onesource-host-system:v8n_required",({provider:o="avalara",config:r="{}"})=>{const{service:t,title:n}=e(r);return"webhook"!==o||"json"!==t||!!n||"webhook-json-title:v8n_required"},({provider:o="avalara",config:r="{}"})=>{const{service:t,encryption_key:n}=e(r);return"webhook"!==o||"json"!==t||!!n||"webhook-json-encryption-key:v8n_required"},({provider:o="avalara",config:t="{}"})=>{const{service:n,url:a}=e(t),i=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==o||"json"!==n||!i||`webhook-json-url:${i}`},({provider:o="avalara",config:r="{}"})=>{const{service:t,title:n}=e(r);return"webhook"!==o||"legacy_xml"!==t||!!n||"webhook-legacy-xml-title:v8n_required"},({provider:o="avalara",config:t="{}"})=>{const{service:n,url:a}=e(t),i=a?r(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==o||"legacy_xml"!==n||!i||`webhook-legacy-xml-url:${i}`},({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).site_id||"webflow-site-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).site_name||"webflow-site-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).collection_id||"webflow-collection-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).collection_name||"webflow-collection-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-group-one","zapier-group-one","provider-group-one"),new t(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e,o;const r=null!==(e=this.form.provider)&&void 0!==e?e:"avalara";return i(v||(v=N` ${0} ${0} ${0} ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @fetch="${0}"> </foxy-nucleon> `),this.renderHeader(),this.href?"":i(x||(x=N` <foxy-internal-summary-control infer="provider-group-one"> <foxy-internal-select-control layout="summary-item" infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===r?this.__renderAvalaraConfig():"taxjar"===r?this.__renderTaxJarConfig():"onesource"===r?this.__renderOneSourceConfig():"webflow"===r?this.__renderWebflowConfig():"zapier"===r?this.__renderZapierConfig():"webhook"===r?this.__renderWebhookConfig():"apple_pay"===r?this.__renderApplePayConfig():"custom_tax"===r?this.__renderCustomTaxConfig():"",super.renderBody(),a(null!==(o=this.store)&&void 0!==o?o:void 0),(()=>this.requestUpdate()))}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let o;try{o=(await e.json())._embedded["fx:errors"][0].message}catch(o){throw e}throw o.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 o;const t=this.__config,n=null!==(o=this.form.provider)&&void 0!==o?o:"avalara",a="avalara"===n?y:"taxjar"===n?_:"onesource"===n?p:"webflow"===n?d:"zapier"===n?m:"webhook"===n?"legacy_xml"===(null==t?void 0:t.service)?s:c:void 0,i=a?JSON.parse(a):{},l=JSON.stringify(r(r(r({},i),t),e));this.edit({provider:n,config:l})}__renderAvalaraConfig(){var e,o,r;const t=null===(o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===o?void 0:o.is_active,n="boolean"==typeof t?this.t("avalara-group-one.avalara-service-url.placeholder_"+(t?"active":"inactive")):void 0;return i(h||(h=N` <foxy-internal-summary-control infer="avalara-group-one"> <foxy-internal-text-control json-template="${0}" placeholder="${0}" json-path="service_url" property="config" layout="summary-item" infer="avalara-service-url"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="id" property="config" layout="summary-item" infer="avalara-id"> </foxy-internal-text-control> <foxy-internal-password-control json-template="${0}" json-path="key" property="config" layout="summary-item" infer="avalara-key"> </foxy-internal-password-control> <foxy-internal-text-control json-template="${0}" json-path="company_code" property="config" layout="summary-item" infer="avalara-company-code"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="avalara-group-two"> <foxy-internal-editable-list-control layout="summary-item" infer="avalara-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="avalara-group-three"> <foxy-internal-switch-control json-template="${0}" json-path="use_ava_tax" property="config" infer="avalara-use-ava-tax"> </foxy-internal-switch-control> <foxy-internal-switch-control json-template="${0}" json-path="use_address_validation" property="config" infer="avalara-use-address-validation"> </foxy-internal-switch-control> ${0} <foxy-internal-switch-control json-template="${0}" json-path="create_invoice" property="config" infer="avalara-create-invoice"> </foxy-internal-switch-control> <foxy-internal-switch-control json-template="${0}" json-path="enable_colorado_delivery_fee" property="config" infer="avalara-enable-colorado-delivery-fee"> </foxy-internal-switch-control> </foxy-internal-summary-control> `),y,a(n),y,y,y,this.__codeMappingsGetValue,this.__codeMappingsSetValue,y,y,(null===(r=this.__config)||void 0===r?void 0:r.use_address_validation)?i(g||(g=N` <foxy-internal-editable-list-control json-template="${0}" json-path="address_validation_countries" property="config" layout="summary-item" infer="avalara-address-validation-countries" .options="${0}"> </foxy-internal-editable-list-control> `),y,this.__avalaraAddressValidationCountriesOptions):"",y,y)}__renderTaxJarConfig(){return i(j||(j=N` <foxy-internal-summary-control infer="taxjar-group-one"> <foxy-internal-password-control json-template="${0}" json-path="api_token" property="config" layout="summary-item" infer="taxjar-api-token"> </foxy-internal-password-control> <foxy-internal-switch-control json-template="${0}" json-path="create_invoice" property="config" infer="taxjar-create-invoice"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="taxjar-group-two"> <foxy-internal-editable-list-control layout="summary-item" infer="taxjar-category-to-product-tax-code-mappings" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> `),_,_,this.__codeMappingsGetValue,this.__codeMappingsSetValue)}__renderOneSourceConfig(){return i(b||(b=N` <foxy-internal-summary-control infer="onesource-group-one"> <foxy-internal-text-control json-template="${0}" json-path="service_url" property="config" layout="summary-item" infer="onesource-service-url"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="external_company_id" property="config" layout="summary-item" infer="onesource-external-company-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="from_city" property="config" layout="summary-item" infer="onesource-from-city"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-two"> <foxy-internal-text-control json-template="${0}" json-path="calling_system_number" property="config" layout="summary-item" infer="onesource-calling-system-number"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="host_system" property="config" layout="summary-item" infer="onesource-host-system"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-three"> <foxy-internal-select-control json-template="${0}" json-path="audit_settings" property="config" layout="summary-item" infer="onesource-audit-settings" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control json-template="${0}" json-path="company_role" property="config" layout="summary-item" infer="onesource-company-role" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-four"> <foxy-internal-text-control json-template="${0}" json-path="part_number_product_option" property="config" layout="summary-item" infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-five"> <foxy-internal-editable-list-control layout="summary-item" infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> `),p,p,p,p,p,p,this.__onesourceAuditSettingsOptions,p,this.__onesourceCompanyRoleOptions,p,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue)}__renderWebhookConfig(){var e,o;return i(w||(w=N` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),l($||($=N`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(o=this.__config)||void 0===o?void 0:o.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return i(k||(k=N` <foxy-internal-summary-control infer="webhook-json-group-one"> <foxy-internal-text-control json-template="${0}" json-path="title" property="config" layout="summary-item" infer="webhook-json-title"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="webhook-json-url"> </foxy-internal-text-control> <foxy-internal-select-control json-template="${0}" json-path="service" property="config" layout="summary-item" infer="webhook-service" .options="${0}"> </foxy-internal-select-control> <foxy-internal-password-control json-template="${0}" json-path="encryption_key" property="config" layout="summary-item" infer="webhook-json-encryption-key"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webhook-json-group-two"> ${0} </foxy-internal-summary-control> `),c,c,c,this.__webhookServiceOptions,c,this.__webhookJsonEventsOptions.map((e=>i(O||(O=N` <foxy-internal-switch-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),`webhook-json-events-${e.value.replace(/\//g,"-")}`,(()=>{var o,r;return null===(r=null===(o=this.__config)||void 0===o?void 0:o.events)||void 0===r?void 0:r.includes(e.value)}),(o=>{var r,t;const n=null!==(t=null===(r=this.__config)||void 0===r?void 0:r.events)&&void 0!==t?t:[];this.__config={events:o?[...n,e.value]:n.filter((o=>o!==e.value))}})))))}__renderWebhookLegacyXmlConfig(){return i(S||(S=N` <foxy-internal-summary-control infer="webhook-legacy-xml-group-one"> <foxy-internal-text-control json-template="${0}" json-path="title" property="config" layout="summary-item" infer="webhook-legacy-xml-title"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="webhook-legacy-xml-url"> </foxy-internal-text-control> <foxy-internal-select-control json-template="${0}" json-path="service" property="config" layout="summary-item" infer="webhook-service" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> `),s,s,s,this.__webhookServiceOptions)}__renderWebflowConfig(){return i(C||(C=N` <foxy-internal-summary-control infer="webflow-group-one"> <foxy-internal-text-control json-template="${0}" json-path="site_id" property="config" layout="summary-item" infer="webflow-site-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="site_name" property="config" layout="summary-item" infer="webflow-site-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-two"> <foxy-internal-text-control json-template="${0}" json-path="collection_id" property="config" layout="summary-item" infer="webflow-collection-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="collection_name" property="config" layout="summary-item" infer="webflow-collection-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-three"> <foxy-internal-text-control json-template="${0}" json-path="sku_field_id" property="config" layout="summary-item" infer="webflow-sku-field-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="sku_field_name" property="config" layout="summary-item" infer="webflow-sku-field-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-four"> <foxy-internal-text-control json-template="${0}" json-path="inventory_field_id" property="config" layout="summary-item" infer="webflow-inventory-field-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="inventory_field_name" property="config" layout="summary-item" infer="webflow-inventory-field-name"> </foxy-internal-text-control> </foxy-internal-summary-control> `),d,d,d,d,d,d,d,d)}__renderZapierConfig(){return i(V||(V=N` <foxy-internal-summary-control infer="zapier-group-one"> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="zapier-url"> </foxy-internal-text-control> <foxy-internal-editable-list-control json-template="${0}" json-path="events" property="config" layout="summary-item" infer="zapier-events" simple-value> </foxy-internal-editable-list-control> <p class="text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> </foxy-internal-summary-control> `),m,m)}__renderApplePayConfig(){return i(q||(q=N` <foxy-internal-summary-control infer="apple-pay-group-one"> <foxy-internal-text-control json-template="${0}" json-path="merchantID" property="config" layout="summary-item" infer="apple-pay-merchant-id"> </foxy-internal-text-control> <p class="text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> </foxy-internal-summary-control> `),u)}__renderCustomTaxConfig(){return i(J||(J=N` <foxy-internal-summary-control infer="custom-tax-group-one"> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="custom-tax-url"> </foxy-internal-text-control> </foxy-internal-summary-control> `),f)}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-native-integration-form",z);export{z as NativeIntegrationForm};
|
|
1
|
+
import"./shared-eef73355.js";import"./shared-4a4f6eb9.js";import"./shared-511fcf8e.js";import"./shared-5cd33249.js";import"./shared-00e02b35.js";import"./shared-4a32f76a.js";import{a as e,I as o}from"./shared-5b4e2567.js";import"./foxy-nucleon-element.js";import"./shared-653368ea.js";import"./foxy-item-category-card.js";import{_ as r,m as t,B as n}from"./shared-cb58dfcd.js";import{g as a}from"./shared-bab2ea2c.js";import{i}from"./shared-53e42a77.js";import{h as l,s}from"./shared-ba5c42c7.js";import{c}from"./shared-4e709717.js";import{a as p}from"./shared-11351c00.js";import"./shared-d807cb20.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-f9ac8763.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-5fd5805c.js";import"./shared-d0aed1c1.js";import"./shared-53e476fd.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-8ef0ca65.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-243456aa.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-c18f681b.js";import"./foxy-spinner.js";import"./shared-0098edce.js";import"./shared-6957b8e6.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";let u,f,d,m=e=>e;customElements.define("foxy-internal-native-integration-form-code-map-control",class extends e{constructor(){super(...arguments),this.itemCategoryBase=null,this.itemCategories=null,this.__newMappingGetValue=()=>{},this.__newMappingSetValue=e=>{const o=a(e);if("string"==typeof o||"number"==typeof o)if(this._value&&o in this._value){const e=this.renderRoot.querySelector(`#category-${o}`);null==e||e.animate([{background:""},{background:"var(--lumo-primary-color-50pct)"},{background:""}],{duration:2e3,easing:"ease"})}else this._value=r(r({},this._value),{},{[o]:""})}}static get properties(){return r(r({},super.properties),{},{itemCategoryBase:{attribute:"item-category-base"},itemCategories:{attribute:"item-categories"}})}renderControl(){var e,o;return l(u||(u=m` <foxy-internal-summary-control infer="existing-mappings" unsafe-helper-text> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control helper-text="" label="" infer="new-mapping" class="mt-s"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="" item="foxy-item-category-card" .getValue="${0}" .setValue="${0}"> </foxy-internal-resource-picker-control> </foxy-internal-summary-control> `),Object.entries(null!==(e=this._value)&&void 0!==e?e:{}).map((([e,o])=>{var t,n,a,p,u;let y;try{y=new URL(e,null!==(t=this.itemCategoryBase)&&void 0!==t?t:void 0).toString()}catch(e){y=void 0}const _=this.renderRoot.querySelector(`#category${e}Loader`),v=(null==_?void 0:_.in("fail"))?this.t("existing-mappings.status_fail"):(null==_?void 0:_.in("busy"))?this.t("existing-mappings.status_busy"):null;return l(f||(f=m` <div class="flex items-center gap-xs" id="category-${0}"> <foxy-nucleon parent="${0}" class="hidden" infer="" href="${0}" id="category${0}Loader" @update="${0}"> </foxy-nucleon> <foxy-internal-text-control helper-text="" layout="summary-item" label="${0}" infer="" class="flex-1" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> `),e,i(null!==(n=this.itemCategories)&&void 0!==n?n:void 0),i(y),e,(()=>this.requestUpdate()),null!==(u=null!==(p=null===(a=null==_?void 0:_.data)||void 0===a?void 0:a.name)&&void 0!==p?p:v)&&void 0!==u?u:e,(()=>o),(o=>this._value=r(r({},this._value),{},{[e]:o})),this.t("delete"),c({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!!o,(()=>{const o=r({},this._value);delete o[e],this._value=o}),s(d||(d=m`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: translate(0.1em, 0.1em) scale(1.3);"><path fill-rule="evenodd" d="M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z" clip-rule="evenodd" /> </svg>`)))})),i(null!==(o=this.itemCategories)&&void 0!==o?o:void 0),this.__newMappingGetValue,this.__newMappingSetValue)}get _value(){return super._value}set _value(e){super._value=e}});const y=JSON.stringify({service:"legacy_xml",version:1,events:["transaction/created"],title:"",url:""}),_=JSON.stringify({encryption_key:"",service:"json",version:1,events:[],title:"",url:""}),v=JSON.stringify({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:""}),h=JSON.stringify({url:""}),x=JSON.stringify({merchantID:""}),g=JSON.stringify({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:""}),j=JSON.stringify({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:""}),b=JSON.stringify({service:"zapier",events:[],url:""}),w=JSON.stringify({category_to_product_tax_code_mappings:{},create_invoice:!1,api_token:""});let $,k,C,S,O,q,V,J,B,A,N,L,P,z,G,M=e=>e;const W=p(o,"native-integration-form");class R extends W{constructor(){super(...arguments),this.itemCategoryBase=null,this.store=null,this.__createConfigGetterFor=t((e=>()=>{var o;return null===(o=this.__config)||void 0===o?void 0:o[e]})),this.__createConfigSetterFor=t((e=>o=>this.__config={[e]:o})),this.__providerGetValue=()=>this.form.provider,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"},{value:"custom_tax",label:"option_custom_tax"}],this.__avalaraAddressValidationCountriesOptions=[{value:"US"},{value:"CA"}],this.__onesourceCompanyRoleOptions=[{value:"B",label:"option_buyer"},{value:"M",label:"option_middleman"},{value:"S",label:"option_seller"}],this.__onesourceProductOrderPriorityGetValue=()=>{var e,o;return(null!==(o=null===(e=this.__config)||void 0===e?void 0:e.product_order_priority.split(","))&&void 0!==o?o:[]).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 properties(){return r(r({},super.properties),{},{itemCategoryBase:{attribute:"item-category-base"},store:{}})}static get v8n(){const e=t(JSON.parse),o=t((e=>{try{return Boolean(new URL(e))}catch(e){return!1}}));return[({provider:r="avalara",config:t="{}"})=>{const n=e(t).service_url,a=n?o(n)?null:"v8n_invalid":"v8n_required";return"avalara"!==r||!a||`avalara-service-url:${a}`},({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).id||"avalara-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).key||"avalara-key:v8n_required",({provider:o="avalara",config:r="{}"})=>"avalara"!==o||!!e(r).company_code||"avalara-company-code:v8n_required",({provider:o="avalara",config:r="{}"})=>"taxjar"!==o||!!e(r).api_token||"taxjar-api-token:v8n_required",({provider:r="avalara",config:t="{}"})=>{const n=e(t).service_url,a=n?o(n)?null:"v8n_invalid":"v8n_required";return"onesource"!==r||!a||`onesource-service-url:${a}`},({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).external_company_id||"onesource-external-company-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).calling_system_number||"onesource-calling-system-number:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).from_city||"onesource-from-city:v8n_required",({provider:o="avalara",config:r="{}"})=>"onesource"!==o||!!e(r).host_system||"onesource-host-system:v8n_required",({provider:o="avalara",config:r="{}"})=>{const{service:t,title:n}=e(r);return"webhook"!==o||"json"!==t||!!n||"webhook-json-title:v8n_required"},({provider:o="avalara",config:r="{}"})=>{const{service:t,encryption_key:n}=e(r);return"webhook"!==o||"json"!==t||!!n||"webhook-json-encryption-key:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:n,url:a}=e(t),i=a?o(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"json"!==n||!i||`webhook-json-url:${i}`},({provider:o="avalara",config:r="{}"})=>{const{service:t,title:n}=e(r);return"webhook"!==o||"legacy_xml"!==t||!!n||"webhook-legacy-xml-title:v8n_required"},({provider:r="avalara",config:t="{}"})=>{const{service:n,url:a}=e(t),i=a?o(a)?null:"v8n_invalid":"v8n_required";return"webhook"!==r||"legacy_xml"!==n||!i||`webhook-legacy-xml-url:${i}`},({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).site_id||"webflow-site-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).site_name||"webflow-site-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).collection_id||"webflow-collection-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).collection_name||"webflow-collection-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).sku_field_id||"webflow-sku-field-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).sku_field_name||"webflow-sku-field-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).inventory_field_id||"webflow-inventory-field-id:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).inventory_field_name||"webflow-inventory-field-name:v8n_required",({provider:o="avalara",config:r="{}"})=>"webflow"!==o||!!e(r).auth||"webflow-auth:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("apple-pay-group-one","zapier-group-one","provider-group-one"),new n(e.join(" ").trim())}get headerTitleOptions(){return{context:this.data?`existing_${this.data.provider}`:"new",id:this.headerCopyIdValue}}renderBody(){var e;const o=this.form.provider;return l($||($=M` ${0} ${0} ${0} ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.href?"":l(k||(k=M` <foxy-internal-summary-control infer="provider-group-one"> <foxy-internal-select-control layout="summary-item" infer="provider" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> `),this.__providerGetValue,this.__providerSetValue,this.__templateProviderOptions),"avalara"===o?this.__renderAvalaraConfig():"taxjar"===o?this.__renderTaxJarConfig():"onesource"===o?this.__renderOneSourceConfig():"webflow"===o?this.__renderWebflowConfig():"zapier"===o?this.__renderZapierConfig():"webhook"===o?this.__renderWebhookConfig():"apple_pay"===o?this.__renderApplePayConfig():"custom_tax"===o?this.__renderCustomTaxConfig():"",super.renderBody(),i(null!==(e=this.store)&&void 0!==e?e:void 0),(()=>this.requestUpdate()))}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let o;try{o=(await e.json())._embedded["fx:errors"][0].message}catch(o){throw e}throw o.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 o;const t=this.__config,n=null!==(o=this.form.provider)&&void 0!==o?o:"avalara",a="avalara"===n?g:"taxjar"===n?w:"onesource"===n?v:"webflow"===n?j:"zapier"===n?b:"webhook"===n?"legacy_xml"===(null==t?void 0:t.service)?y:_:void 0,i=a?JSON.parse(a):{},l=JSON.stringify(r(r(r({},i),t),e));this.edit({provider:n,config:l})}__renderAvalaraConfig(){var e,o,r,t,n,a;const s=null===(o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===o?void 0:o.is_active,c=null===(t=null===(r=this.__storeLoader)||void 0===r?void 0:r.data)||void 0===t?void 0:t._links["fx:item_categories"].href,p="boolean"==typeof s?this.t("avalara-group-one.avalara-service-url.placeholder_"+(s?"active":"inactive")):void 0;return l(C||(C=M` <foxy-internal-summary-control infer="avalara-group-one"> <foxy-internal-text-control json-template="${0}" placeholder="${0}" json-path="service_url" property="config" layout="summary-item" infer="avalara-service-url"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="id" property="config" layout="summary-item" infer="avalara-id"> </foxy-internal-text-control> <foxy-internal-password-control json-template="${0}" json-path="key" property="config" layout="summary-item" infer="avalara-key"> </foxy-internal-password-control> <foxy-internal-text-control json-template="${0}" json-path="company_code" property="config" layout="summary-item" infer="avalara-company-code"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="avalara-group-two"> <foxy-internal-switch-control json-template="${0}" json-path="use_ava_tax" property="config" infer="avalara-use-ava-tax"> </foxy-internal-switch-control> <foxy-internal-switch-control json-template="${0}" json-path="use_address_validation" property="config" infer="avalara-use-address-validation"> </foxy-internal-switch-control> ${0} <foxy-internal-switch-control json-template="${0}" json-path="create_invoice" property="config" infer="avalara-create-invoice"> </foxy-internal-switch-control> <foxy-internal-switch-control json-template="${0}" json-path="enable_colorado_delivery_fee" property="config" infer="avalara-enable-colorado-delivery-fee"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-native-integration-form-code-map-control item-category-base="${0}" item-categories="${0}" json-template="${0}" json-path="category_to_product_tax_code_mappings" property="config" layout="summary-item" infer="avalara-category-to-product-tax-code-mappings"> </foxy-internal-native-integration-form-code-map-control> `),g,i(p),g,g,g,g,g,(null===(n=this.__config)||void 0===n?void 0:n.use_address_validation)?l(S||(S=M` <foxy-internal-editable-list-control json-template="${0}" json-path="address_validation_countries" property="config" layout="summary-item" infer="avalara-address-validation-countries" .options="${0}"> </foxy-internal-editable-list-control> `),g,this.__avalaraAddressValidationCountriesOptions):"",g,g,i(null!==(a=this.itemCategoryBase)&&void 0!==a?a:void 0),i(c),g)}__renderTaxJarConfig(){var e,o,r;const t=null===(o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===o?void 0:o._links["fx:item_categories"].href;return l(O||(O=M` <foxy-internal-summary-control infer="taxjar-group-one"> <foxy-internal-password-control json-template="${0}" json-path="api_token" property="config" layout="summary-item" infer="taxjar-api-token"> </foxy-internal-password-control> <foxy-internal-switch-control json-template="${0}" json-path="create_invoice" property="config" infer="taxjar-create-invoice"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-native-integration-form-code-map-control item-category-base="${0}" item-categories="${0}" json-template="${0}" json-path="category_to_product_tax_code_mappings" property="config" infer="taxjar-category-to-product-tax-code-mappings"> </foxy-internal-native-integration-form-code-map-control> `),w,w,i(null!==(r=this.itemCategoryBase)&&void 0!==r?r:void 0),i(t),w)}__renderOneSourceConfig(){return l(q||(q=M` <foxy-internal-summary-control infer="onesource-group-one"> <foxy-internal-text-control json-template="${0}" json-path="service_url" property="config" layout="summary-item" infer="onesource-service-url"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="external_company_id" property="config" layout="summary-item" infer="onesource-external-company-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="from_city" property="config" layout="summary-item" infer="onesource-from-city"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-two"> <foxy-internal-text-control json-template="${0}" json-path="calling_system_number" property="config" layout="summary-item" infer="onesource-calling-system-number"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="host_system" property="config" layout="summary-item" infer="onesource-host-system"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-three"> <foxy-internal-select-control json-template="${0}" json-path="audit_settings" property="config" layout="summary-item" infer="onesource-audit-settings" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control json-template="${0}" json-path="company_role" property="config" layout="summary-item" infer="onesource-company-role" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-four"> <foxy-internal-text-control json-template="${0}" json-path="part_number_product_option" property="config" layout="summary-item" infer="onesource-part-number-product-option" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="onesource-group-five"> <foxy-internal-editable-list-control layout="summary-item" infer="onesource-product-order-priority" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> </foxy-internal-summary-control> `),v,v,v,v,v,v,this.__onesourceAuditSettingsOptions,v,this.__onesourceCompanyRoleOptions,v,this.__createConfigGetterFor("part_number_product_option"),this.__createConfigSetterFor("part_number_product_option"),this.__onesourceProductOrderPriorityGetValue,this.__onesourceProductOrderPrioritySetValue)}__renderWebhookConfig(){var e,o;return l(V||(V=M` <div class="flex items-start border border-error rounded" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="webhook-warning" key="warning_text"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-error transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> <foxy-i18n infer="webhook-warning" key="link_text"></foxy-i18n> </a> </p> </div> ${0} `),s(J||(J=M`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),"json"===(null===(e=this.__config)||void 0===e?void 0:e.service)?this.__renderWebhookJsonConfig():"legacy_xml"===(null===(o=this.__config)||void 0===o?void 0:o.service)?this.__renderWebhookLegacyXmlConfig():"")}__renderWebhookJsonConfig(){return l(B||(B=M` <foxy-internal-summary-control infer="webhook-json-group-one"> <foxy-internal-text-control json-template="${0}" json-path="title" property="config" layout="summary-item" infer="webhook-json-title"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="webhook-json-url"> </foxy-internal-text-control> <foxy-internal-select-control json-template="${0}" json-path="service" property="config" layout="summary-item" infer="webhook-service" .options="${0}"> </foxy-internal-select-control> <foxy-internal-password-control json-template="${0}" json-path="encryption_key" property="config" layout="summary-item" infer="webhook-json-encryption-key"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webhook-json-group-two"> ${0} </foxy-internal-summary-control> `),_,_,_,this.__webhookServiceOptions,_,this.__webhookJsonEventsOptions.map((e=>l(A||(A=M` <foxy-internal-switch-control infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),`webhook-json-events-${e.value.replace(/\//g,"-")}`,(()=>{var o,r;return null===(r=null===(o=this.__config)||void 0===o?void 0:o.events)||void 0===r?void 0:r.includes(e.value)}),(o=>{var r,t;const n=null!==(t=null===(r=this.__config)||void 0===r?void 0:r.events)&&void 0!==t?t:[];this.__config={events:o?[...n,e.value]:n.filter((o=>o!==e.value))}})))))}__renderWebhookLegacyXmlConfig(){return l(N||(N=M` <foxy-internal-summary-control infer="webhook-legacy-xml-group-one"> <foxy-internal-text-control json-template="${0}" json-path="title" property="config" layout="summary-item" infer="webhook-legacy-xml-title"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="webhook-legacy-xml-url"> </foxy-internal-text-control> <foxy-internal-select-control json-template="${0}" json-path="service" property="config" layout="summary-item" infer="webhook-service" .options="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> `),y,y,y,this.__webhookServiceOptions)}__renderWebflowConfig(){return l(L||(L=M` <foxy-internal-summary-control infer="webflow-group-one"> <foxy-internal-text-control json-template="${0}" json-path="site_id" property="config" layout="summary-item" infer="webflow-site-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="site_name" property="config" layout="summary-item" infer="webflow-site-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-two"> <foxy-internal-text-control json-template="${0}" json-path="collection_id" property="config" layout="summary-item" infer="webflow-collection-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="collection_name" property="config" layout="summary-item" infer="webflow-collection-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-three"> <foxy-internal-text-control json-template="${0}" json-path="sku_field_id" property="config" layout="summary-item" infer="webflow-sku-field-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="sku_field_name" property="config" layout="summary-item" infer="webflow-sku-field-name"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="webflow-group-four"> <foxy-internal-text-control json-template="${0}" json-path="inventory_field_id" property="config" layout="summary-item" infer="webflow-inventory-field-id"> </foxy-internal-text-control> <foxy-internal-text-control json-template="${0}" json-path="inventory_field_name" property="config" layout="summary-item" infer="webflow-inventory-field-name"> </foxy-internal-text-control> </foxy-internal-summary-control> `),j,j,j,j,j,j,j,j)}__renderZapierConfig(){return l(P||(P=M` <foxy-internal-summary-control infer="zapier-group-one"> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="zapier-url"> </foxy-internal-text-control> <foxy-internal-editable-list-control json-template="${0}" json-path="events" property="config" layout="summary-item" infer="zapier-events" simple-value> </foxy-internal-editable-list-control> <p class="text-secondary leading-xs"> <foxy-i18n infer="zapier-warning" key="warning_text"></foxy-i18n> </p> </foxy-internal-summary-control> `),b,b)}__renderApplePayConfig(){return l(z||(z=M` <foxy-internal-summary-control infer="apple-pay-group-one"> <foxy-internal-text-control json-template="${0}" json-path="merchantID" property="config" layout="summary-item" infer="apple-pay-merchant-id"> </foxy-internal-text-control> <p class="text-secondary leading-xs"> <foxy-i18n infer="apple-pay-warning" key="warning_text"></foxy-i18n> </p> </foxy-internal-summary-control> `),x)}__renderCustomTaxConfig(){return l(G||(G=M` <foxy-internal-summary-control infer="custom-tax-group-one"> <foxy-internal-text-control json-template="${0}" json-path="url" property="config" layout="summary-item" infer="custom-tax-url"> </foxy-internal-text-control> </foxy-internal-summary-control> `),h)}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-native-integration-form",R);export{R as NativeIntegrationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-37348820.js";import"./shared-c18f681b.js";import"./shared-8ef0ca65.js";import"./shared-e5546d55.js";import"./shared-5212ef4f.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as e,B as t}from"./shared-cb58dfcd.js";import{l as s,u as r}from"./shared-cf613436.js";import{C as a}from"./shared-5afb584d.js";import{T as i,a as o}from"./shared-11351c00.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c as l}from"./shared-ba5c42c7.js";import{i as c}from"./shared-53e42a77.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-f83207fb.js";import"./shared-21e68b72.js";import"./shared-f9ac8763.js";import"./shared-315d7620.js";import"./shared-048d5cae.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-
|
|
1
|
+
import"./shared-37348820.js";import"./shared-c18f681b.js";import"./shared-8ef0ca65.js";import"./shared-e5546d55.js";import"./shared-5212ef4f.js";import"./foxy-update-payment-method-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as e,B as t}from"./shared-cb58dfcd.js";import{l as s,u as r}from"./shared-cf613436.js";import{C as a}from"./shared-5afb584d.js";import{T as i,a as o}from"./shared-11351c00.js";import"./foxy-nucleon-element.js";import{u as d,h as n,c as l}from"./shared-ba5c42c7.js";import{i as c}from"./shared-53e42a77.js";import{c as m}from"./shared-4e709717.js";import{N as p}from"./shared-f83207fb.js";import"./shared-21e68b72.js";import"./shared-f9ac8763.js";import"./shared-315d7620.js";import"./shared-048d5cae.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-653368ea.js";import"./shared-0098edce.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-511fcf8e.js";import"./shared-5b4e2567.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-bab2ea2c.js";import"./foxy-collection-page.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./foxy-template-set-card.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./foxy-payment-card-embed.js";import"./shared-be442f26.js";import"./shared-8b0f00fa.js";import"./shared-c1e86ea4.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-99a8889a.js";import"./shared-673d668a.js";const h=d("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),f=d(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${h} }`)).join(" "));let u,b,j,y,v,g,$,x,_,S,w=e=>e;const T=i(a(o(p,"payment-method-card")));class k extends T{constructor(){super(...arguments),this.embedUrl=null,this.__renderActionsUpdate=()=>{var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.save_cc),s=t?"--lumo-primary-text-color: #fff; --lumo-primary-color-50pct: rgba(255, 255, 255, 0.5); --lumo-contrast-5pct: rgba(255, 255, 255, 0.05)":void 0;return n(u||(u=w` <div class="flex"> ${0} <foxy-form-dialog data-testid="update-dialog" readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="status ${0}" header="${0}" group="${0}" form="foxy-update-payment-method-form" href="${0}" lang="${0}" ns="${0} dialog" alert close-on-patch .props="${0}"> </foxy-form-dialog> <vaadin-button class="${0}" theme="${0}" style="${0}" aria-label="${0}" data-testid="actions:update" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:update:before"),this.readonlySelector.zoom("actions:update:form"),this.disabledSelector.zoom("actions:update:form"),this.hiddenSelector.zoom("actions:update:form"),t?"dialog_header_update":"dialog_header_add",this.group,this.href,this.lang,this.ns,{".embedUrl":this.embedUrl},c(t?"px-xs rounded":void 0),t?"icon":"contrast small",c(s),this.t(t?"update":"add"),this.disabledSelector.matches("actions:update",!0),(e=>{const t=e.currentTarget;t.previousElementSibling.show(t)}),n(t?b||(b=w`<iron-icon icon="icons:create"></iron-icon>`):j||(j=w`<foxy-i18n infer="" key="add"></foxy-i18n>`)),this.renderTemplateOrSlot("actions:update:after"))},this.__renderActionsDelete=()=>n(y||(y=w` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>{const e=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl,t=this.hiddenSelector.matches("actions:delete",!0);return n(v||(v=w` <div class="flex gap-s" data-testid="actions"> ${0} ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),e?"":this.__renderActionsUpdate(),t?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}}static get properties(){return e(e({},super.properties),{},{embedUrl:{attribute:"embed-url"}})}static get styles(){return[super.styles,f,l(g||(g=w`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var e,a,i,o,d,l;const{data:c,lang:p,ns:h}=this;if(this.in({idle:"template"})||!(null==c?void 0:c.save_cc)||!this.in("idle")){const t=this.in("fail")?"error":this.in("busy")?"busy":"empty",s=this.hiddenSelector.matches("actions:update",!0)||!this.embedUrl||!this.data;return n($||($=w` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex flex-col gap-m items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> ${0} </div> </div> `),this.in("busy"),t,this.lang,h,null!==(a=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==a?a:"",s?"":this.__renderActionsUpdate())}const f=null!==(o=null===(i=c.cc_type)||void 0===i?void 0:i.toLowerCase())&&void 0!==o?o:"unknown",u=null!==(d=s[f])&&void 0!==d?d:r,b=null===(l=c.cc_number_masked)||void 0===l?void 0:l.substring(c.cc_number_masked.length-4);return n(x||(x=w` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> <div class="mr-auto rounded h-m">${0}</div> ${0} </div> <div class="font-tnum leading-none flex justify-between" style="color:#fff"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),p,h,this.__handleConfirmHide,this.in("busy"),f,m({"flex items-start":!0,"justify-between":this.readonlyControls===t.False,"justify-end":this.readonlyControls===t.True}),u,this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),c.cc_exp_month&&c.cc_exp_year?n(_||(_=w` <span class="sr-only">${0} </span> <span>${0} / ${0}</span> `),this.t("expires").toString(),c.cc_exp_month,c.cc_exp_year):"",b?n(S||(S=w` <span class="sr-only">${0} </span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),b):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return p.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",k);export{k as PaymentMethodCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-8ef0ca65.js";import"./shared-
|
|
1
|
+
import"./shared-8ef0ca65.js";import"./shared-511fcf8e.js";import"./shared-00e02b35.js";import"./shared-e0da7113.js";import"./shared-5cd33249.js";import"./shared-4a32f76a.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-nucleon-element.js";import"./shared-4d32d19e.js";import{_ as t,B as r,aM as o,l as a}from"./shared-cb58dfcd.js";import{a as i}from"./shared-11351c00.js";import{i as s}from"./shared-53e42a77.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-ba5c42c7.js";import{s as d}from"./shared-0aedd809.js";import{h as c}from"./shared-ef4ad461.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-d807cb20.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-b65d169b.js";import"./shared-8b0f00fa.js";import"./shared-be442f26.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-243456aa.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-2aa23b5f.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-c18f681b.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let f,p,h,u,m,v,y,j,_,b,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,a;const i=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(f||(f=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=P``)):l(h||(h=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(y||(y=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(j||(j=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(_||(_=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(b||(b=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,f=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,f,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,f,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,f,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-8ef0ca65.js";import"./shared-4a4f6eb9.js";import"./shared-80a1bf6f.js";import"./shared-00e02b35.js";import"./shared-5cd33249.js";import"./shared-4a32f76a.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as t,B as r,l as o}from"./shared-cb58dfcd.js";import{g as i}from"./shared-bab2ea2c.js";import{a}from"./shared-11351c00.js";import{i as s}from"./shared-53e42a77.js";import{h as l,s as n}from"./shared-ba5c42c7.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-ef4ad461.js";import{s as h}from"./shared-0aedd809.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-d807cb20.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-243456aa.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-2aa23b5f.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-c18f681b.js";let u,p,m,f,_,v,y,g,x,$,b,j,w,L,S,k,P,V,M,I,B,C,q,Z,H,D,O,R,T=e=>e;const W=a(e,"payments-api-payment-method-form");class z extends W{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,o=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${o}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}]}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=T` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=T``)):l(m||(m=T` <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=i(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=i(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=T` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=T`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const o=t.charAt(0).toUpperCase(),i=!/\w/.test(o)?"#":o,a=e.find((e=>e.name===i));return a?a.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=T` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=T` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=T`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=T` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e,t;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=T` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=T` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_auth_only)?l(w||(w=T` <foxy-internal-switch-control infer="use-auth-only" helper-text-as-tooltip> </foxy-internal-switch-control> `)):"",(null===(t=this.form.helper)||void 0===t?void 0:t.supports_3d_secure)?l(L||(L=T` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=T` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,o,i,a,d,c,h,u,p,m,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=T``));if("live"===e&&!(null===(i=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===i?void 0:i.is_active))return l(P||(P=T` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(V||(V=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(p=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===p?void 0:p.is_live));return l(M||(M=T` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(m=this.form.helper)||void 0===m?void 0:m.id_description)?l(I||(I=T` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(B||(B=T` <foxy-internal-password-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(C||(C=T` <foxy-internal-password-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,o;const i=z.defaultImageSrc,a=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:i,s=e=>e.currentTarget.src=i;return l(q||(q=T` <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}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(Z||(Z=T`${0}`),e.fields.map((e=>{var t,r,i;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const i=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=o(i,e.id))&&void 0!==r?r:i.default_value}catch(t){return e.default_value}},n=t=>{var r;let o={};try{o=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(o,e.id,t))})},d=e.options;return l(H||(H=T` ${0} `),"checkbox"===e.type?l(D||(D=T` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(O||(O=T` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(R||(R=T` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=e.description)&&void 0!==i?i:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",z);export{z as PaymentsApiPaymentMethodForm};
|
|
1
|
+
import"./shared-8ef0ca65.js";import"./shared-4a4f6eb9.js";import"./shared-511fcf8e.js";import"./shared-00e02b35.js";import"./shared-5cd33249.js";import"./shared-4a32f76a.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as t,B as r,l as o}from"./shared-cb58dfcd.js";import{g as i}from"./shared-bab2ea2c.js";import{a}from"./shared-11351c00.js";import{i as s}from"./shared-53e42a77.js";import{h as l,s as n}from"./shared-ba5c42c7.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-ef4ad461.js";import{s as h}from"./shared-0aedd809.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-d807cb20.js";import"./shared-37348820.js";import"./shared-360d6a20.js";import"./shared-243456aa.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-2aa23b5f.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-c18f681b.js";let u,p,m,f,_,v,y,g,x,$,b,j,w,L,S,k,P,V,M,I,B,C,q,Z,H,D,O,R,T=e=>e;const W=a(e,"payments-api-payment-method-form");class z extends W{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,o=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${o}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}]}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=T` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=T``)):l(m||(m=T` <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=i(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=i(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=T` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=T`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const o=t.charAt(0).toUpperCase(),i=!/\w/.test(o)?"#":o,a=e.find((e=>e.name===i));return a?a.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=T` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=T` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=T`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=T` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e,t;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=T` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=T` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_auth_only)?l(w||(w=T` <foxy-internal-switch-control infer="use-auth-only" helper-text-as-tooltip> </foxy-internal-switch-control> `)):"",(null===(t=this.form.helper)||void 0===t?void 0:t.supports_3d_secure)?l(L||(L=T` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=T` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,o,i,a,d,c,h,u,p,m,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=T``));if("live"===e&&!(null===(i=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===i?void 0:i.is_active))return l(P||(P=T` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(V||(V=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(p=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===p?void 0:p.is_live));return l(M||(M=T` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(m=this.form.helper)||void 0===m?void 0:m.id_description)?l(I||(I=T` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(B||(B=T` <foxy-internal-password-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(C||(C=T` <foxy-internal-password-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,o;const i=z.defaultImageSrc,a=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:i,s=e=>e.currentTarget.src=i;return l(q||(q=T` <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}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(Z||(Z=T`${0}`),e.fields.map((e=>{var t,r,i;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const i=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=o(i,e.id))&&void 0!==r?r:i.default_value}catch(t){return e.default_value}},n=t=>{var r;let o={};try{o=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(o,e.id,t))})},d=e.options;return l(H||(H=T` ${0} `),"checkbox"===e.type?l(D||(D=T` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(O||(O=T` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(R||(R=T` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=e.description)&&void 0!==i?i:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",z);export{z as PaymentsApiPaymentMethodForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-0098edce.js";import"./shared-511fcf8e.js";import"./shared-00e02b35.js";import"./shared-4a32f76a.js";import{I as e}from"./shared-5b4e2567.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-cb58dfcd.js";import{a as o}from"./shared-11351c00.js";import{i as s}from"./shared-53e42a77.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-37348820.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-8ef0ca65.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c18f681b.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-8b0f00fa.js";import"./shared-be442f26.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./shared-e0da7113.js";import"./shared-b65d169b.js";import"./shared-5cd33249.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./foxy-nucleon-element.js";import"./shared-ef4ad461.js";import"./shared-4a4f6eb9.js";import"./shared-8b25a098.js";let a,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return i(a||(a=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
|