@dropins/storefront-account 0.1.0-alpha10
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/api/createCustomerAddress/createCustomerAddress.d.ts +4 -0
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +2 -0
- package/api/createCustomerAddress/index.d.ts +2 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
- package/api/fetch-graphql/index.d.ts +2 -0
- package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
- package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
- package/api/getAttributesForm/index.d.ts +2 -0
- package/api/getCountries/getCountries.d.ts +9 -0
- package/api/getCountries/graphql/getCountries.graphql.d.ts +2 -0
- package/api/getCountries/index.d.ts +2 -0
- package/api/getCustomer/getCustomer.d.ts +4 -0
- package/api/getCustomer/graphql/getCustomer.graphql.d.ts +2 -0
- package/api/getCustomer/index.d.ts +2 -0
- package/api/getCustomerAddress/getCustomerAddress.d.ts +4 -0
- package/api/getCustomerAddress/graphql/getCustomerAddress.graphql.d.ts +2 -0
- package/api/getCustomerAddress/index.d.ts +2 -0
- package/api/getOrderHistoryList/getOrderHistoryList.d.ts +4 -0
- package/api/getOrderHistoryList/graphql/customerAddressFragment.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/graphql/getOrderHistoryList.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/graphql/orderSummaryFragment.graphql.d.ts +2 -0
- package/api/getOrderHistoryList/index.d.ts +2 -0
- package/api/getRegions/getRegions.d.ts +5 -0
- package/api/getRegions/graphql/getRegions.graphql.d.ts +2 -0
- package/api/getRegions/index.d.ts +2 -0
- package/api/index.d.ts +12 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +14 -0
- package/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.d.ts +2 -0
- package/api/removeCustomerAddress/index.d.ts +2 -0
- package/api/removeCustomerAddress/removeCustomerAddress.d.ts +2 -0
- package/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.d.ts +2 -0
- package/api/updateCustomerAddress/index.d.ts +2 -0
- package/api/updateCustomerAddress/updateCustomerAddress.d.ts +8 -0
- package/api.d.ts +1 -0
- package/api.js +9 -0
- package/chunks/AddressFormWrapper.js +1 -0
- package/chunks/getOrderHistoryList.js +113 -0
- package/chunks/removeCustomerAddress.js +116 -0
- package/components/AccountLoaders/AccountLoaders.d.ts +8 -0
- package/components/AccountLoaders/index.d.ts +3 -0
- package/components/AddressActions/AddressActions.d.ts +5 -0
- package/components/AddressActions/index.d.ts +3 -0
- package/components/AddressCard/AddressCard.d.ts +5 -0
- package/components/AddressCard/index.d.ts +3 -0
- package/components/AddressFormWrapper/AddressFormWrapper.d.ts +5 -0
- package/components/AddressFormWrapper/index.d.ts +3 -0
- package/components/AddressModal/AddressModal.d.ts +5 -0
- package/components/AddressModal/index.d.ts +3 -0
- package/components/AddressesWrapper/AddressesWrapper.d.ts +5 -0
- package/components/AddressesWrapper/index.d.ts +3 -0
- package/components/EmptyList/EmptyList.d.ts +5 -0
- package/components/EmptyList/index.d.ts +3 -0
- package/components/Form/Form.d.ts +6 -0
- package/components/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/Form/FormInputs/index.d.ts +3 -0
- package/components/Form/index.d.ts +3 -0
- package/components/OrdersListAction/OrdersListAction.d.ts +5 -0
- package/components/OrdersListAction/index.d.ts +3 -0
- package/components/OrdersListCard/OrdersListCard.d.ts +5 -0
- package/components/OrdersListCard/index.d.ts +3 -0
- package/components/OrdersListWrapper/OrdersListWrapper.d.ts +5 -0
- package/components/OrdersListWrapper/index.d.ts +3 -0
- package/components/index.d.ts +13 -0
- package/configs/addressField.config.d.ts +39 -0
- package/configs/defaultAttributePreset.config.d.ts +2 -0
- package/configs/mockDefaultAddress.config.d.ts +184 -0
- package/configs/mockOrdersList.config.d.ts +203 -0
- package/containers/AddressForm/AddressForm.d.ts +5 -0
- package/containers/AddressForm/index.d.ts +3 -0
- package/containers/AddressForm.d.ts +3 -0
- package/containers/AddressForm.js +1 -0
- package/containers/Addresses/Addresses.d.ts +5 -0
- package/containers/Addresses/index.d.ts +3 -0
- package/containers/Addresses.d.ts +3 -0
- package/containers/Addresses.js +1 -0
- package/containers/OrdersList/OrdersList.d.ts +5 -0
- package/containers/OrdersList/index.d.ts +3 -0
- package/containers/OrdersList.d.ts +3 -0
- package/containers/OrdersList.js +1 -0
- package/containers/index.d.ts +4 -0
- package/data/models/attributes-form.d.ts +46 -0
- package/data/models/country.d.ts +5 -0
- package/data/models/customer-address.d.ts +21 -0
- package/data/models/customer.d.ts +6 -0
- package/data/models/index.d.ts +6 -0
- package/data/models/order-history-list.d.ts +78 -0
- package/data/models/region.d.ts +11 -0
- package/data/transforms/index.d.ts +7 -0
- package/data/transforms/transform-attributes-form.d.ts +6 -0
- package/data/transforms/transform-countries.d.ts +10 -0
- package/data/transforms/transform-customer-address.d.ts +8 -0
- package/data/transforms/transform-customer.d.ts +5 -0
- package/data/transforms/transform-order-history-list.d.ts +5 -0
- package/data/transforms/transform-regions.d.ts +6 -0
- package/hooks/components/useForm.d.ts +13 -0
- package/hooks/containers/useAddressForm.d.ts +30 -0
- package/hooks/containers/useAddresses.d.ts +24 -0
- package/hooks/containers/useOrderSelectList.d.ts +12 -0
- package/hooks/containers/useOrdersList.d.ts +13 -0
- package/hooks/useDebounce.d.ts +3 -0
- package/hooks/useIsMobile.d.ts +2 -0
- package/i18n/en_US.json.d.ts +119 -0
- package/lib/areRequiredFieldsValid.d.ts +6 -0
- package/lib/checkIsFunction.d.ts +2 -0
- package/lib/convertCase.d.ts +4 -0
- package/lib/convertToBoolean.d.ts +2 -0
- package/lib/convertToInputDateFormat.d.ts +2 -0
- package/lib/fetch-error.d.ts +5 -0
- package/lib/formatDateToLocale.d.ts +31 -0
- package/lib/getDateRange.d.ts +10 -0
- package/lib/getFieldsConfig.d.ts +4 -0
- package/lib/getFormValues.d.ts +2 -0
- package/lib/getFormValuesFromRef.d.ts +5 -0
- package/lib/initializeFormDataAndErrors.d.ts +10 -0
- package/lib/manageAddressDeletion.d.ts +9 -0
- package/lib/network-error.d.ts +6 -0
- package/lib/normalizeAttributes.d.ts +2 -0
- package/lib/normalizeGetAddressData.d.ts +6 -0
- package/lib/prepareNormalizedData.d.ts +21 -0
- package/lib/serializeAddressForm.d.ts +4 -0
- package/lib/sortingAddressesList.d.ts +5 -0
- package/lib/transformSessionData.d.ts +6 -0
- package/lib/validationFields.d.ts +33 -0
- package/package.json +1 -0
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +3 -0
- package/types/addressForm.types.d.ts +45 -0
- package/types/addresses.types.d.ts +88 -0
- package/types/api/createCustomerAddress.types.d.ts +47 -0
- package/types/api/getAttributesForm.types.d.ts +31 -0
- package/types/api/getCountries.types.d.ts +19 -0
- package/types/api/getCustomer.types.d.ts +13 -0
- package/types/api/getCustomerAddress.type.d.ts +36 -0
- package/types/api/getOrderHistoryList.types.d.ts +77 -0
- package/types/api/getRegions.types.d.ts +16 -0
- package/types/api/removeCustomerAddress.types.d.ts +9 -0
- package/types/api/updateCustomerAddress.types.d.ts +11 -0
- package/types/emptyList.types.d.ts +8 -0
- package/types/form.types.d.ts +51 -0
- package/types/index.d.ts +15 -0
- package/types/ordersList.types.d.ts +52 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe/fetch-graphql').Header) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe/fetch-graphql').FetchOptions | undefined) => Promise<{
|
|
2
|
+
errors?: import('@adobe/fetch-graphql').FetchQueryError | undefined;
|
|
3
|
+
data: T;
|
|
4
|
+
}>, getConfig: () => {
|
|
5
|
+
endpoint: string | undefined;
|
|
6
|
+
fetchGraphQlHeaders: import('@adobe/fetch-graphql').Header | undefined;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=fetch-graphql.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
|
|
2
|
+
export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: customer_register_address) {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n";
|
|
3
|
+
//# sourceMappingURL=getAttributesForm.graphql.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Country } from '../../data/models';
|
|
2
|
+
|
|
3
|
+
export declare const getCountries: () => Promise<{
|
|
4
|
+
availableCountries: Country[] | [
|
|
5
|
+
];
|
|
6
|
+
countriesWithRequiredRegion: string[];
|
|
7
|
+
optionalZipCountries: string[];
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=getCountries.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const GET_CUSTOMER_ADDRESS = "\n query GET_CUSTOMER_ADDRESS {\n customer {\n addresses {\n firstname\n lastname\n city\n company\n country_code\n region {\n region\n region_code\n region_id\n }\n custom_attributesV2 {\n ... on AttributeValue {\n code\n value\n }\n }\n telephone\n id\n vat_id\n postcode\n street\n default_shipping\n default_billing\n }\n }\n }\n";
|
|
2
|
+
//# sourceMappingURL=getCustomerAddress.graphql.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ADDRESS = "\nfragment AddressesList on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n}";
|
|
2
|
+
//# sourceMappingURL=customerAddressFragment.graphql.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ORDER_SUMMARY = "\nfragment OrderSummary on OrderTotal {\n __typename\n grand_total {\n value\n currency\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n}";
|
|
2
|
+
//# sourceMappingURL=orderSummaryFragment.graphql.d.ts.map
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './initialize';
|
|
2
|
+
export * from './fetch-graphql';
|
|
3
|
+
export * from './getAttributesForm';
|
|
4
|
+
export * from './createCustomerAddress';
|
|
5
|
+
export * from './getCustomerAddress';
|
|
6
|
+
export * from './getCountries';
|
|
7
|
+
export * from './getRegions';
|
|
8
|
+
export * from './updateCustomerAddress';
|
|
9
|
+
export * from './getCustomer';
|
|
10
|
+
export * from './removeCustomerAddress';
|
|
11
|
+
export * from './getOrderHistoryList';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
|
|
4
|
+
type ConfigProps = {
|
|
5
|
+
langDefinitions?: Lang;
|
|
6
|
+
authHeaderConfig?: {
|
|
7
|
+
header?: string;
|
|
8
|
+
tokenPrefix?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const initialize: Initializer<ConfigProps>;
|
|
12
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomerAddressesModel } from '../../data/models';
|
|
2
|
+
|
|
3
|
+
type ExtendedAddressFormProps = CustomerAddressesModel & {
|
|
4
|
+
addressId: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const updateCustomerAddress: (forms: ExtendedAddressFormProps) => Promise<string>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=updateCustomerAddress.d.ts.map
|
package/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api/index'
|
package/api.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{Initializer as c}from"@dropins/tools/lib.js";import{f as n,h as d,a as u}from"./chunks/removeCustomerAddress.js";import{e as T,d as x,g as y,j as Q,i as k,k as w,l as z,r as O,s as R,b,c as v,u as M}from"./chunks/removeCustomerAddress.js";import{g as U}from"./chunks/getOrderHistoryList.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";const s=new c({init:async t=>{const a={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};s.config.setConfig({...a,...t})},listeners:()=>[]}),G=s.config,f=t=>{var a,r,e,i,o,m;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((i=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:i.firstname)||"",lastname:((m=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:m.lastname)||""}},h=`
|
|
2
|
+
query GET_CUSTOMER {
|
|
3
|
+
customer {
|
|
4
|
+
firstname
|
|
5
|
+
lastname
|
|
6
|
+
email
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,A=async()=>await n(h,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?d(t.errors):f(t)}).catch(u);export{G as config,T as createCustomerAddress,n as fetchGraphQl,x as getAttributesForm,y as getConfig,Q as getCountries,A as getCustomer,k as getCustomerAddress,U as getOrderHistoryList,w as getRegions,s as initialize,z as removeCustomerAddress,O as removeFetchGraphQlHeader,R as setEndpoint,b as setFetchGraphQlHeader,v as setFetchGraphQlHeaders,M as updateCustomerAddress};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as d,Fragment as ae,jsxs as U}from"@dropins/tools/preact-jsx-runtime.js";import{classes as J,Slot as be}from"@dropins/tools/lib.js";import{Field as ie,Picker as ze,Input as ke,InputDate as Ue,Checkbox as we,TextArea as qe,Card as he,Skeleton as Fe,SkeletonRow as W,Button as de,Tag as pe,Icon as Ie,Modal as Pe,ProgressSpinner as We,IllustratedMessage as je,Header as Ge,InLineAlert as Ke}from"@dropins/tools/components.js";import{useRef as Je,useState as Z,useEffect as Q,useCallback as z,useMemo as Xe}from"@dropins/tools/preact-hooks.js";import{m as De,u as ge,d as Oe,i as Ye,n as Qe,l as e1,j as t1,k as r1,e as s1}from"./removeCustomerAddress.js";import{useText as te}from"@dropins/tools/i18n.js";import*as K from"@dropins/tools/preact-compat.js";import{memo as ve,useCallback as se,forwardRef as n1,useImperativeHandle as a1,useMemo as Ce}from"@dropins/tools/preact-compat.js";import{Fragment as Ee}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({formName:e,showFormLoader:s,showSaveCheckBox:n,saveCheckBoxValue:t,forwardFormRef:a,slots:o,addressesFormTitle:i,className:l,addressFormId:c,inputsDefaultValueSet:f,billingCheckBoxValue:L,shippingCheckBoxValue:A,showBillingCheckBox:v,showShippingCheckBox:x,isOpen:r,onSubmit:g,onCloseBtnClick:h,onSuccess:$,onError:T,onChange:E})=>d("div",{className:J(["dropin-address-form"]),children:d(q1,{formName:e,showFormLoader:s,slots:o,addressesFormTitle:i,className:l,addressFormId:c,inputsDefaultValueSet:f,shippingCheckBoxValue:A,billingCheckBoxValue:L,showShippingCheckBox:x,showBillingCheckBox:v,isOpen:r,onSubmit:g,onCloseBtnClick:h,onSuccess:$,onError:T,onChange:E,forwardFormRef:a,showSaveCheckBox:n,saveCheckBoxValue:t})}),d1=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),o1=e=>/^\d+$/.test(e),i1=e=>/^[a-zA-Z0-9\s]+$/.test(e),l1=e=>/^[a-zA-Z0-9]+$/.test(e),c1=e=>/^[a-zA-Z]+$/.test(e),u1=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),p1=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),f1=(e,s,n)=>{const t=new Date(e).getTime()/1e3;return isNaN(t)||t<0?!1:t>=s&&t<=n},_e=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],m1=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),h1=(e,s,n)=>{const t=e.length;return t>=s&&t<=n},Ae=(e,s,n,t)=>{var B,V;const{requiredFieldError:a,lengthTextError:o,numericError:i,alphaNumWithSpacesError:l,alphaNumericError:c,alphaError:f,emailError:L,dateError:A,urlError:v,dateLengthError:x}=n,r=s==null?void 0:s.customUpperCode,g={[r]:""};if(t[r]&&delete t[r],s!=null&&s.required&&!e)return{[r]:a};if(!(s!=null&&s.required)&&!e||!((B=s==null?void 0:s.validateRules)!=null&&B.length))return g;const h=d1(s==null?void 0:s.validateRules),$=h.MIN_TEXT_LENGTH??1,T=h.MAX_TEXT_LENGTH??255,E=h.DATE_RANGE_MIN,F=h.DATE_RANGE_MAX;if(!h1(e,+$,+T)&&!(E||F))return{[r]:o.replace("{min}",$).replace("{max}",T)};if(!f1(e,+E,+F)&&(E||F))return{[r]:x.replace("{min}",_e(E)).replace("{max}",_e(F))};const I={numeric:{validate:o1,error:i},"alphanum-with-spaces":{validate:i1,error:l},alphanumeric:{validate:l1,error:c},alpha:{validate:c1,error:f},email:{validate:u1,error:L},date:{validate:p1,error:A},url:{validate:m1,error:v}}[h.INPUT_VALIDATION];return I&&!I.validate(e)&&!((V=t[r])!=null&&V.length)?{[r]:I.error}:g},Se=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},A1=["true","false","yes","on","off"],L1={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:""},g1=e=>{const s={},n={};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t],o=t.match(/^(.*)Multiline_(\d+)$/);if(o){const i=o[1],l=parseInt(o[2],10);n[i]||(n[i]=[]),n[i].push({index:l,value:a})}else Object.keys(e).filter(l=>l.startsWith(`${t}Multiline_`)).length>0?n[t]=[{index:1,value:a}]:s[t]=a}for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)){const a=n[t];a.sort((o,i)=>o.index-i.index),s[t]=a.map(o=>o.value)}return s},C1=e=>{const s={},n={};for(const t in e){const a=A1.includes(e[t])?Se(e[t]):e[t];Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(L1,t)?s[t]=a:n[t]=a)}return{...s,customAttributes:n}},ne=(e,s=!1)=>{const n=De(e,"camelCase",{firstname:"firstName",lastname:"lastName"}),t=C1(g1(n));if(!s)return t;const[a,o]=t.region?t.region.split(","):[];return{...t,region:{regionCode:a,...o&&{regionId:+o}}}},me=e=>{if(!e.current)return{};const s=e.current.elements;return Array.from(s).reduce((t,a)=>(a.name&&(t[a.name]=a.type==="checkbox"?a.checked:a.value),t),{})},Le=(e,s)=>Object.keys(e).every(t=>t in s&&s[t]!==""),xe=e=>typeof e=="function",y1=e=>e.reduce((s,{customUpperCode:n,required:t,defaultValue:a})=>(t&&n&&(s.initialData[n]=a||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),Ne=e=>Object.keys(e).length>0,M1=["countryCode"],b1=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:t,formName:a})=>{const o=te({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),i=Je(null),[l,c]=Z({}),[f,L]=Z({}),[A,v]=Z({}),[x,r]=Z(!0),[g,h]=Z(!1),[$,T]=Z(!1),[E,F]=Z(!0);Q(()=>{const u=()=>{if(i.current){const y=window.getComputedStyle(i.current).getPropertyValue("grid-template-rows").split(" ").length,w=i.current.querySelector(".dropin-address-form--saveAddressBook");w&&(w.style.gridRow=String(y-1))}};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[e.length]);const N=z((u=!1)=>{let p=!0;const y={...f};let w=null;for(const[O,S]of Object.entries(l)){const m=e.find(M=>M.customUpperCode.includes(O)),R=Ae(S.toString(),m,o,y);R[O]&&(Object.assign(y,R),p=!1),w||(w=Object.keys(y).find(M=>y[M])||null)}if(u||L(y),w&&i.current&&!u){const O=i.current.elements.namedItem(w);O==null||O.focus()}return p},[f,e,l,o]),I=z((u,p,y,w,O)=>{const S={...me(i),[p]:u,...p.includes("countryCode")?{region:""}:{}},m={data:ne(S,!0),isDataValid:O??Le(y,S)};N(!0),["selectedShippingAddress","selectedBillingAddress"].includes(a)&&sessionStorage.setItem(`${a}_addressData`,JSON.stringify(m)),n==null||n(m,{},w)},[N,a,n]);Q(()=>{if(e!=null&&e.length){const{initialData:u,errorList:p}=y1(e);c(y=>({...u,...y})),L(p),v(p)}},[JSON.stringify(e)]),Q(()=>{if($)return;const u=me(i),p=sessionStorage.getItem(`${a}_addressData`);if(Ne(l)&&Ne(A)){let y={};const w=Le(A,l);p?y=JSON.parse(p).data:y=ne(u,!0)??{},n==null||n({data:y,isDataValid:w},{},null),T(!0)}},[l,A]),Q(()=>{var m,R;if(!E)return;const u=me(i),p=e.find(M=>(M==null?void 0:M.code)==="region"),y=p==null?void 0:p.required,w=!!(u!=null&&u.countryCode),O=!!((m=u==null?void 0:u.region)!=null&&m.length);if(w&&!O&&xe(n)){const M=p&&((R=p==null?void 0:p.options)==null?void 0:R.length)>0;if(!x&&M&&!g)y&&I(u==null?void 0:u.region,"region",A,null,O);else if(!M&&!y){const H=Le(A,l);I(u==null?void 0:u.region,"region",A,null,H),r(!1)}}},[E,x,e,i,n,I,A,g]);const B=z(u=>{const{name:p,value:y,type:w,checked:O}=u==null?void 0:u.target,S=w==="checkbox"?O:y;c(M=>{const H={...M,[p]:S};return p==="countryCode"&&(H.region="",r(!0),h(!1)),H}),t==null||t({[p]:S}),T(!0);const m=e==null?void 0:e.find(M=>M.customUpperCode.includes(p));let R={...f};if(m){const M=Ae(S.toString(),m,o,R);M&&Object.assign(R,M),L(R)}M1.includes(p)||I(S,p,A,u),p==="region"&&I(S,p,A,u,!0)},[t,e,f,o,I,A]),V=z(u=>{const{name:p}=u==null?void 0:u.target,y=e.find(w=>w.customUpperCode===p);p==="region"&&(y!=null&&y.options.length)&&F(!1),F(p==="countryCode")},[]),b=z(u=>{const{name:p,value:y,type:w,checked:O}=u==null?void 0:u.target,S=w==="checkbox"?O:y,m=e.find(R=>R.customUpperCode===p);if(m){const R={...f},M=Ae(S.toString(),m,o,R);M&&Object.assign(R,M),L(R)}},[f,e,o]),k=z(u=>{u.preventDefault();const p=N();s==null||s(u,p)},[N,s]);return{formData:l,errors:f,formRef:i,handleInputChange:B,onFocus:V,handleBlur:b,handleSubmit:k,handleValidationSubmit:N}};var ee=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(ee||{});const v1=ve(({loading:e,values:s,fields:n=[],errors:t,className:a="",onChange:o,onBlur:i,onFocus:l})=>{const c=`${a}__field`,f=se((r,g,h)=>{var T;const $=(T=r.options.find(E=>E.isDefault))==null?void 0:T.value;return d(ie,{error:h,className:J([c,`${c}--${r.id}`,[`${c}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${a}--${r.id}`,disabled:e||r.disabled,children:d(ze,{name:r.customUpperCode,floatingLabel:`${r.label} ${r.required?"*":""}`,placeholder:r.label,"aria-label":r.label,options:r.options,onBlur:i,onFocus:l,handleSelect:o,value:$||g||r.defaultValue})},r.id)},[a,e,c,i,o,l]),L=se((r,g,h)=>d(ie,{error:h,className:J([c,`${c}--${r.id}`,[`${c}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${a}--${r.id}`,disabled:e,children:d(ke,{type:"text",name:r.customUpperCode,value:g??r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,onBlur:i,onFocus:l,onChange:o})},r.id),[a,e,c,i,o,l]),A=se((r,g,h)=>d(ie,{error:h,className:J([c,`${c}--${r.id}`,[`${c}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${a}--${r.id}`,disabled:e,children:d(Ue,{type:"text",name:r.customUpperCode,value:g||r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,onBlur:i,onChange:o})},r.id),[a,e,c,i,o]),v=se((r,g,h)=>d(ie,{error:h,className:J([c,`${c}--${r.id}`,[`${c}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${a}--${r.id}`,disabled:e,children:d(we,{name:r.customUpperCode,checked:g||r.defaultValue,placeholder:r.label,label:`${r.label} ${r.required?"*":""}`,onBlur:i,onChange:o})},r.id),[a,e,c,i,o]),x=se((r,g,h)=>d(ie,{error:h,className:J([c,`${c}--${r.id}`,[`${c}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${a}--${r.id}`,disabled:e,children:d(qe,{type:"text",name:r.customUpperCode,value:g??r.defaultValue,label:`${r.label} ${r.required?"*":""}`,onBlur:i,onChange:o})},r.id),[a,e,c,i,o]);return n.length?d(ae,{children:n.map(r=>{const g=t==null?void 0:t[r.customUpperCode],h=s==null?void 0:s[r.customUpperCode];switch(r.fieldType){case ee.TEXT:return r.options.length?f(r,h,g):L(r,h,g);case ee.MULTILINE:return L(r,h,g);case ee.SELECT:return f(r,h,g);case ee.DATE:return A(r,h,g);case ee.BOOLEAN:return v(r,h,g);case ee.TEXTAREA:return x(r,h,g);default:return null}})}):null}),Re=({testId:e,withCard:s=!0})=>{const n=U(Fe,{"data-testid":e||"skeletonLoader",children:[d(W,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),d(W,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),d(W,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:d(he,{variant:"secondary",className:J(["dropin-account-loaders","dropin-account-loaders--card-loader"]),children:n})},E1=()=>U(Fe,{"data-testid":"addressFormLoader",children:[d(W,{variant:"heading",size:"medium"}),d(W,{variant:"empty",size:"medium"}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large",fullWidth:!0}),d(W,{size:"large",fullWidth:!0,lines:3}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large"}),d(W,{size:"large",fullWidth:!0})]}),_1=ve(n1(({setInputChange:e,showFormLoader:s,slots:n,name:t,loading:a,children:o,className:i="defaultForm",fieldsConfig:l,onSubmit:c,onChange:f,forwardFormRef:L,regionOptions:A,showSaveCheckBox:v,handleSaveCheckBoxAddress:x,saveCheckBoxAddress:r})=>{const g=te({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{formData:h,errors:$,formRef:T,handleInputChange:E,handleBlur:F,handleSubmit:N,handleValidationSubmit:I,onFocus:B}=b1({fieldsConfig:l,onSubmit:c,onChange:f,setInputChange:e,regionOptions:A,formName:t});return a1(L,()=>{const V=me(T);return{handleValidationSubmit:I,formData:ne(V,!0)}}),s||!(l!=null&&l.length)?d(E1,{}):U("form",{className:J(["dropin-form",i]),onSubmit:N,name:t,ref:T,children:[d(v1,{className:i,loading:a,fields:l,onChange:E,onBlur:F,errors:$,values:h,onFocus:B}),n!=null&&n.AddressFormInputs?d(be,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:n.AddressFormInputs,context:{formActions:{handleChange:E}}}):null,v?d("div",{className:"dropin-address-form--saveAddressBook",children:d(we,{name:"saveAddressBook",label:g.saveAddressBook,checked:r,onChange:V=>{E(V),x(V)}})}):null,o]})})),ye=({slots:e,selectable:s,selectShipping:n,selectBilling:t,variant:a="secondary",minifiedView:o,keysSortOrder:i,addressData:l,loading:c,setAddressId:f,handleRenderModal:L,handleRenderForm:A})=>{const v=o?"minifiedView":"fullSizeView",x=te({actionRemove:`Account.${v}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${v}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${v}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${v}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${v}.Addresses.addressCard.defaultLabelText`}),r=x.cardLabelBilling.toLocaleUpperCase(),g=x.cardLabelShipping.toLocaleUpperCase(),h=x.defaultLabelText.toLocaleUpperCase(),$=Ce(()=>{const b={shippingLabel:g,billingLabel:r,hideShipping:!1,hideBilling:!1};return s?n&&!t?{shippingLabel:h,billingLabel:h,hideShipping:!1,hideBilling:!0}:t&&!n?{shippingLabel:h,billingLabel:h,hideShipping:!0,hideBilling:!1}:b:b},[r,h,g,t,n,s]),T=se(()=>{f==null||f(l==null?void 0:l.id),L==null||L()},[L,l==null?void 0:l.id,f]),E=se(()=>{f==null||f(l==null?void 0:l.id),A==null||A()},[A,l==null?void 0:l.id,f]),F=Ce(()=>{if(!i)return[];const{region:b,...k}=l,u={...k,...b};return i.filter(({name:p})=>u[p]).map(p=>({name:p.name,orderNumber:p.orderNumber,value:u[p.name],label:p.label}))},[l,i]),{shippingLabel:N,billingLabel:I,hideShipping:B,hideBilling:V}=$;return d(he,{variant:a,className:"dropin-address-card","data-testid":"addressCard",children:c?d(Re,{}):U(ae,{children:[U("div",{className:"dropin-address-card__action",children:[L?d(de,{type:"button",variant:"tertiary",onClick:T,"data-testid":"removeButton",children:x.actionRemove}):null,A?d(de,{type:"button",variant:"tertiary",onClick:E,className:"dropin-address-card__action--editbutton","data-testid":"editButton",children:x.actionEdit}):null]}),d("div",{className:"dropin-address-card__description",children:e!=null&&e.AddressCard?d(be,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:F}}):d(ae,{children:F.map((b,k)=>{const u=b.label?`${b.label}: ${b==null?void 0:b.value}`:b==null?void 0:b.value;return d("p",{"data-testid":`${b.name}_${k}`,children:u},k)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?U("div",{className:"dropin-address-card__labels",children:[l!=null&&l.defaultShipping?d(pe,{label:g}):null,l!=null&&l.defaultBilling?d(pe,{label:r}):null]}):null,s?U("div",{className:"dropin-address-card__labels",children:[!B&&(l!=null&&l.defaultShipping)?d(pe,{label:N}):null,!V&&(l!=null&&l.defaultBilling)?d(pe,{label:I}):null]}):null]})})},N1=e=>K.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},K.createElement("g",{id:"Large"},K.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),K.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},K.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),K.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),T1=e=>K.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},K.createElement("g",{id:"Large"},K.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),K.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},K.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),Z1=e=>K.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},K.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"#3D3D3D"})),$1=e=>K.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},K.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),Te=({selectable:e,className:s,addNewAddress:n,minifiedView:t,routeAddressesPage:a})=>{const o=t?"minifiedView":"fullSizeView",i=te({viewAllAddressesButton:`Account.${o}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${o}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${o}.Addresses.differentAddressButton`}),l=t&&!n?i.viewAllAddressesButton:i.addNewAddressButton,c=e?i.differentAddressButton:l;return U("button",{type:"button",className:J(["dropin-actions-address",["dropin-actions-address--viewall",t],["dropin-actions-address--address",!t],s]),"data-testid":"showRouteFullAddress",onClick:a,children:[d("span",{className:"dropin-actions-address--title","data-testid":"addressActionsText",children:c}),d(Ie,{source:t&&!n?T1:N1,size:"32"})]})},w1=({minifiedView:e,keysSortOrder:s,addressData:n,open:t,submitLoading:a,onRemoveAddress:o,closeModal:i})=>{const l=e?"minifiedView":"fullSizeView",c=te({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return t?U(Pe,{title:d("h3",{children:c.title}),className:"dropin-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:i,children:[a?d("div",{className:"dropin-address-modal__spinner","data-testid":"progressSpinner",children:d(We,{stroke:"4",size:"large"})}):null,d("p",{children:c.description}),d(ye,{minifiedView:e,addressData:n,keysSortOrder:s}),U("div",{className:"dropin-address-modal__wrapper--buttons",children:[d(de,{type:"button",onClick:i,variant:"secondary",disabled:a,children:c.actionCancel}),d(de,{disabled:a,onClick:o,children:c.actionConfirm})]})]}):null},F1=({typeList:e,isEmpty:s,minifiedView:n,className:t})=>{const a=n?"minifiedView":"fullSizeView",o=te({addressesMessage:`Account.${a}.EmptyList.Addresses.message`,ordersListMessage:`Account.${a}.EmptyList.OrdersList.message`}),i=Ce(()=>{switch(e){case"address":return{icon:Z1,text:d("p",{children:o.addressesMessage})};case"orders":return{icon:$1,text:d("p",{children:o.ordersListMessage})};default:return{icon:"",text:""}}},[e,o]);return!s||!e||!i.text?null:d(je,{className:J(["dropin-empty-list",n?"dropin-empty-list--minified":"",t]),message:i.text,icon:d(Ie,{source:i.icon}),"data-testid":"emptyList"})},I1=async(e,s)=>{if(s.length===1){const i=s[0],c=Object.values(i.region).every(L=>!!L)?{}:{region:{...i.region,regionId:0}};return!!await ge({addressId:Number(i==null?void 0:i.id),defaultShipping:!1,defaultBilling:!1,...c})}const n=s.filter(i=>i.id!==e&&(i.defaultBilling||i.defaultShipping)||i.id!==e),t=s[s.length-1],a=n[0]||((t==null?void 0:t.id)!==e?t:null);return!a||!a.id?!1:!!await ge({addressId:+a.id,defaultShipping:!0,defaultBilling:!0})},O1=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing"],He=(e,s,n)=>{if(s&&n||!s&&!n)return e;const t=e.slice();return s?t.sort((a,o)=>Number(o.defaultShipping)-Number(a.defaultShipping)):n?t.sort((a,o)=>Number(o.defaultBilling)-Number(a.defaultBilling)):e},Me=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(Me),S1=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:t,minifiedView:a,routeAddressesPage:o,onSuccess:i})=>{const[l,c]=Z(""),[f,L]=Z(!1),[A,v]=Z(!1),[x,r]=Z(!1),[g,h]=Z(!1),[$,T]=Z(!1),[E,F]=Z(""),[N,I]=Z([]),[B,V]=Z([]),b=z(async()=>{r(!0),Promise.all([Oe("shortRequest"),Ye()]).then(M=>{const[H,j]=M;if(H){const X=H.map(({name:D,orderNumber:oe,label:re})=>({name:Qe(D),orderNumber:oe,label:O1.includes(D)?null:re}));V(X)}if(j)if(a){const X=j.filter(D=>!!D.defaultShipping||!!D.defaultBilling);I(X)}else I(j)}).finally(()=>{r(!1)})},[a]);Q(()=>{b()},[b]),Q(()=>{var M;if(N.length)if(n===0)T(!0),c("0");else{const H=N.find(X=>+X.id===n)||He(N,e,s)[0],j={data:ne(H),isDataValid:!Me(H)};c(n.toString()||((M=H==null?void 0:H.id)==null?void 0:M.toString())),t==null||t(j)}},[N,n,t,s,e]);const k=z(M=>{F(M),T(!1)},[]),u=z((M,H)=>{const j=(M==null?void 0:M.target).value;c(j);const X={data:ne(H),isDataValid:!Me(ne(H))};t==null||t(X),j!=="0"&&T(!1)},[t]),p=z(()=>{v(!0)},[]),y=z(()=>{F(""),v(!1),L(!1)},[]),w=z(()=>{L(!0)},[]),O=z(async()=>{h(!0),await I1(E,N),e1(+E).then(()=>{b(),y()}).finally(()=>{h(!1)})},[N,E,y,b]),S=z(()=>{T(!1)},[]),m=z(()=>{xe(o)&&a&&!$?window.location.href=o():(T(!0),F(""))},[$,o,a]),R=z(async()=>{await b(),await(i==null?void 0:i())},[b,i]);return{keysSortOrder:B,submitLoading:g,isModalRendered:f,isFormRendered:A,loading:x,addNewAddress:$,addressesList:N,addressId:E,handleRenderForm:p,handleRenderModal:w,removeAddress:O,onCloseBtnClick:y,setEditingAddressId:k,closeNewAddressForm:S,redirectToAddressesRoute:m,handleOnSuccess:R,handleSelectAddressOption:u,selectedAddressOption:l}},Q1=ve(({slots:e,title:s="",addressFormTitle:n="",defaultSelectAddressId:t="",showFormLoader:a=!1,onAddressData:o,forwardFormRef:i,className:l,showSaveCheckBox:c=!1,saveCheckBoxValue:f=!1,selectShipping:L=!1,selectBilling:A=!1,selectable:v=!1,withHeader:x=!0,minifiedView:r=!1,withActionsInMinifiedView:g=!1,withActionsInFullSizeView:h=!0,inputsDefaultValueSet:$,showShippingCheckBox:T=!0,showBillingCheckBox:E=!0,shippingCheckBoxValue:F=!0,billingCheckBoxValue:N=!0,routeAddressesPage:I,onSuccess:B,onError:V})=>{var P;const b=r?"minifiedView":"fullSizeView",k=te({containerTitle:`Account.${b}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${b}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${b}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${b}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${b}.Addresses.newAddressFormTitle`}),{keysSortOrder:u,submitLoading:p,isModalRendered:y,isFormRendered:w,loading:O,addNewAddress:S,addressesList:m,addressId:R,handleRenderForm:M,handleRenderModal:H,removeAddress:j,onCloseBtnClick:X,handleOnSuccess:D,setEditingAddressId:oe,closeNewAddressForm:re,redirectToAddressesRoute:le,handleSelectAddressOption:ce,selectedAddressOption:ue}=S1({defaultSelectAddressId:t,minifiedView:r,routeAddressesPage:I,onSuccess:B,onAddressData:o,selectShipping:L,selectBilling:A}),C=L&&A?"selectedAddress":L?"selectedShippingAddress":A?"selectedBillingAddress":"default",q=v?U("div",{className:"dropin-addresses-wrapper--select-view",children:[(P=He(m,L,A))==null?void 0:P.map((_,G)=>U(Ee,{children:[d("input",{"data-testid":`radio-${G+1}`,type:"radio",name:C,id:`${C}_${_.id}`,value:_.id,checked:ue===(_==null?void 0:_.id.toString()),onChange:Y=>ce(Y,_)}),d("label",{htmlFor:`${C}_${_.id}`,className:"dropin-addresses-wrapper--label",children:d(ye,{slots:e,selectable:v,selectShipping:L,selectBilling:A,minifiedView:r,addressData:_,keysSortOrder:u,loading:O})})]},_.id)),d("input",{"data-testid":"radio-0",type:"radio",name:C,id:`${C}_addressActions`,value:"0",checked:ue==="0",onChange:_=>ce(_,{})}),d("label",{htmlFor:`${C}_addressActions`,className:"dropin-addresses-wrapper--label",children:S?d("div",{className:J(["dropin-addresses-form__footer__wrapper",["dropin-addresses-form__footer__wrapper-show",S]]),children:d(fe,{formName:C,showFormLoader:a,isOpen:S,forwardFormRef:i,showSaveCheckBox:c,saveCheckBoxValue:f,shippingCheckBoxValue:F,billingCheckBoxValue:N,addressesFormTitle:n||k.differentAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:T,showBillingCheckBox:E,onCloseBtnClick:re,onSuccess:D,onError:V,onChange:o})}):m!=null&&m.length?d(Te,{selectable:v,minifiedView:r,addNewAddress:S,routeAddressesPage:le}):null})]}):U(ae,{children:[m.map(_=>d(Ee,{children:R===_.id&&w?d(he,{variant:"secondary",style:{marginBottom:20},children:d(fe,{isOpen:R===_.id&&w,addressFormId:R,inputsDefaultValueSet:_,addressesFormTitle:k.editAddressFormTitle,showShippingCheckBox:T,showBillingCheckBox:E,shippingCheckBoxValue:F,billingCheckBoxValue:N,onCloseBtnClick:X,onSuccess:D,onError:V})}):d(ye,{slots:e,minifiedView:r,addressData:_,keysSortOrder:u,loading:O,setAddressId:oe,handleRenderModal:r&&g||!r&&h?H:void 0,handleRenderForm:r&&g||!r&&h?M:void 0},_.id)},_.id)),d("div",{className:"dropin-addresses__footer",children:S?d("div",{className:J(["dropin-addresses-form__footer__wrapper",["dropin-addresses-form__footer__wrapper-show",S]]),children:d(he,{variant:"secondary",children:d(fe,{isOpen:S,addressesFormTitle:k.newAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:!!(m!=null&&m.length),showBillingCheckBox:!!(m!=null&&m.length),shippingCheckBoxValue:F,billingCheckBoxValue:N,onCloseBtnClick:re,onSuccess:D,onError:V})})}):d(Te,{minifiedView:r,addNewAddress:S,routeAddressesPage:le})})]});return U("div",{children:[d("div",{children:x?d(Ge,{title:s||k.containerTitle,divider:!r,className:r?"dropin-addresses-header":""}):null}),U("div",{className:J(["dropin-addresses-wrapper",l]),"data-testid":"addressesIdWrapper",children:[d(w1,{minifiedView:r,addressData:m==null?void 0:m.find(_=>_.id===R),keysSortOrder:u,submitLoading:p,open:y,closeModal:X,onRemoveAddress:j}),O?d(Re,{testId:"addressSkeletonLoader",withCard:!1}):v?d("div",{className:J(["dropin-addresses-form__footer__wrapper",["dropin-addresses-form__footer__wrapper-show",!(m!=null&&m.length)]]),children:d(fe,{formName:C,isOpen:!(m!=null&&m.length),forwardFormRef:i,showSaveCheckBox:c,saveCheckBoxValue:f,shippingCheckBoxValue:F,billingCheckBoxValue:N,addressesFormTitle:n||k.differentAddressFormTitle,inputsDefaultValueSet:$,showShippingCheckBox:T,showBillingCheckBox:E,onCloseBtnClick:re,onSuccess:D,onError:V,onChange:o})}):d(F1,{isEmpty:!(m!=null&&m.length),typeList:"address",minifiedView:r}),q]})]})}),Ve={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:ee.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},x1={...Ve,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},R1={...Ve,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},H1=(e,s)=>s==null?void 0:s.map(n=>{const t={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName},a=JSON.parse(JSON.stringify(n));if(Object.hasOwn(t,n.customUpperCode)){const o=t[n.customUpperCode];n.customUpperCode==="region"&&typeof o=="object"?a.defaultValue=o.regionCode&&o.regionId?`${o.regionCode},${o.regionId}`:o.region??o.regionCode:a.defaultValue=o}return a}),Ze=e=>{if(!e)return null;const s=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(t=>{s.has(t.name)||s.set(t.name,"false"),t.checked&&s.set(t.name,"true")}),s&&typeof s.entries=="function"){const t=s.entries();if(t&&typeof t[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(t)))||{}}return{}},V1=({fields:e,addressId:s,countryOptions:n,disableField:t,regionOptions:a,isRequiredRegion:o,isRequiredPostCode:i})=>e.filter(c=>!(s&&(c.customUpperCode==="defaultShipping"||c.customUpperCode==="defaultBilling")&&c.defaultValue)).map(c=>c.customUpperCode==="countryCode"?{...c,options:n,disabled:t}:c.customUpperCode==="postcode"?{...c,required:i}:c.customUpperCode==="region"?{...c,options:a,required:o,disabled:t}:c),B1=e=>{const s=["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"],n={},t=[];return Object.keys(e).forEach(a=>{s.includes(a)?n[a]=e[a]:t.push({attribute_code:a,value:e[a]})}),t.length>0&&(n.custom_attributesV2=t),n},$e=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],t=[],a={};for(const r in e){const g=e[r];n.includes(g)&&(a[r]=Se(g)),s.includes(r)&&t.push(g)}const{street:o,streetMultiline_2:i,streetMultiline_1:l,region:c,...f}=e,[L,A]=c?c.split(","):[void 0,void 0],v=A&&L?{regionId:+A,regionCode:L}:{region:L};return B1({...f,...a,region:{...v},street:t})},z1=(e,s)=>{const n={};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];if(t==="region"&&a.regionId){const o=s.find(i=>(i==null?void 0:i.id)===a.regionId);o?n[t]={...a,text:o.text}:n[t]=a}else Array.isArray(a)?(n[t]=a[0]||"",a.slice(1).forEach((o,i)=>{n[`${t}Multiline_${i+2}`]=o})):n[t]=a}return n},k1=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},U1=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:t,billingCheckBoxValue:a,shippingCheckBoxValue:o,showShippingCheckBox:i,showBillingCheckBox:l,inputsDefaultValueSet:c,onCloseBtnClick:f,onSuccess:L,onError:A,formName:v})=>{const[x,r]=Z({text:"",type:"success"}),[g,h]=Z(e??!1),[$,T]=Z(t||""),[E,F]=Z([]),[N,I]=Z([]),[B,V]=Z([]),[b,k]=Z([]),[u,p]=Z([]),[y,w]=Z(!1),[O,S]=Z(!1),[m,R]=Z(()=>{var q,P;const C=sessionStorage.getItem(`${v}_addressData`);return C?{countryCode:(P=(q=JSON.parse(C))==null?void 0:q.data)==null?void 0:P.countryCode}:c}),[M,H]=Z(!1),[j,X]=Z(()=>{var P,_;const C=sessionStorage.getItem(`${v}_addressData`);return C?(_=(P=JSON.parse(C))==null?void 0:P.data)==null?void 0:_.saveAddressBook:n}),D=z(C=>{X(C.target.checked)},[]);Q(()=>{Oe($?"customer_address_edit":"customer_register_address").then(C=>{F(C)})},[$]),Q(()=>{H(!0),t1().then(({availableCountries:C,countriesWithRequiredRegion:q,optionalZipCountries:P})=>{I(C),k(q),p(P),H(!1)})},[]),Q(()=>{if(m!=null&&m.countryCode){H(!0);const C=m==null?void 0:m.countryCode;r1(C).then(q=>{V(q);const P=b.find(G=>G===C),_=u.find(G=>G===C);w(!!P),S(!_),H(!1)})}},[m==null?void 0:m.countryCode,b,u]);const oe=z(()=>{r({text:"",type:"success"}),f==null||f()},[f]),re=z(async(C,q)=>{if(!q)return null;h(!0);const P=Ze(C.target),_=$e(P);await ge(_).then(()=>{var G;L==null||L(),f==null||f(),(G=C==null?void 0:C.target)==null||G.reset()}).catch(G=>{r(Y=>({...Y,text:G.message,type:"error"})),A==null||A(G)}).finally(()=>{T(""),h(!1)})},[f,A,L]),le=z(async(C,q)=>{if(!q)return;h(!0);const{saveAddressBook:P,..._}=Ze(C.target),G=$e(_);await s1(G).then(()=>{var Y;L==null||L(),f==null||f(),(Y=C==null?void 0:C.target)==null||Y.reset()}).catch(Y=>{r(Be=>({...Be,text:Y.message,type:"error"})),A==null||A(Y)}).finally(()=>{T(""),h(!1)})},[f,A,L]),ce=Xe(()=>{if(!E.length)return[];const C={...x1,defaultValue:o,isHidden:s&&!j?!0:!i},q={...R1,defaultValue:a,isHidden:s&&!j?!0:!l},P=[...E,C,q],_=sessionStorage.getItem(`${v}_addressData`),G=_?z1(JSON.parse(_).data,B):{},Y=H1(k1(G,c),P);return V1({fields:Y,addressId:$,countryOptions:N,disableField:M,regionOptions:B,isRequiredRegion:y,isRequiredPostCode:O})},[E,o,s,j,i,a,l,v,B,c,$,N,M,y,O]),ue=z(C=>{R(q=>({...q,...C}))},[]);return{regionOptions:B,saveCheckBoxAddress:j,inLineAlert:x,addressId:$,submitLoading:g,normalizeFieldsConfig:ce,handleSaveCheckBoxAddress:D,handleUpdateAddress:re,handleCreateAddress:le,handleOnCloseForm:oe,handleInputChange:ue}},q1=({formName:e="",showFormLoader:s=!1,showSaveCheckBox:n=!1,saveCheckBoxValue:t=!1,forwardFormRef:a,slots:o,addressesFormTitle:i,className:l,addressFormId:c,inputsDefaultValueSet:f,showShippingCheckBox:L=!0,showBillingCheckBox:A=!0,shippingCheckBoxValue:v=!0,billingCheckBoxValue:x=!0,isOpen:r,onSubmit:g,onCloseBtnClick:h,onSuccess:$,onError:T,onChange:E})=>{const F=te({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{inLineAlert:N,addressId:I,submitLoading:B,normalizeFieldsConfig:V,handleUpdateAddress:b,handleCreateAddress:k,handleOnCloseForm:u,handleSaveCheckBoxAddress:p,saveCheckBoxAddress:y,handleInputChange:w,regionOptions:O}=U1({showFormLoader:s,addressFormId:c,inputsDefaultValueSet:f,shippingCheckBoxValue:v,billingCheckBoxValue:x,showShippingCheckBox:L,showBillingCheckBox:A,saveCheckBoxValue:t,showSaveCheckBox:n,onSuccess:$,onError:T,onCloseBtnClick:h,formName:e});return r?U("div",{className:J(["dropin-address-form-wrapper",l]),children:[d("div",{className:"dropin-address-form-wrapper--title","data-testid":"addressesFormTitle",children:i}),N.text?d(Ke,{"data-testid":"inLineAlert",className:"dropin-address-form-wrapper--notification",type:N.type,variant:"secondary",heading:N.text,icon:N.icon}):null,U(_1,{regionOptions:O,forwardFormRef:a,slots:o,className:"dropin-address-form",name:e||"addressesForm",fieldsConfig:V,onSubmit:g||(I?b:k),setInputChange:w,loading:B,showFormLoader:s,showSaveCheckBox:n,handleSaveCheckBoxAddress:p,saveCheckBoxAddress:y,onChange:E,children:[I?d("input",{type:"hidden",name:"addressId",value:I,"data-testid":"hidden_test_id"}):null,d("div",{className:"dropin-field dropin-address-form-wrapper--buttons",children:o!=null&&o.AddressFormActions?d(be,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:o.AddressFormActions,context:{handleUpdateAddress:b,handleCreateAddress:k,addressId:I}}):d(ae,{children:n?null:U(ae,{children:[d(de,{type:"button",onClick:u,variant:"secondary",disabled:B,children:F.secondaryButton}),d(de,{disabled:B,children:F.primaryButton})]})})})]})]}):null};export{fe as A,Re as C,F1 as E,T1 as S,Q1 as a,xe as c};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{t as l,m as i,f as m,h as _,a as p}from"./removeCustomerAddress.js";const f=(t,r="en-US",s={})=>{const e={...{day:"2-digit",month:"2-digit",year:"numeric"},...s},a=new Date(t);return isNaN(a.getTime())?"Invalid Date":new Intl.DateTimeFormat(r,e).format(a)},g=t=>{var d,c;if(!((c=(d=t.data)==null?void 0:d.customer)!=null&&c.orders))return null;const{items:r,page_info:s,total_count:n,date_of_first_order:e}=t.data.customer.orders;return{items:r.map(o=>{const u={...o,order_date:f(o.order_date),shipping_address:l(o.shipping_address),billing_address:l(o.billing_address)};return i(u,"camelCase",{})}),pageInfo:i(s,"camelCase",{}),totalCount:i(n,"camelCase",{}),dateOfFirstOrder:i(e,"camelCase",{})}},y=`
|
|
2
|
+
fragment AddressesList on OrderAddress {
|
|
3
|
+
city
|
|
4
|
+
company
|
|
5
|
+
country_code
|
|
6
|
+
fax
|
|
7
|
+
firstname
|
|
8
|
+
lastname
|
|
9
|
+
middlename
|
|
10
|
+
postcode
|
|
11
|
+
prefix
|
|
12
|
+
region
|
|
13
|
+
region_id
|
|
14
|
+
street
|
|
15
|
+
suffix
|
|
16
|
+
telephone
|
|
17
|
+
vat_id
|
|
18
|
+
}`,h=`
|
|
19
|
+
fragment OrderSummary on OrderTotal {
|
|
20
|
+
__typename
|
|
21
|
+
grand_total {
|
|
22
|
+
value
|
|
23
|
+
currency
|
|
24
|
+
}
|
|
25
|
+
subtotal {
|
|
26
|
+
currency
|
|
27
|
+
value
|
|
28
|
+
}
|
|
29
|
+
taxes {
|
|
30
|
+
amount {
|
|
31
|
+
currency
|
|
32
|
+
value
|
|
33
|
+
}
|
|
34
|
+
rate
|
|
35
|
+
title
|
|
36
|
+
}
|
|
37
|
+
total_tax {
|
|
38
|
+
currency
|
|
39
|
+
value
|
|
40
|
+
}
|
|
41
|
+
total_shipping {
|
|
42
|
+
currency
|
|
43
|
+
value
|
|
44
|
+
}
|
|
45
|
+
discounts {
|
|
46
|
+
amount {
|
|
47
|
+
currency
|
|
48
|
+
value
|
|
49
|
+
}
|
|
50
|
+
label
|
|
51
|
+
}
|
|
52
|
+
}`,O=`
|
|
53
|
+
query GET_CUSTOMER_ORDERS_LIST($currentPage: Int, $pageSize: Int, $filter: CustomerOrdersFilterInput, $sort: CustomerOrderSortInput) {
|
|
54
|
+
customer {
|
|
55
|
+
orders(currentPage: $currentPage, pageSize: $pageSize, filter: $filter, sort: $sort) {
|
|
56
|
+
page_info {
|
|
57
|
+
page_size
|
|
58
|
+
total_pages
|
|
59
|
+
current_page
|
|
60
|
+
}
|
|
61
|
+
date_of_first_order
|
|
62
|
+
total_count
|
|
63
|
+
items {
|
|
64
|
+
token
|
|
65
|
+
email
|
|
66
|
+
shipping_method
|
|
67
|
+
payment_methods {
|
|
68
|
+
name
|
|
69
|
+
type
|
|
70
|
+
}
|
|
71
|
+
shipping_address {
|
|
72
|
+
...AddressesList
|
|
73
|
+
}
|
|
74
|
+
billing_address {
|
|
75
|
+
...AddressesList
|
|
76
|
+
}
|
|
77
|
+
shipments {
|
|
78
|
+
id
|
|
79
|
+
number
|
|
80
|
+
tracking {
|
|
81
|
+
title
|
|
82
|
+
number
|
|
83
|
+
carrier
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
number
|
|
87
|
+
id
|
|
88
|
+
order_date
|
|
89
|
+
carrier
|
|
90
|
+
status
|
|
91
|
+
items {
|
|
92
|
+
status
|
|
93
|
+
product_name
|
|
94
|
+
id
|
|
95
|
+
quantity_ordered
|
|
96
|
+
quantity_shipped
|
|
97
|
+
quantity_invoiced
|
|
98
|
+
product {
|
|
99
|
+
small_image {
|
|
100
|
+
url
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
total {
|
|
105
|
+
...OrderSummary
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
${y}
|
|
112
|
+
${h}
|
|
113
|
+
`,S={sort_direction:"DESC",sort_field:"CREATED_AT"},T=async(t,r,s)=>{const n=r.includes("viewAll")?{}:{order_date:JSON.parse(r)};return await m(O,{method:"GET",cache:"no-cache",variables:{pageSize:t,currentPage:s,filter:n,sort:S}}).then(e=>{var a;return(a=e.errors)!=null&&a.length?_(e.errors):g(e)}).catch(p)};export{T as g};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import{events as C}from"@dropins/tools/event-bus.js";import{FetchGraphQL as T}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:x,setFetchGraphQlHeader:B,removeFetchGraphQlHeader:Q,setFetchGraphQlHeaders:j,fetchGraphQl:s,getConfig:k}=new T().getMethods(),A=`
|
|
2
|
+
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
3
|
+
attributesForm(formCode: $formCode) {
|
|
4
|
+
items {
|
|
5
|
+
code
|
|
6
|
+
default_value
|
|
7
|
+
entity_type
|
|
8
|
+
frontend_class
|
|
9
|
+
frontend_input
|
|
10
|
+
is_required
|
|
11
|
+
is_unique
|
|
12
|
+
label
|
|
13
|
+
options {
|
|
14
|
+
is_default
|
|
15
|
+
label
|
|
16
|
+
value
|
|
17
|
+
}
|
|
18
|
+
... on CustomerAttributeMetadata {
|
|
19
|
+
multiline_count
|
|
20
|
+
sort_order
|
|
21
|
+
validate_rules {
|
|
22
|
+
name
|
|
23
|
+
value
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
errors {
|
|
28
|
+
type
|
|
29
|
+
message
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`,p=`
|
|
34
|
+
query GET_ATTRIBUTES_FORM_SHORT {
|
|
35
|
+
attributesForm(formCode: customer_register_address) {
|
|
36
|
+
items {
|
|
37
|
+
frontend_input
|
|
38
|
+
label
|
|
39
|
+
code
|
|
40
|
+
... on CustomerAttributeMetadata {
|
|
41
|
+
multiline_count
|
|
42
|
+
sort_order
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`,f=t=>{throw t instanceof DOMException&&t.name==="AbortError"||C.emit("error",{source:"auth",type:"network",error:t}),t},h=t=>{const e=t.map(r=>r.message).join(" ");throw Error(e)},b=t=>t.replace(/_([a-z])/g,(e,r)=>r.toUpperCase()),R=t=>t.replace(/([A-Z])/g,e=>`_${e.toLowerCase()}`),a=(t,e,r)=>{const n=["string","boolean","number"],o=e==="camelCase"?b:R;return Array.isArray(t)?t.map(i=>n.includes(typeof i)||i===null?i:typeof i=="object"?a(i,e,r):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,_])=>{const u=r&&r[c]?r[c]:o(c);return i[u]=n.includes(typeof _)||_===null?_:a(_,e,r),i},{}):t},S=t=>{let e=[];for(const r of t)if(!(r.frontend_input!=="MULTILINE"||r.multiline_count<2))for(let n=2;n<=r.multiline_count;n++){const o={...r,is_required:!1,name:`${r.code}_multiline_${n}`,code:`${r.code}_multiline_${n}`,id:`${r.code}_multiline_${n}`};e.push(o)}return e},y=t=>{var i,c,_;const e=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!e.length)return[];const r=(_=e.filter(u=>{var l;return!((l=u.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:_.map(({code:u,...l})=>{const m=u!=="country_id"?u:"country_code";return{...l,name:m,id:m,code:m}}),n=S(r);return r.concat(n).map(u=>{var g;const l=u.code==="firstname"?"firstName":u.code==="lastname"?"lastName":b(u.code),m=(g=u.options)==null?void 0:g.map(E=>({isDefault:E.is_default,text:E.label,value:E.value}));return a({...u,options:m,customUpperCode:l},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((u,l)=>u.orderNumber-l.orderNumber)},v=t=>{const e={};for(const r in t){const n=t[r];!Array.isArray(n)||n.length===0||(r==="custom_attributesV2"?n.forEach(o=>{typeof o=="object"&&"value"in o&&(e[o==null?void 0:o.code]=o==null?void 0:o.value)}):n.length>1?n.forEach((o,i)=>{i===0?e[r]=o:e[`${r}_multiline_${i+1}`]=o}):e[r]=n[0])}return e},O=t=>{var e,r,n;return a({firstname:(t==null?void 0:t.firstname)||"",lastname:(t==null?void 0:t.lastname)||"",city:(t==null?void 0:t.city)||"",company:(t==null?void 0:t.company)||"",country_code:(t==null?void 0:t.country_code)||"",region:{region:((e=t==null?void 0:t.region)==null?void 0:e.region)||"",region_code:((r=t==null?void 0:t.region)==null?void 0:r.region_code)||"",region_id:((n=t==null?void 0:t.region)==null?void 0:n.region_id)||""},telephone:(t==null?void 0:t.telephone)||"",id:(t==null?void 0:t.id)||"",vat_id:(t==null?void 0:t.vat_id)||"",postcode:(t==null?void 0:t.postcode)||"",default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...v(t)},"camelCase",{})},$=t=>{var r,n;const e=((n=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:n.addresses)||[];return e.length?e.map(O).sort((o,i)=>(Number(i.defaultBilling)||Number(i.defaultShipping))-(Number(o.defaultBilling)||Number(o.defaultShipping))):[]},d=t=>{var c,_;if(!((_=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&_.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:e,storeConfig:r}=t.data,n=r==null?void 0:r.countries_with_required_region.split(","),o=r==null?void 0:r.optional_zip_countries.split(",");return{availableCountries:e.filter(({two_letter_abbreviation:u,full_name_locale:l})=>!!(u&&l)).map(u=>{const{two_letter_abbreviation:l,full_name_locale:m}=u;return{value:l,text:m}}).sort((u,l)=>u.text.localeCompare(l.text)),countriesWithRequiredRegion:n,optionalZipCountries:o}},G=t=>{var r,n;return(n=(r=t==null?void 0:t.data)==null?void 0:r.country)!=null&&n.available_regions?t.data.country.available_regions.filter(o=>{if(!o)return!1;const{id:i,code:c,name:_}=o;return!!(i&&c&&_)}).map(o=>{const{id:i}=o;return{id:i,text:o.name,value:`${o.code},${o.id}`}}):[]},H=async t=>await s(t!=="shortRequest"?A:p,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?h(e.errors):y(e)}).catch(f),I=`
|
|
48
|
+
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
49
|
+
createCustomerAddress(input:$input) {
|
|
50
|
+
firstname
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`,L=async t=>await s(I,{method:"POST",variables:{input:a(t,"snakeCase",{customAttributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname"})}}).then(e=>{var r,n,o;return(r=e.errors)!=null&&r.length?h(e.errors):((o=(n=e==null?void 0:e.data)==null?void 0:n.createCustomerAddress)==null?void 0:o.firstname)||""}).catch(f),M=`
|
|
54
|
+
query GET_CUSTOMER_ADDRESS {
|
|
55
|
+
customer {
|
|
56
|
+
addresses {
|
|
57
|
+
firstname
|
|
58
|
+
lastname
|
|
59
|
+
city
|
|
60
|
+
company
|
|
61
|
+
country_code
|
|
62
|
+
region {
|
|
63
|
+
region
|
|
64
|
+
region_code
|
|
65
|
+
region_id
|
|
66
|
+
}
|
|
67
|
+
custom_attributesV2 {
|
|
68
|
+
... on AttributeValue {
|
|
69
|
+
code
|
|
70
|
+
value
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
telephone
|
|
74
|
+
id
|
|
75
|
+
vat_id
|
|
76
|
+
postcode
|
|
77
|
+
street
|
|
78
|
+
default_shipping
|
|
79
|
+
default_billing
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`,P=async()=>await s(M,{method:"GET",cache:"force-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?h(t.errors):$(t)}).catch(f),N=`
|
|
84
|
+
query GET_COUNTRIES_QUERY {
|
|
85
|
+
countries {
|
|
86
|
+
two_letter_abbreviation
|
|
87
|
+
full_name_locale
|
|
88
|
+
}
|
|
89
|
+
storeConfig {
|
|
90
|
+
countries_with_required_region
|
|
91
|
+
optional_zip_countries
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`,z=async()=>await s(N,{method:"GET",cache:"no-cache"}).then(t=>{var e;return(e=t.errors)!=null&&e.length?h(t.errors):d(t)}).catch(f),U=`
|
|
95
|
+
query GET_REGIONS($countryCode: String!) {
|
|
96
|
+
country(id: $countryCode) {
|
|
97
|
+
id
|
|
98
|
+
available_regions {
|
|
99
|
+
id
|
|
100
|
+
code
|
|
101
|
+
name
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`,Z=async t=>await s(U,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?h(e.errors):G(e)}).catch(f),w=`
|
|
106
|
+
mutation UPDATE_CUSTOMER_ADDRESS($id: Int!,
|
|
107
|
+
$input: CustomerAddressInput) {
|
|
108
|
+
updateCustomerAddress(id:$id, input:$input) {
|
|
109
|
+
firstname
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
`,K=async t=>{const{addressId:e,...r}=t;return e?await s(w,{method:"POST",variables:{id:e,input:a(r,"snakeCase",{customAttributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname"})}}).then(n=>{var o,i,c;return(o=n.errors)!=null&&o.length?h(n.errors):((c=(i=n==null?void 0:n.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(f):""},q=`
|
|
113
|
+
mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {
|
|
114
|
+
deleteCustomerAddress(id:$id)
|
|
115
|
+
}
|
|
116
|
+
`,W=async t=>await s(q,{method:"POST",variables:{id:t}}).then(e=>{var r;return(r=e.errors)!=null&&r.length?h(e.errors):e.data.deleteCustomerAddress}).catch(f);export{f as a,B as b,j as c,H as d,L as e,s as f,k as g,h,P as i,z as j,Z as k,W as l,a as m,b as n,Q as r,x as s,O as t,K as u};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
export declare const CardLoader: ({ testId, withCard, }: {
|
|
3
|
+
testId?: string | undefined;
|
|
4
|
+
withCard?: boolean | undefined;
|
|
5
|
+
}) => import("preact").JSX.Element;
|
|
6
|
+
export declare const AddressFormLoader: () => import("preact").JSX.Element;
|
|
7
|
+
export declare const PickerLoader: (props: any) => import("preact").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=AccountLoaders.d.ts.map
|