@ebitex/visitors-sdk 0.1.229 → 0.1.237
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/dist/dropIn.d.ts +4 -0
- package/dist/dropIn.d.ts.map +1 -1
- package/dist/dropIn.js +8 -0
- package/dist/dropIn.js.map +1 -1
- package/dist/embeds.d.ts +40 -0
- package/dist/embeds.d.ts.map +1 -0
- package/dist/embeds.js +106 -0
- package/dist/embeds.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/dropIn.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ import type { Visitors } from './types.js';
|
|
|
18
18
|
* `<meta name="ebitex:categories" content="id,id,...">` (a published page's `classification` from the Content Delivery API has them), and the script records one `content.viewed` event for
|
|
19
19
|
* them. A page without that tag records nothing. A single-page app calls `window.ebitexVisitors.pageViewed({ categories })` on each route change instead.
|
|
20
20
|
*
|
|
21
|
+
* `data-ebitex-embeds` lets an ebitex form embedded in an `<iframe>` on the page recognise the same visitor as the page, in
|
|
22
|
+
* browsers where a frame can hold no cookie (see `connectEmbeds`). It is off unless you ask. `data-ebitex-forms-origin` names the
|
|
23
|
+
* form host when it is not `https://forms.ebitex.io`.
|
|
24
|
+
*
|
|
21
25
|
* Attributes on a control: `data-ebitex-forget-confirm="off"` to skip the confirmation question, `data-ebitex-done-text`
|
|
22
26
|
* and `data-ebitex-error-text` for your own wording, and `data-ebitex-forget-status="#id"` to say where the result goes
|
|
23
27
|
* (by default a status line is added after the control). After a successful forget a `ebitex:visitor-forgotten` event
|
package/dist/dropIn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropIn.d.ts","sourceRoot":"","sources":["../src/dropIn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dropIn.d.ts","sourceRoot":"","sources":["../src/dropIn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAK1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,QAAmB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,IAAI,CA2B3F"}
|
package/dist/dropIn.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { connectEmbeds } from './embeds.js';
|
|
1
2
|
import { createVisitors } from './visitors.js';
|
|
2
3
|
/** What the visitor sees if forgetting fails and the page gave no wording of its own. */
|
|
3
4
|
const DEFAULT_ERROR_TEXT = 'Something went wrong. Please try again.';
|
|
@@ -20,6 +21,10 @@ const DEFAULT_ERROR_TEXT = 'Something went wrong. Please try again.';
|
|
|
20
21
|
* `<meta name="ebitex:categories" content="id,id,...">` (a published page's `classification` from the Content Delivery API has them), and the script records one `content.viewed` event for
|
|
21
22
|
* them. A page without that tag records nothing. A single-page app calls `window.ebitexVisitors.pageViewed({ categories })` on each route change instead.
|
|
22
23
|
*
|
|
24
|
+
* `data-ebitex-embeds` lets an ebitex form embedded in an `<iframe>` on the page recognise the same visitor as the page, in
|
|
25
|
+
* browsers where a frame can hold no cookie (see `connectEmbeds`). It is off unless you ask. `data-ebitex-forms-origin` names the
|
|
26
|
+
* form host when it is not `https://forms.ebitex.io`.
|
|
27
|
+
*
|
|
23
28
|
* Attributes on a control: `data-ebitex-forget-confirm="off"` to skip the confirmation question, `data-ebitex-done-text`
|
|
24
29
|
* and `data-ebitex-error-text` for your own wording, and `data-ebitex-forget-status="#id"` to say where the result goes
|
|
25
30
|
* (by default a status line is added after the control). After a successful forget a `ebitex:visitor-forgotten` event
|
|
@@ -43,6 +48,9 @@ export function startDropIn(doc = document, signal) {
|
|
|
43
48
|
// Never throws into the page: a view that could not be recorded is not worth a console error on every load.
|
|
44
49
|
void visitors.pageViewed({ categories }).catch(() => undefined);
|
|
45
50
|
}
|
|
51
|
+
if (script.dataset.ebitexEmbeds !== undefined && script.dataset.ebitexEmbeds !== 'off') {
|
|
52
|
+
connectEmbeds(visitors, { formsOrigin: script.dataset.ebitexFormsOrigin || undefined, signal });
|
|
53
|
+
}
|
|
46
54
|
doc.addEventListener('click', (event) => {
|
|
47
55
|
const control = event.target?.closest('[data-ebitex-forget]');
|
|
48
56
|
if (!control)
|
package/dist/dropIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropIn.js","sourceRoot":"","sources":["../src/dropIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,yFAAyF;AACzF,MAAM,kBAAkB,GAAG,yCAAyC,CAAA;AAEpE
|
|
1
|
+
{"version":3,"file":"dropIn.js","sourceRoot":"","sources":["../src/dropIn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAG9C,yFAAyF;AACzF,MAAM,kBAAkB,GAAG,yCAAyC,CAAA;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,WAAW,CAAC,MAAgB,QAAQ,EAAE,MAAoB;IACxE,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,CAAc,yBAAyB,CAAC,CAAA;IACxE,MAAM,GAAG,GAAG,MAAM,EAAE,OAAO,CAAC,SAAS,CAAA;IACrC,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IAEhC,MAAM,QAAQ,GAAG,cAAc,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc,IAAI,SAAS,EAAE,CAAC,CAC7F;IAAC,GAAG,CAAC,WAAgE,CAAC,cAAc,GAAG,QAAQ,CAAA;IAChG,IAAI,MAAM,CAAC,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,IAAI,MAAM,GAAuB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAc,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3F,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACvC,MAAM,GAAG,IAAI,YAAY,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,sBAAsB,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IACtG,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAClC,MAAM,CAAC,OAAO,CAAC,sBAAsB,GAAG,MAAM,CAAA;QAC9C,OAAO,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACnD,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACzD,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAClE,MAAM,CAAC,WAAW,GAAG,IAAI,CAAA;AAC3B,CAAC"}
|
package/dist/embeds.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Visitors } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Lets an ebitex form embedded in an `<iframe>` on this page recognise the same visitor as the page, in browsers where a
|
|
4
|
+
* frame can hold no cookie of its own.
|
|
5
|
+
*
|
|
6
|
+
* The form frame announces itself; this answers with the page's token, sent only to the form host's exact origin (read from
|
|
7
|
+
* the iframe's own `src`), never to `*` and never in a URL. What the frame sends back is a token and a consent state, which
|
|
8
|
+
* go through {@link Visitors.adopt}, so they are kept on the device only under the same rules as any other answer. A visitor
|
|
9
|
+
* who uses "forget this browser" inside the frame is forgotten here too (the suite-wide forget, which also ends the link to
|
|
10
|
+
* a person).
|
|
11
|
+
*
|
|
12
|
+
* Nothing happens unless you call it, and a page with no ebitex iframes is unaffected. Only iframes of this page whose
|
|
13
|
+
* `src` is on one of the given origins are ever answered.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_FORMS_ORIGIN = "https://forms.ebitex.io";
|
|
16
|
+
export interface ConnectEmbedsOptions {
|
|
17
|
+
/** The origin(s) the form frames are served from. Defaults to {@link DEFAULT_FORMS_ORIGIN}. */
|
|
18
|
+
formsOrigin?: string | readonly string[];
|
|
19
|
+
/** Stops answering frames. */
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
/** For tests. */
|
|
22
|
+
window?: EmbedsWindow;
|
|
23
|
+
}
|
|
24
|
+
/** The part of `window` this needs. */
|
|
25
|
+
export interface EmbedsWindow {
|
|
26
|
+
document: {
|
|
27
|
+
getElementsByTagName(name: 'iframe'): ArrayLike<{
|
|
28
|
+
src: string;
|
|
29
|
+
contentWindow: EmbedFrameWindow | null;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
addEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
|
|
33
|
+
removeEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
|
|
34
|
+
}
|
|
35
|
+
export interface EmbedFrameWindow {
|
|
36
|
+
postMessage(message: unknown, targetOrigin: string): void;
|
|
37
|
+
}
|
|
38
|
+
/** Returns a function that stops. */
|
|
39
|
+
export declare function connectEmbeds(visitors: Visitors, options?: ConnectEmbedsOptions): () => void;
|
|
40
|
+
//# sourceMappingURL=embeds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeds.d.ts","sourceRoot":"","sources":["../src/embeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,4BAA4B,CAAA;AAE7D,MAAM,WAAW,oBAAoB;IACnC,+FAA+F;IAC/F,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;IACxC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,iBAAiB;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE;QAAE,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;IACtH,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAA;IAChF,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAA;CACpF;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1D;AAiBD,qCAAqC;AACrC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,oBAAyB,GAAG,MAAM,IAAI,CAuEhG"}
|
package/dist/embeds.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lets an ebitex form embedded in an `<iframe>` on this page recognise the same visitor as the page, in browsers where a
|
|
3
|
+
* frame can hold no cookie of its own.
|
|
4
|
+
*
|
|
5
|
+
* The form frame announces itself; this answers with the page's token, sent only to the form host's exact origin (read from
|
|
6
|
+
* the iframe's own `src`), never to `*` and never in a URL. What the frame sends back is a token and a consent state, which
|
|
7
|
+
* go through {@link Visitors.adopt}, so they are kept on the device only under the same rules as any other answer. A visitor
|
|
8
|
+
* who uses "forget this browser" inside the frame is forgotten here too (the suite-wide forget, which also ends the link to
|
|
9
|
+
* a person).
|
|
10
|
+
*
|
|
11
|
+
* Nothing happens unless you call it, and a page with no ebitex iframes is unaffected. Only iframes of this page whose
|
|
12
|
+
* `src` is on one of the given origins are ever answered.
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_FORMS_ORIGIN = 'https://forms.ebitex.io';
|
|
15
|
+
const SOURCE = 'ebitex-forms-embed';
|
|
16
|
+
const VERSION = 1;
|
|
17
|
+
function readMessage(data) {
|
|
18
|
+
if (data === null || typeof data !== 'object')
|
|
19
|
+
return null;
|
|
20
|
+
const message = data;
|
|
21
|
+
if (message.source !== SOURCE || message.v !== VERSION || typeof message.type !== 'string')
|
|
22
|
+
return null;
|
|
23
|
+
return message;
|
|
24
|
+
}
|
|
25
|
+
/** Returns a function that stops. */
|
|
26
|
+
export function connectEmbeds(visitors, options = {}) {
|
|
27
|
+
const win = options.window ?? (typeof window === 'undefined' ? undefined : window);
|
|
28
|
+
if (!win)
|
|
29
|
+
return () => undefined;
|
|
30
|
+
const origins = new Set((Array.isArray(options.formsOrigin) ? options.formsOrigin : [options.formsOrigin ?? DEFAULT_FORMS_ORIGIN]).map(normaliseOrigin));
|
|
31
|
+
// The frames this page has answered, and the token each was last given, so a change reaches them and a repeat does not ping-pong.
|
|
32
|
+
const answered = new Map();
|
|
33
|
+
function frameOf(source) {
|
|
34
|
+
if (source === null)
|
|
35
|
+
return null;
|
|
36
|
+
for (const frame of Array.from(win.document.getElementsByTagName('iframe'))) {
|
|
37
|
+
const frameWindow = frame.contentWindow;
|
|
38
|
+
if (frameWindow === null || frameWindow !== source)
|
|
39
|
+
continue;
|
|
40
|
+
const origin = originOf(frame.src);
|
|
41
|
+
return origin !== null && origins.has(origin) ? { window: frameWindow, origin } : null;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function give(frame, origin, token) {
|
|
46
|
+
answered.set(frame, { origin, sent: token });
|
|
47
|
+
frame.postMessage({ source: SOURCE, v: VERSION, type: 'visitor', token }, origin);
|
|
48
|
+
}
|
|
49
|
+
const listener = (event) => {
|
|
50
|
+
const message = readMessage(event.data);
|
|
51
|
+
if (message === null)
|
|
52
|
+
return;
|
|
53
|
+
const frame = frameOf(event.source);
|
|
54
|
+
// Only a frame of this page, served from the form host, and speaking from that host's origin.
|
|
55
|
+
if (frame === null || event.origin !== frame.origin)
|
|
56
|
+
return;
|
|
57
|
+
if (message.type === 'ready') {
|
|
58
|
+
void visitors.ready.then(() => give(frame.window, frame.origin, visitors.token));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// Anything else is a reply, and only to a frame this page has spoken to.
|
|
62
|
+
const known = answered.get(frame.window);
|
|
63
|
+
if (!known)
|
|
64
|
+
return;
|
|
65
|
+
if (message.type === 'visitor-result') {
|
|
66
|
+
if (typeof message.visitor !== 'string' || message.visitor === '' || message.consent === null || typeof message.consent !== 'object')
|
|
67
|
+
return;
|
|
68
|
+
// Set before adopting: adopting notifies, and the frame that just answered must not be sent the token it just sent.
|
|
69
|
+
known.sent = message.visitor;
|
|
70
|
+
void visitors.adopt({ visitor: message.visitor, consent: message.consent }).catch(() => undefined);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (message.type === 'forgotten') {
|
|
74
|
+
void visitors.forget().catch(() => undefined);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
win.addEventListener('message', listener);
|
|
78
|
+
// The page's token arrives or changes after a frame announced itself (the visitor's consent answered late, a sibling frame
|
|
79
|
+
// rotated the token): tell every frame that has not been given this one. A frame that has not announced is never sent anything.
|
|
80
|
+
const unsubscribe = visitors.subscribe(({ token }) => {
|
|
81
|
+
for (const [frame, state] of answered) {
|
|
82
|
+
if (state.sent !== token)
|
|
83
|
+
give(frame, state.origin, token);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const stop = () => {
|
|
87
|
+
win.removeEventListener('message', listener);
|
|
88
|
+
unsubscribe();
|
|
89
|
+
answered.clear();
|
|
90
|
+
};
|
|
91
|
+
options.signal?.addEventListener('abort', stop, { once: true });
|
|
92
|
+
return stop;
|
|
93
|
+
}
|
|
94
|
+
function originOf(url) {
|
|
95
|
+
try {
|
|
96
|
+
const origin = new URL(url).origin;
|
|
97
|
+
return origin === 'null' ? null : origin;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function normaliseOrigin(value) {
|
|
104
|
+
return originOf(value) ?? value;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=embeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeds.js","sourceRoot":"","sources":["../src/embeds.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,yBAAyB,CAAA;AAsB7D,MAAM,MAAM,GAAG,oBAAoB,CAAA;AACnC,MAAM,OAAO,GAAG,CAAC,CAAA;AAOjB,SAAS,WAAW,CAAC,IAAa;IAChC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1D,MAAM,OAAO,GAAG,IAA+B,CAAA;IAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,KAAK,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACvG,OAAO,OAAkB,CAAA;AAC3B,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,UAAgC,EAAE;IAClF,MAAM,GAAG,GAA6B,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SA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AI,CAAA;IACb,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAA;AACjC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { createVisitors } from './visitors.js';
|
|
2
2
|
export { cookieStorage } from './storage.js';
|
|
3
|
+
export { connectEmbeds, DEFAULT_FORMS_ORIGIN } from './embeds.js';
|
|
4
|
+
export type { ConnectEmbedsOptions } from './embeds.js';
|
|
3
5
|
export type { CookieStorageOptions } from './storage.js';
|
|
4
6
|
export { VisitorsApiError, DEFAULT_ENDPOINT } from './client.js';
|
|
5
7
|
export type { ConsentMessages, ConsentOptions, ConsentSignals, ConsentState, EventInput, EventResult, InteractionOptions, InteractionResult, Visitors, VisitorSession, VisitorsOptions, VisitorsSnapshot, VisitorStorage, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAChE,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAChE,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebitex/visitors-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.237",
|
|
4
4
|
"description": "Recognise a returning visitor with their consent, honour Global Privacy Control and your own consent tool, and let them forget their device, from any site. No forms needed.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ebitex",
|