cap-hydra-web-sdk 1.10.5 → 1.10.6

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 CHANGED
@@ -149,23 +149,22 @@ The SDK supports two bootstrap modes, selected by whether `remoteConfigKey` is p
149
149
 
150
150
  The following fields are fetched from Firebase Remote Config. **Do not set them manually.**
151
151
 
152
- | Field | Required | Default | Description |
153
- | ----------------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
154
- | `accountId` | Yes | — | Organization account identifier |
155
- | `baseURL` | Yes | — | API base URL for all SDK requests |
156
- | `orgId` | Yes | — | Organization ID for API authentication |
157
- | `brandId` | No | — | Brand identifier for namespaced database names |
158
- | `applicationId` | No | — | Application identifier for namespaced database names |
159
- | `source` | No | `WEBPUSH` | Source identifier for visitor profiles |
160
- | `channelType` | No | `web` | Communication channel type |
161
- | `sessionTimeoutMinutes` | No | `30` | Session inactivity timeout in minutes |
162
- | `batchSize` | No | `50` | Max events per batch request |
163
- | `debugLevel` | No | `NONE` | Logging level (`NONE` / `ERROR` / `WARN` / `INFO` / `DEBUG` / `VERBOSE`) |
164
- | `gamificationWriteKey` | Yes\* | — | CustomerGlu write key; when present, gamification auto-initializes on user signin. **Required to enable gamification.** |
165
- | `gamificationRegion` | Yes\* | — | CustomerGlu region code (e.g. `'us'`, `'me'`). **Required to enable gamification.** Derives the API base URL automatically. |
166
- | `gamificationBaseUrl` | Yes\* | — | Explicit override for the gamification API base URL. **Required to enable gamification.** Takes precedence over the `gamificationRegion`-derived URL. |
167
-
168
- > \* `gamificationWriteKey`, `gamificationRegion`, and `gamificationBaseUrl` are all required together to enable gamification. Omit all three if gamification is not being used.
152
+ | Field | Required | Default | Description |
153
+ | ----------------------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
154
+ | `accountId` | Yes | — | Organization account identifier |
155
+ | `baseURL` | Yes | — | API base URL for all SDK requests |
156
+ | `orgId` | Yes | — | Organization ID for API authentication |
157
+ | `brandId` | No | — | Brand identifier for namespaced database names |
158
+ | `applicationId` | No | — | Application identifier for namespaced database names |
159
+ | `source` | No | `WEBPUSH` | Source identifier for visitor profiles |
160
+ | `channelType` | No | `web` | Communication channel type |
161
+ | `sessionTimeoutMinutes` | No | `30` | Session inactivity timeout in minutes |
162
+ | `batchSize` | No | `50` | Max events per batch request |
163
+ | `debugLevel` | No | `NONE` | Logging level (`NONE` / `ERROR` / `WARN` / `INFO` / `DEBUG` / `VERBOSE`) |
164
+ | `gamificationWriteKey` | Yes\* | — | Gamification write key; gamification auto-initializes on user signin once this and `gamificationBaseUrl` are set. **Required to enable gamification.** |
165
+ | `gamificationBaseUrl` | Yes\* | — | Gamification API base URL. **Required to enable gamification** — there is no built-in default endpoint. |
166
+
167
+ > \* `gamificationWriteKey` and `gamificationBaseUrl` are both required to enable gamification. Omit both if gamification is not being used.
169
168
 
170
169
  **Example Remote Config JSON** (stored as the value of your `remoteConfigKey` in Firebase Console):
171
170
 
@@ -182,12 +181,11 @@ The following fields are fetched from Firebase Remote Config. **Do not set them
182
181
  "batchSize": 50,
183
182
  "debugLevel": "NONE",
184
183
  "gamificationWriteKey": "wk_live_xxxxxxxxxx",
185
- "gamificationRegion": "us",
186
- "gamificationBaseUrl": "https://api-us.customerglu.com"
184
+ "gamificationBaseUrl": "https://gamification.example.capillarytech.com"
187
185
  }
