@foxy.io/elements 1.29.0-beta.2 → 1.29.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-cart-form.js +2 -2
- package/dist/cdn/foxy-client-form.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-customer-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-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +2 -2
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-passkey-form.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-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/shared-3ea78c8d.js +1 -0
- package/dist/cdn/shared-a8170f94.js +1 -0
- package/dist/cdn/shared-cdf20ded.js +1 -0
- package/dist/cdn/shared-d393bcd8.js +1 -0
- package/dist/cdn/shared-e96c5384.js +1 -0
- package/dist/cdn/shared-f07d15d6.js +1 -0
- package/dist/cdn/{shared-70a5fad6.js → shared-f8723f3f.js} +1 -1
- package/dist/cdn/translations/item-category-form/en.json +181 -148
- package/dist/cdn/translations/subscription-settings-form/en.json +85 -61
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.d.ts +1 -0
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js +39 -18
- package/dist/elements/internal/InternalEditableListControl/InternalEditableListControl.js.map +1 -1
- package/dist/elements/internal/InternalEditableListControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalEditableListControl/index.js +1 -0
- package/dist/elements/internal/InternalEditableListControl/index.js.map +1 -1
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js +2 -2
- package/dist/elements/internal/InternalFrequencyControl/InternalFrequencyControl.js.map +1 -1
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.d.ts +3 -0
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js +35 -12
- package/dist/elements/internal/InternalNumberControl/InternalNumberControl.js.map +1 -1
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.d.ts +2 -0
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js +12 -2
- package/dist/elements/internal/InternalSelectControl/InternalSelectControl.js.map +1 -1
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js +2 -2
- package/dist/elements/internal/InternalSummaryControl/InternalSummaryControl.js.map +1 -1
- package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.d.ts +1 -0
- package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js +31 -9
- package/dist/elements/internal/InternalSwitchControl/InternalSwitchControl.js.map +1 -1
- package/dist/elements/internal/InternalSwitchControl/index.d.ts +1 -0
- package/dist/elements/internal/InternalSwitchControl/index.js +1 -0
- package/dist/elements/internal/InternalSwitchControl/index.js.map +1 -1
- package/dist/elements/internal/InternalTextControl/InternalTextControl.d.ts +2 -0
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js +14 -3
- package/dist/elements/internal/InternalTextControl/InternalTextControl.js.map +1 -1
- package/dist/elements/public/CartForm/internal/InternalCartFormAddressSummaryItem/InternalCartFormAddressSummaryItem.js +3 -3
- package/dist/elements/public/CartForm/internal/InternalCartFormAddressSummaryItem/InternalCartFormAddressSummaryItem.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +1 -7
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +109 -135
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/index.d.ts +4 -3
- package/dist/elements/public/ItemCategoryForm/index.js +4 -3
- package/dist/elements/public/ItemCategoryForm/index.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.d.ts +4 -13
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js +105 -115
- package/dist/elements/public/SubscriptionSettingsForm/SubscriptionSettingsForm.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/index.d.ts +4 -4
- package/dist/elements/public/SubscriptionSettingsForm/index.js +4 -4
- package/dist/elements/public/SubscriptionSettingsForm/index.js.map +1 -1
- package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +3 -1
- package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-292ba15e.js +0 -1
- package/dist/cdn/shared-6e355777.js +0 -1
- package/dist/cdn/shared-aefac46b.js +0 -1
- package/dist/cdn/shared-d4810405.js +0 -1
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.d.ts +0 -12
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js +0 -128
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/InternalSubscriptionSettingsFormReattemptBypass.js.map +0 -1
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.d.ts +0 -2
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js +0 -26
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/globalStyles.js.map +0 -1
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.d.ts +0 -7
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js +0 -13
- package/dist/elements/public/SubscriptionSettingsForm/internal/InternalSubscriptionSettingsFormReattemptBypass/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-10b5e78f.js";import"./shared-
|
|
1
|
+
import"./shared-10b5e78f.js";import"./shared-e96c5384.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import{a as r}from"./shared-075796e2.js";import{B as t}from"./shared-0f6e4584.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-797ba64a.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-2099544a.js";import"./shared-2fc671cd.js";import"./shared-e5d37737.js";import"./shared-651c44fa.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";const a={AF:[],AX:[],AL:[],DZ:[],AS:[],AD:[],AO:[],AI:[],AQ:[],AG:[],AR:[],AM:[],AW:[],AU:["ACT","NSW","NT","QLD","SA","TAS","VIC","WA"],AT:["BL","KN","NO","OO","SB","ST","TI","VB","WI"],AZ:[],BS:[],BH:[],BD:[],BB:[],BY:[],BE:[],BZ:[],BJ:[],BM:[],BT:[],BO:[],BQ:["BO","SA","SE"],BA:[],BW:[],BV:[],BR:[],IO:[],BN:[],BG:[],BF:[],BI:[],KH:[],CM:[],CA:["AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT"],CV:[],CW:[],KY:[],CF:[],TD:[],CL:[],CN:[],CX:[],CC:[],CO:[],KM:[],CG:[],CD:[],CK:[],CR:[],CI:[],HR:[],CU:[],CY:[],CZ:[],DK:[],DJ:[],DM:[],DO:[],EC:[],EG:[],SV:[],SX:[],GQ:[],ER:[],EE:[],ET:[],FK:[],FO:[],FJ:[],FI:[],FR:[],GF:[],PF:[],TF:[],GA:[],GM:[],GE:[],DE:["BW","BY","BE","BB","HB","HH","HE","MV","NI","NW","RP","SL","SN","ST","SH","TH"],GH:[],GI:[],GR:[],GL:[],GD:[],GP:[],GU:[],GT:[],GG:[],GN:[],GW:[],GY:[],HT:[],HM:[],VA:[],HN:[],HK:[],HU:[],IS:[],IN:["AN","AP","AR","AS","BR","CH","CT","DN","DD","DL","GA","GJ","HR","HP","JK","JH","KA","KL","LD","MP","MH","MN","ML","MZ","NL","OR","PY","PB","RJ","SK","TN","TG","TR","UT","UP","WB"],ID:[],IR:[],IQ:[],IE:["CW","CN","CE","CO","DL","D","G","KY","KE","KK","LS","LM","LK","LD","LH","MO","MH","MN","OY","RN","SO","TA","WD","WH","WX","WW"],IM:[],IL:[],IT:[],JM:[],JP:["10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","05","02","07","01","08","03","04","09","06"],JE:[],JO:[],KZ:[],KE:[],KI:[],KP:[],KR:[],KW:[],KG:[],LA:[],LV:[],LB:[],LS:[],LR:[],LY:[],LI:[],LT:[],LU:[],MO:[],MK:[],MG:[],MW:[],MY:[],MV:[],ML:[],MT:[],MH:[],MQ:[],MR:[],MU:[],YT:[],MX:[],FM:[],MD:[],MC:[],MN:[],ME:[],MS:[],MA:[],MZ:[],MM:[],NA:[],NR:[],NP:[],NL:[],NC:[],NZ:[],NI:[],NE:[],NG:[],NU:[],NF:[],MP:[],NO:["10","11","12","14","15","16","17","18","19","20","30","34","38","42","46","50","54","01","02","03","04","05","06","07","08","09"],OM:[],PK:[],PW:[],PS:[],PA:[],PG:[],PY:[],PE:[],PH:[],PN:[],PL:[],PT:[],PR:[],QA:[],RE:[],RO:[],RU:[],RW:[],BL:[],SH:[],KN:[],LC:[],MF:[],PM:[],VC:[],WS:[],SM:[],SS:[],ST:[],SA:[],SN:[],RS:[],SC:[],SL:[],SG:[],SK:[],SI:[],SB:[],SO:[],ZA:[],GS:[],ES:["A Coruna","Alava","Albacete","Alicante","Almeria","Asturias","Avila","Badajoz","Baleares","Barcelona","Burgos","Caceres","Cadiz","CN","Cantabria","Castellon","Ceuta","Ciudad Real","Cordoba","Cuenca","Gipuzkoa","Girona","Granada","Guadalajara","Guipuzcoa","Huelva","Huesca","Jaen","La Rioja","Las Palmas","Leon","Lleida","Lugo","Madrid","Malaga","Melilla","Murcia","Navarra","Ourense","Palencia","Pontevedra","Salamanca","Santa Cruz de Tenerife","Segovia","Sevilla","Soria","Tarragona","Teruel","Toledo","Valencia","Valladolid","Vizcaya","Zamora","Zaragoza"],LK:[],SD:[],SR:[],SJ:[],SZ:[],SE:[],CH:["AG","AR","AI","BL","BS","BE","FR","GE","GL","GR","JU","LU","NE","NW","OW","SH","SZ","SO","SG","TI","TG","UR","VS","VD","ZH","ZG"],SY:[],TW:[],TJ:[],TZ:[],TH:[],TL:[],TG:[],TK:[],TO:[],TT:[],TN:[],TR:[],TM:[],TC:[],TV:[],UG:[],UA:[],AE:[],GB:[],US:["AL","AK","AS","AZ","AR","AF","AA","AC","AE","AM","AP","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"],UM:[],UY:[],UZ:[],VU:[],VE:[],VN:[],VG:[],VI:[],WF:[],EH:[],YE:[],ZM:[],ZW:[]};let s,n,i,d=e=>e;const l=r(e,"address-form");class c extends l{constructor(){super(...arguments),this.__ignoreAddressRestrictionsGetValue=()=>this.form.ignore_address_restrictions?["true"]:[],this.__ignoreAddressRestrictionsSetValue=e=>{this.edit({ignore_address_restrictions:e.includes("true")})},this.__ignoreAddressRestrictionsOptions=[{label:"option_true",value:"true"}],this.__countrySetValue=e=>{this.edit({country:e,region:""})}}static get v8n(){return[({address_name:e})=>e&&e.length>0||"address-name:v8n_required",({address_name:e})=>!e||e.length<=100||"address-name:v8n_too_long",({first_name:e})=>!e||e.length<=50||"first-name:v8n_too_long",({last_name:e})=>!e||e.length<=50||"last-name:v8n_too_long",({region:e})=>!e||e.length<=50||"region:v8n_too_long",({city:e})=>!e||e.length<=50||"city:v8n_too_long",({phone:e})=>!e||e.length<=50||"phone:v8n_too_long",({company:e})=>!e||e.length<=50||"company:v8n_too_long",({address2:e})=>!e||e.length<=100||"address-two:v8n_too_long",({address1:e})=>e&&e.length>0||"address-one:v8n_required",({address1:e})=>!e||e.length<=100||"address-one:v8n_too_long",({postal_code:e})=>!e||e.length<=50||"postal-code:v8n_too_long"]}get hiddenSelector(){var e,r;const o=[super.hiddenSelector.toString()];return(!!(null===(e=this.data)||void 0===e?void 0:e.is_default_shipping)||!!(null===(r=this.data)||void 0===r?void 0:r.is_default_billing))&&o.unshift("delete","address-name","header:copy-id"),new t(o.join(" ").trim())}get headerTitleKey(){var e,r;return(null===(e=this.data)||void 0===e?void 0:e.is_default_shipping)?"title_default_shipping":(null===(r=this.data)||void 0===r?void 0:r.is_default_billing)?"title_default_billing":super.headerTitleKey}renderBody(){const e=this.__regionOptions;return o(s||(s=d` ${0} <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control class="col-span-2" infer="address-name"> </foxy-internal-text-control> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> <foxy-internal-text-control infer="company"></foxy-internal-text-control> <foxy-internal-text-control infer="phone"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="address-one" property="address1"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="address-two" property="address2"> </foxy-internal-text-control> <foxy-internal-select-control infer="country" .options="${0}" .setValue="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control infer="city"></foxy-internal-text-control> <foxy-internal-text-control infer="postal-code"></foxy-internal-text-control> <foxy-internal-checkbox-group-control infer="ignore-address-restrictions" class="col-span-2" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} `),this.renderHeader(),this.__countryOptions,this.__countrySetValue,e.length>0?o(n||(n=d` <foxy-internal-select-control infer="region" .options="${0}"> </foxy-internal-select-control> `),e):o(i||(i=d`<foxy-internal-text-control infer="region"></foxy-internal-text-control>`)),this.__ignoreAddressRestrictionsGetValue,this.__ignoreAddressRestrictionsSetValue,this.__ignoreAddressRestrictionsOptions,super.renderBody())}async _fetch(...e){try{return await super._fetch(...e)}catch(e){let r;try{r=(await e.json())._embedded["fx:errors"][0].message}catch(r){throw e}throw r.includes("Country is invalid or disallowed by store configuration")?["error:country_banned"]:r.includes("this address name already exists for this customer")?["error:address_name_exists"]:e}}get __countryOptions(){return Object.keys(a).map((e=>({label:this.t(`country_${e.toLowerCase()}`),value:e})))}get __regionOptions(){var e,r;const t=null!==(e=this.form.country)&&void 0!==e?e:"";return(null!==(r=a[t])&&void 0!==r?r:[]).map((e=>({label:this.t(`country_${t.toLowerCase()}_region_${e.toLowerCase()}`),value:e})))}}customElements.define("foxy-address-form",c);export{c as AddressForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-b98b8d02.js";import"./shared-
|
|
1
|
+
import"./shared-b98b8d02.js";import"./shared-f8723f3f.js";import"./shared-f07d15d6.js";import"./shared-cbb0e610.js";import{I as r}from"./shared-8c1df97c.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import{a as o}from"./shared-7b8ad9c1.js";import"./shared-f1d2b5bb.js";import{_ as t,B as e}from"./shared-0f6e4584.js";import{i as a}from"./shared-9803aa7c.js";import{h as s,s as i}from"./shared-dc73b9a5.js";import{a as n}from"./shared-075796e2.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-fb56178f.js";import"./shared-2099544a.js";import"./shared-8f7a31e0.js";import"./shared-2d723710.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5c05ac06.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-df00a537.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-339bbd50.js";import"./shared-e2a61f69.js";import"./shared-797ba64a.js";import"./shared-2fc671cd.js";import"./shared-651c44fa.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-ffd3690b.js";import"./shared-303b428e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-bab2ea2c.js";import"./shared-51c4a6dd.js";import"./shared-61f4e91a.js";import"./shared-a6273e4a.js";import"./shared-cc79152c.js";import"./shared-a036e345.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-10b5e78f.js";import"./shared-e6e84ff5.js";import"./foxy-custom-field-card.js";import"./shared-77051754.js";import"./foxy-shipment-card.js";import"./foxy-nucleon-element.js";import"./shared-6ac0d05e.js";import"./foxy-payment-card.js";import"./shared-2bf89a21.js";import"./foxy-item-card.js";import"./shared-4c2d43e6.js";import"./foxy-item-form.js";import"./shared-7ce91c80.js";import"./shared-72f41a65.js";import"./shared-77c4acdd.js";import"./shared-3fa791ca.js";import"./shared-3ea78c8d.js";import"./shared-22ba9566.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"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-customer-card.js";let d,m=r=>r;customElements.define("foxy-internal-admin-subscription-form-load-in-cart-action",class extends o{constructor(){super(...arguments),this.action=null}static get properties(){return t(t({},super.properties),{},{action:{}})}renderControl(){var r,o;const t=this.nucleon;let e;try{const a=new URL(null!==(o=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==o?o:"");"cancel"===this.action&&a.searchParams.set("sub_cancel","true"),e=a.toString()}catch(r){e=void 0}return s(d||(d=m` <a target="_blank" class="rounded font-medium text-primary group focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n class="transition-opacity group-hover-opacity-80" infer="" key="caption"> </foxy-i18n> </a> `),a(e))}});let c,f,l=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends o{renderControl(){var r,o;return s(c||(c=l` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(f||(f=l`<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>`)),null===(o=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===o?void 0:o.error_message)}});let p,h,u=r=>r;const j=n(r,"admin-subscription-form");class y extends j{get hiddenSelector(){var r,o;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(o=this.data)||void 0===o?void 0:o.is_active)||t.unshift("view-action","cancel-action"),new e(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderHeaderActions(r){return s(p||(p=u` <foxy-internal-admin-subscription-form-load-in-cart-action infer="view-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> <foxy-internal-admin-subscription-form-load-in-cart-action action="cancel" infer="cancel-action"> </foxy-internal-admin-subscription-form-load-in-cart-action> `))}renderBody(){var r,o,t,e,i;let n;try{const t=new URL(null!==(o=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==o?o:"");t.searchParams.set("zoom","items"),n=t.toString()}catch(r){n=void 0}return s(h||(h=u` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" format="iso-long" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),a(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),this.renderTemplateOrSlot(),a(null===(i=null===(e=this.data)||void 0===e?void 0:e._links)||void 0===i?void 0:i["fx:attributes"].href),a(n),super.renderBody())}}customElements.define("foxy-admin-subscription-form",y);export{y as AdminSubscriptionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-10b5e78f.js";import"./shared-
|
|
1
|
+
import"./shared-10b5e78f.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import{a as r}from"./shared-075796e2.js";import{B as s}from"./shared-0f6e4584.js";import{h as t}from"./shared-dc73b9a5.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-3e03c988.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let o,a,i=e=>e;const d=r(e,"applied-coupon-code-form");class p extends d{constructor(){super(...arguments),this.__ignoreUsageLimitsOptions=[{value:"checked",label:"option_checked"}],this.__getIgnoreUsageLimitsValue=()=>this.form.ignore_usage_limits?["checked"]:[],this.__setIgnoreUsageLimitsValue=e=>{this.edit({ignore_usage_limits:e.includes("checked")})}}static get v8n(){return[({code:e})=>!!e||"code:v8n_required"]}get readonlySelector(){return this.data?new s("not=delete"):super.readonlySelector}get hiddenSelector(){return new s(`timestamps ${super.hiddenSelector}`)}renderBody(){return t(o||(o=i` ${0} <foxy-internal-text-control helper-text="${0}" infer="code"> </foxy-internal-text-control> ${0} ${0} `),this.renderHeader(),this.t(this.data?"code.helper_text_existing":"code.helper_text_new"),this.data?"":t(a||(a=i` <foxy-internal-checkbox-group-control infer="ignore-usage-limits" class="-my-xs" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__getIgnoreUsageLimitsValue,this.__setIgnoreUsageLimitsValue,this.__ignoreUsageLimitsOptions),super.renderBody())}}customElements.define("foxy-applied-coupon-code-form",p);export{p as AppliedCouponCodeForm};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-7ce91c80.js";import"./shared-b98b8d02.js";import
|
|
1
|
+
import"./shared-7ce91c80.js";import"./shared-b98b8d02.js";import"./shared-cdf20ded.js";import"./shared-a8170f94.js";import"./shared-e96c5384.js";import"./shared-3ea78c8d.js";import{I as e}from"./shared-8c1df97c.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-template-set-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-f1d2b5bb.js";import{a as t,I as r}from"./shared-7b8ad9c1.js";import{_ as o,B as i}from"./shared-0f6e4584.js";import{c as s}from"./shared-4e709717.js";import{h as n,c as a}from"./shared-dc73b9a5.js";import"./shared-2d723710.js";import{R as l,a as d}from"./shared-075796e2.js";import{i as c}from"./shared-9803aa7c.js";import"./foxy-update-payment-method-form.js";import{U as u}from"./shared-cd96ff03.js";import{s as m}from"./shared-99940888.js";import"./shared-61f4e91a.js";import{g as p}from"./shared-bab2ea2c.js";import{T as _}from"./shared-77051754.js";import{T as h}from"./shared-8874ec69.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-24d71d01.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-fb56178f.js";import"./shared-2099544a.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5c05ac06.js";import"./shared-a0c6a159.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-797ba64a.js";import"./shared-2fc671cd.js";import"./shared-e5d37737.js";import"./shared-651c44fa.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-a6273e4a.js";import"./shared-10b5e78f.js";import"./shared-e6e84ff5.js";import"./shared-51c4a6dd.js";import"./shared-a036e345.js";import"./shared-cc79152c.js";import"./shared-4c2d43e6.js";import"./shared-f8723f3f.js";import"./shared-df00a537.js";import"./shared-339bbd50.js";import"./shared-e2a61f69.js";import"./shared-72f41a65.js";import"./shared-77c4acdd.js";import"./shared-3fa791ca.js";import"./shared-f07d15d6.js";import"./shared-cbb0e610.js";import"./shared-ffd3690b.js";import"./shared-303b428e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.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"./shared-8438d4ca.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-payment-card-embed.js";import"./shared-39a33102.js";import"./shared-01b2cad8.js";import"./shared-6d645dc5.js";let f,y,v=e=>e;customElements.define("foxy-internal-cart-form-create-session-action",class extends t{constructor(){super(...arguments),this.__loader=null}static get properties(){return o(o({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const r=null===(e=this.__loader)||void 0===e?void 0:e.state,o=null===(t=this.__loader)||void 0===t?void 0:t.result;return o?n(f||(f=v` <a target="_blank" class="rounded font-medium transition-colors text-body focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),o):n(y||(y=v` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),s({"transition-colors font-medium rounded":!0,"text-tertiary":"fail"!==r,"text-error":"fail"===r}),"fail"===r?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const r=this.nucleon,o=null==r?void 0:r.data,i=null!==(t=null==o?void 0:o._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(i)}async __reloadSessionHref(e){var t;if(console.log("RELOAD SESSION HREF",e),(null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const r=this.nucleon;if(r)if(e){const t={result:null,state:"busy",href:e},o=new r.constructor.API(this);this.__loader=t;try{const r=await o.fetch(e,{method:"POST"});if(!r.ok)throw new Error;t.result=(await r.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let g;const x=a(g||(g=(e=>e)`
|
|
2
2
|
#dialog{
|
|
3
3
|
width:100dvw;
|
|
4
4
|
max-height:calc(100dvh - var(--lumo-space-m));
|
|
@@ -54,4 +54,4 @@ import"./shared-7ce91c80.js";import"./shared-b98b8d02.js";import{I as e,a as t}f
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
`));let U,L,E,T,A,C,O=e=>e;class R extends(l(e)){constructor(){super(...arguments),this.countries=null,this.customer=null,this.regions=null,this.type=null}static get properties(){return s(s({},super.properties),{},{countries:{},customer:{type:Object},regions:{},type:{}})}static get styles(){return[...super.styles,S]}get disabledSelector(){var e;const t=[super.disabledSelector.toString()];return(null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||t.unshift("address:state"),new o(t.join(" ").toString())}renderControl(){var e,t;const r=this.__regionOptions,s=null!==(e=this.type)&&void 0!==e?e:"billing",o=this.__mergedAddress;return i(U||(U=O` <div class="flex flex-col gap-m sm-flex-row items-start leading-xs"> <div class="flex-1"> <p class="text-m text-body">${0}</p> <p class="text-s text-secondary">${0}</p> <p class="text-s text-error" ?hidden="${0}"> ${0} </p> </div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> <dialog id="dialog" class="p-m bg-base shadow-xxl space-y-m"> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="label"></foxy-i18n> </h2> <foxy-internal-summary-control infer="name"> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="address"> ${0} ${0} ${0} <foxy-internal-select-control placeholder="${0}" property="${0}_country" layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="extra"> ${0} ${0} </foxy-internal-summary-control> <p class="text-s text-secondary"> <foxy-i18n infer="" key="form_helper_text"></foxy-i18n> </p> <div class="flex justify-between gap-m"> <vaadin-button theme="error" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> <vaadin-button theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="done"></foxy-i18n> </vaadin-button> </div> </dialog> <foxy-nucleon class="hidden" infer="" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.label,this.helperText,this.disabled||this.readonly,this._errorMessage,this.t("edit"),n({"text-left sm-text-right transition-colors transition-opacity":!0,"text-body cursor-pointer hover-opacity-80":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.disabled||this.readonly,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.showModal()}),this.__isAddressEmpty?i(L||(L=O`<foxy-i18n infer="" key="not_set"></foxy-i18n>`)):i(E||(E=O` <div> ${0} ${0} </div> <div>${0}</div> <div>${0}</div> <div> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),this.__renderAddressPart(o.first_name),this.__renderAddressPart(o.last_name),this.__renderAddressPart(o.company),this.__renderAddressPart(o.phone),this.__renderAddressPart(o.address1),this.__renderAddressPart(o.address2),this.__renderAddressPart(o.city),this.__renderAddressPart(o.state),this.__renderAddressPart(o.postal_code),this.__renderAddressPart(o.country)),this.__renderTextField(o.first_name),this.__renderTextField(o.last_name),this.__renderTextField(o.address1),this.__renderTextField(o.address2),this.__renderTextField(o.city),c(this.__getPlaceholder(o.country)),s,this.__countryOptions,r.length>0?i(T||(T=O` <foxy-internal-select-control placeholder="${0}" property="${0}_state" layout="summary-item" infer="state" .options="${0}"> </foxy-internal-select-control> `),c(this.__getPlaceholder(o.state)),s,r):this.__renderTextField(o.state),this.__renderTextField(o.postal_code),this.__renderTextField(o.company),this.__renderTextField(o.phone),this.disabled,this.readonly,(()=>{var e;null===(e=this.nucleon)||void 0===e||e.edit({[`${s}_first_name`]:null,[`${s}_last_name`]:null,[`${s}_company`]:null,[`${s}_address1`]:null,[`${s}_address2`]:null,[`${s}_city`]:null,[`${s}_state`]:null,[`${s}_postal_code`]:null,[`${s}_country`]:null,[`${s}_phone`]:null})}),this.disabled,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.close()}),c(null!==(t=this.countries)&&void 0!==t?t:void 0),(()=>this.requestUpdate()),c(this.__regionsUrl),(()=>this.requestUpdate()))}__renderAddressPart(e){const t=this.__getDisplayText(e);return i(A||(A=O` <span class="${0}"> ${0} </span> `),n({"text-success bg-success-10":e.modified&&!this.disabled,"bg-contrast-5":e.modified&&this.disabled,"inline-block":!!t,"rounded-s":!0,hidden:!t}),t)}__renderTextField(e){var t;return i(C||(C=O` <foxy-internal-text-control placeholder="${0}" property="${0}_${0}" layout="summary-item" infer="${0}" @clear="${0}"> </foxy-internal-text-control> `),c(this.__getPlaceholder(e)),null!==(t=this.type)&&void 0!==t?t:"billing",e.field,e.field.replace(/_/g,"-").replace("1","-one").replace("2","-two"),(()=>{var t,r;return null===(t=this.nucleon)||void 0===t?void 0:t.edit({[`${null!==(r=this.type)&&void 0!==r?r:"billing"}_${e.field}`]:null})}))}__getDisplayText(e){return e.value||(e.modified?"--":"")}__getPlaceholder(e){return e.modified?this.t("empty_modified_placeholder"):e.originalValue||void 0}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __countryOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2})))}get __isAddressEmpty(){return Object.values(this.__mergedAddress).every((e=>""===this.__getDisplayText(e)))}get __regionOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.code})))}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __mergedAddress(){var e,t,r;const i=null===(e=this.nucleon)||void 0===e?void 0:e.form,s="shipping"===this.type?"shipping":"billing",o=null!==(r=null===(t=this.customer)||void 0===t?void 0:t._embedded[`fx:default_${s}_address`])&&void 0!==r?r:{},n=["first_name","last_name","company","address1","address2","city","state","postal_code","country","phone"].reduce(((e,t)=>{var r;const n=null==i?void 0:i[`${s}_${t}`],a=null==o?void 0:o["state"===t?"region":t];return e[t]={originalValue:String(null!=a?a:""),modified:null!==n,value:String(null!==(r=null!=n?n:a)&&void 0!==r?r:""),field:t},e}),{});return n}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.__mergedAddress.country.value;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __dialog(){return this.renderRoot.querySelector("#dialog")}}customElements.define("foxy-internal-cart-form-address-summary-item",R);let M,F=e=>e;customElements.define("foxy-internal-cart-form-payment-method-form",class extends a{constructor(){super(...arguments),this.defaultPaymentMethod=null,this.paymentCardEmbedUrl=null,this.selectionProps={}}static get properties(){return s(s({},super.properties),{},{defaultPaymentMethod:{attribute:"default-payment-method"},paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},selectionProps:{attribute:!1}})}renderBody(){var e,t;return i(M||(M=F` <foxy-update-payment-method-form embed-url="${0}" infer="default-payment-method" href="${0}" @update="${0}"> </foxy-update-payment-method-form> <div class="flex items-center gap-m"> <div class="border-t border-contrast-10 flex-1"></div> <foxy-i18n class="text-tertiary" infer="" key="or"></foxy-i18n> <div class="border-t border-contrast-10 flex-1"></div> </div> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="select_previous"></foxy-i18n> </h2> <foxy-internal-async-list-control infer="selection" limit="5" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),c(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:void 0),c(null!==(t=this.defaultPaymentMethod)&&void 0!==t?t:void 0),(e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.result)===u.UpdateResult.ResourceUpdated&&(this.edit({selection:""}),this.submit())}),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),m(this.selectionProps))}});let I,q,D=e=>e;customElements.define("foxy-internal-cart-form-payment-method-card",class extends h{renderBody(){return super.renderBody({title:e=>{var t,r,s,o,n;const a=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],l=null!==(s=null==a?void 0:a.cc_type)&&void 0!==s?s:"",d=null===(o=null==a?void 0:a.cc_exp_year)||void 0===o?void 0:o.substring(2),c=null==a?void 0:a.cc_exp_month,u=null===(n=null==a?void 0:a.cc_number_masked)||void 0===n?void 0:n.replace(/x/gi,"");return i(I||(I=D`<foxy-i18n infer="" key="title" .options="${0}"></foxy-i18n>`),{last4Digits:u,context:l&&d&&c&&u?"valid":"invalid",month:c,type:l,year:d})},subtitle:e=>{var t,r,s;const o=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],n={id:p(e._links.self.href),date:null!==(s=null==o?void 0:o.date_created)&&void 0!==s?s:e.transaction_date};return i(q||(q=D`<foxy-i18n infer="" key="subtitle" .options="${0}"></foxy-i18n>`),n)}})}});let H,V,z,B,G,W=e=>e;customElements.define("foxy-internal-cart-form-totals-control",class extends t{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,r,s,o;const n=null===(e=this.nucleon)||void 0===e?void 0:e.data;return n?i(V||(V=W` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> <span></span> <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),c(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(n.total_item_price),this.__renderPrice(n.total_shipping,!0),this.__renderPrice(n.total_tax,!0),null===(r=null===(t=null==n?void 0:n._embedded)||void 0===t?void 0:t["fx:applied_gift_card_codes"])||void 0===r?void 0:r.map((e=>{var t;return i(z||(z=W` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(o=null===(s=null==n?void 0:n._embedded)||void 0===s?void 0:s["fx:discounts"])||void 0===o?void 0:o.map((e=>i(B||(B=W` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderPrice(n.total_order)):i(H||(H=W``))}get __storeHref(){var e,t,r;return null===(r=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===r?void 0:r.href}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var r,s,o;const n=(null===(r=this.__store)||void 0===r?void 0:r.use_international_currency_symbol)?"code":"symbol",a=null===(o=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===o?void 0:o.currency_code;return i(G||(G=W` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}});let Y,N,Z=e=>e;const J=l(d(a,"cart-form"));class K extends J{constructor(){super(...arguments),this.paymentCardEmbedUrl=null,this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.languages=null,this.customers=null,this.countries=null,this.regions=null,this.coupons=null,this.__languagesLoaderId="languagesLoader",this.__customerLoaderId="customerLoader",this.__paymentMethodUriGetDisplayValueOptions=e=>{var t,r,i,s;const o=null!==(i=null===(r=null===(t=null==e?void 0:e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0])&&void 0!==i?i:null,n=null==o?void 0:o.cc_exp_month,a=null==o?void 0:o.cc_exp_year,l=null===(s=null==o?void 0:o.cc_number_masked)||void 0===s?void 0:s.replace(/x/g,""),d=null==o?void 0:o.cc_type;return{cc_exp_month:null!=n?n:"",cc_exp_year:null!=a?a:"",cc_last4:null!=l?l:"",cc_type:null!=d?d:"",context:l&&n&&a&&d?"":"empty"}},this.__paymentMethodUriSetValue=e=>{try{const t=new URL(e);t.search="",t.pathname+="/payments",this.edit({payment_method_uri:t.toString()})}catch(e){this.edit({payment_method_uri:""})}},this.__paymentMethodUriFilters=[{label:"filter_type",type:_.String,path:"payments:type",list:[{label:"filter_type_value_purchase_order",value:"purchase_order"},{label:"filter_type_value_amazon_mws",value:"amazon_mws"},{label:"filter_type_value_paypal_ec",value:"paypal_ec"},{label:"filter_type_value_paypal",value:"paypal"},{label:"filter_type_value_hosted",value:"hosted"},{label:"filter_type_value_ogone",value:"ogone"}]},{label:"filter_cc_type",type:_.String,path:"payments:cc_type",list:[{label:"filter_cc_type_value_mastercard",value:"mastercard"},{label:"filter_cc_type_value_discover",value:"discover"},{label:"filter_cc_type_value_unionpay",value:"unionpay"},{label:"filter_cc_type_value_maestro",value:"maestro"},{label:"filter_cc_type_value_diners",value:"diners"},{label:"filter_cc_type_value_visa",value:"visa"},{label:"filter_cc_type_value_amex",value:"amex"},{label:"filter_cc_type_value_jcb",value:"jcb"}]},{label:"filter_cc_number_masked",type:_.String,path:"payments:cc_number_masked"}],this.__customerUriSetValue=e=>{this.edit({customer_uri:e,customer_email:""})},this.__customerUriOptions=[{label:"filter_email",path:"email",type:_.String},{label:"filter_is_anonymous",path:"is_anonymous",type:_.String,list:[{value:"false",label:"filter_is_anonymous_value_false"},{value:"true",label:"filter_is_anonymous_value_true"}]}]}static get properties(){return s(s({},super.properties),{},{paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},languages:{},customers:{},countries:{},regions:{},coupons:{}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_state:e})=>!e||e.length<=50||"billing-state:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_state:e})=>!e||e.length<=50||"shipping-state:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.customer_uri?e.unshift("general:customer-email"):e.unshift("billing:payment-method-uri"),this.data?this.form.use_customer_shipping_address||e.unshift("shipping:shipping-address"):e.unshift("applied-coupon-codes","custom-fields","attributes","shipping","billing","totals","items"),new o(e.join(" ").trim())}renderHeaderActions(){return i(Y||(Y=Z` <foxy-internal-cart-form-create-session-action infer="view-as-customer"> </foxy-internal-cart-form-create-session-action> `))}renderBody(){var e,t,r,s,o,n,a,l,d,u,m,p,h,_;const f=null===(e=this.data)||void 0===e?void 0:e._links,y=this.__customer,v=null==y?void 0:y._links["fx:customer_addresses"].href;return i(N||(N=Z` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="template-set-uri" item="foxy-template-set-card"> </foxy-internal-resource-picker-control> <foxy-internal-select-control layout="summary-item" infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="customer-uri" item="foxy-customer-card" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="customer-email"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" alert item="foxy-item-card" form="foxy-item-form" .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-cart-form-totals-control class="min-w-0" infer="totals"> </foxy-internal-cart-form-totals-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0" first="${0}" item="foxy-applied-coupon-code-card" form="foxy-applied-coupon-code-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="billing"> <foxy-internal-resource-picker-control placeholder="${0}" layout="summary-item" first="${0}" infer="payment-method-uri" item="foxy-internal-cart-form-payment-method-card" form="foxy-internal-cart-form-payment-method-form" .getDisplayValueOptions="${0}" .formProps="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="billing-address" type="billing" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-switch-control infer="use-customer-shipping-address" invert> </foxy-internal-switch-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="shipping-address" type="shipping" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="foxy-custom-field-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <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> `),this.renderHeader(),c(null!==(t=this.templateSets)&&void 0!==t?t:void 0),this.__languageOptions,c(null!==(r=this.customers)&&void 0!==r?r:void 0),this.__customerUriSetValue,this.__customerUriOptions,c(this.__itemsHref),this.href?[this.href]:[],{"locale-codes":null!==(s=this.localeCodes)&&void 0!==s?s:""},{"customer-addresses":null!=v?v:"","item-categories":null!==(o=this.itemCategories)&&void 0!==o?o:"","locale-codes":null!==(n=this.localeCodes)&&void 0!==n?n:"",coupons:null!==(a=this.coupons)&&void 0!==a?a:""},c(null==f?void 0:f["fx:applied_coupon_codes"].href),this.href?[this.href]:[],this.__paymentMethodUriPlaceholder,c(this.__transactionsWithPaymentsUrl),this.__paymentMethodUriGetDisplayValueOptions,{"default-payment-method":null!==(l=null==y?void 0:y._links["fx:default_payment_method"].href)&&void 0!==l?l:"","payment-card-embed-url":null!==(d=this.__pickerPaymentCardEmbedUrl)&&void 0!==d?d:""},this.__paymentMethodUriSetValue,this.__paymentMethodUriFilters,c(null!==(u=this.countries)&&void 0!==u?u:void 0),c(null!==(m=this.regions)&&void 0!==m?m:void 0),y,c(null!==(p=this.countries)&&void 0!==p?p:void 0),c(null!==(h=this.regions)&&void 0!==h?h:void 0),y,c(null==f?void 0:f["fx:custom_fields"].href),c(null==f?void 0:f["fx:attributes"].href),super.renderBody(),c(null!==(_=this.languages)&&void 0!==_?_:void 0),this.__languagesLoaderId,(()=>this.requestUpdate()),c(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()))}get __paymentMethodUriPlaceholder(){var e,t,r,i,s,o;const n=null===(e=this.__customer)||void 0===e?void 0:e._embedded["fx:default_payment_method"],a=null!==(t=null==n?void 0:n.cc_exp_month)&&void 0!==t?t:null,l=null!==(r=null==n?void 0:n.cc_exp_year)&&void 0!==r?r:null,d=null!==(s=null===(i=null==n?void 0:n.cc_number_masked)||void 0===i?void 0:i.replace(/x/g,""))&&void 0!==s?s:null,c=null!==(o=null==n?void 0:n.cc_type)&&void 0!==o?o:null;return this.t("billing.payment-method-uri.value",{cc_exp_month:null!=a?a:"",cc_exp_year:null!=l?l:"",cc_last4:null!=d?d:"",cc_type:null!=c?c:"",context:d&&a&&l&&c?"":"empty"})}get __transactionsWithPaymentsUrl(){var e,t;try{const r=new URL(null!==(t=null===(e=this.__customer)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","payments"),r.toString()}catch(e){}}get __pickerPaymentCardEmbedUrl(){var e,t;try{const r=new URL(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:""),i=p(null!==(t=this.form.template_set_uri)&&void 0!==t?t:"");if(null!==i)return r.searchParams.set("template_set_id",String(i)),r.toString()}catch(e){}}get __customerHref(){var e;try{const t=new URL(null!==(e=this.form.customer_uri)&&void 0!==e?e:"");return t.searchParams.set("zoom","default_payment_method,default_billing_address,default_shipping_address"),t.toString()}catch(e){}}get __itemsHref(){var e,t;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","item_options"),r.toString()}catch(e){}}get __languageOptions(){var e,t;const r=this.renderRoot.querySelector(`#${this.__languagesLoaderId}`);return Object.entries(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((([e,t])=>({rawLabel:t,value:e})))}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}}customElements.define("foxy-cart-form",K);export{K as CartForm};
|
|
57
|
+
`));let b,$,j,k,w,P,S=e=>e;class U extends(l(r)){constructor(){super(...arguments),this.countries=null,this.customer=null,this.regions=null,this.type=null}static get properties(){return o(o({},super.properties),{},{countries:{},customer:{type:Object},regions:{},type:{}})}static get styles(){return[...super.styles,x]}get disabledSelector(){var e;const t=[super.disabledSelector.toString()];return(null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||t.unshift("address:state"),new i(t.join(" ").toString())}renderControl(){var e,t;const r=this.__regionOptions,o=null!==(e=this.type)&&void 0!==e?e:"billing",i=this.__mergedAddress;return n(b||(b=S` <div class="flex flex-col gap-m sm-flex-row items-start leading-xs"> <div class="flex-1"> <p class="text-m text-body">${0}</p> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> ${0} </button> </div> <dialog id="dialog" class="p-m bg-base shadow-xxl space-y-m"> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="label"></foxy-i18n> </h2> <foxy-internal-summary-control infer="name"> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="address"> ${0} ${0} ${0} <foxy-internal-select-control placeholder="${0}" property="${0}_country" layout="summary-item" infer="country" .options="${0}"> </foxy-internal-select-control> ${0} ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="extra"> ${0} ${0} </foxy-internal-summary-control> <p class="text-xs text-secondary"> <foxy-i18n infer="" key="form_helper_text"></foxy-i18n> </p> <div class="flex justify-between gap-m"> <vaadin-button theme="error" ?disabled="${0}" ?hidden="${0}" @click="${0}"> <foxy-i18n infer="" key="reset"></foxy-i18n> </vaadin-button> <vaadin-button theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="done"></foxy-i18n> </vaadin-button> </div> </dialog> <foxy-nucleon class="hidden" infer="" href="${0}" id="countriesLoader" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="regionsLoader" @update="${0}"> </foxy-nucleon> `),this.label,this.helperText,this.disabled||this.readonly,this._errorMessage,this.t("edit"),s({"text-left sm-text-right transition-colors transition-opacity":!0,"text-body cursor-pointer hover-opacity-80":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.disabled||this.readonly,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.showModal()}),this.__isAddressEmpty?n($||($=S`<foxy-i18n infer="" key="not_set"></foxy-i18n>`)):n(j||(j=S` <div> ${0} ${0} </div> <div>${0}</div> <div>${0}</div> <div> ${0} ${0} ${0} ${0} ${0} ${0} </div> `),this.__renderAddressPart(i.first_name),this.__renderAddressPart(i.last_name),this.__renderAddressPart(i.company),this.__renderAddressPart(i.phone),this.__renderAddressPart(i.address1),this.__renderAddressPart(i.address2),this.__renderAddressPart(i.city),this.__renderAddressPart(i.state),this.__renderAddressPart(i.postal_code),this.__renderAddressPart(i.country)),this.__renderTextField(i.first_name),this.__renderTextField(i.last_name),this.__renderTextField(i.address1),this.__renderTextField(i.address2),this.__renderTextField(i.city),c(this.__getPlaceholder(i.country)),o,this.__countryOptions,r.length>0?n(k||(k=S` <foxy-internal-select-control placeholder="${0}" property="${0}_state" layout="summary-item" infer="state" .options="${0}"> </foxy-internal-select-control> `),c(this.__getPlaceholder(i.state)),o,r):this.__renderTextField(i.state),this.__renderTextField(i.postal_code),this.__renderTextField(i.company),this.__renderTextField(i.phone),this.disabled,this.readonly,(()=>{var e;null===(e=this.nucleon)||void 0===e||e.edit({[`${o}_first_name`]:null,[`${o}_last_name`]:null,[`${o}_company`]:null,[`${o}_address1`]:null,[`${o}_address2`]:null,[`${o}_city`]:null,[`${o}_state`]:null,[`${o}_postal_code`]:null,[`${o}_country`]:null,[`${o}_phone`]:null})}),this.disabled,(()=>{var e;return null===(e=this.__dialog)||void 0===e?void 0:e.close()}),c(null!==(t=this.countries)&&void 0!==t?t:void 0),(()=>this.requestUpdate()),c(this.__regionsUrl),(()=>this.requestUpdate()))}__renderAddressPart(e){const t=this.__getDisplayText(e);return n(w||(w=S` <span class="${0}"> ${0} </span> `),s({"text-success bg-success-10":e.modified&&!this.disabled,"bg-contrast-5":e.modified&&this.disabled,"inline-block":!!t,"rounded-s":!0,hidden:!t}),t)}__renderTextField(e){var t;return n(P||(P=S` <foxy-internal-text-control placeholder="${0}" property="${0}_${0}" layout="summary-item" infer="${0}" @clear="${0}"> </foxy-internal-text-control> `),c(this.__getPlaceholder(e)),null!==(t=this.type)&&void 0!==t?t:"billing",e.field,e.field.replace(/_/g,"-").replace("1","-one").replace("2","-two"),(()=>{var t,r;return null===(t=this.nucleon)||void 0===t?void 0:t.edit({[`${null!==(r=this.type)&&void 0!==r?r:"billing"}_${e.field}`]:null})}))}__getDisplayText(e){return e.value||(e.modified?"--":"")}__getPlaceholder(e){return e.modified?this.t("empty_modified_placeholder"):e.originalValue||void 0}get __countriesLoader(){return this.renderRoot.querySelector("#countriesLoader")}get __countryOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__countriesLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.cc2})))}get __isAddressEmpty(){return Object.values(this.__mergedAddress).every((e=>""===this.__getDisplayText(e)))}get __regionOptions(){var e,t,r;return Object.values(null!==(r=null===(t=null===(e=this.__regionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values)&&void 0!==r?r:{}).map((e=>({rawLabel:e.default,value:e.code})))}get __regionsLoader(){return this.renderRoot.querySelector("#regionsLoader")}get __mergedAddress(){var e,t,r;const o=null===(e=this.nucleon)||void 0===e?void 0:e.form,i="shipping"===this.type?"shipping":"billing",s=null!==(r=null===(t=this.customer)||void 0===t?void 0:t._embedded[`fx:default_${i}_address`])&&void 0!==r?r:{},n=["first_name","last_name","company","address1","address2","city","state","postal_code","country","phone"].reduce(((e,t)=>{var r;const n=null==o?void 0:o[`${i}_${t}`],a=null==s?void 0:s["state"===t?"region":t];return e[t]={originalValue:String(null!=a?a:""),modified:null!==n,value:String(null!==(r=null!=n?n:a)&&void 0!==r?r:""),field:t},e}),{});return n}get __regionsUrl(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),r=this.__mergedAddress.country.value;return r&&t.searchParams.set("country_code",r),t.toString()}catch(e){}}get __dialog(){return this.renderRoot.querySelector("#dialog")}}customElements.define("foxy-internal-cart-form-address-summary-item",U);let L,A=e=>e;customElements.define("foxy-internal-cart-form-payment-method-form",class extends e{constructor(){super(...arguments),this.defaultPaymentMethod=null,this.paymentCardEmbedUrl=null,this.selectionProps={}}static get properties(){return o(o({},super.properties),{},{defaultPaymentMethod:{attribute:"default-payment-method"},paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},selectionProps:{attribute:!1}})}renderBody(){var e,t;return n(L||(L=A` <foxy-update-payment-method-form embed-url="${0}" infer="default-payment-method" href="${0}" @update="${0}"> </foxy-update-payment-method-form> <div class="flex items-center gap-m"> <div class="border-t border-contrast-10 flex-1"></div> <foxy-i18n class="text-tertiary" infer="" key="or"></foxy-i18n> <div class="border-t border-contrast-10 flex-1"></div> </div> <h2 class="text-xl font-medium"> <foxy-i18n infer="" key="select_previous"></foxy-i18n> </h2> <foxy-internal-async-list-control infer="selection" limit="5" form="foxy-null" hide-delete-button hide-create-button @itemclick="${0}" ...="${0}"> </foxy-internal-async-list-control> `),c(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:void 0),c(null!==(t=this.defaultPaymentMethod)&&void 0!==t?t:void 0),(e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.result)===u.UpdateResult.ResourceUpdated&&(this.edit({selection:""}),this.submit())}),(e=>{e.preventDefault(),this.edit({selection:e.detail}),this.submit()}),m(this.selectionProps))}});let E,O,C=e=>e;customElements.define("foxy-internal-cart-form-payment-method-card",class extends _{renderBody(){return super.renderBody({title:e=>{var t,r,o,i,s;const a=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],l=null!==(o=null==a?void 0:a.cc_type)&&void 0!==o?o:"",d=null===(i=null==a?void 0:a.cc_exp_year)||void 0===i?void 0:i.substring(2),c=null==a?void 0:a.cc_exp_month,u=null===(s=null==a?void 0:a.cc_number_masked)||void 0===s?void 0:s.replace(/x/gi,"");return n(E||(E=C`<foxy-i18n infer="" key="title" .options="${0}"></foxy-i18n>`),{last4Digits:u,context:l&&d&&c&&u?"valid":"invalid",month:c,type:l,year:d})},subtitle:e=>{var t,r,o;const i=null===(r=null===(t=e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0],s={id:p(e._links.self.href),date:null!==(o=null==i?void 0:i.date_created)&&void 0!==o?o:e.transaction_date};return n(O||(O=C`<foxy-i18n infer="" key="subtitle" .options="${0}"></foxy-i18n>`),s)}})}});let R,T,F,I,M,q=e=>e;customElements.define("foxy-internal-cart-form-totals-control",class extends t{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,r,o,i;const s=null===(e=this.nucleon)||void 0===e?void 0:e.data;return s?n(T||(T=q` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>:</span> <span>${0}</span> <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> <span></span> <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>: ${0} </span> </span> </p> `),c(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(s.total_item_price),this.__renderPrice(s.total_shipping,!0),this.__renderPrice(s.total_tax,!0),null===(r=null===(t=null==s?void 0:s._embedded)||void 0===t?void 0:t["fx:applied_gift_card_codes"])||void 0===r?void 0:r.map((e=>{var t;return n(F||(F=q` <span>${0}:</span> <span>${0}</span> `),e._embedded["fx:gift_card"].name,this.__renderPrice(null!==(t=e.balance_adjustment)&&void 0!==t?t:0,!0))})),null===(i=null===(o=null==s?void 0:s._embedded)||void 0===o?void 0:o["fx:discounts"])||void 0===i?void 0:i.map((e=>n(I||(I=q` <span data-testclass="discount">${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),this.__renderPrice(s.total_order)):n(R||(R=q``))}get __storeHref(){var e,t,r;return null===(r=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===r?void 0:r.href}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var r,o,i;const s=(null===(r=this.__store)||void 0===r?void 0:r.use_international_currency_symbol)?"code":"symbol",a=null===(i=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===i?void 0:i.currency_code;return n(M||(M=q` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:s,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}});let D,H,V=e=>e;const z=l(d(e,"cart-form"));class B extends z{constructor(){super(...arguments),this.paymentCardEmbedUrl=null,this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.languages=null,this.customers=null,this.countries=null,this.regions=null,this.coupons=null,this.__languagesLoaderId="languagesLoader",this.__customerLoaderId="customerLoader",this.__paymentMethodUriGetDisplayValueOptions=e=>{var t,r,o,i;const s=null!==(o=null===(r=null===(t=null==e?void 0:e._embedded)||void 0===t?void 0:t["fx:payments"])||void 0===r?void 0:r[0])&&void 0!==o?o:null,n=null==s?void 0:s.cc_exp_month,a=null==s?void 0:s.cc_exp_year,l=null===(i=null==s?void 0:s.cc_number_masked)||void 0===i?void 0:i.replace(/x/g,""),d=null==s?void 0:s.cc_type;return{cc_exp_month:null!=n?n:"",cc_exp_year:null!=a?a:"",cc_last4:null!=l?l:"",cc_type:null!=d?d:"",context:l&&n&&a&&d?"":"empty"}},this.__paymentMethodUriSetValue=e=>{try{const t=new URL(e);t.search="",t.pathname+="/payments",this.edit({payment_method_uri:t.toString()})}catch(e){this.edit({payment_method_uri:""})}},this.__paymentMethodUriFilters=[{label:"filter_type",type:h.String,path:"payments:type",list:[{label:"filter_type_value_purchase_order",value:"purchase_order"},{label:"filter_type_value_amazon_mws",value:"amazon_mws"},{label:"filter_type_value_paypal_ec",value:"paypal_ec"},{label:"filter_type_value_paypal",value:"paypal"},{label:"filter_type_value_hosted",value:"hosted"},{label:"filter_type_value_ogone",value:"ogone"}]},{label:"filter_cc_type",type:h.String,path:"payments:cc_type",list:[{label:"filter_cc_type_value_mastercard",value:"mastercard"},{label:"filter_cc_type_value_discover",value:"discover"},{label:"filter_cc_type_value_unionpay",value:"unionpay"},{label:"filter_cc_type_value_maestro",value:"maestro"},{label:"filter_cc_type_value_diners",value:"diners"},{label:"filter_cc_type_value_visa",value:"visa"},{label:"filter_cc_type_value_amex",value:"amex"},{label:"filter_cc_type_value_jcb",value:"jcb"}]},{label:"filter_cc_number_masked",type:h.String,path:"payments:cc_number_masked"}],this.__customerUriSetValue=e=>{this.edit({customer_uri:e,customer_email:""})},this.__customerUriOptions=[{label:"filter_email",path:"email",type:h.String},{label:"filter_is_anonymous",path:"is_anonymous",type:h.String,list:[{value:"false",label:"filter_is_anonymous_value_false"},{value:"true",label:"filter_is_anonymous_value_true"}]}]}static get properties(){return o(o({},super.properties),{},{paymentCardEmbedUrl:{attribute:"payment-card-embed-url"},itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},languages:{},customers:{},countries:{},regions:{},coupons:{}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_state:e})=>!e||e.length<=50||"billing-state:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_state:e})=>!e||e.length<=50||"shipping-state:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.form.customer_uri?e.unshift("general:customer-email"):e.unshift("billing:payment-method-uri"),this.data?this.form.use_customer_shipping_address||e.unshift("shipping:shipping-address"):e.unshift("applied-coupon-codes","custom-fields","attributes","shipping","billing","totals","items"),new i(e.join(" ").trim())}renderHeaderActions(){return n(D||(D=V` <foxy-internal-cart-form-create-session-action infer="view-as-customer"> </foxy-internal-cart-form-create-session-action> `))}renderBody(){var e,t,r,o,i,s,a,l,d,u,m,p,_,h;const f=null===(e=this.data)||void 0===e?void 0:e._links,y=this.__customer,v=null==y?void 0:y._links["fx:customer_addresses"].href;return n(H||(H=V` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="template-set-uri" item="foxy-template-set-card"> </foxy-internal-resource-picker-control> <foxy-internal-select-control layout="summary-item" infer="language" .options="${0}"> </foxy-internal-select-control> <foxy-internal-resource-picker-control layout="summary-item" first="${0}" infer="customer-uri" item="foxy-customer-card" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-text-control layout="summary-item" infer="customer-email"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" alert item="foxy-item-card" form="foxy-item-form" .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-cart-form-totals-control class="min-w-0" infer="totals"> </foxy-internal-cart-form-totals-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0" first="${0}" item="foxy-applied-coupon-code-card" form="foxy-applied-coupon-code-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="billing"> <foxy-internal-resource-picker-control placeholder="${0}" layout="summary-item" first="${0}" infer="payment-method-uri" item="foxy-internal-cart-form-payment-method-card" form="foxy-internal-cart-form-payment-method-form" .getDisplayValueOptions="${0}" .formProps="${0}" .setValue="${0}" .filters="${0}"> </foxy-internal-resource-picker-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="billing-address" type="billing" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-summary-control infer="shipping"> <foxy-internal-switch-control infer="use-customer-shipping-address" invert> </foxy-internal-switch-control> <foxy-internal-cart-form-address-summary-item countries="${0}" regions="${0}" infer="shipping-address" type="shipping" .customer="${0}"> </foxy-internal-cart-form-address-summary-item> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="foxy-custom-field-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <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> `),this.renderHeader(),c(null!==(t=this.templateSets)&&void 0!==t?t:void 0),this.__languageOptions,c(null!==(r=this.customers)&&void 0!==r?r:void 0),this.__customerUriSetValue,this.__customerUriOptions,c(this.__itemsHref),this.href?[this.href]:[],{"locale-codes":null!==(o=this.localeCodes)&&void 0!==o?o:""},{"customer-addresses":null!=v?v:"","item-categories":null!==(i=this.itemCategories)&&void 0!==i?i:"","locale-codes":null!==(s=this.localeCodes)&&void 0!==s?s:"",coupons:null!==(a=this.coupons)&&void 0!==a?a:""},c(null==f?void 0:f["fx:applied_coupon_codes"].href),this.href?[this.href]:[],this.__paymentMethodUriPlaceholder,c(this.__transactionsWithPaymentsUrl),this.__paymentMethodUriGetDisplayValueOptions,{"default-payment-method":null!==(l=null==y?void 0:y._links["fx:default_payment_method"].href)&&void 0!==l?l:"","payment-card-embed-url":null!==(d=this.__pickerPaymentCardEmbedUrl)&&void 0!==d?d:""},this.__paymentMethodUriSetValue,this.__paymentMethodUriFilters,c(null!==(u=this.countries)&&void 0!==u?u:void 0),c(null!==(m=this.regions)&&void 0!==m?m:void 0),y,c(null!==(p=this.countries)&&void 0!==p?p:void 0),c(null!==(_=this.regions)&&void 0!==_?_:void 0),y,c(null==f?void 0:f["fx:custom_fields"].href),c(null==f?void 0:f["fx:attributes"].href),super.renderBody(),c(null!==(h=this.languages)&&void 0!==h?h:void 0),this.__languagesLoaderId,(()=>this.requestUpdate()),c(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()))}get __paymentMethodUriPlaceholder(){var e,t,r,o,i,s;const n=null===(e=this.__customer)||void 0===e?void 0:e._embedded["fx:default_payment_method"],a=null!==(t=null==n?void 0:n.cc_exp_month)&&void 0!==t?t:null,l=null!==(r=null==n?void 0:n.cc_exp_year)&&void 0!==r?r:null,d=null!==(i=null===(o=null==n?void 0:n.cc_number_masked)||void 0===o?void 0:o.replace(/x/g,""))&&void 0!==i?i:null,c=null!==(s=null==n?void 0:n.cc_type)&&void 0!==s?s:null;return this.t("billing.payment-method-uri.value",{cc_exp_month:null!=a?a:"",cc_exp_year:null!=l?l:"",cc_last4:null!=d?d:"",cc_type:null!=c?c:"",context:d&&a&&l&&c?"":"empty"})}get __transactionsWithPaymentsUrl(){var e,t;try{const r=new URL(null!==(t=null===(e=this.__customer)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","payments"),r.toString()}catch(e){}}get __pickerPaymentCardEmbedUrl(){var e,t;try{const r=new URL(null!==(e=this.paymentCardEmbedUrl)&&void 0!==e?e:""),o=p(null!==(t=this.form.template_set_uri)&&void 0!==t?t:"");if(null!==o)return r.searchParams.set("template_set_id",String(o)),r.toString()}catch(e){}}get __customerHref(){var e;try{const t=new URL(null!==(e=this.form.customer_uri)&&void 0!==e?e:"");return t.searchParams.set("zoom","default_payment_method,default_billing_address,default_shipping_address"),t.toString()}catch(e){}}get __itemsHref(){var e,t;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return r.searchParams.set("zoom","item_options"),r.toString()}catch(e){}}get __languageOptions(){var e,t;const r=this.renderRoot.querySelector(`#${this.__languagesLoaderId}`);return Object.entries(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((([e,t])=>({rawLabel:t,value:e})))}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}}customElements.define("foxy-cart-form",B);export{B as CartForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-72f41a65.js";import"./shared-
|
|
1
|
+
import"./shared-72f41a65.js";import"./shared-3ea78c8d.js";import{I as r}from"./shared-8c1df97c.js";import{R as t,a as e}from"./shared-075796e2.js";import{B as o}from"./shared-0f6e4584.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-77c4acdd.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-61ade33e.js";import"./shared-8f7a31e0.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-22ba9566.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-fb56178f.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let s,n=r=>r;const i=t(e(r,"client-form"));class c extends i{get readonlySelector(){const r=["client-secret"];return(this.data||this.in({busy:"fetching"}))&&r.push("client-id"),new o(`${r.join(" ")} ${super.readonlySelector.toString()}`)}get hiddenSelector(){const r=[];return this.data||this.in({busy:"fetching"})||r.push("client-secret"),new o(`${r.join(" ")} ${super.hiddenSelector.toString()}`)}renderBody(){return a(s||(s=n` ${0} <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control class="col-span-2" infer="client-id"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="client-secret"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="redirect-uri"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="project-name"> </foxy-internal-text-control> <foxy-internal-text-area-control class="col-span-2" infer="project-description"> </foxy-internal-text-area-control> <foxy-internal-text-control infer="company-name"></foxy-internal-text-control> <foxy-internal-text-control infer="company-url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="company-logo"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="contact-name"> </foxy-internal-text-control> <foxy-internal-text-control infer="contact-email"></foxy-internal-text-control> <foxy-internal-text-control infer="contact-phone"></foxy-internal-text-control> </div> ${0} `),this.renderHeader(),super.renderBody())}}customElements.define("foxy-client-form",c);export{c as ClientForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-b98b8d02.js";import"./shared-
|
|
1
|
+
import"./shared-b98b8d02.js";import"./shared-3ea78c8d.js";import{I as r}from"./shared-8c1df97c.js";import"./foxy-transaction-card.js";import{_ as e,B as s}from"./shared-0f6e4584.js";import{a as o}from"./shared-075796e2.js";import{i as t}from"./shared-9803aa7c.js";import{h as a}from"./shared-dc73b9a5.js";import"./shared-10325cda.js";import"./shared-021c7a22.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-fb56178f.js";import"./shared-2099544a.js";import"./shared-8f7a31e0.js";import"./shared-2d723710.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5c05ac06.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-3e03c988.js";import"./shared-fe77f6f6.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-22ba9566.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-bab2ea2c.js";import"./shared-61f4e91a.js";import"./shared-a6273e4a.js";let i,d=r=>r;const n=o(r,"coupon-code-form");class c extends n{constructor(){super(...arguments),this.getTransactionPageHref=null}static get properties(){return e(e({},super.properties),{},{getTransactionPageHref:{attribute:!1}})}static get v8n(){return[({code:r})=>!!r||"code:v8n_required",({code:r})=>!r||r.length<=50||"code:v8n_too_long",({code:r})=>!(null==r?void 0:r.includes(" "))||"code:v8n_has_spaces"]}get hiddenSelector(){const r=[super.hiddenSelector.toString()];return this.href||r.unshift("transactions"),new s(r.join(" ").trim())}renderBody(){var r,e;let s;try{const o=new URL(null!==(e=null===(r=this.data)||void 0===r?void 0:r._links["fx:coupon_code_transactions"].href)&&void 0!==e?e:"");o.searchParams.set("zoom","items"),s=o.toString()}catch(r){s=void 0}return a(i||(i=d` ${0} <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-async-list-control first="${0}" infer="transactions" limit="5" item="foxy-transaction-card" .getPageHref="${0}" hide-delete-button> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),t(s),this.getTransactionPageHref,super.renderBody())}}customElements.define("foxy-coupon-code-form",c);export{c as CouponCodeForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-d393bcd8.js";import{I as e}from"./shared-8c1df97c.js";import{a as s}from"./shared-075796e2.js";import{B as r}from"./shared-0f6e4584.js";import{h as o}from"./shared-dc73b9a5.js";import"./shared-12ac8cc6.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-6a4e81ad.js";import"./shared-fb56178f.js";import"./shared-ff63a551.js";import"./shared-7b8ad9c1.js";import"./shared-51c4a6dd.js";import"./shared-f1d2b5bb.js";import"./shared-343d1fd7.js";import"./shared-f7a1193f.js";import"./shared-0b01f721.js";import"./shared-9803aa7c.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-4e709717.js";import"./shared-a0c6a159.js";import"./shared-22ba9566.js";import"./shared-99940888.js";import"./shared-2d723710.js";import"./shared-61ade33e.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./foxy-copy-to-clipboard.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let t,a=e=>e;const d=s(e,"coupon-codes-form");class i extends d{constructor(){super(...arguments),this.__couponCodesGetValue=()=>{var e,s;return null!==(s=null===(e=this.form.coupon_codes)||void 0===e?void 0:e.map((e=>({value:e}))))&&void 0!==s?s:[]},this.__couponCodesSetValue=e=>{this.edit({coupon_codes:e.map((({value:e})=>e.split(" ").map((e=>e.trim())))).flat().filter(((e,s,r)=>r.indexOf(e)===s))})}}static get v8n(){return[({coupon_codes:e})=>e&&e.length>0||"coupon-codes:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.href&&e.push("coupon-codes"),new r(e.join(" ").trim())}get hiddenSelector(){const e=["delete timestamps",super.hiddenSelector.toString()];return new r(e.join(" ").trim())}renderBody(){return o(t||(t=a` <foxy-internal-editable-list-control infer="coupon-codes" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> ${0} `),this.__couponCodesGetValue,this.__couponCodesSetValue,super.renderBody())}async _sendPost(e){const s=JSON.stringify(e),r=await this._fetch(this.parent,{body:s,method:"POST"});return this.status={key:"success"},r}}customElements.define("foxy-coupon-codes-form",i);export{i as CouponCodesForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-7fd9a30f.js";import"./shared-10b5e78f.js";import"./shared-1cf1e1a4.js";import"./shared-aefac46b.js";import{I as e}from"./shared-7b8ad9c1.js";import"./foxy-query-builder.js";import{_ as t,B as o}from"./shared-0f6e4584.js";import{O as s,T as r}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-3fa791ca.js";import"./shared-292ba15e.js";import"./shared-6e355777.js";import"./shared-cbb0e610.js";import{I as a}from"./shared-8c1df97c.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-f1d2b5bb.js";import{R as l,a as d}from"./shared-075796e2.js";import{i as c}from"./shared-9803aa7c.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-fb56178f.js";import"./shared-5c05ac06.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-2d723710.js";import"./shared-bab2ea2c.js";import"./shared-fe77f6f6.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-df00a537.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-339bbd50.js";import"./shared-ffd3690b.js";import"./shared-2fc671cd.js";import"./shared-021c7a22.js";import"./shared-303b428e.js";import"./shared-10325cda.js";import"./shared-2099544a.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-43e2c3f6.js";import"./shared-a036e345.js";import"./shared-77051754.js";import"./shared-a6273e4a.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-61f4e91a.js";import"./shared-b98b8d02.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-cc79152c.js";let u,p,_,m,f=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.operators=Object.values(s),this.disableOr=!1}static get properties(){return t(t({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"}})}renderControl(){const{label:e,helperText:t,_errorMessage:o}=this,s=o&&!this.disabled&&!this.readonly;return n(u||(u=f` <section class="${0}"> ${0} <foxy-query-builder infer="query-builder" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=f`<p class="text-s font-medium">${0}</p>`),e):"",this.operators,this._value,this.disableOr,(e=>{var t;const o=e.currentTarget;this._value=null!==(t=o.value)&&void 0!==t?t:""}),t?n(_||(_=f`<p class="text-xs">${0}</p>`),t):"",s?n(m||(m=f`<p class="text-xs text-error">${0}</p>`),o):"")}});let h,y,b,x,g,v=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"",r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),d=this._errorMessage;return n(h||(h=v` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:s,type:r,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),a||l?n(y||(y=v` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!d||this.disabled||this.readonly?"":n(b||(b=v`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"";return r?this.t("discount_summary",{params:{details:r,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,o=null==e?void 0:e.form.coupon_discount_details,s=null==e?void 0:e.form.coupon_discount_type,r=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=r.find((e=>e.details===o&&e.type===s));return n(x||(x=v` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:t(t({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,o;const s=e.currentTarget,i=r[s.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),r.map((e=>n(g||(g=v` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===a,this.t("discount_summary",{params:t(t({},e),{},{ns:this.ns})})))),!a&&!!o&&!!s,this.t("custom_discount"))}});let j,$,w=e=>e;const k=l(d(a,"coupon-form"));class V extends k{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).join(",")})},this.__itemOptionRestrictionsOperators=[s.In],this.__itemOptionRestrictionsGetValue=()=>{var e;const t=new URLSearchParams,o=null!==(e=this.form.item_option_restrictions)&&void 0!==e?e:{};for(const e in o)t.set(`${e}:in`,o[e].join(","));return t.toString()},this.__itemOptionRestrictionsSetValue=e=>{const t=Object.fromEntries(Array.from(new URLSearchParams(e).entries()).map((([e,t])=>[e.replace(":in",""),t.split(",").filter((e=>!!e.trim()))])));this.edit({item_option_restrictions:t})},this.__optionsGetValue=()=>{const e=[];return this.form.multiple_codes_allowed&&e.push("multiple_codes_allowed"),this.form.combinable&&e.push("combinable"),this.form.exclude_category_discounts&&e.push("exclude_category_discounts"),this.form.exclude_line_item_discounts&&e.push("exclude_line_item_discounts"),this.form.is_taxable&&e.push("is_taxable"),this.form.shared_codes_allowed&&e.push("shared_codes_allowed"),this.form.customer_auto_apply&&e.push("customer_auto_apply"),e},this.__optionsSetValue=e=>{this.edit({multiple_codes_allowed:e.includes("multiple_codes_allowed"),combinable:e.includes("combinable"),exclude_category_discounts:e.includes("exclude_category_discounts"),exclude_line_item_discounts:e.includes("exclude_line_item_discounts"),is_taxable:e.includes("is_taxable"),shared_codes_allowed:e.includes("shared_codes_allowed"),customer_auto_apply:e.includes("customer_auto_apply")})},this.__optionsOptions=[{value:"multiple_codes_allowed",label:"option_multiple_codes_allowed"},{value:"combinable",label:"option_combinable"},{value:"exclude_category_discounts",label:"option_exclude_category_discounts"},{value:"exclude_line_item_discounts",label:"option_exclude_line_item_discounts"},{value:"is_taxable",label:"option_is_taxable"},{value:"shared_codes_allowed",label:"option_shared_codes_allowed"},{value:"customer_auto_apply",label:"option_customer_auto_apply"}],this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:r.String},{label:"used_codes",path:"number_of_uses_to_date",type:r.Number},{label:"date_created",path:"date_created",type:r.Date},{label:"date_modified",path:"date_modified",type:r.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),this.form.customer_auto_apply||e.push("customer-attribute-restrictions","customer-subscription-restrictions"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return t(t({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return n(j||(j=w` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,o,s,r,i,a,l;let d;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");o.searchParams.set("order","date_created desc"),d=o.toString()}catch(e){d=void 0}return n($||($=w` ${0} <foxy-internal-text-control infer="name"></foxy-internal-text-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <div class="grid gap-l sm-grid-cols-3"> <foxy-internal-integer-control infer="number-of-uses-allowed" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-customer" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-code" min="0" show-controls> </foxy-internal-integer-control> </div> <div class="grid gap-l sm-grid-cols-2"> <foxy-internal-date-control infer="start-date"></foxy-internal-date-control> <foxy-internal-date-control infer="end-date"></foxy-internal-date-control> </div> <foxy-internal-number-control min="0" max="1" infer="inclusive-tax-rate"> </foxy-internal-number-control> <foxy-internal-checkbox-group-control infer="options" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],c(null===(o=this.data)||void 0===o?void 0:o._links.self.href),c(null===(r=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===r?void 0:r._links["fx:item_categories"].href),c(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),this.__optionsGetValue,this.__optionsSetValue,this.__optionsOptions,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,c(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),c(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",V);export{V as CouponForm};
|
|
1
|
+
import"./shared-7fd9a30f.js";import"./shared-10b5e78f.js";import"./shared-1cf1e1a4.js";import"./shared-d393bcd8.js";import{I as e}from"./shared-7b8ad9c1.js";import"./foxy-query-builder.js";import{_ as t,B as o}from"./shared-0f6e4584.js";import{O as s,T as r}from"./shared-8874ec69.js";import{c as i}from"./shared-4e709717.js";import{h as n}from"./shared-dc73b9a5.js";import"./shared-3fa791ca.js";import"./shared-f07d15d6.js";import"./shared-3ea78c8d.js";import"./shared-cbb0e610.js";import{I as a}from"./shared-8c1df97c.js";import"./foxy-generate-codes-form.js";import"./foxy-item-category-card.js";import"./foxy-coupon-codes-form.js";import"./foxy-coupon-code-card.js";import"./foxy-coupon-code-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-form.js";import"./foxy-attribute-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-discount-builder.js";import"./shared-f1d2b5bb.js";import{R as l,a as d}from"./shared-075796e2.js";import{i as c}from"./shared-9803aa7c.js";import"./shared-e6e84ff5.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-fb56178f.js";import"./shared-5c05ac06.js";import"./shared-f7a1193f.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-24d71d01.js";import"./shared-c286c5ad.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-a0c6a159.js";import"./shared-99940888.js";import"./foxy-pagination.js";import"./shared-2d723710.js";import"./shared-bab2ea2c.js";import"./shared-fe77f6f6.js";import"./foxy-form-dialog.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-22ba9566.js";import"./shared-51c4a6dd.js";import"./shared-8438d4ca.js";import"./shared-79d0699c.js";import"./shared-df00a537.js";import"./shared-e5d37737.js";import"./shared-acdcae7e.js";import"./shared-3e03c988.js";import"./shared-339bbd50.js";import"./shared-ffd3690b.js";import"./shared-2fc671cd.js";import"./shared-021c7a22.js";import"./shared-303b428e.js";import"./shared-10325cda.js";import"./shared-2099544a.js";import"./shared-b6814728.js";import"./shared-634b670e.js";import"./shared-43e2c3f6.js";import"./shared-a036e345.js";import"./shared-77051754.js";import"./shared-a6273e4a.js";import"./shared-61f4e91a.js";import"./shared-b98b8d02.js";import"./foxy-swipe-actions.js";import"./foxy-transaction-card.js";import"./shared-cc79152c.js";let u,p,_,m,f=e=>e;customElements.define("foxy-internal-query-builder-control",class extends e{constructor(){super(...arguments),this.operators=Object.values(s),this.disableOr=!1}static get properties(){return t(t({},super.properties),{},{operators:{type:Array},disableOr:{type:Boolean,attribute:"disable-or"}})}renderControl(){const{label:e,helperText:t,_errorMessage:o}=this,s=o&&!this.disabled&&!this.readonly;return n(u||(u=f` <section class="${0}"> ${0} <foxy-query-builder infer="query-builder" .operators="${0}" .value="${0}" ?disable-or="${0}" @change="${0}"> </foxy-query-builder> ${0} ${0} </section> `),i({"grid gap-xs leading-xs transition-colors":!0,"text-secondary hover-text-body":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),e?n(p||(p=f`<p class="text-s font-medium">${0}</p>`),e):"",this.operators,this._value,this.disableOr,(e=>{var t;const o=e.currentTarget;this._value=null!==(t=o.value)&&void 0!==t?t:""}),t?n(_||(_=f`<p class="text-xs">${0}</p>`),t):"",s?n(m||(m=f`<p class="text-xs text-error">${0}</p>`),o):"")}});let h,y,b,x,g,v=e=>e;customElements.define("foxy-internal-coupon-form-rules-control",class extends e{renderControl(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_details)&&void 0!==e?e:"",r=null!==(t=null==o?void 0:o.form.coupon_discount_type)&&void 0!==t?t:"quantity_amount",a=this.helperText,l=this.__renderRulesDescription(),d=this._errorMessage;return n(h||(h=v` <section> <p class="leading-xs flex items-center justify-between space-x-m text-s mb-xs"> <span class="${0}"> ${0} </span> <span class="min-w-0">${0}</span> </p> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> ${0} ${0} </section> `),i({"transition-colors font-medium flex-1":!0,"text-secondary":!this.disabled,"text-disabled":this.disabled}),this.label,this.__renderPreset(),{details:s,type:r,name:"Rules"},(e=>{const t=e.currentTarget.parsedValue,o=this.nucleon;null==o||o.edit({coupon_discount_details:t.details,coupon_discount_type:t.type})}),a||l?n(y||(y=v` <p class="${0}"> ${0} </p> `),i({"text-xs mt-xs leading-xs transition-colors":!0,"text-secondary":!this.disabled&&!this.readonly,"text-disabled":this.disabled,"text-body":this.readonly}),l||a):"",!d||this.disabled||this.readonly?"":n(b||(b=v`<p class="mt-xs text-xs leading-xs text-error">${0}</p>`),this._errorMessage))}__renderRulesDescription(){var e,t;const o=this.nucleon,s=null!==(e=null==o?void 0:o.form.coupon_discount_type)&&void 0!==e?e:"quantity_amount",r=null!==(t=null==o?void 0:o.form.coupon_discount_details)&&void 0!==t?t:"";return r?this.t("discount_summary",{params:{details:r,type:s,ns:this.ns}}):null}__renderPreset(){const e=this.nucleon,o=null==e?void 0:e.form.coupon_discount_details,s=null==e?void 0:e.form.coupon_discount_type,r=[{type:"quantity_amount",details:"allunits|2-2"},{type:"quantity_percentage",details:"allunits|5-10|10-20"},{type:"quantity_amount",details:"incremental|3-5"},{type:"quantity_percentage",details:"incremental|11-10|51-15|101-20"},{type:"quantity_percentage",details:"repeat|2-100"},{type:"quantity_percentage",details:"repeat|4-50"},{type:"quantity_amount",details:"single|5-10"},{type:"price_percentage",details:"single|99.99-10"}],a=r.find((e=>e.details===o&&e.type===s));return n(x||(x=v` <label data-testid="rules:preset" class="${0}"> <foxy-i18n class="sr-only" infer="" key="preset"></foxy-i18n> <span class="relative font-medium flex items-center"> <span class="truncate"> ${0} </span> <iron-icon class="icon-inline text-xl ml-xs -mr-xs" icon="icons:expand-more"></iron-icon> <select data-testclass="interactive editable" data-testid="rules:preset:select" class="opacity-0 absolute inset-0 focus-outline-none" ?disabled="${0}" @change="${0}"> ${0} <option value="custom" ?selected="${0}"> ${0} </option> </select> </span> </label> `),i({"whitespace-nowrap block ring-primary-50 rounded px-xs -mx-xs transition-colors":!0,"text-body hover-text-primary focus-within-ring-2":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled}),a?this.t("discount_summary",{params:t(t({},a),{},{ns:this.ns})}):this.t("custom_discount"),this.disabled||this.readonly,(e=>{var t,o;const s=e.currentTarget,i=r[s.selectedIndex],n=this.nucleon;null==n||n.edit({coupon_discount_details:null!==(t=null==i?void 0:i.details)&&void 0!==t?t:"",coupon_discount_type:null!==(o=null==i?void 0:i.type)&&void 0!==o?o:"quantity_amount"})}),r.map((e=>n(g||(g=v` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.details,e===a,this.t("discount_summary",{params:t(t({},e),{},{ns:this.ns})})))),!a&&!!o&&!!s,this.t("custom_discount"))}});let j,$,w=e=>e;const k=l(d(a,"coupon-form"));class V extends k{constructor(){var e;super(...arguments),e=this,this.getTransactionPageHref=null,this.__customerSubscriptionRestrictionsGetValue=()=>{var e;const t=null===(e=this.form.customer_subscription_restrictions)||void 0===e?void 0:e.split(",").map((e=>e.trim())).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).map((e=>({value:e})));return null!=t?t:[]},this.__customerSubscriptionRestrictionsSetValue=e=>{this.edit({customer_subscription_restrictions:e.map((({value:e})=>e.trim())).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).join()}),this.edit({customer_auto_apply:!!this.form.customer_subscription_restrictions||!!this.form.customer_attribute_restrictions})},this.__productCodeRestrictionsGetValue=()=>{var e;return null===(e=this.form.product_code_restrictions)||void 0===e?void 0:e.split(",").filter((e=>!!e.trim())).map((e=>({value:e,label:e.startsWith("-")?this.t("product-code-restrictions.label_block",{value:e.substring(1)}):this.t("product-code-restrictions.label_allow",{value:e})})))},this.__productCodeRestrictionsSetValue=e=>{this.edit({product_code_restrictions:e.map((({value:e,unit:t})=>"block"===t?`-${e}`:e)).filter(((e,t,o)=>!!e&&o.indexOf(e)===t)).join(",")})},this.__itemOptionRestrictionsOperators=[s.In],this.__itemOptionRestrictionsGetValue=()=>{var e;const t=new URLSearchParams,o=null!==(e=this.form.item_option_restrictions)&&void 0!==e?e:{};for(const e in o)t.set(`${e}:in`,o[e].join(","));return t.toString()},this.__itemOptionRestrictionsSetValue=e=>{const t=Object.fromEntries(Array.from(new URLSearchParams(e).entries()).map((([e,t])=>[e.replace(":in",""),t.split(",").filter((e=>!!e.trim()))])));this.edit({item_option_restrictions:t})},this.__optionsGetValue=()=>{const e=[];return this.form.multiple_codes_allowed&&e.push("multiple_codes_allowed"),this.form.combinable&&e.push("combinable"),this.form.exclude_category_discounts&&e.push("exclude_category_discounts"),this.form.exclude_line_item_discounts&&e.push("exclude_line_item_discounts"),this.form.is_taxable&&e.push("is_taxable"),this.form.shared_codes_allowed&&e.push("shared_codes_allowed"),this.form.customer_auto_apply&&e.push("customer_auto_apply"),e},this.__optionsSetValue=e=>{this.edit({multiple_codes_allowed:e.includes("multiple_codes_allowed"),combinable:e.includes("combinable"),exclude_category_discounts:e.includes("exclude_category_discounts"),exclude_line_item_discounts:e.includes("exclude_line_item_discounts"),is_taxable:e.includes("is_taxable"),shared_codes_allowed:e.includes("shared_codes_allowed"),customer_auto_apply:e.includes("customer_auto_apply")})},this.__optionsOptions=[{value:"multiple_codes_allowed",label:"option_multiple_codes_allowed"},{value:"combinable",label:"option_combinable"},{value:"exclude_category_discounts",label:"option_exclude_category_discounts"},{value:"exclude_line_item_discounts",label:"option_exclude_line_item_discounts"},{value:"is_taxable",label:"option_is_taxable"},{value:"shared_codes_allowed",label:"option_shared_codes_allowed"},{value:"customer_auto_apply",label:"option_customer_auto_apply"}],this.__storeLoaderId="storeLoader",this.__codesFilters=[{label:"code",path:"code",type:r.String},{label:"used_codes",path:"number_of_uses_to_date",type:r.Number},{label:"date_created",path:"date_created",type:r.Date},{label:"date_modified",path:"date_modified",type:r.Date}],this.__couponCodesActions=[{theme:"contrast",state:"idle",text:"copy_button_text",onClick:async function(t){e.__couponCodesActions[0].state="busy",e.__couponCodesActions=[...e.__couponCodesActions];try{await navigator.clipboard.writeText(t.code),e.__couponCodesActions[0].state="end"}catch(t){e.__couponCodesActions[0].state="error"}finally{e.__couponCodesActions=[...e.__couponCodesActions],setTimeout((()=>{e.__couponCodesActions[0].state="idle",e.__couponCodesActions=[...e.__couponCodesActions]}),1e3)}}}]}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},__couponCodesActions:{type:Array}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!e||e.length<=50||"name:v8n_too_long",({inclusive_tax_rate:e})=>!e||e>=0||"inclusive-tax-rate:v8n_too_small",({inclusive_tax_rate:e})=>!e||e<=1||"inclusive-tax-rate:v8n_too_big",({number_of_uses_allowed:e})=>!e||e>=0||"number-of-uses-allowed:v8n_too_small",({coupon_discount_details:e})=>!!e||"rules:v8n_required",({coupon_discount_details:e})=>!e||e.length<=200||"rules:v8n_too_long",({item_option_restrictions:e})=>!e||JSON.stringify(e).length<=6e3||"item-option-restrictions:v8n_too_long",({product_code_restrictions:e})=>!e||e.length<=5e3||"product-code-restrictions:v8n_too_long",({customer_attribute_restrictions:e})=>!e||e.length<=2e3||"customer-attribute-restrictions:v8n_too_long",({number_of_uses_allowed_per_code:e})=>!e||e>=0||"number-of-uses-allowed-per-code:v8n_too_small",({customer_subscription_restrictions:e})=>!e||e.length<=200||"customer-subscription-restrictions:v8n_too_long",({number_of_uses_allowed_per_customer:e})=>!e||e>=0||"number-of-uses-allowed-per-customer:v8n_too_small"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data||e.push("coupon-codes","category-restrictions","attributes"),this.form.customer_auto_apply||e.push("customer-attribute-restrictions","customer-subscription-restrictions"),new o(e.join(" ").trim())}get headerSubtitleOptions(){return t(t({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}renderHeaderActions(e){return n(j||(j=w` <foxy-internal-bulk-add-action-control parent="${0}" infer="generate" form="foxy-generate-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> <foxy-internal-bulk-add-action-control parent="${0}" infer="import" form="foxy-coupon-codes-form" .related="${0}"> </foxy-internal-bulk-add-action-control> ${0} `),e._links["fx:generate_codes"].href,[e._links["fx:coupon_codes"].href],e._links["fx:coupon_codes"].href,[e._links["fx:coupon_codes"].href],super.renderHeaderActions(e))}renderBody(){var e,t,o,s,r,i,a,l;let d;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:coupon_codes"].href)&&void 0!==t?t:"");o.searchParams.set("order","date_created desc"),d=o.toString()}catch(e){d=void 0}return n($||($=w` ${0} <foxy-internal-text-control infer="name"></foxy-internal-text-control> <foxy-internal-coupon-form-rules-control infer="rules"> </foxy-internal-coupon-form-rules-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="coupon-codes" item="foxy-coupon-code-card" form="foxy-coupon-code-form" alert .formProps="${0}" .actions="${0}" .filters="${0}"> </foxy-internal-async-list-control> <foxy-internal-query-builder-control infer="item-option-restrictions" disable-or .operators="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-query-builder-control> <foxy-internal-editable-list-control infer="product-code-restrictions" .getValue="${0}" .setValue="${0}" .units="${0}"> </foxy-internal-editable-list-control> <foxy-internal-async-resource-link-list-control foreign-key-for-uri="item_category_uri" foreign-key-for-id="item_category_id" own-key-for-uri="coupon_uri" own-uri="${0}" embed-key="fx:coupon_item_categories" options-href="${0}" links-href="${0}" infer="category-restrictions" limit="5" item="foxy-item-category-card"> </foxy-internal-async-resource-link-list-control> <div class="grid gap-l sm-grid-cols-3"> <foxy-internal-integer-control infer="number-of-uses-allowed" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-customer" min="0" show-controls> </foxy-internal-integer-control> <foxy-internal-integer-control infer="number-of-uses-allowed-per-code" min="0" show-controls> </foxy-internal-integer-control> </div> <div class="grid gap-l sm-grid-cols-2"> <foxy-internal-date-control infer="start-date"></foxy-internal-date-control> <foxy-internal-date-control infer="end-date"></foxy-internal-date-control> </div> <foxy-internal-number-control min="0" max="1" infer="inclusive-tax-rate"> </foxy-internal-number-control> <foxy-internal-checkbox-group-control infer="options" theme="vertical" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-editable-list-control infer="customer-subscription-restrictions" .getValue="${0}" .setValue="${0}"> </foxy-internal-editable-list-control> <foxy-internal-query-builder-control infer="customer-attribute-restrictions"> </foxy-internal-query-builder-control> <foxy-internal-async-list-control first="${0}" limit="5" infer="attributes" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> ${0} <foxy-nucleon infer="" class="hidden" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),d,{".getTransactionPageHref":this.getTransactionPageHref},this.__couponCodesActions,this.__codesFilters,this.__itemOptionRestrictionsOperators,this.__itemOptionRestrictionsGetValue,this.__itemOptionRestrictionsSetValue,this.__productCodeRestrictionsGetValue,this.__productCodeRestrictionsSetValue,[{label:this.t("product-code-restrictions.unit_allow"),value:"allow"},{label:this.t("product-code-restrictions.unit_block"),value:"block"}],c(null===(o=this.data)||void 0===o?void 0:o._links.self.href),c(null===(r=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===r?void 0:r._links["fx:item_categories"].href),c(null===(i=this.data)||void 0===i?void 0:i._links["fx:coupon_item_categories"].href),this.__optionsGetValue,this.__optionsSetValue,this.__optionsOptions,this.__customerSubscriptionRestrictionsGetValue,this.__customerSubscriptionRestrictionsSetValue,c(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),super.renderBody(),c(null===(l=this.data)||void 0===l?void 0:l._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-coupon-form",V);export{V as CouponForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-cc79152c.js";import"./shared-a159ccff.js";import"./shared-6e355777.js";import{I as t}from"./shared-8c1df97c.js";import{a as e}from"./shared-7b8ad9c1.js";import"./shared-f1d2b5bb.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-075796e2.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|
|
1
|
+
import"./shared-cc79152c.js";import"./shared-a159ccff.js";import"./shared-3ea78c8d.js";import{I as t}from"./shared-8c1df97c.js";import{a as e}from"./shared-7b8ad9c1.js";import"./shared-f1d2b5bb.js";import{i as s}from"./shared-9803aa7c.js";import{h as o}from"./shared-dc73b9a5.js";import{c as r,_ as a,B as i}from"./shared-0f6e4584.js";import{S as n,a as d}from"./shared-075796e2.js";import{v as l}from"./shared-b738ee96.js";import{c as h}from"./shared-4e709717.js";import"./shared-6a4e81ad.js";import"./shared-30221a16.js";import"./shared-8f7a31e0.js";import"./shared-61ade33e.js";import"./shared-fe77f6f6.js";import"./shared-fb56178f.js";import"./shared-f5366dda.js";import"./shared-e5d37737.js";import"./shared-3e03c988.js";import"./shared-acdcae7e.js";import"./shared-22ba9566.js";import"./shared-2d723710.js";import"./shared-abea5e34.js";import"./shared-7026fb08.js";import"./shared-c286c5ad.js";import"./shared-343d1fd7.js";import"./shared-0b01f721.js";import"./shared-f7a1193f.js";import"./foxy-copy-to-clipboard.js";import"./shared-12ac8cc6.js";import"./shared-ff63a551.js";import"./shared-5c05ac06.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-24d71d01.js";import"./shared-cd96ff03.js";import"./shared-522a172d.js";import"./shared-12a7a15d.js";import"./shared-6474675f.js";import"./shared-ee36b83f.js";import"./shared-51c4a6dd.js";!function(){function t(t,e,s){if(null!=s){const o=t.includes("?")?"&":"?";return t+o+e+"="+encodeURIComponent(s)}return t}class e extends Error{constructor(t){super(`[hcaptcha-web-component]: ${t}`),Object.setPrototypeOf(this,e.prototype)}}class s extends HTMLElement{connectedCallback(){(function(e){if(window._hCaptchaOnLoadPromise)return window._hCaptchaOnLoadPromise;if(window.hcaptcha)return console.warn("[vanilla-hcaptcha] hCaptcha JS API detected to be externally loaded. Unless you know what are you doing, this task should be delegated to this web component."),window._hCaptchaOnLoadPromise=Promise.resolve(),window._hCaptchaOnLoadPromise;{let s,o;window._hCaptchaOnLoadPromise=new Promise(((t,e)=>{s=t,o=e})),window._hCaptchaOnLoad=s;const r=function(e){let s=e.jsapi;return s=t(s,"render","explicit"),s=t(s,"onload","_hCaptchaOnLoad"),s=t(s,"recaptchacompat",!1===e.reCaptchaCompat?"off":null),s=t(s,"host",e.host),s=t(s,"hl",e.hl),s=t(s,"sentry",JSON.stringify(e.sentry)),s=t(s,"endpoint",e.endpoint),s=t(s,"assethost",e.assethost),s=t(s,"imghost",e.imghost),s=t(s,"reportapi",e.reportapi),s}(e),a=document.createElement("script");return a.src=r,a.async=!0,a.defer=!0,a.onerror=t=>{const e=`Failed to load hCaptcha JS API: "${r}"`;console.error(e,t),o(e)},document.head.appendChild(a),window._hCaptchaOnLoadPromise}})({host:this.getAttribute("host"),hl:this.getAttribute("hl"),sentry:"false"!==this.getAttribute("sentry"),reCaptchaCompat:"false"===this.getAttribute("reCaptchaCompat"),jsapi:this.getAttribute("jsapi")||"https://js.hcaptcha.com/1/api.js",endpoint:this.getAttribute("endpoint"),reportapi:this.getAttribute("reportapi"),assethost:this.getAttribute("assethost"),imghost:this.getAttribute("imghost")}).then(this.onApiLoaded.bind(this)).catch(this.onError.bind(this))}onApiLoaded(){this.$emit("loaded");const t="false"!==this.getAttribute("auto-render"),e={sitekey:this.getAttribute("sitekey")||this.getAttribute("site-key"),theme:this.getAttribute("theme"),size:this.getAttribute("size"),hl:this.getAttribute("hl"),tplinks:"off"===this.getAttribute("tplinks")?"off":"on",tabindex:parseInt(this.getAttribute("tabindex")),custom:"true"===this.getAttribute("custom")},s=this.getAttribute("challenge-container");s&&(e["challenge-container"]=s);const o=this.getAttribute("rqdata");t&&!e.sitekey||t&&(this.render(e),this.setData(o))}assertApiLoaded(t){if(!hcaptcha)throw new e(`hCaptcha JS API was not loaded yet. Please wait for \`loaded\` event to safely call "${t}".`)}assertRendered(){if(!this.hcaptchaId)throw new e('hCaptcha was not yet rendered. Please call "render()" first.')}onError(t){console.error(t),this.$emit("error",{error:t})}$emit(t,e){let s;"function"==typeof Event?s=new Event(t):(s=document.createEvent("Event"),s.initEvent(t,!1,!1)),e&&Object.assign(s,e),this.dispatchEvent(s)}render(t){this.assertApiLoaded("render"),this.hcaptchaId?console.warn("hCaptcha was already rendered. You may want to call 'reset()' first."):this.hcaptchaId=hcaptcha.render(this,Object.assign(Object.assign({},t),{callback:()=>{const t=hcaptcha.getResponse(this.hcaptchaId),e=hcaptcha.getRespKey(this.hcaptchaId);this.$emit("verified",{token:t,eKey:e,key:t})},"expired-callback":()=>{this.$emit("expired")},"chalexpired-callback":()=>{this.$emit("challenge-expired")},"error-callback":this.onError.bind(this),"open-callback":()=>{this.$emit("opened")},"close-callback":()=>{this.$emit("closed")}}))}setData(t){this.assertRendered(),hcaptcha.setData(this.hcaptchaId,{rqdata:t})}execute(){this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId)}executeAsync(){return this.assertApiLoaded("execute"),this.assertRendered(),hcaptcha.execute(this.hcaptchaId,{async:!0})}reset(){this.assertApiLoaded("reset"),this.assertRendered(),hcaptcha.reset(this.hcaptchaId)}}customElements.define("h-captcha",s)}();let c,p=t=>t;customElements.define("foxy-internal-customer-form-legal-notice-control",class extends e{renderControl(){var t,e;const r=this.nucleon;return o(c||(c=p` <p class="leading-s text-xs text-secondary"> <foxy-i18n infer="" key="text"></foxy-i18n> <a class="font-medium text-body rounded hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" target="_blank" href="${0}" rel="noopener noreferrer"> <foxy-i18n infer="" key="link"></foxy-i18n> </a> </p> `),s(null===(e=null===(t=null==r?void 0:r.settings)||void 0===t?void 0:t.tos_checkbox_settings)||void 0===e?void 0:e.url))}});var m=r((function(t){!function(){const e=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],s=(t,s=e,o="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";s[0].minDiversity=0,s[0].minLength=0;const a=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];o&&a.push({regex:`[${o}]`,message:"symbol"});let i={};i.contains=a.filter((t=>new RegExp(`${t.regex}`).test(r))).map((t=>t.message)),i.length=r.length;let n=s.filter((t=>i.contains.length>=t.minDiversity)).filter((t=>i.length>=t.minLength)).sort(((t,e)=>e.id-t.id)).map((t=>({id:t.id,value:t.value})));return Object.assign(i,n[0]),i};t.exports={passwordStrength:s,defaultOptions:e}}()}));let u,f,g=t=>t;const _=n(d(t,"customer-form")),y=m.passwordStrength;class x extends _{constructor(){super(...arguments),this.passwordless=!1,this.settings=null,this.__isAnonymousGetValue=()=>{var t;return!1===(null===(t=this.form)||void 0===t?void 0:t.is_anonymous)?"false":"true"},this.__isAnonymousSetValue=t=>{const e="true"===t;this.edit({is_anonymous:e}),e&&this.form.password&&this.edit({password:""}),e&&this.form.password_old&&this.edit({password_old:""}),e&&this.form.forgot_password&&this.edit({forgot_password:""})},this.__isAnonymousOptions=[{value:"true",label:"option_true"},{value:"false",label:"option_false"}],this.__refreshInterval=null}static get scopedElements(){return{"foxy-internal-customer-form-legal-notice-control":customElements.get("foxy-internal-customer-form-legal-notice-control"),"foxy-internal-radio-group-control":customElements.get("foxy-internal-radio-group-control"),"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-password-control":customElements.get("foxy-internal-password-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-text-control":customElements.get("foxy-internal-text-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"h-captcha":customElements.get("h-captcha"),"vaadin-button":customElements.get("vaadin-button")}}static get properties(){return a(a({},super.properties),{},{passwordless:{type:Boolean},settings:{type:Object}})}static get v8n(){return[({password:t,_links:e,is_anonymous:s=!0},o)=>!!o.passwordless||(!!(e||s||t)||"password:v8n_required"),({password_old:t,password:e,_links:s},o)=>{var r;return!s||(void 0===(null===(r=o.settings)||void 0===r?void 0:r.sign_up)||(!(e&&!t)||"password-old:v8n_required"))},({first_name:t})=>!t||t.length<=50||"first-name:v8n_too_long",({last_name:t})=>!t||t.length<=50||"last-name:v8n_too_long",({password:t})=>!t||y(t).id>=2||"password:v8n_too_weak",({password:t})=>!t||t.length<=50||"password:v8n_too_long",({tax_id:t})=>!t||t.length<=50||"tax-id:v8n_too_long",({email:t})=>t&&t.length>0||"email:v8n_required",({email:t})=>!t||t.length<=100||"email:v8n_too_long",({email:t})=>!t||l(t)||"email:v8n_invalid_email"]}get hiddenSelector(){const t=new Set(super.hiddenSelector.toString().split(" "));return this.settings?(t.add("forgot-password"),t.add("is-anonymous"),this.form.password||t.add("password-old"),"none"===this.settings.tos_checkbox_settings.usage&&t.add("legal-notice")):(!1!==this.form.is_anonymous&&(t.add("forgot-password"),t.add("password")),t.add("password-old"),t.add("legal-notice")),this.href&&(t.add("is-anonymous"),t.add("legal-notice")),new i(Array.from(t).join(" ").trim())}get headerTitleOptions(){const t=this.data;return!t||t.first_name.trim()||t.last_name.trim()?super.headerTitleOptions:a(a({},super.headerTitleOptions),{},{context:"no_name"})}get headerSubtitleKey(){var t;return(null===(t=this.data)||void 0===t?void 0:t.is_anonymous)?"subtitle_anonymous":"subtitle_registered"}get headerSubtitleOptions(){return a(a({},super.headerSubtitleOptions),{},{id:this.headerCopyIdValue})}disconnectedCallback(){super.disconnectedCallback();const t=this.__refreshInterval;t&&clearInterval(t)}connectedCallback(){super.connectedCallback();const t=setInterval((()=>this.requestUpdate()),6e4);this.__refreshInterval=t}renderBody(){var t,e,s,r;const a=this.hiddenSelector.matches("first-name",!0),i=this.hiddenSelector.matches("last-name",!0);return o(u||(u=g` ${0} <div class="${0}"> <foxy-internal-text-control infer="first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="last-name"></foxy-internal-text-control> </div> <foxy-internal-text-control helper-text="${0}" infer="email"> </foxy-internal-text-control> <foxy-internal-radio-group-control infer="is-anonymous" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> <foxy-internal-password-control placeholder="${0}" helper-text="${0}" infer="password" show-generator> </foxy-internal-password-control> <foxy-internal-password-control infer="password-old"></foxy-internal-password-control> <foxy-internal-password-control helper-text="${0}" infer="forgot-password" show-generator> </foxy-internal-password-control> <foxy-internal-text-control infer="tax-id"></foxy-internal-text-control> <foxy-internal-customer-form-legal-notice-control infer="legal-notice"> </foxy-internal-customer-form-legal-notice-control> ${0} ${0} `),this.renderHeader(),h({"grid-cols-2":!a&&!i,hidden:a&&i,"gap-m":!0,grid:!a||!i}),this.__emailHelperText,this.__isAnonymousGetValue,this.__isAnonymousSetValue,this.__isAnonymousOptions,this.__passwordPlaceholder,this.__passwordHelperText,this.__forgotPasswordHelperText,!this.data&&(null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.enabled)&&"hcaptcha"===(null===(r=null===(s=this.settings)||void 0===s?void 0:s.sign_up)||void 0===r?void 0:r.verification.type)?o(f||(f=g` <h-captcha site-key="${0}" class="hidden" size="invisible" hl="${0}" @verified="${0}"> </h-captcha> `),this.settings.sign_up.verification.site_key,this.lang,(({token:t})=>{this.edit({verification:{type:"hcaptcha",token:t}}),super.submit()})):"",super.renderBody())}submit(){var t,e,s,o,r;"hcaptcha"!==(null===(s=null===(e=null===(t=this.settings)||void 0===t?void 0:t.sign_up)||void 0===e?void 0:e.verification)||void 0===s?void 0:s.type)||this.data?super.submit():(null===(o=this.__hcaptcha)||void 0===o||o.reset(),null===(r=this.__hcaptcha)||void 0===r||r.execute())}async _sendPatch(t){const e=await super._sendPatch(t);if(t.password){const t={key:"password_change_success",options:{email:e.email}};this.status=t}return e}async _sendGet(){return this.status=null,await super._sendGet()}async _fetch(...t){try{return await super._fetch(...t)}catch(t){let e;try{e=(await t.json())._embedded["fx:errors"][0].message}catch(e){throw t}throw"Conflict"===e||e.startsWith("This email address is already in use")?["error:email_already_used"]:e.startsWith("Customer registration is disabled")?["error:registration_disabled"]:e.startsWith("Client verification failed")?["error:verification_failed"]:e.startsWith("Provided password is incorrect")?["error:old_password_incorrect"]:t}}get __forgotPasswordHelperText(){var t,e;const s=null===(t=this.data)||void 0===t?void 0:t.forgot_password_timestamp,o="forgot-password.helper_text";if((null===(e=this.data)||void 0===e?void 0:e.forgot_password)&&s){const t=new Date(new Date(s).getTime()+18e5),e=Math.floor((t.getTime()-Date.now())/1e3/60);return e<=0?this.t(`${o}_expired_on`,{expiresOn:t}):this.t(`${o}_expires_in`,{expiresInMin:`${e}minutes`})}return this.t(o)}get __passwordPlaceholder(){return this.data?this.t("password.placeholder_new"):this.t("password.placeholder")}get __passwordHelperText(){return this.data?this.t("password.helper_text_new"):this.t("password.helper_text")}get __emailHelperText(){var t;return(null===(t=this.data)||void 0===t?void 0:t.last_login_date)?this.t("email.helper_text_last_login_date",{date:this.data.last_login_date}):this.t("email.helper_text")}get __hcaptcha(){return this.renderRoot.querySelector("h-captcha")}}customElements.define("foxy-customer-form",x);export{x as CustomerForm};
|