@opengovsg/confetti 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/build/Button-LiaNjkvk.js +7 -0
- package/build/{Confetti-fis-IO5o.d.ts → Confetti-De4vjrHr.d.ts} +133 -3
- package/build/DefaultConfettiTrigger-DRQBj9sz.js +1 -0
- package/build/Embed-C2iGQW0a.js +1 -0
- package/build/ModalContainer-Du6BhvXW.js +5 -0
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +49 -9
- package/build/components.js +1 -1
- package/build/confetti.css +2 -2
- package/build/{types-NMQZur7D.d.ts → index-CER9nZlw.d.ts} +15 -102
- package/build/index.d.ts +45 -3
- package/build/index.js +1 -1
- package/build/internals-DYTVPK_r.js +1 -0
- package/build/internals.d.ts +2 -2
- package/build/internals.js +1 -1
- package/build/src-BewqzpwC.js +1 -0
- package/build/static.d.ts +1 -2
- package/build/static.js +1 -1
- package/package.json +2 -2
- package/build/Button-uM2fAs2N.js +0 -7
- package/build/DefaultConfettiTrigger-CxIyRNHv.js +0 -1
- package/build/Embed-Db5yO1Sk.js +0 -1
- package/build/ModalContainer-7p9nPFPf.js +0 -5
- package/build/internals-Cn5wlavT.js +0 -1
package/build/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-CbbuRuFl.js";
|
|
2
|
-
import {
|
|
3
|
-
import { _ as useSurvey, a as BaseFieldProps, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-
|
|
2
|
+
import { c as RatingQuestionProperties, d as TextQuestionProperties, l as SingleSelectQuestionProperties, s as MultiSelectQuestionProperties, u as StatementQuestionProperties } from "./index-CER9nZlw.js";
|
|
3
|
+
import { C as ConfettiState, _ as useSurvey, a as BaseFieldProps, b as Answer, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, k as Question, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-De4vjrHr.js";
|
|
4
4
|
import { HTMLAttributes, JSX, PropsWithChildren, SVGProps } from "react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/container/PopoverContainer.d.ts
|
|
@@ -55,12 +55,14 @@ interface SurveyQuestionFactoryProps extends BugReportOptions {
|
|
|
55
55
|
question: Question$1;
|
|
56
56
|
onChange: (answer: Answer) => void;
|
|
57
57
|
error?: string;
|
|
58
|
+
defaultAnswer?: Answer;
|
|
58
59
|
}
|
|
59
60
|
declare const SurveyQuestionFactory: ({
|
|
60
61
|
question,
|
|
61
62
|
onChange,
|
|
62
63
|
error,
|
|
63
|
-
maskAllInputs
|
|
64
|
+
maskAllInputs,
|
|
65
|
+
defaultAnswer
|
|
64
66
|
}: SurveyQuestionFactoryProps) => import("react").JSX.Element;
|
|
65
67
|
//#endregion
|
|
66
68
|
//#region src/components/questions/Rating.d.ts
|
|
@@ -94,7 +96,8 @@ declare const Rating: ({
|
|
|
94
96
|
onChange,
|
|
95
97
|
id,
|
|
96
98
|
error,
|
|
97
|
-
required
|
|
99
|
+
required,
|
|
100
|
+
defaultAnswer
|
|
98
101
|
}: RatingProps) => JSX.Element;
|
|
99
102
|
//#endregion
|
|
100
103
|
//#region src/components/questions/FreeText.d.ts
|
|
@@ -118,7 +121,8 @@ declare const FreeText: ({
|
|
|
118
121
|
onChange,
|
|
119
122
|
classNames,
|
|
120
123
|
required,
|
|
121
|
-
error
|
|
124
|
+
error,
|
|
125
|
+
defaultAnswer
|
|
122
126
|
}: FreeTextProps) => import("react").JSX.Element;
|
|
123
127
|
//#endregion
|
|
124
128
|
//#region src/components/questions/SingleChoice.d.ts
|
|
@@ -148,7 +152,8 @@ declare const SingleChoice: ({
|
|
|
148
152
|
onChange,
|
|
149
153
|
id,
|
|
150
154
|
required,
|
|
151
|
-
error
|
|
155
|
+
error,
|
|
156
|
+
defaultAnswer
|
|
152
157
|
}: SingleChoiceProps) => import("react").JSX.Element;
|
|
153
158
|
//#endregion
|
|
154
159
|
//#region src/components/questions/MultiChoice.d.ts
|
|
@@ -181,7 +186,8 @@ declare const MultiChoice: ({
|
|
|
181
186
|
onChange,
|
|
182
187
|
id,
|
|
183
188
|
required,
|
|
184
|
-
error
|
|
189
|
+
error,
|
|
190
|
+
defaultAnswer
|
|
185
191
|
}: MultiChoiceProps) => import("react").JSX.Element;
|
|
186
192
|
//#endregion
|
|
187
193
|
//#region src/components/questions/Statement.d.ts
|
|
@@ -221,23 +227,57 @@ declare const ThankYouMessage: ({
|
|
|
221
227
|
onClose
|
|
222
228
|
}: ThankYouMessageProps) => import("react").JSX.Element | null;
|
|
223
229
|
//#endregion
|
|
230
|
+
//#region src/components/BackButton.d.ts
|
|
231
|
+
interface BackButtonProps {
|
|
232
|
+
onPress: () => void;
|
|
233
|
+
children?: React.ReactNode;
|
|
234
|
+
}
|
|
235
|
+
declare const BackButton: ({
|
|
236
|
+
onPress,
|
|
237
|
+
children
|
|
238
|
+
}: BackButtonProps) => import("react").JSX.Element | null;
|
|
239
|
+
//#endregion
|
|
224
240
|
//#region src/components/presentation/Flow.d.ts
|
|
225
241
|
type ChildField = (_: {
|
|
226
242
|
onChange: (answer: Answer) => void;
|
|
227
243
|
question: Question$1;
|
|
228
244
|
error?: string;
|
|
245
|
+
defaultAnswer?: Answer;
|
|
229
246
|
}) => React.ReactNode;
|
|
230
247
|
interface FlowProps {
|
|
231
248
|
onSubmit: (answer: Answer) => void;
|
|
232
249
|
children: ChildField;
|
|
233
250
|
question: Question$1;
|
|
234
251
|
isLastQuestion: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Prior answer for this question, seeding the field when it is revisited via
|
|
254
|
+
* back-navigation so the respondent's earlier input is shown.
|
|
255
|
+
*/
|
|
256
|
+
defaultAnswer?: Answer;
|
|
257
|
+
/**
|
|
258
|
+
* Back-navigation control, rendered alongside the submit button so both sit
|
|
259
|
+
* on a single justified row. Its `onPress` is wrapped to flush the
|
|
260
|
+
* in-progress answer via `saveAnswer` first (see below).
|
|
261
|
+
*/
|
|
262
|
+
backButton?: React.ReactNode;
|
|
263
|
+
/**
|
|
264
|
+
* Draft-saves the in-progress answer, keyed by question id. Only `onSubmit`
|
|
265
|
+
* (Next/Submit, or auto-progress) normally commits an answer; a respondent
|
|
266
|
+
* who instead leaves via `backButton` would otherwise lose whatever they
|
|
267
|
+
* typed, since it only lived in this component's local state. Wired to
|
|
268
|
+
* `backButton`'s `onPress` below, and skipped for empty/untouched answers so
|
|
269
|
+
* an unanswered required question is not wrongly marked as attempted.
|
|
270
|
+
*/
|
|
271
|
+
saveAnswer?: (answer: Answer) => void;
|
|
235
272
|
}
|
|
236
273
|
declare const Flow: ({
|
|
237
274
|
onSubmit,
|
|
238
275
|
children,
|
|
239
276
|
question,
|
|
240
|
-
isLastQuestion
|
|
277
|
+
isLastQuestion,
|
|
278
|
+
defaultAnswer,
|
|
279
|
+
backButton,
|
|
280
|
+
saveAnswer
|
|
241
281
|
}: FlowProps) => import("react").JSX.Element;
|
|
242
282
|
//#endregion
|
|
243
283
|
//#region src/components/presentation/Embed.d.ts
|
|
@@ -279,4 +319,4 @@ declare const DefaultConfettiTrigger: ({
|
|
|
279
319
|
label
|
|
280
320
|
}: DefaultConfettiTriggerProps) => import("react").JSX.Element | null;
|
|
281
321
|
//#endregion
|
|
282
|
-
export { type Answer, type BaseConfettiProps, CloseButton, Confetti, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, ConfettiTriggerIcon, DefaultConfettiTrigger, type DefaultConfettiTriggerProps, Embed, type EmbedProps, Flow, type FlowProps, FreeText, type FreeTextProps, ModalContainer, type ModalContainerProps, MultiChoice, type MultiChoiceProps, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, RespondentVisibilityContext, RespondentVisibilityProvider, type RespondentVisibilityProviderProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, SurveyContext, SurveyProvider, type SurveyProviderProps, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useRespondentVisibility, useSurvey };
|
|
322
|
+
export { type Answer, BackButton, type BaseConfettiProps, CloseButton, Confetti, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, ConfettiTriggerIcon, DefaultConfettiTrigger, type DefaultConfettiTriggerProps, Embed, type EmbedProps, Flow, type FlowProps, FreeText, type FreeTextProps, ModalContainer, type ModalContainerProps, MultiChoice, type MultiChoiceProps, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, RespondentVisibilityContext, RespondentVisibilityProvider, type RespondentVisibilityProviderProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, SurveyContext, SurveyProvider, type SurveyProviderProps, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useRespondentVisibility, useSurvey };
|
package/build/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./DefaultConfettiTrigger-
|
|
1
|
+
import{n as e,t}from"./DefaultConfettiTrigger-DRQBj9sz.js";import{a as n,o as r,r as i,s as a,t as o}from"./ModalContainer-Du6BhvXW.js";import{a as s,c,d as l,f as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./Embed-C2iGQW0a.js";import{ErrorBoundary as S}from"react-error-boundary";import{Fragment as C,jsx as w}from"react/jsx-runtime";const T=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=m();return w(r,{...i,respondent:a,children:e})},E=({children:e,...t})=>w(_,{...t,children:w(T,{...t,children:e})}),D=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>w(S,{fallback:w(C,{}),children:w(E,{...r,children:w(d,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{v as BackButton,i as CloseButton,D as Confetti,d as ConfettiController,E as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,b as Embed,h as Flow,x as FreeText,o as ModalContainer,p as MultiChoice,l as PopoverContainer,c as Rating,u as RespondentVisibilityContext,_ as RespondentVisibilityProvider,y as SingleChoice,g as Statement,n as SurveyContext,r as SurveyProvider,s as SurveyQuestionFactory,f as ThankYouMessage,m as useRespondentVisibility,a as useSurvey};
|
package/build/confetti.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
:root{--confetti-font-scale: 16px;--confetti-box-padding: 24px;--confetti-max-width: 300px;--confetti-z-index: 2147483647;--confetti-border-color: #e4e4e7;--confetti-border-bottom: 1.5px solid var(--confetti-border-color);--confetti-border-radius: 12px;--confetti-input-border-radius: 8px;--confetti-choice-border-radius: max(
|
|
1
|
+
:root{--confetti-font-scale: 16px;--confetti-box-padding: 24px;--confetti-button-row-gap: 16px;--confetti-max-width: 300px;--confetti-z-index: 2147483647;--confetti-border-color: #e4e4e7;--confetti-border-bottom: 1.5px solid var(--confetti-border-color);--confetti-border-radius: 12px;--confetti-input-border-radius: 8px;--confetti-choice-border-radius: max(
|
|
2
2
|
var(--confetti-input-border-radius) - 2px,
|
|
3
3
|
0px
|
|
4
4
|
);--confetti-tag-border-radius: var(--confetti-input-border-radius);--confetti-background-color: #ffffff;--confetti-box-shadow:
|
|
5
5
|
0 4px 6px -4px rgba(16, 24, 40, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);--confetti-focus-shadow: 0 0 0 2px rgba(9, 9, 11, 0.3);--confetti-submit-button-color: #18181b;--confetti-submit-button-text-color: #fafafa;--confetti-rating-bg-color: white;--confetti-rating-text-color: #09090b;--confetti-rating-active-bg-color: #09090b;--confetti-rating-active-text-color: white;--confetti-indicator-active-bg-color: var(--confetti-rating-active-bg-color);--confetti-indicator-active-dot-color: var(
|
|
6
6
|
--confetti-rating-active-text-color
|
|
7
|
-
);--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-submit-button{align-self:end;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
|
|
7
|
+
);--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-button-row{display:flex;align-items:center;justify-content:space-between;gap:var(--confetti-button-row-gap)}.confetti .cf-submit-button{margin-left:auto;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-back-button{color:var(--confetti-text-primary-color);background:transparent;border:none;padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-back-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-back-button:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
|
|
8
8
|
--confetti-bug-report-record-button-active-color
|
|
9
9
|
);}.confetti .cf-rating-section{display:flex;flex-direction:column;gap:4px}.confetti .cf-rating-emoji{opacity:0.5}.confetti .cf-rating-display-star,.confetti .cf-rating-display-emoji{display:grid;grid-template-columns:repeat(auto-fit, 40px);justify-content:space-between;grid-gap:8px;gap:8px}.confetti .cf-rating-display-star .cf-rating-emoji,.confetti .cf-rating-display-emoji .cf-rating-emoji,.confetti .cf-rating-display-star .cf-rating-star,.confetti .cf-rating-display-emoji .cf-rating-star{font-size:1em;background-color:transparent;border:none;padding:0;transition:transform 0.15s ease-out;color:var(--confetti-rating-active-bg-color)}.confetti .cf-rating-display-star .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-star .cf-rating-star[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-rating-display-star .cf-rating-emoji:hover,.confetti .cf-rating-display-emoji .cf-rating-emoji:hover,.confetti .cf-rating-display-star .cf-rating-star:hover,.confetti .cf-rating-display-emoji .cf-rating-star:hover{cursor:pointer;-ms-transform:scale(1.15);transform:scale(1.15);opacity:1!important}.confetti .cf-rating-display-star .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-star .cf-rating-star[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-filled='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-selected='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji svg,.confetti .cf-rating-display-emoji .cf-rating-emoji svg,.confetti .cf-rating-display-star .cf-rating-star svg,.confetti .cf-rating-display-emoji .cf-rating-star svg{transition:fill 0.15s ease-out}.confetti .cf-rating-text{display:flex;justify-content:space-between;font-size:0.75em;color:var(--confetti-text-subtle-color);font-weight:500;line-height:1}.confetti .cf-rating-text .cf-rating-text-lower{flex:1;text-align:left}.confetti .cf-rating-text .cf-rating-text-upper{flex:1;text-align:right}.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'] ~ .cf-rating-star{opacity:0.5}.confetti .cf-rating-display-number{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden}.confetti .cf-rating-display-number .cf-rating-number{border-right:1px solid var(--confetti-border-color);text-align:center;cursor:pointer;color:var(--confetti-rating-text-color);border-left:none;border-top:none;border-bottom:none;font-weight:700;padding:8px 0;margin-top:-1px;margin-bottom:-1px}.confetti .cf-rating-display-number .cf-rating-number:first-of-type{border-top-left-radius:8px;border-bottom-left-radius:8px}.confetti .cf-rating-display-number .cf-rating-number:last-of-type{border-top-right-radius:8px;border-bottom-right-radius:8px;border-right:0}.confetti .cf-rating-display-number .cf-rating-number[data-focus-visible='true']{box-shadow:inset 0 0 0 1px var(--confetti-outline-color)}.confetti .cf-rating-display-number .cf-rating-number[data-selected='true']{background:var(--confetti-rating-active-bg-color);color:var(--confetti-rating-active-text-color)}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
|
|
4
3
|
//#region ../validators/dist/questions/routing.d.ts
|
|
@@ -46,6 +45,7 @@ declare const singleSelectQuestionPropertiesSchema: z.ZodObject<{
|
|
|
46
45
|
options: z.ZodArray<z.ZodObject<{
|
|
47
46
|
value: z.ZodString;
|
|
48
47
|
description: z.ZodOptional<z.ZodString>;
|
|
48
|
+
translationId: z.ZodOptional<z.ZodCUID2>;
|
|
49
49
|
}, z.core.$strip>>;
|
|
50
50
|
buttonLabel: z.ZodOptional<z.ZodString>;
|
|
51
51
|
editable: z.ZodNullable<z.ZodObject<{
|
|
@@ -61,6 +61,7 @@ declare const multiSelectQuestionPropertiesSchema: z.ZodObject<{
|
|
|
61
61
|
options: z.ZodArray<z.ZodObject<{
|
|
62
62
|
value: z.ZodString;
|
|
63
63
|
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
translationId: z.ZodOptional<z.ZodCUID2>;
|
|
64
65
|
}, z.core.$strip>>;
|
|
65
66
|
editable: z.ZodNullable<z.ZodObject<{
|
|
66
67
|
label: z.ZodString;
|
|
@@ -130,6 +131,14 @@ declare const multiSelectAnswerSchemaFactory: ({
|
|
|
130
131
|
}) => z.ZodArray<z.ZodString>;
|
|
131
132
|
type MultiSelectAnswer = z.infer<ReturnType<typeof multiSelectAnswerSchemaFactory>>;
|
|
132
133
|
//#endregion
|
|
134
|
+
//#region ../validators/dist/questions/reachability.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Answer shape the routing engine can evaluate. Mirrors the widget's `Answer`
|
|
137
|
+
* union. Condition evaluation only meaningfully inspects string / number /
|
|
138
|
+
* string[] answers; any other shape never satisfies a condition.
|
|
139
|
+
*/
|
|
140
|
+
type RoutableAnswer = BugReportAnswer | RatingAnswer | MultiSelectAnswer | SingleSelectAnswer;
|
|
141
|
+
//#endregion
|
|
133
142
|
//#region ../validators/dist/survey.d.ts
|
|
134
143
|
declare const publicGetSurveyOutputSchema: z.ZodObject<{
|
|
135
144
|
title: z.ZodString;
|
|
@@ -156,6 +165,7 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
|
|
|
156
165
|
options: z.ZodArray<z.ZodObject<{
|
|
157
166
|
value: z.ZodString;
|
|
158
167
|
description: z.ZodOptional<z.ZodString>;
|
|
168
|
+
translationId: z.ZodOptional<z.ZodCUID2>;
|
|
159
169
|
}, z.core.$strip>>;
|
|
160
170
|
buttonLabel: z.ZodOptional<z.ZodString>;
|
|
161
171
|
editable: z.ZodNullable<z.ZodObject<{
|
|
@@ -174,6 +184,7 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
|
|
|
174
184
|
options: z.ZodArray<z.ZodObject<{
|
|
175
185
|
value: z.ZodString;
|
|
176
186
|
description: z.ZodOptional<z.ZodString>;
|
|
187
|
+
translationId: z.ZodOptional<z.ZodCUID2>;
|
|
177
188
|
}, z.core.$strip>>;
|
|
178
189
|
editable: z.ZodNullable<z.ZodObject<{
|
|
179
190
|
label: z.ZodString;
|
|
@@ -239,107 +250,9 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
|
|
|
239
250
|
description: z.ZodString;
|
|
240
251
|
buttonText: z.ZodString;
|
|
241
252
|
}, z.core.$strip>;
|
|
253
|
+
isBackNavigationAllowed: z.ZodBoolean;
|
|
254
|
+
backButtonLabel: z.ZodNullable<z.ZodString>;
|
|
242
255
|
}, z.core.$strip>;
|
|
243
256
|
type PublicGetSurveyOutput = z.infer<typeof publicGetSurveyOutputSchema>;
|
|
244
257
|
//#endregion
|
|
245
|
-
|
|
246
|
-
type Question = {
|
|
247
|
-
visible: boolean;
|
|
248
|
-
error?: string;
|
|
249
|
-
} & PublicGetSurveyOutput['questions'][number];
|
|
250
|
-
type Answer = BugReportAnswer | RatingAnswer | MultiSelectAnswer | SingleSelectAnswer;
|
|
251
|
-
interface ConfettiState {
|
|
252
|
-
questions: Question[];
|
|
253
|
-
current: number;
|
|
254
|
-
update: ({
|
|
255
|
-
question,
|
|
256
|
-
answer
|
|
257
|
-
}: {
|
|
258
|
-
question: number;
|
|
259
|
-
answer: Answer;
|
|
260
|
-
}) => {
|
|
261
|
-
next?: number;
|
|
262
|
-
error?: string;
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
* Submits the survey, or, when a visible question is unanswered or invalid,
|
|
266
|
-
* refuses and reveals the blocking errors through `errors`. Render an
|
|
267
|
-
* always-enabled submit control and let this decide.
|
|
268
|
-
*
|
|
269
|
-
* Returns whether the submission was accepted. Anything that should only
|
|
270
|
-
* happen on a real submission — navigation, analytics — must be gated on
|
|
271
|
-
* this rather than assuming the press went through.
|
|
272
|
-
*/
|
|
273
|
-
submit: () => boolean;
|
|
274
|
-
isSubmitted: boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Blocking errors keyed by question id. Empty until the first submit
|
|
277
|
-
* attempt, then updated live as answers change.
|
|
278
|
-
*/
|
|
279
|
-
errors: Record<Question['id'], string>;
|
|
280
|
-
}
|
|
281
|
-
interface Proxyable {
|
|
282
|
-
/**
|
|
283
|
-
* Origin of the proxy that forwards Confetti API requests. The hosted
|
|
284
|
-
* templates also load the widget bundle and stylesheet from it.
|
|
285
|
-
*/
|
|
286
|
-
proxyUrl?: string;
|
|
287
|
-
}
|
|
288
|
-
type WithProxyable<T> = Omit<T, 'apiBaseUrl'> & Proxyable;
|
|
289
|
-
interface Finishable {
|
|
290
|
-
/**
|
|
291
|
-
* Callback is invoked after the survey response is submitted and the
|
|
292
|
-
* submission network call settles.
|
|
293
|
-
*/
|
|
294
|
-
onFinished?: () => void;
|
|
295
|
-
}
|
|
296
|
-
interface Closable {
|
|
297
|
-
/**
|
|
298
|
-
* Callback is invoked whenever the survey closes, regardless of how it was closed.
|
|
299
|
-
*/
|
|
300
|
-
onClose?: () => void;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Wraps the rendered survey in a consumer-provided container. Receives an
|
|
304
|
-
* object holding the survey node and returns the wrapped tree. The object
|
|
305
|
-
* shape leaves room to pass extra render data in the future.
|
|
306
|
-
*/
|
|
307
|
-
type ConfettiContainer = (props: {
|
|
308
|
-
survey: ReactNode;
|
|
309
|
-
}) => ReactNode;
|
|
310
|
-
interface Containable {
|
|
311
|
-
/**
|
|
312
|
-
* Wraps the rendered survey in a consumer-provided container for theming.
|
|
313
|
-
* Only invoked once the survey passes its visibility gates, so the container
|
|
314
|
-
* never renders while the survey is hidden, and unmounts when the survey
|
|
315
|
-
* closes.
|
|
316
|
-
*
|
|
317
|
-
* Prefer an inline function. To carry state or animation, render your own
|
|
318
|
-
* component inside it: `container={({ survey }) => <BrandShell>{survey}</BrandShell>}`.
|
|
319
|
-
*/
|
|
320
|
-
container?: ConfettiContainer;
|
|
321
|
-
}
|
|
322
|
-
interface Dismissable extends Closable {
|
|
323
|
-
/**
|
|
324
|
-
* The widget will automatically close this many milliseconds
|
|
325
|
-
* after the survey is finished.
|
|
326
|
-
* Set to `null` to disable automatic closing.
|
|
327
|
-
* @default 3000
|
|
328
|
-
*/
|
|
329
|
-
closeOnFinishMs?: number | null;
|
|
330
|
-
/**
|
|
331
|
-
* Callback is invoked when the user dismisses the survey before submitting.
|
|
332
|
-
* Closing after submission is not a dismissal and does not invoke this.
|
|
333
|
-
*/
|
|
334
|
-
onDismiss?: () => void;
|
|
335
|
-
}
|
|
336
|
-
interface OptionallyDismissable extends Dismissable {
|
|
337
|
-
/**
|
|
338
|
-
* Allows the user to dismiss the modal via the close button and the
|
|
339
|
-
* overlay.
|
|
340
|
-
* @default true
|
|
341
|
-
*/
|
|
342
|
-
isDismissable?: boolean;
|
|
343
|
-
}
|
|
344
|
-
//#endregion
|
|
345
|
-
export { TextQuestionProperties as _, Containable as a, OptionallyDismissable as c, WithProxyable as d, PublicGetSurveyOutput as f, StatementQuestionProperties as g, SingleSelectQuestionProperties as h, ConfettiState as i, Proxyable as l, RatingQuestionProperties as m, Closable as n, Dismissable as o, MultiSelectQuestionProperties as p, ConfettiContainer as r, Finishable as s, Answer as t, Question as u, BinaryOperatorCondition as v };
|
|
258
|
+
export { RatingAnswer as a, RatingQuestionProperties as c, TextQuestionProperties as d, BinaryOperatorCondition as f, MultiSelectAnswer as i, SingleSelectQuestionProperties as l, RoutableAnswer as n, SingleSelectAnswer as o, BugReportAnswer as r, MultiSelectQuestionProperties as s, PublicGetSurveyOutput as t, StatementQuestionProperties as u };
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as BaseConfettiProps } from "./Confetti-fis-IO5o.js";
|
|
1
|
+
import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-De4vjrHr.js";
|
|
3
2
|
|
|
4
3
|
//#region src/contracts/api.d.ts
|
|
5
4
|
type Template = 'TriggerPopover' | 'Popover' | 'Modal' | 'Embedded' | 'Stepper';
|
|
@@ -104,6 +103,49 @@ interface TriggerPopoverConfettiProps extends Omit<BaseConfettiProps, 'apiBaseUr
|
|
|
104
103
|
}
|
|
105
104
|
declare function TriggerPopoverConfetti(props: TriggerPopoverConfettiProps): import("react").JSX.Element | null;
|
|
106
105
|
//#endregion
|
|
106
|
+
//#region src/hooks/useRespondentState.d.ts
|
|
107
|
+
interface UseRespondentStateOptions {
|
|
108
|
+
/** Identifier of the published survey to load. */
|
|
109
|
+
surveyId: string;
|
|
110
|
+
/** Publishable API key that authorises read access to the survey. */
|
|
111
|
+
publishableKey: string;
|
|
112
|
+
/**
|
|
113
|
+
* Identifies who the survey is shown to and tracked against. Required —
|
|
114
|
+
* unlike drop-in templates, this hook does not generate an anonymous
|
|
115
|
+
* respondent id. Pass a stable non-empty user identifier to target a
|
|
116
|
+
* person, an event identifier on its own to target an event, or a
|
|
117
|
+
* composite such as `{User ID}-{Event ID}` to target a person for a
|
|
118
|
+
* specific event. An empty string returns `null`.
|
|
119
|
+
*/
|
|
120
|
+
respondent: string;
|
|
121
|
+
/**
|
|
122
|
+
* Origin that serves the proxied Confetti API. Omit it to use the default
|
|
123
|
+
* Confetti origin.
|
|
124
|
+
*/
|
|
125
|
+
proxyUrl?: string;
|
|
126
|
+
}
|
|
127
|
+
type UseRespondentStateResult = {
|
|
128
|
+
lastRespondedAt: Date | null;
|
|
129
|
+
lastDismissedAt: Date | null;
|
|
130
|
+
} | null | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Fetches the respondent's response and dismissal timestamps for a survey.
|
|
133
|
+
*
|
|
134
|
+
* Returns `undefined` until the availability probe and respondent-state fetch
|
|
135
|
+
* have both settled. Returns `null` when `respondent` is empty, or when the
|
|
136
|
+
* survey is not available. Otherwise returns `{ lastRespondedAt,
|
|
137
|
+
* lastDismissedAt }` as fresh `Date` values (or `null`).
|
|
138
|
+
*
|
|
139
|
+
* Fetch or parse failures on the respondent endpoint are treated as empty
|
|
140
|
+
* history (`null` timestamps), matching the drop-in templates.
|
|
141
|
+
*/
|
|
142
|
+
declare function useRespondentState({
|
|
143
|
+
surveyId,
|
|
144
|
+
publishableKey,
|
|
145
|
+
respondent,
|
|
146
|
+
proxyUrl
|
|
147
|
+
}: UseRespondentStateOptions): UseRespondentStateResult;
|
|
148
|
+
//#endregion
|
|
107
149
|
//#region src/hooks/useVisibleAfterDelay.d.ts
|
|
108
150
|
interface UseVisibleAfterDelayOptions {
|
|
109
151
|
delay: number;
|
|
@@ -144,4 +186,4 @@ declare const useVisibleAfterScroll: ({
|
|
|
144
186
|
isVisible: boolean;
|
|
145
187
|
};
|
|
146
188
|
//#endregion
|
|
147
|
-
export { type ConfettiContainer, EmbeddedConfetti, type EmbeddedConfettiProps, ModalConfetti, type ModalConfettiProps, PopoverConfetti, type PopoverConfettiProps, StepperConfetti, type StepperConfettiProps, TriggerPopoverConfetti, type TriggerPopoverConfettiProps, type TriggerRenderProps, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };
|
|
189
|
+
export { type ConfettiContainer, EmbeddedConfetti, type EmbeddedConfettiProps, ModalConfetti, type ModalConfettiProps, PopoverConfetti, type PopoverConfettiProps, StepperConfetti, type StepperConfettiProps, TriggerPopoverConfetti, type TriggerPopoverConfettiProps, type TriggerRenderProps, type UseRespondentStateOptions, type UseRespondentStateResult, useRespondentState, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,r,t as i}from"./DefaultConfettiTrigger-CxIyRNHv.js";import{nt as a}from"./Button-uM2fAs2N.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useLocalStorage as f,useSessionStorage as p}from"usehooks-ts";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=`confetti:ready`,v=`https://confetti.gov.sg`,y={promise:null,channel:null,url:null};function b(){y.promise=null,y.channel=null,y.url=null}function x(){y.promise=null}function S(e){return new URL(``,e).href}function C(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function w(e=`stable`,t=v){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(y.promise)return y.channel===e?y.url===n?y.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(y.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(y.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?y.url!==null&&y.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${y.url} to ${n} on the same page`)):k(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=E(n,e);return y.channel=e,y.url=n,y.promise=i,i}function T(e=`stable`,t=v){if(typeof window>`u`)return Promise.resolve();let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return D(n,e)}async function E(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([D(e,t),O(e,t)])]);return clearTimeout(r),x(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),b(),e}}function D(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=C(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function O(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}k(e).then(n,r)};if(window.addEventListener(_,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=C(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(_,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function k(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function A(e){let t=l(null),n=l(null),r=l(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,s(()=>{if(!e.element)return;let o=!1;return w(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),s(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function j(e){let[t,n]=u(null);return A({...e,element:t}),h(d,{fallback:h(m,{}),children:h(`div`,{ref:n,"data-confetti-mount":!0})})}function M(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.1`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Embedded`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function N(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.1`},closeOnFinishMs:i.closeOnFinishMs,isDismissable:i.isDismissable,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.isDismissable,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Modal`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function P(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.1`},closeOnFinishMs:i.closeOnFinishMs,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Popover`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function F(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.1`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Stepper`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function I(f){let p=e({surveyId:f.surveyId,override:f.respondent}),_=a({publishableKey:f.publishableKey,apiBaseUrl:f.proxyUrl}),{isAvailable:v,isSettled:y}=r({client:_,surveyId:f.surveyId}),{state:b,isSettled:x}=t({client:_,surveyId:f.surveyId,respondent:p}),[S,C]=u(!1),w=y&&v&&x&&S&&n(b,f.isSurveyVisible),[E,D]=u(!1),[O,k]=u(!1),{onError:A,channel:M,proxyUrl:N}=f,P=l(A);s(()=>{P.current=A},[A]),s(()=>{if(!(y&&v))return;let e=!1;return T(M,N).then(()=>{e||C(!0)}).catch(e=>P.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[y,v,M,N]);let F=w&&E,I=o(()=>D(!0),[]),L=f.onFinished,R=c(()=>({surveyId:f.surveyId,publishableKey:f.publishableKey,respondent:p,metadata:f.metadata,apiBaseUrl:f.proxyUrl,telemetry:{version:`0.6.1`},isOpen:E,onFinished:()=>{k(!0),L?.()},onClose:()=>{D(!1)},onDismiss:()=>{D(!1)},options:f.options}),[f.surveyId,f.publishableKey,p,f.metadata,f.proxyUrl,f.options,E,L]);return w?g(d,{fallback:h(m,{}),children:[f.trigger?f.trigger({onClick:I,isOpen:E,isSubmitted:O}):h(i,{onClick:I,isWidgetOpen:E}),F?h(j,{template:`TriggerPopover`,channel:f.channel,scriptBaseUrl:f.proxyUrl,onError:f.onError,props:R}):null]}):null}const L=({delay:e})=>{let[t,n]=u(!1),r=c(()=>e,[]);return s(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},R=({visits:e,respondent:t})=>{let[n,r]=f(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},z=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},B=({threshold:e})=>{let[t,n]=u(()=>typeof window>`u`?!1:window.scrollY>=e);return s(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{M as EmbeddedConfetti,N as ModalConfetti,P as PopoverConfetti,F as StepperConfetti,I as TriggerPopoverConfetti,L as useVisibleAfterDelay,R as useVisibleAfterPageVisits,B as useVisibleAfterScroll,z as useVisibleAfterSessionPageVisits};
|
|
1
|
+
import{a as e,i as t,o as n,r,t as i}from"./DefaultConfettiTrigger-DRQBj9sz.js";import{G as a}from"./Button-LiaNjkvk.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useLocalStorage as f,useSessionStorage as p}from"usehooks-ts";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=`confetti:ready`,v=`https://confetti.gov.sg`,y={promise:null,channel:null,url:null};function b(){y.promise=null,y.channel=null,y.url=null}function x(){y.promise=null}function S(e){return new URL(``,e).href}function C(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function w(e=`stable`,t=v){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(y.promise)return y.channel===e?y.url===n?y.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(y.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(y.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?y.url!==null&&y.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${y.url} to ${n} on the same page`)):k(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=E(n,e);return y.channel=e,y.url=n,y.promise=i,i}function T(e=`stable`,t=v){if(typeof window>`u`)return Promise.resolve();let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return D(n,e)}async function E(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([D(e,t),O(e,t)])]);return clearTimeout(r),x(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),b(),e}}function D(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=C(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function O(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}k(e).then(n,r)};if(window.addEventListener(_,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=C(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(_,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function k(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function A(e){let t=l(null),n=l(null),r=l(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,s(()=>{if(!e.element)return;let o=!1;return w(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),s(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function j(e){let[t,n]=u(null);return A({...e,element:t}),h(d,{fallback:h(m,{}),children:h(`div`,{ref:n,"data-confetti-mount":!0})})}function M(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.1`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Embedded`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function N(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.1`},closeOnFinishMs:i.closeOnFinishMs,isDismissable:i.isDismissable,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.isDismissable,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Modal`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function P(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.1`},closeOnFinishMs:i.closeOnFinishMs,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Popover`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function F(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.1`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Stepper`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function I(f){let p=e({surveyId:f.surveyId,override:f.respondent}),_=a({publishableKey:f.publishableKey,apiBaseUrl:f.proxyUrl}),{isAvailable:v,isSettled:y}=r({client:_,surveyId:f.surveyId}),{state:b,isSettled:x}=t({client:_,surveyId:f.surveyId,respondent:p}),[S,C]=u(!1),w=y&&v&&x&&S&&n(b,f.isSurveyVisible),[E,D]=u(!1),[O,k]=u(!1),{onError:A,channel:M,proxyUrl:N}=f,P=l(A);s(()=>{P.current=A},[A]),s(()=>{if(!(y&&v))return;let e=!1;return T(M,N).then(()=>{e||C(!0)}).catch(e=>P.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[y,v,M,N]);let F=w&&E,I=o(()=>D(!0),[]),L=f.onFinished,R=c(()=>({surveyId:f.surveyId,publishableKey:f.publishableKey,respondent:p,metadata:f.metadata,apiBaseUrl:f.proxyUrl,telemetry:{version:`0.7.1`},isOpen:E,onFinished:()=>{k(!0),L?.()},onClose:()=>{D(!1)},onDismiss:()=>{D(!1)},options:f.options}),[f.surveyId,f.publishableKey,p,f.metadata,f.proxyUrl,f.options,E,L]);return w?g(d,{fallback:h(m,{}),children:[f.trigger?f.trigger({onClick:I,isOpen:E,isSubmitted:O}):h(i,{onClick:I,isWidgetOpen:E}),F?h(j,{template:`TriggerPopover`,channel:f.channel,scriptBaseUrl:f.proxyUrl,onError:f.onError,props:R}):null]}):null}function L({surveyId:e,publishableKey:n,respondent:i,proxyUrl:o}){let s=a({publishableKey:n,apiBaseUrl:o}),{isAvailable:c,isSettled:l}=r({client:s,surveyId:e}),{state:u,isSettled:d}=t({client:s,surveyId:e,respondent:i});if(!i)return null;if(!(!l||!d))return c?{lastRespondedAt:u.lastRespondedAt?new Date(u.lastRespondedAt):null,lastDismissedAt:u.lastDismissedAt?new Date(u.lastDismissedAt):null}:null}const R=({delay:e})=>{let[t,n]=u(!1),r=c(()=>e,[]);return s(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},z=({visits:e,respondent:t})=>{let[n,r]=f(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},B=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},V=({threshold:e})=>{let[t,n]=u(()=>typeof window>`u`?!1:window.scrollY>=e);return s(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{M as EmbeddedConfetti,N as ModalConfetti,P as PopoverConfetti,F as StepperConfetti,I as TriggerPopoverConfetti,L as useRespondentState,R as useVisibleAfterDelay,z as useVisibleAfterPageVisits,V as useVisibleAfterScroll,B as useVisibleAfterSessionPageVisits};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-BewqzpwC.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=({position:e,question:t,answer:i})=>{let a=t.routingLogic;if(a.type===`always`)return r({position:e,value:a.target});if(i==null&&t.required)return null;let o=i==null?void 0:a.cases.find(e=>n({answer:i,condition:e}));return r(o?{position:e,value:o.target}:{position:e,value:a.default})},a=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),a=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){a.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!a.has(s.id))&&i({position:o,question:s,answer:t[s.id]})===e){a.add(n.id);break}}}}return a},o=n,s=`cfti-mask`,c=`cfti-block`,l=`__confetti_bug_report_recording_event`,u=e.object({detail:e.object({isRecording:e.boolean()})});export{o as a,u as i,s as n,a as o,l as r,c as t};
|
package/build/internals.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as BinaryOperatorCondition, n as RoutableAnswer } from "./index-CER9nZlw.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/core/logic/routing.d.ts
|
|
@@ -6,7 +6,7 @@ declare const evaluateCondition: ({
|
|
|
6
6
|
answer,
|
|
7
7
|
condition
|
|
8
8
|
}: {
|
|
9
|
-
answer:
|
|
9
|
+
answer: RoutableAnswer;
|
|
10
10
|
condition: BinaryOperatorCondition;
|
|
11
11
|
}) => boolean;
|
|
12
12
|
//#endregion
|
package/build/internals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"./internals-
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"./internals-DYTVPK_r.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),ee=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),a=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:ee,target:i}),o=e.object({type:e.literal(`switch`),cases:e.array(a),default:i}),s=e.object({type:e.literal(`always`),target:i}),c=e.discriminatedUnion(`type`,[s,o]),l=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),u=e.optional(e.string().check(e.trim(),e.maxLength(50))),d=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),f=e.array(d).check(e.superRefine((e,t)=>{let n=new Set;for(let r of e)if(r.translationId!==void 0){if(n.has(r.translationId)){t.addIssue({code:`custom`,message:`Option translation ids must be unique within a question`});return}n.add(r.translationId)}})),p=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),m=e.optional(e.boolean()),h=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:m,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),g=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),te=e.object({type:e.literal(`single-select`),shouldAutoProgress:m,options:f,buttonLabel:u,editable:p}),ne=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:f,editable:p,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),re=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),ie=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),ae=e.discriminatedUnion(`type`,[h,te,g,ne,re,ie]),_=e.object({label:e.optional(e.string()),description:e.optional(e.string())}),v=e.object({type:e.literal(`rating`),buttonLabel:u,labels:e.optional(e.object({lower:e.optional(e.string()),upper:e.optional(e.string())}))}),y=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u}),b=e.object({type:e.literal(`single-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),x=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:e.optional(e.record(e.string(),_))}),S=e.object({type:e.literal(`statement`),buttonLabel:u}),C=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,detailsLabel:e.optional(e.string()),detailsPlaceholder:e.optional(e.string())}),w=e.discriminatedUnion(`type`,[v,y,b,x,S,C]),T=`__CONFETTI_CHECKBOX_Others`,E=`__CONFETTI_RADIO_Others`,D=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.optional(e.string())}).partial().catchall(e.optional(e.string())));e.cuid2();const O=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(O);const k=e.array(O),A=e.string().check(e.refine(e=>{try{return k.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),j=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),M=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(j),recordingEventsJson:e.optional(A),metadata:D}),N=M(!0),P=(e,{required:t})=>M(t),F=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),I=({scale:t},{required:n})=>{let r=F(t);return n?r:e.optional(r)},L=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),oe=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==E,{error:`Please fill out the free text field`})),R=({maxLength:t},{required:n})=>{let r=oe(t,n);return n?r:e.optional(r)},z=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==T,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),B=()=>e.optional(e.string()),V=e.enum([`en`,`zh`,`ms`,`ta`]),H=e.cuid2(),U=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),W=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:ae,routingLogic:c}),G=e.object({title:e.optional(e.string()),description:e.optional(e.string()),confirmation:e.optional(e.object({title:e.optional(e.string()),description:e.optional(e.string()),buttonText:e.optional(e.string())}))});e.partialRecord(V,G);const K=e.object({title:e.optional(e.string()),description:e.optional(e.string()),properties:e.optional(w)});e.partialRecord(V,K);const q=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(W),confirmation:U,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const J=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(J),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:H});const se=W;e.object({data:e.object({...J.shape,questions:e.array(se)})}),e.object({surveyId:H,responseId:e.union([e.cuid2(),e.uuid()])});const ce=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),Y=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),N])),X=e.string().check(e.trim(),e.maxLength(1e3)),Z=e.record(X,X).check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:Y,metadata:Z,telemetry:e.optional(ce)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:H,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:H,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:H});const le=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:H}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const ue=e.object({id:e.string(),respondent:e.string(),data:Y,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(ue),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Q=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Q,uniqueViewers:Q,totalDismissals:Q,uniqueDismissers:Q,totalResponses:Q,uniqueResponders:Q})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const $=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:$,previousQuarter:e.nullable($)})});export{L as a,B as c,l as d,z as i,T as l,q as n,I as o,P as r,R as s,le as t,E as u};
|
package/build/static.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps } from "./Confetti-fis-IO5o.js";
|
|
1
|
+
import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-De4vjrHr.js";
|
|
3
2
|
|
|
4
3
|
//#region src/templates/EmbeddedConfettiContent.d.ts
|
|
5
4
|
interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
|
package/build/static.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./DefaultConfettiTrigger-
|
|
1
|
+
import{t as e}from"./DefaultConfettiTrigger-DRQBj9sz.js";import{c as t,o as n,t as r}from"./ModalContainer-Du6BhvXW.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-C2iGQW0a.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,...r})=>g(m,{fallback:g(h,{}),children:g(t,{type:`embedded`,children:g(n,{...r,children:g(o,{...r,shouldAutoSubmit:!1,children:({questions:t,update:n,submit:a,isSubmitted:o,errors:c})=>o?g(s,{onClose:e}):g(f,{onSubmit:a,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,error:c[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:t=>n({question:e.position,answer:t})},e.position))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,...d})=>g(m,{fallback:g(h,{}),children:g(t,{type:`modal`,children:g(n,{...d,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...d,shouldAutoSubmit:!1,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o})=>o?g(s,{onClose:a}):g(f,{onSubmit:r,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,error:n[e.id]||``,maskAllInputs:d.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,...f})=>g(m,{fallback:g(h,{}),children:g(t,{type:`popover`,children:g(n,{...f,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...f,shouldAutoSubmit:!0,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:p,isSubmitted:m})=>{let _=e===t.length-1;if(m)return g(s,{onClose:r});let v=t[e];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:n[v.id]??void 0,backButton:c?g(d,{onPress:o,children:u}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:f.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,...t})=>g(m,{fallback:g(h,{}),children:g(n,{...t,children:g(o,{...t,shouldAutoSubmit:!0,children:({current:n,questions:r,answers:a,update:o,back:c,canGoBack:u,backButtonLabel:f,saveAnswer:p,isSubmitted:m})=>{let _=n===r.length-1;if(m)return g(s,{onClose:e});let v=r[n];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:a[v.id]??void 0,backButton:u?g(d,{onPress:c,children:f}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:e=>o({question:n,answer:e}),children:e=>g(i,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,options:i,onFinished:a,proxyUrl:o,...s})=>g(m,{fallback:g(h,{}),children:g(u,{...s,apiBaseUrl:o,children:g(A,{trigger:t,surveyId:s.surveyId,publishableKey:s.publishableKey,proxyUrl:o,metadata:r,options:i,onFinished:a,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengovsg/confetti",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Widgets for Confetti",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@vitest/coverage-v8": "4.1.8",
|
|
89
89
|
"dotenv-cli": "^11.0.0",
|
|
90
90
|
"esbuild": "^0.28.1",
|
|
91
|
-
"postcss": "^8.5.
|
|
91
|
+
"postcss": "^8.5.25",
|
|
92
92
|
"postcss-cli": "^11.0.1",
|
|
93
93
|
"postcss-preset-env": "^11.2.1",
|
|
94
94
|
"react-aria-components": "1.16.0",
|