@colabcommerce/elements 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/QuoteForm.js +22 -15
- package/dist/Store.js +1 -1
- package/dist/StoreLocator.js +18 -18
- package/dist/StoreLocatorProvider.js +1 -1
- package/dist/elements.css +1 -1
- package/dist/{index-DvX0QvFh.js → index-CPPzJjs-.js} +5 -5
- package/dist/{navigation-DpGLbcKb.js → navigation-QgfKnxTJ.js} +1 -1
- package/dist/store-locator-Cu5fUiVm.js +1 -0
- package/dist/{translations-6mspyPRw.js → translations-WfjA8013.js} +1 -1
- package/dist/useGeolocation-BEKRqeV7.js +1 -0
- package/dist/useGeolocation.js +1 -0
- package/dist/useStoreLocator.js +1 -1
- package/dist/useStoreLocatorConfig-CLD8ogGE.js +1 -0
- package/package.json +3 -1
- package/dist/store-locator-Bto20jHS.js +0 -1
- package/dist/useStoreLocatorConfig-r4Y_2t-M.js +0 -1
package/README.md
CHANGED
|
@@ -34,10 +34,11 @@ const MyStoreLocator = () => {
|
|
|
34
34
|
|
|
35
35
|
#### Props
|
|
36
36
|
|
|
37
|
-
| Prop
|
|
37
|
+
| Prop | Type | Default |
|
|
38
38
|
| --------------- | ------- | ------- |
|
|
39
|
-
| organizationId | String
|
|
40
|
-
| locale | String
|
|
39
|
+
| organizationId | String | null
|
|
40
|
+
| locale | String | 'en'
|
|
41
|
+
|
|
41
42
|
|
|
42
43
|
### StoreDetails
|
|
43
44
|
|
package/dist/QuoteForm.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{c as
|
|
2
|
-
/* @__PURE__ */e(
|
|
3
|
-
/* @__PURE__ */e(
|
|
4
|
-
/* @__PURE__ */e("
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{c as l}from"react/compiler-runtime";import{createContext as o,useState as s,useContext as r,useRef as n,useId as c,useEffect as i}from"react";import{u as d,a as m}from"./useStoreLocatorConfig-CLD8ogGE.js";import{u}from"./useGeolocation-BEKRqeV7.js";import*as h from"@radix-ui/react-popover";import*as p from"@radix-ui/react-scroll-area";import"@radix-ui/react-slot";import{b as f,c as x,u as g,I as v,A as y,a as b,M as N,m as _,i as S,j as w,k,L as I,n as C,l as L,B as A}from"./index-CPPzJjs-.js";import{useTranslation as j}from"react-i18next";import{c as z,S as M,M as D,B as F,C as O,a as P,L as T}from"./translations-WfjA8013.js";import"@radix-ui/react-collapsible";const q=o(),U=t=>{const a=l(36),{organizationId:o,locale:r,baseUrl:n,products:c,productKey:i,filterBy:h,children:p}=t,f=void 0===n?"/retailers":n;let x;a[0]!==c?(x=void 0===c?[]:c,a[0]=c,a[1]=x):x=a[1];const g=x;let v;a[2]!==h?(v=void 0===h?{stocked:["sku"],available:["sku"]}:h,a[2]=h,a[3]=v):v=a[3];const y=v,[b,N]=s(0),[_,S]=s(null),[w,k]=s(null),[I,C]=s(null),[L,A]=s(!1),[j,z]=s("300mi"),[M,D]=s(null),[F,O]=s("geolocation");let P;a[4]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(P={autoGeoLocate:!1},a[4]=P):P=a[4];const{location:T,Locate:U}=u(P),E="geolocation"===F?T:M||T;let B;a[5]!==E||a[6]!==o||a[7]!==j?(B={organizationId:o,location:E,page:1,radius:j,pageSize:10},a[5]=E,a[6]=o,a[7]=j,a[8]=B):B=a[8];const{stores:$,meta:H,isLoading:K,error:R}=d(B),{config:W,isLoading:Z,error:J}=m(o);let G;a[9]!==U||a[10]!==f||a[11]!==W||a[12]!==J||a[13]!==Z||a[14]!==y||a[15]!==w||a[16]!==r||a[17]!==E||a[18]!==L||a[19]!==I||a[20]!==H||a[21]!==o||a[22]!==i||a[23]!==g||a[24]!==R||a[25]!==K||a[26]!==M||a[27]!==j||a[28]!==_||a[29]!==b||a[30]!==$||a[31]!==F?(G={stepIndex:b,setStepIndex:N,selectedStoreId:_,setSelectedStoreId:S,focusedStoreId:w,setFocusedStoreId:k,organizationId:o,location:E,locale:r,stores:$,meta:H,searchIsLoading:K,searchError:R,config:W,configIsLoading:Z,configError:J,messageDialogOpen:L,setMessageDialogOpen:A,messageStoreId:I,setMessageStoreId:C,baseUrl:f,searchRadius:j,setSearchRadius:z,searchLocation:M,setSearchLocation:D,useLocationType:F,setUseLocationType:O,products:g,productKey:i,filterBy:y,Locate:U},a[9]=U,a[10]=f,a[11]=W,a[12]=J,a[13]=Z,a[14]=y,a[15]=w,a[16]=r,a[17]=E,a[18]=L,a[19]=I,a[20]=H,a[21]=o,a[22]=i,a[23]=g,a[24]=R,a[25]=K,a[26]=M,a[27]=j,a[28]=_,a[29]=b,a[30]=$,a[31]=F,a[32]=G):G=a[32];const V=G;let Q;return a[33]!==p||a[34]!==V?(Q=/* @__PURE__ */e(q.Provider,{value:V,children:p}),a[33]=p,a[34]=V,a[35]=Q):Q=a[35],Q},E=()=>r(q),B=z("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]),$=z("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);function H(e){return e?.label??e?.description??e?.text??e?.placePrediction?.text?.text??e?.placePrediction?.structuredFormat?.mainText?.text??""}function K(){const o=l(66),{t:r}=j(),[d,m]=s("");s(!1);const[u,g]=s(!1),[v,y]=s(-1),{location:b,setSearchLocation:N,setUseLocationType:_,Locate:S}=E();let w,k,I;o[0]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(w={lat:37.7937,lng:-122.3965},o[0]=w):w=o[0],o[1]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(k=["locality","postal_code"],o[1]=k):k=o[1],o[2]!==d?(I={query:d,apiKey:"AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M",center:w,radiusMeters:1e4,types:k},o[2]=d,o[3]=I):I=o[3];const{results:C,isLoading:L,error:A}=f(I);let z;o[4]!==C?(z=Array.isArray(C)?C:[],o[4]=C,o[5]=z):z=o[5];const F=z,O=n(null),P=c(),T=v>=0?`${P}-opt-${v}`:void 0;let q,U,B;o[6]!==L||o[7]!==F.length||o[8]!==u?(q=()=>{u&&(L||y(F.length?0:-1))},U=[u,L,F.length],o[6]=L,o[7]=F.length,o[8]=u,o[9]=q,o[10]=U):(q=o[9],U=o[10]),i(q,U),o[11]!==N||o[12]!==_?(B=e=>{const t=H(e);if(!t)return;m(t),g(!1),requestAnimationFrame(()=>O.current?.focus());const a={latitude:e.location?.lat??null,longitude:e.location?.lng??null,accuracy:null,altitude:0,altitudeAccuracy:null,heading:null,speed:null,city:e.city??null,region:e.region??null,country:e.country??null,postal:e.postalCode??null,timezone:null,ip:null,type:"search",raw:e};N(a),_("search")},o[11]=N,o[12]=_,o[13]=B):B=o[13];const $=B;let K;o[14]!==v||o[15]!==$||o[16]!==F||o[17]!==u?(K=e=>{if(u||"ArrowDown"!==e.key&&"ArrowUp"!==e.key){if(u)e:switch(e.key){case"ArrowDown":e.preventDefault(),y(e=>Math.min(e+1,F.length-1));break e;case"ArrowUp":e.preventDefault(),y(Z);break e;case"Enter":v>=0&&F[v]&&(e.preventDefault(),$(F[v]));break e;case"Escape":e.preventDefault(),g(!1)}}else g(!0)},o[14]=v,o[15]=$,o[16]=F,o[17]=u,o[18]=K):K=o[18];const J=K;let G;o[19]!==S||o[20]!==_?(G=()=>{_("geolocation"),g(!1),m(""),S()},o[19]=S,o[20]=_,o[21]=G):G=o[21];const V=G;let Q;o[22]!==A||o[23]!==L||o[24]!==F.length||o[25]!==u||o[26]!==d?(Q=u&&!L&&!A&&d.trim().length>0&&0===F.length,o[22]=A,o[23]=L,o[24]=F.length,o[25]=u,o[26]=d,o[27]=Q):Q=o[27];const Y=Q,X=L||!!A||Y||F.length>0;let ee,te,ae,le,oe,se,re,ne,ce,ie,de,me;return o[28]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(ee=/* @__PURE__ */e(M,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),o[28]=ee):ee=o[28],o[29]!==b||o[30]!==r?(te=b?.city?r("default:location_search_placeholder_w_location",{location:b.city}):r("default:location_search_placeholder"),o[29]=b,o[30]=r,o[31]=te):te=o[31],o[32]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(ae=e=>{m(e.target.value),g(!0)},le=()=>g(!0),o[32]=ae,o[33]=le):(ae=o[32],le=o[33]),o[34]!==T||o[35]!==P||o[36]!==J||o[37]!==u||o[38]!==d||o[39]!==te?(oe=/* @__PURE__ */e(h.Anchor,{asChild:!0,children:/* @__PURE__ */t("div",{className:"flex-1 relative",children:[ee,
|
|
2
|
+
/* @__PURE__ */e(x,{ref:O,type:"text",placeholder:te,value:d,onChange:ae,onFocus:le,onKeyDown:J,className:"pl-10 h-12",role:"combobox","aria-autocomplete":"list","aria-expanded":u,"aria-controls":P,"aria-activedescendant":T})]})}),o[34]=T,o[35]=P,o[36]=J,o[37]=u,o[38]=d,o[39]=te,o[40]=oe):oe=o[40],o[41]!==v||o[42]!==$||o[43]!==A||o[44]!==L||o[45]!==F||o[46]!==P||o[47]!==X||o[48]!==Y||o[49]!==r?(se=X?/* @__PURE__ */t(a,{children:[
|
|
3
|
+
/* @__PURE__ */e(p.Viewport,{children:/* @__PURE__ */t("div",{id:P,role:"listbox",className:"p-2",children:[A?/* @__PURE__ */e("div",{className:"px-3 py-2 text-sm rounded-md border border-destructive/30 bg-destructive/10 text-destructive",children:String(A)}):null,L?/* @__PURE__ */e("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:r("default:loading")}):null,Y?/* @__PURE__ */e("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:r("default:no_results")}):null,!L&&!A&&F.map((a,l)=>{const o=l===v,s=H(a),r=(n=a,n?.secondary??n?.secondary_text??n?.placePrediction?.structuredFormat?.secondaryText?.text??n?.placePrediction?.structuredFormat?.secondaryText??"");var n;const c=function(e,t){return e?.id??e?.place_id??e?.placePrediction?.placeId??t}(a,`${l}`);return s?/* @__PURE__ */t("div",{id:`${P}-opt-${l}`,role:"option","aria-selected":o,onMouseEnter:()=>y(l),onMouseDown:R,onClick:()=>$(a),className:["cursor-pointer rounded-lg px-3 py-2",o?"bg-muted":"hover:bg-muted/60"].join(" "),children:[
|
|
4
|
+
/* @__PURE__ */e("div",{className:"text-sm text-left font-medium leading-tight",children:s}),r?/* @__PURE__ */e("div",{className:"text-xs text-left text-muted-foreground mt-1 leading-tight",children:r}):null]},c):null})]})}),
|
|
5
|
+
/* @__PURE__ */e(p.Scrollbar,{orientation:"vertical",className:"flex select-none touch-none p-0.5 bg-transparent",children:/* @__PURE__ */e(p.Thumb,{className:"flex-1 bg-border rounded-full"})})]}):null,o[41]=v,o[42]=$,o[43]=A,o[44]=L,o[45]=F,o[46]=P,o[47]=X,o[48]=Y,o[49]=r,o[50]=se):se=o[50],o[51]!==se?(re=/* @__PURE__ */e(h.Content,{sideOffset:6,align:"start",onOpenAutoFocus:W,className:"w-[var(--radix-popover-trigger-width)] max-w-[560px] rounded-xl border rounded bg-background shadow-lg overflow-hidden",children:/* @__PURE__ */e(p.Root,{className:"max-h-80",children:se})}),o[51]=se,o[52]=re):re=o[52],o[53]!==u||o[54]!==oe||o[55]!==re?(ne=/* @__PURE__ */e("div",{className:"flex flex-row gap-4",children:/* @__PURE__ */t(h.Root,{open:u,onOpenChange:g,children:[oe,re]})}),o[53]=u,o[54]=oe,o[55]=re,o[56]=ne):ne=o[56],o[57]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(ce=/* @__PURE__ */e(D,{className:"w-4 h-4"}),o[57]=ce):ce=o[57],o[58]!==r?(ie=r("default:use_my_location"),o[58]=r,o[59]=ie):ie=o[59],o[60]!==V||o[61]!==ie?(de=/* @__PURE__ */t("div",{className:"mt-2 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[ce,
|
|
6
|
+
/* @__PURE__ */e("button",{className:"text-primary hover:underline font-medium",type:"button",onClick:V,children:ie})]}),o[60]=V,o[61]=ie,o[62]=de):de=o[62],o[63]!==ne||o[64]!==de?(me=/* @__PURE__ */e("div",{className:"max-w-3xl mx-auto",children:/* @__PURE__ */t("div",{className:"rounded-xl p-6",children:[ne,de]})}),o[63]=ne,o[64]=de,o[65]=me):me=o[65],me}function R(e){return e.preventDefault()}function W(e){return e.preventDefault()}function Z(e){return Math.max(e-1,0)}const J=a=>{const o=l(29),{store:r,isSelected:n,onClick:c,onSelect:i}=a,[,d]=s(!1),[m,u]=g();let h;o[0]!==c||o[1]!==r.id?(h=()=>{c&&c(r.id)},o[0]=c,o[1]=r.id,o[2]=h):h=o[2];const p=h;let f;o[3]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(f=()=>d(!1),o[3]=f):f=o[3];const x=f,b=n;let N;o[4]!==i||o[5]!==r.id?(N=e=>{e.stopPropagation(),i&&i(r.id)},o[4]=i,o[5]=r.id,o[6]=N):N=o[6];const _=N,S=1*r.address?.latitude,w=1*r.address?.longitude;let k;o[7]!==S||o[8]!==w?(k={lat:S,lng:w},o[7]=S,o[8]=w,o[9]=k):k=o[9];const I="w-8 h-8 hover:cursor-pointer "+(n?"text-primary fill-white z-10":"z-1 fill-white text-muted-foreground");let C,L,A;return o[10]!==I?(C=/* @__PURE__ */e(D,{className:I,size:32}),o[10]=I,o[11]=C):C=o[11],o[12]!==_||o[13]!==u||o[14]!==b||o[15]!==r.address?.city||o[16]!==r.address?.postal_code||o[17]!==r.address?.province||o[18]!==r.address?.street_line_one||o[19]!==r.address?.street_line_two||o[20]!==r.retailer_name?(L=b&&/* @__PURE__ */t(v,{anchor:u,headerContent:/* @__PURE__ */e("h3",{className:"cc-iw-title font-bold text-sm align-center text-left mb-2",style:{color:"#111827"},children:r.retailer_name}),onClose:x,children:[
|
|
5
7
|
/* @__PURE__ */t("p",{className:"text-xs text-left text-muted-foreground",children:[r.address?.street_line_one,r.address?.street_line_two?`, ${r.address?.street_line_two}`:""]}),
|
|
6
8
|
/* @__PURE__ */t("p",{className:"text-xs text-left text-muted-foreground mb-2",children:[r.address?.city,", ",r.address?.province," ",r.address?.postal_code]}),
|
|
7
|
-
/* @__PURE__ */e("div",{className:"flex flex-row gap-2 mb-1",children:/* @__PURE__ */e(
|
|
8
|
-
/* @__PURE__ */e("span",{className:"text-primary",children:s.length})," stores found"]}),
|
|
9
|
-
/* @__PURE__ */t("div",{children:[
|
|
10
|
-
/* @__PURE__ */e("span",{className:"text-muted-foreground",children:/* @__PURE__ */e(
|
|
11
|
-
/* @__PURE__ */e(
|
|
12
|
-
/* @__PURE__ */e($,{className:"w-4 me-1 h-4 text-orange-600"}),"Available by Special Order"]}),o[
|
|
9
|
+
/* @__PURE__ */e("div",{className:"flex flex-row gap-2 mb-1",children:/* @__PURE__ */e(F,{className:"flex-1 md:flex-row",size:"sm",onClick:_,children:"Select"})})]}),o[12]=_,o[13]=u,o[14]=b,o[15]=r.address?.city,o[16]=r.address?.postal_code,o[17]=r.address?.province,o[18]=r.address?.street_line_one,o[19]=r.address?.street_line_two,o[20]=r.retailer_name,o[21]=L):L=o[21],o[22]!==p||o[23]!==m||o[24]!==r.name||o[25]!==k||o[26]!==C||o[27]!==L?(A=/* @__PURE__ */t(y,{position:k,ref:m,title:r.name,onClick:p,children:[C,L]}),o[22]=p,o[23]=m,o[24]=r.name,o[25]=k,o[26]=C,o[27]=L,o[28]=A):A=o[28],A},G=()=>{const a=l(46),{location:o,stores:s,focusedStoreId:r,setFocusedStoreId:n,setSelectedStoreId:c,setStepIndex:d}=E(),m=b();let u;a[0]!==m?(u=()=>{if(!m)return;const e=m.getZoom();m.setZoom(e+1)},a[0]=m,a[1]=u):u=a[1];const h=u;let p;a[2]!==m?(p=()=>{if(!m)return;const e=m.getZoom();m.setZoom(e-1)},a[2]=m,a[3]=p):p=a[3];const f=p;let x,g,v,y,_;a[4]!==o||a[5]!==m?(x=()=>{m&&o?.latitude&&o?.longitude&&(m.panTo({lat:o.latitude,lng:o.longitude}),m.setZoom(9))},g=[o,m],a[4]=o,a[5]=m,a[6]=x,a[7]=g):(x=a[6],g=a[7]),i(x,g),a[8]!==r||a[9]!==m||a[10]!==s?(v=()=>{if(!m||!r)return;const e=s.find(e=>e.id===r);e&&e.address&&m.panTo({lat:1*e.address.latitude,lng:1*e.address.longitude})},y=[r,s,m],a[8]=r,a[9]=m,a[10]=s,a[11]=v,a[12]=y):(v=a[11],y=a[12]),i(v,y),a[13]!==n?(_=e=>{n(e)},a[13]=n,a[14]=_):_=a[14];const S=_;let w;a[15]!==c||a[16]!==d?(w=e=>{c(e),d(1)},a[15]=c,a[16]=d,a[17]=w):w=a[17];const k=w;let I,C,L,A,j,z,M,D,F,O,P;if(a[18]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(I={width:"100%",height:"300px"},C={lat:22.54992,lng:0},a[18]=I,a[19]=C):(I=a[18],C=a[19]),a[20]!==r||a[21]!==S||a[22]!==k||a[23]!==s){let t;a[25]!==r||a[26]!==S||a[27]!==k?(t=t=>/* @__PURE__ */e(J,{store:t,isSelected:r===t.id,onClick:S,onSelect:k},t.id),a[25]=r,a[26]=S,a[27]=k,a[28]=t):t=a[28],L=s.map(t),a[20]=r,a[21]=S,a[22]=k,a[23]=s,a[24]=L}else L=a[24];return a[29]!==L?(A=/* @__PURE__ */e("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/5 to-muted",children:/* @__PURE__ */e("div",{className:"text-center w-full",children:/* @__PURE__ */e(N,{style:I,defaultCenter:C,defaultZoom:3,gestureHandling:"greedy",disableDefaultUI:!0,mapId:"b1e4f5f5f8c7e2d9",children:L})})}),a[29]=L,a[30]=A):A=a[30],a[31]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(j=/* @__PURE__ */e("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),a[31]=j):j=a[31],a[32]!==h?(z=/* @__PURE__ */e("button",{className:"bg-card border shadow-md rounded-lg p-2 hover:bg-accent transition-colors",onClick:h,children:j}),a[32]=h,a[33]=z):z=a[33],a[34]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(M=/* @__PURE__ */e("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */e("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})}),a[34]=M):M=a[34],a[35]!==f?(D=/* @__PURE__ */e("button",{className:"bg-card border shadow-md rounded-lg p-2 hover:bg-accent transition-colors",onClick:f,children:M}),a[35]=f,a[36]=D):D=a[36],a[37]!==z||a[38]!==D?(F=/* @__PURE__ */t("div",{className:"absolute top-4 right-4 flex flex-col gap-2",children:[z,D]}),a[37]=z,a[38]=D,a[39]=F):F=a[39],a[40]!==s.length?(O=/* @__PURE__ */t("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-card border shadow-lg rounded-full px-4 py-2 text-sm font-medium",children:[
|
|
10
|
+
/* @__PURE__ */e("span",{className:"text-primary",children:s.length})," stores found"]}),a[40]=s.length,a[41]=O):O=a[41],a[42]!==A||a[43]!==F||a[44]!==O?(P=/* @__PURE__ */e("div",{className:"relative",children:/* @__PURE__ */t("div",{className:"bg-muted rounded-xl overflow-hidden border shadow-md h-[300px]",children:[A,F,O]})}),a[42]=A,a[43]=F,a[44]=O,a[45]=P):P=a[45],P},V=a=>{const o=l(61),{id:s,name:r,addressLineOne:n,city:c,province:i,postalCode:d,hours:m,distance:u,services:h,isFocused:p,handleFocus:f,handleSelect:x,requestedProducts:g,locationProducts:v,filterBy:y}=a,b=void 0===h?[]:h;let N;o[0]!==g?(N=void 0===g?[]:g,o[0]=g,o[1]=N):N=o[1];const w=N;let k;o[2]!==v?(k=void 0===v?[]:v,o[2]=v,o[3]=k):k=o[3];const I=k,C=void 0===y?"sku":y,{t:L}=j(),{availabilitySummary:A}=((e,t,a=["sku"])=>{const l={};t.map(t=>{const o=e.find(e=>a.some(a=>e[a]===t.key));l[t.sku]=o?{stocked:o.stocked,available:o.available}:{stocked:!1,available:!1}});const o=Object.values(l).every(e=>e.stocked),s=Object.values(l).every(e=>e.available),r=Object.values(l).every(e=>!e.stocked),n=Object.values(l).every(e=>!e.available);let c="mixed";return o?c="allStocked":s?c="allAvailable":r&&n&&(c="none"),{availability:l,allAvailable:s,allStocked:o,noneStocked:r,noneAvailable:n,availabilitySummary:c}})(I,w,C);let z;o[4]!==x||o[5]!==s?(z=e=>{e.stopPropagation(),x(s)},o[4]=x,o[5]=s,o[6]=z):z=o[6];const M=z,P="bg-card border rounded-xl p-6 transition-all hover:shadow-lg cursor-pointer "+(p?"ring-2 ring-primary shadow-lg":"");let T,q,U,E,H,K,R,W,Z,J,G,V,X,ee;o[7]!==f||o[8]!==s?(T=()=>f(s),o[7]=f,o[8]=s,o[9]=T):T=o[9],o[10]!==r?(q=/* @__PURE__ */e("div",{className:"flex items-start justify-between gap-4 mb-3",children:/* @__PURE__ */e("div",{children:/* @__PURE__ */e("h3",{className:"font-bold text-lg text-left mb-1",children:r})})}),o[10]=r,o[11]=q):q=o[11],o[12]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(U=/* @__PURE__ */e(D,{className:"w-4 h-4 text-muted-foreground mt-0.5 shrink-0"}),o[12]=U):U=o[12],o[13]!==n?(E=/* @__PURE__ */e("p",{className:"font-medium text-left",children:n}),o[13]=n,o[14]=E):E=o[14],o[15]!==c||o[16]!==d||o[17]!==i?(H=/* @__PURE__ */t("p",{className:"text-muted-foreground text-left",children:[c,", ",i," ",d]}),o[15]=c,o[16]=d,o[17]=i,o[18]=H):H=o[18],o[19]!==u||o[20]!==L?(K=L("default:distance_away",{distance:_(u).toFixed(1),distanceUnit:"miles"}),o[19]=u,o[20]=L,o[21]=K):K=o[21],o[22]!==K?(R=/* @__PURE__ */e("p",{className:"text-primary font-medium mt-1 text-left",children:K}),o[22]=K,o[23]=R):R=o[23],o[24]!==E||o[25]!==H||o[26]!==R?(W=/* @__PURE__ */t("div",{className:"flex items-start gap-2",children:[U,
|
|
11
|
+
/* @__PURE__ */t("div",{children:[E,H,R]})]}),o[24]=E,o[25]=H,o[26]=R,o[27]=W):W=o[27],o[28]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(Z=/* @__PURE__ */e("div",{className:"mt-2.5",children:/* @__PURE__ */e(O,{className:"w-4 h-4 text-muted-foreground"})}),o[28]=Z):Z=o[28],o[29]!==m?(J=/* @__PURE__ */t("div",{className:"flex items-top gap-2",children:[Z,
|
|
12
|
+
/* @__PURE__ */e("span",{className:"text-muted-foreground",children:/* @__PURE__ */e(S,{hours:m})})]}),o[29]=m,o[30]=J):J=o[30],o[31]!==W||o[32]!==J?(G=/* @__PURE__ */t("div",{className:"space-y-2 text-sm",children:[W,J]}),o[31]=W,o[32]=J,o[33]=G):G=o[33],o[34]!==A?(V="allStocked"===A&&/* @__PURE__ */t("div",{className:"flex items-center shrink mt-3 px-3 py-1 bg-green-50 text-green-600 text-xs font-medium rounded-full",children:[
|
|
13
|
+
/* @__PURE__ */e(B,{className:"w-4 h-4 text-green-600 me-1"}),"All Items Stocked"]}),o[34]=A,o[35]=V):V=o[35],o[36]!==A?(X="allAvailable"===A&&/* @__PURE__ */t("div",{className:"flex items-center shrink mt-3 px-3 py-1 bg-orange-50 text-orange-600 text-xs font-medium rounded-full",children:[
|
|
14
|
+
/* @__PURE__ */e($,{className:"w-4 me-1 h-4 text-orange-600"}),"Available by Special Order"]}),o[36]=A,o[37]=X):X=o[37],o[38]!==A?(ee="mixed"===A&&/* @__PURE__ */t("div",{children:[
|
|
13
15
|
/* @__PURE__ */t("div",{className:"flex items-center gap-2 mt-4 text-sm",children:[
|
|
14
16
|
/* @__PURE__ */e("span",{className:"font-bold w-28 text-wrap",children:"Braxton"}),
|
|
15
17
|
/* @__PURE__ */t("span",{className:"flex items-center px-3 py-1 bg-orange-50 text-orange-600 text-xs font-medium rounded-full",children:[
|
|
@@ -17,8 +19,13 @@ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{c as a}from"react/compi
|
|
|
17
19
|
/* @__PURE__ */t("div",{className:"flex items-center gap-2 mt-4 text-sm",children:[
|
|
18
20
|
/* @__PURE__ */e("span",{className:"font-bold w-28 text-wrap",children:"Juno"}),
|
|
19
21
|
/* @__PURE__ */t("span",{className:"flex items-center px-3 py-1 bg-green-50 text-green-600 text-xs font-medium rounded-full",children:[
|
|
20
|
-
/* @__PURE__ */e(
|
|
21
|
-
return e("span",{className:"px-3 py-1 bg-primary/10 text-primary text-xs font-medium rounded-full",children:t},t)}function
|
|
22
|
-
/* @__PURE__ */e("
|
|
23
|
-
/* @__PURE__ */e(
|
|
24
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */e(B,{className:"w-4 me-1 h-4 text-green-600"}),"Stocked"]})]})]}),o[38]=A,o[39]=ee):ee=o[39];const te=b.filter(Q).map(Y);let ae,le,oe,se,re,ne;return o[40]!==te?(ae=/* @__PURE__ */e("div",{className:"flex flex-wrap gap-2 mt-4",children:te}),o[40]=te,o[41]=ae):ae=o[41],o[42]!==q||o[43]!==G||o[44]!==V||o[45]!==X||o[46]!==ee||o[47]!==ae?(le=/* @__PURE__ */t("div",{className:"flex-1",children:[q,G,V,X,ee,ae]}),o[42]=q,o[43]=G,o[44]=V,o[45]=X,o[46]=ee,o[47]=ae,o[48]=le):le=o[48],o[49]!==L?(oe=L("default:select_store"),o[49]=L,o[50]=oe):oe=o[50],o[51]!==M||o[52]!==oe?(se=/* @__PURE__ */e("div",{className:"flex md:flex-col gap-2",children:/* @__PURE__ */e(F,{onClick:M,variant:"default",className:"whitespace-nowrap",children:oe})}),o[51]=M,o[52]=oe,o[53]=se):se=o[53],o[54]!==le||o[55]!==se?(re=/* @__PURE__ */t("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[le,se]}),o[54]=le,o[55]=se,o[56]=re):re=o[56],o[57]!==re||o[58]!==P||o[59]!==T?(ne=/* @__PURE__ */e("div",{className:P,onClick:T,children:re}),o[57]=re,o[58]=P,o[59]=T,o[60]=ne):ne=o[60],ne};function Q(e){return e}function Y(t){/* @__PURE__ */
|
|
23
|
+
return e("span",{className:"px-3 py-1 bg-primary/10 text-primary text-xs font-medium rounded-full",children:t},t)}function X(){const a=l(28),{stores:o,location:s,products:r,setStepIndex:n,productKey:c,setSelectedStoreId:i,searchIsLoading:d,searchError:m,baseUrl:u,focusedStoreId:h,setFocusedStoreId:p}=E();let f;a[0]!==i||a[1]!==n?(f=e=>{i(e),n(1)},a[0]=i,a[1]=n,a[2]=f):f=a[2];const x=f;let g,v,y,b,N;return a[3]!==m||a[4]!==d||a[5]!==o?(g=!d&&!m&&0===o.length&&/* @__PURE__ */e(w,{}),a[3]=m,a[4]=d,a[5]=o,a[6]=g):g=a[6],a[7]!==d?(v=d&&/* @__PURE__ */e("div",{className:"flex items-center justify-center h-48",children:/* @__PURE__ */e(I,{})}),a[7]=d,a[8]=v):v=a[8],a[9]!==u||a[10]!==h||a[11]!==x||a[12]!==s||a[13]!==c||a[14]!==r||a[15]!==m||a[16]!==d||a[17]!==p||a[18]!==o?(y=!d&&!m&&o.map(t=>/* @__PURE__ */e(V,{id:t.id,name:t.retailer_name,placeId:t.place_id,addressLineOne:t.address?.street_line_one,addressLineTwo:t.address?.street_line_two,city:t.address?.city,province:t.address?.province,postalCode:t.address?.postal_code,country:t.address?.country,distance:k(s.latitude,s.longitude,t.address?.latitude,t.address?.longitude),phone:t.phone_number,hours:t.retailer_location_hours,services:[t.store_type],isFocused:h===t.id,handleFocus:p,href:`${u}/${t.id}`,handleSelect:x,locationProducts:t.retailer_location_products,requestedProducts:r,filterBy:[c]},t.id)),a[9]=u,a[10]=h,a[11]=x,a[12]=s,a[13]=c,a[14]=r,a[15]=m,a[16]=d,a[17]=p,a[18]=o,a[19]=y):y=a[19],a[20]!==m||a[21]!==d?(b=!d&&m&&/* @__PURE__ */e("div",{className:"text-red-600 text-center",children:"An error occurred while searching for stores. Please try again."}),a[20]=m,a[21]=d,a[22]=b):b=a[22],a[23]!==g||a[24]!==v||a[25]!==y||a[26]!==b?(N=/* @__PURE__ */t("div",{className:"space-y-4",children:[g,v,y,b]}),a[23]=g,a[24]=v,a[25]=y,a[26]=b,a[27]=N):N=a[27],N}const ee=a=>{const o=l(30),{onClose:s,onSuccess:r}=a,{organizationId:n,location:c,selectedStoreId:i,products:d,stores:m,productKey:u}=E();let h,p,f,x,g,v;if(o[0]!==c||o[1]!==s||o[2]!==r||o[3]!==n||o[4]!==u||o[5]!==d||o[6]!==i||o[7]!==m){let a;o[12]!==i?(a=e=>e.id===i,o[12]=i,o[13]=a):a=o[13];const l=m.find(a),g=l?.retailer_location_products?.filter(e=>d.map(te).includes(e[u]));let v;o[14]!==r?(v=(e,t)=>{r&&r({formValues:e,lead:t})},o[14]=r,o[15]=v):v=o[15];const y=v;f=/* @__PURE__ */t("div",{className:"mb-3",children:["Selected location ",
|
|
24
|
+
/* @__PURE__ */e("strong",{children:l?.retailer_name})]}),o[16]!==y||o[17]!==c||o[18]!==s||o[19]!==n||o[20]!==d||o[21]!==i?(x=/* @__PURE__ */e(C,{onClose:s,products:d,activityType:"LeadActivity::QuoteRequest",onSuccess:y,location:c,organizationId:n,selectedLocationId:i}),o[16]=y,o[17]=c,o[18]=s,o[19]=n,o[20]=d,o[21]=i,o[22]=x):x=o[22],h="mt-5",p=g?.map(a=>/* @__PURE__ */t("div",{className:"grid grid-cols-2 gap-4",children:[
|
|
25
|
+
/* @__PURE__ */e("img",{src:a.images[0],alt:a.name,className:"w-full"}),
|
|
26
|
+
/* @__PURE__ */t("div",{children:[
|
|
27
|
+
/* @__PURE__ */e("div",{className:"font-semibold fs-lg",children:a.name}),
|
|
28
|
+
/* @__PURE__ */e("div",{children:a.category})]})]},a[u])),o[0]=c,o[1]=s,o[2]=r,o[3]=n,o[4]=u,o[5]=d,o[6]=i,o[7]=m,o[8]=h,o[9]=p,o[10]=f,o[11]=x}else h=o[8],p=o[9],f=o[10],x=o[11];return o[23]!==h||o[24]!==p?(g=/* @__PURE__ */e("div",{className:h,children:p}),o[23]=h,o[24]=p,o[25]=g):g=o[25],o[26]!==f||o[27]!==x||o[28]!==g?(v=/* @__PURE__ */t("div",{children:[f,x,g]}),o[26]=f,o[27]=x,o[28]=g,o[29]=v):v=o[29],v};function te(e){return e.key}function ae(t){const a=l(8),{active:o,children:s,className:r}=t,n=o?"open":"closed";let c,i,d;return a[0]!==r?(c=P("absolute inset-0","transition duration-300 ease-out will-change-transform","data-[state=closed]:pointer-events-none",r),a[0]=r,a[1]=c):c=a[1],a[2]!==s?(i=/* @__PURE__ */e("div",{className:"w-full h-[100%]",children:s}),a[2]=s,a[3]=i):i=a[3],a[4]!==n||a[5]!==c||a[6]!==i?(d=/* @__PURE__ */e("div",{"data-state":n,className:c,children:i}),a[4]=n,a[5]=c,a[6]=i,a[7]=d):d=a[7],d}const le=a=>{const o=l(31),{onClose:s,onSuccess:r}=a,{stepIndex:n,setStepIndex:c}=E();let i;o[0]!==s?(i=()=>{s&&s()},o[0]=s,o[1]=i):i=o[1];const d=i;let m;o[2]!==r||o[3]!==c?(m=e=>{c(2),r&&r(e)},o[2]=r,o[3]=c,o[4]=m):m=o[4];const u=m,h=0===n;let p,f,x,g;o[5]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(p=P("data-[state=open]:opacity-100 data-[state=open]:translate-x-0","data-[state=closed]:opacity-0 data-[state=closed]:-translate-x-6"),o[5]=p):p=o[5],o[6]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(f=/* @__PURE__ */e(K,{}),o[6]=f):f=o[6],o[7]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(x=/* @__PURE__ */t("div",{className:"relative px-1 h-screen overflow-y-scroll",children:[f,
|
|
29
|
+
/* @__PURE__ */e("div",{className:"pb-8",children:/* @__PURE__ */e(L,{apiKey:"AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M",children:/* @__PURE__ */e(G,{})})}),
|
|
30
|
+
/* @__PURE__ */e(X,{})]}),o[7]=x):x=o[7],o[8]!==h?(g=/* @__PURE__ */e(ae,{active:h,className:p,children:x}),o[8]=h,o[9]=g):g=o[9];const v=1===n;let y,b,N,_;o[10]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(y=P("data-[state=open]:opacity-100 data-[state=open]:translate-x-0","data-[state=closed]:opacity-0 data-[state=closed]:-translate-x-6","flex items-center"),o[10]=y):y=o[10],o[11]!==c?(b=()=>c(0),o[11]=c,o[12]=b):b=o[12],o[13]!==u||o[14]!==b?(N=/* @__PURE__ */e("div",{className:"px-1",children:/* @__PURE__ */e(ee,{onClose:b,onSuccess:u})}),o[13]=u,o[14]=b,o[15]=N):N=o[15],o[16]!==N||o[17]!==v?(_=/* @__PURE__ */e(ae,{active:v,className:y,children:N}),o[16]=N,o[17]=v,o[18]=_):_=o[18];const S=2===n;let w,k,I,C,j,z;return o[19]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(w=P("data-[state=open]:opacity-100 data-[state=open]:translate-x-0","data-[state=closed]:opacity-0 data-[state=closed]:-translate-x-6","flex items-center"),o[19]=w):w=o[19],o[20]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(k=/* @__PURE__ */e("h2",{className:"text-2xl font-semibold mb-4",children:"Thank you!"}),I=/* @__PURE__ */e("p",{className:"mb-8",children:"Your quote request has been submitted successfully. We will get back to you shortly."}),o[20]=k,o[21]=I):(k=o[20],I=o[21]),o[22]!==d?(C=/* @__PURE__ */e("div",{className:"px-1",children:/* @__PURE__ */t("div",{className:"text-center py-20 px-4",children:[k,I,
|
|
31
|
+
/* @__PURE__ */e(A,{onClick:d,children:"Close"})]})}),o[22]=d,o[23]=C):C=o[23],o[24]!==S||o[25]!==C?(j=/* @__PURE__ */e(ae,{active:S,className:w,children:C}),o[24]=S,o[25]=C,o[26]=j):j=o[26],o[27]!==_||o[28]!==j||o[29]!==g?(z=/* @__PURE__ */e("div",{className:"relative overflow-hidden h-[100%] py-1",children:/* @__PURE__ */t("div",{className:"h-[100%] relative",children:[g,_,j]})}),o[27]=_,o[28]=j,o[29]=g,o[30]=z):z=o[30],z},oe=t=>{const a=l(17),{organizationId:o,products:s,locale:r,onClose:n,onSuccess:c}=t;let i,d,m,u,h;return a[0]!==r?(i={lng:r},a[0]=r,a[1]=i):i=a[1],a[2]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(d={height:"100%"},a[2]=d):d=a[2],a[3]!==r||a[4]!==n||a[5]!==c||a[6]!==o||a[7]!==s?(m=/* @__PURE__ */e("div",{className:"cc",style:d,children:/* @__PURE__ */e(le,{organizationId:o,products:s,locale:r,onClose:n,onSuccess:c})}),a[3]=r,a[4]=n,a[5]=c,a[6]=o,a[7]=s,a[8]=m):m=a[8],a[9]!==r||a[10]!==o||a[11]!==s||a[12]!==m?(u=/* @__PURE__ */e(U,{organizationId:o,products:s,locale:r,children:m}),a[9]=r,a[10]=o,a[11]=s,a[12]=m,a[13]=u):u=a[13],a[14]!==i||a[15]!==u?(h=/* @__PURE__ */e(T,{options:i,children:u}),a[14]=i,a[15]=u,a[16]=h):h=a[16],h};export{oe as default};
|
package/dist/Store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{Slot as n}from"@radix-ui/react-slot";import{c as o,a as l,b as s,M as i,C as c,P as d,B as m,S as u,I as p,L as f}from"./translations-
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{Slot as n}from"@radix-ui/react-slot";import{c as o,a as l,b as s,M as i,C as c,P as d,B as m,S as u,I as p,L as f}from"./translations-WfjA8013.js";import{useTranslation as h}from"react-i18next";import*as g from"react";import{createContext as b,useState as y,useEffect as x,useContext as v}from"react";import"@radix-ui/react-collapsible";import{N as _}from"./navigation-QgfKnxTJ.js";const N=o("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),w=o("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),S=o("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]),M=o("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),D=s("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90"}},defaultVariants:{variant:"default"}});function T(t){const a=r(12);let o,s,i,c;a[0]!==t?(({className:o,variant:c,asChild:i,...s}=t),a[0]=t,a[1]=o,a[2]=s,a[3]=i,a[4]=c):(o=a[1],s=a[2],i=a[3],c=a[4]);const d=void 0!==i&&i?n:"span";let m,u;return a[5]!==o||a[6]!==c?(m=l(D({variant:c}),o),a[5]=o,a[6]=c,a[7]=m):m=a[7],a[8]!==d||a[9]!==s||a[10]!==m?(u=/* @__PURE__ */e(d,{"data-slot":"badge",className:m,...s}),a[8]=d,a[9]=s,a[10]=m,a[11]=u):u=a[11],u}const k=b(),z=({organizationId:t,id:a,locale:r,baseUrl:n="/retailers",initialData:o=null,children:l})=>{const[s,i]=y(o?.company_retailer_location||null);x(()=>{!async function(){if(a)try{const e=await fetch(`https://api.colabcommerce.com/widget_api/company_retailer_locations/${a}`);if(!e.ok)throw new Error(`Error fetching retailer: ${e.statusText}`);const t=await e.json();i(t?.company_retailer_location||null)}catch(e){i(null)}else i(null)}()},[t,a,n]);const c={organizationId:t,id:a,locale:r,baseUrl:n,store:s};/* @__PURE__ */
|
|
2
2
|
return e(k.Provider,{value:c,children:l})},$=()=>{const e=v(k);if(void 0===e)throw new Error("useStore must be used within a StoreProvider");return e},I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function L(e){return[e.day,e]}function A(e){return e?.timezone}function C(e){if(!e)return null;if(e.open_at){const t=new Date(e.open_at);return U(t)?t:null}return"number"==typeof e.open_at_hour&&"number"==typeof e.open_at_minute?F({storeHour:e.open_at_hour,storeMinute:e.open_at_minute,utcOffsetMinute:e.utc_offset_minute}):null}function j(e,t){if(!e)return null;if("number"!=typeof e.close_at_hour||"number"!=typeof e.close_at_minute)return null;let a=F({storeHour:e.close_at_hour,storeMinute:e.close_at_minute,utcOffsetMinute:e.utc_offset_minute,anchorDate:t||void 0});return a&&t?(a.getTime()<=t.getTime()&&(a=new Date(a.getTime()+864e5)),a):a}function F({storeHour:e,storeMinute:t,utcOffsetMinute:a,anchorDate:r}){const n=r?new Date(r):/* @__PURE__ */new Date,o=n.getFullYear(),l=n.getMonth(),s=n.getDate(),i=Date.UTC(o,l,s,e,t,0)-60*a*1e3,c=new Date(i);return U(c)?c:null}function U(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function O(e){return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit"}).format(e).replace(":00","").replace(" AM","am").replace(" PM","pm")}function H(){const a=r(33),{t:n}=h(),{store:o}=$(),l=o?.retailer_location_hours;let s;a[0]!==n||a[1]!==l?(s={hours:l,t:n},a[0]=n,a[1]=l,a[2]=s):s=a[2];const{computed:d}=function(e){const t=r(17),{hours:a,openingSoonMinutes:n,closingSoonMinutes:o,t:l}=e,s=void 0===n?60:n,i=void 0===o?60:o;let c,d,m,u;if(t[0]!==i||t[1]!==a||t[2]!==s||t[3]!==l){const e=Array.isArray(a)?a:[],r=e.find(A)?.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,n=/* @__PURE__ */new Date,o=function(e,t){switch(new Intl.DateTimeFormat("en-US",{weekday:"short",timeZone:t}).format(e)){case"Sun":return 0;case"Mon":return 1;case"Tue":return 2;case"Wed":return 3;case"Thu":return 4;case"Fri":return 5;case"Sat":return 6;default:return new Date(e).getDay()}}(n,r);d=function({now:e,today:t,openingSoonMinutes:a,closingSoonMinutes:r,t:n}){if(!t||!t.open)return{label:n("default:closed"),detail:""};const o=C(t),l=j(t,o);if(!o||!l)return{label:n("default:open"),detail:""};const s=e.getTime(),i=o.getTime(),c=l.getTime(),d=i-60*a*1e3,m=c-60*r*1e3,u=n("default:opens_at",{time:O(o)}),p=n("default:closes_at",{time:O(l)});return s<i?s>=d?{label:n("default:opening_soon"),detail:u}:{label:n("default:closed"),detail:u}:s>=i&&s<c?s>=m?{label:n("default:closing_soon"),detail:p}:{label:n("default:open"),detail:p}:{label:n("default:closed"),detail:u}}({now:n,today:e.find(e=>e?.day===o),openingSoonMinutes:s,closingSoonMinutes:i,t:l});const p=[1,2,3,4,5,6,0],f=new Map(e.map(L));c=p.map(e=>{const t=f.get(e),a=l(`default:${I[e].toLowerCase()}`),r=e===o;let n=l("default:closed");if(t?.open){const e=C(t),a=j(t,e);n=e&&a?`${O(e)} - ${O(a)}`:l("default:open")}return{dayIdx:e,label:a,text:n,isToday:r}}),u=l,m=d.label.toLowerCase().replace(" ","_"),t[0]=i,t[1]=a,t[2]=s,t[3]=l,t[4]=c,t[5]=d,t[6]=m,t[7]=u}else c=t[4],d=t[5],m=t[6],u=t[7];const p=`default:${m}`;let f,h;t[8]!==u||t[9]!==p?(f=u(p),t[8]=u,t[9]=p,t[10]=f):f=t[10],t[11]!==c||t[12]!==d.detail||t[13]!==f?(h={statusLabel:f,statusDetail:d.detail,rows:c},t[11]=c,t[12]=d.detail,t[13]=f,t[14]=h):h=t[14];const g=h;let b;return t[15]!==g?(b={computed:g},t[15]=g,t[16]=b):b=t[16],b}(s);let m;a[3]!==o?.store_type?(m=o?.store_type?.toLowerCase(),a[3]=o?.store_type,a[4]=m):m=a[4];const u=`default:store.types.${m}`;let p,f;a[5]!==n||a[6]!==u?(p=n(u),a[5]=n,a[6]=u,a[7]=p):p=a[7],a[8]!==p?(f=/* @__PURE__ */e("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:/* @__PURE__ */e(T,{variant:"secondary",className:"text-sm",children:p})}),a[8]=p,a[9]=f):f=a[9];const g=o?.retailer_name;let b,y;a[10]!==g?(b=/* @__PURE__ */e("h1",{className:"text-4xl lg:text-5xl font-bold mb-4 text-balance",children:g}),a[10]=g,a[11]=b):b=a[11],a[12]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(y=/* @__PURE__ */e(i,{className:"w-4 h-4"}),a[12]=y):y=a[12];const x=o?.address?.city,v=o?.address?.province;let _,N;a[13]!==v||a[14]!==x?(_=/* @__PURE__ */t("div",{className:"flex items-center gap-2 text-muted-foreground",children:[y,
|
|
3
3
|
/* @__PURE__ */t("span",{className:"text-sm",children:[x,", ",v]})]}),a[13]=v,a[14]=x,a[15]=_):_=a[15],a[16]===/* @__PURE__ */Symbol.for("react.memo_cache_sentinel")?(N=/* @__PURE__ */e(c,{className:"w-4 h-4"}),a[16]=N):N=a[16];const w="text-sm font-medium "+(d.statusLabel===n("default:open")?"text-green-600":"text-red-600");let S,M;a[17]!==d.statusLabel||a[18]!==w?(S=/* @__PURE__ */t("div",{className:"flex items-center gap-2 text-muted-foreground",children:[N,
|
|
4
4
|
/* @__PURE__ */e("span",{className:w,children:d.statusLabel})]}),a[17]=d.statusLabel,a[18]=w,a[19]=S):S=a[19],a[20]!==_||a[21]!==S?(M=/* @__PURE__ */t("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[_,S]}),a[20]=_,a[21]=S,a[22]=M):M=a[22];const D=o?.retailer_name||"our store";let k,z,F;return a[23]!==n||a[24]!==D?(k=n("default:store_romance",{name:D}),a[23]=n,a[24]=D,a[25]=k):k=a[25],a[26]!==k?(z=/* @__PURE__ */e("p",{className:"text-lg text-muted-foreground leading-relaxed mb-6",children:k}),a[26]=k,a[27]=z):z=a[27],a[28]!==M||a[29]!==z||a[30]!==f||a[31]!==b?(F=/* @__PURE__ */e("section",{className:"bg-gradient-to-b from-primary/5 to-background py-12 lg:py-16",children:/* @__PURE__ */e("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:/* @__PURE__ */t("div",{className:"max-w-4xl",children:[f,b,M,z]})})}),a[28]=M,a[29]=z,a[30]=f,a[31]=b,a[32]=F):F=a[32],F}function P(t){const a=r(8);let n,o,s,i;return a[0]!==t?(({className:n,...o}=t),a[0]=t,a[1]=n,a[2]=o):(n=a[1],o=a[2]),a[3]!==n?(s=l("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",n),a[3]=n,a[4]=s):s=a[4],a[5]!==o||a[6]!==s?(i=/* @__PURE__ */e("div",{"data-slot":"card",className:s,...o}),a[5]=o,a[6]=s,a[7]=i):i=a[7],i}const W=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function E({hours:r,openingSoonMinutes:n=60,closingSoonMinutes:o=60,className:l=""}){const{t:s}=h(),[i,c]=g.useState(!1),d=g.useMemo(()=>{const e=Array.isArray(r)?r:[],t=e.find(e=>e?.timezone)?.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone,a=/* @__PURE__ */new Date,l=function(e,t){switch(new Intl.DateTimeFormat("en-US",{weekday:"short",timeZone:t}).format(e)){case"Sun":return 0;case"Mon":return 1;case"Tue":return 2;case"Wed":return 3;case"Thu":return 4;case"Fri":return 5;case"Sat":return 6;default:return new Date(e).getDay()}}(a,t),i=function({now:e,today:t,openingSoonMinutes:a,closingSoonMinutes:r,t:n}){if(!t||!t.open)return{label:n("default:closed"),detail:""};const o=V(t),l=Z(t,o);if(!o||!l)return{label:n("default:open"),detail:""};const s=e.getTime(),i=o.getTime(),c=l.getTime(),d=i-60*a*1e3,m=c-60*r*1e3,u=n("default:opens_at",{time:G(o)}),p=n("default:closes_at",{time:G(l)});return s<i?s>=d?{label:n("default:opening_soon"),detail:u}:{label:n("default:closed"),detail:u}:s>=i&&s<c?s>=m?{label:n("default:closing_soon"),detail:p}:{label:n("default:open"),detail:p}:{label:n("default:closed"),detail:u}}({now:a,today:e.find(e=>e?.day===l),openingSoonMinutes:n,closingSoonMinutes:o,t:s}),c=new Map(e.map(e=>[e.day,e])),d=[1,2,3,4,5,6,0].map(e=>{const t=c.get(e),a=s(`default:${W[e].toLowerCase()}`),r=e===l;let n=s("default:closed");if(t?.open){const e=V(t),a=Z(t,e);n=e&&a?`${G(e)} - ${G(a)}`:s("default:open")}return{dayIdx:e,label:a,text:n,isToday:r}});return{statusLabel:s(`default:${i.label.toLowerCase().replace(" ","_")}`),statusDetail:i.detail,rows:d}},[r,n,o]);/* @__PURE__ */
|