@walkeros/web-destination-gtag 0.2.1 → 0.3.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/dist/examples/index.js +204 -74
- package/dist/examples/index.mjs +204 -74
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +361 -42
- package/dist/index.d.ts +361 -42
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/examples/index.mjs
CHANGED
|
@@ -195,16 +195,16 @@ var util;
|
|
|
195
195
|
return obj;
|
|
196
196
|
};
|
|
197
197
|
util2.getValidEnumValues = (obj) => {
|
|
198
|
-
const validKeys = util2.objectKeys(obj).filter((
|
|
198
|
+
const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
199
199
|
const filtered = {};
|
|
200
|
-
for (const
|
|
201
|
-
filtered[
|
|
200
|
+
for (const k of validKeys) {
|
|
201
|
+
filtered[k] = obj[k];
|
|
202
202
|
}
|
|
203
203
|
return util2.objectValues(filtered);
|
|
204
204
|
};
|
|
205
205
|
util2.objectValues = (obj) => {
|
|
206
|
-
return util2.objectKeys(obj).map(function(
|
|
207
|
-
return obj[
|
|
206
|
+
return util2.objectKeys(obj).map(function(e2) {
|
|
207
|
+
return obj[e2];
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
210
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
@@ -268,8 +268,8 @@ var ZodParsedType = util.arrayToEnum([
|
|
|
268
268
|
"set"
|
|
269
269
|
]);
|
|
270
270
|
var getParsedType = (data) => {
|
|
271
|
-
const
|
|
272
|
-
switch (
|
|
271
|
+
const t2 = typeof data;
|
|
272
|
+
switch (t2) {
|
|
273
273
|
case "undefined":
|
|
274
274
|
return ZodParsedType.undefined;
|
|
275
275
|
case "string":
|
|
@@ -1071,7 +1071,7 @@ function isValidJWT(jwt, alg) {
|
|
|
1071
1071
|
if (alg && decoded.alg !== alg)
|
|
1072
1072
|
return false;
|
|
1073
1073
|
return true;
|
|
1074
|
-
} catch (
|
|
1074
|
+
} catch (e2) {
|
|
1075
1075
|
return false;
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
@@ -1230,7 +1230,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1230
1230
|
} else if (check.kind === "url") {
|
|
1231
1231
|
try {
|
|
1232
1232
|
new URL(input.data);
|
|
1233
|
-
} catch (
|
|
1233
|
+
} catch (e2) {
|
|
1234
1234
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1235
1235
|
addIssueToContext(ctx, {
|
|
1236
1236
|
validation: "url",
|
|
@@ -1882,7 +1882,7 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1882
1882
|
if (this._def.coerce) {
|
|
1883
1883
|
try {
|
|
1884
1884
|
input.data = BigInt(input.data);
|
|
1885
|
-
} catch (
|
|
1885
|
+
} catch (e2) {
|
|
1886
1886
|
return this._getInvalidInput(input);
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
@@ -2974,17 +2974,17 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
|
2974
2974
|
});
|
|
2975
2975
|
}
|
|
2976
2976
|
};
|
|
2977
|
-
function mergeValues(a,
|
|
2977
|
+
function mergeValues(a, b) {
|
|
2978
2978
|
const aType = getParsedType(a);
|
|
2979
|
-
const bType = getParsedType(
|
|
2980
|
-
if (a ===
|
|
2979
|
+
const bType = getParsedType(b);
|
|
2980
|
+
if (a === b) {
|
|
2981
2981
|
return { valid: true, data: a };
|
|
2982
2982
|
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
2983
|
-
const bKeys = util.objectKeys(
|
|
2983
|
+
const bKeys = util.objectKeys(b);
|
|
2984
2984
|
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2985
|
-
const newObj = { ...a, ...
|
|
2985
|
+
const newObj = { ...a, ...b };
|
|
2986
2986
|
for (const key of sharedKeys) {
|
|
2987
|
-
const sharedValue = mergeValues(a[key],
|
|
2987
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
2988
2988
|
if (!sharedValue.valid) {
|
|
2989
2989
|
return { valid: false };
|
|
2990
2990
|
}
|
|
@@ -2992,13 +2992,13 @@ function mergeValues(a, b2) {
|
|
|
2992
2992
|
}
|
|
2993
2993
|
return { valid: true, data: newObj };
|
|
2994
2994
|
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
2995
|
-
if (a.length !==
|
|
2995
|
+
if (a.length !== b.length) {
|
|
2996
2996
|
return { valid: false };
|
|
2997
2997
|
}
|
|
2998
2998
|
const newArray = [];
|
|
2999
2999
|
for (let index = 0; index < a.length; index++) {
|
|
3000
3000
|
const itemA = a[index];
|
|
3001
|
-
const itemB =
|
|
3001
|
+
const itemB = b[index];
|
|
3002
3002
|
const sharedValue = mergeValues(itemA, itemB);
|
|
3003
3003
|
if (!sharedValue.valid) {
|
|
3004
3004
|
return { valid: false };
|
|
@@ -3006,7 +3006,7 @@ function mergeValues(a, b2) {
|
|
|
3006
3006
|
newArray.push(sharedValue.data);
|
|
3007
3007
|
}
|
|
3008
3008
|
return { valid: true, data: newArray };
|
|
3009
|
-
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +
|
|
3009
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
3010
3010
|
return { valid: true, data: a };
|
|
3011
3011
|
} else {
|
|
3012
3012
|
return { valid: false };
|
|
@@ -3376,29 +3376,29 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
3376
3376
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3377
3377
|
const fn = ctx.data;
|
|
3378
3378
|
if (this._def.returns instanceof ZodPromise) {
|
|
3379
|
-
const
|
|
3379
|
+
const me2 = this;
|
|
3380
3380
|
return OK(async function(...args) {
|
|
3381
3381
|
const error = new ZodError([]);
|
|
3382
|
-
const parsedArgs = await
|
|
3383
|
-
error.addIssue(makeArgsIssue(args,
|
|
3382
|
+
const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e2) => {
|
|
3383
|
+
error.addIssue(makeArgsIssue(args, e2));
|
|
3384
3384
|
throw error;
|
|
3385
3385
|
});
|
|
3386
3386
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3387
|
-
const parsedReturns = await
|
|
3388
|
-
error.addIssue(makeReturnsIssue(result,
|
|
3387
|
+
const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e2) => {
|
|
3388
|
+
error.addIssue(makeReturnsIssue(result, e2));
|
|
3389
3389
|
throw error;
|
|
3390
3390
|
});
|
|
3391
3391
|
return parsedReturns;
|
|
3392
3392
|
});
|
|
3393
3393
|
} else {
|
|
3394
|
-
const
|
|
3394
|
+
const me2 = this;
|
|
3395
3395
|
return OK(function(...args) {
|
|
3396
|
-
const parsedArgs =
|
|
3396
|
+
const parsedArgs = me2._def.args.safeParse(args, params);
|
|
3397
3397
|
if (!parsedArgs.success) {
|
|
3398
3398
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3399
3399
|
}
|
|
3400
3400
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3401
|
-
const parsedReturns =
|
|
3401
|
+
const parsedReturns = me2._def.returns.safeParse(result, params);
|
|
3402
3402
|
if (!parsedReturns.success) {
|
|
3403
3403
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
3404
3404
|
}
|
|
@@ -3960,10 +3960,10 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
3960
3960
|
}
|
|
3961
3961
|
}
|
|
3962
3962
|
}
|
|
3963
|
-
static create(a,
|
|
3963
|
+
static create(a, b) {
|
|
3964
3964
|
return new _ZodPipeline({
|
|
3965
3965
|
in: a,
|
|
3966
|
-
out:
|
|
3966
|
+
out: b,
|
|
3967
3967
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3968
3968
|
});
|
|
3969
3969
|
}
|
|
@@ -4761,7 +4761,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
4761
4761
|
}
|
|
4762
4762
|
try {
|
|
4763
4763
|
new RegExp(pattern);
|
|
4764
|
-
} catch (
|
|
4764
|
+
} catch (e2) {
|
|
4765
4765
|
console.warn(`Could not convert regex pattern at ${refs.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`);
|
|
4766
4766
|
return regex.source;
|
|
4767
4767
|
}
|
|
@@ -4770,7 +4770,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
4770
4770
|
|
|
4771
4771
|
// ../../../core/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
4772
4772
|
function parseRecordDef(def, refs) {
|
|
4773
|
-
var _a, _b, _c, _d,
|
|
4773
|
+
var _a, _b, _c, _d, _e2, _f, _g;
|
|
4774
4774
|
if (refs.target === "openAi") {
|
|
4775
4775
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
4776
4776
|
}
|
|
@@ -4807,7 +4807,7 @@ function parseRecordDef(def, refs) {
|
|
|
4807
4807
|
...schema,
|
|
4808
4808
|
propertyNames: keyType
|
|
4809
4809
|
};
|
|
4810
|
-
} else if (((
|
|
4810
|
+
} else if (((_e2 = def.keyType) == null ? void 0 : _e2._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
|
|
4811
4811
|
return {
|
|
4812
4812
|
...schema,
|
|
4813
4813
|
propertyNames: {
|
|
@@ -5097,7 +5097,7 @@ function decideAdditionalProperties(def, refs) {
|
|
|
5097
5097
|
function safeIsOptional(schema) {
|
|
5098
5098
|
try {
|
|
5099
5099
|
return schema.isOptional();
|
|
5100
|
-
} catch (
|
|
5100
|
+
} catch (e2) {
|
|
5101
5101
|
return true;
|
|
5102
5102
|
}
|
|
5103
5103
|
}
|
|
@@ -5133,12 +5133,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
5133
5133
|
...refs,
|
|
5134
5134
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
5135
5135
|
});
|
|
5136
|
-
const
|
|
5136
|
+
const b = parseDef(def.out._def, {
|
|
5137
5137
|
...refs,
|
|
5138
5138
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
5139
5139
|
});
|
|
5140
5140
|
return {
|
|
5141
|
-
allOf: [a,
|
|
5141
|
+
allOf: [a, b].filter((x2) => x2 !== void 0)
|
|
5142
5142
|
};
|
|
5143
5143
|
};
|
|
5144
5144
|
|
|
@@ -5412,52 +5412,182 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
5412
5412
|
};
|
|
5413
5413
|
|
|
5414
5414
|
// ../../../core/dist/index.mjs
|
|
5415
|
-
var
|
|
5416
|
-
var
|
|
5417
|
-
var
|
|
5418
|
-
|
|
5419
|
-
var
|
|
5420
|
-
var
|
|
5421
|
-
var S =
|
|
5422
|
-
var
|
|
5423
|
-
var
|
|
5424
|
-
var
|
|
5425
|
-
var
|
|
5426
|
-
var
|
|
5427
|
-
var
|
|
5428
|
-
var
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5415
|
+
var e = Object.defineProperty;
|
|
5416
|
+
var t = (t2, n) => {
|
|
5417
|
+
for (var i in n) e(t2, i, { get: n[i], enumerable: true });
|
|
5418
|
+
};
|
|
5419
|
+
var h = external_exports.string();
|
|
5420
|
+
var y = external_exports.number();
|
|
5421
|
+
var S = external_exports.boolean();
|
|
5422
|
+
var v = external_exports.string().min(1);
|
|
5423
|
+
var j = external_exports.number().int().positive();
|
|
5424
|
+
var w = external_exports.number().int().nonnegative();
|
|
5425
|
+
var x = external_exports.number().describe("Tagging version number");
|
|
5426
|
+
var E = external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]);
|
|
5427
|
+
var C = E.optional();
|
|
5428
|
+
var P = {};
|
|
5429
|
+
t(P, { ErrorHandlerSchema: () => O, HandlerSchema: () => L, LogHandlerSchema: () => J, StorageSchema: () => I, StorageTypeSchema: () => $, errorHandlerJsonSchema: () => R, handlerJsonSchema: () => q, logHandlerJsonSchema: () => A, storageJsonSchema: () => M, storageTypeJsonSchema: () => T });
|
|
5430
|
+
var $ = external_exports.enum(["local", "session", "cookie"]).describe("Storage mechanism: local, session, or cookie");
|
|
5431
|
+
var I = external_exports.object({ Local: external_exports.literal("local"), Session: external_exports.literal("session"), Cookie: external_exports.literal("cookie") }).describe("Storage type constants for type-safe references");
|
|
5432
|
+
var O = external_exports.any().describe("Error handler function: (error, state?) => void");
|
|
5433
|
+
var J = external_exports.any().describe("Log handler function: (message, verbose?) => void");
|
|
5434
|
+
var L = external_exports.object({ Error: O.describe("Error handler function"), Log: J.describe("Log handler function") }).describe("Handler interface with error and log functions");
|
|
5435
|
+
var T = zodToJsonSchema($, { target: "jsonSchema7", $refStrategy: "relative", name: "StorageType" });
|
|
5436
|
+
var M = zodToJsonSchema(I, { target: "jsonSchema7", $refStrategy: "relative", name: "Storage" });
|
|
5437
|
+
var R = zodToJsonSchema(O, { target: "jsonSchema7", $refStrategy: "relative", name: "ErrorHandler" });
|
|
5438
|
+
var A = zodToJsonSchema(J, { target: "jsonSchema7", $refStrategy: "relative", name: "LogHandler" });
|
|
5439
|
+
var q = zodToJsonSchema(L, { target: "jsonSchema7", $refStrategy: "relative", name: "Handler" });
|
|
5440
|
+
var U = external_exports.object({ onError: O.optional().describe("Error handler function: (error, state?) => void"), onLog: J.optional().describe("Log handler function: (message, verbose?) => void") }).partial();
|
|
5441
|
+
var N = external_exports.object({ verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional() }).partial();
|
|
5442
|
+
var B = external_exports.object({ queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional() }).partial();
|
|
5443
|
+
var W = external_exports.object({}).partial();
|
|
5444
|
+
var V = external_exports.object({ init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional() }).partial();
|
|
5445
|
+
var H = external_exports.object({ disabled: external_exports.boolean().describe("Set to true to disable").optional() }).partial();
|
|
5446
|
+
var _ = external_exports.object({ primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).partial();
|
|
5447
|
+
var K = external_exports.object({ settings: external_exports.any().optional().describe("Implementation-specific configuration") }).partial();
|
|
5448
|
+
var F = external_exports.object({ env: external_exports.any().optional().describe("Environment dependencies (platform-specific)") }).partial();
|
|
5449
|
+
var Z = external_exports.object({ type: external_exports.string().optional().describe("Instance type identifier"), config: external_exports.any().describe("Instance configuration") }).partial();
|
|
5450
|
+
var ee = external_exports.object({ collector: external_exports.any().describe("Collector instance (runtime object)"), config: external_exports.any().describe("Configuration"), env: external_exports.any().describe("Environment dependencies") }).partial();
|
|
5451
|
+
var te = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), batched: external_exports.any().optional().describe("Batch of events to be processed") }).partial();
|
|
5452
|
+
var ne = external_exports.object({ ignore: external_exports.boolean().describe("Set to true to skip processing").optional(), condition: external_exports.string().optional().describe("Condition function: return true to process") }).partial();
|
|
5453
|
+
var ie = external_exports.object({ sources: external_exports.record(external_exports.string(), external_exports.any()).describe("Map of source instances") }).partial();
|
|
5454
|
+
var oe = external_exports.object({ destinations: external_exports.record(external_exports.string(), external_exports.any()).describe("Map of destination instances") }).partial();
|
|
5455
|
+
var re = {};
|
|
5456
|
+
t(re, { ConsentSchema: () => me, DeepPartialEventSchema: () => je, EntitiesSchema: () => ye, EntitySchema: () => he, EventSchema: () => Se, OrderedPropertiesSchema: () => pe, PartialEventSchema: () => ve, PropertiesSchema: () => de, PropertySchema: () => le, PropertyTypeSchema: () => ce, SourceSchema: () => fe, SourceTypeSchema: () => ue, UserSchema: () => ge, VersionSchema: () => be, consentJsonSchema: () => De, entityJsonSchema: () => Pe, eventJsonSchema: () => we, orderedPropertiesJsonSchema: () => ke, partialEventJsonSchema: () => xe, propertiesJsonSchema: () => Ce, sourceTypeJsonSchema: () => ze, userJsonSchema: () => Ee });
|
|
5457
|
+
var ce = external_exports.lazy(() => external_exports.union([external_exports.boolean(), external_exports.string(), external_exports.number(), external_exports.record(external_exports.string(), le)]));
|
|
5458
|
+
var le = external_exports.lazy(() => external_exports.union([ce, external_exports.array(ce)]));
|
|
5459
|
+
var de = external_exports.record(external_exports.string(), le.optional()).describe("Flexible property collection with optional values");
|
|
5460
|
+
var pe = external_exports.record(external_exports.string(), external_exports.tuple([le, external_exports.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control");
|
|
5461
|
+
var ue = external_exports.union([external_exports.enum(["web", "server", "app", "other"]), external_exports.string()]).describe("Source type: web, server, app, other, or custom");
|
|
5462
|
+
var me = external_exports.record(external_exports.string(), external_exports.boolean()).describe("Consent requirement mapping (group name \u2192 state)");
|
|
5463
|
+
var ge = de.and(external_exports.object({ id: external_exports.string().optional().describe("User identifier"), device: external_exports.string().optional().describe("Device identifier"), session: external_exports.string().optional().describe("Session identifier"), hash: external_exports.string().optional().describe("Hashed identifier"), address: external_exports.string().optional().describe("User address"), email: external_exports.string().email().optional().describe("User email address"), phone: external_exports.string().optional().describe("User phone number"), userAgent: external_exports.string().optional().describe("Browser user agent string"), browser: external_exports.string().optional().describe("Browser name"), browserVersion: external_exports.string().optional().describe("Browser version"), deviceType: external_exports.string().optional().describe("Device type (mobile, desktop, tablet)"), os: external_exports.string().optional().describe("Operating system"), osVersion: external_exports.string().optional().describe("Operating system version"), screenSize: external_exports.string().optional().describe("Screen dimensions"), language: external_exports.string().optional().describe("User language"), country: external_exports.string().optional().describe("User country"), region: external_exports.string().optional().describe("User region/state"), city: external_exports.string().optional().describe("User city"), zip: external_exports.string().optional().describe("User postal code"), timezone: external_exports.string().optional().describe("User timezone"), ip: external_exports.string().optional().describe("User IP address"), internal: external_exports.boolean().optional().describe("Internal user flag (employee, test user)") })).describe("User identification and properties");
|
|
5464
|
+
var be = de.and(external_exports.object({ source: h.describe('Walker implementation version (e.g., "2.0.0")'), tagging: x })).describe("Walker version information");
|
|
5465
|
+
var fe = de.and(external_exports.object({ type: ue.describe("Source type identifier"), id: h.describe("Source identifier (typically URL on web)"), previous_id: h.describe("Previous source identifier (typically referrer on web)") })).describe("Event source information");
|
|
5466
|
+
var he = external_exports.lazy(() => external_exports.object({ entity: external_exports.string().describe("Entity name"), data: de.describe("Entity-specific properties"), nested: external_exports.array(he).describe("Nested child entities"), context: pe.describe("Entity context data") })).describe("Nested entity structure with recursive nesting support");
|
|
5467
|
+
var ye = external_exports.array(he).describe("Array of nested entities");
|
|
5468
|
+
var Se = external_exports.object({ name: external_exports.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'), data: de.describe("Event-specific properties"), context: pe.describe("Ordered context properties with priorities"), globals: de.describe("Global properties shared across events"), custom: de.describe("Custom implementation-specific properties"), user: ge.describe("User identification and attributes"), nested: ye.describe("Related nested entities"), consent: me.describe("Consent states at event time"), id: v.describe("Unique event identifier (timestamp-based)"), trigger: h.describe("Event trigger identifier"), entity: h.describe("Parsed entity from event name"), action: h.describe("Parsed action from event name"), timestamp: j.describe("Unix timestamp in milliseconds since epoch"), timing: y.describe("Event processing timing information"), group: h.describe("Event grouping identifier"), count: w.describe("Event count in session"), version: be.describe("Walker version information"), source: fe.describe("Event source information") }).describe("Complete walkerOS event structure");
|
|
5469
|
+
var ve = Se.partial().describe("Partial event structure with all fields optional");
|
|
5470
|
+
var je = external_exports.lazy(() => Se.deepPartial()).describe("Deep partial event structure with all nested fields optional");
|
|
5471
|
+
var we = zodToJsonSchema(Se, { target: "jsonSchema7", $refStrategy: "relative", name: "Event" });
|
|
5472
|
+
var xe = zodToJsonSchema(ve, { target: "jsonSchema7", $refStrategy: "relative", name: "PartialEvent" });
|
|
5473
|
+
var Ee = zodToJsonSchema(ge, { target: "jsonSchema7", $refStrategy: "relative", name: "User" });
|
|
5474
|
+
var Ce = zodToJsonSchema(de, { target: "jsonSchema7", $refStrategy: "relative", name: "Properties" });
|
|
5475
|
+
var ke = zodToJsonSchema(pe, { target: "jsonSchema7", $refStrategy: "relative", name: "OrderedProperties" });
|
|
5476
|
+
var Pe = zodToJsonSchema(he, { target: "jsonSchema7", $refStrategy: "relative", name: "Entity" });
|
|
5477
|
+
var ze = zodToJsonSchema(ue, { target: "jsonSchema7", $refStrategy: "relative", name: "SourceType" });
|
|
5478
|
+
var De = zodToJsonSchema(me, { target: "jsonSchema7", $refStrategy: "relative", name: "Consent" });
|
|
5479
|
+
var $e = {};
|
|
5480
|
+
t($e, { ConfigSchema: () => Be, LoopSchema: () => Te, MapSchema: () => Re, PolicySchema: () => qe, ResultSchema: () => We, RuleSchema: () => Ue, RulesSchema: () => Ne, SetSchema: () => Me, ValueConfigSchema: () => Ae, ValueSchema: () => Je, ValuesSchema: () => Le, configJsonSchema: () => Ye, loopJsonSchema: () => _e, mapJsonSchema: () => Fe, policyJsonSchema: () => Ge, ruleJsonSchema: () => Qe, rulesJsonSchema: () => Xe, setJsonSchema: () => Ke, valueConfigJsonSchema: () => He, valueJsonSchema: () => Ve });
|
|
5481
|
+
var Je = external_exports.lazy(() => external_exports.union([external_exports.string().describe('String value or property path (e.g., "data.id")'), external_exports.number().describe("Numeric value"), external_exports.boolean().describe("Boolean value"), Ae, external_exports.array(Je).describe("Array of values")]));
|
|
5482
|
+
var Le = external_exports.array(Je).describe("Array of transformation values");
|
|
5483
|
+
var Te = external_exports.tuple([Je, Je]).describe("Loop transformation: [source, transform] tuple for array processing");
|
|
5484
|
+
var Me = external_exports.array(Je).describe("Set: Array of values for selection or combination");
|
|
5485
|
+
var Re = external_exports.record(external_exports.string(), Je).describe("Map: Object mapping keys to transformation values");
|
|
5486
|
+
var Ae = external_exports.object({ key: external_exports.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'), value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()]).optional().describe("Static primitive value"), fn: external_exports.string().optional().describe("Custom transformation function as string (serialized)"), map: Re.optional().describe("Object mapping: transform event data to structured output"), loop: Te.optional().describe("Loop transformation: [source, transform] for array processing"), set: Me.optional().describe("Set of values: combine or select from multiple values"), consent: me.optional().describe("Required consent states to include this value"), condition: external_exports.string().optional().describe("Condition function as string: return true to include value"), validate: external_exports.string().optional().describe("Validation function as string: return true if value is valid") }).refine((e2) => Object.keys(e2).length > 0, { message: "ValueConfig must have at least one property" }).describe("Value transformation configuration with multiple strategies");
|
|
5487
|
+
var qe = external_exports.record(external_exports.string(), Je).describe("Policy rules for event pre-processing (key \u2192 value mapping)");
|
|
5488
|
+
var Ue = external_exports.object({ batch: external_exports.number().optional().describe("Batch size: bundle N events for batch processing"), condition: external_exports.string().optional().describe("Condition function as string: return true to process event"), consent: me.optional().describe("Required consent states to process this event"), settings: external_exports.any().optional().describe("Destination-specific settings for this event mapping"), data: external_exports.union([Je, Le]).optional().describe("Data transformation rules for event"), ignore: external_exports.boolean().optional().describe("Set to true to skip processing this event"), name: external_exports.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'), policy: qe.optional().describe("Event-level policy overrides (applied after config-level policy)") }).describe("Mapping rule for specific entity-action combination");
|
|
5489
|
+
var Ne = external_exports.record(external_exports.string(), external_exports.record(external_exports.string(), external_exports.union([Ue, external_exports.array(Ue)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support");
|
|
5490
|
+
var Be = external_exports.object({ consent: me.optional().describe("Required consent states to process any events"), data: external_exports.union([Je, Le]).optional().describe("Global data transformation applied to all events"), mapping: Ne.optional().describe("Entity-action specific mapping rules"), policy: qe.optional().describe("Pre-processing policy rules applied before mapping") }).describe("Shared mapping configuration for sources and destinations");
|
|
5491
|
+
var We = external_exports.object({ eventMapping: Ue.optional().describe("Resolved mapping rule for event"), mappingKey: external_exports.string().optional().describe('Mapping key used (e.g., "product.view")') }).describe("Mapping resolution result");
|
|
5492
|
+
var Ve = zodToJsonSchema(Je, { target: "jsonSchema7", $refStrategy: "relative", name: "Value" });
|
|
5493
|
+
var He = zodToJsonSchema(Ae, { target: "jsonSchema7", $refStrategy: "relative", name: "ValueConfig" });
|
|
5494
|
+
var _e = zodToJsonSchema(Te, { target: "jsonSchema7", $refStrategy: "relative", name: "Loop" });
|
|
5495
|
+
var Ke = zodToJsonSchema(Me, { target: "jsonSchema7", $refStrategy: "relative", name: "Set" });
|
|
5496
|
+
var Fe = zodToJsonSchema(Re, { target: "jsonSchema7", $refStrategy: "relative", name: "Map" });
|
|
5497
|
+
var Ge = zodToJsonSchema(qe, { target: "jsonSchema7", $refStrategy: "relative", name: "Policy" });
|
|
5498
|
+
var Qe = zodToJsonSchema(Ue, { target: "jsonSchema7", $refStrategy: "relative", name: "Rule" });
|
|
5499
|
+
var Xe = zodToJsonSchema(Ne, { target: "jsonSchema7", $refStrategy: "relative", name: "Rules" });
|
|
5500
|
+
var Ye = zodToJsonSchema(Be, { target: "jsonSchema7", $refStrategy: "relative", name: "MappingConfig" });
|
|
5501
|
+
var Ze = {};
|
|
5502
|
+
t(Ze, { BatchSchema: () => dt, ConfigSchema: () => nt, ContextSchema: () => rt, DLQSchema: () => St, DataSchema: () => pt, DestinationPolicySchema: () => ot, DestinationsSchema: () => bt, InitDestinationsSchema: () => gt, InitSchema: () => mt, InstanceSchema: () => ut, PartialConfigSchema: () => it, PushBatchContextSchema: () => st, PushContextSchema: () => at, PushEventSchema: () => ct, PushEventsSchema: () => lt, PushResultSchema: () => ht, RefSchema: () => ft, ResultSchema: () => yt, batchJsonSchema: () => Et, configJsonSchema: () => vt, contextJsonSchema: () => wt, instanceJsonSchema: () => Ct, partialConfigJsonSchema: () => jt, pushContextJsonSchema: () => xt, resultJsonSchema: () => kt });
|
|
5503
|
+
var nt = external_exports.object({ consent: me.optional().describe("Required consent states to send events to this destination"), settings: external_exports.any().describe("Implementation-specific configuration").optional(), data: external_exports.union([Je, Le]).optional().describe("Global data transformation applied to all events for this destination"), env: external_exports.any().describe("Environment dependencies (platform-specific)").optional(), id: v.describe("Destination instance identifier (defaults to destination key)").optional(), init: external_exports.boolean().describe("Whether to initialize immediately").optional(), loadScript: external_exports.boolean().describe("Whether to load external script (for web destinations)").optional(), mapping: Ne.optional().describe("Entity-action specific mapping rules for this destination"), policy: qe.optional().describe("Pre-processing policy rules applied before event mapping"), queue: external_exports.boolean().describe("Whether to queue events when consent is not granted").optional(), verbose: external_exports.boolean().describe("Enable verbose logging for debugging").optional(), onError: O.optional(), onLog: J.optional() }).describe("Destination configuration");
|
|
5504
|
+
var it = nt.deepPartial().describe("Partial destination configuration with all fields deeply optional");
|
|
5505
|
+
var ot = qe.describe("Destination policy rules for event pre-processing");
|
|
5506
|
+
var rt = external_exports.object({ collector: external_exports.any().describe("Collector instance (runtime object)"), config: nt.describe("Destination configuration"), data: external_exports.union([external_exports.any(), external_exports.undefined(), external_exports.array(external_exports.union([external_exports.any(), external_exports.undefined()]))]).optional().describe("Transformed event data"), env: external_exports.any().describe("Environment dependencies") }).describe("Destination context for init and push functions");
|
|
5507
|
+
var at = rt.extend({ mapping: Ue.optional().describe("Resolved mapping rule for this specific event") }).describe("Push context with event-specific mapping");
|
|
5508
|
+
var st = at.describe("Batch push context with event-specific mapping");
|
|
5509
|
+
var ct = external_exports.object({ event: Se.describe("The event to process"), mapping: Ue.optional().describe("Mapping rule for this event") }).describe("Event with optional mapping for batch processing");
|
|
5510
|
+
var lt = external_exports.array(ct).describe("Array of events with mappings");
|
|
5511
|
+
var dt = external_exports.object({ key: external_exports.string().describe('Batch key (usually mapping key like "product.view")'), events: external_exports.array(Se).describe("Array of events in batch"), data: external_exports.array(external_exports.union([external_exports.any(), external_exports.undefined(), external_exports.array(external_exports.union([external_exports.any(), external_exports.undefined()]))])).describe("Transformed data for each event"), mapping: Ue.optional().describe("Shared mapping rule for batch") }).describe("Batch of events grouped by mapping key");
|
|
5512
|
+
var pt = external_exports.union([external_exports.any(), external_exports.undefined(), external_exports.array(external_exports.union([external_exports.any(), external_exports.undefined()]))]).describe("Transformed event data (Property, undefined, or array)");
|
|
5513
|
+
var ut = external_exports.object({ config: nt.describe("Destination configuration"), queue: external_exports.array(Se).optional().describe("Queued events awaiting consent"), dlq: external_exports.array(external_exports.tuple([Se, external_exports.any()])).optional().describe("Dead letter queue (failed events with errors)"), type: external_exports.string().optional().describe("Destination type identifier"), env: external_exports.any().optional().describe("Environment dependencies"), init: external_exports.any().optional().describe("Initialization function"), push: external_exports.any().describe("Push function for single events"), pushBatch: external_exports.any().optional().describe("Batch push function"), on: external_exports.any().optional().describe("Event lifecycle hook function") }).describe("Destination instance (runtime object with functions)");
|
|
5514
|
+
var mt = external_exports.object({ code: ut.describe("Destination instance with implementation"), config: it.optional().describe("Partial configuration overrides"), env: external_exports.any().optional().describe("Partial environment overrides") }).describe("Destination initialization configuration");
|
|
5515
|
+
var gt = external_exports.record(external_exports.string(), mt).describe("Map of destination IDs to initialization configurations");
|
|
5516
|
+
var bt = external_exports.record(external_exports.string(), ut).describe("Map of destination IDs to runtime instances");
|
|
5517
|
+
var ft = external_exports.object({ id: external_exports.string().describe("Destination ID"), destination: ut.describe("Destination instance") }).describe("Destination reference (ID + instance)");
|
|
5518
|
+
var ht = external_exports.object({ queue: external_exports.array(Se).optional().describe("Events queued (awaiting consent)"), error: external_exports.any().optional().describe("Error if push failed") }).describe("Push operation result");
|
|
5519
|
+
var yt = external_exports.object({ successful: external_exports.array(ft).describe("Destinations that processed successfully"), queued: external_exports.array(ft).describe("Destinations that queued events"), failed: external_exports.array(ft).describe("Destinations that failed to process") }).describe("Overall destination processing result");
|
|
5520
|
+
var St = external_exports.array(external_exports.tuple([Se, external_exports.any()])).describe("Dead letter queue: [(event, error), ...]");
|
|
5521
|
+
var vt = zodToJsonSchema(nt, { target: "jsonSchema7", $refStrategy: "relative", name: "DestinationConfig" });
|
|
5522
|
+
var jt = zodToJsonSchema(it, { target: "jsonSchema7", $refStrategy: "relative", name: "PartialDestinationConfig" });
|
|
5523
|
+
var wt = zodToJsonSchema(rt, { target: "jsonSchema7", $refStrategy: "relative", name: "DestinationContext" });
|
|
5524
|
+
var xt = zodToJsonSchema(at, { target: "jsonSchema7", $refStrategy: "relative", name: "PushContext" });
|
|
5525
|
+
var Et = zodToJsonSchema(dt, { target: "jsonSchema7", $refStrategy: "relative", name: "Batch" });
|
|
5526
|
+
var Ct = zodToJsonSchema(ut, { target: "jsonSchema7", $refStrategy: "relative", name: "DestinationInstance" });
|
|
5527
|
+
var kt = zodToJsonSchema(yt, { target: "jsonSchema7", $refStrategy: "relative", name: "DestinationResult" });
|
|
5528
|
+
var Pt = {};
|
|
5529
|
+
t(Pt, { CommandTypeSchema: () => $t, ConfigSchema: () => It, DestinationsSchema: () => Mt, InitConfigSchema: () => Jt, InstanceSchema: () => Rt, PushContextSchema: () => Lt, SessionDataSchema: () => Ot, SourcesSchema: () => Tt, commandTypeJsonSchema: () => At, configJsonSchema: () => qt, initConfigJsonSchema: () => Nt, instanceJsonSchema: () => Wt, pushContextJsonSchema: () => Bt, sessionDataJsonSchema: () => Ut });
|
|
5530
|
+
var $t = external_exports.union([external_exports.enum(["action", "config", "consent", "context", "destination", "elb", "globals", "hook", "init", "link", "run", "user", "walker"]), external_exports.string()]).describe("Collector command type: standard commands or custom string for extensions");
|
|
5531
|
+
var It = external_exports.object({ run: external_exports.boolean().describe("Whether to run collector automatically on initialization").optional(), tagging: x, globalsStatic: de.describe("Static global properties that persist across collector runs"), sessionStatic: external_exports.record(external_exports.any()).describe("Static session data that persists across collector runs"), verbose: external_exports.boolean().describe("Enable verbose logging for debugging"), onError: O.optional(), onLog: J.optional() }).describe("Core collector configuration");
|
|
5532
|
+
var Ot = de.and(external_exports.object({ isStart: external_exports.boolean().describe("Whether this is a new session start"), storage: external_exports.boolean().describe("Whether storage is available"), id: v.describe("Session identifier").optional(), start: j.describe("Session start timestamp").optional(), marketing: external_exports.literal(true).optional().describe("Marketing attribution flag"), updated: j.describe("Last update timestamp").optional(), isNew: external_exports.boolean().describe("Whether this is a new session").optional(), device: v.describe("Device identifier").optional(), count: w.describe("Event count in session").optional(), runs: w.describe("Number of runs").optional() })).describe("Session state and tracking data");
|
|
5533
|
+
var Jt = It.partial().extend({ consent: me.optional().describe("Initial consent state"), user: ge.optional().describe("Initial user data"), globals: de.optional().describe("Initial global properties"), sources: external_exports.any().optional().describe("Source configurations"), destinations: external_exports.any().optional().describe("Destination configurations"), custom: de.optional().describe("Initial custom implementation-specific properties") }).describe("Collector initialization configuration with initial state");
|
|
5534
|
+
var Lt = external_exports.object({ mapping: Be.optional().describe("Source-level mapping configuration") }).describe("Push context with optional source mapping");
|
|
5535
|
+
var Tt = external_exports.record(external_exports.string(), external_exports.any()).describe("Map of source IDs to source instances");
|
|
5536
|
+
var Mt = external_exports.record(external_exports.string(), external_exports.any()).describe("Map of destination IDs to destination instances");
|
|
5537
|
+
var Rt = external_exports.object({ push: external_exports.any().describe("Push function for processing events"), command: external_exports.any().describe("Command function for walker commands"), allowed: external_exports.boolean().describe("Whether event processing is allowed"), config: It.describe("Current collector configuration"), consent: me.describe("Current consent state"), count: external_exports.number().describe("Event count (increments with each event)"), custom: de.describe("Custom implementation-specific properties"), sources: Tt.describe("Registered source instances"), destinations: Mt.describe("Registered destination instances"), globals: de.describe("Current global properties"), group: external_exports.string().describe("Event grouping identifier"), hooks: external_exports.any().describe("Lifecycle hook functions"), on: external_exports.any().describe("Event lifecycle configuration"), queue: external_exports.array(Se).describe("Queued events awaiting processing"), round: external_exports.number().describe("Collector run count (increments with each run)"), session: external_exports.union([external_exports.undefined(), Ot]).describe("Current session state"), timing: external_exports.number().describe("Event processing timing information"), user: ge.describe("Current user data"), version: external_exports.string().describe("Walker implementation version") }).describe("Collector instance with state and methods");
|
|
5538
|
+
var At = zodToJsonSchema($t, { target: "jsonSchema7", $refStrategy: "relative", name: "CommandType" });
|
|
5539
|
+
var qt = zodToJsonSchema(It, { target: "jsonSchema7", $refStrategy: "relative", name: "CollectorConfig" });
|
|
5540
|
+
var Ut = zodToJsonSchema(Ot, { target: "jsonSchema7", $refStrategy: "relative", name: "SessionData" });
|
|
5541
|
+
var Nt = zodToJsonSchema(Jt, { target: "jsonSchema7", $refStrategy: "relative", name: "InitConfig" });
|
|
5542
|
+
var Bt = zodToJsonSchema(Lt, { target: "jsonSchema7", $refStrategy: "relative", name: "CollectorPushContext" });
|
|
5543
|
+
var Wt = zodToJsonSchema(Rt, { target: "jsonSchema7", $refStrategy: "relative", name: "CollectorInstance" });
|
|
5544
|
+
var Vt = {};
|
|
5545
|
+
t(Vt, { BaseEnvSchema: () => Kt, ConfigSchema: () => Ft, InitSchema: () => Xt, InitSourceSchema: () => Yt, InitSourcesSchema: () => Zt, InstanceSchema: () => Qt, PartialConfigSchema: () => Gt, baseEnvJsonSchema: () => en, configJsonSchema: () => tn, initSourceJsonSchema: () => rn, initSourcesJsonSchema: () => an, instanceJsonSchema: () => on, partialConfigJsonSchema: () => nn });
|
|
5546
|
+
var Kt = external_exports.object({ push: external_exports.any().describe("Collector push function"), command: external_exports.any().describe("Collector command function"), sources: external_exports.any().optional().describe("Map of registered source instances"), elb: external_exports.any().describe("Public API function (alias for collector.push)") }).catchall(external_exports.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this");
|
|
5547
|
+
var Ft = Be.extend({ settings: external_exports.any().describe("Implementation-specific configuration").optional(), env: Kt.optional().describe("Environment dependencies (platform-specific)"), id: v.describe("Source identifier (defaults to source key)").optional(), onError: O.optional(), disabled: external_exports.boolean().describe("Set to true to disable").optional(), primary: external_exports.boolean().describe("Mark as primary (only one can be primary)").optional() }).describe("Source configuration with mapping and environment");
|
|
5548
|
+
var Gt = Ft.deepPartial().describe("Partial source configuration with all fields deeply optional");
|
|
5549
|
+
var Qt = external_exports.object({ type: external_exports.string().describe('Source type identifier (e.g., "browser", "dataLayer")'), config: Ft.describe("Current source configuration"), push: external_exports.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"), destroy: external_exports.any().optional().describe("Cleanup function called when source is removed"), on: external_exports.any().optional().describe("Lifecycle hook function for event types") }).describe("Source instance with push handler and lifecycle methods");
|
|
5550
|
+
var Xt = external_exports.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>");
|
|
5551
|
+
var Yt = external_exports.object({ code: Xt.describe("Source initialization function"), config: Gt.optional().describe("Partial configuration overrides"), env: Kt.partial().optional().describe("Partial environment overrides"), primary: external_exports.boolean().optional().describe("Mark as primary source (only one can be primary)") }).describe("Source initialization configuration");
|
|
5552
|
+
var Zt = external_exports.record(external_exports.string(), Yt).describe("Map of source IDs to initialization configurations");
|
|
5553
|
+
var en = zodToJsonSchema(Kt, { target: "jsonSchema7", $refStrategy: "relative", name: "SourceBaseEnv" });
|
|
5554
|
+
var tn = zodToJsonSchema(Ft, { target: "jsonSchema7", $refStrategy: "relative", name: "SourceConfig" });
|
|
5555
|
+
var nn = zodToJsonSchema(Gt, { target: "jsonSchema7", $refStrategy: "relative", name: "PartialSourceConfig" });
|
|
5556
|
+
var on = zodToJsonSchema(Qt, { target: "jsonSchema7", $refStrategy: "relative", name: "SourceInstance" });
|
|
5557
|
+
var rn = zodToJsonSchema(Yt, { target: "jsonSchema7", $refStrategy: "relative", name: "InitSource" });
|
|
5558
|
+
var an = zodToJsonSchema(Zt, { target: "jsonSchema7", $refStrategy: "relative", name: "InitSources" });
|
|
5559
|
+
var hn = { merge: true, shallow: true, extend: true };
|
|
5560
|
+
function yn(e2, t2 = {}, n = {}) {
|
|
5561
|
+
n = { ...hn, ...n };
|
|
5562
|
+
const i = Object.entries(t2).reduce((t3, [i2, o]) => {
|
|
5563
|
+
const r = e2[i2];
|
|
5564
|
+
return n.merge && Array.isArray(r) && Array.isArray(o) ? t3[i2] = o.reduce((e3, t4) => e3.includes(t4) ? e3 : [...e3, t4], [...r]) : (n.extend || i2 in e2) && (t3[i2] = o), t3;
|
|
5435
5565
|
}, {});
|
|
5436
|
-
return n.shallow ? { ...
|
|
5566
|
+
return n.shallow ? { ...e2, ...i } : (Object.assign(e2, i), e2);
|
|
5437
5567
|
}
|
|
5438
|
-
function
|
|
5439
|
-
return Array.isArray(
|
|
5568
|
+
function vn(e2) {
|
|
5569
|
+
return Array.isArray(e2);
|
|
5440
5570
|
}
|
|
5441
|
-
function
|
|
5442
|
-
return "object" == typeof
|
|
5571
|
+
function Pn(e2) {
|
|
5572
|
+
return "object" == typeof e2 && null !== e2 && !vn(e2) && "[object Object]" === Object.prototype.toString.call(e2);
|
|
5443
5573
|
}
|
|
5444
|
-
function
|
|
5574
|
+
function Mn(e2 = {}) {
|
|
5445
5575
|
var _a;
|
|
5446
|
-
const
|
|
5447
|
-
if (
|
|
5448
|
-
const [
|
|
5449
|
-
|
|
5576
|
+
const t2 = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", i = e2.count || 1, o = yn({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t2}-${n}-${i}`, trigger: "test", entity: "entity", action: "action", timestamp: t2, timing: 3.14, group: n, count: i, version: { source: "0.3.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
5577
|
+
if (e2.name) {
|
|
5578
|
+
const [t3, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
5579
|
+
t3 && n2 && (o.entity = t3, o.action = n2);
|
|
5450
5580
|
}
|
|
5451
5581
|
return o;
|
|
5452
5582
|
}
|
|
5453
|
-
function
|
|
5454
|
-
const n =
|
|
5455
|
-
return
|
|
5583
|
+
function Rn(e2 = "entity action", t2 = {}) {
|
|
5584
|
+
const n = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), i = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
5585
|
+
return Mn({ ...{ "cart view": { data: { currency: "EUR", value: 2 * i.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...i.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: i.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...i, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...i, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.elbwalker.com/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...i, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...i, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...i.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t2, name: e2 });
|
|
5456
5586
|
}
|
|
5457
5587
|
|
|
5458
5588
|
// src/examples/events.ts
|
|
5459
5589
|
function ga4Purchase() {
|
|
5460
|
-
const event =
|
|
5590
|
+
const event = Rn("order complete");
|
|
5461
5591
|
return [
|
|
5462
5592
|
"event",
|
|
5463
5593
|
"purchase",
|
|
@@ -5477,7 +5607,7 @@ function ga4Purchase() {
|
|
|
5477
5607
|
];
|
|
5478
5608
|
}
|
|
5479
5609
|
function ga4AddToCart() {
|
|
5480
|
-
const event =
|
|
5610
|
+
const event = Rn("product add");
|
|
5481
5611
|
return [
|
|
5482
5612
|
"event",
|
|
5483
5613
|
"add_to_cart",
|
|
@@ -5496,7 +5626,7 @@ function ga4AddToCart() {
|
|
|
5496
5626
|
];
|
|
5497
5627
|
}
|
|
5498
5628
|
function adsConversion() {
|
|
5499
|
-
const event =
|
|
5629
|
+
const event = Rn("order complete");
|
|
5500
5630
|
return [
|
|
5501
5631
|
"event",
|
|
5502
5632
|
"conversion",
|
|
@@ -5509,7 +5639,7 @@ function adsConversion() {
|
|
|
5509
5639
|
];
|
|
5510
5640
|
}
|
|
5511
5641
|
function gtmEvent() {
|
|
5512
|
-
const event =
|
|
5642
|
+
const event = Rn("product view");
|
|
5513
5643
|
return {
|
|
5514
5644
|
event: "product_view",
|
|
5515
5645
|
product_id: event.data.id,
|
|
@@ -5548,7 +5678,7 @@ var ga4Purchase2 = {
|
|
|
5548
5678
|
loop: [
|
|
5549
5679
|
"nested",
|
|
5550
5680
|
{
|
|
5551
|
-
condition: (entity) =>
|
|
5681
|
+
condition: (entity) => Pn(entity) && entity.entity === "product",
|
|
5552
5682
|
map: {
|
|
5553
5683
|
item_id: "data.id",
|
|
5554
5684
|
item_name: "data.name",
|
|
@@ -5635,7 +5765,7 @@ var combinedPurchase = {
|
|
|
5635
5765
|
loop: [
|
|
5636
5766
|
"nested",
|
|
5637
5767
|
{
|
|
5638
|
-
condition: (entity) =>
|
|
5768
|
+
condition: (entity) => Pn(entity) && entity.entity === "product",
|
|
5639
5769
|
map: {
|
|
5640
5770
|
item_id: "data.id",
|
|
5641
5771
|
item_name: "data.name",
|