@knock-ai/sdk 0.1.2
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/LICENSE +21 -0
- package/README.md +166 -0
- package/angular/package.json +7 -0
- package/contract/package.json +7 -0
- package/dist/angular.cjs +2 -0
- package/dist/angular.cjs.map +1 -0
- package/dist/angular.js +2 -0
- package/dist/angular.js.map +1 -0
- package/dist/contract.cjs +2 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.js +2 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/knockai.iife.js +3 -0
- package/dist/knockai.iife.js.map +1 -0
- package/dist/react.cjs +2 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -0
- package/dist/snippet.js +3 -0
- package/dist/snippet.js.map +1 -0
- package/dist/testing.cjs +2 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/core/bridge.d.cts +6 -0
- package/dist/types/core/bridge.d.ts +7 -0
- package/dist/types/core/bridge.d.ts.map +1 -0
- package/dist/types/core/contract.d.cts +4 -0
- package/dist/types/core/contract.d.ts +5 -0
- package/dist/types/core/contract.d.ts.map +1 -0
- package/dist/types/core/emitter.d.cts +7 -0
- package/dist/types/core/emitter.d.ts +8 -0
- package/dist/types/core/emitter.d.ts.map +1 -0
- package/dist/types/core/env.d.cts +2 -0
- package/dist/types/core/env.d.ts +3 -0
- package/dist/types/core/env.d.ts.map +1 -0
- package/dist/types/core/globals.d.cts +21 -0
- package/dist/types/core/globals.d.ts +22 -0
- package/dist/types/core/globals.d.ts.map +1 -0
- package/dist/types/core/iife.d.cts +7 -0
- package/dist/types/core/iife.d.ts +8 -0
- package/dist/types/core/iife.d.ts.map +1 -0
- package/dist/types/core/index.d.cts +22 -0
- package/dist/types/core/index.d.ts +23 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/loader.d.cts +9 -0
- package/dist/types/core/loader.d.ts +10 -0
- package/dist/types/core/loader.d.ts.map +1 -0
- package/dist/types/core/queue.d.cts +16 -0
- package/dist/types/core/queue.d.ts +17 -0
- package/dist/types/core/queue.d.ts.map +1 -0
- package/dist/types/core/snippet.d.cts +1 -0
- package/dist/types/core/snippet.d.ts +2 -0
- package/dist/types/core/snippet.d.ts.map +1 -0
- package/dist/types/core/types.d.cts +148 -0
- package/dist/types/core/types.d.ts +149 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/version.d.cts +1 -0
- package/dist/types/core/version.d.ts +2 -0
- package/dist/types/core/version.d.ts.map +1 -0
- package/dist/types/core/wire.d.cts +66 -0
- package/dist/types/core/wire.d.ts +67 -0
- package/dist/types/core/wire.d.ts.map +1 -0
- package/dist/types/frameworks/angular/index.d.cts +2 -0
- package/dist/types/frameworks/angular/index.d.ts +3 -0
- package/dist/types/frameworks/angular/index.d.ts.map +1 -0
- package/dist/types/frameworks/angular/knock.token.d.cts +4 -0
- package/dist/types/frameworks/angular/knock.token.d.ts +5 -0
- package/dist/types/frameworks/angular/knock.token.d.ts.map +1 -0
- package/dist/types/frameworks/angular/provide-knock.d.cts +4 -0
- package/dist/types/frameworks/angular/provide-knock.d.ts +5 -0
- package/dist/types/frameworks/angular/provide-knock.d.ts.map +1 -0
- package/dist/types/frameworks/react/KnockButton.d.cts +9 -0
- package/dist/types/frameworks/react/KnockButton.d.ts +10 -0
- package/dist/types/frameworks/react/KnockButton.d.ts.map +1 -0
- package/dist/types/frameworks/react/KnockProvider.d.cts +10 -0
- package/dist/types/frameworks/react/KnockProvider.d.ts +11 -0
- package/dist/types/frameworks/react/KnockProvider.d.ts.map +1 -0
- package/dist/types/frameworks/react/context.d.cts +3 -0
- package/dist/types/frameworks/react/context.d.ts +4 -0
- package/dist/types/frameworks/react/context.d.ts.map +1 -0
- package/dist/types/frameworks/react/index.d.cts +7 -0
- package/dist/types/frameworks/react/index.d.ts +8 -0
- package/dist/types/frameworks/react/index.d.ts.map +1 -0
- package/dist/types/frameworks/react/useKnock.d.cts +2 -0
- package/dist/types/frameworks/react/useKnock.d.ts +3 -0
- package/dist/types/frameworks/react/useKnock.d.ts.map +1 -0
- package/dist/types/frameworks/react/useKnockEvent.d.cts +2 -0
- package/dist/types/frameworks/react/useKnockEvent.d.ts +3 -0
- package/dist/types/frameworks/react/useKnockEvent.d.ts.map +1 -0
- package/dist/types/frameworks/react/useKnockIdentify.d.cts +2 -0
- package/dist/types/frameworks/react/useKnockIdentify.d.ts +3 -0
- package/dist/types/frameworks/react/useKnockIdentify.d.ts.map +1 -0
- package/dist/types/frameworks/vue/button.d.cts +29 -0
- package/dist/types/frameworks/vue/button.d.ts +30 -0
- package/dist/types/frameworks/vue/button.d.ts.map +1 -0
- package/dist/types/frameworks/vue/index.d.cts +4 -0
- package/dist/types/frameworks/vue/index.d.ts +5 -0
- package/dist/types/frameworks/vue/index.d.ts.map +1 -0
- package/dist/types/frameworks/vue/inject-key.d.cts +3 -0
- package/dist/types/frameworks/vue/inject-key.d.ts +4 -0
- package/dist/types/frameworks/vue/inject-key.d.ts.map +1 -0
- package/dist/types/frameworks/vue/plugin.d.cts +5 -0
- package/dist/types/frameworks/vue/plugin.d.ts +6 -0
- package/dist/types/frameworks/vue/plugin.d.ts.map +1 -0
- package/dist/types/frameworks/vue/use-knock.d.cts +2 -0
- package/dist/types/frameworks/vue/use-knock.d.ts +3 -0
- package/dist/types/frameworks/vue/use-knock.d.ts.map +1 -0
- package/dist/types/testing/index.d.cts +61 -0
- package/dist/types/testing/index.d.ts +62 -0
- package/dist/types/testing/index.d.ts.map +1 -0
- package/dist/vue.cjs +2 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.js +2 -0
- package/dist/vue.js.map +1 -0
- package/package.json +231 -0
- package/react/package.json +7 -0
- package/testing/package.json +7 -0
- package/vue/package.json +7 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire protocol: what a conforming runtime sends for `track()` — `POST <ingest>/client/an/v1/product-events`.
|
|
3
|
+
* The facade never touches the network — these shapes bind the runtime (the Knock tag). On the product tag,
|
|
4
|
+
* `identify()` is sent here too, as the reserved `$identify` event.
|
|
5
|
+
*/
|
|
6
|
+
import type { KnockTagSurface } from './types.cjs';
|
|
7
|
+
/** Retry policy every runtime must implement (posthog-js backoff). Status codes not listed are not retried. */
|
|
8
|
+
export declare const WIRE_RETRY_POLICY: {
|
|
9
|
+
readonly retryOn: readonly [408, 429, 500, 502, 503, 504];
|
|
10
|
+
readonly neverRetryOn: readonly [400, 401, 403];
|
|
11
|
+
readonly maxAttempts: 10;
|
|
12
|
+
/** No HTTP response at all (usually an ad blocker). Offline time doesn't count. */
|
|
13
|
+
readonly maxNetworkAttempts: 3;
|
|
14
|
+
readonly initialBackoffMs: 3000;
|
|
15
|
+
readonly maxBackoffMs: 300000;
|
|
16
|
+
readonly jitter: 0.25;
|
|
17
|
+
/** `Retry-After` (seconds) is a floor on the next delay, itself capped. */
|
|
18
|
+
readonly maxRetryAfterMs: 30000;
|
|
19
|
+
};
|
|
20
|
+
/** The server caps a request body at 64 KB and a batch at 50 events; a 413 halves the batch. */
|
|
21
|
+
export declare const WIRE_BATCH_POLICY: {
|
|
22
|
+
readonly maxEventsPerBatch: 50;
|
|
23
|
+
readonly maxBatchBytes: number;
|
|
24
|
+
readonly flushIntervalMs: 1000;
|
|
25
|
+
};
|
|
26
|
+
/** Bodies at least this large are gzipped and named in `?e=gzip` (sendBeacon can't set Content-Encoding). */
|
|
27
|
+
export declare const WIRE_COMPRESSION: {
|
|
28
|
+
readonly param: 'e';
|
|
29
|
+
readonly format: 'gzip';
|
|
30
|
+
readonly minBytes: 1024;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Server-enforced event name. The runtime normalizes a vendor's name onto it (`Signed up` → `signed_up`)
|
|
34
|
+
* and a name that can't be normalized is dropped — one invalid event rejects its whole batch.
|
|
35
|
+
*/
|
|
36
|
+
export declare const WIRE_EVENT_NAME_PATTERN: RegExp;
|
|
37
|
+
export interface KnockWireEvent {
|
|
38
|
+
/** A unique id per event (`[A-Za-z0-9_-]{8,64}`), minted once at call time and identical on every retry. */
|
|
39
|
+
eventId: string;
|
|
40
|
+
/** Normalized to `WIRE_EVENT_NAME_PATTERN`, or the runtime's reserved `$identify` (properties = traits, `email` required). */
|
|
41
|
+
name: string;
|
|
42
|
+
/** ISO-8601 time of the vendor's call, unchanged on retry. The server keeps it only within ±24 h. */
|
|
43
|
+
occurredAt: string;
|
|
44
|
+
/** JSON values, ≤ 3 levels of nesting, ≤ 100 keys, arrays ≤ 50, strings ≤ 1 KB, ~8 KB serialized. */
|
|
45
|
+
properties?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
/** One request: the session context once, then the events. Keys match the tag's analytics rows. */
|
|
48
|
+
export interface KnockWireBatch {
|
|
49
|
+
vendorId: string;
|
|
50
|
+
/** Knock's visitor id from `/uid2` (`<uuid>.<mintedAtMs>`) — required; the runtime holds events until it exists. */
|
|
51
|
+
userId: string;
|
|
52
|
+
sessionId: string | null;
|
|
53
|
+
/** Required: the sending tag's id. */
|
|
54
|
+
tagId: string;
|
|
55
|
+
tagVersion: string | null;
|
|
56
|
+
/** Which tag sent the batch; absent from tags that predate it. */
|
|
57
|
+
surface?: KnockTagSurface;
|
|
58
|
+
pageVisit: string | null;
|
|
59
|
+
referrerUrl: string | null;
|
|
60
|
+
utm_source?: string;
|
|
61
|
+
utm_medium?: string;
|
|
62
|
+
utm_campaign?: string;
|
|
63
|
+
utm_content?: string;
|
|
64
|
+
utm_term?: string;
|
|
65
|
+
events: KnockWireEvent[];
|
|
66
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire protocol: what a conforming runtime sends for `track()` — `POST <ingest>/client/an/v1/product-events`.
|
|
3
|
+
* The facade never touches the network — these shapes bind the runtime (the Knock tag). On the product tag,
|
|
4
|
+
* `identify()` is sent here too, as the reserved `$identify` event.
|
|
5
|
+
*/
|
|
6
|
+
import type { KnockTagSurface } from './types.js';
|
|
7
|
+
/** Retry policy every runtime must implement (posthog-js backoff). Status codes not listed are not retried. */
|
|
8
|
+
export declare const WIRE_RETRY_POLICY: {
|
|
9
|
+
readonly retryOn: readonly [408, 429, 500, 502, 503, 504];
|
|
10
|
+
readonly neverRetryOn: readonly [400, 401, 403];
|
|
11
|
+
readonly maxAttempts: 10;
|
|
12
|
+
/** No HTTP response at all (usually an ad blocker). Offline time doesn't count. */
|
|
13
|
+
readonly maxNetworkAttempts: 3;
|
|
14
|
+
readonly initialBackoffMs: 3000;
|
|
15
|
+
readonly maxBackoffMs: 300000;
|
|
16
|
+
readonly jitter: 0.25;
|
|
17
|
+
/** `Retry-After` (seconds) is a floor on the next delay, itself capped. */
|
|
18
|
+
readonly maxRetryAfterMs: 30000;
|
|
19
|
+
};
|
|
20
|
+
/** The server caps a request body at 64 KB and a batch at 50 events; a 413 halves the batch. */
|
|
21
|
+
export declare const WIRE_BATCH_POLICY: {
|
|
22
|
+
readonly maxEventsPerBatch: 50;
|
|
23
|
+
readonly maxBatchBytes: number;
|
|
24
|
+
readonly flushIntervalMs: 1000;
|
|
25
|
+
};
|
|
26
|
+
/** Bodies at least this large are gzipped and named in `?e=gzip` (sendBeacon can't set Content-Encoding). */
|
|
27
|
+
export declare const WIRE_COMPRESSION: {
|
|
28
|
+
readonly param: 'e';
|
|
29
|
+
readonly format: 'gzip';
|
|
30
|
+
readonly minBytes: 1024;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Server-enforced event name. The runtime normalizes a vendor's name onto it (`Signed up` → `signed_up`)
|
|
34
|
+
* and a name that can't be normalized is dropped — one invalid event rejects its whole batch.
|
|
35
|
+
*/
|
|
36
|
+
export declare const WIRE_EVENT_NAME_PATTERN: RegExp;
|
|
37
|
+
export interface KnockWireEvent {
|
|
38
|
+
/** A unique id per event (`[A-Za-z0-9_-]{8,64}`), minted once at call time and identical on every retry. */
|
|
39
|
+
eventId: string;
|
|
40
|
+
/** Normalized to `WIRE_EVENT_NAME_PATTERN`, or the runtime's reserved `$identify` (properties = traits, `email` required). */
|
|
41
|
+
name: string;
|
|
42
|
+
/** ISO-8601 time of the vendor's call, unchanged on retry. The server keeps it only within ±24 h. */
|
|
43
|
+
occurredAt: string;
|
|
44
|
+
/** JSON values, ≤ 3 levels of nesting, ≤ 100 keys, arrays ≤ 50, strings ≤ 1 KB, ~8 KB serialized. */
|
|
45
|
+
properties?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
/** One request: the session context once, then the events. Keys match the tag's analytics rows. */
|
|
48
|
+
export interface KnockWireBatch {
|
|
49
|
+
vendorId: string;
|
|
50
|
+
/** Knock's visitor id from `/uid2` (`<uuid>.<mintedAtMs>`) — required; the runtime holds events until it exists. */
|
|
51
|
+
userId: string;
|
|
52
|
+
sessionId: string | null;
|
|
53
|
+
/** Required: the sending tag's id. */
|
|
54
|
+
tagId: string;
|
|
55
|
+
tagVersion: string | null;
|
|
56
|
+
/** Which tag sent the batch; absent from tags that predate it. */
|
|
57
|
+
surface?: KnockTagSurface;
|
|
58
|
+
pageVisit: string | null;
|
|
59
|
+
referrerUrl: string | null;
|
|
60
|
+
utm_source?: string;
|
|
61
|
+
utm_medium?: string;
|
|
62
|
+
utm_campaign?: string;
|
|
63
|
+
utm_content?: string;
|
|
64
|
+
utm_term?: string;
|
|
65
|
+
events: KnockWireEvent[];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/core/wire.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,+GAA+G;AAC/G,eAAO,MAAM,iBAAiB;aAC5B,OAAO,YAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;aACtC,YAAY,YAAG,GAAG,EAAE,GAAG,EAAE,GAAG;aAC5B,WAAW,EAAE,EAAE;IACf,mFAAmF;aACnF,kBAAkB,EAAE,CAAC;aACrB,gBAAgB,EAAE,IAAI;aACtB,YAAY,EAAE,MAAO;aACrB,MAAM,EAAE,IAAI;IACZ,2EAA2E;aAC3E,eAAe,EAAE,KAAM;CACf,CAAC;AAEX,gGAAgG;AAChG,eAAO,MAAM,iBAAiB;aAC5B,iBAAiB,EAAE,EAAE;aACrB,aAAa;aACb,eAAe,EAAE,IAAI;CACb,CAAC;AAEX,6GAA6G;AAC7G,eAAO,MAAM,gBAAgB;aAAK,KAAK,EAAE,GAAG;aAAE,MAAM,EAAE,MAAM;aAAE,QAAQ,EAAE,IAAI;CAAW,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAA2B,CAAC;AAEhE,MAAM,WAAW,cAAc;IAC7B,4GAA4G;IAC5G,OAAO,EAAE,MAAM,CAAC;IAChB,8HAA8H;IAC9H,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,UAAU,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,mGAAmG;AACnG,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,oHAAoH;IACpH,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kEAAkE;IAClE,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/angular/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import type { KnockSDK } from '@knock-ai/sdk';
|
|
3
|
+
/** `inject(KNOCK)` returns the shared `knock` instance. A runtime token, so it needs no Angular compiler output. */
|
|
4
|
+
export declare const KNOCK: InjectionToken<KnockSDK>;
|
|
5
|
+
//# sourceMappingURL=knock.token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knock.token.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/angular/knock.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,oHAAoH;AACpH,eAAO,MAAM,KAAK,0BAA8F,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import type { KnockInitOptions } from '@knock-ai/sdk';
|
|
3
|
+
export declare function initKnockRuntime(options: KnockInitOptions): void;
|
|
4
|
+
export declare function provideKnock(options: KnockInitOptions): EnvironmentProviders;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import type { KnockInitOptions } from '@knock-ai/sdk';
|
|
3
|
+
export declare function initKnockRuntime(options: KnockInitOptions): void;
|
|
4
|
+
export declare function provideKnock(options: KnockInitOptions): EnvironmentProviders;
|
|
5
|
+
//# sourceMappingURL=provide-knock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provide-knock.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/angular/provide-knock.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAEhE;AAID,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,oBAAoB,CAQ5E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface KnockButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
4
|
+
magicLinkId?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Loads the scheduling modal on hover or focus, so a click opens it with times already there. */
|
|
9
|
+
export declare function KnockButton({ magicLinkId, email, children, onClick, onPointerEnter, onFocus, ...rest }: KnockButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface KnockButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
4
|
+
magicLinkId?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Loads the scheduling modal on hover or focus, so a click opens it with times already there. */
|
|
9
|
+
export declare function KnockButton({ magicLinkId, email, children, onClick, onPointerEnter, onFocus, ...rest }: KnockButtonProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=KnockButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnockButton.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/KnockButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAA6D,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC/E,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,+BAwBxH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { KnockIdentifyTraits, KnockInitOptions } from '@knock-ai/sdk';
|
|
3
|
+
export interface KnockProviderUser {
|
|
4
|
+
traits: KnockIdentifyTraits;
|
|
5
|
+
}
|
|
6
|
+
export interface KnockProviderProps extends KnockInitOptions {
|
|
7
|
+
user?: KnockProviderUser | null;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function KnockProvider({ user, children, ...initOptions }: KnockProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { KnockIdentifyTraits, KnockInitOptions } from '@knock-ai/sdk';
|
|
3
|
+
export interface KnockProviderUser {
|
|
4
|
+
traits: KnockIdentifyTraits;
|
|
5
|
+
}
|
|
6
|
+
export interface KnockProviderProps extends KnockInitOptions {
|
|
7
|
+
user?: KnockProviderUser | null;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function KnockProvider({ user, children, ...initOptions }: KnockProviderProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=KnockProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnockProvider.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/KnockProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI3E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,IAAI,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,EAAE,kBAAkB,+BAoBnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,2FAA2F;AAC3F,eAAO,MAAM,YAAY,+CAAiD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { KnockProvider } from './KnockProvider.cjs';
|
|
2
|
+
export type { KnockProviderProps, KnockProviderUser } from './KnockProvider.cjs';
|
|
3
|
+
export { useKnock } from './useKnock.cjs';
|
|
4
|
+
export { useKnockIdentify } from './useKnockIdentify.cjs';
|
|
5
|
+
export { useKnockEvent } from './useKnockEvent.cjs';
|
|
6
|
+
export { KnockButton } from './KnockButton.cjs';
|
|
7
|
+
export type { KnockButtonProps } from './KnockButton.cjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { KnockProvider } from './KnockProvider.js';
|
|
2
|
+
export type { KnockProviderProps, KnockProviderUser } from './KnockProvider.js';
|
|
3
|
+
export { useKnock } from './useKnock.js';
|
|
4
|
+
export { useKnockIdentify } from './useKnockIdentify.js';
|
|
5
|
+
export { useKnockEvent } from './useKnockEvent.js';
|
|
6
|
+
export { KnockButton } from './KnockButton.js';
|
|
7
|
+
export type { KnockButtonProps } from './KnockButton.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKnock.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/useKnock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,wBAAgB,QAAQ,IAAI,QAAQ,CAEnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKnockEvent.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/useKnockEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGnE,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EACpD,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAC3C,IAAI,CAON"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKnockIdentify.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/react/useKnockIdentify.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAUlE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export declare const KnockButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
4
|
+
magicLinkId: {
|
|
5
|
+
type: PropType<string | undefined>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
email: {
|
|
9
|
+
type: PropType<string | undefined>;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
16
|
+
magicLinkId: {
|
|
17
|
+
type: PropType<string | undefined>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
email: {
|
|
21
|
+
type: PropType<string | undefined>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
magicLinkId: string | undefined;
|
|
28
|
+
email: string | undefined;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export declare const KnockButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
4
|
+
magicLinkId: {
|
|
5
|
+
type: PropType<string | undefined>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
email: {
|
|
9
|
+
type: PropType<string | undefined>;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
/** Omit to open your workspace's default Knock modal. */
|
|
16
|
+
magicLinkId: {
|
|
17
|
+
type: PropType<string | undefined>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
email: {
|
|
21
|
+
type: PropType<string | undefined>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
magicLinkId: string | undefined;
|
|
28
|
+
email: string | undefined;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/vue/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGxD,eAAO,MAAM,WAAW;IAIpB,yDAAyD;;QAC1C,IAAI,EAAY,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;QAAE,OAAO;;;QAC3D,IAAI,EAAY,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;QAAE,OAAO;;;;;IAF9D,yDAAyD;;;;;;;;;;;;;;4EAqB3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-key.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/vue/inject-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/vue/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMtD,eAAO,MAAM,WAAW;IACtB,OAAO,MAAM,GAAG,WAAW,gBAAgB,GAAG,IAAI;CAInD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-knock.d.ts","sourceRoot":"","sources":["../../../../src/frameworks/vue/use-knock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,wBAAgB,QAAQ,IAAI,QAAQ,CAEnC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { KnockEventMap, KnockEventName, KnockFieldValue, KnockIdentifyTraits, KnockInitOptions, KnockModalOpenOptions, KnockSDK, KnockSchedulingLoadOptions } from '../core/types.cjs';
|
|
2
|
+
export type KnockMockCall = {
|
|
3
|
+
method: 'init';
|
|
4
|
+
args: [KnockInitOptions];
|
|
5
|
+
} | {
|
|
6
|
+
method: 'identify';
|
|
7
|
+
args: [KnockIdentifyTraits];
|
|
8
|
+
} | {
|
|
9
|
+
method: 'track';
|
|
10
|
+
args: [string, Record<string, KnockFieldValue> | undefined];
|
|
11
|
+
} | {
|
|
12
|
+
method: 'modal.open';
|
|
13
|
+
args: [KnockModalOpenOptions];
|
|
14
|
+
} | {
|
|
15
|
+
method: 'modal.close';
|
|
16
|
+
args: [];
|
|
17
|
+
} | {
|
|
18
|
+
method: 'scheduling.load';
|
|
19
|
+
args: [KnockSchedulingLoadOptions];
|
|
20
|
+
} | {
|
|
21
|
+
method: 'scheduling.handle.open';
|
|
22
|
+
args: [];
|
|
23
|
+
} | {
|
|
24
|
+
method: 'scheduling.handle.close';
|
|
25
|
+
args: [];
|
|
26
|
+
} | {
|
|
27
|
+
method: 'widget.show';
|
|
28
|
+
args: [];
|
|
29
|
+
} | {
|
|
30
|
+
method: 'widget.hide';
|
|
31
|
+
args: [];
|
|
32
|
+
} | {
|
|
33
|
+
method: 'widget.open';
|
|
34
|
+
args: [];
|
|
35
|
+
} | {
|
|
36
|
+
method: 'widget.close';
|
|
37
|
+
args: [];
|
|
38
|
+
} | {
|
|
39
|
+
method: 'on';
|
|
40
|
+
args: [KnockEventName];
|
|
41
|
+
};
|
|
42
|
+
export interface KnockMock extends KnockSDK {
|
|
43
|
+
/** Every call made against this mock, oldest first. */
|
|
44
|
+
readonly calls: readonly KnockMockCall[];
|
|
45
|
+
/** Traits from the most recent `identify()` call, if any. */
|
|
46
|
+
lastIdentify(): {
|
|
47
|
+
traits: KnockIdentifyTraits;
|
|
48
|
+
} | undefined;
|
|
49
|
+
/** Properties from every `track(name, …)` call, in call order. */
|
|
50
|
+
eventsNamed(name: string): Array<Record<string, KnockFieldValue> | undefined>;
|
|
51
|
+
/** Fire a handler registered via `on()`, as the real runtime would. */
|
|
52
|
+
emit<E extends KnockEventName>(event: E, payload: KnockEventMap[E]): void;
|
|
53
|
+
/** Forget recorded calls; `on()` subscriptions stay. */
|
|
54
|
+
clearCalls(): void;
|
|
55
|
+
}
|
|
56
|
+
/** A full, in-memory `KnockSDK` that records every call for assertions. */
|
|
57
|
+
export declare function createKnockMock(): KnockMock;
|
|
58
|
+
/** Swap the singleton the framework bindings resolve `knock` through onto `mock`. */
|
|
59
|
+
export declare function installKnockMock(mock: KnockMock): void;
|
|
60
|
+
/** Restore the framework bindings to the real (queueing) facade singleton. */
|
|
61
|
+
export declare function uninstallKnockMock(): void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { KnockEventMap, KnockEventName, KnockFieldValue, KnockIdentifyTraits, KnockInitOptions, KnockModalOpenOptions, KnockSDK, KnockSchedulingLoadOptions } from '../core/types.js';
|
|
2
|
+
export type KnockMockCall = {
|
|
3
|
+
method: 'init';
|
|
4
|
+
args: [KnockInitOptions];
|
|
5
|
+
} | {
|
|
6
|
+
method: 'identify';
|
|
7
|
+
args: [KnockIdentifyTraits];
|
|
8
|
+
} | {
|
|
9
|
+
method: 'track';
|
|
10
|
+
args: [string, Record<string, KnockFieldValue> | undefined];
|
|
11
|
+
} | {
|
|
12
|
+
method: 'modal.open';
|
|
13
|
+
args: [KnockModalOpenOptions];
|
|
14
|
+
} | {
|
|
15
|
+
method: 'modal.close';
|
|
16
|
+
args: [];
|
|
17
|
+
} | {
|
|
18
|
+
method: 'scheduling.load';
|
|
19
|
+
args: [KnockSchedulingLoadOptions];
|
|
20
|
+
} | {
|
|
21
|
+
method: 'scheduling.handle.open';
|
|
22
|
+
args: [];
|
|
23
|
+
} | {
|
|
24
|
+
method: 'scheduling.handle.close';
|
|
25
|
+
args: [];
|
|
26
|
+
} | {
|
|
27
|
+
method: 'widget.show';
|
|
28
|
+
args: [];
|
|
29
|
+
} | {
|
|
30
|
+
method: 'widget.hide';
|
|
31
|
+
args: [];
|
|
32
|
+
} | {
|
|
33
|
+
method: 'widget.open';
|
|
34
|
+
args: [];
|
|
35
|
+
} | {
|
|
36
|
+
method: 'widget.close';
|
|
37
|
+
args: [];
|
|
38
|
+
} | {
|
|
39
|
+
method: 'on';
|
|
40
|
+
args: [KnockEventName];
|
|
41
|
+
};
|
|
42
|
+
export interface KnockMock extends KnockSDK {
|
|
43
|
+
/** Every call made against this mock, oldest first. */
|
|
44
|
+
readonly calls: readonly KnockMockCall[];
|
|
45
|
+
/** Traits from the most recent `identify()` call, if any. */
|
|
46
|
+
lastIdentify(): {
|
|
47
|
+
traits: KnockIdentifyTraits;
|
|
48
|
+
} | undefined;
|
|
49
|
+
/** Properties from every `track(name, …)` call, in call order. */
|
|
50
|
+
eventsNamed(name: string): Array<Record<string, KnockFieldValue> | undefined>;
|
|
51
|
+
/** Fire a handler registered via `on()`, as the real runtime would. */
|
|
52
|
+
emit<E extends KnockEventName>(event: E, payload: KnockEventMap[E]): void;
|
|
53
|
+
/** Forget recorded calls; `on()` subscriptions stay. */
|
|
54
|
+
clearCalls(): void;
|
|
55
|
+
}
|
|
56
|
+
/** A full, in-memory `KnockSDK` that records every call for assertions. */
|
|
57
|
+
export declare function createKnockMock(): KnockMock;
|
|
58
|
+
/** Swap the singleton the framework bindings resolve `knock` through onto `mock`. */
|
|
59
|
+
export declare function installKnockMock(mock: KnockMock): void;
|
|
60
|
+
/** Restore the framework bindings to the real (queueing) facade singleton. */
|
|
61
|
+
export declare function uninstallKnockMock(): void;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EAER,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,CAAA;CAAE,GAC5C;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,CAAC,mBAAmB,CAAC,CAAA;CAAE,GACnD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,CAAC,CAAA;CAAE,GAChF;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,CAAC,qBAAqB,CAAC,CAAA;CAAE,GACvD;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,CAAC,0BAA0B,CAAC,CAAA;CAAE,GACjE;IAAE,MAAM,EAAE,wBAAwB,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GAC9C;IAAE,MAAM,EAAE,yBAAyB,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,EAAE,CAAA;CAAE,GACpC;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,cAAc,CAAC,CAAA;CAAE,CAAC;AAE7C,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,6DAA6D;IAC7D,YAAY,IAAI;QAAE,MAAM,EAAE,mBAAmB,CAAA;KAAE,GAAG,SAAS,CAAC;IAC5D,kEAAkE;IAClE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,CAAC,CAAC;IAC9E,uEAAuE;IACvE,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC1E,wDAAwD;IACxD,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,IAAI,SAAS,CAuH3C;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEtD;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC"}
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var sdk=require('@knock-ai/sdk'),vue=require('vue');var n=Symbol("knock");var f={install(o,t){sdk.knock.init(t),o.provide(n,sdk.knock);}};function i(){return vue.inject(n,sdk.knock)}var s=vue.defineComponent({name:"KnockButton",inheritAttrs:false,props:{magicLinkId:{type:String,default:void 0},email:{type:String,default:void 0}},emits:["click"],setup(o,{slots:t,attrs:c,emit:k}){let e=i();function r(){o.magicLinkId&&e.scheduling.load({magicLinkId:o.magicLinkId,email:o.email});}function p(d){k("click",d),e.modal.open({magicLinkId:o.magicLinkId,email:o.email});}return ()=>vue.h("button",{type:"button",...c,onClick:p,onPointerenter:r,onFocus:r},t.default?t.default():void 0)}});exports.KNOCK=n;exports.KnockButton=s;exports.KnockPlugin=f;exports.useKnock=i;//# sourceMappingURL=vue.cjs.map
|
|
2
|
+
//# sourceMappingURL=vue.cjs.map
|
package/dist/vue.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/frameworks/vue/inject-key.ts","../src/frameworks/vue/plugin.ts","../src/frameworks/vue/use-knock.ts","../src/frameworks/vue/button.ts"],"names":["KNOCK","KnockPlugin","app","options","knock","useKnock","inject","KnockButton","defineComponent","props","slots","attrs","emit","prewarm","onClick","event","h"],"mappings":"iEAGO,IAAMA,CAAAA,CAAgC,OAAO,OAAO,ECIpD,IAAMC,CAAAA,CAAc,CACzB,OAAA,CAAQC,CAAAA,CAAUC,CAAAA,CAAiC,CACjDC,UAAM,IAAA,CAAKD,CAAO,CAAA,CAClBD,CAAAA,CAAI,QAAQF,CAAAA,CAAOI,SAAK,EAC1B,CACF,ECPO,SAASC,GAAqB,CACnC,OAAOC,UAAAA,CAAON,CAAAA,CAAOI,SAAK,CAC5B,CCJO,IAAMG,EAAcC,mBAAAA,CAAgB,CACzC,IAAA,CAAM,aAAA,CACN,aAAc,KAAA,CACd,KAAA,CAAO,CAEL,WAAA,CAAa,CAAE,IAAA,CAAM,MAAA,CAAwC,OAAA,CAAS,MAAU,EAChF,KAAA,CAAO,CAAE,IAAA,CAAM,MAAA,CAAwC,QAAS,MAAU,CAC5E,CAAA,CACA,KAAA,CAAO,CAAC,OAAO,CAAA,CACf,KAAA,CAAMC,CAAAA,CAAO,CAAE,KAAA,CAAAC,CAAAA,CAAO,KAAA,CAAAC,CAAAA,CAAO,KAAAC,CAAK,CAAA,CAAG,CACnC,IAAMR,EAAQC,CAAAA,EAAS,CAGvB,SAASQ,CAAAA,EAAgB,CACnBJ,CAAAA,CAAM,WAAA,EAAaL,CAAAA,CAAM,UAAA,CAAW,KAAK,CAAE,WAAA,CAAaK,CAAAA,CAAM,WAAA,CAAa,MAAOA,CAAAA,CAAM,KAAM,CAAC,EACrG,CAEA,SAASK,CAAAA,CAAQC,CAAAA,CAAyB,CACxCH,EAAK,OAAA,CAASG,CAAK,CAAA,CACnBX,CAAAA,CAAM,MAAM,IAAA,CAAK,CAAE,WAAA,CAAaK,CAAAA,CAAM,YAAa,KAAA,CAAOA,CAAAA,CAAM,KAAM,CAAC,EACzE,CAEA,OAAO,IACLO,KAAAA,CAAE,SAAU,CAAE,IAAA,CAAM,QAAA,CAAU,GAAGL,EAAO,OAAA,CAAAG,CAAAA,CAAS,cAAA,CAAgBD,CAAAA,CAAS,QAASA,CAAQ,CAAA,CAAGH,CAAAA,CAAM,OAAA,CAAUA,EAAM,OAAA,EAAQ,CAAI,MAAS,CAC7I,CACF,CAAC","file":"vue.cjs","sourcesContent":["import type { InjectionKey } from 'vue';\nimport type { KnockSDK } from '@knock-ai/sdk';\n\nexport const KNOCK: InjectionKey<KnockSDK> = Symbol('knock');\n","import type { App } from 'vue';\nimport type { KnockInitOptions } from '@knock-ai/sdk';\nimport { knock } from '@knock-ai/sdk';\nimport { KNOCK } from './inject-key.js';\n\n// Structural shape only (not Vue's `Plugin<T>` type) so app.use()'s generic\n// overloads infer KnockInitOptions from `install` without version-specific friction.\nexport const KnockPlugin = {\n install(app: App, options: KnockInitOptions): void {\n knock.init(options);\n app.provide(KNOCK, knock);\n },\n};\n","import { inject } from 'vue';\nimport type { KnockSDK } from '@knock-ai/sdk';\nimport { knock } from '@knock-ai/sdk';\nimport { KNOCK } from './inject-key.js';\n\nexport function useKnock(): KnockSDK {\n return inject(KNOCK, knock);\n}\n","import { defineComponent, h, type PropType } from 'vue';\nimport { useKnock } from './use-knock.js';\n\nexport const KnockButton = defineComponent({\n name: 'KnockButton',\n inheritAttrs: false,\n props: {\n /** Omit to open your workspace's default Knock modal. */\n magicLinkId: { type: String as PropType<string | undefined>, default: undefined },\n email: { type: String as PropType<string | undefined>, default: undefined },\n },\n emits: ['click'],\n setup(props, { slots, attrs, emit }) {\n const knock = useKnock();\n\n /** Hover or focus loads the scheduling modal, so a click opens it with times already there. */\n function prewarm(): void {\n if (props.magicLinkId) knock.scheduling.load({ magicLinkId: props.magicLinkId, email: props.email });\n }\n\n function onClick(event: MouseEvent): void {\n emit('click', event);\n knock.modal.open({ magicLinkId: props.magicLinkId, email: props.email });\n }\n\n return () =>\n h('button', { type: 'button', ...attrs, onClick, onPointerenter: prewarm, onFocus: prewarm }, slots.default ? slots.default() : undefined);\n },\n});\n"]}
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {knock}from'@knock-ai/sdk';import {defineComponent,h,inject}from'vue';var n=Symbol("knock");var f={install(o,t){knock.init(t),o.provide(n,knock);}};function i(){return inject(n,knock)}var s=defineComponent({name:"KnockButton",inheritAttrs:false,props:{magicLinkId:{type:String,default:void 0},email:{type:String,default:void 0}},emits:["click"],setup(o,{slots:t,attrs:c,emit:k}){let e=i();function r(){o.magicLinkId&&e.scheduling.load({magicLinkId:o.magicLinkId,email:o.email});}function p(d){k("click",d),e.modal.open({magicLinkId:o.magicLinkId,email:o.email});}return ()=>h("button",{type:"button",...c,onClick:p,onPointerenter:r,onFocus:r},t.default?t.default():void 0)}});export{n as KNOCK,s as KnockButton,f as KnockPlugin,i as useKnock};//# sourceMappingURL=vue.js.map
|
|
2
|
+
//# sourceMappingURL=vue.js.map
|
package/dist/vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/frameworks/vue/inject-key.ts","../src/frameworks/vue/plugin.ts","../src/frameworks/vue/use-knock.ts","../src/frameworks/vue/button.ts"],"names":["KNOCK","KnockPlugin","app","options","knock","useKnock","inject","KnockButton","defineComponent","props","slots","attrs","emit","prewarm","onClick","event","h"],"mappings":"6EAGO,IAAMA,CAAAA,CAAgC,OAAO,OAAO,ECIpD,IAAMC,CAAAA,CAAc,CACzB,OAAA,CAAQC,CAAAA,CAAUC,CAAAA,CAAiC,CACjDC,MAAM,IAAA,CAAKD,CAAO,CAAA,CAClBD,CAAAA,CAAI,QAAQF,CAAAA,CAAOI,KAAK,EAC1B,CACF,ECPO,SAASC,GAAqB,CACnC,OAAOC,MAAAA,CAAON,CAAAA,CAAOI,KAAK,CAC5B,CCJO,IAAMG,EAAcC,eAAAA,CAAgB,CACzC,IAAA,CAAM,aAAA,CACN,aAAc,KAAA,CACd,KAAA,CAAO,CAEL,WAAA,CAAa,CAAE,IAAA,CAAM,MAAA,CAAwC,OAAA,CAAS,MAAU,EAChF,KAAA,CAAO,CAAE,IAAA,CAAM,MAAA,CAAwC,QAAS,MAAU,CAC5E,CAAA,CACA,KAAA,CAAO,CAAC,OAAO,CAAA,CACf,KAAA,CAAMC,CAAAA,CAAO,CAAE,KAAA,CAAAC,CAAAA,CAAO,KAAA,CAAAC,CAAAA,CAAO,KAAAC,CAAK,CAAA,CAAG,CACnC,IAAMR,EAAQC,CAAAA,EAAS,CAGvB,SAASQ,CAAAA,EAAgB,CACnBJ,CAAAA,CAAM,WAAA,EAAaL,CAAAA,CAAM,UAAA,CAAW,KAAK,CAAE,WAAA,CAAaK,CAAAA,CAAM,WAAA,CAAa,MAAOA,CAAAA,CAAM,KAAM,CAAC,EACrG,CAEA,SAASK,CAAAA,CAAQC,CAAAA,CAAyB,CACxCH,EAAK,OAAA,CAASG,CAAK,CAAA,CACnBX,CAAAA,CAAM,MAAM,IAAA,CAAK,CAAE,WAAA,CAAaK,CAAAA,CAAM,YAAa,KAAA,CAAOA,CAAAA,CAAM,KAAM,CAAC,EACzE,CAEA,OAAO,IACLO,CAAAA,CAAE,SAAU,CAAE,IAAA,CAAM,QAAA,CAAU,GAAGL,EAAO,OAAA,CAAAG,CAAAA,CAAS,cAAA,CAAgBD,CAAAA,CAAS,QAASA,CAAQ,CAAA,CAAGH,CAAAA,CAAM,OAAA,CAAUA,EAAM,OAAA,EAAQ,CAAI,MAAS,CAC7I,CACF,CAAC","file":"vue.js","sourcesContent":["import type { InjectionKey } from 'vue';\nimport type { KnockSDK } from '@knock-ai/sdk';\n\nexport const KNOCK: InjectionKey<KnockSDK> = Symbol('knock');\n","import type { App } from 'vue';\nimport type { KnockInitOptions } from '@knock-ai/sdk';\nimport { knock } from '@knock-ai/sdk';\nimport { KNOCK } from './inject-key.js';\n\n// Structural shape only (not Vue's `Plugin<T>` type) so app.use()'s generic\n// overloads infer KnockInitOptions from `install` without version-specific friction.\nexport const KnockPlugin = {\n install(app: App, options: KnockInitOptions): void {\n knock.init(options);\n app.provide(KNOCK, knock);\n },\n};\n","import { inject } from 'vue';\nimport type { KnockSDK } from '@knock-ai/sdk';\nimport { knock } from '@knock-ai/sdk';\nimport { KNOCK } from './inject-key.js';\n\nexport function useKnock(): KnockSDK {\n return inject(KNOCK, knock);\n}\n","import { defineComponent, h, type PropType } from 'vue';\nimport { useKnock } from './use-knock.js';\n\nexport const KnockButton = defineComponent({\n name: 'KnockButton',\n inheritAttrs: false,\n props: {\n /** Omit to open your workspace's default Knock modal. */\n magicLinkId: { type: String as PropType<string | undefined>, default: undefined },\n email: { type: String as PropType<string | undefined>, default: undefined },\n },\n emits: ['click'],\n setup(props, { slots, attrs, emit }) {\n const knock = useKnock();\n\n /** Hover or focus loads the scheduling modal, so a click opens it with times already there. */\n function prewarm(): void {\n if (props.magicLinkId) knock.scheduling.load({ magicLinkId: props.magicLinkId, email: props.email });\n }\n\n function onClick(event: MouseEvent): void {\n emit('click', event);\n knock.modal.open({ magicLinkId: props.magicLinkId, email: props.email });\n }\n\n return () =>\n h('button', { type: 'button', ...attrs, onClick, onPointerenter: prewarm, onFocus: prewarm }, slots.default ? slots.default() : undefined);\n },\n});\n"]}
|