@thg-agentic/hyper-personalisation-web 0.0.0-stage → 3.18.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/LICENSE +21 -0
- package/README.md +860 -2
- package/dist/hp.min.js +3 -0
- package/dist/snippet.min.js +1 -0
- package/package.json +83 -3
- package/src/assignment.js +75 -0
- package/src/auto/attributes.js +16 -0
- package/src/auto/exposures.js +45 -0
- package/src/auto/lists.js +136 -0
- package/src/auto/promotions.js +104 -0
- package/src/auto/rails.js +217 -0
- package/src/auto/viewability.js +150 -0
- package/src/auto.js +13 -0
- package/src/bootstrap.js +504 -0
- package/src/carry.js +74 -0
- package/src/conformance.js +530 -0
- package/src/consent-gate.js +324 -0
- package/src/consent.js +604 -0
- package/src/context.js +439 -0
- package/src/datalayer.js +411 -0
- package/src/debug.js +45 -0
- package/src/decisions.js +90 -0
- package/src/device-storage.js +213 -0
- package/src/experiments.js +220 -0
- package/src/ga4.js +124 -0
- package/src/hash.js +138 -0
- package/src/hp.js +135 -0
- package/src/index.js +840 -0
- package/src/preview.js +44 -0
- package/src/recommendation-context.js +101 -0
- package/src/sampling.js +19 -0
- package/src/segment.js +388 -0
- package/src/session/category.js +40 -0
- package/src/session/record.js +176 -0
- package/src/session/rules.js +195 -0
- package/src/session/signals.js +150 -0
- package/src/session-id.js +62 -0
- package/src/session.js +28 -0
- package/src/settings.js +230 -0
- package/src/shape.js +120 -0
- package/src/social-proof.js +139 -0
- package/src/spec-version.js +4 -0
- package/src/storage-scope.js +164 -0
- package/src/transport.js +451 -0
- package/src/version.js +2 -0
- package/types/auto.d.ts +51 -0
- package/types/bootstrap.d.ts +165 -0
- package/types/consent.d.ts +126 -0
- package/types/datalayer.d.ts +76 -0
- package/types/events.d.ts +713 -0
- package/types/hp.d.ts +64 -0
- package/types/index.d.ts +617 -0
- package/types/segment.d.ts +68 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ConsentAdapter } from './consent';
|
|
2
|
+
import type {
|
|
3
|
+
AnalyticsContextSources,
|
|
4
|
+
AnonymousIdSource,
|
|
5
|
+
StorageNames,
|
|
6
|
+
} from './index';
|
|
7
|
+
|
|
8
|
+
export interface CdpPluginsOptions extends AnalyticsContextSources {
|
|
9
|
+
/** For a key scoped to several properties, or without settings: the settings' propertyId wins. */
|
|
10
|
+
propertyId?: string | number;
|
|
11
|
+
channel?: string | null;
|
|
12
|
+
market?: string | null;
|
|
13
|
+
environment?: string | null;
|
|
14
|
+
currency?: string | null;
|
|
15
|
+
locale?: string | null;
|
|
16
|
+
country?: string | null;
|
|
17
|
+
shipToCountry?: string | null;
|
|
18
|
+
getCurrency?(): string | null | undefined;
|
|
19
|
+
getShipToCountry?(): string | null | undefined;
|
|
20
|
+
getLocale?(): string | null | undefined;
|
|
21
|
+
consent?: ConsentAdapter;
|
|
22
|
+
consentTimeoutMs?: number;
|
|
23
|
+
consentCookieDomain?: string;
|
|
24
|
+
storageNames?: StorageNames;
|
|
25
|
+
/** Only without settings: the settings' allowlist wins. */
|
|
26
|
+
queryParamAllowlist?: string[];
|
|
27
|
+
queryParamBlocklist?: string[];
|
|
28
|
+
sensitiveParamAllowlist?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Pin analytics-next's anonymousId to the site's own device id. The settings' `hp.anonymousId`
|
|
31
|
+
* replaces it when it names a cookie or chooses Hyper-Personalisation's (since 3.6).
|
|
32
|
+
*/
|
|
33
|
+
getAnonymousId?(): string | null | undefined;
|
|
34
|
+
/** Only without settings: the settings' `hp.anonymousId` wins. */
|
|
35
|
+
anonymousIdSource?: AnonymousIdSource | null;
|
|
36
|
+
getPageType?(): string | null | undefined;
|
|
37
|
+
debug?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** An analytics-next plugin, structurally (so this file does not depend on analytics-next). */
|
|
41
|
+
export interface CdpPlugin {
|
|
42
|
+
name: string;
|
|
43
|
+
type: 'before' | 'enrichment';
|
|
44
|
+
version: string;
|
|
45
|
+
isLoaded(): boolean;
|
|
46
|
+
load(ctx: unknown, analytics: unknown): Promise<void>;
|
|
47
|
+
[hook: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Pass as `plugins` in the FIRST argument of AnalyticsBrowser.load. */
|
|
51
|
+
export declare function cdpPlugins(options?: CdpPluginsOptions): CdpPlugin[];
|
|
52
|
+
/** Pass as `disable` to AnalyticsBrowser.load: a key the settings do not enable is a no-op. */
|
|
53
|
+
export declare function hpDisabled(cdnSettings: unknown): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The second argument of AnalyticsBrowser.load when `cdnURL` is the apiHost: delivery to the
|
|
56
|
+
* settings' apiHost with the write key (the settings carry no Segment.io destination), telemetry
|
|
57
|
+
* off, and a disabled key a no-op. Spread it and add your own options.
|
|
58
|
+
*/
|
|
59
|
+
/** The HP API, used when the page names no proxy host: `cdnURL` for AnalyticsBrowser.load. */
|
|
60
|
+
export declare const DEFAULT_API_HOST: string;
|
|
61
|
+
|
|
62
|
+
export declare function hpLoadOptions(config: {
|
|
63
|
+
writeKey: string;
|
|
64
|
+
apiHost?: string;
|
|
65
|
+
}): {
|
|
66
|
+
disable(cdnSettings: unknown): boolean;
|
|
67
|
+
updateCDNSettings<T extends Record<string, unknown>>(cdnSettings: T): T;
|
|
68
|
+
};
|