@frigade/react 1.38.11 → 2.0.0-alpha

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.d.ts CHANGED
@@ -1,1065 +1,83 @@
1
- import * as React from 'react';
2
- import React__default, { CSSProperties, FC, ElementType, ReactNode, ComponentPropsWithoutRef } from 'react';
3
- import { BorderProps, ColorProps, LayoutProps, ShadowProps, SpaceProps, TypographyProps, FontProps } from 'styled-system';
1
+ import * as React$1 from 'react';
2
+ import React__default from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as Popover from '@radix-ui/react-popover';
4
5
 
5
- type StepActionType = 'STARTED_STEP' | 'COMPLETED_STEP' | 'NOT_STARTED_STEP';
6
+ type BoxProps<T extends React$1.ElementType = React$1.ElementType> = {
7
+ as?: T;
8
+ part?: string | string[];
9
+ } & React$1.ComponentPropsWithRef<T>;
10
+ declare const Box: React$1.ForwardRefExoticComponent<Omit<any, "ref"> & React$1.RefAttributes<React$1.ElementType<any>>>;
6
11
 
7
- interface StepData {
8
- /**
9
- * Unique identifier for the step.
10
- */
11
- id: string;
12
- /**
13
- * Name of the step when shown in a list view
14
- */
15
- stepName?: string;
16
- /**
17
- * Title of the step
18
- */
12
+ type ButtonVariant = 'Primary' | 'Secondary' | 'Link' | 'Plain';
13
+ interface ButtonProps extends BoxProps {
19
14
  title?: string;
20
- /**
21
- * Subtitle of the step
22
- */
23
- subtitle?: string;
24
- /**
25
- * Primary button title. If omitted, the primary button will not be shown.
26
- */
27
- primaryButtonTitle?: string;
28
- /**
29
- * Primary button URI.
30
- */
31
- primaryButtonUri?: string;
32
- /**
33
- * Primary button URI target (either _blank or _self)
34
- */
35
- primaryButtonUriTarget?: string;
36
- /**
37
- * Secondary button title. If omitted, the secondary button will not be shown.
38
- */
39
- secondaryButtonTitle?: string;
40
- /**
41
- * Secondary button URI.
42
- */
43
- secondaryButtonUri?: string;
44
- /**
45
- * Secondary button URI target (either _blank or _self)
46
- */
47
- secondaryButtonUriTarget?: string;
48
- /**
49
- * Text on button if a back button is present
50
- */
51
- backButtonTitle?: string;
52
- /**
53
- * If true, the step will be marked as completed when the secondary button is clicked.
54
- */
55
- skippable?: boolean;
56
- /**
57
- * @deprecated use primaryButtonUri instead
58
- */
59
- url?: string;
60
- /**
61
- * @deprecated use primaryButtonUriTarget instead
62
- */
63
- urlTarget?: string;
64
- type?: string;
65
- /**
66
- * Video url to be shown for components supporting video.
67
- */
68
- videoUri?: string;
69
- /**
70
- * Image url to be shown for components supporting image.
71
- */
72
- imageUri?: string | null;
73
- /**
74
- * Automatically mark the step as completed when the primary button is clicked. Default is false.
75
- */
76
- autoMarkCompleted?: boolean;
77
- /**
78
- * Whether the step is completed.
79
- */
80
- complete: boolean;
81
- /**
82
- * Whether the step has been started by the user. True if either the step was marked started or completed.
83
- */
84
- started: boolean;
85
- /**
86
- * Whether the step is currently active/the flow is currently on this step. Can only be true for on step at a time.
87
- */
88
- currentlyActive: boolean;
89
- /**
90
- * Whether the step is blocked (can't be accessed yet)
91
- */
92
- blocked?: boolean;
93
- /**
94
- * Whether the step is hidden (not shown in the list view)
95
- */
96
- hidden?: boolean;
97
- StepContent?: React__default.ReactNode;
98
- /**
99
- * Handler for when the primary button is clicked.
100
- */
101
- handlePrimaryButtonClick?: () => void;
102
- /**
103
- * Handler for when the secondary button is clicked.
104
- */
105
- handleSecondaryButtonClick?: () => void;
106
- ctaActionType?: 'complete';
107
- props?: any;
108
- /**
109
- * Criteria that needs to be met for the step to complete
110
- */
111
- completionCriteria?: string;
112
- /**
113
- * Criteria that needs to be met for the step to start
114
- */
115
- startCriteria?: string;
116
- progress?: number;
117
- /**
118
- * Whether the step is dismissible (for instance, tooltips or other non-essential steps)
119
- */
120
- dismissible?: boolean;
121
- /**
122
- * Whether to show a highlight in the page where the step is shown. Typically used in tooltips for creating small pings.
123
- */
124
- showHighlight?: boolean;
125
- /**
126
- * Any other additional props defined in config.yml
127
- */
128
- [x: string | number | symbol]: unknown;
129
- }
130
- interface DefaultFrigadeFlowProps {
131
- flowId: string;
132
- style?: CSSProperties;
133
- className?: string;
134
- /**
135
- * The appearance of the flow. See https://docs.frigade.com/sdk/styling
136
- */
137
- appearance?: Appearance;
138
- /**
139
- * Dynamic variables to use in config.yml. See https://docs.frigade.com/flows/dynamic-variables
140
- */
141
- customVariables?: {
142
- [key: string]: string | number | boolean;
143
- };
144
- hideOnFlowCompletion?: boolean;
145
- /**
146
- * Handler for when a step is completed.
147
- * @param step
148
- * @param index
149
- * @param nextStep
150
- * @param allFormData All form data collected so far (only applicable to FrigadeForms)
151
- * @param stepSpecificFormData Form data collected for the finished step (only applicable to FrigadeForms)
152
- */
153
- onStepCompletion?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: any) => boolean;
154
- /**
155
- * Handler for when a primary or secondary CTA is clicked (regardless if step is completed or not).
156
- * Return true if your app performs an action (e.g. open other modal or page transition).
157
- * @param step
158
- * @param index
159
- * @param cta
160
- */
161
- onButtonClick?: (step: StepData, index?: number, cta?: 'primary' | 'secondary' | 'link' | 'back' | 'collapse' | 'expand', nextStep?: StepData) => boolean;
162
- onDismiss?: () => void;
163
- onComplete?: () => void;
164
- }
165
- interface Appearance {
166
- /**
167
- * Overrides of individual components and classes.
168
- * This map can either be className(s) or CSSProperties.
169
- */
170
- styleOverrides?: {
171
- [key: string]: CSSProperties | string;
172
- };
173
- /**
174
- * The base theme to use with Frigade components.
175
- */
176
- theme?: BaseTheme;
177
- }
178
- interface BaseTheme {
179
- /**
180
- * The base theme color used on CTAs and other primary elements.
181
- */
182
- colorPrimary?: string;
183
- /**
184
- * Secondary color, used for CTAs and other secondary elements.
185
- */
186
- colorSecondary?: string;
187
- colorBackground?: string;
188
- colorBackgroundSecondary?: string;
189
- colorText?: string;
190
- colorTextOnPrimaryBackground?: string;
191
- colorTextSecondary?: string;
192
- colorTextDisabled?: string;
193
- colorTextError?: string;
194
- colorTextSuccess?: string;
195
- colorBorder?: string;
196
- fontSize?: string | number;
197
- fontSmoothing?: string;
198
- fontWeight?: string | number;
199
- borderRadius?: number;
200
- modalContainer?: CSSProperties;
15
+ variant?: ButtonVariant;
201
16
  }
