@leadbot/components 2.21.0

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.
@@ -0,0 +1,20 @@
1
+ import { type Step, type StepAttributes } from "@leadbot/core";
2
+ import { type LeadbotComponentsConfig } from "./mount";
3
+ export interface StepOptions extends LeadbotComponentsConfig {
4
+ /**
5
+ * Uuid of the step this component renders, as published by the collector.
6
+ * Required: every components component is backed by a published step, so
7
+ * unpublishing a bot removes its components from every page.
8
+ */
9
+ id: string;
10
+ }
11
+ export type PublishedStep = Step<Partial<StepAttributes>>;
12
+ /**
13
+ * Resolves the published step behind `id` from the page's boot fetch. Null
14
+ * while the fetch is pending, when no id is given, or when the flow has no
15
+ * such step.
16
+ */
17
+ export declare function useStep(options: Omit<StepOptions, "id"> & {
18
+ id?: string;
19
+ }): PublishedStep | null;
20
+ //# sourceMappingURL=useStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStep.d.ts","sourceRoot":"","sources":["../src/useStep.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,IAAI,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,KAAK,uBAAuB,EAAY,MAAM,SAAS,CAAC;AAEjE,MAAM,WAAW,WAAY,SAAQ,uBAAuB;IAC3D;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,OAAO,CAEtB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,aAAa,GAAG,IAAI,CAkEtB"}
@@ -0,0 +1,28 @@
1
+ import { type BaseMountOptions, type MountHandle } from "./mount";
2
+ import { type StepOptions } from "./useStep";
3
+ export interface WhatsAppLabels {
4
+ contactName: string;
5
+ status: string;
6
+ placeholder: string;
7
+ messageLabel: string;
8
+ submitError: string;
9
+ redirectError: string;
10
+ }
11
+ export declare const DEFAULT_WHATSAPP_LABELS: WhatsAppLabels;
12
+ export interface WhatsAppOptions extends BaseMountOptions, StepOptions {
13
+ /** Id of the component leadbot this component belongs to (dashboard → Settings → Components). */
14
+ leadbotId: number;
15
+ /** Destination WhatsApp number, e.g. "+31612345678". Omit to use the published step's number. */
16
+ phoneNumber?: string;
17
+ prefilledMessage?: string;
18
+ eventLabel?: string;
19
+ marksAsQualified?: boolean;
20
+ /** Return false (or a promise of false) to cancel. */
21
+ onSubmit?: (data: Record<string, unknown>) => boolean | void | Promise<boolean | void>;
22
+ onSuccess?: (data: Record<string, unknown>) => void;
23
+ onError?: (error: unknown) => void;
24
+ labels?: Partial<WhatsAppLabels>;
25
+ }
26
+ export declare function ComponentsWhatsApp(props: WhatsAppOptions): import("preact").JSX.Element | null;
27
+ export declare function mountWhatsApp(el: HTMLElement, options: WhatsAppOptions): MountHandle<WhatsAppOptions>;
28
+ //# sourceMappingURL=whatsapp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../src/whatsapp.tsx"],"names":[],"mappings":"AAUA,OAAO,EACN,KAAK,gBAAgB,EAGrB,KAAK,WAAW,EAGhB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,uBAAuB,EAAE,cASrC,CAAC;AAOF,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,WAAW;IACrE,iGAAiG;IACjG,SAAS,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,CACV,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzB,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACjC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,uCAwIxD;AAED,wBAAgB,aAAa,CAC5B,EAAE,EAAE,WAAW,EACf,OAAO,EAAE,eAAe,GACtB,WAAW,CAAC,eAAe,CAAC,CAE9B"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@leadbot/components",
3
+ "version": "2.21.0",
4
+ "description": "LeadBot Components: mount agent chat, forms, callback/email requests and WhatsApp handoff into your own DOM.",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "author": "LeadBot development team",
10
+ "type": "module",
11
+ "sideEffects": [
12
+ "*.css"
13
+ ],
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ },
21
+ "./styles.css": "./dist/styles.css"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "dependencies": {
27
+ "@leadbot/core": "2.21.0"
28
+ },
29
+ "devDependencies": {
30
+ "happy-dom": "^20.8.9",
31
+ "preact": "^10.29.1",
32
+ "sass-embedded": "^1.99.0",
33
+ "typescript": "^5.9.3",
34
+ "vite": "^8.0.8",
35
+ "vitest": "^4.1.4"
36
+ },
37
+ "scripts": {
38
+ "build": "vite build && tsc -p tsconfig.json && sass --no-source-map src/styles/index.scss dist/styles.css",
39
+ "test": "vitest run"
40
+ }
41
+ }