@dropins/storefront-order 0.1.0-alpha4 → 0.1.0-alpha6

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.
Files changed (68) hide show
  1. package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
  2. package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
  3. package/api/getAttributesForm/index.d.ts +2 -0
  4. package/api/getGuestOrder/getGuestOrder.d.ts +2 -2
  5. package/api/getOrderDetailsById/getOrderDetailsById.d.ts +1 -2
  6. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +1 -1
  7. package/api/guestOrderByToken/guestOrderByToken.d.ts +2 -2
  8. package/api/helpers/initializeOrderDetails.d.ts +3 -1
  9. package/api/index.d.ts +1 -0
  10. package/api.js +129 -27
  11. package/chunks/CustomerDetailsContent.js +1 -0
  12. package/chunks/OrderLoaders.js +1 -0
  13. package/chunks/fetch-graphql.js +1 -0
  14. package/chunks/getAttributesForm.js +47 -0
  15. package/chunks/getGuestOrder.js +75 -31
  16. package/components/CustomerDetailsContent/CustomerDetailsContent.d.ts +5 -0
  17. package/components/CustomerDetailsContent/index.d.ts +3 -0
  18. package/components/OrderActions/OrderActions.d.ts +5 -0
  19. package/components/OrderActions/index.d.ts +3 -0
  20. package/components/OrderLoaders/OrderLoaders.d.ts +7 -0
  21. package/components/OrderLoaders/index.d.ts +3 -0
  22. package/components/OrderStatusContent/OrderStatusContent.d.ts +5 -0
  23. package/components/OrderStatusContent/index.d.ts +3 -0
  24. package/components/ShippingStatusCard/ShippingStatusCard.d.ts +5 -0
  25. package/components/ShippingStatusCard/index.d.ts +3 -0
  26. package/components/index.d.ts +5 -0
  27. package/configs/defaultAttributePreset.config.d.ts +2 -0
  28. package/configs/mock.config.d.ts +773 -0
  29. package/containers/CustomerDetails/CustomerDetails.d.ts +5 -0
  30. package/containers/CustomerDetails/index.d.ts +3 -0
  31. package/containers/CustomerDetails.d.ts +3 -0
  32. package/containers/CustomerDetails.js +1 -0
  33. package/containers/OrderSearch.js +1 -1
  34. package/containers/OrderStatus/OrderStatus.d.ts +5 -0
  35. package/containers/OrderStatus/index.d.ts +3 -0
  36. package/containers/OrderStatus.d.ts +3 -0
  37. package/containers/OrderStatus.js +1 -0
  38. package/containers/ShippingStatus/ShippingStatus.d.ts +5 -0
  39. package/containers/ShippingStatus/index.d.ts +3 -0
  40. package/containers/ShippingStatus.d.ts +3 -0
  41. package/containers/ShippingStatus.js +1 -0
  42. package/containers/index.d.ts +3 -0
  43. package/data/models/attributes-form.d.ts +46 -0
  44. package/data/models/index.d.ts +1 -1
  45. package/data/models/order-details.d.ts +109 -32
  46. package/data/transforms/index.d.ts +1 -0
  47. package/data/transforms/transform-attributes-form.d.ts +6 -0
  48. package/data/transforms/transform-guest-order.d.ts +3 -3
  49. package/data/transforms/transform-order-details.d.ts +4 -2
  50. package/hooks/containers/useCustomerDetails.d.ts +12 -0
  51. package/hooks/containers/useOrderSearch.d.ts +1 -1
  52. package/hooks/containers/useOrderStatus.d.ts +8 -0
  53. package/hooks/containers/useShippingStatus.d.ts +7 -0
  54. package/hooks/index.d.ts +3 -0
  55. package/i18n/en_US.json.d.ts +69 -2
  56. package/lib/convertCase.d.ts +4 -0
  57. package/lib/convertToInputDateFormat.d.ts +1 -0
  58. package/package.json +1 -1
  59. package/render.js +2 -2
  60. package/types/api/getAttributesForm.types.d.ts +31 -0
  61. package/types/api/getOrderDetails.types.d.ts +54 -28
  62. package/types/customerDetails.types.d.ts +49 -0
  63. package/types/form.types.d.ts +5 -5
  64. package/types/index.d.ts +5 -1
  65. package/types/orderSearch.types.d.ts +5 -5
  66. package/types/orderStatus.types.d.ts +41 -0
  67. package/types/shippingStatus.types.d.ts +18 -0
  68. package/data/models/guest-order.d.ts +0 -21
