@veroxm/sdk 1.0.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0
4
+
5
+ - `Schemas['ProcessRunDetail']` has `branches`: while a run is on a parallel step, where each branch stands
6
+ (public API 2.3). `processes.run(id)` returns them.
7
+
8
+ ## 1.1.0
9
+
10
+ - `tracker.identifyAccount(accessToken, traits?)`: links the visitor to a signed-in end user's account, checked
11
+ with their own access token, so segments can target `account.role` and `account.emailVerified`, which a page
12
+ can't fake. Needs a VeroXM with accounts linking (public API 2.2); an older one answers 400.
13
+ - `Schemas['IdentifyRequest']`: `userId` is optional, and `accountToken` is new.
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  - Stable: from 1.0, breaking changes come only in a major version, after a deprecation period. What that covers
@@ -589,7 +589,7 @@ export interface paths {
589
589
  };
590
590
  get?: never;
591
591
  put?: never;
592
- /** Link a visitor to your user id */
592
+ /** Link a visitor to your user id, or to a signed-in end user with their accountToken */
593
593
  post: operations["identify"];
594
594
  delete?: never;
595
595
  options?: never;
@@ -957,6 +957,19 @@ export interface components {
957
957
  /** Format: date-time */
958
958
  createdAt: string;
959
959
  }[];
960
+ /** @description While the run is on a parallel step: where each branch stands. */
961
+ branches?: {
962
+ /** @description The parallel step. */
963
+ stepId: string;
964
+ /** @description The branch's key. */
965
+ branch: string;
966
+ /** @description active | waiting_task | done | cancelled (more may be added). */
967
+ status: string;
968
+ /** @description The branch's own step it is on. */
969
+ stepIndex: number;
970
+ /** Format: date-time */
971
+ nextRunAt: string | null;
972
+ }[];
960
973
  };
961
974
  EventInput: {
962
975
  /**
@@ -998,7 +1011,10 @@ export interface components {
998
1011
  };
999
1012
  IdentifyRequest: {
1000
1013
  visitorId: string;
1001
- userId: string;
1014
+ /** @description Your own id for this person. Not with accountToken; ids starting "account:" are refused. */
1015
+ userId?: string;
1016
+ /** @description A signed-in end user's access token: links the visitor to that account (the profile's user id is then "account:<id>"). */
1017
+ accountToken?: string;
1002
1018
  traits?: {
1003
1019
  [key: string]: unknown;
1004
1020
  };
package/dist/tracker.d.ts CHANGED
@@ -98,6 +98,13 @@ export declare class VeroxmTracker {
98
98
  consent(choices: ConsentChoices): Promise<void>;
99
99
  /** Links this visitor to your own user id (e.g. after sign-in) and updates their traits. Needs analytics consent. */
100
100
  identify(userId: string, traits?: Record<string, unknown>): Promise<void>;
101
+ /**
102
+ * Links this visitor to a signed-in end user's account (built-in accounts or your sign-in provider), checked with
103
+ * their own access token, so segments can target account roles that a page can't fake. Needs analytics consent.
104
+ * Call it after sign-in, e.g. `tracker.identifyAccount(await app.auth.getAccessToken())`.
105
+ * @since 1.1.0
106
+ */
107
+ identifyAccount(accessToken: string, traits?: Record<string, unknown>): Promise<void>;
101
108
  /** Call on sign-out: starts a new anonymous visitor on this device. Consent answers are kept. */
102
109
  reset(): void;
103
110
  /**
package/dist/tracker.js CHANGED
@@ -217,6 +217,19 @@ export class VeroxmTracker {
217
217
  await this.post('/identify', { visitorId: this.visitorId, userId, ...(traits ? { traits } : {}) }).catch((e) => this.onError(e));
218
218
  this.changed(); // traits can change which segment the visitor is in
219
219
  }
220
+ /**
221
+ * Links this visitor to a signed-in end user's account (built-in accounts or your sign-in provider), checked with
222
+ * their own access token, so segments can target account roles that a page can't fake. Needs analytics consent.
223
+ * Call it after sign-in, e.g. `tracker.identifyAccount(await app.auth.getAccessToken())`.
224
+ * @since 1.1.0
225
+ */
226
+ async identifyAccount(accessToken, traits) {
227
+ if (!this.canSend())
228
+ return;
229
+ await this.flush();
230
+ await this.post('/identify', { visitorId: this.visitorId, accountToken: accessToken, ...(traits ? { traits } : {}) }).catch((e) => this.onError(e));
231
+ this.changed();
232
+ }
220
233
  /** Call on sign-out: starts a new anonymous visitor on this device. Consent answers are kept. */
221
234
  reset() {
222
235
  this.queue = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veroxm/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "VeroXM client for JavaScript and TypeScript: content, media, experiences, events and the visitor tracker.",
5
5
  "keywords": [
6
6
  "veroxm",