188
186
  ```
189
187
 
190
- > **Gamification is opt-in.** With the three fields above configured, campaigns and entry points are fetched and rendered automatically after `identify()` — no other host-app code is required beyond placing a `<div id="{hookId}"></div>` for EMBEDDED/NATIVE_BANNER container types. Once a user explicitly closes a campaign, it won't reopen again until a new session starts, by default — no configuration needed. See [DEVELOPER_GUIDE.md §14](DEVELOPER_GUIDE.md#14-gamification-customerglu) for the full container/content-type reference, the session-dismissal rules, and the 7 engagement-tracking events sent automatically alongside `track()`/`pageView()`.
188
+ > **Gamification is opt-in.** With both fields above configured, campaigns and entry points are fetched and rendered automatically after `identify()` — no other host-app code is required beyond placing a `<div id="{hookId}"></div>` for EMBEDDED/NATIVE_BANNER container types. Once a user explicitly closes a campaign, it won't reopen again until a new session starts, by default — no configuration needed. See [DEVELOPER_GUIDE.md §14](DEVELOPER_GUIDE.md#14-gamification) for the full container/content-type reference, the session-dismissal rules, and the 7 engagement-tracking events sent automatically alongside `track()`/`pageView()`.
191
189
 
192
190
  ### Direct-Config Bootstrap (No Firebase)
193
191
 
@@ -199,15 +197,14 @@ HydraSDK.initialize({
199
197
  baseURL: 'https://api.example.capillarytech.com',
200
198
  orgId: '100458',
201
199
  // Everything below is optional (same fields, same defaults as Remote Config bootstrap) —
202
- // except the gamification trio, which is required together only if you want gamification.
200
+ // except the gamification pair, which is required together only if you want gamification.
203
201
  brandId: '1',
204
202
  applicationId: '2',
205
203
  sessionTimeoutMinutes: 30,
206
204
  batchSize: 50,
207
205
  debugLevel: 'NONE',
208
206
  gamificationWriteKey: 'wk_live_xxxxxxxxxx',
209
- gamificationRegion: 'us',
210
- gamificationBaseUrl: 'https://api-us.customerglu.com',
207
+ gamificationBaseUrl: 'https://gamification.example.capillarytech.com',
211
208
  });
212
209
  ```
213
210
 
