@xenia-martech/sdk-js 1.0.0-dev.26 → 1.0.0-dev.27
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/README.md +21 -1
- package/dist/{actions-DFLoSXO_.d.cts → actions-CkiSdvSa.d.cts} +65 -5
- package/dist/{actions-DFLoSXO_.d.ts → actions-CkiSdvSa.d.ts} +65 -5
- package/dist/{chunk-D37RD3UC.js → chunk-7D2HJMW6.js} +31 -3
- package/dist/chunk-7D2HJMW6.js.map +1 -0
- package/dist/{chunk-3KYKKIIG.cjs → chunk-UOW3GK4I.cjs} +32 -2
- package/dist/chunk-UOW3GK4I.cjs.map +1 -0
- package/dist/client/index.cjs +73 -8
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +73 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/react/index.cjs +73 -8
- package/dist/client/react/index.cjs.map +1 -1
- package/dist/client/react/index.d.cts +2 -2
- package/dist/client/react/index.d.ts +2 -2
- package/dist/client/react/index.js +73 -8
- package/dist/client/react/index.js.map +1 -1
- package/dist/{cookie-names-LgNDAreS.d.cts → cookie-names-C3LKDhsg.d.cts} +34 -0
- package/dist/{cookie-names-LgNDAreS.d.ts → cookie-names-C3LKDhsg.d.ts} +34 -0
- package/dist/index.cjs +23 -19
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +1 -1
- package/dist/server/index.cjs +53 -22
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +31 -11
- package/dist/server/index.d.ts +31 -11
- package/dist/server/index.js +43 -12
- package/dist/server/index.js.map +1 -1
- package/dist/xenia-sdk.iife.js +3 -3
- package/dist/xenia-sdk.iife.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3KYKKIIG.cjs.map +0 -1
- package/dist/chunk-D37RD3UC.js.map +0 -1
package/dist/client/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InteractionType, X as XeniaConfig, a as XeniaEvent, M as MessageCta, b as MessageTemplateFn, c as MessageComponentRenderer, d as XeniaAction } from '../actions-
|
|
2
|
-
export { A as AnalyticsContext, e as AnalyticsEventName, f as AnalyticsIdentity, g as AnalyticsIngestResponse, C as ClientEvent, h as ConsentState, i as ContentSwap, j as IdentifyRequest, k as IdentifyResponse, l as Identity, J as JsonValue, m as MessageMountContext, n as MessagePlacement, o as MessageRenderContext, P as PersonalizationSwap, R as ResolveBatchItem, p as ResolveBatchResult, q as ResolveOptions, r as ResolveResult, T as TrackOptions, W as WebhookResponse, s as XeniaClient, t as XeniaClientOptions, u as createXeniaClient, v as extractContentSwaps, w as parseActions, x as spliceSlots } from '../actions-
|
|
1
|
+
import { I as InteractionType, X as XeniaConfig, a as XeniaEvent, M as MessageCta, b as MessageTemplateFn, c as MessageComponentRenderer, d as XeniaAction } from '../actions-CkiSdvSa.cjs';
|
|
2
|
+
export { A as AnalyticsContext, e as AnalyticsEventName, f as AnalyticsIdentity, g as AnalyticsIngestResponse, C as ClientEvent, h as ConsentState, i as ContentSwap, j as IdentifyRequest, k as IdentifyResponse, l as Identity, J as JsonValue, m as MessageMountContext, n as MessagePlacement, o as MessageRenderContext, P as PersonalizationSwap, R as ResolveBatchItem, p as ResolveBatchResult, q as ResolveOptions, r as ResolveResult, T as TrackOptions, W as WebhookResponse, s as XeniaClient, t as XeniaClientOptions, u as createXeniaClient, v as extractContentSwaps, w as parseActions, x as spliceSlots } from '../actions-CkiSdvSa.cjs';
|
|
3
3
|
|
|
4
4
|
interface Parsed {
|
|
5
5
|
eventId: string;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as InteractionType, X as XeniaConfig, a as XeniaEvent, M as MessageCta, b as MessageTemplateFn, c as MessageComponentRenderer, d as XeniaAction } from '../actions-
|
|
2
|
-
export { A as AnalyticsContext, e as AnalyticsEventName, f as AnalyticsIdentity, g as AnalyticsIngestResponse, C as ClientEvent, h as ConsentState, i as ContentSwap, j as IdentifyRequest, k as IdentifyResponse, l as Identity, J as JsonValue, m as MessageMountContext, n as MessagePlacement, o as MessageRenderContext, P as PersonalizationSwap, R as ResolveBatchItem, p as ResolveBatchResult, q as ResolveOptions, r as ResolveResult, T as TrackOptions, W as WebhookResponse, s as XeniaClient, t as XeniaClientOptions, u as createXeniaClient, v as extractContentSwaps, w as parseActions, x as spliceSlots } from '../actions-
|
|
1
|
+
import { I as InteractionType, X as XeniaConfig, a as XeniaEvent, M as MessageCta, b as MessageTemplateFn, c as MessageComponentRenderer, d as XeniaAction } from '../actions-CkiSdvSa.js';
|
|
2
|
+
export { A as AnalyticsContext, e as AnalyticsEventName, f as AnalyticsIdentity, g as AnalyticsIngestResponse, C as ClientEvent, h as ConsentState, i as ContentSwap, j as IdentifyRequest, k as IdentifyResponse, l as Identity, J as JsonValue, m as MessageMountContext, n as MessagePlacement, o as MessageRenderContext, P as PersonalizationSwap, R as ResolveBatchItem, p as ResolveBatchResult, q as ResolveOptions, r as ResolveResult, T as TrackOptions, W as WebhookResponse, s as XeniaClient, t as XeniaClientOptions, u as createXeniaClient, v as extractContentSwaps, w as parseActions, x as spliceSlots } from '../actions-CkiSdvSa.js';
|
|
3
3
|
|
|
4
4
|
interface Parsed {
|
|
5
5
|
eventId: string;
|
package/dist/client/index.js
CHANGED
|
@@ -964,6 +964,40 @@ var Identity = class {
|
|
|
964
964
|
return null;
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
|
+
// ── Customer id / email ──────────────────────────────────────────────────
|
|
968
|
+
//
|
|
969
|
+
// Ambient, persisted the same way as the visitor id, so a value set once
|
|
970
|
+
// (typically alongside `identify()`) rides on every later `resolve()` call
|
|
971
|
+
// without the caller having to pass it again — the SDK-provided-fields
|
|
972
|
+
// parity list on the Personalization Resolve trigger includes both.
|
|
973
|
+
setCustomerId(customerId) {
|
|
974
|
+
try {
|
|
975
|
+
if (customerId) localStorage.setItem(this.key("customer_id"), customerId);
|
|
976
|
+
else localStorage.removeItem(this.key("customer_id"));
|
|
977
|
+
} catch {
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
getCustomerId() {
|
|
981
|
+
try {
|
|
982
|
+
return localStorage.getItem(this.key("customer_id"));
|
|
983
|
+
} catch {
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
setEmail(email) {
|
|
988
|
+
try {
|
|
989
|
+
if (email) localStorage.setItem(this.key("email"), email);
|
|
990
|
+
else localStorage.removeItem(this.key("email"));
|
|
991
|
+
} catch {
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
getEmail() {
|
|
995
|
+
try {
|
|
996
|
+
return localStorage.getItem(this.key("email"));
|
|
997
|
+
} catch {
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
967
1001
|
// ── Session id ───────────────────────────────────────────────────────────────
|
|
968
1002
|
/**
|
|
969
1003
|
* Resolve the current session id: reused while activity continues within
|
|
@@ -1427,10 +1461,16 @@ var XeniaClient = class {
|
|
|
1427
1461
|
* Persist a visitor id, attached to every subsequent event, and bind it to
|
|
1428
1462
|
* a known user server-side (`POST /api/events/v1/identify`, fire-and-
|
|
1429
1463
|
* forget — resolves to an `"identify"` client event carrying `personId`).
|
|
1464
|
+
*
|
|
1465
|
+
* `extra.customerId`/`extra.email`, when supplied, are also persisted
|
|
1466
|
+
* ambiently (like the visitor id) so they ride on every later `resolve()`
|
|
1467
|
+
* call automatically — part of the SDK-provided-fields parity list.
|
|
1430
1468
|
*/
|
|
1431
|
-
identify(visitorId) {
|
|
1469
|
+
identify(visitorId, extra) {
|
|
1432
1470
|
this.identity.identify(visitorId);
|
|
1433
|
-
|
|
1471
|
+
if (extra?.customerId !== void 0) this.identity.setCustomerId(extra.customerId);
|
|
1472
|
+
if (extra?.email !== void 0) this.identity.setEmail(extra.email);
|
|
1473
|
+
void this.api.identify({ xeniaVisitorId: visitorId, userId: extra?.customerId, email: extra?.email }).then((res) => this.emit("identify", res)).catch((err) => this.emitError(err));
|
|
1434
1474
|
}
|
|
1435
1475
|
/** Override the customer-journey UUID (else derived from utm_id). */
|
|
1436
1476
|
setJourneyId(id) {
|
|
@@ -1548,15 +1588,40 @@ var XeniaClient = class {
|
|
|
1548
1588
|
return this.identity.getVisitorId() ?? this.identity.getDeviceId() ?? void 0;
|
|
1549
1589
|
}
|
|
1550
1590
|
/**
|
|
1551
|
-
* Stamp the SDK-
|
|
1552
|
-
* `
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
1591
|
+
* Stamp the full set of SDK-provided fields into the resolve `data` —
|
|
1592
|
+
* `path`, `query`, `deviceId`, `visitorId`, `customerId`, `email`, `url`,
|
|
1593
|
+
* `referrer`, and the five `utm*` fields — the same field-name/type parity
|
|
1594
|
+
* the webhook trigger's "SDK-provided fields" already promises, now native
|
|
1595
|
+
* (always attached, no marketer toggle) for the Personalization Resolve
|
|
1596
|
+
* trigger too. Plus the reserved `_xenia_vid` key the backend reads for
|
|
1597
|
+
* holdout/exposure bucketing. All of these are spread LAST (after the
|
|
1598
|
+
* caller's own `data`) so none can be overridden per call — the same
|
|
1599
|
+
* override-protection guarantee `_xenia_vid` alone used to have, now
|
|
1600
|
+
* widened to the full set. A no-op (returns `opts` unchanged) when nothing
|
|
1601
|
+
* is resolvable yet (e.g. called before `init()` on a fresh visit with no
|
|
1602
|
+
* page context available).
|
|
1555
1603
|
*/
|
|
1556
1604
|
withVisitor(opts) {
|
|
1605
|
+
const ctx = this.identity.collectContext();
|
|
1557
1606
|
const vid = this.resolveVisitorId();
|
|
1558
|
-
|
|
1559
|
-
|
|
1607
|
+
const sdkFields = compact({
|
|
1608
|
+
path: ctx.path,
|
|
1609
|
+
query: ctx.query,
|
|
1610
|
+
deviceId: this.identity.getDeviceId() ?? void 0,
|
|
1611
|
+
visitorId: vid,
|
|
1612
|
+
customerId: this.identity.getCustomerId() ?? void 0,
|
|
1613
|
+
email: this.identity.getEmail() ?? void 0,
|
|
1614
|
+
url: ctx.url,
|
|
1615
|
+
referrer: ctx.referrer,
|
|
1616
|
+
utmSource: ctx.utmSource,
|
|
1617
|
+
utmMedium: ctx.utmMedium,
|
|
1618
|
+
utmCampaign: ctx.utmCampaign,
|
|
1619
|
+
utmContent: ctx.utmContent,
|
|
1620
|
+
utmId: ctx.utmId
|
|
1621
|
+
});
|
|
1622
|
+
if (vid) sdkFields._xenia_vid = vid;
|
|
1623
|
+
if (Object.keys(sdkFields).length === 0) return opts;
|
|
1624
|
+
return { ...opts, data: { ...opts?.data ?? {}, ...sdkFields } };
|
|
1560
1625
|
}
|
|
1561
1626
|
dntBlocked() {
|
|
1562
1627
|
if (this.options.respectDnt === false) return false;
|