New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dropins/storefront-account

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dropins/storefront-account - npm Package Compare versions

Comparing version 0.1.0-alpha6 to 0.1.0-alpha7

hooks/containers/useOrderSelectList.d.ts

2

api/getOrderHistoryList/getOrderHistoryList.d.ts
import { OrderHistory } from '../../data/models';
export declare const getOrderHistoryList: (pageSize: number) => Promise<OrderHistory | null>;
export declare const getOrderHistoryList: (pageSize: number, selectOrdersDate: string) => Promise<OrderHistory | null>;
//# sourceMappingURL=getOrderHistoryList.d.ts.map

@@ -1,2 +0,2 @@

export declare const GET_CUSTOMER_ORDERS_LIST = "\n query GET_CUSTOMER_ORDERS_LIST($pageSize: Int) {\n customer {\n orders(pageSize: $pageSize) {\n page_info {\n page_size\n total_pages\n current_page\n }\n total_count\n items {\n token\n email\n shipping_method\n shipping_address {\n firstname\n lastname\n postcode\n street\n region\n city\n country_code\n region_id\n }\n billing_address {\n firstname\n lastname\n postcode\n street\n region\n city\n country_code\n region_id\n }\n payment_methods {\n name\n }\n number\n id\n order_date\n carrier\n status\n items {\n status\n product_name\n id\n product {\n small_image {\n url\n }\n }\n }\n total {\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 }\n }\n }\n }\n}\n";
export declare const GET_CUSTOMER_ORDERS_LIST = "\n query GET_CUSTOMER_ORDERS_LIST($pageSize: Int, $filter: CustomerOrdersFilterInput, $sort: CustomerOrderSortInput) {\n customer {\n orders(pageSize: $pageSize, filter: $filter, sort: $sort) {\n page_info {\n page_size\n total_pages\n current_page\n }\n total_count\n items {\n token\n email\n shipping_method\n shipping_address {\n firstname\n lastname\n postcode\n street\n region\n city\n country_code\n region_id\n }\n billing_address {\n firstname\n lastname\n postcode\n street\n region\n city\n country_code\n region_id\n }\n payment_methods {\n name\n }\n number\n id\n order_date\n carrier\n status\n items {\n status\n product_name\n id\n product {\n small_image {\n url\n }\n }\n }\n total {\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 }\n }\n }\n }\n}\n";
//# sourceMappingURL=getOrderHistoryList.graphql.d.ts.map

@@ -1,1 +0,1 @@