@@ -263,7 +260,7 @@ HydraSDK.track('button_click', {
263
260
  | `eventName` | `string` | Yes | Name of the event |
264
261
  | `properties` | `Record<string, unknown>` | No | Custom event properties |
265
262
 
266
- If gamification is configured and a CustomerGlu entry point is set up with `triggerType: "ACTION_EVENT"` for this `eventName`, this same `track()` call also evaluates and, if its display conditions pass, opens that entry point — no separate call is needed. Unlike screen-triggered campaigns, an `ACTION_EVENT` entry point isn't rationed by a frequency cap and isn't blocked once its campaign is marked completed — it keeps responding to every occurrence of its event.
263
+ If gamification is configured and a gamification entry point is set up with `triggerType: "ACTION_EVENT"` for this `eventName`, this same `track()` call also evaluates and, if its display conditions pass, opens that entry point — no separate call is needed. Unlike screen-triggered campaigns, an `ACTION_EVENT` entry point isn't rationed by a frequency cap and isn't blocked once its campaign is marked completed — it keeps responding to every occurrence of its event.
267
264
 
268
265
  > **Overlay campaigns queue, they don't stack.** If a matching entry point is a pop-up, bottom sheet, or chat box and another overlay campaign is already open, it waits in a priority-ordered queue and shows automatically once the current one closes — you never see two overlay campaigns on screen at once. Icon buttons, banners, and embeds are unaffected and open immediately. See [DEVELOPER_GUIDE.md's Campaign Queue section](DEVELOPER_GUIDE.md#campaign-queue) for the full ordering/persistence rules.
269
266
 
@@ -414,7 +411,7 @@ const visitorId = HydraSDK.getAnonymousId();
414
411
 
415
412
  ### 7. `enableSDK()`
416
413
 
417
- Re-enables event tracking after it was disabled. Pending events in the queue are processed.
414
+ Re-enables event tracking after it was disabled.
418
415
 
419
416
  ```javascript
420
417
  HydraSDK.enableSDK();
@@ -424,7 +421,7 @@ HydraSDK.enableSDK();
424
421
 
425
422
  ### 8. `disableSDK()`
426
423
 
427
- Disables event tracking (e.g. when tracking consent is declined). New `track()`/`pageView()` events and scroll-depth auto-tracking are dropped. Existing queued events are preserved in IndexedDB and will be sent when the SDK is re-enabled.
424
+ Disables event tracking (e.g. when tracking consent is declined). New `track()`/`pageView()` events and scroll-depth auto-tracking are dropped. Events already in the queue are still sent.
428
425
 
429
426
  User identity events (`identify()`, `reset()`, `pushUserSignin`/`pushUserSignup`/`pushUserUpdate`/`pushUserSignOut`) and gamification events continue to be tracked regardless of `disableSDK()` — they are not behavioral analytics and must keep flowing even when tracking consent is not given.
430
427
 
@@ -525,7 +522,7 @@ HydraSDK.onScreenChanged('checkout');
525
522
 
526
523
  ### 16. `setTheme(theme)`
527
524
 
528
- Sets the gamification theme. Appends a `darkMode=true`/`darkMode=false` query param to every campaign/loyalty embed URL the SDK loads from this point on (so the CustomerGlu-hosted content can theme itself), and switches the color scheme of the SDK's own container chrome and hand-built widgets.
525
+ Sets the gamification theme. Appends a `darkMode=true`/`darkMode=false` query param to every campaign/loyalty embed URL the SDK loads from this point on (so the hosted content can theme itself), and switches the color scheme of the SDK's own container chrome and hand-built widgets.
529
526
 
530
527
  ```javascript
531
528
  HydraSDK.setTheme('DARK');
package/dist/index.d.ts CHANGED
@@ -90,7 +90,6 @@ interface WebSDKConfig {
90
90
  */
91
91
  appVersion?: string;
92
92
  gamificationWriteKey?: string;
93
- gamificationRegion?: string;
94
93
  gamificationBaseUrl?: string;
95
94
  accountId?: string;
96
95
  baseURL?: string;
@@ -492,7 +491,6 @@ declare class WebSDK {
492
491
  private userOperationChain;
493
492
  private apiClient;
494
493
  private gamificationManager;
495
- private gamificationBaseUrl;
496
494
  /**
497
495
  * Buffers the last setGamificationCallback() call. init() is fire-and-forget — the Remote
498
496
  * Config fetch, and therefore gamificationManager's construction, can still be in flight when
@@ -880,15 +878,14 @@ declare class WebSDK {
880
878
  */
881
879
  private pushEventAsync;
882
880
  /**
883
- * Disable the SDK. Stops all event tracking immediately.
884
- * New events are silently dropped. Queued events are paused (not deleted).
885
- * The SDK remains initialized but inactive.
881
+ * Disable behavioral event tracking. New track()/pageView()/scroll-depth events are dropped
882
+ * at pushEventAsync(). The event queue keeps processing, so consent-exempt events (user
883
+ * identity, gamification, DLR) and anything already queued are still sent.
886
884
  * Note: Consent storage is handled by the UI layer, not by the SDK.
887
885
  */
888
886
  disableSDK(): void;
889
887
  /**
890
- * Re-enable the SDK. Resumes event tracking and queue processing.
891
- * Does not require re-initialization.
888
+ * Re-enable behavioral event tracking. Does not require re-initialization.
892
889
  * Note: Consent storage is handled by the UI layer, not by the SDK.
893
890
  */
894
891
  enableSDK(): void;
@@ -898,10 +895,9 @@ declare class WebSDK {
898
895
  * @returns The channel type string from Remote Config (defaults to 'web')
899
896
  */
900
897
  getChannelType(): string;
901
- private resolveGamificationBaseUrl;
902
898
  /**
903
- * Fills defaults for anything not already set on this.config, derives the gamification base/
904
- * stream URLs, and wires the logger's enabled state. Shared by both bootstrap paths — by the
899
+ * Fills defaults for anything not already set on this.config and wires the logger's enabled
900
+ * state. Shared by both bootstrap paths — by the
905
901
  * time this runs, this.config already has accountId/baseURL/orgId (either freshly parsed from
906
902
  * Remote Config or supplied directly by the host in direct-config bootstrap).
907
903
  */