@formbricks/js
Advanced tools
Comparing version 2.1.0 to 2.1.1-beta.0
@@ -1,6 +0,198 @@ | ||
import { TFormbricksApp } from '@formbricks/js-core/app'; | ||
import { z } from 'zod'; | ||
declare class ActionAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(apiHost: string, environmentId: string); | ||
create(actionInput: Omit<TActionInput, "environmentId">): Promise<Result<{}, NetworkError | Error>>; | ||
} | ||
declare interface ApiConfig { | ||
environmentId: string; | ||
apiHost: string; | ||
} | ||
declare class AttributeAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(apiHost: string, environmentId: string); | ||
update(attributeUpdateInput: Omit<TAttributeUpdateInput, "environmentId">): Promise<Result<{ | ||
changed: boolean; | ||
message: string; | ||
}, NetworkError | Error>>; | ||
} | ||
declare class Client { | ||
response: ResponseAPI; | ||
display: DisplayAPI; | ||
action: ActionAPI; | ||
people: PeopleAPI; | ||
storage: StorageAPI; | ||
attribute: AttributeAPI; | ||
constructor(options: ApiConfig); | ||
} | ||
declare class DisplayAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(baseUrl: string, environmentId: string); | ||
create(displayInput: Omit<TDisplayCreateInput, "environmentId">): Promise<Result<{ | ||
id: string; | ||
}, NetworkError | Error>>; | ||
update(displayId: string, displayInput: Omit<TDisplayUpdateInput, "environmentId">): Promise<Result<{}, NetworkError | Error>>; | ||
} | ||
declare const formbricks: { | ||
init: (initConfig: TJsAppConfigInput) => Promise<void>; | ||
setEmail: (email: string) => Promise<void>; | ||
setAttribute: (key: string, value: any) => Promise<void>; | ||
track: (name: string, properties?: TJsTrackProperties) => Promise<void>; | ||
logout: () => Promise<void>; | ||
reset: () => Promise<void>; | ||
registerRouteChange: () => Promise<void>; | ||
getApi: () => FormbricksAPI; | ||
}; | ||
declare class FormbricksAPI { | ||
client: Client; | ||
constructor(options: ApiConfig); | ||
} | ||
declare const formbricksApp: TFormbricksApp; | ||
export default formbricksApp; | ||
declare type NetworkError = { | ||
code: "network_error"; | ||
message: string; | ||
status: number; | ||
url: URL; | ||
}; | ||
declare class PeopleAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(apiHost: string, environmentId: string); | ||
create(userId: string): Promise<Result<{}, NetworkError | Error>>; | ||
} | ||
declare class ResponseAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(apiHost: string, environmentId: string); | ||
create(responseInput: Omit<TResponseInput, "environmentId">): Promise<Result<{ | ||
id: string; | ||
}, NetworkError | Error>>; | ||
update({ responseId, finished, data, ttc, language, }: TResponseUpdateInputWithResponseId): Promise<Result<{}, NetworkError | Error>>; | ||
} | ||
declare type Result<T, E = Error> = { ok: true; data: T } | { ok: false; error: E }; | ||
declare class StorageAPI { | ||
private apiHost; | ||
private environmentId; | ||
constructor(apiHost: string, environmentId: string); | ||
uploadFile(file: File, { allowedFileExtensions, surveyId }?: TUploadFileConfig | undefined): Promise<string>; | ||
} | ||
declare type TActionInput = z.infer<typeof ZActionInput>; | ||
declare type TAttributeUpdateInput = z.infer<typeof ZAttributeUpdateInput>; | ||
declare type TDisplayCreateInput = z.infer<typeof ZDisplayCreateInput>; | ||
declare type TDisplayUpdateInput = z.infer<typeof ZDisplayUpdateInput>; | ||
declare type TFormbricksApp = typeof formbricks; | ||
declare type TJsAppConfigInput = z.infer<typeof ZJsAppConfigInput>; | ||
declare type TJsTrackProperties = z.infer<typeof ZJsTrackProperties>; | ||
declare type TResponseInput = z.infer<typeof ZResponseInput>; | ||
declare type TResponseUpdateInput = z.infer<typeof ZResponseUpdateInput>; | ||
declare type TResponseUpdateInputWithResponseId = TResponseUpdateInput & { | ||
responseId: string; | ||
}; | ||
declare type TUploadFileConfig = z.infer<typeof ZUploadFileConfig>; | ||
declare const ZActionInput = z.object({ | ||
environmentId: z.string().cuid(), | ||
userId: z.string(), | ||
name: z.string(), | ||
}); | ||
declare const ZAttributeUpdateInput = z.object({ | ||
environmentId: z.string().cuid2(), | ||
userId: z.string(), | ||
attributes: z.record(z.union([z.string(), z.number()])), | ||
}); | ||
declare const ZDisplayCreateInput = z.object({ | ||
environmentId: z.string().cuid(), | ||
surveyId: z.string().cuid(), | ||
userId: z.string().optional(), | ||
responseId: z.string().cuid().optional(), | ||
}); | ||
declare const ZDisplayUpdateInput = z.object({ | ||
environmentId: z.string().cuid(), | ||
userId: z.string().optional(), | ||
responseId: z.string().cuid().optional(), | ||
}); | ||
declare const ZJsAppConfigInput = z.object({ | ||
environmentId: z.string().cuid(), | ||
apiHost: z.string(), | ||
errorHandler: z.function().args(z.any()).returns(z.void()).optional(), | ||
userId: z.string(), | ||
attributes: z.record(z.string()).optional(), | ||
}); | ||
declare const ZJsTrackProperties = z.object({ | ||
hiddenFields: ZResponseHiddenFieldValue.optional(), | ||
}); | ||
declare const ZResponseInput = z.object({ | ||
createdAt: z.coerce.date().optional(), | ||
updatedAt: z.coerce.date().optional(), | ||
environmentId: z.string().cuid2(), | ||
surveyId: z.string().cuid2(), | ||
userId: z.string().nullish(), | ||
singleUseId: z.string().nullable().optional(), | ||
finished: z.boolean(), | ||
language: z.string().optional(), | ||
data: ZResponseData, | ||
ttc: ZResponseTtc.optional(), | ||
meta: z | ||
.object({ | ||
source: z.string().optional(), | ||
url: z.string().optional(), | ||
userAgent: z | ||
.object({ | ||
browser: z.string().optional(), | ||
device: z.string().optional(), | ||
os: z.string().optional(), | ||
}) | ||
.optional(), | ||
country: z.string().optional(), | ||
action: z.string().optional(), | ||
}) | ||
.optional(), | ||
}); | ||
declare const ZResponseUpdateInput = z.object({ | ||
finished: z.boolean(), | ||
data: ZResponseData, | ||
ttc: ZResponseTtc.optional(), | ||
language: z.string().optional(), | ||
}); | ||
declare const ZUploadFileConfig = z.object({ | ||
allowedFileExtensions: z.array(z.string()).optional(), | ||
surveyId: z.string().optional(), | ||
}); | ||
export { } | ||
@@ -7,0 +199,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { l as loadFormbricksToProxy } from "./loadFormbricks-DaeJP_pg.js"; | ||
import { l as loadFormbricksToProxy } from "./loadFormbricks-5D_VzSCy.js"; | ||
const formbricksProxyHandler = { | ||
@@ -3,0 +3,0 @@ get(_target, prop, _receiver) { |
@@ -1,6 +0,30 @@ | ||
import { TFormbricksWebsite } from '@formbricks/js-core/website'; | ||
import z from 'zod'; | ||
declare const formbricks: { | ||
init: (initConfig: TJsWebsiteConfigInput) => Promise<void>; | ||
track: (name: string, properties?: TJsTrackProperties) => Promise<void>; | ||
reset: () => Promise<void>; | ||
registerRouteChange: () => Promise<void>; | ||
}; | ||
declare const formbricksWebsite: TFormbricksWebsite; | ||
export default formbricksWebsite; | ||
declare type TFormbricksWebsite = typeof formbricks; | ||
declare type TJsTrackProperties = z.infer<typeof ZJsTrackProperties>; | ||
declare type TJsWebsiteConfigInput = z.infer<typeof ZJsWebsiteConfigInput>; | ||
declare const ZJsTrackProperties = z.object({ | ||
hiddenFields: ZResponseHiddenFieldValue.optional(), | ||
}); | ||
declare const ZJsWebsiteConfigInput = z.object({ | ||
environmentId: z.string().cuid(), | ||
apiHost: z.string(), | ||
errorHandler: z.function().args(z.any()).returns(z.void()).optional(), | ||
attributes: z.record(z.string()).optional(), | ||
}); | ||
export { } | ||
@@ -7,0 +31,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { l as loadFormbricksToProxy } from "./loadFormbricks-DaeJP_pg.js"; | ||
import { l as loadFormbricksToProxy } from "./loadFormbricks-5D_VzSCy.js"; | ||
const formbricksProxyHandler = { | ||
@@ -3,0 +3,0 @@ get(_target, prop, _receiver) { |
{ | ||
"name": "@formbricks/js", | ||
"license": "MIT", | ||
"version": "2.1.0", | ||
"version": "2.1.1-beta.0", | ||
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.", | ||
@@ -44,11 +44,2 @@ "homepage": "https://formbricks.com", | ||
}, | ||
"author": "Formbricks <hola@formbricks.com>", | ||
"devDependencies": { | ||
"terser": "^5.31.0", | ||
"vite": "^5.2.11", | ||
"vite-plugin-dts": "^3.9.1", | ||
"@formbricks/js-core": "1.0.0", | ||
"@formbricks/config-typescript": "1.0.0", | ||
"@formbricks/eslint-config": "0.0.0" | ||
}, | ||
"scripts": { | ||
@@ -61,3 +52,12 @@ "dev": "vite build --watch --mode dev", | ||
"clean": "rimraf .turbo node_modules dist coverage" | ||
}, | ||
"author": "Formbricks <hola@formbricks.com>", | ||
"devDependencies": { | ||
"@formbricks/js-core": "workspace:*", | ||
"@formbricks/config-typescript": "workspace:*", | ||
"@formbricks/eslint-config": "workspace:*", | ||
"terser": "^5.31.1", | ||
"vite": "^5.3.1", | ||
"vite-plugin-dts": "^3.9.1" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
47901
385
1
3