import{jsx as g,jsxs as z,Fragment as W}from"@dropins/tools/preact-jsx-runtime.js";import{classes as O,Slot as $}from"@dropins/tools/lib.js";import{d as v,a as D,A as M,F as P}from"./AddressFormWrapper2.js";import"@dropins/tools/preact-compat.js";import{InLineAlert as S,Button as q}from"@dropins/tools/components.js";import{useState as N,useEffect as R,useCallback as j,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{useText as Q}from"@dropins/tools/i18n.js";import{a as X,b as Y,g as Z,u as C,c as B}from"./updateCustomerAddress.js";import{c as E}from"./convertCase.js";const ye=({slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,billingCheckBoxValue:n,shippingCheckBoxValue:m,showBillingCheckBox:d,showShippingCheckBox:o,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})=>g("div",{className:O(["dropin-address-form"]),children:g(de,{slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,shippingCheckBoxValue:m,billingCheckBoxValue:n,showShippingCheckBox:o,showBillingCheckBox:d,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})}),k=()=>{const[e,r]=N(""),[a,t]=N({});R(()=>{X().then(n=>{t(m=>({...m,country_code:n}))})},[]),R(()=>{e&&Y(e).then(n=>{t(m=>({...m,region:n}))})},[e]);const s=j(n=>{n&&r(n)},[]);return{countryRegionOptions:a,handleSetCountryCode:s}},ee=(e,r)=>{const a=r.map(t=>({...t}));return a.forEach(t=>{if(Object.prototype.hasOwnProperty.call(e,t.customUpperCode)){const s=e[t.customUpperCode];if(t.customUpperCode==="region"&&typeof s=="object"){const n=s!=null&&s.regionCode&&(s!=null&&s.regionId)?`${s.regionCode},${s.regionId}`:s.region;t.defaultValue=n}else t.defaultValue=s}}),a},H=e=>{if(!e)return null;const r=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(t=>{r.has(t.name)||r.set(t.name,"false"),t.checked&&r.set(t.name,"true")}),r&&typeof r.entries=="function"){const t=r.entries();if(t&&typeof t[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(t)))||{}}return{}},te=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}},re=e=>{const r=["region","city","company","country_code","country_id","default_billing","default_shipping","fax","firstname","lastname","middlename","postcode","prefix","street","suffix","telephone","vat_id","addressId"],a={},t=[];return Object.keys(e).forEach(s=>{r.includes(s)?a[s]=e[s]:t.push({attribute_code:s,value:e[s]})}),t.length>0&&(a.custom_attributesV2=t),a},J=e=>{const r=["street","street_1","street_2"],a=["on","off","true","false"],t=[],s={};for(const p in e){const F=e[p];a.includes(F)&&(s[p]=te(F)),r.includes(p)&&t.push(F)}const{street:n,street_2:m,street_1:d,region:o,...u}=e,[y,l]=o?o.split(","):[void 0,void 0],f=l&&y?{region_id:+l,region_code:y}:{region:y},A=re({...u,...s,region:{...f},street:t});return E(A,"camelCase",{})},se=(e,r)=>r!=null&&r.length?e.code==="region"?{...e,required:!!(r!=null&&r.length),options:r}:{...e,options:r}:e,ae=({addressFormId:e,billingCheckBoxValue:r,shippingCheckBoxValue:a,showShippingCheckBox:t,showBillingCheckBox:s,countryRegionOptions:n,inputsDefaultValueSet:m,onCloseBtnClick:d,onSuccess:o,onError:u})=>{const[y,l]=N(!1),[f,A]=N(e||""),[p,F]=N([]),[T,V]=N({text:"",type:"success"});R(()=>{Z(f?"customer_address_edit":"customer_register_address").then(i=>{F(i)})},[f]);const x=j(()=>{V({text:"",type:"success"}),d==null||d()},[d]),L=j(async(i,b)=>{if(!b)return null;l(!0);const _=H(i.target),U=J(_);await C(U).then(()=>{var c;o==null||o(),d==null||d(),(c=i==null?void 0:i.target)==null||c.reset()}).catch(c=>{V(h=>({...h,text:c.message,type:"error"})),u==null||u(c)}).finally(()=>{A(""),l(!1)})},[d,u,o]),w=j(async(i,b)=>{if(!b)return null;l(!0);const _=H(i.target),U=J(_);await B(U).then(()=>{var c;o==null||o(),d==null||d(),(c=i==null?void 0:i.target)==null||c.reset()}).catch(c=>{V(h=>({...h,text:c.message,type:"error"})),u==null||u(c)}).finally(()=>{A(""),l(!1)})},[d,u,o]),I=G(()=>{if(!p.length)return[];const i={...v,defaultValue:a,isHidden:!t},b={...D,defaultValue:r,isHidden:!s},_=[...p,i,b];return ee(m||{},_).filter(h=>!(f&&(h.customUpperCode==="defaultShipping"||h.customUpperCode==="defaultBilling")&&h.defaultValue)).map(h=>{const K=n[h.code];return se(h,K)})},[p,t,a,s,r,m,n,f]);return{inLineAlert:T,addressId:f,submitLoading:y,normalizeFieldsConfig:I,handleUpdateAddress:L,handleCreateAddress:w,handleOnCloseForm:x}},de=({slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,showShippingCheckBox:n=!0,showBillingCheckBox:m=!0,shippingCheckBoxValue:d=!0,billingCheckBoxValue:o=!0,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})=>{const F=Q({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton"}),{countryRegionOptions:T,handleSetCountryCode:V}=k(),{inLineAlert:x,addressId:L,submitLoading:w,normalizeFieldsConfig:I,handleUpdateAddress:i,handleCreateAddress:b,handleOnCloseForm:_}=ae({addressFormId:t,inputsDefaultValueSet:s,countryRegionOptions:T,shippingCheckBoxValue:d,billingCheckBoxValue:o,showShippingCheckBox:n,showBillingCheckBox:m,onSuccess:f,onError:A,onCloseBtnClick:l});return u?I!=null&&I.length?z("div",{className:O(["dropin-address-form-wrapper",a]),children:[g("div",{className:"dropin-address-form-wrapper--title","data-testid":"addressesFormTitle",children:r}),x.text?g(S,{"data-testid":"inLineAlert",className:"dropin-address-form-wrapper--notification",type:x.type,variant:"secondary",heading:x.text,icon:x.icon}):null,z(P,{slots:e,className:"dropin-address-form",name:"addressesForm",loading:w,fieldsConfig:I,onSubmit:y||(L?i:b),handleSetCountryCode:V,onChange:p,children:[L?g("input",{type:"hidden",name:"addressId",value:L,"data-testid":"hidden_test_id"}):null,g("div",{className:"dropin-field dropin-address-form-wrapper--buttons",children:e!=null&&e.AddressFormActions?g($,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:e.AddressFormActions,context:{handleUpdateAddress:i,handleCreateAddress:b,addressId:L}}):z(W,{children:[g(q,{type:"button",onClick:_,variant:"secondary",disabled:w,children:F.secondaryButton}),g(q,{disabled:w,children:F.primaryButton})]})})]})]}):g("div",{children:g(M,{})}):null};export{ye as A};
import{jsx as g,jsxs as z,Fragment as W}from"@dropins/tools/preact-jsx-runtime.js";import{classes as O,Slot as $}from"@dropins/tools/lib.js";import{d as v,a as D,A as M,F as P}from"./AddressFormWrapper2.js";import"@dropins/tools/preact-compat.js";import{InLineAlert as S,Button as q}from"@dropins/tools/components.js";import"@dropins/tools/preact.js";import{useState as N,useEffect as R,useCallback as j,useMemo as G}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{useText as Q}from"@dropins/tools/i18n.js";import{a as X,b as Y,g as Z,u as C,c as B}from"./updateCustomerAddress.js";import{c as E}from"./convertCase.js";const ye=({slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,billingCheckBoxValue:n,shippingCheckBoxValue:m,showBillingCheckBox:d,showShippingCheckBox:o,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})=>g("div",{className:O(["dropin-address-form"]),children:g(de,{slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,shippingCheckBoxValue:m,billingCheckBoxValue:n,showShippingCheckBox:o,showBillingCheckBox:d,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})}),k=()=>{const[e,r]=N(""),[a,t]=N({});R(()=>{X().then(n=>{t(m=>({...m,country_code:n}))})},[]),R(()=>{e&&Y(e).then(n=>{t(m=>({...m,region:n}))})},[e]);const s=j(n=>{n&&r(n)},[]);return{countryRegionOptions:a,handleSetCountryCode:s}},ee=(e,r)=>{const a=r.map(t=>({...t}));return a.forEach(t=>{if(Object.prototype.hasOwnProperty.call(e,t.customUpperCode)){const s=e[t.customUpperCode];if(t.customUpperCode==="region"&&typeof s=="object"){const n=s!=null&&s.regionCode&&(s!=null&&s.regionId)?`${s.regionCode},${s.regionId}`:s.region;t.defaultValue=n}else t.defaultValue=s}}),a},H=e=>{if(!e)return null;const r=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(t=>{r.has(t.name)||r.set(t.name,"false"),t.checked&&r.set(t.name,"true")}),r&&typeof r.entries=="function"){const t=r.entries();if(t&&typeof t[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(t)))||{}}return{}},te=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}},re=e=>{const r=["region","city","company","country_code","country_id","default_billing","default_shipping","fax","firstname","lastname","middlename","postcode","prefix","street","suffix","telephone","vat_id","addressId"],a={},t=[];return Object.keys(e).forEach(s=>{r.includes(s)?a[s]=e[s]:t.push({attribute_code:s,value:e[s]})}),t.length>0&&(a.custom_attributesV2=t),a},J=e=>{const r=["street","street_1","street_2"],a=["on","off","true","false"],t=[],s={};for(const p in e){const F=e[p];a.includes(F)&&(s[p]=te(F)),r.includes(p)&&t.push(F)}const{street:n,street_2:m,street_1:d,region:o,...u}=e,[y,l]=o?o.split(","):[void 0,void 0],f=l&&y?{region_id:+l,region_code:y}:{region:y},A=re({...u,...s,region:{...f},street:t});return E(A,"camelCase",{})},se=(e,r)=>r!=null&&r.length?e.code==="region"?{...e,required:!!(r!=null&&r.length),options:r}:{...e,options:r}:e,ae=({addressFormId:e,billingCheckBoxValue:r,shippingCheckBoxValue:a,showShippingCheckBox:t,showBillingCheckBox:s,countryRegionOptions:n,inputsDefaultValueSet:m,onCloseBtnClick:d,onSuccess:o,onError:u})=>{const[y,l]=N(!1),[f,A]=N(e||""),[p,F]=N([]),[T,V]=N({text:"",type:"success"});R(()=>{Z(f?"customer_address_edit":"customer_register_address").then(i=>{F(i)})},[f]);const x=j(()=>{V({text:"",type:"success"}),d==null||d()},[d]),L=j(async(i,b)=>{if(!b)return null;l(!0);const _=H(i.target),U=J(_);await C(U).then(()=>{var c;o==null||o(),d==null||d(),(c=i==null?void 0:i.target)==null||c.reset()}).catch(c=>{V(h=>({...h,text:c.message,type:"error"})),u==null||u(c)}).finally(()=>{A(""),l(!1)})},[d,u,o]),w=j(async(i,b)=>{if(!b)return null;l(!0);const _=H(i.target),U=J(_);await B(U).then(()=>{var c;o==null||o(),d==null||d(),(c=i==null?void 0:i.target)==null||c.reset()}).catch(c=>{V(h=>({...h,text:c.message,type:"error"})),u==null||u(c)}).finally(()=>{A(""),l(!1)})},[d,u,o]),I=G(()=>{if(!p.length)return[];const i={...v,defaultValue:a,isHidden:!t},b={...D,defaultValue:r,isHidden:!s},_=[...p,i,b];return ee(m||{},_).filter(h=>!(f&&(h.customUpperCode==="defaultShipping"||h.customUpperCode==="defaultBilling")&&h.defaultValue)).map(h=>{const K=n[h.code];return se(h,K)})},[p,t,a,s,r,m,n,f]);return{inLineAlert:T,addressId:f,submitLoading:y,normalizeFieldsConfig:I,handleUpdateAddress:L,handleCreateAddress:w,handleOnCloseForm:x}},de=({slots:e,addressesFormTitle:r,className:a,addressFormId:t,inputsDefaultValueSet:s,showShippingCheckBox:n=!0,showBillingCheckBox:m=!0,shippingCheckBoxValue:d=!0,billingCheckBoxValue:o=!0,isOpen:u,onSubmit:y,onCloseBtnClick:l,onSuccess:f,onError:A,onChange:p})=>{const F=Q({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton"}),{countryRegionOptions:T,handleSetCountryCode:V}=k(),{inLineAlert:x,addressId:L,submitLoading:w,normalizeFieldsConfig:I,handleUpdateAddress:i,handleCreateAddress:b,handleOnCloseForm:_}=ae({addressFormId:t,inputsDefaultValueSet:s,countryRegionOptions:T,shippingCheckBoxValue:d,billingCheckBoxValue:o,showShippingCheckBox:n,showBillingCheckBox:m,onSuccess:f,onError:A,onCloseBtnClick:l});return u?I!=null&&I.length?z("div",{className:O(["dropin-address-form-wrapper",a]),children:[g("div",{className:"dropin-address-form-wrapper--title","data-testid":"addressesFormTitle",children:r}),x.text?g(S,{"data-testid":"inLineAlert",className:"dropin-address-form-wrapper--notification",type:x.type,variant:"secondary",heading:x.text,icon:x.icon}):null,z(P,{slots:e,className:"dropin-address-form",name:"addressesForm",loading:w,fieldsConfig:I,onSubmit:y||(L?i:b),handleSetCountryCode:V,onChange:p,children:[L?g("input",{type:"hidden",name:"addressId",value:L,"data-testid":"hidden_test_id"}):null,g("div",{className:"dropin-field dropin-address-form-wrapper--buttons",children:e!=null&&e.AddressFormActions?g($,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:e.AddressFormActions,context:{handleUpdateAddress:i,handleCreateAddress:b,addressId:L}}):z(W,{children:[g(q,{type:"button",onClick:_,variant:"secondary",disabled:w,children:F.secondaryButton}),g(q,{disabled:w,children:F.primaryButton})]})})]})]}):g("div",{children:g(M,{})}):null};export{ye as A};

@@ -1,1 +0,1 @@

import{jsx as a,Fragment as H,jsxs as R}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as W,useState as O,useEffect as V,useCallback as L}from"@dropins/tools/preact-hooks.js";import{useText as G}from"@dropins/tools/i18n.js";import{classes as y,Slot as g}from"@dropins/tools/lib.js";import{memo as U,useCallback as z}from"@dropins/tools/preact-compat.js";import{Field as M,Picker as P,Input as X,InputDate as C,Checkbox as w,TextArea as B,Skeleton as q,SkeletonRow as E,Card as j}from"@dropins/tools/components.js";const v=r=>r.reduce(($,{code:T,required:I,defaultValue:s})=>(I&&T&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&($[T]=s),$),{}),Y=({fieldsConfig:r,onSubmit:$,handleSetCountryCode:T,onChange:I})=>{const{requiredFieldError:s}=G({requiredFieldError:"Account.FormText.requiredFieldError"}),p=W(null),[i,t]=O({}),[S,A]=O({});V(()=>{if(!r||!r.length)return;const l=v(r);t(l)},[r==null?void 0:r.length]);const[f,D]=O({previousCountryCode:null,previousRegionCode:null,initialLoad:!0});V(()=>{var h;const l=i.country_code,d=r==null?void 0:r.find(u=>u.code==="region");if(f.initialLoad)D(u=>({...u,previousCountryCode:l,initialLoad:!1}));else if(f.previousCountryCode!==l){D(c=>({...c,previousCountryCode:l}));const u=!((h=d==null?void 0:d.options)!=null&&h.length)&&!(d!=null&&d.defaultValue)||f.previousRegionCode?"":(d==null?void 0:d.defaultValue)??"";t(c=>({...c,region:u})),T(l)}d!=null&&d.defaultValue&&f.previousCountryCode===l&&D(u=>({...u,previousRegionCode:d.defaultValue}))},[r,i,f.previousCountryCode,f.initialLoad,f.previousRegionCode,T,t]),V(()=>{if(!(r!=null&&r.length))return;const l=v(r);t(l)},[r==null?void 0:r.length]);const b=L((l,d)=>{const h=r.find(u=>u.code===l);return h!=null&&h.required&&!d?s:""},[r,s]),e=L(l=>{const{name:d,value:h,type:u,checked:c}=l==null?void 0:l.target,x=u==="checkbox"?c:h;t(k=>({...k,[d]:x}))},[]),n=L(l=>{const d=l.currentTarget,h=l.target,u=new FormData(d),c=Object.fromEntries(u.entries()),x={[h.name]:c[h.name]&&String(c[h.name])};I==null||I(c,x,l)},[I]),o=L(l=>{const{name:d,value:h,type:u,checked:c}=l==null?void 0:l.target,x=u==="checkbox"?c:h;A(k=>({...k,[d]:b(d,x)}))},[b]),F=L(l=>{l.preventDefault();let d=!0,h={},u=null;for(const[c,x]of Object.entries(i)){const k=b(c,x);k&&(h[c]=k,d=!1,u||(u=c))}if(A(h),u&&p.current){const c=p.current.elements.namedItem(u);c==null||c.focus()}$==null||$(l,d)},[i,b,$]);return{formData:i,errors:S,formRef:p,handleInputChange:e,handleFormChange:n,handleBlur:o,handleSubmit:F}};var N=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(N||{});const m=U(({loading:r,values:$,fields:T=[],errors:I,className:s="",onChange:p,onBlur:i})=>{const t=`${s}__field`,S=z((e,n,o)=>a(M,{error:o,className:y([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(P,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:i,handleSelect:p,value:n||e.defaultValue})},e.id),[s,r,t,i,p]),A=z((e,n,o)=>a(M,{error:o,className:y([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(X,{type:"text",name:e.id,value:n??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:i,onChange:p})},e.id),[s,r,t,i,p]),f=z((e,n,o)=>a(M,{error:o,className:y([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(C,{type:"text",name:e.id,value:n||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:i,onChange:p})},e.id),[s,r,t,i,p]),D=z((e,n,o)=>a(M,{error:o,className:y([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(w,{name:e.id,checked:n||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:i,onChange:p})},e.id),[s,r,t,i,p]),b=z((e,n,o)=>a(M,{error:o,className:y([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(B,{type:"text",name:e.id,value:n??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:i,onChange:p})},e.id),[s,r,t,i,p]);return T.length?a(H,{children:T.map(e=>{const n=I==null?void 0:I[e.id],o=$==null?void 0:$[e.id];switch(e.fieldType){case N.TEXT:return e.options.length?S(e,o,n):A(e,o,n);case N.MULTILINE:return A(e,o,n);case N.SELECT:return S(e,o,n);case N.DATE:return f(e,o,n);case N.BOOLEAN:return D(e,o,n);case"TEXTAREA":return b(e,o,n);default:return null}})}):null}),ae=U(({slots:r,name:$,loading:T,children:I,className:s="defaultForm",fieldsConfig:p,onSubmit:i,handleSetCountryCode:t,onChange:S})=>{const{formData:A,errors:f,formRef:D,handleInputChange:b,handleFormChange:e,handleBlur:n,handleSubmit:o}=Y({fieldsConfig:p,onSubmit:i,handleSetCountryCode:t,onChange:S});return R("form",{className:y(["dropin-form",s]),onSubmit:o,onChange:e,name:$,ref:D,children:[a(m,{className:s,loading:T,fields:p,onChange:b,onBlur:n,errors:f,values:A}),r!=null&&r.AddressFormInputs?a(g,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:b}}}):null,I]})}),te=({testId:r,withCard:$=!0})=>{const T=R(q,{"data-testid":r||"skeletonLoader",children:[a(E,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(E,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(E,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return $?T:a(j,{variant:"secondary",className:y(["dropin-account-loaders","dropin-account-loaders--card-loader"]),children:T})},le=()=>R(q,{"data-testid":"addressFormLoader",children:[a(E,{variant:"heading",size:"medium"}),a(E,{variant:"empty",size:"medium"}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large",fullWidth:!0}),a(E,{size:"large",fullWidth:!0,lines:3}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large"}),a(E,{size:"large",fullWidth:!0})]}),_={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:N.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},de={..._,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},se={..._,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"};export{le as A,te as C,ae as F,se as a,de as d};
import{jsx as a,Fragment as H,jsxs as v}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as W,useState as O,useEffect as V,useCallback as L}from"@dropins/tools/preact-hooks.js";import{useText as G}from"@dropins/tools/i18n.js";import{classes as A,Slot as g}from"@dropins/tools/lib.js";import{memo as q,useCallback as S}from"@dropins/tools/preact-compat.js";import{Field as M,Picker as P,Input as m,InputDate as X,Checkbox as w,TextArea as C,Skeleton as R,SkeletonRow as i,Card as B}from"@dropins/tools/components.js";const U=r=>r.reduce(($,{code:T,required:I,defaultValue:s})=>(I&&T&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&($[T]=s),$),{}),j=({fieldsConfig:r,onSubmit:$,handleSetCountryCode:T,onChange:I})=>{const{requiredFieldError:s}=G({requiredFieldError:"Account.FormText.requiredFieldError"}),h=W(null),[p,t]=O({}),[z,D]=O({});V(()=>{if(!r||!r.length)return;const l=U(r);t(l)},[r==null?void 0:r.length]);const[f,x]=O({previousCountryCode:null,previousRegionCode:null,initialLoad:!0});V(()=>{var E;const l=p.country_code,d=r==null?void 0:r.find(u=>u.code==="region");if(f.initialLoad)x(u=>({...u,previousCountryCode:l,initialLoad:!1}));else if(f.previousCountryCode!==l){x(c=>({...c,previousCountryCode:l}));const u=!((E=d==null?void 0:d.options)!=null&&E.length)&&!(d!=null&&d.defaultValue)||f.previousRegionCode?"":(d==null?void 0:d.defaultValue)??"";t(c=>({...c,region:u})),T(l)}d!=null&&d.defaultValue&&f.previousCountryCode===l&&x(u=>({...u,previousRegionCode:d.defaultValue}))},[r,p,f.previousCountryCode,f.initialLoad,f.previousRegionCode,T,t]),V(()=>{if(!(r!=null&&r.length))return;const l=U(r);t(l)},[r==null?void 0:r.length]);const b=L((l,d)=>{const E=r.find(u=>u.code===l);return E!=null&&E.required&&!d?s:""},[r,s]),e=L(l=>{const{name:d,value:E,type:u,checked:c}=l==null?void 0:l.target,y=u==="checkbox"?c:E;t(N=>({...N,[d]:y}))},[]),n=L(l=>{const d=l.currentTarget,E=l.target,u=new FormData(d),c=Object.fromEntries(u.entries()),y={[E.name]:c[E.name]&&String(c[E.name])};I==null||I(c,y,l)},[I]),o=L(l=>{const{name:d,value:E,type:u,checked:c}=l==null?void 0:l.target,y=u==="checkbox"?c:E;D(N=>({...N,[d]:b(d,y)}))},[b]),F=L(l=>{l.preventDefault();let d=!0,E={},u=null;for(const[c,y]of Object.entries(p)){const N=b(c,y);N&&(E[c]=N,d=!1,u||(u=c))}if(D(E),u&&h.current){const c=h.current.elements.namedItem(u);c==null||c.focus()}$==null||$(l,d)},[p,b,$]);return{formData:p,errors:z,formRef:h,handleInputChange:e,handleFormChange:n,handleBlur:o,handleSubmit:F}};var k=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(k||{});const Y=q(({loading:r,values:$,fields:T=[],errors:I,className:s="",onChange:h,onBlur:p})=>{const t=`${s}__field`,z=S((e,n,o)=>a(M,{error:o,className:A([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(P,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:e.options,onBlur:p,handleSelect:h,value:n||e.defaultValue})},e.id),[s,r,t,p,h]),D=S((e,n,o)=>a(M,{error:o,className:A([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(m,{type:"text",name:e.id,value:n??e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:h})},e.id),[s,r,t,p,h]),f=S((e,n,o)=>a(M,{error:o,className:A([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(X,{type:"text",name:e.id,value:n||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:h})},e.id),[s,r,t,p,h]),x=S((e,n,o)=>a(M,{error:o,className:A([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(w,{name:e.id,checked:n||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:h})},e.id),[s,r,t,p,h]),b=S((e,n,o)=>a(M,{error:o,className:A([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.isHidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:r,children:a(C,{type:"text",name:e.id,value:n??e.defaultValue,label:`${e.label} ${e.required?"*":""}`,onBlur:p,onChange:h})},e.id),[s,r,t,p,h]);return T.length?a(H,{children:T.map(e=>{const n=I==null?void 0:I[e.id],o=$==null?void 0:$[e.id];switch(e.fieldType){case k.TEXT:return e.options.length?z(e,o,n):D(e,o,n);case k.MULTILINE:return D(e,o,n);case k.SELECT:return z(e,o,n);case k.DATE:return f(e,o,n);case k.BOOLEAN:return x(e,o,n);case"TEXTAREA":return b(e,o,n);default:return null}})}):null}),ae=q(({slots:r,name:$,loading:T,children:I,className:s="defaultForm",fieldsConfig:h,onSubmit:p,handleSetCountryCode:t,onChange:z})=>{const{formData:D,errors:f,formRef:x,handleInputChange:b,handleFormChange:e,handleBlur:n,handleSubmit:o}=j({fieldsConfig:h,onSubmit:p,handleSetCountryCode:t,onChange:z});return v("form",{className:A(["dropin-form",s]),onSubmit:o,onChange:e,name:$,ref:x,children:[a(Y,{className:s,loading:T,fields:h,onChange:b,onBlur:n,errors:f,values:D}),r!=null&&r.AddressFormInputs?a(g,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:b}}}):null,I]})}),te=({testId:r,withCard:$=!0})=>{const T=v(R,{"data-testid":r||"skeletonLoader",children:[a(i,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(i,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return $?T:a(B,{variant:"secondary",className:A(["dropin-account-loaders","dropin-account-loaders--card-loader"]),children:T})},le=()=>v(R,{"data-testid":"addressFormLoader",children:[a(i,{variant:"heading",size:"medium"}),a(i,{variant:"empty",size:"medium"}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large",fullWidth:!0}),a(i,{size:"large",fullWidth:!0,lines:3}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large"}),a(i,{size:"large",fullWidth:!0})]}),de=r=>v(R,{...r,rowGap:"xsmall",className:A(["dropin-account-loaders","dropin-account-loaders--picker-loader"]),children:[a(i,{variant:"heading",size:"xsmall"}),a(i,{variant:"empty",size:"small"}),a(i,{size:"small"})]}),_={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:k.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},se={..._,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},ne={..._,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"};export{le as A,te as C,ae as F,de as P,ne as a,se as d};

@@ -1,5 +0,5 @@

import{c as n,f as l,h as u,a as m}from"./convertCase.js";import{t as c}from"./transform-customer-address.js";const _=(e,t="en-US",r={})=>{const s={...{day:"2-digit",month:"2-digit",year:"numeric"},...r},a=new Date(e);return isNaN(a.getTime())?"Invalid Date":new Intl.DateTimeFormat(t,s).format(a)},g=e=>{var s,a;if(!((a=(s=e.data)==null?void 0:s.customer)!=null&&a.orders))return null;const{items:t,page_info:r,total_count:i}=e.data.customer.orders;return{items:t.map(o=>{const d={...o,order_date:_(o.order_date),shipping_address:c(o.shipping_address),billing_address:c(o.billing_address)};return n(d,"camelCase",{})}),pageInfo:n(r,"camelCase",{}),totalCount:n(i,"camelCase",{})}},p=`
query GET_CUSTOMER_ORDERS_LIST($pageSize: Int) {
import{c as i,f as l,h as u,a as m}from"./convertCase.js";import{t as d}from"./transform-customer-address.js";const _=(e,r="en-US",o={})=>{const t={...{day:"2-digit",month:"2-digit",year:"numeric"},...o},s=new Date(e);return isNaN(s.getTime())?"Invalid Date":new Intl.DateTimeFormat(r,t).format(s)},p=e=>{var t,s;if(!((s=(t=e.data)==null?void 0:t.customer)!=null&&s.orders))return null;const{items:r,page_info:o,total_count:a}=e.data.customer.orders;return{items:r.map(n=>{const c={...n,order_date:_(n.order_date),shipping_address:d(n.shipping_address),billing_address:d(n.billing_address)};return i(c,"camelCase",{})}),pageInfo:i(o,"camelCase",{}),totalCount:i(a,"camelCase",{})}},g=`
query GET_CUSTOMER_ORDERS_LIST($pageSize: Int, $filter: CustomerOrdersFilterInput, $sort: CustomerOrderSortInput) {
customer {
orders(pageSize: $pageSize) {
orders(pageSize: $pageSize, filter: $filter, sort: $sort) {
page_info {

@@ -90,2 +90,2 @@ page_size

}
`,y=async e=>await l(p,{method:"GET",cache:"no-cache",variables:{pageSize:e}}).then(t=>{var r;return(r=t.errors)!=null&&r.length?u(t.errors):g(t)}).catch(m);export{y as g};
`,y=async(e,r)=>{const o=r?{order_date:JSON.parse(r)}:{};return await l(g,{method:"GET",cache:"no-cache",variables:{pageSize:e,filter:o,sort:{sort_direction:"DESC",sort_field:"CREATED_AT"}}}).then(a=>{var t;return(t=a.errors)!=null&&t.length?u(a.errors):p(a)}).catch(m)};export{y as g};

@@ -7,2 +7,3 @@

export declare const AddressFormLoader: () => import("preact").JSX.Element;
export declare const PickerLoader: (props: any) => import("preact").JSX.Element;
//# sourceMappingURL=AccountLoaders.d.ts.map

@@ -1,1 +0,1 @@

import{jsx as i,jsxs as C,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{classes as M}from"@dropins/tools/lib.js";import{C as K}from"../chunks/AddressFormWrapper2.js";import*as z from"@dropins/tools/preact-compat.js";import{useCallback as I,useMemo as Y}from"@dropins/tools/preact-compat.js";import{Card as j,Button as x,Tag as W,Icon as Z,Modal as D,ProgressSpinner as ee,Header as ie}from"@dropins/tools/components.js";import{useState as v,useCallback as h,useEffect as se}from"@dropins/tools/preact-hooks.js";import{Fragment as te}from"@dropins/tools/preact.js";import{u as q,g as re}from"../chunks/updateCustomerAddress.js";import"@dropins/tools/event-bus.js";import{e as de}from"../chunks/convertCase.js";import{g as ne,r as oe}from"../chunks/removeCustomerAddress.js";import{S as le,c as ae,E as ce}from"../chunks/checkIsFunction.js";import{A as H}from"../chunks/AddressFormWrapper.js";import{useText as S}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-address.js";const G=({minifiedView:t,keysSortOrder:n,addressData:e,loading:l,setAddressId:s,handleRenderModal:c,handleRenderForm:d})=>{const r={minifiedView:{},fullSizeView:{}};r.minifiedView=S({actionRemove:"Account.Addresses.minifiedView.addressCard.actionRemove",actionEdit:"Account.Addresses.minifiedView.addressCard.actionEdit",cardLabelShipping:"Account.Addresses.minifiedView.addressCard.cardLabelShipping",cardLabelBilling:"Account.Addresses.minifiedView.addressCard.cardLabelBilling"}),r.fullSizeView=S({actionRemove:"Account.Addresses.fullSizeView.addressCard.actionRemove",actionEdit:"Account.Addresses.fullSizeView.addressCard.actionEdit",cardLabelShipping:"Account.Addresses.fullSizeView.addressCard.cardLabelShipping",cardLabelBilling:"Account.Addresses.fullSizeView.addressCard.cardLabelBilling"});const p=I(()=>{s==null||s(e==null?void 0:e.id),c==null||c()},[c,e==null?void 0:e.id,s]),g=I(()=>{s==null||s(e==null?void 0:e.id),d==null||d()},[d,e==null?void 0:e.id,s]),w=Y(()=>{if(!n)return[];const{region:o,...u}=e,a={...u,...o};return n.filter(({name:m})=>a[m]).map(m=>({name:m.name,orderNumber:m.orderNumber,value:a[m.name],label:m.label}))},[e,n]);return i(j,{variant:"secondary",className:"dropin-address-card","data-testid":"addressCard",children:l?i(K,{}):C(X,{children:[C("div",{className:"dropin-address-card__action",children:[c?i(x,{variant:"tertiary",onClick:p,"data-testid":"removeButton",children:t?r.minifiedView.actionRemove:r.fullSizeView.actionRemove}):null,d?i(x,{variant:"tertiary",onClick:g,className:"dropin-address-card__action--editbutton","data-testid":"editButton",children:t?r.minifiedView.actionEdit:r.fullSizeView.actionEdit}):null]}),i("div",{className:"dropin-address-card__description",children:w.map((o,u)=>{const a=o.label?`${o.label}: ${o==null?void 0:o.value}`:o==null?void 0:o.value;return i("p",{"data-testid":`${o.name}_${u}`,children:a},u)})}),e!=null&&e.defaultShipping||e!=null&&e.defaultBilling?C("div",{className:"dropin-address-card__labels",children:[e!=null&&e.defaultShipping?i(W,{label:t?r.minifiedView.cardLabelShipping.toLocaleUpperCase():r.fullSizeView.cardLabelShipping.toLocaleUpperCase()}):null,e!=null&&e.defaultBilling?i(W,{label:t?r.minifiedView.cardLabelBilling.toLocaleUpperCase():r.fullSizeView.cardLabelBilling.toLocaleUpperCase()}):null]}):null]})})},ue=t=>z.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",...t},z.createElement("g",{id:"Large"},z.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),z.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},z.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"}),z.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"})))),me=({className:t,addNewAddress:n,minifiedView:e,routeAddressesPage:l})=>{const s={minifiedView:{},fullSizeView:{}};return s.minifiedView=S({viewAllAddressesButton:"Account.Addresses.minifiedView.viewAllAddressesButton"}),s.fullSizeView=S({addNewAddressButton:"Account.Addresses.fullSizeView.addNewAddressButton"}),C("button",{className:M(["dropin-actions-address",["dropin-actions-address--viewall",e],["dropin-actions-address--address",!e],t]),"data-testid":"showRouteFullAddress",onClick:l,children:[i("span",{className:"dropin-actions-address--title","data-testid":"addressActionsText",children:e&&!n?s.minifiedView.viewAllAddressesButton:s.fullSizeView.addNewAddressButton}),i(Z,{source:e&&!n?le:ue,size:"32"})]})},fe=({minifiedView:t,keysSortOrder:n,addressData:e,open:l,submitLoading:s,onRemoveAddress:c,closeModal:d})=>{const r={minifiedView:{},fullSizeView:{}};return r.minifiedView=S({title:"Account.Addresses.minifiedView.removeAddressModal.title",description:"Account.Addresses.minifiedView.removeAddressModal.description",actionCancel:"Account.Addresses.minifiedView.removeAddressModal.actionCancel",actionConfirm:"Account.Addresses.minifiedView.removeAddressModal.actionConfirm"}),r.fullSizeView=S({title:"Account.Addresses.fullSizeView.removeAddressModal.title",description:"Account.Addresses.fullSizeView.removeAddressModal.description",actionCancel:"Account.Addresses.fullSizeView.removeAddressModal.actionCancel",actionConfirm:"Account.Addresses.fullSizeView.removeAddressModal.actionConfirm"}),l?C(D,{title:i("h3",{children:t?r.minifiedView.title:r.fullSizeView.title}),className:"dropin-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:d,children:[s?i("div",{className:"dropin-address-modal__spinner","data-testid":"progressSpinner",children:i(ee,{stroke:"4",size:"large"})}):null,i("p",{children:t?r.minifiedView.description:r.fullSizeView.description}),i(G,{minifiedView:t,addressData:e,keysSortOrder:n}),C("div",{className:"dropin-address-modal__wrapper--buttons",children:[i(x,{type:"button",onClick:d,variant:"secondary",disabled:s,children:t?r.minifiedView.actionCancel:r.fullSizeView.actionCancel}),i(x,{disabled:s,onClick:c,children:t?r.minifiedView.actionConfirm:r.fullSizeView.actionConfirm})]})]}):null},pe=async(t,n)=>{if(n.length===1){const d=n[0],p=Object.values(d.region).every(w=>!!w)?{}:{region:{...d.region,regionId:0}};return!!await q({addressId:Number(d==null?void 0:d.id),defaultShipping:!1,defaultBilling:!1,...p})}const e=n.filter(d=>d.id!==t&&(d.defaultBilling||d.defaultShipping)||d.id!==t),l=n[n.length-1],s=e[0]||((l==null?void 0:l.id)!==t?l:null);return!s||!s.id?!1:!!await q({addressId:+s.id,defaultShipping:!0,defaultBilling:!0})},Ae=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],we=({minifiedView:t,routeAddressesPage:n,onSuccess:e})=>{const[l,s]=v(!1),[c,d]=v(!1),[r,p]=v(!1),[g,w]=v(!1),[o,u]=v(!1),[a,m]=v(""),[_,N]=v([]),[T,E]=v([]),A=h(async()=>{p(!0),Promise.all([re("shortRequest"),ne()]).then(b=>{const[k,f]=b;if(k){const U=k.map(({name:y,orderNumber:J,label:Q})=>({name:de(y),orderNumber:J,label:Ae.includes(y)?null:Q}));E(U)}if(f)if(t){const U=f.filter(y=>!!y.defaultShipping||!!y.defaultBilling);N(U)}else N(f)}).finally(()=>{p(!1)})},[t]);se(()=>{A()},[A]);const V=h(b=>{m(b),u(!1)},[]),B=h(()=>{d(!0)},[]),L=h(()=>{m(""),d(!1),s(!1)},[]),O=h(()=>{s(!0)},[]),$=h(async()=>{w(!0),await pe(a,_),oe(+a).then(()=>{A(),L()}).finally(()=>{w(!1)})},[_,a,L,A]),F=h(()=>{u(!1)},[]),R=h(()=>{ae(n)&&t&&!o?window.location.href=n():(u(!0),m(""))},[o,n,t]),P=h(async()=>{await A(),await(e==null?void 0:e())},[A,e]);return{keysSortOrder:T,submitLoading:g,isModalRendered:l,isFormRendered:c,loading:r,addNewAddress:o,addressesList:_,addressId:a,handleRenderForm:B,handleRenderModal:O,removeAddress:$,onCloseBtnClick:L,setEditingAddressId:V,closeNewAddressForm:F,redirectToAddressesRoute:R,handleOnSuccess:P}},ge=({className:t,withHeader:n=!0,minifiedView:e=!1,withActionsInMinifiedView:l=!1,withActionsInFullSizeView:s=!0,inputsDefaultValueSet:c,showShippingCheckBox:d=!0,showBillingCheckBox:r=!0,shippingCheckBoxValue:p=!0,billingCheckBoxValue:g=!0,routeAddressesPage:w,onSuccess:o,onError:u})=>{const a={minifiedView:{},fullSizeView:{}};a.minifiedView=S({containerTitle:"Account.Addresses.minifiedView.containerTitle",editAddressFormTitle:"Account.Addresses.minifiedView.editAddressFormTitle",viewAllAddressesButton:"Account.Addresses.minifiedView.viewAllAddressesButton"}),a.fullSizeView=S({containerTitle:"Account.Addresses.fullSizeView.containerTitle",editAddressFormTitle:"Account.Addresses.fullSizeView.editAddressFormTitle",newAddressFormTitle:"Account.Addresses.fullSizeView.newAddressFormTitle",viewAllAddressesButton:"Account.Addresses.fullSizeView.viewAllAddressesButton"});const{keysSortOrder:m,submitLoading:_,isModalRendered:N,isFormRendered:T,loading:E,addNewAddress:A,addressesList:V,addressId:B,handleRenderForm:L,handleRenderModal:O,removeAddress:$,onCloseBtnClick:F,handleOnSuccess:R,setEditingAddressId:P,closeNewAddressForm:b,redirectToAddressesRoute:k}=we({minifiedView:e,routeAddressesPage:w,onSuccess:o});return C("div",{children:[i("div",{children:n?i(ie,{title:e?a.minifiedView.containerTitle:a.fullSizeView.containerTitle,divider:!e,className:e?"dropin-addresses-header":""}):null}),C("div",{className:M(["dropin-addresses-wrapper",t]),"data-testid":"addressesIdWrapper",children:[i(fe,{minifiedView:e,addressData:V.find(f=>f.id===B),keysSortOrder:m,submitLoading:_,open:N,closeModal:F,onRemoveAddress:$}),E?i(K,{testId:"addressSkeletonLoader",withCard:!1}):i(ce,{isEmpty:!V.length,typeList:"address",minifiedView:e}),V.map(f=>i(te,{children:B===f.id&&T?i(j,{variant:"secondary",style:{marginBottom:20},children:i(H,{isOpen:B===f.id&&T,addressFormId:B,inputsDefaultValueSet:f,addressesFormTitle:e?a.minifiedView.editAddressFormTitle:a.fullSizeView.editAddressFormTitle,showShippingCheckBox:d,showBillingCheckBox:r,shippingCheckBoxValue:p,billingCheckBoxValue:g,onCloseBtnClick:F,onSuccess:R,onError:u})}):i(G,{minifiedView:e,addressData:f,keysSortOrder:m,loading:E,setAddressId:P,handleRenderModal:e&&l||!e&&s?O:void 0,handleRenderForm:e&&l||!e&&s?L:void 0},f.id)},f.id)),i("div",{className:"dropin-addresses__footer",children:A?i("div",{className:M(["dropin-addresses-form__footer__wrapper",["dropin-addresses-form__footer__wrapper-show",A]]),children:i(j,{variant:"secondary",children:i(H,{isOpen:A,addressesFormTitle:a.fullSizeView.newAddressFormTitle,inputsDefaultValueSet:c,showShippingCheckBox:!!V.length,showBillingCheckBox:!!V.length,shippingCheckBoxValue:p,billingCheckBoxValue:g,onCloseBtnClick:b,onSuccess:R,onError:u})})}):i(me,{minifiedView:e,addNewAddress:A,routeAddressesPage:k})})]})]})},ke=({className:t,withHeader:n,minifiedView:e,withActionsInMinifiedView:l,withActionsInFullSizeView:s,inputsDefaultValueSet:c,showShippingCheckBox:d,showBillingCheckBox:r,shippingCheckBoxValue:p,billingCheckBoxValue:g,routeAddressesPage:w,onSuccess:o,onError:u})=>i("div",{className:M(["dropin-addresses",t]),"data-testid":"addressesid",children:i(ge,{className:t,withHeader:n,minifiedView:e,withActionsInMinifiedView:l,withActionsInFullSizeView:s,inputsDefaultValueSet:c,billingCheckBoxValue:g,shippingCheckBoxValue:p,showBillingCheckBox:r,showShippingCheckBox:d,routeAddressesPage:w,onSuccess:o,onError:u})});export{ke as Addresses,ke as default};
import{jsx as i,jsxs as C,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{classes as M}from"@dropins/tools/lib.js";import{C as K}from"../chunks/AddressFormWrapper2.js";import*as z from"@dropins/tools/preact-compat.js";import{useCallback as I,useMemo as Y}from"@dropins/tools/preact-compat.js";import{Card as j,Button as x,Tag as W,Icon as Z,Modal as D,ProgressSpinner as ee,Header as ie}from"@dropins/tools/components.js";import{Fragment as se}from"@dropins/tools/preact.js";import{useState as v,useCallback as h,useEffect as te}from"@dropins/tools/preact-hooks.js";import{u as q,g as re}from"../chunks/updateCustomerAddress.js";import"@dropins/tools/event-bus.js";import{e as de}from"../chunks/convertCase.js";import{g as ne,r as oe}from"../chunks/removeCustomerAddress.js";import{S as le,c as ae,E as ce}from"../chunks/checkIsFunction.js";import{A as H}from"../chunks/AddressFormWrapper.js";import{useText as S}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-address.js";const G=({minifiedView:t,keysSortOrder:n,addressData:e,loading:l,setAddressId:s,handleRenderModal:c,handleRenderForm:d})=>{const r={minifiedView:{},fullSizeView:{}};r.minifiedView=S({actionRemove:"Account.Addresses.minifiedView.addressCard.actionRemove",actionEdit:"Account.Addresses.minifiedView.addressCard.actionEdit",cardLabelShipping:"Account.Addresses.minifiedView.addressCard.cardLabelShipping",cardLabelBilling:"Account.Addresses.minifiedView.addressCard.cardLabelBilling"}),r.fullSizeView=S({actionRemove:"Account.Addresses.fullSizeView.addressCard.actionRemove",actionEdit:"Account.Addresses.fullSizeView.addressCard.actionEdit",cardLabelShipping:"Account.Addresses.fullSizeView.addressCard.cardLabelShipping",cardLabelBilling:"Account.Addresses.fullSizeView.addressCard.cardLabelBilling"});const p=I(()=>{s==null||s(e==null?void 0:e.id),c==null||c()},[c,e==null?void 0:e.id,s]),g=I(()=>{s==null||s(e==null?void 0:e.id),d==null||d()},[d,e==null?void 0:e.id,s]),w=Y(()=>{if(!n)return[];const{region:o,...u}=e,a={...u,...o};return n.filter(({name:m})=>a[m]).map(m=>({name:m.name,orderNumber:m.orderNumber,value:a[m.name],label:m.label}))},[e,n]);return i(j,{variant:"secondary",className:"dropin-address-card","data-testid":"addressCard",children:l?i(K,{}):C(X,{children:[C("div",{className:"dropin-address-card__action",children:[c?i(x,{variant:"tertiary",onClick:p,"data-testid":"removeButton",children:t?r.minifiedView.actionRemove:r.fullSizeView.actionRemove}):null,d?i(x,{variant:"tertiary",onClick:g,className:"dropin-address-card__action--editbutton","data-testid":"editButton",children:t?r.minifiedView.actionEdit:r.fullSizeView.actionEdit}):null]}),i("div",{className:"dropin-address-card__description",children:w.map((o,u)=>{const a=o.label?`${o.label}: ${o==null?void 0:o.value}`:o==null?void 0:o.value;return i("p",{"data-testid":`${o.name}_${u}`,children:a},u)})}),e!=null&&e.defaultShipping||e!=null&&e.defaultBilling?C("div",{className:"dropin-address-card__labels",children:[e!=null&&e.defaultShipping?i(W,{label:t?r.minifiedView.cardLabelShipping.toLocaleUpperCase():r.fullSizeView.cardLabelShipping.toLocaleUpperCase()}):null,e!=null&&e.defaultBilling?i(W,{label:t?r.minifiedView.cardLabelBilling.toLocaleUpperCase():r.fullSizeView.cardLabelBilling.toLocaleUpperCase()}):null]}):null]})})},ue=t=>z.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",...t},z.createElement("g",{id:"Large"},z.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),z.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},z.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"}),z.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"})))),me=({className:t,addNewAddress:n,minifiedView:e,routeAddressesPage:l})=>{const s={minifiedView:{},fullSizeView:{}};return s.minifiedView=S({viewAllAddressesButton:"Account.Addresses.minifiedView.viewAllAddressesButton"}),s.fullSizeView=S({addNewAddressButton:"Account.Addresses.fullSizeView.addNewAddressButton"}),C("button",{className:M(["dropin-actions-address",["dropin-actions-address--viewall",e],["dropin-actions-address--address",!e],t]),"data-testid":"showRouteFullAddress",onClick:l,children:[i("span",{className:"dropin-actions-address--title","data-testid":"addressActionsText",children:e&&!n?s.minifiedView.viewAllAddressesButton:s.fullSizeView.addNewAddressButton}),i(Z,{source:e&&!n?le:ue,size:"32"})]})},fe=({minifiedView:t,keysSortOrder:n,addressData:e,open:l,submitLoading:s,onRemoveAddress:c,closeModal:d})=>{const r={minifiedView:{},fullSizeView:{}};return r.minifiedView=S({title:"Account.Addresses.minifiedView.removeAddressModal.title",description:"Account.Addresses.minifiedView.removeAddressModal.description",actionCancel:"Account.Addresses.minifiedView.removeAddressModal.actionCancel",actionConfirm:"Account.Addresses.minifiedView.removeAddressModal.actionConfirm"}),r.fullSizeView=S({title:"Account.Addresses.fullSizeView.removeAddressModal.title",description:"Account.Addresses.fullSizeView.removeAddressModal.description",actionCancel:"Account.Addresses.fullSizeView.removeAddressModal.actionCancel",actionConfirm:"Account.Addresses.fullSizeView.removeAddressModal.actionConfirm"}),l?C(D,{title:i("h3",{children:t?r.minifiedView.title:r.fullSizeView.title}),className:"dropin-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:d,children:[s?i("div",{className:"dropin-address-modal__spinner","data-testid":"progressSpinner",children:i(ee,{stroke:"4",size:"large"})}):null,i("p",{children:t?r.minifiedView.description:r.fullSizeView.description}),i(G,{minifiedView:t,addressData:e,keysSortOrder:n}),C("div",{className:"dropin-address-modal__wrapper--buttons",children:[i(x,{type:"button",onClick:d,variant:"secondary",disabled:s,children:t?r.minifiedView.actionCancel:r.fullSizeView.actionCancel}),i(x,{disabled:s,onClick:c,children:t?r.minifiedView.actionConfirm:r.fullSizeView.actionConfirm})]})]}):null},pe=async(t,n)=>{if(n.length===1){const d=n[0],p=Object.values(d.region).every(w=>!!w)?{}:{region:{...d.region,regionId:0}};return!!await q({addressId:Number(d==null?void 0:d.id),defaultShipping:!1,defaultBilling:!1,...p})}const e=n.filter(d=>d.id!==t&&(d.defaultBilling||d.defaultShipping)||d.id!==t),l=n[n.length-1],s=e[0]||((l==null?void 0:l.id)!==t?l:null);return!s||!s.id?!1:!!await q({addressId:+s.id,defaultShipping:!0,defaultBilling:!0})},Ae=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],we=({minifiedView:t,routeAddressesPage:n,onSuccess:e})=>{const[l,s]=v(!1),[c,d]=v(!1),[r,p]=v(!1),[g,w]=v(!1),[o,u]=v(!1),[a,m]=v(""),[_,N]=v([]),[T,E]=v([]),A=h(async()=>{p(!0),Promise.all([re("shortRequest"),ne()]).then(b=>{const[k,f]=b;if(k){const U=k.map(({name:y,orderNumber:J,label:Q})=>({name:de(y),orderNumber:J,label:Ae.includes(y)?null:Q}));E(U)}if(f)if(t){const U=f.filter(y=>!!y.defaultShipping||!!y.defaultBilling);N(U)}else N(f)}).finally(()=>{p(!1)})},[t]);te(()=>{A()},[A]);const V=h(b=>{m(b),u(!1)},[]),B=h(()=>{d(!0)},[]),L=h(()=>{m(""),d(!1),s(!1)},[]),O=h(()=>{s(!0)},[]),$=h(async()=>{w(!0),await pe(a,_),oe(+a).then(()=>{A(),L()}).finally(()=>{w(!1)})},[_,a,L,A]),F=h(()=>{u(!1)},[]),R=h(()=>{ae(n)&&t&&!o?window.location.href=n():(u(!0),m(""))},[o,n,t]),P=h(async()=>{await A(),await(e==null?void 0:e())},[A,e]);return{keysSortOrder:T,submitLoading:g,isModalRendered:l,isFormRendered:c,loading:r,addNewAddress:o,addressesList:_,addressId:a,handleRenderForm:B,handleRenderModal:O,removeAddress:$,onCloseBtnClick:L,setEditingAddressId:V,closeNewAddressForm:F,redirectToAddressesRoute:R,handleOnSuccess:P}},ge=({className:t,withHeader:n=!0,minifiedView:e=!1,withActionsInMinifiedView:l=!1,withActionsInFullSizeView:s=!0,inputsDefaultValueSet:c,showShippingCheckBox:d=!0,showBillingCheckBox:r=!0,shippingCheckBoxValue:p=!0,billingCheckBoxValue:g=!0,routeAddressesPage:w,onSuccess:o,onError:u})=>{const a={minifiedView:{},fullSizeView:{}};a.minifiedView=S({containerTitle:"Account.Addresses.minifiedView.containerTitle",editAddressFormTitle:"Account.Addresses.minifiedView.editAddressFormTitle",viewAllAddressesButton:"Account.Addresses.minifiedView.viewAllAddressesButton"}),a.fullSizeView=S({containerTitle:"Account.Addresses.fullSizeView.containerTitle",editAddressFormTitle:"Account.Addresses.fullSizeView.editAddressFormTitle",newAddressFormTitle:"Account.Addresses.fullSizeView.newAddressFormTitle",viewAllAddressesButton:"Account.Addresses.fullSizeView.viewAllAddressesButton"});const{keysSortOrder:m,submitLoading:_,isModalRendered:N,isFormRendered:T,loading:E,addNewAddress:A,addressesList:V,addressId:B,handleRenderForm:L,handleRenderModal:O,removeAddress:$,onCloseBtnClick:F,handleOnSuccess:R,setEditingAddressId:P,closeNewAddressForm:b,redirectToAddressesRoute:k}=we({minifiedView:e,routeAddressesPage:w,onSuccess:o});return C("div",{children:[i("div",{children:n?i(ie,{title:e?a.minifiedView.containerTitle:a.fullSizeView.containerTitle,divider:!e,className:e?"dropin-addresses-header":""}):null}),C("div",{className:M(["dropin-addresses-wrapper",t]),"data-testid":"addressesIdWrapper",children:[i(fe,{minifiedView:e,addressData:V.find(f=>f.id===B),keysSortOrder:m,submitLoading:_,open:N,closeModal:F,onRemoveAddress:$}),E?i(K,{testId:"addressSkeletonLoader",withCard:!1}):i(ce,{isEmpty:!V.length,typeList:"address",minifiedView:e}),V.map(f=>i(se,{children:B===f.id&&T?i(j,{variant:"secondary",style:{marginBottom:20},children:i(H,{isOpen:B===f.id&&T,addressFormId:B,inputsDefaultValueSet:f,addressesFormTitle:e?a.minifiedView.editAddressFormTitle:a.fullSizeView.editAddressFormTitle,showShippingCheckBox:d,showBillingCheckBox:r,shippingCheckBoxValue:p,billingCheckBoxValue:g,onCloseBtnClick:F,onSuccess:R,onError:u})}):i(G,{minifiedView:e,addressData:f,keysSortOrder:m,loading:E,setAddressId:P,handleRenderModal:e&&l||!e&&s?O:void 0,handleRenderForm:e&&l||!e&&s?L:void 0},f.id)},f.id)),i("div",{className:"dropin-addresses__footer",children:A?i("div",{className:M(["dropin-addresses-form__footer__wrapper",["dropin-addresses-form__footer__wrapper-show",A]]),children:i(j,{variant:"secondary",children:i(H,{isOpen:A,addressesFormTitle:a.fullSizeView.newAddressFormTitle,inputsDefaultValueSet:c,showShippingCheckBox:!!V.length,showBillingCheckBox:!!V.length,shippingCheckBoxValue:p,billingCheckBoxValue:g,onCloseBtnClick:b,onSuccess:R,onError:u})})}):i(me,{minifiedView:e,addNewAddress:A,routeAddressesPage:k})})]})]})},ke=({className:t,withHeader:n,minifiedView:e,withActionsInMinifiedView:l,withActionsInFullSizeView:s,inputsDefaultValueSet:c,showShippingCheckBox:d,showBillingCheckBox:r,shippingCheckBoxValue:p,billingCheckBoxValue:g,routeAddressesPage:w,onSuccess:o,onError:u})=>i("div",{className:M(["dropin-addresses",t]),"data-testid":"addressesid",children:i(ge,{className:t,withHeader:n,minifiedView:e,withActionsInMinifiedView:l,withActionsInFullSizeView:s,inputsDefaultValueSet:c,billingCheckBoxValue:g,shippingCheckBoxValue:p,showBillingCheckBox:r,showShippingCheckBox:d,routeAddressesPage:w,onSuccess:o,onError:u})});export{ke as Addresses,ke as default};

@@ -1,1 +0,1 @@

import{jsx as i,jsxs as p,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import{classes as w,Slot as S}from"@dropins/tools/lib.js";import{C as k}from"../chunks/AddressFormWrapper2.js";import"@dropins/tools/preact-compat.js";import{Card as y,Icon as C,Image as T,Header as b}from"@dropins/tools/components.js";import{S as v,c as H,E as x}from"../chunks/checkIsFunction.js";import{useCallback as I,useState as A,useEffect as B}from"@dropins/tools/preact-hooks.js";import{useText as h}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as E}from"../chunks/getOrderHistoryList.js";import"../chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-address.js";const N={size:"32",stroke:"2"},V=({minifiedView:n,orderId:r,orderToken:t,onSelectId:o,routeOrdersList:e,routeOrderDetails:f})=>{const s={minifiedView:{},fullSizeView:{}};s.minifiedView=h({viewAllOrdersButton:"Account.OrdersList.minifiedView.viewAllOrdersButton"});const l=I(()=>{o&&r&&(o==null||o(r))},[o,r]);return e?i("a",{className:w(["dropin-orders-list-action",["dropin-orders-list-action--minifiedView",n]]),"data-testid":"ordersListActionButtonMinifiedView",href:e(),onClick:l,children:i(y,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:p("div",{className:"dropin-orders-list-action__card-wrapper",children:[i("p",{children:s.minifiedView.viewAllOrdersButton}),i(C,{source:v,...N})]})})}):i("a",{href:H(f)?f(r,t):"#",onClick:l,className:"dropin-orders-list-action","data-testid":"ordersListActionButton",children:i(C,{source:v,...N})})},_=({minifiedView:n,item:r,withThumbnails:t,children:o,slots:e,...f})=>{var l,d,u,L;const s={minifiedView:{},fullSizeView:{}};return s.minifiedView=h({orderNumber:"Account.OrdersList.minifiedView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.minifiedView.OrdersListCard.itemsAmount"}),s.fullSizeView=h({orderNumber:"Account.OrdersList.fullSizeView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.fullSizeView.OrdersListCard.itemsAmount"}),p(y,{...f,className:w(["dropin-orders-list-card",["dropin-orders-list-card--full",((l=r==null?void 0:r.items)==null?void 0:l.length)>6]]),variant:"secondary",children:[i("div",{className:"dropin-orders-list-card--content",children:e!=null&&e.OrdersListCard?i(S,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:e==null?void 0:e.OrdersListCard,context:{orderHistoryListItem:r}}):p(z,{children:[i("div",{children:r==null?void 0:r.status}),i("p",{children:r==null?void 0:r.orderDate}),p("p",{children:[n?s.minifiedView.orderNumber:s.fullSizeView.orderNumber," ",r.number]}),p("p",{children:["$",(d=r==null?void 0:r.total)==null?void 0:d.grandTotal.value]}),p("p",{children:[(u=r==null?void 0:r.items)==null?void 0:u.length," ",n?s.minifiedView.itemsAmount:s.fullSizeView.itemsAmount]})]})}),t&&((L=r==null?void 0:r.items)!=null&&L.length)?i("div",{className:"dropin-orders-list-card--images","data-testid":"ordersListCardImages",children:r.items.map((a,c)=>{var g;const m=(g=a==null?void 0:a.product)==null?void 0:g.smallImage.url,O=a==null?void 0:a.productName;return i(T,{src:m,width:65,height:65,alt:O},a.id+c)})}):null,i("div",{className:"dropin-orders-list-card--actions",children:o})]})},$=({ordersInMinifiedView:n,minifiedView:r,pageSize:t})=>{const[o,e]=A([]),[f,s]=A({}),[l,d]=A(""),[u,L]=A(!1);B(()=>{L(!0),E(r?n:t).then(c=>{!c||!c.items||(s(c.pageInfo),e(c.items))}).finally(()=>{L(!1)})},[r,n,t]);const a=I(c=>{d(c)},[]);return{loading:u,orderHistoryListItems:o,pageInfo:f,selectedId:l,handleSelectId:a}},j=({className:n,withHeader:r=!0,minifiedView:t=!1,withThumbnails:o=!0,ordersInMinifiedView:e=1,pageSize:f=10,routeOrdersList:s,routeOrderDetails:l,slots:d})=>{const u={minifiedView:{},fullSizeView:{}};u.minifiedView=h({containerTitle:"Account.OrdersList.minifiedView.containerTitle"}),u.fullSizeView=h({containerTitle:"Account.OrdersList.fullSizeView.containerTitle"});const{loading:L,orderHistoryListItems:a,handleSelectId:c}=$({minifiedView:t,pageSize:f,ordersInMinifiedView:e});return p("div",{children:[r?i(b,{title:t?u.minifiedView.containerTitle:u.fullSizeView.containerTitle,divider:!t,className:t?"dropin-orders-list-header":""}):null,p("div",{className:w(["dropin-orders-list",n]),children:[L?i(k,{testId:"orderSkeletonLoader",withCard:!1}):i(x,{isEmpty:!a.length,typeList:"orders",minifiedView:t}),a.map((m,O)=>i(_,{minifiedView:t,item:m,withThumbnails:o,slots:d,children:d!=null&&d.OrdersListAction?i(S,{"data-testid":`ordersListActionSlot_${O}`,name:"OrdersListAction",slot:d==null?void 0:d.OrdersListAction,context:{handleSelectId:c,orderHistoryListItem:m}}):i(V,{minifiedView:t,onSelectId:c,orderId:m.id,orderToken:m.token,routeOrderDetails:l})},O)),t?i(V,{minifiedView:t,onSelectId:c,routeOrdersList:s}):null]})]})},Z=({className:n,withHeader:r,minifiedView:t,withThumbnails:o,withFilter:e,ordersInMinifiedView:f,pageSize:s,routeOrdersList:l,routeOrderDetails:d,slots:u})=>i("div",{className:w(["dropin-orders-list",n]),"data-testid":"ordersListId",children:i(j,{className:n,withHeader:r,minifiedView:t,withThumbnails:o,withFilter:e,ordersInMinifiedView:f,pageSize:s,routeOrdersList:l,routeOrderDetails:d,slots:u})});export{Z as OrdersList,Z as default};
import{jsx as t,jsxs as f,Fragment as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as D}from"@dropins/tools/lib.js";import{P as x,C as k}from"../chunks/AddressFormWrapper2.js";import"@dropins/tools/preact-compat.js";import{Card as b,Icon as N,Image as T,Header as M,Picker as H}from"@dropins/tools/components.js";import{S as z,c as Y,E}from"../chunks/checkIsFunction.js";import{useText as L}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import{useState as g,useEffect as P,useMemo as B,useCallback as F}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as $}from"../chunks/getOrderHistoryList.js";import"../chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-address.js";const C={size:"32",stroke:"2"},I=({minifiedView:i,orderNumber:r,orderToken:e,routeOrdersList:d,routeOrderDetails:s})=>{const a={minifiedView:{},fullSizeView:{}};return a.minifiedView=L({viewAllOrdersButton:"Account.OrdersList.minifiedView.viewAllOrdersButton"}),d?t("a",{className:A(["dropin-orders-list-action",["dropin-orders-list-action--minifiedView",i]]),"data-testid":"ordersListActionButtonMinifiedView",href:d(),children:t(b,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:f("div",{className:"dropin-orders-list-action__card-wrapper",children:[t("p",{children:a.minifiedView.viewAllOrdersButton}),t(N,{source:z,...C})]})})}):t("a",{href:Y(s)?s(r,e):"#",className:"dropin-orders-list-action","data-testid":"ordersListActionButton",children:t(N,{source:z,...C})})},J=({minifiedView:i,item:r,withThumbnails:e,children:d,slots:s,...a})=>{var l,p,n,o;const c={minifiedView:{},fullSizeView:{}};return c.minifiedView=L({orderNumber:"Account.OrdersList.minifiedView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.minifiedView.OrdersListCard.itemsAmount"}),c.fullSizeView=L({orderNumber:"Account.OrdersList.fullSizeView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.fullSizeView.OrdersListCard.itemsAmount"}),f(b,{...a,className:A(["dropin-orders-list-card",["dropin-orders-list-card--full",((l=r==null?void 0:r.items)==null?void 0:l.length)>6]]),variant:"secondary",children:[t("div",{className:"dropin-orders-list-card--content",children:s!=null&&s.OrdersListCard?t(D,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:s==null?void 0:s.OrdersListCard,context:{orderHistoryListItem:r}}):f(y,{children:[t("div",{children:r==null?void 0:r.status}),t("p",{children:r==null?void 0:r.orderDate}),f("p",{children:[i?c.minifiedView.orderNumber:c.fullSizeView.orderNumber," ",r.number]}),f("p",{children:["$",(p=r==null?void 0:r.total)==null?void 0:p.grandTotal.value]}),f("p",{children:[(n=r==null?void 0:r.items)==null?void 0:n.length," ",i?c.minifiedView.itemsAmount:c.fullSizeView.itemsAmount]})]})}),e&&((o=r==null?void 0:r.items)!=null&&o.length)?t("div",{className:"dropin-orders-list-card--images","data-testid":"ordersListCardImages",children:r.items.map((u,m)=>{var h;const w=(h=u==null?void 0:u.product)==null?void 0:h.smallImage.url,S=u==null?void 0:u.productName;return t(T,{src:w,width:65,height:65,alt:S},u.id+m)})}):null,t("div",{className:"dropin-orders-list-card--actions",children:d})]})},_=({ordersInMinifiedView:i,minifiedView:r,pageSize:e,selectedDate:d})=>{const[s,a]=g([]),[c,l]=g({}),[p,n]=g(!1);return P(()=>{a([]),n(!0),$(r?i:e,d).then(o=>{!o||!o.items||(l(o.pageInfo),a(o.items))}).finally(()=>{n(!1)})},[r,i,e,d]),{loading:p,orderHistoryListItems:s,pageInfo:c}},v=i=>{const r=new Date,e=new Date(r);switch(i){case"sixMonthsAgo":{e.setMonth(e.getMonth()-6);break}case"oneYearAgo":{e.setFullYear(e.getFullYear()-1);break}default:return""}return{from:e.toISOString().split("T")[0],to:`${r.toISOString().split("T")[0]} 23:59:59`}},j=()=>{const i=L({pastSixMonths:"Account.OrdersList.fullSizeView.OrdersListSelectDate.pastSixMonths",currentYear:"Account.OrdersList.fullSizeView.OrdersListSelectDate.currentYear",viewAll:"Account.OrdersList.fullSizeView.OrdersListSelectDate.viewAll"}),[r,e]=g(JSON.stringify(v("sixMonthsAgo"))),d=B(()=>[{value:JSON.stringify(v("sixMonthsAgo")),text:i.pastSixMonths},{value:JSON.stringify(v("oneYearAgo")),text:i.currentYear},{value:"",text:i.viewAll}],[i]),s=F(a=>{const l=a.target.value;e(l)},[]);return{selectableDateList:d,selectedDate:r,handleSelectDate:s}},R=({className:i,withHeader:r=!0,minifiedView:e=!1,withThumbnails:d=!0,withFilter:s=!0,ordersInMinifiedView:a=1,pageSize:c=10,routeOrdersList:l,routeOrderDetails:p,slots:n})=>{const o={minifiedView:{},fullSizeView:{}};o.minifiedView=L({containerTitle:"Account.OrdersList.minifiedView.containerTitle"}),o.fullSizeView=L({containerTitle:"Account.OrdersList.fullSizeView.containerTitle"}),o.fullSizeView=L({titleSelectOrder:"Account.OrdersList.fullSizeView.titleSelectOrder"});const{selectableDateList:u,selectedDate:m,handleSelectDate:w}=j(),{loading:S,orderHistoryListItems:h}=_({minifiedView:e,pageSize:c,ordersInMinifiedView:a,selectedDate:m});return f("div",{children:[r?t(M,{title:e?o.minifiedView.containerTitle:o.fullSizeView.containerTitle,divider:!e,className:e?"dropin-orders-list-header":""}):null,f("div",{className:A(["dropin-orders-list",i]),children:[!e&&s?t("div",{className:"dropin-orders-list--date-select",children:S?t(x,{"data-testid":"selectPickerLoader"}):f(y,{children:[t("span",{children:o.fullSizeView.titleSelectOrder}),t(H,{value:m,name:"orderDatePicker",options:u,handleSelect:w})]})}):null,S?t(k,{testId:"orderSkeletonLoader",withCard:!1}):t(E,{isEmpty:!h.length,typeList:"orders",minifiedView:e}),h.map((O,V)=>t(J,{minifiedView:e,item:O,withThumbnails:d,slots:n,children:n!=null&&n.OrdersListAction?t(D,{"data-testid":`ordersListActionSlot_${V}`,name:"OrdersListAction",slot:n==null?void 0:n.OrdersListAction,context:{orderHistoryListItem:O}}):t(I,{minifiedView:e,orderNumber:O.number,orderToken:O.token,routeOrderDetails:p})},V)),e?t(I,{minifiedView:e,routeOrdersList:l}):null]})]})},dr=({className:i,withHeader:r,minifiedView:e,withThumbnails:d,withFilter:s,ordersInMinifiedView:a,pageSize:c,routeOrdersList:l,routeOrderDetails:p,slots:n})=>t("div",{className:A(["dropin-orders-list",i]),"data-testid":"ordersListId",children:t(R,{className:i,withHeader:r,minifiedView:e,withThumbnails:d,withFilter:s,ordersInMinifiedView:a,pageSize:c,routeOrdersList:l,routeOrderDetails:p,slots:n})});export{dr as OrdersList,dr as default};
import { OrderDetails } from '../../data/models';
import { useOrdersListProps } from '../../types';
export declare const useOrdersList: ({ ordersInMinifiedView, minifiedView, pageSize, }: useOrdersListProps) => {
export declare const useOrdersList: ({ ordersInMinifiedView, minifiedView, pageSize, selectedDate, }: useOrdersListProps) => {
loading: boolean;
orderHistoryListItems: OrderDetails[];
pageInfo: {};
selectedId: string;
handleSelectId: (id: string) => void;
};
//# sourceMappingURL=useOrdersList.d.ts.map

@@ -32,5 +32,11 @@ declare const _default: {

"containerTitle": "Your orders",
"titleSelectOrder": "Date order placed",
"OrdersListCard": {
"orderNumber": "Order number:",
"itemsAmount": "items"
},
"OrdersListSelectDate":{
"pastSixMonths": "Past 6 months",
"currentYear": "Current year",
"viewAll": "View all"
}

@@ -37,0 +43,0 @@ }

@@ -1,1 +0,1 @@

{"name": "@dropins/storefront-account", "version": "0.1.0-alpha6", "@dropins/elsie": "0.29.0"}
{"name": "@dropins/storefront-account", "version": "0.1.0-alpha7", "@dropins/elsie": "0.29.0"}

@@ -1,3 +0,3 @@

(function(o,i){try{if(typeof document<"u"){const r=document.createElement("style"),n=i.styleId;for(const d in i.attributes)r.setAttribute(d,i.attributes[d]);r.setAttribute("data-dropin",n),r.appendChild(document.createTextNode(o));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(r);else{const d=document.querySelector('link[rel="stylesheet"], style');d?d.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-orders-list-header{margin-bottom:var(--spacing-medium)}
.dropin-form{display:flex;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.dropin-form{display:grid;grid-template-columns:repeat(2,1fr)}.dropin-form>.dropin-field:nth-child(1),.dropin-form>.dropin-field:nth-child(2){grid-column:span 1}.dropin-form>.dropin-field:nth-child(3),.dropin-form>.dropin-field:nth-child(4),.dropin-form>.dropin-field:nth-child(5){grid-column:span 2}.dropin-form>.dropin-field:nth-child(6),.dropin-form>.dropin-field:nth-child(7){grid-column:span 1}.dropin-form>.dropin-field:nth-child(8),.dropin-form>.dropin-field:nth-child(9){grid-column:span 1}.dropin-form>.dropin-field:nth-child(n+10){grid-column:span 2}}.dropin-form [class$=-hidden]{position:absolute;opacity:0;height:0;width:0;overflow:hidden;clip:rect(0,0,0,0)}.dropin-address-card{border-radius:var(--shape-border-radius-1);margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1)}.dropin-address-card .dropin-card__content{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-small) 0px;grid-template-areas:"description action" "labels action"}.dropin-address-card .dropin-address-card__action{display:flex;justify-content:flex-end;align-items:baseline;cursor:pointer;grid-area:action}.dropin-address-card .dropin-address-card__action--editbutton{margin-left:var(--spacing-small)}.dropin-address-card .dropin-address-card__action button{padding:0}.dropin-address-card .dropin-address-card__action button:hover{text-decoration:underline}.dropin-address-card .dropin-address-card__description{grid-area:description;margin:0;padding:0}.dropin-address-card .dropin-address-card__description p{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800);margin:0;padding:0;display:inline;overflow:hidden}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(2){margin:0 0 var(--spacing-small) 0;color:var(--color-neutral-800);font:var(--type-button-2-font);text-align:left;font-weight:500;cursor:default}.dropin-address-card__description p{margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(5),.dropin-address-card .dropin-address-card__description p:nth-child(7){float:left;width:auto;margin-right:var(--spacing-xsmall)}.dropin-address-card .dropin-address-card__description p:nth-child(2),.dropin-address-card .dropin-address-card__description p:nth-child(6),.dropin-address-card .dropin-address-card__description p:nth-child(8){display:inline;width:50%}.dropin-address-card .dropin-address-card__description p:nth-child(2):after,.dropin-address-card .dropin-address-card__description p:nth-child(6):after,.dropin-address-card .dropin-address-card__description p:nth-child(8):after{content:"\\a";white-space:pre;display:block;height:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(3),.dropin-address-card .dropin-address-card__description p:nth-child(4),.dropin-address-card .dropin-address-card__description p:nth-child(n+9){display:block;width:100%;margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__labels{display:flex;gap:0 var(--spacing-xsmall);grid-area:labels}.dropin-account-loaders--card-loader{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-actions-address{cursor:pointer;padding:var(--spacing-xsmall) var(--spacing-medium);border-radius:var(--shape-border-radius-1);border:var(--shape-border-width-1) solid var(--color-neutral-400);background-color:var(--color-neutral-50);width:100%;height:88px;display:flex;align-items:center;justify-content:space-between}.dropin-actions-address--title{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-actions-address svg{stroke:var(--shape-icon-stroke-4);color:var(--color-neutral-800)}.dropin-address-modal{position:relative;padding:var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig);width:100%;margin:auto;max-width:721px}.dropin-modal__body--medium>.dropin-modal__header-title,.dropin-modal__body--full>.dropin-modal__header-title,.dropin-address-modal .dropin-modal__content{margin:0;align-items:center}.dropin-address-modal .dropin-modal__header-title-content h3{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0;padding:0}.dropin-address-modal .dropin-address-modal__spinner{position:absolute;top:0;left:0;background-color:var(--color-neutral-200);opacity:.8;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1}.dropin-address-modal p{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-modal .dropin-address-modal__wrapper--buttons{display:flex;align-items:center;justify-content:right;gap:0 var(--spacing-small)}.dropin-empty-list{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-empty-list.dropin-empty-list--minified,.dropin-empty-list .dropin-card{border:none}.dropin-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.dropin-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.dropin-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.dropin-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.dropin-orders-list-action{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.dropin-orders-list-action--minifiedView{width:100%;text-align:left;font:var(--type-body-1-default-font)}.dropin-orders-list-action.dropin-orders-list-action--minifiedView:hover{text-decoration:none}.dropin-orders-list-action--minifiedView .dropin-orders-list-action__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.dropin-orders-list-action__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-orders-list-action__card-wrapper svg,.dropin-orders-list-action svg{color:var(--color-neutral-800)}.dropin-orders-list-action--minifiedView .dropin-card--secondary{border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-action--minifiedView .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.dropin-orders-list-action--minifiedView p{font:var(--type-body-1-strong-font)}.dropin-orders-list-card{height:100%;margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-card .dropin-card__content{padding:var(--spacing-medium);display:grid;grid-template-areas:"content actions" "imageList actions";gap:0;max-height:100%}.dropin-orders-list-card .dropin-orders-list-card--content{grid-area:content;margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--content>div:first-child{font-weight:500}.dropin-orders-list-card .dropin-orders-list-card--content p,.dropin-orders-list-card .dropin-orders-list-card--content div{padding:0;text-align:left;font:var(--type-body-1-default-font);margin-bottom:var(--spacing-small);color:var(--color-neutral-800)}.dropin-orders-list-card .dropin-orders-list-card--content p:last-child{margin:0}.dropin-orders-list-card .dropin-orders-list-card--content div{font:var(--type-button-2-font);margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--actions{grid-area:actions}.dropin-orders-list-card .dropin-orders-list-card--images{max-width:calc(6 * 65px + 5 * var(--spacing-small));grid-area:imageList;display:grid;grid-template-columns:repeat(auto-fill,65px);grid-template-rows:65px;gap:var(--spacing-small);overflow:hidden}.dropin-orders-list-card .dropin-orders-list-card--images img{object-fit:contain;width:65px;height:65px}.dropin-orders-list-card .dropin-orders-list-card--actions{position:relative;align-self:center;margin-left:auto}@media (min-width: 768px){.dropin-orders-list-card .dropin-card__content{max-height:290px}.dropin-orders-list-card.dropin-orders-list-card--full .dropin-card__content{max-height:100%}}.dropin-addresses-header{margin-bottom:var(--spacing-medium)}.dropin-addresses-wrapper{box-sizing:border-box;position:relative}.dropin-address-form-wrapper{box-sizing:border-box;background-color:var(--color-neutral-50)}.dropin-address-form-wrapper--notification{margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--buttons{display:flex;align-items:center;justify-content:end;gap:0 var(--spacing-medium);margin-top:var(--spacing-medium)}.dropin-address-form-wrapper--buttons button{min-width:142px}`,{styleId:"account"});
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as o}from"@dropins/tools/lib.js";import{useState as n,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const c={EmptyList:{minifiedView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}},fullSizeView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}}},OrdersList:{minifiedView:{containerTitle:"Recent orders",viewAllOrdersButton:"View all orders",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"}},fullSizeView:{containerTitle:"Your orders",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"}}},Addresses:{minifiedView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",viewAllAddressesButton:"View address list",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}},fullSizeView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",newAddressFormTitle:"Add address",addNewAddressButton:"Create new",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}}},AddressForm:{formText:{secondaryButton:"Cancel",primaryButton:"Save",defaultShippingLabel:"Set as default shipping address",defaultBillingLabel:"Set as default billing address"}},FormText:{requiredFieldError:"This is a required field."}},u={Account:c},f={default:u},p=({children:s})=>{const[d,i]=n("en_US");return a(()=>{const e=m.on("locale",t=>{i(t)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:d,langDefinitions:f,children:s})},L=new o(r(p,{}));export{L as render};
(function(o,i){try{if(typeof document<"u"){const r=document.createElement("style"),n=i.styleId;for(const d in i.attributes)r.setAttribute(d,i.attributes[d]);r.setAttribute("data-dropin",n),r.appendChild(document.createTextNode(o));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(r);else{const d=document.querySelector('link[rel="stylesheet"], style');d?d.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-orders-list-header{margin-bottom:var(--spacing-medium)}.dropin-orders-list--date-select{margin-bottom:var(--spacing-xbig)}.dropin-orders-list--date-select span{display:inline-block;font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);margin-bottom:var(--spacing-xsmall)}.dropin-orders-list--date-select .dropin-picker{max-width:224px}
.dropin-form{display:flex;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.dropin-form{display:grid;grid-template-columns:repeat(2,1fr)}.dropin-form>.dropin-field:nth-child(1),.dropin-form>.dropin-field:nth-child(2){grid-column:span 1}.dropin-form>.dropin-field:nth-child(3),.dropin-form>.dropin-field:nth-child(4),.dropin-form>.dropin-field:nth-child(5){grid-column:span 2}.dropin-form>.dropin-field:nth-child(6),.dropin-form>.dropin-field:nth-child(7){grid-column:span 1}.dropin-form>.dropin-field:nth-child(8),.dropin-form>.dropin-field:nth-child(9){grid-column:span 1}.dropin-form>.dropin-field:nth-child(n+10){grid-column:span 2}}.dropin-form [class$=-hidden]{position:absolute;opacity:0;height:0;width:0;overflow:hidden;clip:rect(0,0,0,0)}.dropin-address-card{border-radius:var(--shape-border-radius-1);margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1)}.dropin-address-card .dropin-card__content{display:grid;grid-template-columns:1fr auto;gap:var(--spacing-small) 0px;grid-template-areas:"description action" "labels action"}.dropin-address-card .dropin-address-card__action{display:flex;justify-content:flex-end;align-items:baseline;cursor:pointer;grid-area:action}.dropin-address-card .dropin-address-card__action--editbutton{margin-left:var(--spacing-small)}.dropin-address-card .dropin-address-card__action button{padding:0}.dropin-address-card .dropin-address-card__action button:hover{text-decoration:underline}.dropin-address-card .dropin-address-card__description{grid-area:description;margin:0;padding:0}.dropin-address-card .dropin-address-card__description p{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800);margin:0;padding:0;display:inline;overflow:hidden}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(2){margin:0 0 var(--spacing-small) 0;color:var(--color-neutral-800);font:var(--type-button-2-font);text-align:left;font-weight:500;cursor:default}.dropin-address-card__description p{margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(1),.dropin-address-card .dropin-address-card__description p:nth-child(5),.dropin-address-card .dropin-address-card__description p:nth-child(7){float:left;width:auto;margin-right:var(--spacing-xsmall)}.dropin-address-card .dropin-address-card__description p:nth-child(2),.dropin-address-card .dropin-address-card__description p:nth-child(6),.dropin-address-card .dropin-address-card__description p:nth-child(8){display:inline;width:50%}.dropin-address-card .dropin-address-card__description p:nth-child(2):after,.dropin-address-card .dropin-address-card__description p:nth-child(6):after,.dropin-address-card .dropin-address-card__description p:nth-child(8):after{content:"\\a";white-space:pre;display:block;height:var(--spacing-small)}.dropin-address-card .dropin-address-card__description p:nth-child(3),.dropin-address-card .dropin-address-card__description p:nth-child(4),.dropin-address-card .dropin-address-card__description p:nth-child(n+9){display:block;width:100%;margin-bottom:var(--spacing-small)}.dropin-address-card .dropin-address-card__labels{display:flex;gap:0 var(--spacing-xsmall);grid-area:labels}.dropin-account-loaders--card-loader{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-account-loaders--picker-loader div:first-child{max-width:200px}.dropin-account-loaders--picker-loader div:nth-child(3){max-width:400px}.dropin-actions-address{cursor:pointer;padding:var(--spacing-xsmall) var(--spacing-medium);border-radius:var(--shape-border-radius-1);border:var(--shape-border-width-1) solid var(--color-neutral-400);background-color:var(--color-neutral-50);width:100%;height:88px;display:flex;align-items:center;justify-content:space-between}.dropin-actions-address--title{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-actions-address svg{stroke:var(--shape-icon-stroke-4);color:var(--color-neutral-800)}.dropin-address-modal{position:relative;padding:var(--spacing-xbig) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig);width:100%;margin:auto;max-width:721px}.dropin-modal__body--medium>.dropin-modal__header-title,.dropin-modal__body--full>.dropin-modal__header-title,.dropin-address-modal .dropin-modal__content{margin:0;align-items:center}.dropin-address-modal .dropin-modal__header-title-content h3{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0;padding:0}.dropin-address-modal .dropin-address-modal__spinner{position:absolute;top:0;left:0;background-color:var(--color-neutral-200);opacity:.8;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1}.dropin-address-modal p{color:var(--color-neutral-800);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-modal .dropin-address-modal__wrapper--buttons{display:flex;align-items:center;justify-content:right;gap:0 var(--spacing-small)}.dropin-empty-list{margin-bottom:var(--spacing-small);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-empty-list.dropin-empty-list--minified,.dropin-empty-list .dropin-card{border:none}.dropin-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.dropin-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.dropin-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.dropin-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.dropin-empty-list.dropin-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.dropin-orders-list-action{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.dropin-orders-list-action--minifiedView{width:100%;text-align:left;font:var(--type-body-1-default-font)}.dropin-orders-list-action.dropin-orders-list-action--minifiedView:hover{text-decoration:none}.dropin-orders-list-action--minifiedView .dropin-orders-list-action__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.dropin-orders-list-action__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-orders-list-action__card-wrapper svg,.dropin-orders-list-action svg{color:var(--color-neutral-800)}.dropin-orders-list-action--minifiedView .dropin-card--secondary{border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-action--minifiedView .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.dropin-orders-list-action--minifiedView p{font:var(--type-body-1-strong-font)}.dropin-orders-list-card{height:100%;margin-bottom:var(--spacing-small);border-width:var(--shape-border-width-1);border-radius:var(--shape-border-radius-1)}.dropin-orders-list-card .dropin-card__content{padding:var(--spacing-medium);display:grid;grid-template-areas:"content actions" "imageList actions";gap:0;max-height:100%}.dropin-orders-list-card .dropin-orders-list-card--content{grid-area:content;margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--content>div:first-child{font-weight:500}.dropin-orders-list-card .dropin-orders-list-card--content p,.dropin-orders-list-card .dropin-orders-list-card--content div{padding:0;text-align:left;font:var(--type-body-1-default-font);margin-bottom:var(--spacing-small);color:var(--color-neutral-800)}.dropin-orders-list-card .dropin-orders-list-card--content p:last-child{margin:0}.dropin-orders-list-card .dropin-orders-list-card--content div{font:var(--type-button-2-font);margin-bottom:var(--spacing-small)}.dropin-orders-list-card .dropin-orders-list-card--actions{grid-area:actions}.dropin-orders-list-card .dropin-orders-list-card--images{max-width:calc(6 * 65px + 5 * var(--spacing-small));grid-area:imageList;display:grid;grid-template-columns:repeat(auto-fill,65px);grid-template-rows:65px;gap:var(--spacing-small);overflow:hidden}.dropin-orders-list-card .dropin-orders-list-card--images img{object-fit:contain;width:65px;height:65px}.dropin-orders-list-card .dropin-orders-list-card--actions{position:relative;align-self:center;margin-left:auto}@media (min-width: 768px){.dropin-orders-list-card .dropin-card__content{max-height:290px}.dropin-orders-list-card.dropin-orders-list-card--full .dropin-card__content{max-height:100%}}.dropin-addresses-header{margin-bottom:var(--spacing-medium)}.dropin-addresses-wrapper{box-sizing:border-box;position:relative}.dropin-addresses-wrapper .dropin-addresses__footer .dropin-card--secondary{border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-address-form-wrapper{box-sizing:border-box;background-color:var(--color-neutral-50)}.dropin-address-form-wrapper--notification{margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin-bottom:var(--spacing-medium)}.dropin-address-form-wrapper--buttons{display:flex;align-items:center;justify-content:end;gap:0 var(--spacing-medium);margin-top:var(--spacing-medium)}.dropin-address-form-wrapper--buttons button{min-width:142px}`,{styleId:"account"});
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as o}from"@dropins/tools/lib.js";import{useState as a,useEffect as n}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as m}from"@dropins/tools/event-bus.js";const c={EmptyList:{minifiedView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}},fullSizeView:{Addresses:{message:"No saved addresses"},OrdersList:{message:"No orders"}}},OrdersList:{minifiedView:{containerTitle:"Recent orders",viewAllOrdersButton:"View all orders",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"}},fullSizeView:{containerTitle:"Your orders",titleSelectOrder:"Date order placed",OrdersListCard:{orderNumber:"Order number:",itemsAmount:"items"},OrdersListSelectDate:{pastSixMonths:"Past 6 months",currentYear:"Current year",viewAll:"View all"}}},Addresses:{minifiedView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",viewAllAddressesButton:"View address list",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}},fullSizeView:{containerTitle:"Addresses",editAddressFormTitle:"Edit address",newAddressFormTitle:"Add address",addNewAddressButton:"Create new",addressCard:{actionRemove:"Remove",actionEdit:"Edit",cardLabelShipping:"Shipping",cardLabelBilling:"Billing"},removeAddressModal:{title:"Remove address",description:"Are you sure you would like to remove this address?",actionCancel:"Cancel",actionConfirm:"Remove"}}},AddressForm:{formText:{secondaryButton:"Cancel",primaryButton:"Save",defaultShippingLabel:"Set as default shipping address",defaultBillingLabel:"Set as default billing address"}},FormText:{requiredFieldError:"This is a required field."}},u={Account:c},f={default:u},p=({children:s})=>{const[d,i]=a("en_US");return n(()=>{const e=m.on("locale",t=>{i(t)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:d,langDefinitions:f,children:s})},L=new o(r(p,{}));export{L as render};

@@ -7,3 +7,2 @@ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';

orderHistoryListItem: OrderDetails;
handleSelectId: (id: string) => void;
}

@@ -39,7 +38,6 @@ export interface OrdersListCardContext {

minifiedView: boolean;
orderId?: string;
orderNumber?: string;
orderToken?: string;
onSelectId?: (id: string) => void;
routeOrdersList?: () => string;
routeOrderDetails?: (orderId?: string, orderToken?: string) => string;
routeOrderDetails?: (orderNumber?: string, orderToken?: string) => string;
}

@@ -50,3 +48,4 @@ export interface useOrdersListProps {

ordersInMinifiedView: number;
selectedDate: string;
}
//# sourceMappingURL=ordersList.types.d.ts.map
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc