flowgrid-sdk 1.7.8 → 1.8.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/README.md +3 -1
- package/dist/flowgrid.min.js +1 -1
- package/dist/flowgrid.min.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/consent/index.d.ts +1 -0
- package/dist/lib/consent/index.js +3 -1
- package/dist/lib/consent/index.js.map +1 -1
- package/dist/lib/consent/manager.js +8 -0
- package/dist/lib/consent/manager.js.map +1 -1
- package/dist/lib/consent/registry.d.ts +37 -0
- package/dist/lib/consent/registry.js +61 -0
- package/dist/lib/consent/registry.js.map +1 -0
- package/dist/lib/consent/types.d.ts +8 -0
- package/dist/lib/features/core/activation.d.ts +14 -0
- package/dist/lib/features/core/activation.js +23 -0
- package/dist/lib/features/core/activation.js.map +1 -1
- package/dist/lib/flowgrid.d.ts +38 -2
- package/dist/lib/flowgrid.js +46 -10
- package/dist/lib/flowgrid.js.map +1 -1
- package/dist/lib/server/index.d.ts +3 -1
- package/dist/lib/server/index.js +6 -5
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/tracking/core/activation.d.ts +5 -0
- package/dist/lib/tracking/core/activation.js +4 -0
- package/dist/lib/tracking/core/activation.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export { getCookie, getVisitorId, getSessionId, getWebId, getUTM, getUTMHistory,
|
|
|
46
46
|
export type { FlowGridUTM, FlowGridUTMHistoryEntry, } from "./lib/utils/storage";
|
|
47
47
|
export { IdentityManager } from "./lib/utils/identity";
|
|
48
48
|
export type { IdentityConfig, ServerCookieReader, } from "./lib/utils/identity";
|
|
49
|
-
export { ConsentManager, wireDeclarativeBanners } from "./lib/consent";
|
|
49
|
+
export { ConsentManager, wireDeclarativeBanners, grantConsentOnAuth } from "./lib/consent";
|
|
50
50
|
export type { ConsentConfig, ConsentPreferences, ConsentCategory as ConsentCategoryType, ConsentChangeEvent, CookieBannerConfig, CookieBannerTheme, WireDeclarativeBannersOptions, DeclarativeBannersHandle, } from "./lib/consent";
|
|
51
51
|
export { getOrCreateAnonId, getOrCreateCartId, resetCartId, setupConsent, attachConsentBanner, renderConsentBanner, } from "./lib/helpers";
|
|
52
52
|
export type { ConsentBannerOptions, ConsentBannerHandle, RenderConsentBannerOptions, } from "./lib/helpers";
|
package/dist/index.js
CHANGED
|
@@ -31,8 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.
|
|
35
|
-
exports.renderConsentBanner = exports.attachConsentBanner = exports.setupConsent = exports.resetCartId = void 0;
|
|
34
|
+
exports.getOrCreateAnonId = exports.grantConsentOnAuth = exports.wireDeclarativeBanners = exports.ConsentManager = exports.IdentityManager = exports.getUTMHistory = exports.getUTM = exports.getWebId = exports.getSessionId = exports.getVisitorId = exports.getCookie = exports.Forecasting = exports.SecurityAnalytics = exports.AlertsAnalytics = exports.PathAnalytics = exports.AcquisitionAnalytics = exports.SupportAnalytics = exports.MultiPathFunnels = exports.Monetization = exports.ChurnAnalytics = exports.Cohorts = exports.Engagement = exports.FlowGridTransport = exports.Subscriptions = exports.SearchAnalytics = exports.CustomerLTV = exports.WishlistTracking = exports.Promotions = exports.Refunds = exports.Purchases = exports.Checkout = exports.CartTracking = exports.Products = exports.SessionReplay = exports.Performance = exports.PerformanceTracking = exports.Heatmaps = exports.Attribution = exports.Retention = exports.Funnels = exports.Identify = exports.Events = exports.Sessions = exports.PageViews = exports.Experiment = exports.TrackPrompt = exports.TrackFeature = exports.Activation = exports.default = exports.FlowGrid = void 0;
|
|
35
|
+
exports.renderConsentBanner = exports.attachConsentBanner = exports.setupConsent = exports.resetCartId = exports.getOrCreateCartId = void 0;
|
|
36
36
|
// ============================================================================
|
|
37
37
|
// UNIFIED SDK CLASS
|
|
38
38
|
// ============================================================================
|
|
@@ -117,6 +117,7 @@ Object.defineProperty(exports, "IdentityManager", { enumerable: true, get: funct
|
|
|
117
117
|
var consent_1 = require("./lib/consent");
|
|
118
118
|
Object.defineProperty(exports, "ConsentManager", { enumerable: true, get: function () { return consent_1.ConsentManager; } });
|
|
119
119
|
Object.defineProperty(exports, "wireDeclarativeBanners", { enumerable: true, get: function () { return consent_1.wireDeclarativeBanners; } });
|
|
120
|
+
Object.defineProperty(exports, "grantConsentOnAuth", { enumerable: true, get: function () { return consent_1.grantConsentOnAuth; } });
|
|
120
121
|
// ============================================================================
|
|
121
122
|
// DROP-IN HELPERS
|
|
122
123
|
//
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;;AAEH,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,2CAA0C;AAAjC,oGAAA,QAAQ,OAAA;AACjB,2CAAyC;AAAhC,oHAAA,OAAO,OAAA;AAGhB,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,4CAK6B;AAJ3B,kGAAA,UAAU,OAAA;AACV,oGAAA,YAAY,OAAA;AACZ,mGAAA,WAAW,OAAA;AACX,kGAAA,UAAU,OAAA;AA8BZ,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,sDAYkC;AAXhC,sGAAA,SAAS,OAAA;AACT,qGAAA,QAAQ,OAAA;AACR,mGAAA,MAAM,OAAA;AACN,qGAAA,QAAQ,OAAA;AACR,oGAAA,OAAO,OAAA;AACP,sGAAA,SAAS,OAAA;AACT,wGAAA,WAAW,OAAA;AACX,qGAAA,QAAQ,OAAA;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AgB,OAAA;AAChB,8GAAA,gBAAgB,OAAA;AAChB,kHAAA,oBAAoB,OAAA;AACpB,2GAAA,aAAa,OAAA;AACb,6GAAA,eAAe,OAAA;AACf,+GAAA,iBAAiB,OAAA;AACjB,yGAAA,WAAW,OAAA;AAwNb,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,kFAAkF;AAClF,+CAO6B;AAN3B,oGAAA,SAAS,OAAA;AACT,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AACZ,mGAAA,QAAQ,OAAA;AACR,iGAAA,MAAM,OAAA;AACN,wGAAA,aAAa,OAAA;AAQf,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,iDAAuD;AAA9C,2GAAA,eAAe,OAAA;AAOxB,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,yCAA2F;AAAlF,yGAAA,cAAc,OAAA;AAAE,iHAAA,sBAAsB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAanE,+EAA+E;AAC/E,kBAAkB;AAClB,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAE/E,yCAOuB;AANrB,4GAAA,iBAAiB,OAAA;AACjB,4GAAA,iBAAiB,OAAA;AACjB,sGAAA,WAAW,OAAA;AACX,uGAAA,YAAY,OAAA;AACZ,8GAAA,mBAAmB,OAAA;AACnB,8GAAA,mBAAmB,OAAA"}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* @see {@link ConsentManager} for the core API.
|
|
30
30
|
*/
|
|
31
31
|
export { ConsentManager } from './manager';
|
|
32
|
+
export { grantConsentOnAuth } from './registry';
|
|
32
33
|
export { wireDeclarativeBanners } from './declarativeBanner';
|
|
33
34
|
export type { WireDeclarativeBannersOptions, DeclarativeBannersHandle, } from './declarativeBanner';
|
|
34
35
|
export type { ConsentCategory, ConsentPreferences, ConsentConfig, ConsentChangeEvent, CookieBannerConfig, CookieBannerTheme, } from './types';
|
|
@@ -30,9 +30,11 @@
|
|
|
30
30
|
* @see {@link ConsentManager} for the core API.
|
|
31
31
|
*/
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.wireDeclarativeBanners = exports.ConsentManager = void 0;
|
|
33
|
+
exports.wireDeclarativeBanners = exports.grantConsentOnAuth = exports.ConsentManager = void 0;
|
|
34
34
|
var manager_1 = require("./manager");
|
|
35
35
|
Object.defineProperty(exports, "ConsentManager", { enumerable: true, get: function () { return manager_1.ConsentManager; } });
|
|
36
|
+
var registry_1 = require("./registry");
|
|
37
|
+
Object.defineProperty(exports, "grantConsentOnAuth", { enumerable: true, get: function () { return registry_1.grantConsentOnAuth; } });
|
|
36
38
|
var declarativeBanner_1 = require("./declarativeBanner");
|
|
37
39
|
Object.defineProperty(exports, "wireDeclarativeBanners", { enumerable: true, get: function () { return declarativeBanner_1.wireDeclarativeBanners; } });
|
|
38
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/consent/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/consent/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AACvB,uCAAgD;AAAvC,8GAAA,kBAAkB,OAAA;AAE3B,yDAA6D;AAApD,2HAAA,sBAAsB,OAAA"}
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
*/
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.ConsentManager = void 0;
|
|
51
|
+
const registry_1 = require("./registry");
|
|
51
52
|
// ============================================================================
|
|
52
53
|
// DEFAULTS
|
|
53
54
|
// ============================================================================
|
|
@@ -124,6 +125,8 @@ class ConsentManager {
|
|
|
124
125
|
// responsibility — the SDK does not block essential or analytics data,
|
|
125
126
|
// including session replay, out of the box.
|
|
126
127
|
requireExplicitConsent: config?.requireExplicitConsent ?? false,
|
|
128
|
+
// Logging in = accepting tracking (see registry.ts). Opt out per manager.
|
|
129
|
+
grantOnAuth: config?.grantOnAuth ?? true,
|
|
127
130
|
onChange: config?.onChange,
|
|
128
131
|
defaultPreferences: {
|
|
129
132
|
...DEFAULT_PREFERENCES,
|
|
@@ -157,6 +160,11 @@ class ConsentManager {
|
|
|
157
160
|
preferences: true,
|
|
158
161
|
};
|
|
159
162
|
}
|
|
163
|
+
// Logging in = accepting tracking: the auth helpers auto-acceptAll() on
|
|
164
|
+
// every registered manager. Opt out per manager with `grantOnAuth: false`.
|
|
165
|
+
if (config?.grantOnAuth !== false) {
|
|
166
|
+
(0, registry_1.registerConsentManager)(this);
|
|
167
|
+
}
|
|
160
168
|
}
|
|
161
169
|
// ---------------------------------------------------------------------------
|
|
162
170
|
// PUBLIC API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/lib/consent/manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;;
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/lib/consent/manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;;AAMH,yCAAoD;AAEpD,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E,MAAM,mBAAmB,GAAG,YAAY,CAAC;AACzC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AAC3D,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,mBAAmB,GAAuB;IAC9C,SAAS,EAAE,IAAI;IACf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,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QACtE,QAAQ,CAAC,MAAM,GAAG,GAAG,4BAA4B,IAAI,eAAe,qBAAqB,MAAM,iBAAiB,MAAM,GAAG,MAAM,EAAE,CAAC;IACpI,CAAC;IAEO,YAAY;QAClB,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,OAAO;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,uBAAuB,MAAM,EAAE,CAAC;QAC3E,QAAQ,CAAC,MAAM,GAAG,GAAG,4BAA4B,uBAAuB,MAAM,EAAE,CAAC;IACnF,CAAC;CACF;AA7QD,wCA6QC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Consent-manager registry + login auto-grant.
|
|
3
|
+
* @module consent/registry
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Logging in counts as accepting tracking: an authenticated user has agreed to
|
|
7
|
+
* the app's terms, so the auth helpers (`completeAuth`, `trackAuth`,
|
|
8
|
+
* `pingActiveUser`) auto-accept consent instead of leaving a banner up — the
|
|
9
|
+
* same behaviour a hand-rolled auth beacon would implement.
|
|
10
|
+
*
|
|
11
|
+
* Every {@link ConsentManager} registers itself here on construction (unless
|
|
12
|
+
* created with `grantOnAuth: false`), so the grant reaches whichever manager(s)
|
|
13
|
+
* the app wired — `setupConsent`, `attachConsentBanner`, `renderConsentBanner`
|
|
14
|
+
* or a bare `new ConsentManager()` — without the SDK knowing cookie names.
|
|
15
|
+
*/
|
|
16
|
+
import type { ConsentManager } from './manager';
|
|
17
|
+
/** Register a manager for the login auto-grant. Called from the constructor. */
|
|
18
|
+
export declare function registerConsentManager(manager: ConsentManager): void;
|
|
19
|
+
/**
|
|
20
|
+
* Accept all consent categories because the visitor authenticated.
|
|
21
|
+
*
|
|
22
|
+
* Fired automatically by the auth helpers ({@link FlowGrid.completeAuth},
|
|
23
|
+
* {@link FlowGrid.trackAuth}, {@link FlowGrid.pingActiveUser}); call it
|
|
24
|
+
* yourself only from a fully custom auth flow that bypasses them.
|
|
25
|
+
*
|
|
26
|
+
* Semantics mirror clicking "Accept all" on every registered manager: the
|
|
27
|
+
* choice is persisted in each manager's cookie (so banners gated on
|
|
28
|
+
* `hasConsented()` stay hidden on future visits), each manager's `onChange`
|
|
29
|
+
* fires (starting consent-gated streams like session replay), and it
|
|
30
|
+
* supersedes an earlier anonymous decline — logging in wins. Managers created
|
|
31
|
+
* with `grantOnAuth: false` are left untouched. Already fully-granted managers
|
|
32
|
+
* are skipped so repeated auth pings don't rewrite cookies.
|
|
33
|
+
*
|
|
34
|
+
* With no manager registered, it just opens the transport-level gates, which
|
|
35
|
+
* covers apps that called `FlowGridTransport.setConsent` by hand.
|
|
36
|
+
*/
|
|
37
|
+
export declare function grantConsentOnAuth(): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Consent-manager registry + login auto-grant.
|
|
4
|
+
* @module consent/registry
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Logging in counts as accepting tracking: an authenticated user has agreed to
|
|
8
|
+
* the app's terms, so the auth helpers (`completeAuth`, `trackAuth`,
|
|
9
|
+
* `pingActiveUser`) auto-accept consent instead of leaving a banner up — the
|
|
10
|
+
* same behaviour a hand-rolled auth beacon would implement.
|
|
11
|
+
*
|
|
12
|
+
* Every {@link ConsentManager} registers itself here on construction (unless
|
|
13
|
+
* created with `grantOnAuth: false`), so the grant reaches whichever manager(s)
|
|
14
|
+
* the app wired — `setupConsent`, `attachConsentBanner`, `renderConsentBanner`
|
|
15
|
+
* or a bare `new ConsentManager()` — without the SDK knowing cookie names.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.registerConsentManager = registerConsentManager;
|
|
19
|
+
exports.grantConsentOnAuth = grantConsentOnAuth;
|
|
20
|
+
const transport_1 = require("../client/transport");
|
|
21
|
+
const managers = new Set();
|
|
22
|
+
/** Register a manager for the login auto-grant. Called from the constructor. */
|
|
23
|
+
function registerConsentManager(manager) {
|
|
24
|
+
managers.add(manager);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Accept all consent categories because the visitor authenticated.
|
|
28
|
+
*
|
|
29
|
+
* Fired automatically by the auth helpers ({@link FlowGrid.completeAuth},
|
|
30
|
+
* {@link FlowGrid.trackAuth}, {@link FlowGrid.pingActiveUser}); call it
|
|
31
|
+
* yourself only from a fully custom auth flow that bypasses them.
|
|
32
|
+
*
|
|
33
|
+
* Semantics mirror clicking "Accept all" on every registered manager: the
|
|
34
|
+
* choice is persisted in each manager's cookie (so banners gated on
|
|
35
|
+
* `hasConsented()` stay hidden on future visits), each manager's `onChange`
|
|
36
|
+
* fires (starting consent-gated streams like session replay), and it
|
|
37
|
+
* supersedes an earlier anonymous decline — logging in wins. Managers created
|
|
38
|
+
* with `grantOnAuth: false` are left untouched. Already fully-granted managers
|
|
39
|
+
* are skipped so repeated auth pings don't rewrite cookies.
|
|
40
|
+
*
|
|
41
|
+
* With no manager registered, it just opens the transport-level gates, which
|
|
42
|
+
* covers apps that called `FlowGridTransport.setConsent` by hand.
|
|
43
|
+
*/
|
|
44
|
+
function grantConsentOnAuth() {
|
|
45
|
+
if (managers.size === 0) {
|
|
46
|
+
transport_1.FlowGridTransport.setConsent({ analytics: true, marketing: true });
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
for (const manager of managers) {
|
|
50
|
+
try {
|
|
51
|
+
const prefs = manager.getPreferences();
|
|
52
|
+
if (!manager.hasConsented() || !prefs.analytics || !prefs.marketing) {
|
|
53
|
+
manager.acceptAll();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
/* consent stamping is best-effort — never let it break auth tracking */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/lib/consent/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAQH,wDAEC;AAoBD,gDAeC;AA1CD,mDAAwD;AAExD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE3C,gFAAgF;AAChF,SAAgB,sBAAsB,CAAC,OAAuB;IAC5D,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACxB,6BAAiB,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,OAAO;IACT,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpE,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,wEAAwE;QAC1E,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -76,6 +76,14 @@ export interface ConsentConfig {
|
|
|
76
76
|
* GDPR-style opt-in flow.
|
|
77
77
|
*/
|
|
78
78
|
requireExplicitConsent?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Treat logging in as accepting tracking. Defaults to `true`: when the auth
|
|
81
|
+
* helpers (`completeAuth`, `trackAuth`, `pingActiveUser`) see an
|
|
82
|
+
* authenticated user, this manager auto-runs `acceptAll()` — persisting the
|
|
83
|
+
* choice, hiding consent banners, and superseding an earlier anonymous
|
|
84
|
+
* decline. Set `false` if authenticated users must still consent explicitly.
|
|
85
|
+
*/
|
|
86
|
+
grantOnAuth?: boolean;
|
|
79
87
|
}
|
|
80
88
|
/**
|
|
81
89
|
* Event emitted when consent changes.
|
|
@@ -222,5 +222,19 @@ export declare class Activation extends FlowGridTransport {
|
|
|
222
222
|
* @returns Promise resolving to activation response
|
|
223
223
|
*/
|
|
224
224
|
trackLogin(userId: string, method?: 'email' | 'google' | 'github' | 'apple' | 'sso' | string, properties?: Record<string, unknown>): Promise<ActivationResponse>;
|
|
225
|
+
/**
|
|
226
|
+
* Emit an `active_user` signal for an identified user so the dashboard can
|
|
227
|
+
* compute DAU / WAU / MAU **by identity**. Rides the activation pipe
|
|
228
|
+
* (subtype `active_user`) so the wire `event_name` is `active_user` — the
|
|
229
|
+
* exact shape the active-users pipes read.
|
|
230
|
+
*
|
|
231
|
+
* @param userId - User ID
|
|
232
|
+
* @param traits - Optional email/name for Known-visitor parity
|
|
233
|
+
* @returns Promise resolving to activation response
|
|
234
|
+
*/
|
|
235
|
+
trackActiveUser(userId: string, traits?: {
|
|
236
|
+
email?: string;
|
|
237
|
+
name?: string;
|
|
238
|
+
} & Record<string, unknown>): Promise<ActivationResponse>;
|
|
225
239
|
}
|
|
226
240
|
export default Activation;
|
|
@@ -192,6 +192,29 @@ class Activation extends transport_1.FlowGridTransport {
|
|
|
192
192
|
timestamp: new Date().toISOString()
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Emit an `active_user` signal for an identified user so the dashboard can
|
|
197
|
+
* compute DAU / WAU / MAU **by identity**. Rides the activation pipe
|
|
198
|
+
* (subtype `active_user`) so the wire `event_name` is `active_user` — the
|
|
199
|
+
* exact shape the active-users pipes read.
|
|
200
|
+
*
|
|
201
|
+
* @param userId - User ID
|
|
202
|
+
* @param traits - Optional email/name for Known-visitor parity
|
|
203
|
+
* @returns Promise resolving to activation response
|
|
204
|
+
*/
|
|
205
|
+
async trackActiveUser(userId, traits) {
|
|
206
|
+
const now = new Date();
|
|
207
|
+
return await this.init("active_user", {
|
|
208
|
+
type: "activation",
|
|
209
|
+
subtype: "active_user",
|
|
210
|
+
userId,
|
|
211
|
+
...(traits?.email ? { email: traits.email } : {}),
|
|
212
|
+
...(traits?.name ? { name: traits.name } : {}),
|
|
213
|
+
// Day bucket lets the dashboard dedupe repeat pings within a day cheaply.
|
|
214
|
+
date: now.toISOString().slice(0, 10),
|
|
215
|
+
timestamp: now.toISOString()
|
|
216
|
+
});
|
|
217
|
+
}
|
|
195
218
|
}
|
|
196
219
|
exports.Activation = Activation;
|
|
197
220
|
exports.default = Activation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activation.js","sourceRoot":"","sources":["../../../../src/lib/features/core/activation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;;;AAEH,sDAA2D;AA6G3D,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,UAAW,SAAQ,6BAAiB;IAC/C;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAwB;QACnC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACvC,GAAG,MAAM,CAAC,UAAU;YACpB,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,mBAAmB,CAAC,MAA4B;QACpD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CAAC,MAAM;YACrB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,MAAM,CAAC,UAAU;YACpB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,CACf,MAAc,EACd,MAAgE,EAChE,MAAe,EACf,UAAoC;QAEpC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YACzC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,QAAQ;YACjB,MAAM;YACN,MAAM;YACN,MAAM;YACN,GAAG,UAAU;YACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,UAAU,CACd,MAAc,EACd,MAAiE,EACjE,UAAoC;QAEpC,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YACxC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO;YAChB,MAAM;YACN,MAAM;YACN,GAAG,UAAU;YACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CAEF;
|
|
1
|
+
{"version":3,"file":"activation.js","sourceRoot":"","sources":["../../../../src/lib/features/core/activation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;;;AAEH,sDAA2D;AA6G3D,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAa,UAAW,SAAQ,6BAAiB;IAC/C;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAwB;QACnC,OAAO,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C;QACvB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACpC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,aAAa;YACtB,MAAM;YACN,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,0EAA0E;YAC1E,IAAI,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YACpC,SAAS,EAAE,GAAG,CAAC,WAAW,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;CAEF;AAjKD,gCAiKC;AAED,kBAAe,UAAU,CAAC"}
|
package/dist/lib/flowgrid.d.ts
CHANGED
|
@@ -1011,6 +1011,11 @@ export declare class FlowGrid {
|
|
|
1011
1011
|
* user active for DAU/WAU/MAU. Framework-agnostic: call it from a React
|
|
1012
1012
|
* effect, a Vue watcher, a Svelte reactive block — wherever the id lands.
|
|
1013
1013
|
*
|
|
1014
|
+
* Also auto-accepts cookie consent: logging in counts as opting in to
|
|
1015
|
+
* tracking, so every {@link ConsentManager} (banner or headless) runs
|
|
1016
|
+
* `acceptAll()` and consent-gated streams start. Disable per manager with
|
|
1017
|
+
* `grantOnAuth: false`.
|
|
1018
|
+
*
|
|
1014
1019
|
* @example
|
|
1015
1020
|
* ```ts
|
|
1016
1021
|
* fg.completeAuth(user.id, { email: user.email, name: user.name });
|
|
@@ -1023,11 +1028,42 @@ export declare class FlowGrid {
|
|
|
1023
1028
|
identify: Promise<import("..").IdentifyResponse>;
|
|
1024
1029
|
event: Promise<import("..").ActivationResponse>;
|
|
1025
1030
|
};
|
|
1031
|
+
/**
|
|
1032
|
+
* Beacon-style auth completion: identical to {@link completeAuth}, but a
|
|
1033
|
+
* **no-op unless a {@link markLogin} / {@link markSignup} intent is pending**.
|
|
1034
|
+
* That makes it safe to call every time your app mounts or the user id
|
|
1035
|
+
* resolves — it fires exactly once, right after the auth redirect, instead
|
|
1036
|
+
* of logging a phantom "login" on every page load. This replaces the
|
|
1037
|
+
* hand-rolled tracking-beacon component apps used to need.
|
|
1038
|
+
*
|
|
1039
|
+
* @example
|
|
1040
|
+
* ```tsx
|
|
1041
|
+
* // React — the entire auth-tracking "beacon" is one effect:
|
|
1042
|
+
* useEffect(() => {
|
|
1043
|
+
* if (user) fg.completeAuthIfPending(user.id, { email: user.email, name: user.name });
|
|
1044
|
+
* }, [user]);
|
|
1045
|
+
* ```
|
|
1046
|
+
* ```ts
|
|
1047
|
+
* // Vue
|
|
1048
|
+
* watch(user, (u) => u && fg.completeAuthIfPending(u.id, { email: u.email }));
|
|
1049
|
+
* // Svelte
|
|
1050
|
+
* $: user && fg.completeAuthIfPending(user.id, { email: user.email });
|
|
1051
|
+
* ```
|
|
1052
|
+
*/
|
|
1053
|
+
completeAuthIfPending(userId: string, traits?: {
|
|
1054
|
+
email?: string;
|
|
1055
|
+
name?: string;
|
|
1056
|
+
} & Record<string, unknown>): {
|
|
1057
|
+
identify: Promise<import("..").IdentifyResponse>;
|
|
1058
|
+
event: Promise<import("..").ActivationResponse>;
|
|
1059
|
+
} | undefined;
|
|
1026
1060
|
/**
|
|
1027
1061
|
* One-call auth tracking for apps that DON'T redirect (email/password, magic
|
|
1028
1062
|
* link resolved in-page): identify + fire the login/signup event + mark the
|
|
1029
1063
|
* user active, in a single call. Prefer {@link markLogin} + {@link completeAuth}
|
|
1030
|
-
* when your provider redirects.
|
|
1064
|
+
* when your provider redirects. Like {@link completeAuth}, it auto-accepts
|
|
1065
|
+
* cookie consent (logging in = opting in; disable per manager with
|
|
1066
|
+
* `grantOnAuth: false`).
|
|
1031
1067
|
*
|
|
1032
1068
|
* @example
|
|
1033
1069
|
* ```ts
|
|
@@ -1062,7 +1098,7 @@ export declare class FlowGrid {
|
|
|
1062
1098
|
pingActiveUser(userId: string, traits?: {
|
|
1063
1099
|
email?: string;
|
|
1064
1100
|
name?: string;
|
|
1065
|
-
} & Record<string, unknown>): Promise<import("..").
|
|
1101
|
+
} & Record<string, unknown>): Promise<import("..").ActivationResponse>;
|
|
1066
1102
|
/**
|
|
1067
1103
|
* Clear the identified user on logout so a shared device doesn't attribute the
|
|
1068
1104
|
* next visitor to the previous user. Resets the identity server-side and
|
package/dist/lib/flowgrid.js
CHANGED
|
@@ -71,6 +71,7 @@ const authIntent_1 = require("./features/analytics/authIntent");
|
|
|
71
71
|
const core_1 = require("./features/core");
|
|
72
72
|
const analytics_1 = require("./features/analytics");
|
|
73
73
|
const ecommerce_1 = require("./features/ecommerce");
|
|
74
|
+
const registry_1 = require("./consent/registry");
|
|
74
75
|
const core_2 = require("./tracking/core");
|
|
75
76
|
const analytics_2 = require("./tracking/analytics");
|
|
76
77
|
const ecommerce_2 = require("./tracking/ecommerce");
|
|
@@ -410,6 +411,11 @@ class FlowGrid {
|
|
|
410
411
|
* user active for DAU/WAU/MAU. Framework-agnostic: call it from a React
|
|
411
412
|
* effect, a Vue watcher, a Svelte reactive block — wherever the id lands.
|
|
412
413
|
*
|
|
414
|
+
* Also auto-accepts cookie consent: logging in counts as opting in to
|
|
415
|
+
* tracking, so every {@link ConsentManager} (banner or headless) runs
|
|
416
|
+
* `acceptAll()` and consent-gated streams start. Disable per manager with
|
|
417
|
+
* `grantOnAuth: false`.
|
|
418
|
+
*
|
|
413
419
|
* @example
|
|
414
420
|
* ```ts
|
|
415
421
|
* fg.completeAuth(user.id, { email: user.email, name: user.name });
|
|
@@ -437,11 +443,40 @@ class FlowGrid {
|
|
|
437
443
|
(0, authIntent_1.clearAuthIntent)();
|
|
438
444
|
return { identify: identifyResult, event: eventResult };
|
|
439
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Beacon-style auth completion: identical to {@link completeAuth}, but a
|
|
448
|
+
* **no-op unless a {@link markLogin} / {@link markSignup} intent is pending**.
|
|
449
|
+
* That makes it safe to call every time your app mounts or the user id
|
|
450
|
+
* resolves — it fires exactly once, right after the auth redirect, instead
|
|
451
|
+
* of logging a phantom "login" on every page load. This replaces the
|
|
452
|
+
* hand-rolled tracking-beacon component apps used to need.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```tsx
|
|
456
|
+
* // React — the entire auth-tracking "beacon" is one effect:
|
|
457
|
+
* useEffect(() => {
|
|
458
|
+
* if (user) fg.completeAuthIfPending(user.id, { email: user.email, name: user.name });
|
|
459
|
+
* }, [user]);
|
|
460
|
+
* ```
|
|
461
|
+
* ```ts
|
|
462
|
+
* // Vue
|
|
463
|
+
* watch(user, (u) => u && fg.completeAuthIfPending(u.id, { email: u.email }));
|
|
464
|
+
* // Svelte
|
|
465
|
+
* $: user && fg.completeAuthIfPending(user.id, { email: user.email });
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
completeAuthIfPending(userId, traits) {
|
|
469
|
+
if (!(0, authIntent_1.readAuthIntent)())
|
|
470
|
+
return undefined;
|
|
471
|
+
return this.completeAuth(userId, traits);
|
|
472
|
+
}
|
|
440
473
|
/**
|
|
441
474
|
* One-call auth tracking for apps that DON'T redirect (email/password, magic
|
|
442
475
|
* link resolved in-page): identify + fire the login/signup event + mark the
|
|
443
476
|
* user active, in a single call. Prefer {@link markLogin} + {@link completeAuth}
|
|
444
|
-
* when your provider redirects.
|
|
477
|
+
* when your provider redirects. Like {@link completeAuth}, it auto-accepts
|
|
478
|
+
* cookie consent (logging in = opting in; disable per manager with
|
|
479
|
+
* `grantOnAuth: false`).
|
|
445
480
|
*
|
|
446
481
|
* @example
|
|
447
482
|
* ```ts
|
|
@@ -476,15 +511,16 @@ class FlowGrid {
|
|
|
476
511
|
* ```
|
|
477
512
|
*/
|
|
478
513
|
pingActiveUser(userId, traits) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
514
|
+
// Logging in = accepting tracking: every auth helper (completeAuth,
|
|
515
|
+
// trackAuth) and the once-per-session app-boot ping funnels through here,
|
|
516
|
+
// so this is the one place that knows "this browser belongs to an
|
|
517
|
+
// authenticated user". Auto-accept consent on the app's managers/banners —
|
|
518
|
+
// opt out per manager with `grantOnAuth: false`.
|
|
519
|
+
(0, registry_1.grantConsentOnAuth)();
|
|
520
|
+
// Rides the activation pipe (subtype `active_user`) so the wire event_name
|
|
521
|
+
// is `active_user` — the generic custom_event pipe stored it under
|
|
522
|
+
// event_name "custom_event", which the DAU/WAU/MAU pipes can't see.
|
|
523
|
+
return this.activation.trackActiveUser(userId, traits);
|
|
488
524
|
}
|
|
489
525
|
/**
|
|
490
526
|
* Clear the identified user on logout so a shared device doesn't attribute the
|