@dropins/storefront-account 0.1.0-alpha7 → 0.1.0-alpha9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- 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";
1
+ 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 date_of_first_order\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";
2
2
  //# sourceMappingURL=getOrderHistoryList.graphql.d.ts.map
@@ -1 +1 @@
1
- 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
+ import{jsx as a,Fragment as H,jsxs as O}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as Z,useState as y,useEffect as U,useCallback as M}from"@dropins/tools/preact-hooks.js";import{useText as q}from"@dropins/tools/i18n.js";import{classes as S,Slot as P}from"@dropins/tools/lib.js";import{memo as C,useCallback as L}from"@dropins/tools/preact-compat.js";import{Field as _,Picker as X,Input as j,InputDate as w,Checkbox as B,TextArea as Y,Skeleton as F,SkeletonRow as $,Card as J}from"@dropins/tools/components.js";const K=e=>e.reduce((d,p)=>({...d,[p.name]:p.value}),{}),Q=e=>/^\d+$/.test(e),ee=e=>/^[a-zA-Z0-9\s]+$/.test(e),re=e=>/^[a-zA-Z0-9]+$/.test(e),ae=e=>/^[a-zA-Z]+$/.test(e),te=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),le=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),ne=(e,d,p)=>{const s=new Date(e).getTime()/1e3;return isNaN(s)||s<0?!1:s>=d&&s<=p},W=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],oe=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),de=(e,d,p)=>{const s=e.length;return s>=d&&s<=p},R=(e,d,p,s)=>{var V;const{requiredFieldError:n,lengthTextError:T,numericError:f,alphaNumWithSpacesError:l,alphaNumericError:m,alphaError:x,emailError:I,dateError:v,urlError:g,dateLengthError:r}=p,{validateRules:c,code:u,required:o}=d,t=u,A={[t]:""};if(s[t]&&delete s[t],o&&!e)return{[t]:n};if(!o&&!e||!c.length)return A;const i=K(c),h=i.MIN_TEXT_LENGTH??1,N=i.MAX_TEXT_LENGTH??255,D=i.DATE_RANGE_MIN,E=i.DATE_RANGE_MAX;if(!de(e,+h,+N)&&!(D||E))return{[t]:T.replace("{min}",h).replace("{max}",N)};if(!ne(e,+D,+E)&&(D||E))return{[t]:r.replace("{min}",W(D)).replace("{max}",W(E))};const k={numeric:{validate:Q,error:f},"alphanum-with-spaces":{validate:ee,error:l},alphanumeric:{validate:re,error:m},alpha:{validate:ae,error:x},email:{validate:te,error:I},date:{validate:le,error:v},url:{validate:oe,error:g}}[i.INPUT_VALIDATION];return k&&!k.validate(e)&&!((V=s[t])!=null&&V.length)?{[t]:k.error}:A},se=e=>e.reduce((d,{code:p,required:s,defaultValue:n})=>(s&&p&&(d[p]=n||""),d),{}),ce=({fieldsConfig:e,onSubmit:d,handleSetCountryCode:p,onChange:s})=>{const n=q({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),T=Z(null),[f,l]=y({}),[m,x]=y({}),[I,v]=y({previousCountryCode:null,previousRegionCode:null,initialLoad:!0});U(()=>{var A;const o=f.country_code,t=e==null?void 0:e.find(i=>i.code==="region");if(I.initialLoad)v(i=>({...i,previousCountryCode:o,initialLoad:!1}));else if(I.previousCountryCode!==o){v(h=>({...h,previousCountryCode:o}));const i=!((A=t==null?void 0:t.options)!=null&&A.length)&&!(t!=null&&t.defaultValue)||I.previousRegionCode?"":(t==null?void 0:t.defaultValue)??"";l(h=>({...h,region:i})),p(o)}t!=null&&t.defaultValue&&I.previousCountryCode===o&&v(i=>({...i,previousRegionCode:t.defaultValue}))},[e,f,I.previousCountryCode,I.initialLoad,I.previousRegionCode,p,l]),U(()=>{if(!(e!=null&&e.length))return;const o=se(e);l(o)},[e==null?void 0:e.length]);const g=M(o=>{const t=o.currentTarget,A=o.target,i=new FormData(t),h=Object.fromEntries(i.entries()),N={[A.name]:h[A.name]&&String(h[A.name])};s==null||s(h,N,o)},[s]),r=M(o=>{const{name:t,value:A,type:i,checked:h}=o==null?void 0:o.target,N=i==="checkbox"?h:A;l(E=>({...E,[t]:N}));const D=e.find(E=>E.id===t);if(D){const E={...m},b=R(N.toString(),D,n,E);b&&Object.assign(E,b),x(E)}},[m,e,n]),c=M(o=>{const{name:t,value:A,type:i,checked:h}=o==null?void 0:o.target,N=i==="checkbox"?h:A,D=e.find(E=>E.id===t);if(D){const E={...m},b=R(N.toString(),D,n,E);b&&Object.assign(E,b),x(E)}},[m,e,n]),u=M(o=>{o.preventDefault();let t=!0;const A={...m};let i=null;for(const[h,N]of Object.entries(f)){const D=e.find(b=>b.id===h),E=R(N.toString(),D,n,A);E[h]&&(Object.assign(A,E),t=!1),i||(i=Object.keys(A).find(b=>A[b])||null)}if(x(A),i&&T.current){const h=T.current.elements.namedItem(i);h==null||h.focus()}d==null||d(o,t)},[m,e,n,f,d]);return{formData:f,errors:m,formRef:T,handleInputChange:r,handleFormChange:g,handleBlur:c,handleSubmit:u}};var z=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(z||{});const ie=C(({loading:e,values:d,fields:p=[],errors:s,className:n="",onChange:T,onBlur:f})=>{const l=`${n}__field`,m=L((r,c,u)=>a(_,{error:u,className:S([l,`${l}--${r.id}`,[`${l}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${n}--${r.id}`,disabled:e,children:a(X,{name:r.id,floatingLabel:`${r.label} ${r.required?"*":""}`,placeholder:r.label,"aria-label":r.label,options:r.options,onBlur:f,handleSelect:T,value:c||r.defaultValue})},r.id),[n,e,l,f,T]),x=L((r,c,u)=>a(_,{error:u,className:S([l,`${l}--${r.id}`,[`${l}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${n}--${r.id}`,disabled:e,children:a(j,{type:"text",name:r.id,value:c??r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,onBlur:f,onChange:T})},r.id),[n,e,l,f,T]),I=L((r,c,u)=>a(_,{error:u,className:S([l,`${l}--${r.id}`,[`${l}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${n}--${r.id}`,disabled:e,children:a(w,{type:"text",name:r.id,value:c||r.defaultValue,placeholder:r.label,floatingLabel:`${r.label} ${r.required?"*":""}`,onBlur:f,onChange:T})},r.id),[n,e,l,f,T]),v=L((r,c,u)=>a(_,{error:u,className:S([l,`${l}--${r.id}`,[`${l}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${n}--${r.id}`,disabled:e,children:a(B,{name:r.id,checked:c||r.defaultValue,placeholder:r.label,label:`${r.label} ${r.required?"*":""}`,onBlur:f,onChange:T})},r.id),[n,e,l,f,T]),g=L((r,c,u)=>a(_,{error:u,className:S([l,`${l}--${r.id}`,[`${l}--${r.id}-hidden`,r.isHidden],r.className]),"data-testid":`${n}--${r.id}`,disabled:e,children:a(Y,{type:"text",name:r.id,value:c??r.defaultValue,label:`${r.label} ${r.required?"*":""}`,onBlur:f,onChange:T})},r.id),[n,e,l,f,T]);return p.length?a(H,{children:p.map(r=>{const c=s==null?void 0:s[r.id],u=d==null?void 0:d[r.id];switch(r.fieldType){case z.TEXT:return r.options.length?m(r,u,c):x(r,u,c);case z.MULTILINE:return x(r,u,c);case z.SELECT:return m(r,u,c);case z.DATE:return I(r,u,c);case z.BOOLEAN:return v(r,u,c);case"TEXTAREA":return g(r,u,c);default:return null}})}):null}),Te=C(({slots:e,name:d,loading:p,children:s,className:n="defaultForm",fieldsConfig:T,onSubmit:f,handleSetCountryCode:l,onChange:m})=>{const{formData:x,errors:I,formRef:v,handleInputChange:g,handleFormChange:r,handleBlur:c,handleSubmit:u}=ce({fieldsConfig:T,onSubmit:f,handleSetCountryCode:l,onChange:m});return O("form",{className:S(["dropin-form",n]),onSubmit:u,onChange:r,name:d,ref:v,children:[a(ie,{className:n,loading:p,fields:T,onChange:g,onBlur:c,errors:I,values:x}),e!=null&&e.AddressFormInputs?a(P,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:e.AddressFormInputs,context:{formActions:{handleChange:g}}}):null,s]})}),$e=({testId:e,withCard:d=!0})=>{const p=O(F,{"data-testid":e||"skeletonLoader",children:[a($,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a($,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a($,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return d?p:a(J,{variant:"secondary",className:S(["dropin-account-loaders","dropin-account-loaders--card-loader"]),children:p})},me=()=>O(F,{"data-testid":"addressFormLoader",children:[a($,{variant:"heading",size:"medium"}),a($,{variant:"empty",size:"medium"}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large",fullWidth:!0}),a($,{size:"large",fullWidth:!0,lines:3}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large"}),a($,{size:"large",fullWidth:!0})]}),Ie=e=>O(F,{...e,rowGap:"xsmall",className:S(["dropin-account-loaders","dropin-account-loaders--picker-loader"]),children:[a($,{variant:"heading",size:"xsmall"}),a($,{variant:"empty",size:"small"}),a($,{size:"small"})]}),G={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:z.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},De={...G,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ne={...G,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"};export{me as A,$e as C,Te as F,Ie as P,Ne as a,De as d};
@@ -1,4 +1,4 @@
1
- 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=`
1
+ import{c as i,f as u,h as m,a as _}from"./convertCase.js";import{t as c}from"./transform-customer-address.js";const f=(t,e="en-US",o={})=>{const a={...{day:"2-digit",month:"2-digit",year:"numeric"},...o},s=new Date(t);return isNaN(s.getTime())?"Invalid Date":new Intl.DateTimeFormat(e,a).format(s)},p=t=>{var s,d;if(!((d=(s=t.data)==null?void 0:s.customer)!=null&&d.orders))return null;const{items:e,page_info:o,total_count:r,date_of_first_order:a}=t.data.customer.orders;return{items:e.map(n=>{const l={...n,order_date:f(n.order_date),shipping_address:c(n.shipping_address),billing_address:c(n.billing_address)};return i(l,"camelCase",{})}),pageInfo:i(o,"camelCase",{}),totalCount:i(r,"camelCase",{}),dateOfFirstOrder:i(a,"camelCase",{})}},g=`
2
2
  query GET_CUSTOMER_ORDERS_LIST($pageSize: Int, $filter: CustomerOrdersFilterInput, $sort: CustomerOrderSortInput) {
3
3
  customer {
4
4
  orders(pageSize: $pageSize, filter: $filter, sort: $sort) {
@@ -7,6 +7,7 @@ import{c as i,f as l,h as u,a as m}from"./convertCase.js";import{t as d}from"./t
7
7
  total_pages
8
8
  current_page
9
9
  }
10
+ date_of_first_order
10
11
  total_count
11
12
  items {
12
13
  token
@@ -87,4 +88,4 @@ import{c as i,f as l,h as u,a as m}from"./convertCase.js";import{t as d}from"./t
87
88
  }
88
89
  }
89
90
  }
90
- `,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};
91
+ `,O=async(t,e)=>{const o=e?{order_date:JSON.parse(e)}:{};return await u(g,{method:"GET",cache:"no-cache",variables:{pageSize:t,filter:o,sort:{sort_direction:"DESC",sort_field:"CREATED_AT"}}}).then(r=>{var a;return(a=r.errors)!=null&&a.length?m(r.errors):p(r)}).catch(_)};export{O as g};
@@ -7,6 +7,7 @@ export declare const mockOrdersListResponse: {
7
7
  current_page: number;
8
8
  };
9
9
  total_count: number;
10
+ date_of_first_order: string;
10
11
  items: {
11
12
  token: string;
12
13
  email: string;
@@ -1 +1 @@
1
- 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};
1
+ import{jsx as i,jsxs as L,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as g,Slot as b}from"@dropins/tools/lib.js";import{P as T,C as Y}from"../chunks/AddressFormWrapper2.js";import"@dropins/tools/preact-compat.js";import{Card as k,Icon as y,Image as M,Header as F,Picker as H}from"@dropins/tools/components.js";import{S as C,c as E,E as P}from"../chunks/checkIsFunction.js";import{useText as h}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import{useState as O,useEffect as $,useMemo as B,useCallback as z}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getOrderHistoryList.js";import"../chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-address.js";const D={size:"32",stroke:"2"},I=({minifiedView:s,orderNumber:r,orderToken:e,routeOrdersList:t,routeOrderDetails:n})=>{const u={minifiedView:{},fullSizeView:{}};return u.minifiedView=h({viewAllOrdersButton:"Account.OrdersList.minifiedView.viewAllOrdersButton"}),t?i("a",{className:g(["dropin-orders-list-action",["dropin-orders-list-action--minifiedView",s]]),"data-testid":"ordersListActionButtonMinifiedView",href:t(),children:i(k,{"data-testid":"ordersListActionMinifiedView",variant:"secondary",children:L("div",{className:"dropin-orders-list-action__card-wrapper",children:[i("p",{children:u.minifiedView.viewAllOrdersButton}),i(y,{source:C,...D})]})})}):i("a",{href:E(n)?n(r,e):"#",className:"dropin-orders-list-action","data-testid":"ordersListActionButton",children:i(y,{source:C,...D})})},_=({minifiedView:s,item:r,withThumbnails:e,children:t,slots:n,...u})=>{var f,d,o,c;const a={minifiedView:{},fullSizeView:{}};return a.minifiedView=h({orderNumber:"Account.OrdersList.minifiedView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.minifiedView.OrdersListCard.itemsAmount"}),a.fullSizeView=h({orderNumber:"Account.OrdersList.fullSizeView.OrdersListCard.orderNumber",itemsAmount:"Account.OrdersList.fullSizeView.OrdersListCard.itemsAmount"}),L(k,{...u,className:g(["dropin-orders-list-card",["dropin-orders-list-card--full",((f=r==null?void 0:r.items)==null?void 0:f.length)>6]]),variant:"secondary",children:[i("div",{className:"dropin-orders-list-card--content",children:n!=null&&n.OrdersListCard?i(b,{"data-testid":`ordersListCard${r.id}`,name:"OrdersListCard",slot:n==null?void 0:n.OrdersListCard,context:{orderHistoryListItem:r}}):L(x,{children:[i("div",{children:r==null?void 0:r.status}),i("p",{children:r==null?void 0:r.orderDate}),L("p",{children:[s?a.minifiedView.orderNumber:a.fullSizeView.orderNumber," ",r.number]}),L("p",{children:["$",(d=r==null?void 0:r.total)==null?void 0:d.grandTotal.value]}),L("p",{children:[(o=r==null?void 0:r.items)==null?void 0:o.length," ",s?a.minifiedView.itemsAmount:a.fullSizeView.itemsAmount]})]})}),e&&((c=r==null?void 0:r.items)!=null&&c.length)?i("div",{className:"dropin-orders-list-card--images","data-testid":"ordersListCardImages",children:r.items.map((l,m)=>{var p;const A=(p=l==null?void 0:l.product)==null?void 0:p.smallImage.url,w=l==null?void 0:l.productName;return i(M,{src:A,width:65,height:65,alt:w},l.id+m)})}):null,i("div",{className:"dropin-orders-list-card--actions",children:t})]})},j=({ordersInMinifiedView:s,minifiedView:r,pageSize:e,selectedDate:t,handleSetFirstOrderDate:n})=>{const[u,a]=O([]),[f,d]=O({}),[o,c]=O(!1);return $(()=>{a([]),c(!0),J(r?s:e,t).then(l=>{!l||!l.items||(d(l.pageInfo),a(l.items),n(l.dateOfFirstOrder))}).finally(()=>{c(!1)})},[n,r,s,e,t]),{loading:o,orderHistoryListItems:u,pageInfo:f}},v=(s,r=1)=>{const e=new Date,t=new Date(e);switch(s){case"sixMonthsAgo":{t.setMonth(t.getMonth()-r);break}case"oneYearAgo":{t.setFullYear(t.getFullYear()-r);break}default:return""}return{from:t==null?void 0:t.toISOString().split("T")[0],to:`${e==null?void 0:e.toISOString().split("T")[0]} 23:59:59`}},R=s=>{const r=[],e=new Date().getFullYear();for(let t=s;t<=e-1;t++)r.push({value:`{"from":"${t}-01-01","to":"${t+1}-01-01 23:59:59"}`,text:t.toString()});return r},W=()=>{const s=h({pastSixMonths:"Account.OrdersList.fullSizeView.OrdersListSelectDate.pastSixMonths",currentYear:"Account.OrdersList.fullSizeView.OrdersListSelectDate.currentYear",viewAll:"Account.OrdersList.fullSizeView.OrdersListSelectDate.viewAll"}),[r,e]=O(),[t,n]=O(JSON.stringify(v("sixMonthsAgo",6))),u=B(()=>{const d=[{value:JSON.stringify(v("sixMonthsAgo",6)),text:s.pastSixMonths},{value:JSON.stringify(v("oneYearAgo",1)),text:s.currentYear},{value:"",text:s.viewAll}];if(r){const c=new Date(r).getFullYear();d==null||d.splice(2,0,...R(c))}return d},[s,r]),a=z(d=>{e(d)},[]),f=z(d=>{const c=d.target.value;n(c)},[]);return{selectableDateList:u,selectedDate:t,handleSelectDate:f,handleSetFirstOrderDate:a}},q=({className:s,withHeader:r=!0,minifiedView:e=!1,withThumbnails:t=!0,withFilter:n=!0,ordersInMinifiedView:u=1,pageSize:a=10,routeOrdersList:f,routeOrderDetails:d,slots:o})=>{const c={minifiedView:{},fullSizeView:{}};c.minifiedView=h({containerTitle:"Account.OrdersList.minifiedView.containerTitle"}),c.fullSizeView=h({containerTitle:"Account.OrdersList.fullSizeView.containerTitle",titleSelectOrder:"Account.OrdersList.fullSizeView.titleSelectOrder"});const{selectableDateList:l,selectedDate:m,handleSelectDate:A,handleSetFirstOrderDate:w}=W(),{loading:p,orderHistoryListItems:N}=j({minifiedView:e,pageSize:a,ordersInMinifiedView:u,selectedDate:m,handleSetFirstOrderDate:w});return L("div",{children:[r?i(F,{title:e?c.minifiedView.containerTitle:c.fullSizeView.containerTitle,divider:!e,className:e?"dropin-orders-list-header":""}):null,L("div",{className:g(["dropin-orders-list",s]),children:[!e&&n?i("div",{className:"dropin-orders-list--date-select",children:p?i(T,{"data-testid":"selectPickerLoader"}):L(x,{children:[i("span",{children:c.fullSizeView.titleSelectOrder}),i(H,{value:m,name:"orderDatePicker",options:l,handleSelect:A})]})}):null,p?i(Y,{testId:"orderSkeletonLoader",withCard:!1}):i(P,{isEmpty:!N.length,typeList:"orders",minifiedView:e}),N.map((S,V)=>i(_,{minifiedView:e,item:S,withThumbnails:t,slots:o,children:o!=null&&o.OrdersListAction?i(b,{"data-testid":`ordersListActionSlot_${V}`,name:"OrdersListAction",slot:o==null?void 0:o.OrdersListAction,context:{orderHistoryListItem:S}}):i(I,{minifiedView:e,orderNumber:S.number,orderToken:S.token,routeOrderDetails:d})},V)),e?i(I,{minifiedView:e,routeOrdersList:f}):null]})]})},ar=({className:s,withHeader:r,minifiedView:e,withThumbnails:t,withFilter:n,ordersInMinifiedView:u,pageSize:a,routeOrdersList:f,routeOrderDetails:d,slots:o})=>i("div",{className:g(["dropin-orders-list",s]),"data-testid":"ordersListId",children:i(q,{className:s,withHeader:r,minifiedView:e,withThumbnails:t,withFilter:n,ordersInMinifiedView:u,pageSize:a,routeOrdersList:f,routeOrderDetails:d,slots:o})});export{ar as OrdersList,ar as default};
@@ -39,6 +39,7 @@ export interface AttributesFormItemsProps {
39
39
  orderNumber: number;
40
40
  isHidden?: boolean;
41
41
  customUpperCode: string;
42
+ validateRules: Record<string, string>[];
42
43
  }
43
44
  export interface AttributesFormModel extends AttributesFormItemsProps {
44
45
  }
@@ -59,5 +59,6 @@ export interface OrderHistory {
59
59
  items: OrderDetails[];
60
60
  pageInfo: PaginationInfo;
61
61
  totalCount: number;
62
+ dateOfFirstOrder: string;
62
63
  }
63
64
  //# sourceMappingURL=order-history-list.d.ts.map
@@ -5,5 +5,6 @@ export declare const useOrderSelectList: () => {
5
5
  }[];
6
6
  selectedDate: string;
7
7
  handleSelectDate: (event: Event) => void;
8
+ handleSetFirstOrderDate: (date: string) => void;
8
9
  };
9
10
  //# sourceMappingURL=useOrderSelectList.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { OrderDetails } from '../../data/models';
2
2
  import { useOrdersListProps } from '../../types';
3
3
 
4
- export declare const useOrdersList: ({ ordersInMinifiedView, minifiedView, pageSize, selectedDate, }: useOrdersListProps) => {
4
+ export declare const useOrdersList: ({ ordersInMinifiedView, minifiedView, pageSize, selectedDate, handleSetFirstOrderDate, }: useOrdersListProps) => {
5
5
  loading: boolean;
6
6
  orderHistoryListItems: OrderDetails[];
7
7
  pageInfo: {};
@@ -87,7 +87,16 @@ declare const _default: {
87
87
  }
88
88
  },
89
89
  "FormText": {
90
- "requiredFieldError": "This is a required field."
90
+ "requiredFieldError": "This is a required field.",
91
+ "numericError": "Only numeric values are allowed.",
92
+ "alphaNumWithSpacesError": "Only alphanumeric characters and spaces are allowed.",
93
+ "alphaNumericError": "Only alphanumeric characters are allowed.",
94
+ "alphaError": "Only alphabetic characters are allowed.",
95
+ "emailError": "Please enter a valid email address.",
96
+ "dateError": "Please enter a valid date.",
97
+ "dateLengthError": "Date must be between {min} and {max}.",
98
+ "urlError": "Please enter a valid URL, e.g., http://www.adobe.com.",
99
+ "lengthTextError": "Text length must be between {min} and {max} characters."
91
100
  }
92
101
  }
93
102
  };
@@ -2,5 +2,9 @@ export interface FilterDateProps {
2
2
  from: string;
3
3
  to: string;
4
4
  }
5
- export declare const getDateRange: (key: 'sixMonthsAgo' | 'oneYearAgo' | '') => FilterDateProps | '';
5
+ export declare const getDateRange: (key: 'sixMonthsAgo' | 'oneYearAgo' | '', numberRange?: number) => FilterDateProps | '';
6
+ export declare const addYearsToList: (startYear: number) => {
7
+ value: string;
8
+ text: string;
9
+ }[];
6
10
  //# sourceMappingURL=getDateRange.d.ts.map
@@ -20,5 +20,6 @@ export declare const getFieldsConfig: (itemValues: Record<string, any>, attribut
20
20
  orderNumber: number;
21
21
  isHidden?: boolean | undefined;
22
22
  customUpperCode: string;
23
+ validateRules: Record<string, string>[];
23
24
  }[];
24
25
  //# sourceMappingURL=getFieldsConfig.d.ts.map
@@ -0,0 +1,32 @@
1
+ type TranslationList = Record<string, string>;
2
+ type ErrorsList = Record<string, string>;
3
+ export type ValidationFieldsConfig = {
4
+ validateRules: Record<string, string>[];
5
+ code: string;
6
+ required: boolean;
7
+ };
8
+ export declare enum InputValidation {
9
+ Numeric = "numeric",
10
+ AlphanumWithSpaces = "alphanum-with-spaces",
11
+ Alphanumeric = "alphanumeric",
12
+ Alpha = "alpha",
13
+ Email = "email",
14
+ Length = "length",
15
+ Date = "date",
16
+ Url = "url"
17
+ }
18
+ export declare const validateNumeric: (value: string) => boolean;
19
+ export declare const validateAlphanumWithSpaces: (value: string) => boolean;
20
+ export declare const validateAlphanumeric: (value: string) => boolean;
21
+ export declare const validateAlpha: (value: string) => boolean;
22
+ export declare const validateEmail: (value: string) => boolean;
23
+ export declare const validateDate: (value: string) => boolean;
24
+ export declare const isDateWithinRange: (date: string, minTimestamp: number, maxTimestamp: number) => boolean;
25
+ export declare const convertTimestampToDate: (timestamp: string) => string;
26
+ export declare const validateUrl: (url: string) => boolean;
27
+ export declare const validateLength: (value: string, minLength: number, maxLength: number) => boolean;
28
+ export declare const validationFields: (value: string, configs: ValidationFieldsConfig, translations: TranslationList, errorsList: ErrorsList) => {
29
+ [x: string]: string;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=validationFields.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-account", "version": "0.1.0-alpha7", "@dropins/elsie": "0.29.0"}
1
+ {"name": "@dropins/storefront-account", "version": "0.1.0-alpha9", "@dropins/elsie": "0.31.0"}
package/render.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (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}
2
2
  .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"});
3
- 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};
3
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as t}from"@dropins/tools/lib.js";import{useState as o,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.",numericError:"Only numeric values are allowed.",alphaNumWithSpacesError:"Only alphanumeric characters and spaces are allowed.",alphaNumericError:"Only alphanumeric characters are allowed.",alphaError:"Only alphabetic characters are allowed.",emailError:"Please enter a valid email address.",dateError:"Please enter a valid date.",dateLengthError:"Date must be between {min} and {max}.",urlError:"Please enter a valid URL, e.g., http://www.adobe.com.",lengthTextError:"Text length must be between {min} and {max} characters."}},u={Account:c},p={default:u},w=({children:s})=>{const[d,a]=o("en_US");return n(()=>{const e=m.on("locale",i=>{a(i)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:d,langDefinitions:p,children:s})},S=new t(r(w,{}));export{S as render};
@@ -59,6 +59,7 @@ export interface OrdersProps {
59
59
  page_info: PageInfoProps;
60
60
  total_count: number;
61
61
  items: OrderProps[];
62
+ date_of_first_order: string;
62
63
  }
63
64
  export interface OrderHistoryListResponse {
64
65
  data: {
@@ -44,5 +44,6 @@ export interface useOrdersListProps {
44
44
  pageSize: number;
45
45
  ordersInMinifiedView: number;
46
46
  selectedDate: string;
47
+ handleSetFirstOrderDate: (date: string) => void;
47
48
  }
48
49
  //# sourceMappingURL=ordersList.types.d.ts.map