@frigade/react 2.4.12 → 2.4.13

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/dist/index.cjs CHANGED
@@ -93,7 +93,7 @@ var zo=Object.defineProperty,kr=Object.defineProperties;var Er=Object.getOwnProp
93
93
  to {
94
94
  opacity: 1;
95
95
  }
96
- `;function M(r){var a=r,{children:e,className:o,modal:t=!0}=a,n=f(a,["children","className","modal"]);let{rootProps:s,contentProps:p,otherProps:y}=Br(n),b=y,{zIndex:c}=b,u=f(b,["zIndex"]);return jsxRuntime.jsx(U__namespace.Root,l(i({defaultOpen:!0,modal:t},s),{children:jsxRuntime.jsx(U__namespace.Portal,{children:jsxRuntime.jsxs(g,{animation:`${Qi} 300ms ease-out`,className:o,display:"grid",inset:"0",padding:"6",part:"dialog-wrapper",pointerEvents:"none",position:"fixed",zIndex:c!=null?c:10,children:[jsxRuntime.jsx(U__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(g,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsxRuntime.jsx(U__namespace.Content,l(i({asChild:!0,onOpenAutoFocus:x=>x.preventDefault(),onPointerDownOutside:x=>x.preventDefault(),onInteractOutside:x=>x.preventDefault()},p),{children:jsxRuntime.jsx(h,l(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxWidth:"430px",p:8,part:"dialog",pointerEvents:"auto",position:"relative"},u),{children:e}))}))]})})}))}M.Dismiss=e=>jsxRuntime.jsx(U__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(I.Plain,l(i({part:"close",position:"absolute",right:"2px",top:"2px"},e),{children:jsxRuntime.jsx(Pe,{height:"20",fill:"currentColor"})}))});M.Subtitle=t=>{var n=t,{children:e}=n,o=f(n,["children"]);return jsxRuntime.jsx(U__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(C.Body2,l(i({part:"subtitle"},o),{children:e}))})};M.Media=t=>{var n=t,{src:e}=n,o=f(n,["src"]);return e==null?null:jsxRuntime.jsx(de,i({borderRadius:"md",src:e},o))};M.Primary=n=>{var r=n,{onClick:e,title:o}=r,t=f(r,["onClick","title"]);return o==null?null:jsxRuntime.jsx(I.Primary,i({title:o,onClick:e},t))};M.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((n,r)=>jsxRuntime.jsx(g,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e===r?R.colors.blue500:R.colors.blue800,part:e===r?"progress-dot-selected":"progress-dot"},r));return jsxRuntime.jsx(g,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};M.Secondary=n=>{var r=n,{onClick:e,title:o}=r,t=f(r,["onClick","title"]);return o==null?null:jsxRuntime.jsx(I.Secondary,i({title:o,onClick:e},t))};M.Title=t=>{var n=t,{children:e}=n,o=f(n,["children"]);return jsxRuntime.jsx(U__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(C.H4,l(i({part:"title"},o),{children:e}))})};M.displayName="Dialog";var Rr=["dismissible","flowId","forceMount","onComplete","onDismiss","onPrimary","onSecondary","variables"];function Wo(n){var r=n,{flowId:e,part:o}=r,t=f(r,["flowId","part"]);let a=Object.fromEntries(Object.entries(t).filter(([p])=>Rr.some(c=>p===c))),s=Object.fromEntries(Object.entries(t).filter(([p])=>Rr.indexOf(p)===-1));return jsxRuntime.jsx(j,l(i({as:null,flowId:e},a),{children:({flow:p,handleDismiss:c,handlePrimary:u,handleSecondary:y,parentProps:{containerProps:b,dismissible:x},step:m})=>{var k,E,T,w,D,O;let F=(k=m.props)!=null?k:{},S=(T=(E=m.primaryButton)==null?void 0:E.title)!=null?T:m.primaryButtonTitle,B=(D=(w=m.secondaryButton)==null?void 0:w.title)!=null?D:m.secondaryButtonTitle,v=m.$state.blocked;return jsxRuntime.jsx(M,l(i(i({part:["announcement",o],textAlign:"center"},b),s),{onEscapeKeyDown:q=>{if(t.dismissible===!1){q.preventDefault();return}typeof t.onEscapeKeyDown=="function"&&t.onEscapeKeyDown(q),q.defaultPrevented||c(q);},children:jsxRuntime.jsxs(P.Column,l(i({gap:5,part:"announcement-step"},F),{children:[x&&jsxRuntime.jsx(M.Dismiss,{onClick:c}),jsxRuntime.jsxs(P.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(M.Title,{children:m.title}),jsxRuntime.jsx(M.Subtitle,{children:m.subtitle})]}),jsxRuntime.jsx(M.Media,{src:(O=m.videoUri)!=null?O:m.imageUri,type:m.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(M.ProgressDots,{current:p.getCurrentStepIndex(),total:p.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(P.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[B&&jsxRuntime.jsx(M.Secondary,{disabled:v,onClick:y,title:B}),S&&jsxRuntime.jsx(M.Primary,{disabled:v,onClick:u,title:S})]})]}))}))}}))}function ta(){let{userId:e,frigade:o}=ho.useContext(H);function t(r){return W(this,null,function*(){yield o.identify(e,r);})}function n(r,a){return W(this,null,function*(){yield o.track(r,a);})}return {userId:e,addProperties:t,track:n}}function na(){var r;let{frigade:e}=ho.useContext(H);function o(a){return W(this,null,function*(){if(!e.config.groupId){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield e.group(e.config.groupId,a);})}function t(a,s){return W(this,null,function*(){yield e.track(a,s);})}function n(a,s){return W(this,null,function*(){yield e.group(a,s);})}return {groupId:(r=e==null?void 0:e.config)==null?void 0:r.groupId,setGroupId:n,addProperties:o,track:t}}
96
+ `;function M(r){var a=r,{children:e,className:o,modal:t=!0}=a,n=f(a,["children","className","modal"]);let{rootProps:s,contentProps:p,otherProps:y}=Br(n),b=y,{zIndex:c}=b,u=f(b,["zIndex"]);return jsxRuntime.jsx(U__namespace.Root,l(i({defaultOpen:!0,modal:t},s),{children:jsxRuntime.jsx(U__namespace.Portal,{children:jsxRuntime.jsxs(g,{animation:`${Qi} 300ms ease-out`,className:o,display:"grid",inset:"0",padding:"6",part:"dialog-wrapper",pointerEvents:"none",position:"fixed",zIndex:c!=null?c:10,children:[jsxRuntime.jsx(U__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(g,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsxRuntime.jsx(U__namespace.Content,l(i({asChild:!0,onOpenAutoFocus:x=>x.preventDefault(),onPointerDownOutside:x=>x.preventDefault(),onInteractOutside:x=>x.preventDefault()},p),{children:jsxRuntime.jsx(h,l(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxHeight:"100%",maxWidth:"430px",overflowY:"auto",padding:8,part:"dialog",pointerEvents:"auto",position:"relative"},u),{children:e}))}))]})})}))}M.Dismiss=e=>jsxRuntime.jsx(U__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(I.Plain,l(i({part:"close",position:"absolute",right:"2px",top:"2px"},e),{children:jsxRuntime.jsx(Pe,{height:"20",fill:"currentColor"})}))});M.Subtitle=t=>{var n=t,{children:e}=n,o=f(n,["children"]);return jsxRuntime.jsx(U__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(C.Body2,l(i({part:"subtitle"},o),{children:e}))})};M.Media=t=>{var n=t,{src:e}=n,o=f(n,["src"]);return e==null?null:jsxRuntime.jsx(de,i({borderRadius:"md",src:e},o))};M.Primary=n=>{var r=n,{onClick:e,title:o}=r,t=f(r,["onClick","title"]);return o==null?null:jsxRuntime.jsx(I.Primary,i({title:o,onClick:e},t))};M.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((n,r)=>jsxRuntime.jsx(g,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e===r?R.colors.blue500:R.colors.blue800,part:e===r?"progress-dot-selected":"progress-dot"},r));return jsxRuntime.jsx(g,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};M.Secondary=n=>{var r=n,{onClick:e,title:o}=r,t=f(r,["onClick","title"]);return o==null?null:jsxRuntime.jsx(I.Secondary,i({title:o,onClick:e},t))};M.Title=t=>{var n=t,{children:e}=n,o=f(n,["children"]);return jsxRuntime.jsx(U__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(C.H4,l(i({part:"title"},o),{children:e}))})};M.displayName="Dialog";var Rr=["dismissible","flowId","forceMount","onComplete","onDismiss","onPrimary","onSecondary","variables"];function Wo(n){var r=n,{flowId:e,part:o}=r,t=f(r,["flowId","part"]);let a=Object.fromEntries(Object.entries(t).filter(([p])=>Rr.some(c=>p===c))),s=Object.fromEntries(Object.entries(t).filter(([p])=>Rr.indexOf(p)===-1));return jsxRuntime.jsx(j,l(i({as:null,flowId:e},a),{children:({flow:p,handleDismiss:c,handlePrimary:u,handleSecondary:y,parentProps:{containerProps:b,dismissible:x},step:m})=>{var k,E,T,w,D,O;let F=(k=m.props)!=null?k:{},S=(T=(E=m.primaryButton)==null?void 0:E.title)!=null?T:m.primaryButtonTitle,B=(D=(w=m.secondaryButton)==null?void 0:w.title)!=null?D:m.secondaryButtonTitle,v=m.$state.blocked;return jsxRuntime.jsx(M,l(i(i({part:["announcement",o],textAlign:"center"},b),s),{onEscapeKeyDown:q=>{if(t.dismissible===!1){q.preventDefault();return}typeof t.onEscapeKeyDown=="function"&&t.onEscapeKeyDown(q),q.defaultPrevented||c(q);},children:jsxRuntime.jsxs(P.Column,l(i({gap:5,part:"announcement-step"},F),{children:[x&&jsxRuntime.jsx(M.Dismiss,{onClick:c}),jsxRuntime.jsxs(P.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(M.Title,{children:m.title}),jsxRuntime.jsx(M.Subtitle,{children:m.subtitle})]}),jsxRuntime.jsx(M.Media,{src:(O=m.videoUri)!=null?O:m.imageUri,type:m.videoUri?"video":"image",css:{objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(M.ProgressDots,{current:p.getCurrentStepIndex(),total:p.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(P.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[B&&jsxRuntime.jsx(M.Secondary,{disabled:v,onClick:y,title:B}),S&&jsxRuntime.jsx(M.Primary,{disabled:v,onClick:u,title:S})]})]}))}))}}))}function ta(){let{userId:e,frigade:o}=ho.useContext(H);function t(r){return W(this,null,function*(){yield o.identify(e,r);})}function n(r,a){return W(this,null,function*(){yield o.track(r,a);})}return {userId:e,addProperties:t,track:n}}function na(){var r;let{frigade:e}=ho.useContext(H);function o(a){return W(this,null,function*(){if(!e.config.groupId){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield e.group(e.config.groupId,a);})}function t(a,s){return W(this,null,function*(){yield e.track(a,s);})}function n(a,s){return W(this,null,function*(){yield e.group(a,s);})}return {groupId:(r=e==null?void 0:e.config)==null?void 0:r.groupId,setGroupId:n,addProperties:o,track:t}}
97
97
 
98
98
  exports.FrigadeJS = js__namespace;
99
99
  exports.Announcement = Wo;