@formbricks/js
Advanced tools
Comparing version 0.1.21 to 0.1.22
import { h } from "preact"; | ||
import type { Question } from "../../../types/questions"; | ||
import { type Question } from "@formbricks/types/questions"; | ||
interface QuestionConditionalProps { | ||
@@ -4,0 +4,0 @@ question: Question; |
import { NetworkError, Result } from "./errors"; | ||
import { Survey } from "@formbricks/types/js"; | ||
export declare const trackEvent: (eventName: string, properties?: any) => Promise<Result<void, NetworkError>>; | ||
export declare const triggerSurvey: (eventName: string) => void; | ||
export declare const triggerSurvey: (eventName: string, activeSurveys: Survey[]) => void; |
@@ -5,2 +5,11 @@ export interface Choice { | ||
} | ||
export declare enum QuestionType { | ||
OpenText = "openText", | ||
MultipleChoiceSingle = "multipleChoiceSingle", | ||
MultipleChoiceMulti = "multipleChoiceMulti", | ||
NPS = "nps", | ||
CTA = "cta", | ||
Rating = "rating", | ||
Consent = "consent" | ||
} | ||
export type Question = OpenTextQuestion | MultipleChoiceSingleQuestion | MultipleChoiceMultiQuestion | NPSQuestion | CTAQuestion | RatingQuestion; | ||
@@ -17,15 +26,15 @@ export interface IQuestion<T extends Logic> { | ||
export interface OpenTextQuestion extends IQuestion<OpenTextLogic> { | ||
type: "openText"; | ||
type: QuestionType.OpenText; | ||
placeholder?: string; | ||
} | ||
export interface MultipleChoiceSingleQuestion extends IQuestion<MultipleChoiceSingleLogic> { | ||
type: "multipleChoiceSingle"; | ||
type: QuestionType.MultipleChoiceSingle; | ||
choices: Choice[]; | ||
} | ||
export interface MultipleChoiceMultiQuestion extends IQuestion<MultipleChoiceMultiLogic> { | ||
type: "multipleChoiceMulti"; | ||
type: QuestionType.MultipleChoiceMulti; | ||
choices: Choice[]; | ||
} | ||
export interface NPSQuestion extends IQuestion<NPSLogic> { | ||
type: "nps"; | ||
type: QuestionType.NPS; | ||
lowerLabel: string; | ||
@@ -35,3 +44,3 @@ upperLabel: string; | ||
export interface CTAQuestion extends IQuestion<CTALogic> { | ||
type: "cta"; | ||
type: QuestionType.CTA; | ||
html?: string; | ||
@@ -43,3 +52,3 @@ buttonUrl?: string; | ||
export interface RatingQuestion extends IQuestion<RatingLogic> { | ||
type: "rating"; | ||
type: QuestionType.Rating; | ||
scale: "number" | "smiley" | "star"; | ||
@@ -46,0 +55,0 @@ range: 5 | 3 | 4 | 7 | 10; |
@@ -1,2 +0,2 @@ | ||
import type { Question } from "./questions"; | ||
import { TPerson } from "./v1/people"; | ||
export interface Response { | ||
@@ -16,18 +16,10 @@ id: string; | ||
} | ||
export interface QuestionSummary<T extends Question> { | ||
export interface QuestionSummary<T> { | ||
question: T; | ||
responses: { | ||
id: string; | ||
personId: string; | ||
value: string; | ||
updatedAt: string; | ||
person?: { | ||
attributes: { | ||
attributeClass: { | ||
name: string; | ||
}; | ||
value: string; | ||
}; | ||
}; | ||
value: string | number | string[]; | ||
updatedAt: Date; | ||
person: TPerson | null; | ||
}[]; | ||
} |
@@ -12,2 +12,3 @@ import { Question } from "./questions"; | ||
name: string; | ||
redirectUrl: string | null; | ||
type: "web" | "email" | "link" | "mobile"; | ||
@@ -26,2 +27,3 @@ environmentId: string; | ||
delay: number; | ||
autoComplete: number | null; | ||
} | ||
@@ -28,0 +30,0 @@ export interface AttributeFilter { |
import z from "zod"; | ||
export declare const ZPersonAttributes: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>; | ||
export type TPersonAttributes = z.infer<typeof ZPersonAttributes>; | ||
export declare const ZPerson: z.ZodObject<{ | ||
@@ -3,0 +5,0 @@ id: z.ZodString; |
import { z } from "zod"; | ||
export declare const ZResponseData: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>; | ||
export type TResponseData = z.infer<typeof ZResponseData>; | ||
export declare const ZResponsePersonAttributes: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>; | ||
export type TResponsePersonAttributes = z.infer<typeof ZResponsePersonAttributes>; | ||
export declare const ZResponseNoteUser: z.ZodObject<{ | ||
id: z.ZodString; | ||
name: z.ZodNullable<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
id?: string; | ||
name?: string; | ||
}, { | ||
id?: string; | ||
name?: string; | ||
}>; | ||
export type TResponseNoteUser = z.infer<typeof ZResponseNoteUser>; | ||
declare const ZResponseNote: z.ZodObject<{ | ||
updatedAt: z.ZodDate; | ||
createdAt: z.ZodDate; | ||
id: z.ZodString; | ||
text: z.ZodString; | ||
user: z.ZodObject<{ | ||
id: z.ZodString; | ||
name: z.ZodNullable<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
id?: string; | ||
name?: string; | ||
}, { | ||
id?: string; | ||
name?: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}, { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}>; | ||
export type TResponseNote = z.infer<typeof ZResponseNote>; | ||
declare const ZResponse: z.ZodObject<{ | ||
@@ -19,4 +67,58 @@ id: z.ZodString; | ||
}>>; | ||
personAttributes: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber]>>>; | ||
finished: z.ZodBoolean; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>; | ||
notes: z.ZodArray<z.ZodObject<{ | ||
updatedAt: z.ZodDate; | ||
createdAt: z.ZodDate; | ||
id: z.ZodString; | ||
text: z.ZodString; | ||
user: z.ZodObject<{ | ||
id: z.ZodString; | ||
name: z.ZodNullable<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
id?: string; | ||
name?: string; | ||
}, { | ||
id?: string; | ||
name?: string; | ||
}>; | ||
}, "strip", z.ZodTypeAny, { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}, { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}>, "many">; | ||
tags: z.ZodArray<z.ZodObject<{ | ||
id: z.ZodString; | ||
createdAt: z.ZodDate; | ||
updatedAt: z.ZodDate; | ||
name: z.ZodString; | ||
environmentId: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
id?: string; | ||
createdAt?: Date; | ||
updatedAt?: Date; | ||
name?: string; | ||
environmentId?: string; | ||
}, { | ||
id?: string; | ||
createdAt?: Date; | ||
updatedAt?: Date; | ||
name?: string; | ||
environmentId?: string; | ||
}>, "many">; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -31,4 +133,22 @@ id?: string; | ||
}; | ||
personAttributes?: Record<string, string | number>; | ||
finished?: boolean; | ||
data?: Record<string, string | number | string[]>; | ||
notes?: { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}[]; | ||
tags?: { | ||
id?: string; | ||
createdAt?: Date; | ||
updatedAt?: Date; | ||
name?: string; | ||
environmentId?: string; | ||
}[]; | ||
}, { | ||
@@ -43,4 +163,22 @@ id?: string; | ||
}; | ||
personAttributes?: Record<string, string | number>; | ||
finished?: boolean; | ||
data?: Record<string, string | number | string[]>; | ||
notes?: { | ||
updatedAt?: Date; | ||
createdAt?: Date; | ||
id?: string; | ||
text?: string; | ||
user?: { | ||
id?: string; | ||
name?: string; | ||
}; | ||
}[]; | ||
tags?: { | ||
id?: string; | ||
createdAt?: Date; | ||
updatedAt?: Date; | ||
name?: string; | ||
environmentId?: string; | ||
}[]; | ||
}>; | ||
@@ -53,2 +191,29 @@ export type TResponse = z.infer<typeof ZResponse>; | ||
data: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>; | ||
meta: z.ZodOptional<z.ZodObject<{ | ||
userAgent: z.ZodOptional<z.ZodObject<{ | ||
browser: z.ZodOptional<z.ZodString>; | ||
device: z.ZodOptional<z.ZodString>; | ||
os: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}, { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
userAgent?: { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}; | ||
}, { | ||
userAgent?: { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}; | ||
}>>; | ||
}, "strip", z.ZodTypeAny, { | ||
@@ -59,2 +224,9 @@ surveyId?: string; | ||
data?: Record<string, string | number | string[]>; | ||
meta?: { | ||
userAgent?: { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}; | ||
}; | ||
}, { | ||
@@ -65,2 +237,9 @@ surveyId?: string; | ||
data?: Record<string, string | number | string[]>; | ||
meta?: { | ||
userAgent?: { | ||
browser?: string; | ||
device?: string; | ||
os?: string; | ||
}; | ||
}; | ||
}>; | ||
@@ -67,0 +246,0 @@ export type TResponseInput = z.infer<typeof ZResponseInput>; |
import { z } from "zod"; | ||
export declare const ZWebhookTrigger: z.ZodEnum<["responseFinished", "responseCreated", "responseUpdated"]>; | ||
export declare const ZWebhook: z.ZodObject<{ | ||
@@ -4,0 +3,0 @@ id: z.ZodString; |
{ | ||
"name": "@formbricks/js", | ||
"license": "MIT", | ||
"version": "0.1.21", | ||
"version": "0.1.22", | ||
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.", | ||
@@ -60,4 +60,4 @@ "keywords": [ | ||
"typescript": "^5.1.3", | ||
"@formbricks/api": "0.1.0", | ||
"@formbricks/types": "0.0.0", | ||
"@formbricks/api": "0.1.0", | ||
"eslint-config-formbricks": "1.0.0" | ||
@@ -64,0 +64,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67
1441144
5175