@opengovsg/confetti 0.8.2 → 0.9.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 +22 -5
- package/build/Button-D3Wb2KZB.js +7 -0
- package/build/{Confetti-CWPpRhr1.d.ts → Confetti-Ch8bCyn_.d.ts} +3 -3
- package/build/DefaultConfettiTrigger-iGndzjo2.js +1 -0
- package/build/Embed-Ci53s3wI.js +1 -0
- package/build/{ModalContainer-QddeK25W.d.ts → ModalContainer-DnTgSV6A.d.ts} +1 -1
- package/build/ModalContainer-kQ-gmZ0r.js +5 -0
- package/build/client-internals.d.ts +1 -1
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +3 -3
- package/build/components.js +1 -1
- package/build/confetti.css +2 -2
- package/build/{index-DODfg3Bc.d.ts → index-DLqC_qk3.d.ts} +35 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +1 -1
- package/build/{internals-CayVHvqI.js → internals-DKNTeE-L.js} +1 -1
- package/build/internals.d.ts +1 -1
- package/build/internals.js +1 -1
- package/build/src-DG66KK2l.js +1 -0
- package/build/static.d.ts +3 -3
- package/build/static.js +1 -1
- package/package.json +5 -5
- package/build/Button-LiaNjkvk.js +0 -7
- package/build/DefaultConfettiTrigger-9WLnJcVv.js +0 -1
- package/build/Embed-p80c52cK.js +0 -1
- package/build/ModalContainer-fwJ97Uo-.js +0 -5
- package/build/src-Cg5yexLG.js +0 -1
package/build/src-Cg5yexLG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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`})])}),te=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}),ne=e.object({type:e.literal(`switch`),cases:e.array(te),default:i}),re=e.object({type:e.literal(`always`),target:i}),a=e.discriminatedUnion(`type`,[re,ne]),o=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),s=e.optional(e.string().check(e.trim(),e.maxLength(50))),ie=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),label:e.optional(e.string()),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),c=e.array(ie).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)}})),l=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()))})),u=e.optional(e.boolean()),d=e.object({type:e.literal(`rating`),buttonLabel:s,shouldAutoProgress:u,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`]))}),ae=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:s,max:e.number()}),oe=e.object({type:e.literal(`single-select`),shouldAutoProgress:u,options:c,buttonLabel:s,editable:l}),f=e.object({type:e.literal(`multi-select`),buttonLabel:s,options:c,editable:l,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),p=e.object({type:e.literal(`statement`),buttonLabel:s,buttonUrl:e.optional(o)}),m=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:s,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()))}),se=e.discriminatedUnion(`type`,[d,oe,ae,f,p,m]),h=e=>e.trim()===``?void 0:e,g=e.string().transform(h).optional(),_=e.string().check(e.maxLength(50)).transform(h).optional(),ce=e.string().check(e.maxLength(128)).transform(h).optional(),v=e.object({label:g,description:g}),y=e.optional(e.object({label:g,description:g})),le=e.object({type:e.literal(`rating`),buttonLabel:_,labels:e.optional(e.object({lower:g,upper:g}))}),b=e.object({type:e.literal(`open-ended`),placeholder:g,buttonLabel:_}),x=e.object({type:e.literal(`single-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),S=e.object({type:e.literal(`multi-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),C=e.object({type:e.literal(`statement`),buttonLabel:_}),w=e.object({type:e.literal(`bug-report`),placeholder:g,buttonLabel:_,detailsLabel:ce,detailsPlaceholder:g}),T=e.discriminatedUnion(`type`,[le,b,x,S,C,w]),E=`__CONFETTI_CHECKBOX_Others`,D=`__CONFETTI_RADIO_Others`,O=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 k=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(k);const A=e.array(k),j=e.string().check(e.refine(e=>{try{return A.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),M=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),N=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(M),recordingEventsJson:e.optional(j),metadata:O});N(!0);const P=N(!1),F=(e,{required:t})=>N(t),I=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},L=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!I(e.recordingEventsJson),R=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),ue=({scale:t},{required:n})=>{let r=R(t);return n?r:e.optional(r)},z=({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`})),B=(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!==D,{error:`Please fill out the free text field`})),V=({maxLength:t},{required:n})=>{let r=B(t,n);return n?r:e.optional(r)},H=({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!==E,{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`})),U=()=>e.optional(e.string()),W=[`en`,`zh`,`ms`,`ta`],G=e.enum(W),K=e.cuid2(),de=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),q=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:se,routingLogic:a}),fe=e.object({title:g,description:g,backButtonLabel:_,confirmation:e.optional(e.object({title:g,description:g,buttonText:g}))});e.partialRecord(G,fe);const pe=e.object({title:g,description:g,properties:e.optional(T)});e.partialRecord(G,pe);const me=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(q),confirmation:de,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({locale:e.optional(G)}),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:K});const Y=q;e.object({data:e.object({...J.shape,questions:e.array(Y)})}),e.object({surveyId:K,responseId:e.union([e.cuid2(),e.uuid()])});const he=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(),{}),X=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)),P])),Z=e.string().check(e.trim(),e.maxLength(1e3)),ge=e.record(Z,Z).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:X,metadata:ge,telemetry:e.optional(he)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:K,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:K,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:K});const _e=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:K}),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 ve=e.object({id:e.string(),respondent:e.string(),data:X,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(ve),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{F as a,z as c,U as d,E as f,W as i,ue as l,o as m,Z as n,L as o,D as p,me as r,H as s,_e as t,V as u};
|