202
- declare const DefaultAppearance: Appearance;
203
-
204
- interface Flow {
205
- id: number;
206
- name: string;
207
- description: string;
208
- data: string;
209
- createdAt: string;
210
- modifiedAt: string;
211
- slug: string;
212
- type: FlowType;
213
- triggerType: TriggerType;
214
- targetingLogic?: string;
215
- active: boolean;
216
- }
217
- declare enum FlowType {
218
- CHECKLIST = "CHECKLIST",
219
- FORM = "FORM",
220
- TOUR = "TOUR",
221
- SUPPORT = "SUPPORT",
222
- CUSTOM = "CUSTOM",
223
- BANNER = "BANNER",
224
- EMBEDDED_TIP = "EMBEDDED_TIP",
225
- NPS_SURVEY = "NPS_SURVEY",
226
- ANNOUNCEMENT = "ANNOUNCEMENT"
227
- }
228
- declare enum TriggerType {
229
- MANUAL = "MANUAL",
230
- AUTOMATIC = "AUTOMATIC"
231
- }
232
- declare function useFlows(): {
233
- getAllFlows: () => Flow[];
234
- getFlow: (flowId: string) => Flow;
235
- getFlowData: <T>(flowId: string) => T;
236
- isLoading: boolean;
237
- getStepStatus: (flowId: string, stepId: string) => StepActionType | null;
238
- getFlowSteps: (flowId: string) => StepData[];
239
- getCurrentStepIndex: (flowId: string) => number;
240
- markStepStarted: (flowId: string, stepId: string, data?: any) => Promise<void>;
241
- markStepCompleted: (flowId: string, stepId: string, data?: any) => Promise<void>;
242
- markFlowNotStarted: (flowId: string, data?: any) => Promise<void>;
243
- markFlowStarted: (flowId: string, data?: any) => Promise<void>;
244
- markFlowCompleted: (flowId: string, data?: any) => Promise<void>;
245
- markFlowSkipped: (flowId: string, data?: any) => Promise<void>;
246
- markStepNotStarted: (flowId: string, stepId: string, data?: any) => Promise<void>;
247
- getFlowStatus: (flowId: string) => "COMPLETED_FLOW" | "STARTED_FLOW" | "NOT_STARTED_FLOW";
248
- getNumberOfStepsCompleted: (flowId: string) => number;
249
- getNumberOfSteps: (flowId: string) => number;
250
- targetingLogicShouldHideFlow: (flow: Flow) => boolean;
251
- setCustomVariable: (key: string, value: string | number | boolean) => void;
252
- updateCustomVariables: (newCustomVariables?: {
253
- [key: string]: string | number | boolean;
254
- }) => void;
255
- customVariables: {
256
- [key: string]: string | number | boolean;
17
+ declare function BaseButton({ as, children, css, title, variant, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
18
+ declare const Button: typeof BaseButton & {
19
+ [k: string]: {
20
+ ({ part, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
21
+ displayName: string;
257
22
  };
258
- getStepOptionalProgress: (step: StepData) => number;
259
- getFlowMetadata: (slug: string) => any;
260
- isStepBlocked: (flowId: string, stepId: string) => boolean;
261
- isStepHidden: (flowId: string, stepId: string) => boolean;
262
- hasActiveFullPageFlow: boolean;
263
- setHasActiveFullPageFlow: React.Dispatch<React.SetStateAction<boolean>>;
264
- isFlowAvailableToUser: (flowId: string) => boolean;
265
- refresh: () => void;
266
23
  };
267
24
 
268
- interface FlowResponse {
269
- foreignUserId: string;
270
- foreignUserGroupId?: string;
271
- flowSlug: string;
272
- stepId: string;
273
- actionType: string;
274
- data: object;
275
- createdAt: Date;
276
- blocked: boolean;
277
- hidden: boolean;
278
- }
279
- interface PublicStepState {
280
- stepId: string;
281
- actionType: 'COMPLETED_STEP' | 'STARTED_STEP' | 'NOT_STARTED_STEP';
282
- blocked: boolean;
283
- hidden: boolean;
284
- createdAt: Date;
285
- }
286
- declare function useFlowResponses(): {
287
- addResponse: (flowResponse: FlowResponse) => Promise<void>;
288
- setFlowResponses: React.Dispatch<React.SetStateAction<FlowResponse[]>>;
289
- getFlowResponses: () => FlowResponse[];
25
+ declare const Flex: {
26
+ Column: React$1.ForwardRefExoticComponent<Omit<any, "ref"> & React$1.RefAttributes<unknown>>;
27
+ Row: React$1.ForwardRefExoticComponent<Omit<any, "ref"> & React$1.RefAttributes<unknown>>;
290
28
  };
291
29
 
292
- interface FrigadeProviderProps {
293
- publicApiKey: string;
294
- /**
295
- * The user id of the user that is currently logged in.
296
- */
297
- userId?: string;
298
- /**
299
- * The organization id of the organization that is currently logged in.
300
- */
301
- organizationId?: string;
302
- config?: FrigadeConfig;
303
- children?: React__default.ReactNode;
30
+ interface ProviderProps {
31
+ apiKey: string;
32
+ children?: React.ReactNode;
33
+ config?: ProviderConfig;
34
+ theme?: Record<any, any>;
304
35
  }
305
- interface FrigadeConfig {
306
- /**
307
- * Override the default router used by Frigade.
308
- * This is useful if you are using a router and want to avoid doing a full page refresh on navigation.
309
- * @param url The url to navigate to.
310
- */
311
- navigate?: (url: string, target: string) => void;
312
- /**
313
- * Default Appearance for all flows.
314
- */
315
- defaultAppearance?: Appearance;
316
- /**
317
- * API url to use for all requests. Defaults to https://api.frigade.com
318
- */
36
+ interface ProviderConfig {
319
37
  apiUrl?: string;
320
- /**
321
- * When true, Frigade will be in read-only mode and state will not be updated. Default false.
322
- * Used mostly for demo purposes.
323
- */
324
- readonly?: boolean;
325
- theme?: Record<string, any>;
326
- /**
327
- * Flag to turn on debug mode which will log all events to the console. Default false.
328
- * Default false.
329
- */
330
- debug?: boolean;
331
- /**
332
- * @ignore
333
- */
334
- __internal__?: {
335
- [key: string]: string;
336
- };
337
- }
338
- declare const FrigadeProvider: FC<FrigadeProviderProps>;
339
-
340
- interface FrigadeChecklistProps extends HeroChecklistProps {
341
- flowId: string;
342
- title?: string;
343
- subtitle?: string;
344
- style?: CSSProperties;
345
- /** @ignore */
346
- initialSelectedStep?: number;
347
- className?: string;
348
- type?: 'inline' | 'modal';
349
- checklistStyle?: 'with-guide' | 'default' | 'condensed' | 'carousel';
350
- visible?: boolean;
351
- setVisible?: (visible: boolean) => void;
352
- onDismiss?: () => void;
353
- /**
354
- * See https://docs.frigade.com/flows/dynamic-variables
355
- */
356
- customVariables?: {
357
- [key: string]: string | number | boolean;
358
- };
359
- /** @ignore */
360
- guideFlowId?: string;
361
- /** @ignore */
362
- guideTitle?: string;
363
- autoExpandFirstIncompleteStep?: boolean;
364
- autoExpandNextStep?: boolean;
365
- }
366
- declare const FrigadeChecklist: React__default.FC<FrigadeChecklistProps>;
367
-
368
- interface HeroChecklistProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {
369
- title?: string;
370
- subtitle?: string;
371
- /**
372
- * @deprecated Use `appearance` instead
373
- * @ignore
374
- */
375
- primaryColor?: string;
376
- /** @ignore */
377
- steps?: StepData[];
378
- /** @ignore */
379
- selectedStep?: number;
380
- /** @ignore */
381
- setSelectedStep?: (index: number) => void;
382
- /**
383
- * Map of custom step types that the checklist supports. To use a custom steps in your checklist, see [Component Customization](/component/customization#customizing-frigade-components)
384
- */
385
- customStepTypes?: Record<string, ((stepData: StepData, appearance: Appearance) => React__default.ReactNode) | React__default.ReactNode>;
386
- }
387
-
388
- interface FrigadeHeroChecklistProps extends HeroChecklistProps {
389
- flowId: string;
390
- title?: string;
391
- subtitle?: string;
392
- primaryColor?: string;
393
- onCompleteStep?: (index: number, stepData: StepData) => void;
394
- style?: CSSProperties;
395
- initialSelectedStep?: number;
396
- className?: string;
397
- }
398
- declare const FrigadeHeroChecklist: React__default.FC<FrigadeHeroChecklistProps>;
399
-
400
- type ProgressBadgeType = 'condensed' | 'default' | 'full-width';
401
-
402
- interface FrigadeProgressBadgeProps extends DefaultFrigadeFlowProps {
403
- title: string;
404
- subtitle?: string;
405
- icon?: React__default.ReactNode;
406
- textStyle?: CSSProperties;
407
- onClick?: () => void;
408
- hideOnFlowCompletion?: boolean;
409
- type?: ProgressBadgeType;
410
- }
411
- declare const FrigadeProgressBadge: React__default.FC<FrigadeProgressBadgeProps>;
412
-
413
- interface FormInputType {
414
- id: string;
415
- title?: string;
416
- subtitle?: string;
417
- type: string;
418
- required?: boolean;
419
- validation?: InputValidation;
420
- }
421
- interface InputValidation {
422
- type: 'number' | 'string' | 'email' | 'phone' | 'date' | 'time' | 'datetime' | 'url' | 'custom' | 'password';
423
- requiredError?: string;
424
- invalidTypeError?: string;
425
- props?: InputValidationRuleProps[];
426
- }
427
- interface InputValidationRuleProps {
428
- requirement: string;
429
- value?: string | number;
430
- message?: string;
431
- }
432
- interface FormInputProps {
433
- formInput: FormInputType;
434
- customFormTypeProps: CustomFormTypeProps;
435
- inputData: any;
436
- onSaveInputData: (data: any) => void;
437
- setFormValidationErrors: (errors: FormValidationError[]) => void;
438
- }
439
- interface FormValidationError {
440
- message: string;
441
- id: string;
442
- hidden?: boolean;
443
- }
444
- interface CustomFormTypeProps {
445
- flowId: string;
446
- stepData: StepData;
447
- canContinue: boolean;
448
- setCanContinue: (canContinue: boolean) => void;
449
- onSaveData: (data: object) => void;
450
- appearance?: Appearance;
451
- prefillData?: Record<string, any>;
452
- customFormElements?: {
453
- [key: string]: (params: FormInputProps) => React__default.ReactNode;
454
- };
455
- }
456
- interface StepContentProps {
457
- stepData: StepData;
458
- appearance?: Appearance;
459
- }
460
- type EntityProperties = Record<string, string | boolean | number | null>;
461
-
462
- type FrigadeFormType = 'inline' | 'modal' | 'large-modal' | 'corner-modal';
463
- interface FrigadeFormProps extends DefaultFrigadeFlowProps {
464
- /**
465
- * @ignore
466
- */
467
- title?: string;
468
- /**
469
- * @ignore
470
- */
471
- subtitle?: string;
472
- type?: FrigadeFormType;
473
- /**
474
- * Map of custom components. The key must match the `type` property of the step defined in `config.yml`
475
- */
476
- customStepTypes?: {
477
- [key: string]: ((params: {
478
- flowId: string;
479
- stepData: StepData;
480
- canContinue: boolean;
481
- setCanContinue: (canContinue: boolean) => void;
482
- onSaveData: (data: object) => void;
483
- appearance?: Appearance;
484
- prefillData?: Record<string, any>;
485
- customFormElements?: {
486
- [key: string]: (params: FormInputProps) => React__default.ReactNode;
487
- };
488
- }) => React__default.ReactNode) | React__default.ReactNode;
489
- };
490
- /**
491
- * Map of custom form components. Can only be used with a step of type `multiInput` (defined in `config.yml`).
492
- * The key must match the `type` property of the input defined in `config.yml`
493
- */
494
- customFormElements?: {
495
- [key: string]: (params: FormInputProps) => React__default.ReactNode;
496
- };
497
- visible?: boolean;
498
- setVisible?: (visible: boolean) => void;
499
- onComplete?: () => void;
500
- /**
501
- * Whether to show a dismiss button to exit out of the form. Applicable only for modal forms.
502
- */
503
- dismissible?: boolean;
504
- /**
505
- * If true, the form can be repeated multiple times. Default is false. Useful for e.g. contact/support forms.
506
- */
507
- repeatable?: boolean;
508
- /**
509
- * If true, the user will be excited from the flow when the form is dismissed. Default is false.
510
- */
511
- endFlowOnDismiss?: boolean;
512
- /**
513
- * Indicates the position of the modal if the form type is a modal. Default is center.
514
- */
515
- modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
516
- /**
517
- * Show a pagination indicator at the bottom of the form. Default is false.
518
- */
519
- showPagination?: boolean;
520
- /**
521
- * Whether to allow the user to navigate back to previous steps. Default is false.
522
- * The title of the button can be controlled by the `backButtonTitle` prop on the step.
523
- */
524
- allowBackNavigation?: boolean;
525
- /**
526
- * @ignore
527
- */
528
- showFrigadeBranding?: boolean;
529
- /**
530
- * Async function resolved when the user submits data in a step.
531
- * If the promise evaluates to a string or `false`, the flow will not proceed to the next step. The string will be displayed as an error message if passed.
532
- * If the promise evaluates to `true`, the flow will proceed to the next step.
533
- */
534
- validationHandler?: (step: StepData, index: number, nextStep?: StepData, allFormData?: any, stepSpecificFormData?: any) => Promise<string | null | boolean | undefined>;
535
- /**
536
- * Handler that is called when the form data changes.
537
- */
538
- onFormDataChange?: (allFormData: any, stepSpecificFormData: any, step: StepData, index: number) => void;
539
- /**
540
- * Show or hide the form footer
541
- */
542
- showFooter?: boolean;
543
- /**
544
- * Data to use for prefilling forms with data.
545
- * Useful when you want to prefill a form with data from another source.
546
- * The format of the data maps a step id to the prefill data. Depending on the implementation of the given step type,
547
- * the value of the data will follow a different structure.
548
- *
549
- * For `type` multiInputStep, the value contains another map similar to the structure returned from `onFormDataChange`
550
- */
551
- prefillData?: Record<string, any>;
552
- /**
553
- * Whether to update the url when the page changes in multi-page forms. If enabled, the current url will be updated with the
554
- * current step id in the following format: <my_url>?p=<current_step_id>
555
- *
556
- * This is useful when wanting to capture URL changes with third-party tracking tools.
557
- *
558
- * Default is false.
559
- */
560
- updateUrlOnPageChange?: boolean;
561
- }
562
- declare const FrigadeForm: FC<FrigadeFormProps>;
563
-
564
- interface FrigadeGuideProps extends DefaultFrigadeFlowProps {
565
- title: string;
566
- primaryColor?: string;
567
- }
568
- declare const FrigadeGuide: FC<FrigadeGuideProps>;
569
-
570
- type ToolTipPosition = 'left' | 'right' | 'auto';
571
- interface ToolTipData extends StepData {
572
- selector?: string;
573
- subtitleStyle?: CSSProperties;
574
- titleStyle?: CSSProperties;
575
- buttonStyle?: CSSProperties;
576
- }
577
-
578
- interface FrigadeTourProps extends Omit<DefaultFrigadeFlowProps, 'flowId'> {
579
- /**
580
- * @ignore
581
- */
582
- steps?: ToolTipData[];
583
- onDismiss?: () => void;
584
- onComplete?: () => void;
585
- tooltipPosition?: ToolTipPosition;
586
- /**
587
- * Whether to show the highlight (the small circle/ping) or not. Defaults to true.
588
- */
589
- showHighlight?: boolean;
590
- /**
591
- * Whether to show more than one tooltip at a time. Defaults to false.
592
- */
593
- showTooltipsSimultaneously?: boolean;
594
- /**
595
- * @ignore
596
- */
597
- buttonStyle?: CSSProperties;
598
- /**
599
- * Offset to apply to all tooltips. If you only wish to apply an offset to a single tooltip you can use `props.offset` in the config.yml instead.
600
- */
601
- offset?: {
602
- x: number;
603
- y: number;
604
- };
605
- visible?: boolean;
606
- /**
607
- * @ignore
608
- */
609
- containerStyle?: CSSProperties;
610
- customVariables?: {
611
- [key: string]: string | number | boolean;
612
- };
613
- /**
614
- * @ignore
615
- */
616
- selectedStep?: number;
617
- customStepTypes?: Record<string, (props: {
618
- stepData: StepData;
619
- primaryColor: string;
620
- }) => React__default.ReactNode>;
621
- appearance?: Appearance;
622
- /**
623
- * Shows a close button in the top right corner of the tooltip. Depending on dismissBehavior, it will either end the entire flow or just the current step.
624
- */
625
- dismissible?: boolean;
626
- primaryColor?: string;
627
- /**
628
- * If true, the tooltip will only show the highlight and not the tooltip itself.
629
- * Clicking the highlight will reveal it.
630
- */
631
- showHighlightOnly?: boolean;
632
- /**
633
- * If true, a step counter will show up in the tooltip.
634
- */
635
- showStepCount?: boolean;
636
- /**
637
- * `skip-flow` (default): Completes the entire flow/tour when a single tooltip is dismissed.
638
- * `complete-step`: Completes the current step when a tooltip is dismissed. The user can continue in the tour.
639
- */
640
- dismissBehavior?: 'skip-flow' | 'complete-step';
641
- /**
642
- * @ignore
643
- */
644
- showFrigadeBranding?: boolean;
645
- /**
646
- * If true, the tour will go to the next existing step/tip if the current selector element is not found on the page.
647
- * Be careful with this, as it can lead to unexpected behavior of tooltip ordering if the selector is slow to load on the page.
648
- * Defaults to false.
649
- */
650
- skipIfNotFound?: boolean;
651
- /**
652
- * How to position the tooltips with CSS. Defaults to `absolute`.
653
- * @ignore
654
- */
655
- cssPosition?: 'fixed' | 'absolute' | 'static';
656
- }
657
- declare const FrigadeTour: FC<FrigadeTourProps & {
658
- flowId: string;
659
- initialSelectedStep?: number;
660
- }>;
661
-
662
- interface FrigadeSupportWidgetProps extends DefaultFrigadeFlowProps {
663
- type?: 'floating' | 'inline';
664
- visible?: boolean;
665
- title?: string;
666
- }
667
- declare const FrigadeSupportWidget: FC<FrigadeSupportWidgetProps>;
668
-
669
- interface FrigadeEmbeddedTipProps extends DefaultFrigadeFlowProps {
670
- dismissible?: boolean;
671
- /**
672
- * Handler for when the container is clicked
673
- */
674
- onClick?: () => void;
675
- }
676
- declare const FrigadeEmbeddedTip: React__default.FC<FrigadeEmbeddedTipProps>;
677
-
678
- type FrigadeBannerType = 'full-width' | 'square';
679
- interface FrigadeBannerProps extends DefaultFrigadeFlowProps {
680
- /**
681
- * full-width: Full width banner, useful in top of the page.
682
- *
683
- * square: Square sized banner, useful in sidebars
684
- */
685
- type?: FrigadeBannerType;
686
- title?: string;
687
- subtitle?: string;
688
- onDismiss?: () => void;
689
- /**
690
- * Icon to use in the banner
691
- */
692
- icon?: React__default.ReactNode;
693
- /**
694
- * Handler for when the banner container is clicked
695
- */
696
- onClick?: () => void;
697
- }
698
- declare const FrigadeBanner: React__default.FC<FrigadeBannerProps>;
699
-
700
- interface FrigadeNPSSurveyProps extends DefaultFrigadeFlowProps {
701
- dismissible?: boolean;
702
- type?: 'inline' | 'modal';
703
- }
704
- declare const FrigadeNPSSurvey: React__default.FC<FrigadeNPSSurveyProps>;
705
-
706
- interface FrigadeAnnouncementProps extends DefaultFrigadeFlowProps {
707
- dismissible?: boolean;
708
- /**
709
- * Indicates the position of the modal if the form type is a modal. Default is center.
710
- */
711
- modalPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' | 'inline';
712
- /**
713
- * Show a pagination indicator at the bottom of the announcement when using more than 1 page. Default is true.
714
- */
715
- showPagination?: boolean;
716
- /**
717
- * Whether to allow the user to navigate back to previous steps. Default is false.
718
- * The title of the button can be controlled by the `backButtonTitle` prop on the step.
719
- */
720
- allowBackNavigation?: boolean;
721
- }
722
- declare const FrigadeAnnouncement: React__default.FC<FrigadeAnnouncementProps>;
723
-
724
- declare function useFlowOpens(): {
725
- getOpenFlowState: (flowId: string, defaultValue?: boolean) => boolean;
726
- setOpenFlowState: (flowId: string, isOpen: boolean) => void;
727
- resetOpenFlowState: (flowId: string) => void;
728
- hasOpenModals: (currentFlowId?: string) => boolean;
729
- setKeepCompletedFlowOpenDuringSession: (flowId: string) => void;
730
- shouldKeepCompletedFlowOpenDuringSession: (flowId: string) => boolean;
731
- };
732
-
733
- declare function useUser(): {
734
- readonly userId: string | null;
735
- readonly setUserId: React__default.Dispatch<React__default.SetStateAction<string | null>>;
736
- readonly setUserIdWithProperties: (userId: string, properties?: EntityProperties) => Promise<void>;
737
- readonly addPropertiesToUser: (properties: EntityProperties) => Promise<void>;
738
- readonly trackEventForUser: (event: string, properties?: EntityProperties) => Promise<void>;
739
- readonly linkExistingGuestSessionToUser: (userId: string) => Promise<void>;
740
- };
741
-
742
- declare function useOrganization(): {
743
- readonly organizationId: string | null;
744
- readonly setOrganizationId: React__default.Dispatch<React__default.SetStateAction<string | null>>;
745
- readonly setOrganizationIdWithProperties: (organizationId: string, properties?: EntityProperties) => Promise<void>;
746
- readonly addPropertiesToOrganization: (properties: EntityProperties) => Promise<void>;
747
- readonly trackEventForOrganization: (event: string, properties?: EntityProperties) => Promise<void>;
748
- };
749
-
750
- interface PublicUserFlowState {
751
- flowId: string;
752
- flowState: 'COMPLETED_FLOW' | 'STARTED_FLOW' | 'NOT_STARTED_FLOW';
753
- lastStepId: string;
754
- userId: string;
755
- foreignUserId: string;
756
- stepStates: object;
757
- shouldTrigger: boolean;
758
- }
759
- declare function useUserFlowStates(): {
760
- userFlowStatesData: PublicUserFlowState[];
761
- isLoadingUserFlowStateData: boolean;
762
- mutateUserFlowState: () => any;
763
- optimisticallyMarkFlowCompleted: (flowId: string) => void;
764
- optimisticallyMarkFlowSkipped: (flowId: string) => void;
765
- optimisticallyMarkFlowNotStarted: (flowId: string) => void;
766
- optimisticallyMarkStepCompleted: (flowId: string, stepId: string, flowResponse: FlowResponse) => void;
767
- optimisticallyMarkStepNotStarted: (flowId: string, stepId: string, flowResponse: FlowResponse) => void;
768
- optimisticallyMarkStepStarted: (flowId: string, stepId: string, flowResponse: FlowResponse) => void;
769
- error: any;
770
- };
771
-
772
- declare function Label({ title, required, appearance, }: {
773
- title?: string;
774
- required: boolean;
775
- appearance?: Appearance;
776
- }): React__default.JSX.Element;
777
-
778
- declare function TextField({ formInput, customFormTypeProps, onSaveInputData, setFormValidationErrors, inputData, }: FormInputProps): React__default.JSX.Element;
779
-
780
- interface Overrides extends Record<string, Overrides | CSSProperties> {
38
+ userId?: string;
781
39
  }
782
- type BoxProps<T extends ElementType = 'div'> = {
783
- as?: T;
784
- css?: Record<string, any>;
785
- children?: ReactNode;
786
- overrides?: Overrides;
787
- } & BorderProps & ColorProps & Exclude<LayoutProps, 'size'> & ShadowProps & SpaceProps & TypographyProps & ComponentPropsWithoutRef<T>;
788
- declare const Box: <T extends React__default.ElementType<any> = "div">({ as, children, overrides, ...rest }: any) => React__default.JSX.Element;
40
+ declare function Provider({ apiKey, children, config, theme }: ProviderProps): react_jsx_runtime.JSX.Element;
789
41
 
790
- interface ButtonProps extends BoxProps {
791
- title: string;
42
+ type TextVariant = 'Display1' | 'Display2' | 'H1' | 'H2' | 'H3' | 'H4' | 'Body1' | 'Body2' | 'Caption';
43
+ interface TextProps extends BoxProps {
44
+ variant?: TextVariant;
792
45
  }
793
- declare const Button: React.FC<ButtonProps> & {
46
+ declare function BaseText({ as, children, css, variant, ...props }: TextProps): react_jsx_runtime.JSX.Element;
47
+ declare const Text: typeof BaseText & {
794
48
  [k: string]: {
795
- (props: ButtonProps): React.JSX.Element;
49
+ (props: TextProps): react_jsx_runtime.JSX.Element;
796
50
  displayName: string;
797
51
  };
798
52
  };
799
53
 
800
- type CheckBoxType = 'square' | 'round';
801
- interface CheckBoxProps {
802
- value: boolean;
803
- type?: CheckBoxType;
804
- primaryColor?: string;
805
- progress?: number;
806
- appearance?: Appearance;
807
- className?: string;
808
- style?: React__default.CSSProperties;
54
+ interface MediaProps extends BoxProps {
55
+ src: string;
56
+ type: 'image' | 'video';
809
57
  }
810
- declare const CheckBox: FC<CheckBoxProps>;
811
58
 
812
- interface ProgressRingProps {
813
- fillColor: string;
814
- size: number;
815
- bgColor?: string;
816
- percentage: number;
817
- className?: string;
59
+ interface MergedRadixPopoverProps extends Pick<Popover.PopoverProps, 'defaultOpen' | 'modal' | 'onOpenChange' | 'open'>, Omit<Popover.PopoverContentProps, 'align' | 'asChild'> {
60
+ }
61
+ interface TooltipProps extends MergedRadixPopoverProps {
62
+ align?: Popover.PopoverContentProps['align'] | 'before' | 'after';
63
+ anchor?: string;
64
+ spotlight?: boolean;
818
65
  style?: React__default.CSSProperties;
819
- children?: React__default.ReactNode;
820
66
  }
821
- declare const ProgressRing: FC<ProgressRingProps>;
822
-
823
- declare const textVariants: {
824
- readonly Display1: {
825
- readonly fontSize: "5xl";
826
- readonly fontWeight: "bold";
827
- readonly letterSpacing: "md";
828
- readonly lineHeight: "4xl";
829
- };
830
- readonly Display2: {
831
- readonly fontSize: "4xl";
832
- readonly fontWeight: "bold";
833
- readonly letterSpacing: "md";
834
- readonly lineHeight: "3xl";
835
- };
836
- readonly H1: {
837
- readonly fontSize: "3xl";
838
- readonly fontWeight: "bold";
839
- readonly letterSpacing: "md";
840
- readonly lineHeight: "2xl";
841
- };
842
- readonly H2: {
843
- readonly fontSize: "2xl";
844
- readonly fontWeight: "bold";
845
- readonly letterSpacing: "md";
846
- readonly lineHeight: "xl";
847
- };
848
- readonly H3: {
849
- readonly fontSize: "xl";
850
- readonly fontWeight: "bold";
851
- readonly letterSpacing: "md";
852
- readonly lineHeight: "lg";
853
- };
854
- readonly H4: {
855
- readonly fontSize: "lg";
856
- readonly fontWeight: "bold";
857
- readonly letterSpacing: "md";
858
- readonly lineHeight: "md";
859
- };
860
- readonly Body1: {
861
- readonly fontSize: "md";
862
- readonly fontWeight: "regular";
863
- readonly letterSpacing: "md";
864
- readonly lineHeight: "md";
865
- };
866
- readonly Body2: {
867
- readonly fontSize: "sm";
868
- readonly fontWeight: "regular";
869
- readonly letterSpacing: "md";
870
- readonly lineHeight: "md";
871
- };
872
- readonly Caption: {
873
- readonly fontSize: "xs";
874
- readonly fontWeight: "regular";
875
- readonly letterSpacing: "md";
876
- readonly lineHeight: "sm";
877
- };
878
- };
879
-
880
- type TextVariant = keyof typeof textVariants;
881
- interface BaseTextProps extends BoxProps, Partial<Pick<FontProps, 'fontWeight'>> {
882
- variant?: TextVariant;
67
+ declare function Tooltip({ anchor, children, css, spotlight, style, ...props }: TooltipProps): react_jsx_runtime.JSX.Element;
68
+ declare namespace Tooltip {
69
+ var Close: ({ css, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
70
+ var Media: ({ src, ...props }: MediaProps) => react_jsx_runtime.JSX.Element;
71
+ var Primary: ({ onClick, title, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
72
+ var Progress: ({ children, ...props }: TextProps) => react_jsx_runtime.JSX.Element;
73
+ var Secondary: ({ onClick, title, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
74
+ var Subtitle: ({ children, ...props }: TextProps) => react_jsx_runtime.JSX.Element;
75
+ var Title: ({ children, ...props }: TextProps) => react_jsx_runtime.JSX.Element;
883
76
  }
884
- declare const Text: React__default.FC<BaseTextProps> & {
885
- [k: string]: {
886
- (props: BaseTextProps): React__default.JSX.Element;
887
- displayName: string;
888
- };
889
- };
890
-
891
- declare const ProgressBar: ({ count, total, display, textLocation, style, textStyle, appearance, }: {
892
- count: number;
893
- total: number;
894
- bgColor?: string;
895
- display?: 'count' | 'percent' | 'compact';
896
- textLocation?: 'top' | 'left';
897
- style?: CSSProperties;
898
- textStyle?: CSSProperties;
899
- appearance?: Appearance;
900
- }) => React__default.JSX.Element;
901
77
 
902
- declare const tokens: {
903
- colors: {
904
- neutral: {
905
- foreground: string;
906
- };
907
- primary: {
908
- background: string;
909
- foreground: string;
910
- inverted: string;
911
- };
912
- negative: {
913
- foreground: string;
914
- };
915
- black: string;
916
- gray100: string;
917
- gray200: string;
918
- gray300: string;
919
- gray400: string;
920
- gray500: string;
921
- gray600: string;
922
- gray700: string;
923
- gray800: string;
924
- gray900: string;
925
- white: string;
926
- blue400: string;
927
- blue500: string;
928
- blue800: string;
929
- blue900: string;
930
- green400: string;
931
- green500: string;
932
- green800: string;
933
- transparent: string;
934
- red500: string;
935
- };
936
- fonts: {
937
- default: string;
938
- };
939
- fontSizes: {
940
- xs: string;
941
- sm: string;
942
- md: string;
943
- lg: string;
944
- xl: string;
945
- '2xl': string;
946
- '3xl': string;
947
- '4xl': string;
948
- '5xl': string;
949
- };
950
- fontWeights: {
951
- regular: number;
952
- semibold: number;
953
- bold: number;
954
- };
955
- letterSpacings: {
956
- md: string;
957
- };
958
- lineHeights: {
959
- xs: string;
960
- sm: string;
961
- md: string;
962
- lg: string;
963
- xl: string;
964
- '2xl': string;
965
- '3xl': string;
966
- '4xl': string;
967
- };
968
- radii: {
969
- md: string;
970
- lg: string;
971
- round: string;
972
- };
973
- shadows: {
974
- md: string;
975
- };
976
- space: {
977
- [k: string]: string;
978
- };
979
- components: {
980
- Button: {
981
- readonly Primary: {
982
- readonly backgroundColor: "primary.background";
983
- readonly color: "primary.foreground";
984
- readonly '&:hover': {
985
- readonly backgroundColor: "blue400";
986
- };
987
- };
988
- readonly Secondary: {
989
- readonly backgroundColor: "white";
990
- readonly border: "1px solid";
991
- readonly borderColor: "gray800";
992
- readonly color: "neutral.foreground";
993
- readonly '&:hover': {
994
- readonly backgroundColor: "blue900";
995
- };
996
- };
997
- readonly Link: {
998
- readonly backgroundColor: "transparent";
999
- readonly color: "primary.inverted";
1000
- };
1001
- readonly Plain: {
1002
- readonly backgroundColor: "transparent";
1003
- readonly color: "neutral.foreground";
1004
- };
1005
- };
1006
- Text: {
1007
- readonly Display1: {
1008
- readonly fontSize: "5xl";
1009
- readonly fontWeight: "bold";
1010
- readonly letterSpacing: "md";
1011
- readonly lineHeight: "4xl";
1012
- };
1013
- readonly Display2: {
1014
- readonly fontSize: "4xl";
1015
- readonly fontWeight: "bold";
1016
- readonly letterSpacing: "md";
1017
- readonly lineHeight: "3xl";
1018
- };
1019
- readonly H1: {
1020
- readonly fontSize: "3xl";
1021
- readonly fontWeight: "bold";
1022
- readonly letterSpacing: "md";
1023
- readonly lineHeight: "2xl";
1024
- };
1025
- readonly H2: {
1026
- readonly fontSize: "2xl";
1027
- readonly fontWeight: "bold";
1028
- readonly letterSpacing: "md";
1029
- readonly lineHeight: "xl";
1030
- };
1031
- readonly H3: {
1032
- readonly fontSize: "xl";
1033
- readonly fontWeight: "bold";
1034
- readonly letterSpacing: "md";
1035
- readonly lineHeight: "lg";
1036
- };
1037
- readonly H4: {
1038
- readonly fontSize: "lg";
1039
- readonly fontWeight: "bold";
1040
- readonly letterSpacing: "md";
1041
- readonly lineHeight: "md";
1042
- };
1043
- readonly Body1: {
1044
- readonly fontSize: "md";
1045
- readonly fontWeight: "regular";
1046
- readonly letterSpacing: "md";
1047
- readonly lineHeight: "md";
1048
- };
1049
- readonly Body2: {
1050
- readonly fontSize: "sm";
1051
- readonly fontWeight: "regular";
1052
- readonly letterSpacing: "md";
1053
- readonly lineHeight: "md";
1054
- };
1055
- readonly Caption: {
1056
- readonly fontSize: "xs";
1057
- readonly fontWeight: "regular";
1058
- readonly letterSpacing: "md";
1059
- readonly lineHeight: "sm";
1060
- };
1061
- };
1062
- };
1063
- };
78
+ interface TourProps extends TooltipProps {
79
+ flowId: string;
80
+ }
81
+ declare function Tour({ flowId, ...props }: TourProps): react_jsx_runtime.JSX.Element;
1064
82
 
1065
- export { Appearance, Box, Button, CheckBox, CustomFormTypeProps, EntityProperties, Flow, FlowResponse, FlowType, FormInputProps, FormInputType, Label as FormLabel, TextField as FormTextField, FormValidationError, FrigadeAnnouncement, FrigadeAnnouncementProps, FrigadeBanner, FrigadeBannerProps, FrigadeChecklist, FrigadeChecklistProps, DefaultAppearance as FrigadeDefaultAppearance, FrigadeEmbeddedTip, FrigadeEmbeddedTipProps, FrigadeForm, FrigadeFormProps, FrigadeGuide, FrigadeHeroChecklist, FrigadeNPSSurvey, FrigadeNPSSurveyProps, FrigadeProgressBadge, FrigadeProgressBadgeProps, FrigadeProvider, FrigadeSupportWidget, BaseTheme as FrigadeTheme, FrigadeTour, FrigadeTourProps, ProgressBar, ProgressRing, PublicStepState, StepContentProps, StepData, Text, tokens, useFlowOpens, useFlowResponses, useFlows, useOrganization, useUser, useUserFlowStates };
83
+ export { Box, BoxProps, Button, ButtonProps, Flex, Provider, ProviderProps, Text, TextProps, Tooltip, TooltipProps, Tour, TourProps };