@@ -0,0 +1,5 @@
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
+ import { CustomerDetailsProps } from '../../types';
3
+
4
+ export declare const CustomerDetails: Container<CustomerDetailsProps>;
5
+ //# sourceMappingURL=CustomerDetails.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './CustomerDetails';
2
+ export { CustomerDetails as default } from './CustomerDetails';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './CustomerDetails/index'
2
+ import _default from './CustomerDetails/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as p,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k}from"@dropins/tools/lib.js";import{useMemo as O,useState as v,useEffect as D,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as S}from"@dropins/tools/event-bus.js";import{e as W}from"../chunks/fetch-graphql.js";import{g as j}from"../chunks/getAttributesForm.js";import{Card as P,Header as Z,Price as x,Icon as z}from"@dropins/tools/components.js";import"../chunks/CustomerDetailsContent.js";import*as o from"@dropins/tools/preact-compat.js";import{D as B}from"../chunks/OrderLoaders.js";import{useText as q}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";const F=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),K=d=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),R=({loading:d,order:i,withHeader:f=!0,title:l,paymentIconsMap:u={},normalizeAddress:h})=>{var E,N,A,T,$,y,w;const a=q({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",billingMethodsTitle:"Order.CustomerDetails.billingMethods.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping"}),g=O(()=>({checkmo:F,card:K,...u}),[u]);if(!i||d)return t(B,{});const C=(i==null?void 0:i.email)??"",n=(E=i==null?void 0:i.shipping)==null?void 0:E.code,c=(N=i==null?void 0:i.shipping)==null?void 0:N.amount,s=(A=i==null?void 0:i.shipping)==null?void 0:A.currency,m=i==null?void 0:i.payments,_=m&&m.length>0,b=_?(T=m[0])==null?void 0:T.name:"",M=_?($=m[0])==null?void 0:$.code:"",H=_&&b!=="";return p(P,{"data-testid":"order-details",variant:"secondary",className:k(["dropin-details"]),children:[f?t(Z,{title:l??a.headerText}):null,p("div",{className:"dropin-details__container",children:[p("div",{className:"dropin-details__container-email",children:[t("div",{className:"dropin-details__container-title",children:a.emailTitle}),t("p",{children:C})]}),p("div",{className:"dropin-details__container-shipping_address",children:[t("div",{className:"dropin-details__container-title",children:a.shippingAddressTitle}),t("div",{className:"dropin-details__container-description",children:(y=h.shippingAddress)==null?void 0:y.filter(({value:e})=>e).map((e,r)=>r===1?t("p",{"data-testid":`${e.name}_${r}`,children:t("span",{children:e.label?`${e.label}: ${e==null?void 0:e.value}`:e==null?void 0:e.value})},r):t("p",{"data-testid":`${e.name}_${r}`,children:e.label?`${e.label}: ${e==null?void 0:e.value}`:e==null?void 0:e.value},r))})]}),p("div",{className:"dropin-details__container-billing_address",children:[t("div",{className:"dropin-details__container-title",children:a.billingAddressTitle}),t("div",{className:"dropin-details__container-description",children:(w=h.billingAddress)==null?void 0:w.filter(({value:e})=>e).map((e,r)=>r===1||r===5?t("p",{"data-testid":`${e.name}_${r}`,children:t("span",{children:e.label?`${e.label}: ${e==null?void 0:e.value}`:e==null?void 0:e.value})},r):t("p",{"data-testid":`${e.name}_${r}`,children:e.label?`${e.label}: ${e==null?void 0:e.value}`:e==null?void 0:e.value},r))})]}),p("div",{className:"dropin-details__container-shipping_methods",children:[t("div",{className:"dropin-details__container-title",children:a.shippingMethodsTitle}),n?t(L,{children:c?p("p",{"data-testid":"shipping_methods_price",children:[t(x,{amount:c,currency:s})," ",n]}):t("p",{"data-testid":"shipping_methods_placeholder",children:a.freeShipping})}):null]}),p("div",{className:"dropin-details__container-billing_methods",children:[t("div",{className:"dropin-details__container-title",children:a.billingMethodsTitle}),H&&p("p",{"data-testid":"billing_methods_description",className:k([["dropin-details__container-billing_methods--icon",!!g[M]]]),children:[t(z,{source:g[M]}),b]})]})]})]})},G=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],I=({orderData:d})=>{const[i,f]=v(!0),[l,u]=v(d),[h,a]=v([]);D(()=>{const n=S.on("order/data",c=>{u(c)},{eager:!0});return()=>{n==null||n.off()}},[]),D(()=>{j("shortRequest").then(n=>{if(n){const c=n.map(({name:s,orderNumber:m,label:_})=>({name:W(s),orderNumber:m,label:G.includes(s)?null:_}));a(c)}}).finally(()=>{f(!1)})},[]);const g=V(n=>{if(!h.length||!l||!l[n])return[];const c=Object.fromEntries(Object.entries(l[n]).map(([s,m])=>[s.toLowerCase(),m]));return h.filter(({name:s})=>c[s.toLowerCase()]).map(s=>({name:s.name,orderNumber:s.orderNumber,value:c[s.name],label:s.label}))},[h,l]),C=O(()=>({billingAddress:g("billingAddress"),shippingAddress:g("shippingAddress")}),[g]);return{order:l,normalizeAddress:C,loading:i}},ae=({paymentIconsMap:d,orderData:i,title:f,className:l})=>{const{order:u,normalizeAddress:h,loading:a}=I({orderData:i});return t("div",{className:k(["dropin-customer-details",l]),children:t(R,{loading:a,order:u,title:f,paymentIconsMap:d,normalizeAddress:h})})};export{ae as CustomerDetails,ae as default};
@@ -1 +1 @@
1
- import{jsxs as M,jsx as c,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{classes as S}from"@dropins/tools/lib.js";import{Card as L,InLineAlert as R,Icon as k,Button as q,Field as D,Picker as w,Input as V,InputDate as g,Checkbox as F,TextArea as U}from"@dropins/tools/components.js";import{useRef as H,useState as N,useEffect as G,useCallback as A,useMemo as X}from"@dropins/tools/preact-hooks.js";import{Text as _,useText as v}from"@dropins/tools/i18n.js";import*as I from"@dropins/tools/preact-compat.js";import{memo as x,useCallback as O}from"@dropins/tools/preact-compat.js";import{events as P}from"@dropins/tools/event-bus.js";import{e as W}from"../chunks/getGuestOrder.js";import"@dropins/tools/fetch-graphql.js";const z=r=>I.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},I.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),I.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),I.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),Z=r=>I.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},I.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),j=({onSubmit:r,loading:t,inLineAlert:i,fieldsConfig:n})=>M(L,{variant:"secondary",className:"dropin-order-search-form",children:[c("h2",{className:"dropin-order-search-form__title",children:c(_,{id:"Order.OrderSearchForm.title"})}),c("p",{children:c(_,{id:"Order.OrderSearchForm.description"})}),i.text?c(R,{"data-testid":"orderAlert",className:"dropin-order-search-form__alert",type:i.type,variant:"secondary",heading:i.text,icon:c(k,{source:Z})}):null,c(K,{className:"dropin-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:n,onSubmit:r,children:c("div",{className:"dropin-order-search-form__button-container",children:c(q,{className:"dropin-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:c(_,{id:"Order.OrderSearchForm.button"})},"logIn")})})]}),Y=r=>r.reduce((t,{code:i,required:n,defaultValue:d})=>(n&&(t[i]=d),t),{}),J=({fieldsConfig:r,onSubmit:t})=>{const{requiredFieldError:i}=v({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),n=H(null),[d,s]=N({}),[f,l]=N({});G(()=>{if(!r||!r.length)return;const h=Y(r);s(h)},[r==null?void 0:r.length]);const p=A((h,e)=>{const a=r.find(u=>u.code===h);return a!=null&&a.required&&!e?i:""},[r,i]),T=A(h=>{const{name:e,value:a,type:o,checked:u}=h==null?void 0:h.target,b=o==="checkbox"?u:a;s(m=>({...m,[e]:b}))},[]),$=A(h=>{const{name:e,value:a,type:o,checked:u}=h==null?void 0:h.target,b=o==="checkbox"?u:a;l(m=>({...m,[e]:p(e,b)}))},[p]),E=A(h=>{h.preventDefault();let e=!0,a={},o=null;for(const[u,b]of Object.entries(d)){const m=p(u,b);m&&(a[u]=m,e=!1,o||(o=u))}if(l(a),o&&n.current){const u=n.current.elements.namedItem(o);u==null||u.focus()}t==null||t(h,e)},[d,p,t]);return{formData:d,errors:f,formRef:n,handleChange:T,handleBlur:$,handleSubmit:E}},B=x(({loading:r,values:t,fields:i=[],errors:n,className:d="",onChange:s,onBlur:f})=>{const l=`${d}__item`,p=O((e,a,o)=>{const u=e.options.map(b=>({text:b.label,value:b.value}));return c(D,{error:o,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${d}--${e.id}`,disabled:r,children:c(w,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:u,onBlur:f,handleSelect:s,value:a||e.defaultValue})},e.id)},[d,r,l,f,s]),T=O((e,a,o)=>{const u=e.id==="email",b=u?c(z,{}):void 0,m=u?"username":"";return c(D,{error:o,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e==null?void 0:e.is_hidden],e.className]),"data-testid":`${d}--${e.id}`,disabled:r,children:c(V,{"aria-label":e.label,"aria-required":e.required,autoComplete:m,icon:b,type:"text",name:e.id,value:a||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:f,onChange:s})},e.id)},[d,r,l,f,s]),$=O((e,a,o)=>c(D,{error:o,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${d}--${e.id}`,disabled:r,children:c(g,{type:"text",name:e.id,value:a||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:f,onChange:s})},e.id),[d,r,l,f,s]),E=O((e,a,o)=>c(D,{error:o,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${d}--${e.id}`,disabled:r,children:c(F,{name:e.id,checked:a||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:f,onChange:s})},e.id),[d,r,l,f,s]),h=O((e,a,o)=>c(D,{error:o,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${d}--${e.id}`,disabled:r,children:c(U,{type:"text",name:e.id,value:a===void 0?e.defaultValue:a,label:`${e.label} ${e.required?"*":""}`,onBlur:f,onChange:s})},e.id),[d,r,l,f,s]);return i.length?c(C,{children:i.map(e=>{var u;const a=(n==null?void 0:n[e.id])??"",o=(t==null?void 0:t[e.id])??"";switch(e.fieldType){case"TEXT":return(u=e==null?void 0:e.options)!=null&&u.length?p(e,o,a):T(e,o,a);case"MULTILINE":return T(e,o,a);case"SELECT":return p(e,o,a);case"DATE":return $(e,o,a);case"BOOLEAN":return E(e,o,a);case"TEXTAREA":return h(e,o,a);default:return null}})}):null}),K=x(({name:r,loading:t,children:i,className:n="defaultForm",fieldsConfig:d,onSubmit:s})=>{const{formData:f,errors:l,formRef:p,handleChange:T,handleBlur:$,handleSubmit:E}=J({fieldsConfig:d,onSubmit:s});return M("form",{className:S(["dropin-form",n]),onSubmit:E,name:r,ref:p,children:[c(B,{className:n,loading:t,fields:d,onChange:T,onBlur:$,errors:l,values:f}),i]})});var y=(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))(y||{});const Q=r=>{if(!r)return null;const t=new FormData(r);if(r.querySelectorAll('input[type="checkbox"]').forEach(n=>{t.has(n.name)||t.set(n.name,"false"),n.checked&&t.set(n.name,"true")}),t&&typeof t.entries=="function"){const n=t.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},ee=({onError:r})=>{const[t,i]=N({text:"",type:"success"}),[n,d]=N(!1),s=v({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),f=X(()=>[{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:s.email,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:s.postcode,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:s.number,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[s]);return{onSubmit:A(async(p,T)=>{if(!T)return null;d(!0);const $=Q(p.target);await W($).then(E=>{E||i({text:s.invalidSearch,type:"warning"}),P.emit("order/data",E)}).catch(E=>{r==null||r({error:E.message,formValues:$}),i({text:E.message,type:"warning"})}).finally(()=>{d(!1)})},[r,s]),inLineAlert:t,loading:n,normalizeFieldsConfig:f}},ue=({className:r,onError:t})=>{const{onSubmit:i,loading:n,inLineAlert:d,normalizeFieldsConfig:s}=ee({onError:t});return c("div",{className:S(["dropin-order-search",r]),children:c(j,{onSubmit:i,loading:n,inLineAlert:d,fieldsConfig:s})})};export{ue as OrderSearch,ue as default};
1
+ import{jsxs as h,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as E}from"@dropins/tools/lib.js";import{Card as S,InLineAlert as I,Icon as O,Button as N}from"@dropins/tools/components.js";import{F as y}from"../chunks/CustomerDetailsContent.js";import{useState as m,useMemo as A,useCallback as D}from"@dropins/tools/preact-hooks.js";import*as f from"@dropins/tools/preact-compat.js";import{Text as d,useText as g}from"@dropins/tools/i18n.js";import{events as b}from"@dropins/tools/event-bus.js";import{g as M}from"../chunks/getGuestOrder.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const _=e=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},f.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),v=({onSubmit:e,loading:t,inLineAlert:o,fieldsConfig:r})=>h(S,{variant:"secondary",className:"dropin-order-search-form",children:[a("h2",{className:"dropin-order-search-form__title",children:a(d,{id:"Order.OrderSearchForm.title"})}),a("p",{children:a(d,{id:"Order.OrderSearchForm.description"})}),o.text?a(I,{"data-testid":"orderAlert",className:"dropin-order-search-form__alert",type:o.type,variant:"secondary",heading:o.text,icon:a(O,{source:_})}):null,a(y,{className:"dropin-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:r,onSubmit:e,children:a("div",{className:"dropin-order-search-form__button-container",children:a(N,{className:"dropin-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:a(d,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});var c=(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))(c||{});const R=e=>{if(!e)return null;const t=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(r=>{t.has(r.name)||t.set(r.name,"false"),r.checked&&t.set(r.name,"true")}),t&&typeof t.entries=="function"){const r=t.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},C=({onError:e})=>{const[t,o]=m({text:"",type:"success"}),[r,i]=m(!1),n=g({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),p=A(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.email,options:[],defaultValue:"",fieldType:c.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.postcode,options:[],defaultValue:"",fieldType:c.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.number,options:[],defaultValue:"",fieldType:c.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[n]);return{onSubmit:D(async(u,T)=>{if(!T)return null;i(!0);const l=R(u.target);await M(l).then(s=>{s||o({text:n.invalidSearch,type:"warning"}),b.emit("order/data",s)}).catch(async s=>{(await(e==null?void 0:e({error:s.message,formValues:l}))??!0)&&o({text:s.message,type:"warning"})}).finally(()=>{i(!1)})},[e,n]),inLineAlert:t,loading:r,normalizeFieldsConfig:p}},j=({className:e,onError:t})=>{const{onSubmit:o,loading:r,inLineAlert:i,normalizeFieldsConfig:n}=C({onError:t});return a("div",{className:E(["dropin-order-search",e]),children:a(v,{onSubmit:o,loading:r,inLineAlert:i,fieldsConfig:n})})};export{j as OrderSearch,j as default};
@@ -0,0 +1,5 @@
1
+ import { OrderStatusProps } from '../../types';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+
4
+ export declare const OrderStatus: Container<OrderStatusProps>;
5
+ //# sourceMappingURL=OrderStatus.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderStatus';
2
+ export { OrderStatus as default } from './OrderStatus';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './OrderStatus/index'
2
+ import _default from './OrderStatus/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as O,Fragment as f}from"@dropins/tools/preact-jsx-runtime.js";import{Card as E,Header as v,Button as p}from"@dropins/tools/components.js";import"../chunks/CustomerDetailsContent.js";import{Slot as g,classes as m}from"@dropins/tools/lib.js";import{useState as C,useEffect as N}from"@dropins/tools/preact-hooks.js";import{useMemo as w}from"@dropins/tools/preact-compat.js";import{useText as l}from"@dropins/tools/i18n.js";import{C as y}from"../chunks/OrderLoaders.js";import{events as A}from"@dropins/tools/event-bus.js";const h={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived"},_=({slots:r,title:a,status:n,orderData:e})=>{var s;const c=String(n).toLocaleLowerCase(),d=l(`Order.OrderStatusContent.${h[c]}.title`),o=l(`Order.OrderStatusContent.${h[c]}.message`);return n?O(E,{className:"dropin-order-status-content",variant:"secondary",children:[t(v,{title:a??d.title}),O("div",{className:"dropin-order-status-content__wrapper",children:[t("div",{className:"dropin-order-status-content__wrapper-description",children:t("p",{children:(s=o.message)==null?void 0:s.replace("{DATE}","01.01.1900")})}),t(T,{orderData:e,slots:r})]})]}):t("div",{})};var i=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(i||{});const T=({className:r,children:a,orderData:n,slots:e,...c})=>{const d=l({cancel:"Order.OrderStatusContent.actions.cancel",return:"Order.OrderStatusContent.actions.return",reorder:"Order.OrderStatusContent.actions.reorder"}),o=w(()=>{const s=n==null?void 0:n.availableActions,R=!!(s!=null&&s.length);return t(f,{children:e!=null&&e.OrderActions?t(g,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:e==null?void 0:e.OrderActions,context:n}):t("div",{"data-testid":"availableActionsList",className:m(["dropin-order-actions__wrapper",["dropin-order-actions__wrapper--empty",!R]]),children:s==null?void 0:s.map((S,u)=>{switch(S){case i.CANCEL:return t(p,{variant:"secondary",children:d.cancel},u);case i.RETURN:return t(p,{variant:"secondary",children:d.return},u);case i.REORDER:return t(p,{variant:"secondary",children:d.reorder},u)}})})})},[n,e==null?void 0:e.OrderActions,d]);return t("div",{...c,className:m(["dropin-order-actions",r]),children:o})},L=({orderData:r})=>{const[a,n]=C(r),[e,c]=C(r==null?void 0:r.status);return N(()=>{const d=A.on("order/data",o=>{n(o),c(o.status)},{eager:!0});return()=>{d==null||d.off()}},[]),{orderStatus:e,order:a}},k=({slots:r,orderData:a,className:n,statusTitle:e,status:c})=>{const{orderStatus:d,order:o}=L({orderData:a});return t("div",{className:m(["dropin-order-status",n]),children:o?t(_,{title:e,status:c||d,slots:r,orderData:o}):t(y,{withCard:!1})})};export{k as OrderStatus,k as default};
@@ -0,0 +1,5 @@
1
+ import { ShippingStatusProps } from '../../types';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+
4
+ export declare const ShippingStatus: Container<ShippingStatusProps>;
5
+ //# sourceMappingURL=ShippingStatus.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ShippingStatus';
2
+ export { ShippingStatus as default } from './ShippingStatus';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ShippingStatus/index'
2
+ import _default from './ShippingStatus/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as h,Fragment as $}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as A,classes as G}from"@dropins/tools/lib.js";import{Image as E,Card as m,Header as C,Accordion as b,AccordionSection as x}from"@dropins/tools/components.js";import"../chunks/CustomerDetailsContent.js";import{useCallback as H,useState as M,useEffect as R}from"@dropins/tools/preact-hooks.js";import{useText as U}from"@dropins/tools/i18n.js";import{C as Y}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";import{events as j}from"@dropins/tools/event-bus.js";var f=(i=>(i.PENDING="pending",i.SHIPPING="shipping",i.COMPLETE="complete",i.PROCESSING="processing",i.HOLD="on hold",i.CANCELED="Canceled",i.SUSPECTED_FRAUD="suspected fraud",i.PAYMENT_REVIEW="payment review",i))(f||{});const F=({slots:i,orderData:n,collapseThreshold:o=0})=>{var T,S,I,v,O;const c=U({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",notYetShippedImagesTitle:"Order.ShippingStatusCard.notYetShippedImagesTitle",noInfoTitle:"Order.OrderStatusContent.noInfoTitle"}),r=H(t=>t==null?void 0:t.map(p=>{var l,g,_,y,L,N;const a=(_=(g=(l=p==null?void 0:p.orderItem)==null?void 0:l.product)==null?void 0:g.thumbnail)==null?void 0:_.label,u=(N=(L=(y=p==null?void 0:p.orderItem)==null?void 0:y.product)==null?void 0:L.thumbnail)==null?void 0:N.url;return e(E,{alt:a,src:u,width:85,height:114},p.id)}),[]),d=(T=n==null?void 0:n.status)==null?void 0:T.toLocaleLowerCase(),w=((S=n==null?void 0:n.shipments)==null?void 0:S.length)===1&&(d==null?void 0:d.includes(f.COMPLETE)),s=(I=n==null?void 0:n.items)==null?void 0:I.filter(t=>(t==null?void 0:t.quantityShipped)===0);return!n||d!=null&&d.includes(f.CANCELED)?null:(v=n==null?void 0:n.shipments)!=null&&v.length?h($,{children:[(O=n==null?void 0:n.shipments)==null?void 0:O.map(({tracking:t,items:p,id:a},u)=>h(m,{variant:"secondary",className:"dropin-shipping-status-card",children:[e(C,{title:`${c.shippingCardTitle} ${u+1}`}),t==null?void 0:t.map(l=>{var g;return h("div",{className:"dropin-shipping-status-card__header",children:[h("div",{className:"dropin-shipping-status-card__header--content",children:[h("p",{children:[c.carrier," ",(g=l==null?void 0:l.carrier)==null?void 0:g.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),e("p",{children:l==null?void 0:l.title})]}),i!=null&&i.DeliveryTrackActions?e(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:i==null?void 0:i.DeliveryTrackActions,context:{trackInformation:l}}):null]},l.number)}),w?null:e(b,{actionIconPosition:"right","data-testid":"dropinAccordion",children:e(x,{defaultOpen:o>=(p==null?void 0:p.length),title:`Package contents (${p==null?void 0:p.length} items)`,children:e("div",{className:"dropin-shipping-status-card__images",children:r(p)})})}),i!=null&&i.DeliveryTimeLine?e(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:i==null?void 0:i.DeliveryTimeLine,context:{}}):null]},a)),s!=null&&s.length?h(m,{variant:"secondary",className:"dropin-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[e(C,{title:c.notYetShippedTitle}),e(b,{actionIconPosition:"right",children:e(x,{title:`${c.notYetShippedImagesTitle} ${s==null?void 0:s.length}`,children:e("div",{className:"dropin-shipping-status-card__images",children:s==null?void 0:s.map(({id:t,thumbnail:{url:p,label:a}})=>e(E,{alt:a,src:p,width:85,height:114},t))})})})]}):null]}):h(m,{variant:"secondary",className:"dropin-shipping-status-card",children:[e(C,{title:c.shippingInfoTitle}),e("div",{className:"dropin-shipping-status-card__header",children:h("div",{className:"dropin-shipping-status-card__header--content",children:[n!=null&&n.carrier?e("p",{children:n==null?void 0:n.carrier}):null,e("p",{children:c.noInfoTitle})]})})]})},q=({orderData:i})=>{const[n,o]=M(i);return R(()=>{const c=j.on("order/data",r=>{o(r)},{eager:!0});return()=>{c==null||c.off()}},[]),{order:n}},k=({slots:i,className:n,collapseThreshold:o,orderData:c})=>{const{order:r}=q({orderData:c});return e("div",{className:G(["dropin-shipping-status",n]),children:r?e(F,{slots:i,orderData:r,collapseThreshold:o}):e(Y,{withCard:!1})})};export{k as ShippingStatus,k as default};
@@ -1,2 +1,5 @@
1
1
  export * from './OrderSearch';
2
+ export * from './OrderStatus';
3
+ export * from './ShippingStatus';
4
+ export * from './CustomerDetails';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,46 @@
1
+ export declare enum FieldEnumList {
2
+ BOOLEAN = "BOOLEAN",
3
+ DATE = "DATE",
4
+ DATETIME = "DATETIME",
5
+ DROPDOWN = "DROPDOWN",
6
+ FILE = "FILE",
7
+ GALLERY = "GALLERY",
8
+ HIDDEN = "HIDDEN",
9
+ IMAGE = "IMAGE",
10
+ MEDIA_IMAGE = "MEDIA_IMAGE",
11
+ MULTILINE = "MULTILINE",
12
+ MULTISELECT = "MULTISELECT",
13
+ PRICE = "PRICE",
14
+ SELECT = "SELECT",
15
+ TEXT = "TEXT",
16
+ TEXTAREA = "TEXTAREA",
17
+ UNDEFINED = "UNDEFINED",
18
+ VISUAL = "VISUAL",
19
+ WEIGHT = "WEIGHT",
20
+ EMPTY = ""
21
+ }
22
+ export interface AttributesFormItemsProps {
23
+ code?: string;
24
+ name?: string;
25
+ id?: string;
26
+ required?: boolean;
27
+ label?: string;
28
+ options?: {
29
+ is_default: boolean;
30
+ label: string;
31
+ value: string;
32
+ }[];
33
+ entityType?: string;
34
+ className?: string;
35
+ defaultValue?: string | boolean | number;
36
+ fieldType?: FieldEnumList;
37
+ multilineCount?: number;
38
+ isUnique?: boolean;
39
+ orderNumber: number;
40
+ isHidden?: boolean;
41
+ customUpperCode: string;
42
+ validateRules: Record<string, string>[];
43
+ }
44
+ export interface AttributesFormModel extends AttributesFormItemsProps {
45
+ }
46
+ //# sourceMappingURL=attributes-form.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export * from './order-details';
2
- export * from './guest-order';
2
+ export * from './attributes-form';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,38 +1,115 @@
1
- import { DiscountProps, GiftMessageProps, GiftWrappingProps, MoneyProps, OrderItemProps, paymentMethodsProps, QueryType, TotalProps, UserAddressesProps } from '../../types';
1
+ import { AvailableActionsProps, MoneyProps, QueryType } from '../../types';
2
2
 
3
- export interface OrderData {
4
- giftWrapping: GiftWrappingProps;
5
- giftMessage: GiftMessageProps;
6
- defaultShipping: UserAddressesProps;
7
- defaultBulling: UserAddressesProps;
8
- paymentMethods: paymentMethodsProps[];
9
- giftReceiptIncluded: boolean;
10
- orderDate: string;
11
- shippingMethod: string;
12
- items: OrderItemProps[];
13
- total: {
14
- discount: DiscountProps[];
15
- subtotal: MoneyProps;
16
- totalTax: MoneyProps;
17
- totalShipping: MoneyProps;
18
- grandTotal: MoneyProps;
3
+ export type OrderAddressModel = {
4
+ city: string;
5
+ company: string;
6
+ country: string;
7
+ firstName: string;
8
+ middleName: string;
9
+ lastName: string;
10
+ postCode: string;
11
+ region: string;
12
+ regionId: string;
13
+ street: string[];
14
+ telephone: string;
15
+ customAttributes: {
16
+ code: string;
17
+ value: string;
18
+ }[];
19
+ } | null;
20
+ export type OrderItemProductModel = {
21
+ canonicalUrl?: string;
22
+ id: string;
23
+ image?: string;
24
+ imageAlt?: string;
25
+ name: string;
26
+ productType: string;
27
+ sku: string;
28
+ thumbnail: {
29
+ url: string;
30
+ label: string;
31
+ };
32
+ };
33
+ export type OrderItemModel = {
34
+ type: string;
35
+ discounted: boolean;
36
+ id: string;
37
+ productName: string;
38
+ regularPrice: MoneyProps;
39
+ price: MoneyProps;
40
+ product: OrderItemProductModel;
41
+ selectedOptions?: Array<{
42
+ label: string;
43
+ value: any;
44
+ }>;
45
+ totalQuantity: number;
46
+ thumbnail: {
47
+ label: string;
48
+ url: string;
49
+ };
50
+ giftCard?: {
51
+ senderName: string;
52
+ senderEmail: string;
53
+ recipientEmail: string;
54
+ recipientName: string;
19
55
  };
20
- }
21
- export interface OrderSummary {
22
- orderSummary: TotalProps;
23
- }
24
- export interface OrderStatus {
56
+ quantityCanceled: number;
57
+ quantityInvoiced: number;
58
+ quantityOrdered: number;
59
+ quantityRefunded: number;
60
+ quantityReturned: number;
61
+ quantityShipped: number;
62
+ };
63
+ export type ShipmentItemsModel = {
64
+ id: string;
65
+ productSku: string;
66
+ productName: string;
67
+ orderItem: OrderItemModel;
68
+ };
69
+ export type ShipmentsTracingModel = {
25
70
  carrier: string;
71
+ number: string;
72
+ title: string;
73
+ };
74
+ export type ShipmentsModel = {
26
75
  id: string;
27
- items: any;
28
76
  number: string;
29
- orderDate: string;
30
- paymentMethods: any;
31
- shippingMethod: string;
32
- }
33
- export interface OrderCustomerInformation {
34
- defaultShipping: UserAddressesProps;
35
- defaultBulling: UserAddressesProps;
36
- }
37
- export type TransformedData<T extends QueryType> = T extends 'orderData' ? OrderData : T extends 'orderSummary' ? OrderSummary : T extends 'orderStatus' ? OrderStatus : T extends 'orderCustomerInformation' ? OrderCustomerInformation : null;
77
+ tracking: ShipmentsTracingModel[];
78
+ comments: {
79
+ message: string;
80
+ timestamp: string;
81
+ }[];
82
+ items: ShipmentItemsModel[];
83
+ };
84
+ export type OrderDataModel = {
85
+ number: string;
86
+ email?: string;
87
+ token?: string;
88
+ status: string;
89
+ isVirtual: boolean;
90
+ totalQuantity: number;
91
+ shippingMethod?: string;
92
+ carrier?: string;
93
+ coupons: {
94
+ code: string;
95
+ }[];
96
+ payments: {
97
+ code: string;
98
+ name: string;
99
+ }[];
100
+ shipping?: {
101
+ code: string;
102
+ amount: number;
103
+ currency: string;
104
+ };
105
+ shipments: ShipmentsModel[];
106
+ items: OrderItemModel[];
107
+ grandTotal: MoneyProps;
108
+ subtotal: MoneyProps;
109
+ totalTax: MoneyProps;
110
+ shippingAddress: OrderAddressModel;
111
+ billingAddress: OrderAddressModel;
112
+ availableActions: AvailableActionsProps[];
113
+ };
114
+ export type TransformedData<T extends QueryType> = T extends 'orderData' ? OrderDataModel : null;
38
115
  //# sourceMappingURL=order-details.d.ts.map
@@ -1,3 +1,4 @@
1
1
  export * from './transform-order-details';
2
2
  export * from './transform-guest-order';
3
+ export * from './transform-attributes-form';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { GetAttributesFormResponse, ResponseAttributesFormItemsProps } from '../../types';
2
+ import { AttributesFormModel } from '../models';
3
+
4
+ export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any;
5
+ export declare const transformAttributesForm: (response: GetAttributesFormResponse) => AttributesFormModel[];
6
+ //# sourceMappingURL=transform-attributes-form.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { GuestOrderByTokenResponse, GuestOrderResponse } from '../../types';
2
- import { GuestOrderModelResponse } from '../models';
2
+ import { OrderDataModel } from '../models';
3
3
 
4
- export declare const transformGuestOrder: (response: GuestOrderResponse) => GuestOrderModelResponse;
5
- export declare const transformGuestOrderByToken: (response: GuestOrderByTokenResponse) => GuestOrderModelResponse;
4
+ export declare const transformGuestOrder: (response: GuestOrderResponse) => OrderDataModel | null;
5
+ export declare const transformGuestOrderByToken: (response: GuestOrderByTokenResponse) => OrderDataModel | null;
6
6
  //# sourceMappingURL=transform-guest-order.d.ts.map
@@ -1,5 +1,7 @@
1
- import { QueryType, ResponseData } from '../../types';
1
+ import { QueryType, ResponseData, OrderProps, OrderItemProps } from '../../types';
2
2
  import { TransformedData } from '../models';
3
3
 
4
- export declare const transformOrderDetails: <T extends QueryType>(queryType: QueryType, response: ResponseData<T>) => TransformedData<T>;
4
+ export declare const transformConfigurableOptions: (item: OrderItemProps) => Record<string, string> | undefined;
5
+ export declare const transformOrderData: (orderData: OrderProps) => any;
6
+ export declare const transformOrderDetails: <T extends "orderData">(queryType: QueryType, response: ResponseData<T>) => TransformedData<T>;
5
7
  //# sourceMappingURL=transform-order-details.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+ import { NormalizeAddressProps, UseCustomerDetails } from '../../types';
3
+
4
+ export declare const useCustomerDetails: ({ orderData }: UseCustomerDetails) => {
5
+ order: OrderDataModel | undefined;
6
+ normalizeAddress: {
7
+ billingAddress: [] | NormalizeAddressProps[];
8
+ shippingAddress: [] | NormalizeAddressProps[];
9
+ };
10
+ loading: boolean;
11
+ };
12
+ //# sourceMappingURL=useCustomerDetails.d.ts.map
@@ -5,7 +5,7 @@ export declare const useOrderSearch: ({ onError }: useOrderSearchProps) => {
5
5
  inLineAlert: inLineAlertProps;
6
6
  loading: boolean;
7
7
  normalizeFieldsConfig: {
8
- entity_type: string;
8
+ entityType: string;
9
9
  is_unique: boolean;
10
10
  label: string;
11
11
  options: never[];
@@ -0,0 +1,8 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+ import { StatusEnumProps, UseOrderStatusProps } from '../../types';
3
+
4
+ export declare const useOrderStatus: ({ orderData }: UseOrderStatusProps) => {
5
+ orderStatus: StatusEnumProps;
6
+ order: OrderDataModel | undefined;
7
+ };
8
+ //# sourceMappingURL=useOrderStatus.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { OrderDataModel } from '../../data/models';
2
+ import { UseShippingStatusProps } from '../../types';
3
+
4
+ export declare const useShippingStatus: ({ orderData }: UseShippingStatusProps) => {
5
+ order: OrderDataModel | undefined;
6
+ };
7
+ //# sourceMappingURL=useShippingStatus.d.ts.map
package/hooks/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  export * from './containers/useOrderSearch';
2
+ export * from './containers/useOrderStatus';
3
+ export * from './containers/useShippingStatus';
4
+ export * from './containers/useCustomerDetails';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -13,12 +13,79 @@ declare const _default: {
13
13
  "requiredFieldError": "This is a required field."
14
14
  }
15
15
  },
16
+ "ShippingStatusCard": {
17
+ "trackButton": "Track package",
18
+ "carrier": "Carrier:",
19
+ "prepositionOf": "of",
20
+ "shippingCardTitle": "Package",
21
+ "shippingInfoTitle": "Shipping info",
22
+ "notYetShippedTitle": "Not yet shipped",
23
+ "notYetShippedImagesTitle": "Package contents"
24
+ },
25
+ "OrderStatusContent": {
26
+ "noInfoTitle": "Check back later for more details.",
27
+ "actions": {
28
+ "cancel": "Cancel order",
29
+ "return": "Return or replace",
30
+ "reorder": "Reorder"
31
+ },
32
+ "orderPending": {
33
+ "title": "Pending",
34
+ "message": "The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."
35
+ },
36
+ "orderProcessing": {
37
+ "title": "Processing",
38
+ "message": "The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."
39
+ },
40
+ "orderOnHold": {
41
+ "title": "On hold",
42
+ "message": "We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information."
43
+ },
44
+ "orderReceived": {
45
+ "title": "Order received",
46
+ "message": "The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."
47
+ },
48
+ "orderComplete": {
49
+ "title": "Complete",
50
+ "message": "Your order is complete. Need help with your order? Contact us at support@adobe.com"
51
+ },
52
+ "orderCanceled": {
53
+ "title": "Canceled",
54
+ "message": "This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."
55
+ },
56
+ "orderSuspectedFraud": {
57
+ "title": "Suspected fraud",
58
+ "message": "We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information."
59
+ },
60
+ "orderPaymentReview": {
61
+ "title": "Payment Review",
62
+ "message": "The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."
63
+ }
64
+ },
65
+ "CustomerDetails": {
66
+ "headerText": "Customer information",
67
+ "freeShipping": "Free shipping",
68
+ "email": {
69
+ "title": "Contact details"
70
+ },
71
+ "shippingAddress": {
72
+ "title": "Shipping address"
73
+ },
74
+ "shippingMethods": {
75
+ "title": "Shipping method"
76
+ },
77
+ "billingAddress": {
78
+ "title": "Billing address"
79
+ },
80
+ "billingMethods": {
81
+ "title": "Payment method"
82
+ }
83
+ },
16
84
  "Errors": {
17
85
  "invalidOrder": "Invalid order. Please try again.",
18
86
  "invalidSearch": "No order found with these order details."
19
87
  }
20
88
  }
21
- }
22
- ;
89
+ };
23
90
 
24
91
  export default _default;
@@ -0,0 +1,4 @@
1
+ export declare const convertToCamelCase: (key: string) => string;
2
+ export declare const convertToSnakeCase: (key: string) => string;
3
+ export declare const convertKeysCase: (data: any, type: 'snakeCase' | 'camelCase', dictionary?: Record<string, string>) => any;
4
+ //# sourceMappingURL=convertCase.d.ts.map
@@ -1,2 +1,3 @@
1
1
  export declare const convertToInputDateFormat: (dateTimeString: string) => string;
2
+ export declare const converDeliveryOrderDate: (dateTimeString: string) => string;
2
3
  //# sourceMappingURL=convertToInputDateFormat.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-order", "version": "0.1.0-alpha4", "@dropins/elsie": "0.28.2-alpha592"}
1
+ {"name": "@dropins/storefront-order", "version": "0.1.0-alpha6", "@dropins/elsie": "0.30.0-alpha620"}
package/render.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(a,t){try{if(typeof document<"u"){const e=document.createElement("style"),n=t.styleId;for(const r in t.attributes)e.setAttribute(r,t.attributes[r]);e.setAttribute("data-dropin",n),e.appendChild(document.createTextNode(a));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(e);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(e):document.head.append(e)}}}catch(e){console.error("dropin-styles (injectCodeFunction)",e)}})('.dropin-order-search-form{gap:var(--spacing-small);border-color:transparent}.dropin-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.dropin-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.dropin-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.dropin-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.dropin-order-search-form__wrapper__item--email{grid-area:email}.dropin-order-search-form__wrapper__item--postcode{grid-area:postcode}.dropin-order-search-form__wrapper__item--number{grid-area:number}.dropin-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.dropin-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.dropin-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email postcode" "number number" "button button"}}',{styleId:"order"});
2
- import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import{useState as a,useEffect as s}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";const c={OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."}},f={Order:c},l={default:f},p=({children:o})=>{const[i,t]=a("en_US");return s(()=>{const r=u.on("locale",n=>{t(n)},{eager:!0});return()=>{r==null||r.off()}},[]),e(m,{lang:i,langDefinitions:l,children:o})},b=new d(e(p,{}));export{b as render};
1
+ (function(a,t){try{if(typeof document<"u"){const r=document.createElement("style"),n=t.styleId;for(const i in t.attributes)r.setAttribute(i,t.attributes[i]);r.setAttribute("data-dropin",n),r.appendChild(document.createTextNode(a));const e=document.querySelector('style[data-dropin="sdk"]');if(e)e.after(r);else{const i=document.querySelector('link[rel="stylesheet"], style');i?i.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})('.dropin-order-search-form{gap:var(--spacing-small);border-color:transparent}.dropin-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.dropin-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.dropin-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.dropin-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.dropin-order-search-form__wrapper__item--email{grid-area:email}.dropin-order-search-form__wrapper__item--postcode{grid-area:postcode}.dropin-order-search-form__wrapper__item--number{grid-area:number}.dropin-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.dropin-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.dropin-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email postcode" "number number" "button button"}}.dropin-order-status-content{margin-bottom:var(--spacing-small)}.dropin-order-status-content.dropin-card--secondary{border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-order-status-content .dropin-card__content{gap:0}.dropin-order-status-content__wrapper p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.dropin-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.dropin-shipping-status-card{margin-bottom:var(--spacing-small)}.dropin-shipping-status-card .dropin-card__content{gap:0}.dropin-shipping-status-card.dropin-card--secondary{border:var(--shape-border-width-1) solid var(--color-neutral-400);border-radius:var(--shape-border-radius-1)}.dropin-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.dropin-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.dropin-shipping-status-card__header button{max-height:40px}.dropin-shipping-status-card__header--content p{margin:0;padding:0;margin-bottom:var(--spacing-xsmall)}.dropin-shipping-status-card .dropin-shipping-status-card__images{max-width:580px;display:grid;grid-template-columns:repeat(auto-fill,85px);grid-template-rows:114px;gap:7px;overflow:hidden}.dropin-shipping-status-card .dropin-shipping-status-card__images img{object-fit:contain}.dropin-order-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-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.dropin-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.dropin-order-actions__wrapper--empty{display:none}.dropin-details .dropin-card__content{gap:0}.dropin-details__container{display:grid;flex-direction:column;gap:var(--spacing-medium)}@media (min-width: 768px){.dropin-details__container{display:grid;grid-template-columns:max-content max-content;grid-template-rows:auto auto auto;gap:var(--spacing-medium);grid-auto-flow:row}.dropin-details__container-email{grid-area:1 / 1 / 2 / 2}.dropin-details__container-shipping_address{grid-area:2 / 1 / 3 / 2}.dropin-details__container-billing_address{grid-area:2 / 2 / 3 / 3}.dropin-details__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.dropin-details__container-billing_methods{grid-area:3 / 2 / 4 / 3}}.dropin-details__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.dropin-details__container p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.dropin-details__container-billing_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.dropin-details__container-billing_methods p.dropin-details__container-billing_methods--icon{gap:0 var(--spacing-xsmall)}.dropin-details__container-description p{margin:0;padding:0;display:inline-flex;overflow:hidden}.dropin-details__container-description p:nth-child(1),.dropin-details__container-description p:nth-child(2){text-align:left;cursor:default;margin-bottom:var(--spacing-xsmall)}.dropin-details__container-description p:nth-child(2){position:relative}.dropin-details__container-description p:nth-child(2) span{position:absolute}.dropin-details__container-description p:nth-child(1),.dropin-details__container-description p:nth-child(7){float:left;width:auto;margin-right:var(--spacing-xsmall)}.dropin-details__container-description p:nth-child(5){position:relative;margin-right:var(--spacing-xsmall)}.dropin-details__container-description p:nth-child(5) span{position:absolute}.dropin-details__container-description p:nth-child(2),.dropin-details__container-description p:nth-child(6),.dropin-details__container-description p:nth-child(8){display:inline;width:50%}.dropin-details__container-description p:nth-child(2):after,.dropin-details__container-description p:nth-child(6):after,.dropin-details__container-description p:nth-child(8):after{content:"\\a";white-space:pre;display:block;height:var(--spacing-xsmall)}.dropin-details__container-description p:nth-child(3),.dropin-details__container-description p:nth-child(4),.dropin-details__container-description p:nth-child(n+9){display:block;width:100%;margin-bottom:var(--spacing-xsmall)}',{styleId:"order"});
2
+ import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as d,useEffect as a}from"@dropins/tools/preact-hooks.js";import{UIProvider as c}from"@dropins/tools/components.js";import{events as l}from"@dropins/tools/event-bus.js";const p={OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",shippingCardTitle:"Package",shippingInfoTitle:"Shipping info",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:"Package contents"},OrderStatusContent:{noInfoTitle:"Check back later for more details.",actions:{cancel:"Cancel order",return:"Return or replace",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},billingMethods:{title:"Payment method"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."}},u={Order:p},m={default:u},h=({children:o})=>{const[i,t]=d("en_US");return a(()=>{const e=l.on("locale",s=>{t(s)},{eager:!0});return()=>{e==null||e.off()}},[]),r(c,{lang:i,langDefinitions:m,children:o})},C=new n(r(h,{}));export{C as render};
@@ -0,0 +1,31 @@
1
+ export interface ResponseAttributesFormItemsProps {
2
+ code: string;
3
+ sort_order: string;
4
+ default_value: null | string;
5
+ entity_type: string;
6
+ frontend_class: null | string;
7
+ multiline_count: number;
8
+ frontend_input: string;
9
+ is_required: boolean;
10
+ is_unique: boolean;
11
+ label: string;
12
+ options: {
13
+ is_default: boolean;
14
+ label: string;
15
+ value: string;
16
+ }[];
17
+ }
18
+ export interface GetAttributesFormResponse {
19
+ data: {
20
+ attributesForm: {
21
+ errors?: {
22
+ message: string;
23
+ }[];
24
+ items?: ResponseAttributesFormItemsProps[];
25
+ };
26
+ };
27
+ errors?: {
28
+ message: string;
29
+ }[];
30
+ }
31
+ //# sourceMappingURL=getAttributesForm.types.d.ts.map