@frigade/react 2.7.4 → 2.7.5
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +39 -39
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { JSX } from '@emotion/react/jsx-runtime';
|
|
2
3
|
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
4
|
import * as React$1 from 'react';
|
|
4
5
|
import React__default, { CSSProperties, SyntheticEvent, ReactNode, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
6
|
import * as _frigade_js from '@frigade/js';
|
|
6
7
|
import { Flow as Flow$1, FlowStep, PropertyPayload, StatefulFlow } from '@frigade/js';
|
|
7
8
|
export { _frigade_js as FrigadeJS };
|
|
8
|
-
import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
|
|
9
9
|
import * as Collapsible$1 from '@radix-ui/react-collapsible';
|
|
10
10
|
import { UseFormReturn, ControllerFieldState, Message, ValidationRule } from 'react-hook-form';
|
|
11
11
|
import * as Popover from '@radix-ui/react-popover';
|
|
@@ -44,14 +44,14 @@ declare const tokens: {
|
|
|
44
44
|
};
|
|
45
45
|
space: {
|
|
46
46
|
0: string;
|
|
47
|
+
2: string;
|
|
48
|
+
1: string;
|
|
47
49
|
auto: string;
|
|
48
50
|
5: string;
|
|
49
51
|
10: string;
|
|
50
52
|
20: string;
|
|
51
53
|
4: string;
|
|
52
54
|
9: string;
|
|
53
|
-
2: string;
|
|
54
|
-
1: string;
|
|
55
55
|
[-20]: string;
|
|
56
56
|
19: string;
|
|
57
57
|
[-19]: string;
|
|
@@ -228,14 +228,14 @@ declare const theme: DeepPartial<{
|
|
|
228
228
|
};
|
|
229
229
|
space: {
|
|
230
230
|
0: string;
|
|
231
|
+
2: string;
|
|
232
|
+
1: string;
|
|
231
233
|
auto: string;
|
|
232
234
|
5: string;
|
|
233
235
|
10: string;
|
|
234
236
|
20: string;
|
|
235
237
|
4: string;
|
|
236
238
|
9: string;
|
|
237
|
-
2: string;
|
|
238
|
-
1: string;
|
|
239
239
|
[-20]: string;
|
|
240
240
|
19: string;
|
|
241
241
|
[-19]: string;
|
|
@@ -639,14 +639,14 @@ declare const themedStyleProps: {
|
|
|
639
639
|
}>;
|
|
640
640
|
readonly gap: DeepPartial<{
|
|
641
641
|
0: string;
|
|
642
|
+
2: string;
|
|
643
|
+
1: string;
|
|
642
644
|
auto: string;
|
|
643
645
|
5: string;
|
|
644
646
|
10: string;
|
|
645
647
|
20: string;
|
|
646
648
|
4: string;
|
|
647
649
|
9: string;
|
|
648
|
-
2: string;
|
|
649
|
-
1: string;
|
|
650
650
|
[-20]: string;
|
|
651
651
|
19: string;
|
|
652
652
|
[-19]: string;
|
|
@@ -695,14 +695,14 @@ declare const themedStyleProps: {
|
|
|
695
695
|
}>;
|
|
696
696
|
readonly margin: DeepPartial<{
|
|
697
697
|
0: string;
|
|
698
|
+
2: string;
|
|
699
|
+
1: string;
|
|
698
700
|
auto: string;
|
|
699
701
|
5: string;
|
|
700
702
|
10: string;
|
|
701
703
|
20: string;
|
|
702
704
|
4: string;
|
|
703
705
|
9: string;
|
|
704
|
-
2: string;
|
|
705
|
-
1: string;
|
|
706
706
|
[-20]: string;
|
|
707
707
|
19: string;
|
|
708
708
|
[-19]: string;
|
|
@@ -741,14 +741,14 @@ declare const themedStyleProps: {
|
|
|
741
741
|
}>;
|
|
742
742
|
readonly marginBottom: DeepPartial<{
|
|
743
743
|
0: string;
|
|
744
|
+
2: string;
|
|
745
|
+
1: string;
|
|
744
746
|
auto: string;
|
|
745
747
|
5: string;
|
|
746
748
|
10: string;
|
|
747
749
|
20: string;
|
|
748
750
|
4: string;
|
|
749
751
|
9: string;
|
|
750
|
-
2: string;
|
|
751
|
-
1: string;
|
|
752
752
|
[-20]: string;
|
|
753
753
|
19: string;
|
|
754
754
|
[-19]: string;
|
|
@@ -787,14 +787,14 @@ declare const themedStyleProps: {
|
|
|
787
787
|
}>;
|
|
788
788
|
readonly marginLeft: DeepPartial<{
|
|
789
789
|
0: string;
|
|
790
|
+
2: string;
|
|
791
|
+
1: string;
|
|
790
792
|
auto: string;
|
|
791
793
|
5: string;
|
|
792
794
|
10: string;
|
|
793
795
|
20: string;
|
|
794
796
|
4: string;
|
|
795
797
|
9: string;
|
|
796
|
-
2: string;
|
|
797
|
-
1: string;
|
|
798
798
|
[-20]: string;
|
|
799
799
|
19: string;
|
|
800
800
|
[-19]: string;
|
|
@@ -833,14 +833,14 @@ declare const themedStyleProps: {
|
|
|
833
833
|
}>;
|
|
834
834
|
readonly marginRight: DeepPartial<{
|
|
835
835
|
0: string;
|
|
836
|
+
2: string;
|
|
837
|
+
1: string;
|
|
836
838
|
auto: string;
|
|
837
839
|
5: string;
|
|
838
840
|
10: string;
|
|
839
841
|
20: string;
|
|
840
842
|
4: string;
|
|
841
843
|
9: string;
|
|
842
|
-
2: string;
|
|
843
|
-
1: string;
|
|
844
844
|
[-20]: string;
|
|
845
845
|
19: string;
|
|
846
846
|
[-19]: string;
|
|
@@ -879,14 +879,14 @@ declare const themedStyleProps: {
|
|
|
879
879
|
}>;
|
|
880
880
|
readonly marginTop: DeepPartial<{
|
|
881
881
|
0: string;
|
|
882
|
+
2: string;
|
|
883
|
+
1: string;
|
|
882
884
|
auto: string;
|
|
883
885
|
5: string;
|
|
884
886
|
10: string;
|
|
885
887
|
20: string;
|
|
886
888
|
4: string;
|
|
887
889
|
9: string;
|
|
888
|
-
2: string;
|
|
889
|
-
1: string;
|
|
890
890
|
[-20]: string;
|
|
891
891
|
19: string;
|
|
892
892
|
[-19]: string;
|
|
@@ -925,14 +925,14 @@ declare const themedStyleProps: {
|
|
|
925
925
|
}>;
|
|
926
926
|
readonly padding: DeepPartial<{
|
|
927
927
|
0: string;
|
|
928
|
+
2: string;
|
|
929
|
+
1: string;
|
|
928
930
|
auto: string;
|
|
929
931
|
5: string;
|
|
930
932
|
10: string;
|
|
931
933
|
20: string;
|
|
932
934
|
4: string;
|
|
933
935
|
9: string;
|
|
934
|
-
2: string;
|
|
935
|
-
1: string;
|
|
936
936
|
[-20]: string;
|
|
937
937
|
19: string;
|
|
938
938
|
[-19]: string;
|
|
@@ -971,14 +971,14 @@ declare const themedStyleProps: {
|
|
|
971
971
|
}>;
|
|
972
972
|
readonly paddingBottom: DeepPartial<{
|
|
973
973
|
0: string;
|
|
974
|
+
2: string;
|
|
975
|
+
1: string;
|
|
974
976
|
auto: string;
|
|
975
977
|
5: string;
|
|
976
978
|
10: string;
|
|
977
979
|
20: string;
|
|
978
980
|
4: string;
|
|
979
981
|
9: string;
|
|
980
|
-
2: string;
|
|
981
|
-
1: string;
|
|
982
982
|
[-20]: string;
|
|
983
983
|
19: string;
|
|
984
984
|
[-19]: string;
|
|
@@ -1017,14 +1017,14 @@ declare const themedStyleProps: {
|
|
|
1017
1017
|
}>;
|
|
1018
1018
|
readonly paddingLeft: DeepPartial<{
|
|
1019
1019
|
0: string;
|
|
1020
|
+
2: string;
|
|
1021
|
+
1: string;
|
|
1020
1022
|
auto: string;
|
|
1021
1023
|
5: string;
|
|
1022
1024
|
10: string;
|
|
1023
1025
|
20: string;
|
|
1024
1026
|
4: string;
|
|
1025
1027
|
9: string;
|
|
1026
|
-
2: string;
|
|
1027
|
-
1: string;
|
|
1028
1028
|
[-20]: string;
|
|
1029
1029
|
19: string;
|
|
1030
1030
|
[-19]: string;
|
|
@@ -1063,14 +1063,14 @@ declare const themedStyleProps: {
|
|
|
1063
1063
|
}>;
|
|
1064
1064
|
readonly paddingRight: DeepPartial<{
|
|
1065
1065
|
0: string;
|
|
1066
|
+
2: string;
|
|
1067
|
+
1: string;
|
|
1066
1068
|
auto: string;
|
|
1067
1069
|
5: string;
|
|
1068
1070
|
10: string;
|
|
1069
1071
|
20: string;
|
|
1070
1072
|
4: string;
|
|
1071
1073
|
9: string;
|
|
1072
|
-
2: string;
|
|
1073
|
-
1: string;
|
|
1074
1074
|
[-20]: string;
|
|
1075
1075
|
19: string;
|
|
1076
1076
|
[-19]: string;
|
|
@@ -1109,14 +1109,14 @@ declare const themedStyleProps: {
|
|
|
1109
1109
|
}>;
|
|
1110
1110
|
readonly paddingTop: DeepPartial<{
|
|
1111
1111
|
0: string;
|
|
1112
|
+
2: string;
|
|
1113
|
+
1: string;
|
|
1112
1114
|
auto: string;
|
|
1113
1115
|
5: string;
|
|
1114
1116
|
10: string;
|
|
1115
1117
|
20: string;
|
|
1116
1118
|
4: string;
|
|
1117
1119
|
9: string;
|
|
1118
|
-
2: string;
|
|
1119
|
-
1: string;
|
|
1120
1120
|
[-20]: string;
|
|
1121
1121
|
19: string;
|
|
1122
1122
|
[-19]: string;
|
|
@@ -1481,14 +1481,14 @@ interface CardHeaderProps extends BoxProps {
|
|
|
1481
1481
|
title?: string;
|
|
1482
1482
|
}
|
|
1483
1483
|
interface CardComponent extends ForwardRefExoticComponent<Omit<FlowPropsWithoutChildren, 'ref'> & RefAttributes<unknown>> {
|
|
1484
|
-
Dismiss: (props: ButtonProps) =>
|
|
1485
|
-
Header: (props: CardHeaderProps) =>
|
|
1486
|
-
Footer: (props: BoxProps) =>
|
|
1487
|
-
Media: (props: MediaProps) =>
|
|
1488
|
-
Primary: (props: ButtonProps) =>
|
|
1489
|
-
Secondary: (props: ButtonProps) =>
|
|
1490
|
-
Subtitle: (props: TextProps) =>
|
|
1491
|
-
Title: (props: TextProps) =>
|
|
1484
|
+
Dismiss: (props: ButtonProps) => JSX.Element;
|
|
1485
|
+
Header: (props: CardHeaderProps) => JSX.Element;
|
|
1486
|
+
Footer: (props: BoxProps) => JSX.Element;
|
|
1487
|
+
Media: (props: MediaProps) => JSX.Element;
|
|
1488
|
+
Primary: (props: ButtonProps) => JSX.Element;
|
|
1489
|
+
Secondary: (props: ButtonProps) => JSX.Element;
|
|
1490
|
+
Subtitle: (props: TextProps) => JSX.Element;
|
|
1491
|
+
Title: (props: TextProps) => JSX.Element;
|
|
1492
1492
|
}
|
|
1493
1493
|
interface CardProps extends FlowPropsWithoutChildren {
|
|
1494
1494
|
children: React$1.ReactNode;
|
|
@@ -1513,7 +1513,7 @@ interface CollapsibleStepProps extends FlowChildrenProps {
|
|
|
1513
1513
|
onOpenChange: (isOpening: boolean) => void;
|
|
1514
1514
|
open: boolean;
|
|
1515
1515
|
}
|
|
1516
|
-
type StepTypes = Record<string, (props: CollapsibleStepProps) =>
|
|
1516
|
+
type StepTypes = Record<string, (props: CollapsibleStepProps) => JSX.Element>;
|
|
1517
1517
|
interface CollapsibleProps extends FlowPropsWithoutChildren {
|
|
1518
1518
|
/**
|
|
1519
1519
|
* Map of step types to their respective components.
|
|
@@ -1531,7 +1531,7 @@ interface CollapsibleProps extends FlowPropsWithoutChildren {
|
|
|
1531
1531
|
*/
|
|
1532
1532
|
stepTypes?: StepTypes;
|
|
1533
1533
|
}
|
|
1534
|
-
declare function Collapsible({ flowId, onPrimary, onSecondary, part, stepTypes, ...props }: CollapsibleProps):
|
|
1534
|
+
declare function Collapsible({ flowId, onPrimary, onSecondary, part, stepTypes, ...props }: CollapsibleProps): JSX.Element;
|
|
1535
1535
|
|
|
1536
1536
|
declare function Content({ children }: {
|
|
1537
1537
|
children: any;
|
|
@@ -1575,7 +1575,7 @@ interface CollectionProps extends BoxProps {
|
|
|
1575
1575
|
*/
|
|
1576
1576
|
collectionId: string;
|
|
1577
1577
|
/**
|
|
1578
|
-
* A map of variables to pass to Flows this Collection.
|
|
1578
|
+
* A map of variables to pass to Flows in this Collection.
|
|
1579
1579
|
* Example:
|
|
1580
1580
|
* ```tsx
|
|
1581
1581
|
* variables={{
|
|
@@ -1586,7 +1586,7 @@ interface CollectionProps extends BoxProps {
|
|
|
1586
1586
|
*/
|
|
1587
1587
|
variables?: FlowProps['variables'];
|
|
1588
1588
|
}
|
|
1589
|
-
declare function Collection({ collectionId, part, variables, ...props }: CollectionProps):
|
|
1589
|
+
declare function Collection({ collectionId, part, variables, ...props }: CollectionProps): JSX.Element;
|
|
1590
1590
|
|
|
1591
1591
|
declare const Row: React$1.ForwardRefExoticComponent<Omit<BoxProps<React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements>>, "ref"> & React$1.RefAttributes<unknown>>;
|
|
1592
1592
|
declare const Column: React$1.ForwardRefExoticComponent<Omit<BoxProps<React$1.ElementType<any, keyof React$1.JSX.IntrinsicElements>>, "ref"> & React$1.RefAttributes<unknown>>;
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var ft=Object.defineProperty,gn=Object.defineProperties;var yn=Object.getOwnProp
|
|
|
64
64
|
to {
|
|
65
65
|
opacity: 1;
|
|
66
66
|
}
|
|
67
|
-
`;function go(w){var B=w,{align:e,alignOffset:o,autoScroll:t,defaultOpen:r,dismissible:n,flow:i,handleDismiss:l,lockScroll:s,modal:d,onPrimary:u,onSecondary:m,part:f,side:g,sideOffset:C,spotlight:T,step:h}=B,S=y(B,["align","alignOffset","autoScroll","defaultOpen","dismissible","flow","handleDismiss","lockScroll","modal","onPrimary","onSecondary","part","side","sideOffset","spotlight","step"]);var Z,Y,Q,U,ee;let{handlePrimary:E,handleSecondary:b}=ye(h,{onPrimary:u,onSecondary:m}),{videoProps:k,otherProps:v}=ce(S),I=(Y=(Z=h.primaryButton)==null?void 0:Z.title)!=null?Y:h.primaryButtonTitle,H=(U=(Q=h.secondaryButton)==null?void 0:Q.title)!=null?U:h.secondaryButtonTitle,J=!!h.$state.blocked;return jsx(qo,p(a({align:e,alignOffset:o,anchor:h.selector,autoScroll:t,"data-step-id":h.id,defaultOpen:r,lockScroll:s,modal:d,part:f,side:g,sideOffset:C,spotlight:T,onMount:()=>{r&&!J&&(h==null||h.start());}},v),{children:jsxs(P,{animation:`${Ua} 300ms ease-out`,boxShadow:"md",maxWidth:"min(360px, calc(100vw - 25px))",children:[jsx(P.Media,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:(ee=h.videoUri)!=null?ee:h.imageUri,transform:"translate3d(0, 0, 1px)",type:h.videoUri?"video":"image"},k)),jsx(P.Header,{css:{".fr-dismiss":{position:"absolute",right:"12px",top:"12px"}},dismissible:n,handleDismiss:l,subtitle:h.subtitle,title:h.title}),jsxs(P.Footer,{children:[i.getNumberOfAvailableSteps()>1&&jsx(Oe,{current:i.getCurrentStepOrder()+1,marginRight:"auto",total:i.getNumberOfAvailableSteps()}),jsx(P.Secondary,{disabled:J,onClick:b,title:H}),jsx(P.Primary,{disabled:J,onClick:E,title:I})]})]})}))}function zr(n){var i=n,{children:e,container:o,flowId:t}=i,r=y(i,["children","container","flowId"]);return jsx(Tr,{container:o,children:jsx(x,p(a({"data-flow-id":t,part:"tour"},r),{children:e}))})}function yo(r){var n=r,{as:e,flowId:o}=n,t=y(n,["as","flowId"]);let{onDismiss:i,onPrimary:l,onSecondary:s}=t;return jsx(z,p(a({as:null,flowId:o,autoStart:!1},t),{children:({flow:d,handleDismiss:u,parentProps:m,step:f})=>{var de;let ne=m.containerProps,{align:g="after",alignOffset:C=0,autoScroll:T=!1,container:h="body",defaultOpen:S,lockScroll:w=!0,modal:B,onOpenChange:E,open:b,part:k,sequential:v=!0,side:I="bottom",sideOffset:H=0,spotlight:J,zIndex:Z=9999}=ne,Y=y(ne,["align","alignOffset","autoScroll","container","defaultOpen","lockScroll","modal","onOpenChange","open","part","sequential","side","sideOffset","spotlight","zIndex"]),{dismissible:Q}=m,U=a({align:g,alignOffset:C,autoScroll:T,dismissible:Q,flow:d,handleDismiss:u,modal:B,onPrimary:l,onSecondary:s,onOpenChange:E,open:b,part:k,side:I,sideOffset:H,spotlight:J,step:f,zIndex:Z},(de=f.props)!=null?de:{});if(v)return jsx(zr,p(a({as:e,container:h,flowId:o,part:"tour",zIndex:Z},Y),{children:jsx(go,a({defaultOpen:S!=null?S:!0,lockScroll:w},U),f.id)}));let ee=Array.from(d.steps.values()).filter(N=>{let{blocked:_,completed:G,skipped:oe,visible:K}=N.$state;return !_&&!G&&!oe&&K}).map(N=>{var ae,ie,dt,ct;function _(ut){return A(this,null,function*(){return (yield i==null?void 0:i(d,ut))===!1?(ut.preventDefault(),!1):(N.skip(),!0)})}let G=J&&N.id===f.id,oe=(ie=(ae=N.props)==null?void 0:ae.zIndex)!=null?ie:Z,K=a({align:g,alignOffset:C,dismissible:Q,flow:d,handleDismiss:_,onPrimary:l,onSecondary:s,onOpenChange:E,open:b,part:k,side:I,sideOffset:H,spotlight:J,zIndex:oe},(dt=N.props)!=null?dt:{});return jsx(go,a({css:{"&:has([aria-expanded=true])":{zIndex:Number(oe)+2},".fr-overlay":{zIndex:Number(oe)+1},".fr-progress-fraction":{display:"none"}},defaultOpen:(ct=S||G)!=null?ct:!1,lockScroll:w,step:N},K),`${N.id}-${G}`)});return jsx(zr,p(a({as:e,container:h,flowId:o,part:"tour",zIndex:Z},Y),{children:ee}))}}))}var xo="useSyncExternalStore"in Do?Do.useSyncExternalStore:Ur.useSyncExternalStore;function ho(){let{frigade:e}=useContext(M),[,o]=useState(!1),t=useRef(),r=useCallback(l=>{e==null||e.getCollections().then(()=>{l();});let s=()=>{clearTimeout(t.current),t.current=setTimeout(()=>{o(d=>!d),l();},0);};return e==null||e.on("flow.any",s),()=>{e==null||e.off("flow.any",s);};},[e]),n=()=>{let l;try{l=e==null?void 0:e.getCollectionsSync();}catch(s){}return l};return {collections:xo(r,n,n)}}function bo(e){var s,d,u,m;let{frigade:o}=useContext(M),{collections:t}=ho(),r=t==null?void 0:t.get(e),i=(m=((u=(d=(s=t==null?void 0:t.get(e))==null?void 0:s.flows)==null?void 0:d.filter(f=>f.visible).map(f=>p(a({},f),{flow:o==null?void 0:o.getFlowSync(f.flowId)})))!=null?u:[]).find(({flow:f})=>f.isVisible))==null?void 0:m.flowId,{flow:l}=Te(i);return useEffect(()=>{o==null||o.registerCollection(e);},[e,o]),{collection:r,currentFlow:l}}function Yo(n){var i=n,{collectionId:e,part:o,variables:t={}}=i,r=y(i,["collectionId","part","variables"]);var u,m,f;let l={ANNOUNCEMENT:Qo,BANNER:Io,CARD:P,CHECKLIST:no,EMBEDDED_TIP:P,FORM:Ve,NPS_SURVEY:Ke,SURVEY:Ke,TOUR:yo},{currentFlow:s}=bo(e),d=(m=l[(u=s==null?void 0:s.rawData)==null?void 0:u.flowType])!=null?m:null;return s==null||d==null?null:((f=s==null?void 0:s.rawData)==null?void 0:f.flowType)===FlowType.FORM?jsx(x,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(Ve,{flowId:s.id,as:$,variables:t},s.id)})):jsx(x,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(d,{flowId:s.id,variables:t},s.id)}))}function Gr(){var t,r;let{collections:e}=ho(),o=(r=Array.from((t=e==null?void 0:e.entries())!=null?t:[]).find(n=>n[1].collectionType==="DEFAULT"))==null?void 0:r[0];return bo(o),o==null?null:jsx(Yo,{as:null,collectionId:o})}var M=createContext({apiKey:"",currentModal:null,setCurrentModal:()=>{},navigate:()=>{},hasInitialized:!1,registerComponent:()=>{},unregisterComponent:()=>{},variables:{}});var be=(e,o="log")=>{let t=`__frigade_logged_${e}`;globalThis[t]||(globalThis[t]=!0,console[o](e));};function et(){let e=useContext(M);(!e||!e.frigade)&&be("useFrigade() must be used in a child of the Frigade Provider","warn");let{frigade:o}=e;return {frigade:o,isLoading:!(o!=null&&o.isReady())}}function Kr(){let{frigade:e}=et();return useEffect(()=>{A(this,null,function*(){(yield e.getFlows()).forEach(t=>{t.steps.forEach(r=>{if(r.imageUri){let n=new Image;n.src=r.imageUri;}});});});},[e]),null}var jr="2.7.4";function Yr(l){var s=l,{children:e,css:o={},defaultCollection:t=!0,navigate:r,theme:n}=s,i=y(s,["children","css","defaultCollection","navigate","theme"]);let d=n?To(n):{},u=useRef(new Map),m=useRef(),[f,g]=useState(!1),[C,T]=useState(null),h=useMemo(()=>(g(!1),m.current=void 0,new Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,userProperties:i.userProperties,groupProperties:i.groupProperties,generateGuestId:i.generateGuestId,syncOnWindowUpdates:i.syncOnWindowUpdates,__readOnly:i.__readOnly,__flowStateOverrides:i.__flowStateOverrides,__platformVersion:jr,__platformName:"React"})),[i.userId,i.groupId,i.apiKey]);useEffect(()=>{if(i.__flowStateOverrides){let b=h.getConfig();b.__flowStateOverrides=i.__flowStateOverrides,h.reload(b);}},[h,i.__flowStateOverrides]);function S(){let b=[...u.current.entries()].map(([k,v])=>[k,v.callback]);h.batchRegister(b),g(!0);}function w(b,k){if(m.current&&clearTimeout(m.current),f){u.current.has(b)?h.getFlow(b).then(v=>k(v.isVisible)):(h.getFlow(b).then(v=>v.register(k)),u.current.set(b,{callback:k}));return}u.current.has(b)||u.current.set(b,{callback:k}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>S(),0);}function B(b){u.current.has(b)&&h.getFlow(b).then(k=>{u.current.delete(b),k==null||k.unregister();});}let E=r!=null?r:(b,k="_self")=>{window.open(b,k);};return useEffect(()=>()=>{h.destroy();},[h]),jsxs(M.Provider,{value:p(a({currentModal:C,setCurrentModal:T,navigate:E},i),{frigade:h,registerComponent:w,unregisterComponent:B,hasInitialized:f,variables:i.variables||{}}),children:[jsx(Global,{styles:{":root":a(a(a({},ko),d),o)}}),jsxs(ThemeProvider,{theme:O,children:[t&&jsx(Gr,{}),e]}),i.preloadImages!==!1&&jsx(Kr,{})]})}function Te(e,o){let t=useContext(M);(!t||!t.frigade)&&be(`useFlow('${e}') must be used in a child of the Frigade Provider`,"warn");let{frigade:r,variables:n}=t!=null?t:{},[,i]=useState(!1),l=useCallback(d=>{r==null||r.getFlow(e).then(()=>{d();});let u=(m,f)=>{f.id===e&&setTimeout(()=>{i(g=>!g),d();},0);};return r==null||r.on("flow.any",u),()=>{r==null||r.off("flow.any",u);}},[e,r]),s=xo(l,()=>r==null?void 0:r.getFlowSync(e),()=>r==null?void 0:r.getFlowSync(e));return useEffect(()=>{s==null||s.applyVariables(a(a({},n),o==null?void 0:o.variables));},[o==null?void 0:o.variables,s,e,n]),{flow:s,isLoading:r!=null&&r.hasFailedToLoad()?!1:!s}}function tt(e,{onComplete:o,onDismiss:t}={}){let r=useRef(null);return useEffect(()=>{if(e==null)return;function n(){return A(this,null,function*(){e.isCompleted&&r.current===!1&&(r.current=!0,yield o==null?void 0:o(e));})}return n(),r.current=e==null?void 0:e.isCompleted,()=>{n();}},[e,o]),{handleDismiss:useCallback(n=>A(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e,t])}}function on(e,o=!0){let{currentModal:t,setCurrentModal:r}=useContext(M),n=useCallback(l=>{o&&(e!=null&&e.isVisible)&&r(l);},[o,e==null?void 0:e.isVisible,r]),i=useCallback(()=>{e!=null&&t===(e==null?void 0:e.id)&&r(null);},[t,e,r]);return useEffect(()=>(e!=null&&t===null&&e.isVisible&&n(e.id),i),[n,t,e,i]),useEffect(()=>{e!=null&&(!o||!e.isVisible)&&i();},[e,o,i]),e==null?{hasModalCollision:!1}:!o||!e.isVisible?{hasModalCollision:!1}:t===e.id?{hasModalCollision:!1}:t===null?{hasModalCollision:!1}:{hasModalCollision:!0}}function nt(e){return typeof e=="function"&&e.displayName==="Dialog"}function z(m){var f=m,{as:e,autoStart:o=!0,children:t,flowId:r,onComplete:n,onDismiss:i,onPrimary:l,onSecondary:s,variables:d}=f,u=y(f,["as","autoStart","children","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables"]);var Q,U,ee,de;let{flow:g}=Te(r,{variables:d}),C=g==null?void 0:g.getCurrentStep(),T=(Q=C==null?void 0:C.props)!=null?Q:{},{otherProps:h}=ce(T),ne=a(a(a({},u),(U=g==null?void 0:g.props)!=null?U:{}),((ee=g==null?void 0:g.rawData)==null?void 0:ee.flowType)===FlowType.CHECKLIST?{}:h),{dismissible:S=!!nt(e),forceMount:w=!1}=ne,B=y(ne,["dismissible","forceMount"]),{handleDismiss:E}=tt(g,{onComplete:n,onDismiss:i}),{handlePrimary:b,handleSecondary:k}=ye(C,{onPrimary:l,onSecondary:s}),v=(B==null?void 0:B.modal)||nt(e)||[FlowType.ANNOUNCEMENT,FlowType.TOUR].includes((de=g==null?void 0:g.rawData)==null?void 0:de.flowType),{hasModalCollision:I}=on(g,v);function H(N){if(S===!1){N.preventDefault();return}typeof u.onEscapeKeyDown=="function"&&u.onEscapeKeyDown(N),N.defaultPrevented||E(N);}let J=w&&((g==null?void 0:g.isCompleted)||(g==null?void 0:g.isSkipped));if(!g||(!g.isVisible||I)&&!J)return null;(J||!g.isCompleted&&!g.isSkipped&&o)&&(C==null||C.start());let Z=e===null?Fragment$1:e!=null?e:x,Y=p(a({},B),{"data-flow-id":g.id});return nt(e)&&(Y.onEscapeKeyDown=H),jsx(Z,p(a({},e===null?{}:Y),{children:t({flow:g,handleDismiss:E,handlePrimary:b,handleSecondary:k,parentProps:{dismissible:S,flowId:r,variables:d,containerProps:Y},step:C})}))}function rn(t){var r=t,{part:e}=r,o=y(r,["part"]);return jsx(z,p(a({as:P,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:["card",e]},o),{children:({handleDismiss:n,handlePrimary:i,handleSecondary:l,parentProps:{dismissible:s},step:d})=>{var g,C,T,h,S,w;let u=(C=(g=d.primaryButton)==null?void 0:g.title)!=null?C:d.primaryButtonTitle,m=(h=(T=d.secondaryButton)==null?void 0:T.title)!=null?h:d.secondaryButtonTitle,{videoProps:f}=ce((S=d.props)!=null?S:{});return jsxs(Fragment,{children:[jsx(P.Header,{dismissible:s,handleDismiss:n,subtitle:d.subtitle,title:d.title}),jsx(P.Media,a({src:(w=d.videoUri)!=null?w:d.imageUri,type:d.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},f)),jsxs(F.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(P.Secondary,{title:m,onClick:l}),jsx(P.Primary,{title:u,onClick:i})]})]})}}))}function Co(r){var n=r,{part:e,src:o}=n,t=y(n,["part","src"]);return jsx(x,a({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function hs(e){var o,t,r,n,i;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(r=e.split("vimeo.com/")[1])==null?void 0:r.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(i=e.split("loom.com/share/")[1])==null?void 0:i.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function So(T){var h=T,{autoPlay:e,controls:o,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s,playsInline:d,poster:u,preload:m,part:f,src:g}=h,C=y(h,["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","part","src"]);let S=hs(g);return S?jsx(x,a({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",f],src:S},C)):g!=null&&g.endsWith(".mp4")?jsx(x,a({as:"video",part:["video",f],src:g,autoPlay:e,controls:o!=null?o:!0,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s!=null?s:e,playsInline:d,poster:u,preload:m},C)):(console.error(`Could not map videoUri ${g} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function Pe(r){var n=r,{src:e,type:o}=n,t=y(n,["src","type"]);return jsx(o==="video"?So:Co,a({src:e},t))}var P=Do.forwardRef((i,n)=>{var l=i,{children:e,flowId:o,part:t}=l,r=y(l,["children","flowId","part"]);var d;if(o!=null)return jsx(rn,a({flowId:o},r));let s=(d=r.as)!=null?d:F.Column;return jsx(s,p(a({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,part:["card",t]},r),{ref:n,children:e}))});P.Dismiss=e=>jsx(D.Plain,p(a({"aria-label":"Dismiss",part:"dismiss",padding:0},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}));P.Footer=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return jsx(F.Row,p(a({alignItems:"center",gap:3,justifyContent:"flex-end",part:["card-footer",o]},t),{children:e}))};P.Header=l=>{var s=l,{dismissible:e,handleDismiss:o,part:t,subtitle:r,title:n}=s,i=y(s,["dismissible","handleDismiss","part","subtitle","title"]);return !e&&(n==null||(n==null?void 0:n.length)===0)&&(r==null||(r==null?void 0:r.length)===0)?null:jsxs(F.Row,p(a({alignItems:"flex-start",flexWrap:"wrap",gap:1,part:["card-header",t]},i),{children:[jsx(P.Title,{maxWidth:"calc(100% - 32px)",children:n}),e&&jsx(P.Dismiss,{onClick:o,marginLeft:"auto"}),jsx(P.Subtitle,{color:"neutral.400",flexBasis:"100%",children:r})]}))};P.Media=t=>{var r=t,{src:e}=r,o=y(r,["src"]);return e==null||(e==null?void 0:e.length)===0?null:jsx(Pe,a({borderRadius:"md",src:e},o))};P.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=y(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(D.Primary,a({title:o,onClick:e},t))};P.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=y(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(D.Secondary,a({title:o,onClick:e},t))};P.Subtitle=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return e==null?null:jsx(R.Body2,p(a({display:"block",color:"neutral.400",part:["subtitle",o]},t),{children:e}))};P.Title=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return e==null?null:jsx(R.H4,p(a({display:"block",part:["title",o]},t),{children:e}))};var wo={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function sn(e){let o=Object.fromEntries(wo.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(wo.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!wo.content.some(i=>i===n)&&!wo.root.some(i=>i===n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}var Ss=keyframes`
|
|
67
|
+
`;function go(w){var B=w,{align:e,alignOffset:o,autoScroll:t,defaultOpen:r,dismissible:n,flow:i,handleDismiss:l,lockScroll:s,modal:d,onPrimary:u,onSecondary:m,part:f,side:g,sideOffset:C,spotlight:T,step:h}=B,S=y(B,["align","alignOffset","autoScroll","defaultOpen","dismissible","flow","handleDismiss","lockScroll","modal","onPrimary","onSecondary","part","side","sideOffset","spotlight","step"]);var Z,Y,Q,U,ee;let{handlePrimary:E,handleSecondary:b}=ye(h,{onPrimary:u,onSecondary:m}),{videoProps:k,otherProps:v}=ce(S),I=(Y=(Z=h.primaryButton)==null?void 0:Z.title)!=null?Y:h.primaryButtonTitle,H=(U=(Q=h.secondaryButton)==null?void 0:Q.title)!=null?U:h.secondaryButtonTitle,J=!!h.$state.blocked;return jsx(qo,p(a({align:e,alignOffset:o,anchor:h.selector,autoScroll:t,"data-step-id":h.id,defaultOpen:r,lockScroll:s,modal:d,part:f,side:g,sideOffset:C,spotlight:T,onMount:()=>{r&&!J&&(h==null||h.start());}},v),{children:jsxs(P,{animation:`${Ua} 300ms ease-out`,boxShadow:"md",maxWidth:"min(360px, calc(100vw - 25px))",children:[jsx(P.Media,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:(ee=h.videoUri)!=null?ee:h.imageUri,transform:"translate3d(0, 0, 1px)",type:h.videoUri?"video":"image"},k)),jsx(P.Header,{css:{".fr-dismiss":{position:"absolute",right:"12px",top:"12px"}},dismissible:n,handleDismiss:l,subtitle:h.subtitle,title:h.title}),jsxs(P.Footer,{children:[i.getNumberOfAvailableSteps()>1&&jsx(Oe,{current:i.getCurrentStepOrder()+1,marginRight:"auto",total:i.getNumberOfAvailableSteps()}),jsx(P.Secondary,{disabled:J,onClick:b,title:H}),jsx(P.Primary,{disabled:J,onClick:E,title:I})]})]})}))}function zr(n){var i=n,{children:e,container:o,flowId:t}=i,r=y(i,["children","container","flowId"]);return jsx(Tr,{container:o,children:jsx(x,p(a({"data-flow-id":t,part:"tour"},r),{children:e}))})}function yo(r){var n=r,{as:e,flowId:o}=n,t=y(n,["as","flowId"]);let{onDismiss:i,onPrimary:l,onSecondary:s}=t;return jsx(z,p(a({as:null,flowId:o,autoStart:!1},t),{children:({flow:d,handleDismiss:u,parentProps:m,step:f})=>{var de;let ne=m.containerProps,{align:g="after",alignOffset:C=0,autoScroll:T=!1,container:h="body",defaultOpen:S,lockScroll:w=!0,modal:B,onOpenChange:E,open:b,part:k,sequential:v=!0,side:I="bottom",sideOffset:H=0,spotlight:J,zIndex:Z=9999}=ne,Y=y(ne,["align","alignOffset","autoScroll","container","defaultOpen","lockScroll","modal","onOpenChange","open","part","sequential","side","sideOffset","spotlight","zIndex"]),{dismissible:Q}=m,U=a({align:g,alignOffset:C,autoScroll:T,dismissible:Q,flow:d,handleDismiss:u,modal:B,onPrimary:l,onSecondary:s,onOpenChange:E,open:b,part:k,side:I,sideOffset:H,spotlight:J,step:f,zIndex:Z},(de=f.props)!=null?de:{});if(v)return jsx(zr,p(a({as:e,container:h,flowId:o,part:"tour",zIndex:Z},Y),{children:jsx(go,a({defaultOpen:S!=null?S:!0,lockScroll:w},U),f.id)}));let ee=Array.from(d.steps.values()).filter(N=>{let{blocked:_,completed:G,skipped:oe,visible:K}=N.$state;return !_&&!G&&!oe&&K}).map(N=>{var ae,ie,dt,ct;function _(ut){return A(this,null,function*(){return (yield i==null?void 0:i(d,ut))===!1?(ut.preventDefault(),!1):(N.skip(),!0)})}let G=J&&N.id===f.id,oe=(ie=(ae=N.props)==null?void 0:ae.zIndex)!=null?ie:Z,K=a({align:g,alignOffset:C,dismissible:Q,flow:d,handleDismiss:_,onPrimary:l,onSecondary:s,onOpenChange:E,open:b,part:k,side:I,sideOffset:H,spotlight:J,zIndex:oe},(dt=N.props)!=null?dt:{});return jsx(go,a({css:{"&:has([aria-expanded=true])":{zIndex:Number(oe)+2},".fr-overlay":{zIndex:Number(oe)+1},".fr-progress-fraction":{display:"none"}},defaultOpen:(ct=S||G)!=null?ct:!1,lockScroll:w,step:N},K),`${N.id}-${G}`)});return jsx(zr,p(a({as:e,container:h,flowId:o,part:"tour",zIndex:Z},Y),{children:ee}))}}))}var xo="useSyncExternalStore"in Do?Do.useSyncExternalStore:Ur.useSyncExternalStore;function ho(){let{frigade:e}=useContext(M),[,o]=useState(!1),t=useRef(),r=useCallback(l=>{e==null||e.getCollections().then(()=>{l();});let s=()=>{clearTimeout(t.current),t.current=setTimeout(()=>{o(d=>!d),l();},0);};return e==null||e.on("flow.any",s),()=>{e==null||e.off("flow.any",s);};},[e]),n=()=>{let l;try{l=e==null?void 0:e.getCollectionsSync();}catch(s){}return l};return {collections:xo(r,n,n)}}function bo(e){var s,d,u,m;let{frigade:o}=useContext(M),{collections:t}=ho(),r=t==null?void 0:t.get(e),i=(m=((u=(d=(s=t==null?void 0:t.get(e))==null?void 0:s.flows)==null?void 0:d.filter(f=>f.visible).map(f=>p(a({},f),{flow:o==null?void 0:o.getFlowSync(f.flowId)})))!=null?u:[]).find(({flow:f})=>f.isVisible))==null?void 0:m.flowId,{flow:l}=Te(i);return useEffect(()=>{o==null||o.registerCollection(e);},[e,o]),{collection:r,currentFlow:l}}function Yo(n){var i=n,{collectionId:e,part:o,variables:t={}}=i,r=y(i,["collectionId","part","variables"]);var u,m,f;let l={ANNOUNCEMENT:Qo,BANNER:Io,CARD:P,CHECKLIST:no,EMBEDDED_TIP:P,FORM:Ve,NPS_SURVEY:Ke,SURVEY:Ke,TOUR:yo},{currentFlow:s}=bo(e),d=(m=l[(u=s==null?void 0:s.rawData)==null?void 0:u.flowType])!=null?m:null;return s==null||d==null?null:((f=s==null?void 0:s.rawData)==null?void 0:f.flowType)===FlowType.FORM?jsx(x,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(Ve,{flowId:s.id,as:$,variables:t},s.id)})):jsx(x,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(d,{flowId:s.id,variables:t},s.id)}))}function Gr(){var t,r;let{collections:e}=ho(),o=(r=Array.from((t=e==null?void 0:e.entries())!=null?t:[]).find(n=>n[1].collectionType==="DEFAULT"))==null?void 0:r[0];return bo(o),o==null?null:jsx(Yo,{as:null,collectionId:o})}var M=createContext({apiKey:"",currentModal:null,setCurrentModal:()=>{},navigate:()=>{},hasInitialized:!1,registerComponent:()=>{},unregisterComponent:()=>{},variables:{}});var be=(e,o="log")=>{let t=`__frigade_logged_${e}`;globalThis[t]||(globalThis[t]=!0,console[o](e));};function et(){let e=useContext(M);(!e||!e.frigade)&&be("useFrigade() must be used in a child of the Frigade Provider","warn");let{frigade:o}=e;return {frigade:o,isLoading:!(o!=null&&o.isReady())}}function Kr(){let{frigade:e}=et();return useEffect(()=>{A(this,null,function*(){(yield e.getFlows()).forEach(t=>{t.steps.forEach(r=>{if(r.imageUri){let n=new Image;n.src=r.imageUri;}});});});},[e]),null}var jr="2.7.5";function Yr(l){var s=l,{children:e,css:o={},defaultCollection:t=!0,navigate:r,theme:n}=s,i=y(s,["children","css","defaultCollection","navigate","theme"]);let d=n?To(n):{},u=useRef(new Map),m=useRef(),[f,g]=useState(!1),[C,T]=useState(null),h=useMemo(()=>(g(!1),m.current=void 0,new Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,userProperties:i.userProperties,groupProperties:i.groupProperties,generateGuestId:i.generateGuestId,syncOnWindowUpdates:i.syncOnWindowUpdates,__readOnly:i.__readOnly,__flowStateOverrides:i.__flowStateOverrides,__platformVersion:jr,__platformName:"React"})),[i.userId,i.groupId,i.apiKey]);useEffect(()=>{if(i.__flowStateOverrides){let b=h.getConfig();b.__flowStateOverrides=i.__flowStateOverrides,h.reload(b);}},[h,i.__flowStateOverrides]);function S(){let b=[...u.current.entries()].map(([k,v])=>[k,v.callback]);h.batchRegister(b),g(!0);}function w(b,k){if(m.current&&clearTimeout(m.current),f){u.current.has(b)?h.getFlow(b).then(v=>k(v.isVisible)):(h.getFlow(b).then(v=>v.register(k)),u.current.set(b,{callback:k}));return}u.current.has(b)||u.current.set(b,{callback:k}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>S(),0);}function B(b){u.current.has(b)&&h.getFlow(b).then(k=>{u.current.delete(b),k==null||k.unregister();});}let E=r!=null?r:(b,k="_self")=>{window.open(b,k);};return useEffect(()=>()=>{h.destroy();},[h]),jsxs(M.Provider,{value:p(a({currentModal:C,setCurrentModal:T,navigate:E},i),{frigade:h,registerComponent:w,unregisterComponent:B,hasInitialized:f,variables:i.variables||{}}),children:[jsx(Global,{styles:{":root":a(a(a({},ko),d),o)}}),jsxs(ThemeProvider,{theme:O,children:[t&&jsx(Gr,{}),e]}),i.preloadImages!==!1&&jsx(Kr,{})]})}function Te(e,o){let t=useContext(M);(!t||!t.frigade)&&be(`useFlow('${e}') must be used in a child of the Frigade Provider`,"warn");let{frigade:r,variables:n}=t!=null?t:{},[,i]=useState(!1),l=useCallback(d=>{r==null||r.getFlow(e).then(()=>{d();});let u=(m,f)=>{f.id===e&&setTimeout(()=>{i(g=>!g),d();},0);};return r==null||r.on("flow.any",u),()=>{r==null||r.off("flow.any",u);}},[e,r]),s=xo(l,()=>r==null?void 0:r.getFlowSync(e),()=>r==null?void 0:r.getFlowSync(e));return useEffect(()=>{s==null||s.applyVariables(a(a({},n),o==null?void 0:o.variables));},[o==null?void 0:o.variables,s,e,n]),{flow:s,isLoading:r!=null&&r.hasFailedToLoad()?!1:!s}}function tt(e,{onComplete:o,onDismiss:t}={}){let r=useRef(null);return useEffect(()=>{if(e==null)return;function n(){return A(this,null,function*(){e.isCompleted&&r.current===!1&&(r.current=!0,yield o==null?void 0:o(e));})}return n(),r.current=e==null?void 0:e.isCompleted,()=>{n();}},[e,o]),{handleDismiss:useCallback(n=>A(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e,t])}}function on(e,o=!0){let{currentModal:t,setCurrentModal:r}=useContext(M),n=useCallback(l=>{o&&(e!=null&&e.isVisible)&&r(l);},[o,e==null?void 0:e.isVisible,r]),i=useCallback(()=>{e!=null&&t===(e==null?void 0:e.id)&&r(null);},[t,e,r]);return useEffect(()=>(e!=null&&t===null&&e.isVisible&&n(e.id),i),[n,t,e,i]),useEffect(()=>{e!=null&&(!o||!e.isVisible)&&i();},[e,o,i]),e==null?{hasModalCollision:!1}:!o||!e.isVisible?{hasModalCollision:!1}:t===e.id?{hasModalCollision:!1}:t===null?{hasModalCollision:!1}:{hasModalCollision:!0}}function nt(e){return typeof e=="function"&&e.displayName==="Dialog"}function z(m){var f=m,{as:e,autoStart:o=!0,children:t,flowId:r,onComplete:n,onDismiss:i,onPrimary:l,onSecondary:s,variables:d}=f,u=y(f,["as","autoStart","children","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables"]);var Q,U,ee,de;let{flow:g}=Te(r,{variables:d}),C=g==null?void 0:g.getCurrentStep(),T=(Q=C==null?void 0:C.props)!=null?Q:{},{otherProps:h}=ce(T),ne=a(a(a({},u),(U=g==null?void 0:g.props)!=null?U:{}),((ee=g==null?void 0:g.rawData)==null?void 0:ee.flowType)===FlowType.CHECKLIST?{}:h),{dismissible:S=!!nt(e),forceMount:w=!1}=ne,B=y(ne,["dismissible","forceMount"]),{handleDismiss:E}=tt(g,{onComplete:n,onDismiss:i}),{handlePrimary:b,handleSecondary:k}=ye(C,{onPrimary:l,onSecondary:s}),v=(B==null?void 0:B.modal)||nt(e)||[FlowType.ANNOUNCEMENT,FlowType.TOUR].includes((de=g==null?void 0:g.rawData)==null?void 0:de.flowType),{hasModalCollision:I}=on(g,v);function H(N){if(S===!1){N.preventDefault();return}typeof u.onEscapeKeyDown=="function"&&u.onEscapeKeyDown(N),N.defaultPrevented||E(N);}let J=w&&((g==null?void 0:g.isCompleted)||(g==null?void 0:g.isSkipped));if(!g||(!g.isVisible||I)&&!J)return null;(J||!g.isCompleted&&!g.isSkipped&&o)&&(C==null||C.start());let Z=e===null?Fragment$1:e!=null?e:x,Y=p(a({},B),{"data-flow-id":g.id});return nt(e)&&(Y.onEscapeKeyDown=H),jsx(Z,p(a({},e===null?{}:Y),{children:t({flow:g,handleDismiss:E,handlePrimary:b,handleSecondary:k,parentProps:{dismissible:S,flowId:r,variables:d,containerProps:Y},step:C})}))}function rn(t){var r=t,{part:e}=r,o=y(r,["part"]);return jsx(z,p(a({as:P,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:["card",e]},o),{children:({handleDismiss:n,handlePrimary:i,handleSecondary:l,parentProps:{dismissible:s},step:d})=>{var g,C,T,h,S,w;let u=(C=(g=d.primaryButton)==null?void 0:g.title)!=null?C:d.primaryButtonTitle,m=(h=(T=d.secondaryButton)==null?void 0:T.title)!=null?h:d.secondaryButtonTitle,{videoProps:f}=ce((S=d.props)!=null?S:{});return jsxs(Fragment,{children:[jsx(P.Header,{dismissible:s,handleDismiss:n,subtitle:d.subtitle,title:d.title}),jsx(P.Media,a({src:(w=d.videoUri)!=null?w:d.imageUri,type:d.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},f)),jsxs(F.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(P.Secondary,{title:m,onClick:l}),jsx(P.Primary,{title:u,onClick:i})]})]})}}))}function Co(r){var n=r,{part:e,src:o}=n,t=y(n,["part","src"]);return jsx(x,a({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function hs(e){var o,t,r,n,i;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(r=e.split("vimeo.com/")[1])==null?void 0:r.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(i=e.split("loom.com/share/")[1])==null?void 0:i.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function So(T){var h=T,{autoPlay:e,controls:o,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s,playsInline:d,poster:u,preload:m,part:f,src:g}=h,C=y(h,["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","part","src"]);let S=hs(g);return S?jsx(x,a({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",f],src:S},C)):g!=null&&g.endsWith(".mp4")?jsx(x,a({as:"video",part:["video",f],src:g,autoPlay:e,controls:o!=null?o:!0,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s!=null?s:e,playsInline:d,poster:u,preload:m},C)):(console.error(`Could not map videoUri ${g} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function Pe(r){var n=r,{src:e,type:o}=n,t=y(n,["src","type"]);return jsx(o==="video"?So:Co,a({src:e},t))}var P=Do.forwardRef((i,n)=>{var l=i,{children:e,flowId:o,part:t}=l,r=y(l,["children","flowId","part"]);var d;if(o!=null)return jsx(rn,a({flowId:o},r));let s=(d=r.as)!=null?d:F.Column;return jsx(s,p(a({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,part:["card",t]},r),{ref:n,children:e}))});P.Dismiss=e=>jsx(D.Plain,p(a({"aria-label":"Dismiss",part:"dismiss",padding:0},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}));P.Footer=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return jsx(F.Row,p(a({alignItems:"center",gap:3,justifyContent:"flex-end",part:["card-footer",o]},t),{children:e}))};P.Header=l=>{var s=l,{dismissible:e,handleDismiss:o,part:t,subtitle:r,title:n}=s,i=y(s,["dismissible","handleDismiss","part","subtitle","title"]);return !e&&(n==null||(n==null?void 0:n.length)===0)&&(r==null||(r==null?void 0:r.length)===0)?null:jsxs(F.Row,p(a({alignItems:"flex-start",flexWrap:"wrap",gap:1,part:["card-header",t]},i),{children:[jsx(P.Title,{maxWidth:"calc(100% - 32px)",children:n}),e&&jsx(P.Dismiss,{onClick:o,marginLeft:"auto"}),jsx(P.Subtitle,{color:"neutral.400",flexBasis:"100%",children:r})]}))};P.Media=t=>{var r=t,{src:e}=r,o=y(r,["src"]);return e==null||(e==null?void 0:e.length)===0?null:jsx(Pe,a({borderRadius:"md",src:e},o))};P.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=y(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(D.Primary,a({title:o,onClick:e},t))};P.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=y(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(D.Secondary,a({title:o,onClick:e},t))};P.Subtitle=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return e==null?null:jsx(R.Body2,p(a({display:"block",color:"neutral.400",part:["subtitle",o]},t),{children:e}))};P.Title=r=>{var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);return e==null?null:jsx(R.H4,p(a({display:"block",part:["title",o]},t),{children:e}))};var wo={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function sn(e){let o=Object.fromEntries(wo.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(wo.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!wo.content.some(i=>i===n)&&!wo.root.some(i=>i===n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}var Ss=keyframes`
|
|
68
68
|
from {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
}
|