@c15t/scripts 2.1.0 → 2.2.0-canary-20260727202135
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/AGENTS.md +62 -0
- package/README.md +32 -20
- package/dist/e2e-test-utils.cjs +51 -10
- package/dist/e2e-test-utils.js +37 -3
- package/dist/engine/compile.cjs +9 -5
- package/dist/engine/runtime.cjs +100 -17
- package/dist/engine/runtime.js +91 -12
- package/dist/registry.cjs +97 -12
- package/dist/registry.js +80 -0
- package/dist/resolve.cjs +9 -5
- package/dist/types.cjs +17 -13
- package/dist/vendors/_shared/attributes.cjs +13 -9
- package/dist/vendors/_shared/google-consent.cjs +14 -9
- package/dist/vendors/_shared/install-builders.cjs +12 -8
- package/dist/vendors/_shared/script-url.cjs +16 -12
- package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +9 -5
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +13 -9
- package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +11 -7
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +9 -5
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +11 -7
- package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +9 -5
- package/dist/vendors/ads-and-pixels/x-pixel.cjs +9 -5
- package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
- package/dist/vendors/analytics/adobe-analytics.js +49 -0
- package/dist/vendors/analytics/ahrefs-analytics.cjs +11 -7
- package/dist/vendors/analytics/amplitude.cjs +193 -0
- package/dist/vendors/analytics/amplitude.js +134 -0
- package/dist/vendors/analytics/clearbit.cjs +69 -0
- package/dist/vendors/analytics/clearbit.js +28 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +11 -7
- package/dist/vendors/analytics/databuddy.cjs +11 -7
- package/dist/vendors/analytics/fathom-analytics.cjs +11 -7
- package/dist/vendors/analytics/google-tag.cjs +11 -7
- package/dist/vendors/analytics/heap.cjs +181 -0
- package/dist/vendors/analytics/heap.js +134 -0
- package/dist/vendors/analytics/hightouch.cjs +153 -0
- package/dist/vendors/analytics/hightouch.js +109 -0
- package/dist/vendors/analytics/hotjar.cjs +11 -7
- package/dist/vendors/analytics/logrocket.cjs +99 -0
- package/dist/vendors/analytics/logrocket.js +58 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +9 -5
- package/dist/vendors/analytics/microsoft-clarity.cjs +75 -47
- package/dist/vendors/analytics/microsoft-clarity.js +64 -40
- package/dist/vendors/analytics/mixpanel-analytics.cjs +31 -16
- package/dist/vendors/analytics/mixpanel-analytics.js +22 -11
- package/dist/vendors/analytics/pirsch.cjs +108 -0
- package/dist/vendors/analytics/pirsch.js +67 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +9 -5
- package/dist/vendors/analytics/posthog.cjs +11 -7
- package/dist/vendors/analytics/promptwatch.cjs +11 -7
- package/dist/vendors/analytics/rudderstack.cjs +227 -0
- package/dist/vendors/analytics/rudderstack.js +183 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +9 -5
- package/dist/vendors/analytics/segment.cjs +9 -5
- package/dist/vendors/analytics/umami-analytics.cjs +9 -5
- package/dist/vendors/analytics/vercel-analytics.cjs +11 -7
- package/dist/vendors/functional/crisp.cjs +9 -5
- package/dist/vendors/functional/intercom.cjs +11 -7
- package/dist/vendors/tag-managers/google-tag-manager.cjs +11 -7
- package/dist-types/registry.d.ts +313 -241
- package/dist-types/types.d.ts +42 -4
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +18 -18
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +21 -21
- package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +32 -32
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +19 -19
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +16 -16
- package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +28 -28
- package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +13 -13
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +7 -7
- package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
- package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +7 -7
- package/dist-types/vendors/analytics/databuddy.d.ts +25 -25
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +11 -11
- package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
- package/dist-types/vendors/analytics/heap.d.ts +316 -0
- package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
- package/dist-types/vendors/analytics/hotjar.d.ts +14 -14
- package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +42 -30
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +40 -28
- package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
- package/dist-types/vendors/analytics/posthog.d.ts +39 -39
- package/dist-types/vendors/analytics/promptwatch.d.ts +7 -7
- package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +18 -18
- package/dist-types/vendors/analytics/segment.d.ts +13 -13
- package/dist-types/vendors/analytics/umami-analytics.d.ts +12 -12
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +16 -16
- package/dist-types/vendors/functional/crisp.d.ts +11 -11
- package/dist-types/vendors/functional/intercom.d.ts +16 -16
- package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +18 -18
- package/docs/README.md +62 -0
- package/docs/frameworks/javascript/script-loader.md +354 -0
- package/docs/frameworks/next/script-loader.md +499 -0
- package/docs/frameworks/react/script-loader.md +553 -0
- package/docs/integrations/adobe-analytics.md +160 -0
- package/docs/integrations/ahrefs-analytics.md +157 -0
- package/docs/integrations/amplitude.md +230 -0
- package/docs/integrations/building-integrations.md +239 -0
- package/docs/integrations/clearbit.md +130 -0
- package/docs/integrations/cloudflare-web-analytics.md +126 -0
- package/docs/integrations/crisp.md +140 -0
- package/docs/integrations/databuddy.md +205 -0
- package/docs/integrations/fathom-analytics.md +150 -0
- package/docs/integrations/google-maps.md +263 -0
- package/docs/integrations/google-tag-manager.md +154 -0
- package/docs/integrations/google-tag.md +134 -0
- package/docs/integrations/heap.md +219 -0
- package/docs/integrations/hightouch.md +199 -0
- package/docs/integrations/hotjar.md +143 -0
- package/docs/integrations/intercom.md +144 -0
- package/docs/integrations/linkedin-insights.md +161 -0
- package/docs/integrations/logrocket.md +175 -0
- package/docs/integrations/matomo-analytics.md +171 -0
- package/docs/integrations/meta-pixel.md +412 -0
- package/docs/integrations/microsoft-clarity.md +173 -0
- package/docs/integrations/microsoft-uet.md +156 -0
- package/docs/integrations/mixpanel-analytics.md +130 -0
- package/docs/integrations/overview.md +149 -0
- package/docs/integrations/pirsch.md +142 -0
- package/docs/integrations/plausible-analytics.md +154 -0
- package/docs/integrations/posthog.md +258 -0
- package/docs/integrations/promptwatch.md +121 -0
- package/docs/integrations/reddit-pixel.md +241 -0
- package/docs/integrations/rudderstack.md +271 -0
- package/docs/integrations/rybbit-analytics.md +143 -0
- package/docs/integrations/segment.md +146 -0
- package/docs/integrations/snapchat-pixel.md +163 -0
- package/docs/integrations/tiktok-pixel.md +123 -0
- package/docs/integrations/umami-analytics.md +148 -0
- package/docs/integrations/vercel-analytics.md +141 -0
- package/docs/integrations/x-pixel.md +157 -0
- package/docs/integrations/youtube.md +193 -0
- package/docs/shared/react/guides/script-loader.md +309 -0
- package/package.json +61 -7
- package/readme.json +8 -4
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,8 +28,8 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
databuddy: ()=>databuddy,
|
|
32
|
+
databuddyManifest: ()=>databuddyManifest
|
|
29
33
|
});
|
|
30
34
|
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
35
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,8 +28,8 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
fathomAnalytics: ()=>fathomAnalytics,
|
|
32
|
+
fathomAnalyticsManifest: ()=>fathomAnalyticsManifest
|
|
29
33
|
});
|
|
30
34
|
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
35
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,8 +28,8 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
gtag: ()=>gtag,
|
|
32
|
+
gtagManifest: ()=>gtagManifest
|
|
29
33
|
});
|
|
30
34
|
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
31
35
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
DEFAULT_HEAP_CONFIG_BASE_URL: ()=>DEFAULT_HEAP_CONFIG_BASE_URL,
|
|
32
|
+
HEAP_QUEUE_METHODS: ()=>HEAP_QUEUE_METHODS,
|
|
33
|
+
heap: ()=>heap,
|
|
34
|
+
heapManifest: ()=>heapManifest
|
|
35
|
+
});
|
|
36
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
37
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
38
|
+
const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
|
|
39
|
+
const DEFAULT_HEAP_CONFIG_BASE_URL = 'https://cdn.us.heap-api.com/config';
|
|
40
|
+
const HEAP_QUEUE_METHODS = [
|
|
41
|
+
'init',
|
|
42
|
+
'startTracking',
|
|
43
|
+
'stopTracking',
|
|
44
|
+
'track',
|
|
45
|
+
'resetIdentity',
|
|
46
|
+
'identify',
|
|
47
|
+
'identifyHashed',
|
|
48
|
+
'getSessionId',
|
|
49
|
+
'getUserId',
|
|
50
|
+
'getIdentity',
|
|
51
|
+
'addUserProperties',
|
|
52
|
+
'addEventProperties',
|
|
53
|
+
'removeEventProperty',
|
|
54
|
+
'clearEventProperties',
|
|
55
|
+
'addAccountProperties',
|
|
56
|
+
'addAdapter',
|
|
57
|
+
'addTransformer',
|
|
58
|
+
'addTransformerFn',
|
|
59
|
+
'onReady',
|
|
60
|
+
'addPageviewProperties',
|
|
61
|
+
'removePageviewProperty',
|
|
62
|
+
'clearPageviewProperties',
|
|
63
|
+
'trackPageview'
|
|
64
|
+
];
|
|
65
|
+
const heapManifest = {
|
|
66
|
+
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
67
|
+
vendor: 'heap',
|
|
68
|
+
category: 'measurement',
|
|
69
|
+
install: [
|
|
70
|
+
{
|
|
71
|
+
type: 'setGlobal',
|
|
72
|
+
name: 'heapReadyCb',
|
|
73
|
+
value: [],
|
|
74
|
+
ifUndefined: true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'setGlobal',
|
|
78
|
+
name: 'heap',
|
|
79
|
+
value: [],
|
|
80
|
+
ifUndefined: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'setGlobalPath',
|
|
84
|
+
path: [
|
|
85
|
+
'heap',
|
|
86
|
+
'envId'
|
|
87
|
+
],
|
|
88
|
+
value: '{{envId}}'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'setGlobalPath',
|
|
92
|
+
path: [
|
|
93
|
+
'heap',
|
|
94
|
+
'appid'
|
|
95
|
+
],
|
|
96
|
+
value: '{{envId}}'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'setGlobalPath',
|
|
100
|
+
path: [
|
|
101
|
+
'heap',
|
|
102
|
+
'clientConfig'
|
|
103
|
+
],
|
|
104
|
+
value: '{{clientConfig}}'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'defineQueueMethods',
|
|
108
|
+
target: 'heap',
|
|
109
|
+
queue: {
|
|
110
|
+
global: 'heapReadyCb'
|
|
111
|
+
},
|
|
112
|
+
queueFormat: 'callback',
|
|
113
|
+
methods: [
|
|
114
|
+
...HEAP_QUEUE_METHODS
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'loadScript',
|
|
119
|
+
src: "{{scriptUrl}}",
|
|
120
|
+
async: true
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
function validateEnvId(envId) {
|
|
125
|
+
const normalized = 'string' == typeof envId ? envId.trim() : '';
|
|
126
|
+
if (0 === normalized.length) throw new Error('heap: missing or invalid envId');
|
|
127
|
+
return normalized;
|
|
128
|
+
}
|
|
129
|
+
function isPlainRecord(value) {
|
|
130
|
+
if (null === value || 'object' != typeof value || Array.isArray(value)) return false;
|
|
131
|
+
const prototype = Object.getPrototypeOf(value);
|
|
132
|
+
return prototype === Object.prototype || null === prototype;
|
|
133
|
+
}
|
|
134
|
+
function toJsonValue(value, path) {
|
|
135
|
+
if (null === value) return null;
|
|
136
|
+
if ('string' == typeof value || 'boolean' == typeof value) return value;
|
|
137
|
+
if ('number' == typeof value) {
|
|
138
|
+
if (Number.isFinite(value)) return value;
|
|
139
|
+
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be a finite number`);
|
|
140
|
+
}
|
|
141
|
+
if (Array.isArray(value)) return value.map((item, index)=>toJsonValue(item, `${path}[${index}]`));
|
|
142
|
+
if (isPlainRecord(value)) {
|
|
143
|
+
const result = {};
|
|
144
|
+
for (const [key, nestedValue] of Object.entries(value))result[key] = toJsonValue(nestedValue, path ? `${path}.${key}` : key);
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be JSON-serializable`);
|
|
148
|
+
}
|
|
149
|
+
function normalizeClientConfig(clientConfig) {
|
|
150
|
+
const config = clientConfig ?? {};
|
|
151
|
+
const normalized = toJsonValue(config, '');
|
|
152
|
+
if (!isPlainRecord(normalized)) throw new TypeError('heap: clientConfig must be a plain object');
|
|
153
|
+
return {
|
|
154
|
+
...normalized,
|
|
155
|
+
shouldFetchServerConfig: false
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function resolveHeapScriptUrl(envId, scriptUrl) {
|
|
159
|
+
return (0, script_url_cjs_namespaceObject.resolveScriptUrl)((0, script_url_cjs_namespaceObject.trimToUndefined)(scriptUrl), (0, script_url_cjs_namespaceObject.joinUrlPath)(DEFAULT_HEAP_CONFIG_BASE_URL, `${envId}/heap_config.js`));
|
|
160
|
+
}
|
|
161
|
+
function heap({ envId, clientConfig, scriptUrl }) {
|
|
162
|
+
const normalizedEnvId = validateEnvId(envId);
|
|
163
|
+
return (0, external_resolve_cjs_namespaceObject.resolveManifest)(heapManifest, {
|
|
164
|
+
envId: normalizedEnvId,
|
|
165
|
+
clientConfig: normalizeClientConfig(clientConfig),
|
|
166
|
+
scriptUrl: resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
exports.DEFAULT_HEAP_CONFIG_BASE_URL = __webpack_exports__.DEFAULT_HEAP_CONFIG_BASE_URL;
|
|
170
|
+
exports.HEAP_QUEUE_METHODS = __webpack_exports__.HEAP_QUEUE_METHODS;
|
|
171
|
+
exports.heap = __webpack_exports__.heap;
|
|
172
|
+
exports.heapManifest = __webpack_exports__.heapManifest;
|
|
173
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
174
|
+
"DEFAULT_HEAP_CONFIG_BASE_URL",
|
|
175
|
+
"HEAP_QUEUE_METHODS",
|
|
176
|
+
"heap",
|
|
177
|
+
"heapManifest"
|
|
178
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
179
|
+
Object.defineProperty(exports, '__esModule', {
|
|
180
|
+
value: true
|
|
181
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { resolveManifest } from "../../resolve.js";
|
|
2
|
+
import { vendorManifestContract } from "../../types.js";
|
|
3
|
+
import { joinUrlPath, resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
|
|
4
|
+
const DEFAULT_HEAP_CONFIG_BASE_URL = 'https://cdn.us.heap-api.com/config';
|
|
5
|
+
const HEAP_QUEUE_METHODS = [
|
|
6
|
+
'init',
|
|
7
|
+
'startTracking',
|
|
8
|
+
'stopTracking',
|
|
9
|
+
'track',
|
|
10
|
+
'resetIdentity',
|
|
11
|
+
'identify',
|
|
12
|
+
'identifyHashed',
|
|
13
|
+
'getSessionId',
|
|
14
|
+
'getUserId',
|
|
15
|
+
'getIdentity',
|
|
16
|
+
'addUserProperties',
|
|
17
|
+
'addEventProperties',
|
|
18
|
+
'removeEventProperty',
|
|
19
|
+
'clearEventProperties',
|
|
20
|
+
'addAccountProperties',
|
|
21
|
+
'addAdapter',
|
|
22
|
+
'addTransformer',
|
|
23
|
+
'addTransformerFn',
|
|
24
|
+
'onReady',
|
|
25
|
+
'addPageviewProperties',
|
|
26
|
+
'removePageviewProperty',
|
|
27
|
+
'clearPageviewProperties',
|
|
28
|
+
'trackPageview'
|
|
29
|
+
];
|
|
30
|
+
const heapManifest = {
|
|
31
|
+
...vendorManifestContract,
|
|
32
|
+
vendor: 'heap',
|
|
33
|
+
category: 'measurement',
|
|
34
|
+
install: [
|
|
35
|
+
{
|
|
36
|
+
type: 'setGlobal',
|
|
37
|
+
name: 'heapReadyCb',
|
|
38
|
+
value: [],
|
|
39
|
+
ifUndefined: true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'setGlobal',
|
|
43
|
+
name: 'heap',
|
|
44
|
+
value: [],
|
|
45
|
+
ifUndefined: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'setGlobalPath',
|
|
49
|
+
path: [
|
|
50
|
+
'heap',
|
|
51
|
+
'envId'
|
|
52
|
+
],
|
|
53
|
+
value: '{{envId}}'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'setGlobalPath',
|
|
57
|
+
path: [
|
|
58
|
+
'heap',
|
|
59
|
+
'appid'
|
|
60
|
+
],
|
|
61
|
+
value: '{{envId}}'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'setGlobalPath',
|
|
65
|
+
path: [
|
|
66
|
+
'heap',
|
|
67
|
+
'clientConfig'
|
|
68
|
+
],
|
|
69
|
+
value: '{{clientConfig}}'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'defineQueueMethods',
|
|
73
|
+
target: 'heap',
|
|
74
|
+
queue: {
|
|
75
|
+
global: 'heapReadyCb'
|
|
76
|
+
},
|
|
77
|
+
queueFormat: 'callback',
|
|
78
|
+
methods: [
|
|
79
|
+
...HEAP_QUEUE_METHODS
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'loadScript',
|
|
84
|
+
src: "{{scriptUrl}}",
|
|
85
|
+
async: true
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
};
|
|
89
|
+
function validateEnvId(envId) {
|
|
90
|
+
const normalized = 'string' == typeof envId ? envId.trim() : '';
|
|
91
|
+
if (0 === normalized.length) throw new Error('heap: missing or invalid envId');
|
|
92
|
+
return normalized;
|
|
93
|
+
}
|
|
94
|
+
function isPlainRecord(value) {
|
|
95
|
+
if (null === value || 'object' != typeof value || Array.isArray(value)) return false;
|
|
96
|
+
const prototype = Object.getPrototypeOf(value);
|
|
97
|
+
return prototype === Object.prototype || null === prototype;
|
|
98
|
+
}
|
|
99
|
+
function toJsonValue(value, path) {
|
|
100
|
+
if (null === value) return null;
|
|
101
|
+
if ('string' == typeof value || 'boolean' == typeof value) return value;
|
|
102
|
+
if ('number' == typeof value) {
|
|
103
|
+
if (Number.isFinite(value)) return value;
|
|
104
|
+
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be a finite number`);
|
|
105
|
+
}
|
|
106
|
+
if (Array.isArray(value)) return value.map((item, index)=>toJsonValue(item, `${path}[${index}]`));
|
|
107
|
+
if (isPlainRecord(value)) {
|
|
108
|
+
const result = {};
|
|
109
|
+
for (const [key, nestedValue] of Object.entries(value))result[key] = toJsonValue(nestedValue, path ? `${path}.${key}` : key);
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
throw new TypeError(`heap: clientConfig${path ? `.${path}` : ''} must be JSON-serializable`);
|
|
113
|
+
}
|
|
114
|
+
function normalizeClientConfig(clientConfig) {
|
|
115
|
+
const config = clientConfig ?? {};
|
|
116
|
+
const normalized = toJsonValue(config, '');
|
|
117
|
+
if (!isPlainRecord(normalized)) throw new TypeError('heap: clientConfig must be a plain object');
|
|
118
|
+
return {
|
|
119
|
+
...normalized,
|
|
120
|
+
shouldFetchServerConfig: false
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function resolveHeapScriptUrl(envId, scriptUrl) {
|
|
124
|
+
return resolveScriptUrl(trimToUndefined(scriptUrl), joinUrlPath(DEFAULT_HEAP_CONFIG_BASE_URL, `${envId}/heap_config.js`));
|
|
125
|
+
}
|
|
126
|
+
function heap({ envId, clientConfig, scriptUrl }) {
|
|
127
|
+
const normalizedEnvId = validateEnvId(envId);
|
|
128
|
+
return resolveManifest(heapManifest, {
|
|
129
|
+
envId: normalizedEnvId,
|
|
130
|
+
clientConfig: normalizeClientConfig(clientConfig),
|
|
131
|
+
scriptUrl: resolveHeapScriptUrl(normalizedEnvId, scriptUrl)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
export { DEFAULT_HEAP_CONFIG_BASE_URL, HEAP_QUEUE_METHODS, heap, heapManifest };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
HIGHTOUCH_QUEUE_METHODS: ()=>HIGHTOUCH_QUEUE_METHODS,
|
|
32
|
+
hightouch: ()=>hightouch,
|
|
33
|
+
hightouchManifest: ()=>hightouchManifest
|
|
34
|
+
});
|
|
35
|
+
const external_resolve_cjs_namespaceObject = require("../../resolve.cjs");
|
|
36
|
+
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
37
|
+
const script_url_cjs_namespaceObject = require("../_shared/script-url.cjs");
|
|
38
|
+
const DEFAULT_HIGHTOUCH_SCRIPT_URL = 'https://cdn.hightouch-events.com/browser/release/v1-latest/events.min.js';
|
|
39
|
+
const HIGHTOUCH_QUEUE_METHODS = [
|
|
40
|
+
'trackSubmit',
|
|
41
|
+
'trackClick',
|
|
42
|
+
'trackLink',
|
|
43
|
+
'trackForm',
|
|
44
|
+
'pageview',
|
|
45
|
+
'identify',
|
|
46
|
+
'reset',
|
|
47
|
+
'group',
|
|
48
|
+
'track',
|
|
49
|
+
'ready',
|
|
50
|
+
'alias',
|
|
51
|
+
'debug',
|
|
52
|
+
'page',
|
|
53
|
+
'once',
|
|
54
|
+
'off',
|
|
55
|
+
'on',
|
|
56
|
+
'addSourceMiddleware',
|
|
57
|
+
'addIntegrationMiddleware',
|
|
58
|
+
'setAnonymousId',
|
|
59
|
+
'addDestinationMiddleware',
|
|
60
|
+
'load'
|
|
61
|
+
];
|
|
62
|
+
const hightouchManifest = {
|
|
63
|
+
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
64
|
+
vendor: 'hightouch',
|
|
65
|
+
category: 'measurement',
|
|
66
|
+
bootstrap: [
|
|
67
|
+
{
|
|
68
|
+
type: 'setGlobal',
|
|
69
|
+
name: 'htevents',
|
|
70
|
+
value: [],
|
|
71
|
+
ifUndefined: true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'defineQueueMethods',
|
|
75
|
+
target: 'htevents',
|
|
76
|
+
methods: [
|
|
77
|
+
...HIGHTOUCH_QUEUE_METHODS
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'setGlobalPath',
|
|
82
|
+
path: [
|
|
83
|
+
'htevents',
|
|
84
|
+
'_writeKey'
|
|
85
|
+
],
|
|
86
|
+
value: '{{writeKey}}'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'setGlobalPath',
|
|
90
|
+
path: [
|
|
91
|
+
'htevents',
|
|
92
|
+
'_loadOptions'
|
|
93
|
+
],
|
|
94
|
+
value: '{{loadOptions}}'
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
install: [
|
|
98
|
+
{
|
|
99
|
+
type: 'callGlobal',
|
|
100
|
+
global: 'htevents',
|
|
101
|
+
method: 'load',
|
|
102
|
+
args: [
|
|
103
|
+
'{{writeKey}}',
|
|
104
|
+
'{{loadOptions}}'
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'callGlobal',
|
|
109
|
+
global: 'htevents',
|
|
110
|
+
method: 'page'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: 'loadScript',
|
|
114
|
+
src: "{{scriptUrl}}",
|
|
115
|
+
async: true
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
function validateWriteKey(writeKey) {
|
|
120
|
+
const normalized = 'string' == typeof writeKey ? writeKey.trim() : '';
|
|
121
|
+
if (0 === normalized.length) throw new Error('hightouch: missing or invalid writeKey');
|
|
122
|
+
return normalized;
|
|
123
|
+
}
|
|
124
|
+
function normalizeApiHost(apiHost) {
|
|
125
|
+
return (0, script_url_cjs_namespaceObject.trimToUndefined)(apiHost);
|
|
126
|
+
}
|
|
127
|
+
function hightouch({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
|
|
128
|
+
const normalizedWriteKey = validateWriteKey(writeKey);
|
|
129
|
+
const loadOptions = {
|
|
130
|
+
apiHost: normalizeApiHost(apiHost)
|
|
131
|
+
};
|
|
132
|
+
let manifest = hightouchManifest;
|
|
133
|
+
if (!trackPageView) manifest = {
|
|
134
|
+
...hightouchManifest,
|
|
135
|
+
install: hightouchManifest.install.filter((step)=>!('callGlobal' === step.type && 'htevents' === step.global && 'page' === step.method))
|
|
136
|
+
};
|
|
137
|
+
return (0, external_resolve_cjs_namespaceObject.resolveManifest)(manifest, {
|
|
138
|
+
loadOptions,
|
|
139
|
+
writeKey: normalizedWriteKey,
|
|
140
|
+
scriptUrl: (0, script_url_cjs_namespaceObject.resolveScriptUrl)((0, script_url_cjs_namespaceObject.trimToUndefined)(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL)
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
exports.HIGHTOUCH_QUEUE_METHODS = __webpack_exports__.HIGHTOUCH_QUEUE_METHODS;
|
|
144
|
+
exports.hightouch = __webpack_exports__.hightouch;
|
|
145
|
+
exports.hightouchManifest = __webpack_exports__.hightouchManifest;
|
|
146
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
147
|
+
"HIGHTOUCH_QUEUE_METHODS",
|
|
148
|
+
"hightouch",
|
|
149
|
+
"hightouchManifest"
|
|
150
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
151
|
+
Object.defineProperty(exports, '__esModule', {
|
|
152
|
+
value: true
|
|
153
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { resolveManifest } from "../../resolve.js";
|
|
2
|
+
import { vendorManifestContract } from "../../types.js";
|
|
3
|
+
import { resolveScriptUrl, trimToUndefined } from "../_shared/script-url.js";
|
|
4
|
+
const DEFAULT_HIGHTOUCH_SCRIPT_URL = 'https://cdn.hightouch-events.com/browser/release/v1-latest/events.min.js';
|
|
5
|
+
const HIGHTOUCH_QUEUE_METHODS = [
|
|
6
|
+
'trackSubmit',
|
|
7
|
+
'trackClick',
|
|
8
|
+
'trackLink',
|
|
9
|
+
'trackForm',
|
|
10
|
+
'pageview',
|
|
11
|
+
'identify',
|
|
12
|
+
'reset',
|
|
13
|
+
'group',
|
|
14
|
+
'track',
|
|
15
|
+
'ready',
|
|
16
|
+
'alias',
|
|
17
|
+
'debug',
|
|
18
|
+
'page',
|
|
19
|
+
'once',
|
|
20
|
+
'off',
|
|
21
|
+
'on',
|
|
22
|
+
'addSourceMiddleware',
|
|
23
|
+
'addIntegrationMiddleware',
|
|
24
|
+
'setAnonymousId',
|
|
25
|
+
'addDestinationMiddleware',
|
|
26
|
+
'load'
|
|
27
|
+
];
|
|
28
|
+
const hightouchManifest = {
|
|
29
|
+
...vendorManifestContract,
|
|
30
|
+
vendor: 'hightouch',
|
|
31
|
+
category: 'measurement',
|
|
32
|
+
bootstrap: [
|
|
33
|
+
{
|
|
34
|
+
type: 'setGlobal',
|
|
35
|
+
name: 'htevents',
|
|
36
|
+
value: [],
|
|
37
|
+
ifUndefined: true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'defineQueueMethods',
|
|
41
|
+
target: 'htevents',
|
|
42
|
+
methods: [
|
|
43
|
+
...HIGHTOUCH_QUEUE_METHODS
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'setGlobalPath',
|
|
48
|
+
path: [
|
|
49
|
+
'htevents',
|
|
50
|
+
'_writeKey'
|
|
51
|
+
],
|
|
52
|
+
value: '{{writeKey}}'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'setGlobalPath',
|
|
56
|
+
path: [
|
|
57
|
+
'htevents',
|
|
58
|
+
'_loadOptions'
|
|
59
|
+
],
|
|
60
|
+
value: '{{loadOptions}}'
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
install: [
|
|
64
|
+
{
|
|
65
|
+
type: 'callGlobal',
|
|
66
|
+
global: 'htevents',
|
|
67
|
+
method: 'load',
|
|
68
|
+
args: [
|
|
69
|
+
'{{writeKey}}',
|
|
70
|
+
'{{loadOptions}}'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'callGlobal',
|
|
75
|
+
global: 'htevents',
|
|
76
|
+
method: 'page'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'loadScript',
|
|
80
|
+
src: "{{scriptUrl}}",
|
|
81
|
+
async: true
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
function validateWriteKey(writeKey) {
|
|
86
|
+
const normalized = 'string' == typeof writeKey ? writeKey.trim() : '';
|
|
87
|
+
if (0 === normalized.length) throw new Error('hightouch: missing or invalid writeKey');
|
|
88
|
+
return normalized;
|
|
89
|
+
}
|
|
90
|
+
function normalizeApiHost(apiHost) {
|
|
91
|
+
return trimToUndefined(apiHost);
|
|
92
|
+
}
|
|
93
|
+
function hightouch({ writeKey, apiHost, trackPageView = true, scriptUrl }) {
|
|
94
|
+
const normalizedWriteKey = validateWriteKey(writeKey);
|
|
95
|
+
const loadOptions = {
|
|
96
|
+
apiHost: normalizeApiHost(apiHost)
|
|
97
|
+
};
|
|
98
|
+
let manifest = hightouchManifest;
|
|
99
|
+
if (!trackPageView) manifest = {
|
|
100
|
+
...hightouchManifest,
|
|
101
|
+
install: hightouchManifest.install.filter((step)=>!('callGlobal' === step.type && 'htevents' === step.global && 'page' === step.method))
|
|
102
|
+
};
|
|
103
|
+
return resolveManifest(manifest, {
|
|
104
|
+
loadOptions,
|
|
105
|
+
writeKey: normalizedWriteKey,
|
|
106
|
+
scriptUrl: resolveScriptUrl(trimToUndefined(scriptUrl), DEFAULT_HIGHTOUCH_SCRIPT_URL)
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export { HIGHTOUCH_QUEUE_METHODS, hightouch, hightouchManifest };
|