@onlive.ai/flow-client 0.1.34 → 0.1.35
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/client/client.service.d.cts +71 -0
- package/client/client.service.d.ts +71 -0
- package/client/client.service.spec.d.cts +2 -0
- package/client/client.service.spec.d.ts +2 -0
- package/client/client.types.d.cts +13421 -0
- package/client/client.types.d.ts +13421 -0
- package/flow.types.d.cts +49501 -0
- package/flow.types.d.ts +49501 -0
- package/index.d.cts +6 -0
- package/index.d.ts +6 -0
- package/package.json +1 -2
- package/schema-generator.cjs +38 -38
- package/schema-generator.d.cts +2 -0
- package/schema-generator.d.ts +2 -0
- package/schema-generator.js +38 -38
- package/tracking/tracking.service.d.cts +104 -0
- package/tracking/tracking.service.d.ts +104 -0
- package/tracking/tracking.types.d.cts +1489 -0
- package/tracking/tracking.types.d.ts +1489 -0
package/schema-generator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// schema-generator.ts
|
|
2
2
|
import { writeFileSync } from "fs";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
5
5
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
6
6
|
var defaultOptions = {
|
|
7
7
|
name: void 0,
|
|
@@ -34,7 +34,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
34
34
|
...options
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
38
38
|
var getRefs = (options) => {
|
|
39
39
|
const _options = getDefaultOptions(options);
|
|
40
40
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -54,7 +54,7 @@ var getRefs = (options) => {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
//
|
|
57
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
58
58
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
59
59
|
if (!refs?.errorMessages)
|
|
60
60
|
return;
|
|
@@ -70,15 +70,15 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
70
70
|
addErrorMessage(res, key, errorMessage, refs);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
//
|
|
73
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
74
74
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod";
|
|
75
75
|
|
|
76
|
-
//
|
|
76
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
77
77
|
function parseAnyDef() {
|
|
78
78
|
return {};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
//
|
|
81
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
82
82
|
import { ZodFirstPartyTypeKind } from "zod";
|
|
83
83
|
function parseArrayDef(def, refs) {
|
|
84
84
|
const res = {
|
|
@@ -103,7 +103,7 @@ function parseArrayDef(def, refs) {
|
|
|
103
103
|
return res;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
//
|
|
106
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
107
107
|
function parseBigintDef(def, refs) {
|
|
108
108
|
const res = {
|
|
109
109
|
type: "integer",
|
|
@@ -149,24 +149,24 @@ function parseBigintDef(def, refs) {
|
|
|
149
149
|
return res;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
//
|
|
152
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
153
153
|
function parseBooleanDef() {
|
|
154
154
|
return {
|
|
155
155
|
type: "boolean"
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
//
|
|
159
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
160
160
|
function parseBrandedDef(_def, refs) {
|
|
161
161
|
return parseDef(_def.type._def, refs);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
//
|
|
164
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
165
165
|
var parseCatchDef = (def, refs) => {
|
|
166
166
|
return parseDef(def.innerType._def, refs);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
//
|
|
169
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
170
170
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
171
171
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
172
172
|
if (Array.isArray(strategy)) {
|
|
@@ -225,7 +225,7 @@ var integerDateParser = (def, refs) => {
|
|
|
225
225
|
return res;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
//
|
|
228
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
229
229
|
function parseDefaultDef(_def, refs) {
|
|
230
230
|
return {
|
|
231
231
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -233,12 +233,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
//
|
|
236
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
237
237
|
function parseEffectsDef(_def, refs) {
|
|
238
238
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
//
|
|
241
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
242
242
|
function parseEnumDef(def) {
|
|
243
243
|
return {
|
|
244
244
|
type: "string",
|
|
@@ -246,7 +246,7 @@ function parseEnumDef(def) {
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
//
|
|
249
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
250
250
|
var isJsonSchema7AllOfType = (type) => {
|
|
251
251
|
if ("type" in type && type.type === "string")
|
|
252
252
|
return false;
|
|
@@ -288,7 +288,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
288
288
|
} : void 0;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
//
|
|
291
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
292
292
|
function parseLiteralDef(def, refs) {
|
|
293
293
|
const parsedType = typeof def.value;
|
|
294
294
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
@@ -308,10 +308,10 @@ function parseLiteralDef(def, refs) {
|
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
//
|
|
311
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
312
312
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
313
313
|
|
|
314
|
-
//
|
|
314
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
315
315
|
var emojiRegex = void 0;
|
|
316
316
|
var zodPatterns = {
|
|
317
317
|
/**
|
|
@@ -636,7 +636,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
636
636
|
return pattern;
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
-
//
|
|
639
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
640
640
|
function parseRecordDef(def, refs) {
|
|
641
641
|
if (refs.target === "openAi") {
|
|
642
642
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -688,7 +688,7 @@ function parseRecordDef(def, refs) {
|
|
|
688
688
|
return schema;
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
-
//
|
|
691
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
692
692
|
function parseMapDef(def, refs) {
|
|
693
693
|
if (refs.mapStrategy === "record") {
|
|
694
694
|
return parseRecordDef(def, refs);
|
|
@@ -713,7 +713,7 @@ function parseMapDef(def, refs) {
|
|
|
713
713
|
};
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
-
//
|
|
716
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
717
717
|
function parseNativeEnumDef(def) {
|
|
718
718
|
const object = def.values;
|
|
719
719
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -727,14 +727,14 @@ function parseNativeEnumDef(def) {
|
|
|
727
727
|
};
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
-
//
|
|
730
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
731
731
|
function parseNeverDef() {
|
|
732
732
|
return {
|
|
733
733
|
not: {}
|
|
734
734
|
};
|
|
735
735
|
}
|
|
736
736
|
|
|
737
|
-
//
|
|
737
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
738
738
|
function parseNullDef(refs) {
|
|
739
739
|
return refs.target === "openApi3" ? {
|
|
740
740
|
enum: ["null"],
|
|
@@ -744,7 +744,7 @@ function parseNullDef(refs) {
|
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
-
//
|
|
747
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
748
748
|
var primitiveMappings = {
|
|
749
749
|
ZodString: "string",
|
|
750
750
|
ZodNumber: "number",
|
|
@@ -812,7 +812,7 @@ var asAnyOf = (def, refs) => {
|
|
|
812
812
|
return anyOf.length ? { anyOf } : void 0;
|
|
813
813
|
};
|
|
814
814
|
|
|
815
|
-
//
|
|
815
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
816
816
|
function parseNullableDef(def, refs) {
|
|
817
817
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
818
818
|
if (refs.target === "openApi3") {
|
|
@@ -844,7 +844,7 @@ function parseNullableDef(def, refs) {
|
|
|
844
844
|
return base && { anyOf: [base, { type: "null" }] };
|
|
845
845
|
}
|
|
846
846
|
|
|
847
|
-
//
|
|
847
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
848
848
|
function parseNumberDef(def, refs) {
|
|
849
849
|
const res = {
|
|
850
850
|
type: "number"
|
|
@@ -893,7 +893,7 @@ function parseNumberDef(def, refs) {
|
|
|
893
893
|
return res;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
-
//
|
|
896
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
897
897
|
import { ZodOptional } from "zod";
|
|
898
898
|
function parseObjectDef(def, refs) {
|
|
899
899
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
@@ -964,7 +964,7 @@ function safeIsOptional(schema) {
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
|
|
967
|
-
//
|
|
967
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
968
968
|
var parseOptionalDef = (def, refs) => {
|
|
969
969
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
970
970
|
return parseDef(def.innerType._def, refs);
|
|
@@ -983,7 +983,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
983
983
|
} : {};
|
|
984
984
|
};
|
|
985
985
|
|
|
986
|
-
//
|
|
986
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
987
987
|
var parsePipelineDef = (def, refs) => {
|
|
988
988
|
if (refs.pipeStrategy === "input") {
|
|
989
989
|
return parseDef(def.in._def, refs);
|
|
@@ -1003,12 +1003,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
};
|
|
1005
1005
|
|
|
1006
|
-
//
|
|
1006
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1007
1007
|
function parsePromiseDef(def, refs) {
|
|
1008
1008
|
return parseDef(def.type._def, refs);
|
|
1009
1009
|
}
|
|
1010
1010
|
|
|
1011
|
-
//
|
|
1011
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1012
1012
|
function parseSetDef(def, refs) {
|
|
1013
1013
|
const items = parseDef(def.valueType._def, {
|
|
1014
1014
|
...refs,
|
|
@@ -1028,7 +1028,7 @@ function parseSetDef(def, refs) {
|
|
|
1028
1028
|
return schema;
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
-
//
|
|
1031
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1032
1032
|
function parseTupleDef(def, refs) {
|
|
1033
1033
|
if (def.rest) {
|
|
1034
1034
|
return {
|
|
@@ -1056,24 +1056,24 @@ function parseTupleDef(def, refs) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
1058
|
|
|
1059
|
-
//
|
|
1059
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1060
1060
|
function parseUndefinedDef() {
|
|
1061
1061
|
return {
|
|
1062
1062
|
not: {}
|
|
1063
1063
|
};
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
|
-
//
|
|
1066
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1067
1067
|
function parseUnknownDef() {
|
|
1068
1068
|
return {};
|
|
1069
1069
|
}
|
|
1070
1070
|
|
|
1071
|
-
//
|
|
1071
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1072
1072
|
var parseReadonlyDef = (def, refs) => {
|
|
1073
1073
|
return parseDef(def.innerType._def, refs);
|
|
1074
1074
|
};
|
|
1075
1075
|
|
|
1076
|
-
//
|
|
1076
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1077
1077
|
var selectParser = (def, typeName, refs) => {
|
|
1078
1078
|
switch (typeName) {
|
|
1079
1079
|
case ZodFirstPartyTypeKind3.ZodString:
|
|
@@ -1149,7 +1149,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
|
-
//
|
|
1152
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1153
1153
|
function parseDef(def, refs, forceResolution = false) {
|
|
1154
1154
|
const seenItem = refs.seen.get(def);
|
|
1155
1155
|
if (refs.override) {
|
|
@@ -1213,7 +1213,7 @@ var addMeta = (def, refs, jsonSchema2) => {
|
|
|
1213
1213
|
return jsonSchema2;
|
|
1214
1214
|
};
|
|
1215
1215
|
|
|
1216
|
-
//
|
|
1216
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.53/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1217
1217
|
var zodToJsonSchema = (schema, options) => {
|
|
1218
1218
|
const refs = getRefs(options);
|
|
1219
1219
|
const definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Tracker, EventName, EventData } from '@onlive.ai/tracker';
|
|
2
|
+
import { GetStepTrigger, GetStepOptions, FlowContext } from '../client/client.types.cjs';
|
|
3
|
+
import { TrackingOptions } from './tracking.types.cjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Service responsible for tracking user interactions within a flow.
|
|
8
|
+
* @description Manages event tracking, analytics data collection, and event emission
|
|
9
|
+
* for user interactions in the application flow
|
|
10
|
+
*/
|
|
11
|
+
declare class TrackingService {
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for the tracking service.
|
|
14
|
+
*/
|
|
15
|
+
private options;
|
|
16
|
+
/**
|
|
17
|
+
* The tracker instance used to send events.
|
|
18
|
+
*/
|
|
19
|
+
private tracker;
|
|
20
|
+
/**
|
|
21
|
+
* List of event listeners for tracking events.
|
|
22
|
+
*/
|
|
23
|
+
private eventListeners;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new TrackingService instance.
|
|
26
|
+
* @param organizationId - The ID of the organization
|
|
27
|
+
* @param flowId - The ID of the flow being tracked
|
|
28
|
+
* @param options - Configuration options for the tracking service
|
|
29
|
+
* @param devMode - Flag indicating whether to run in development mode
|
|
30
|
+
*/
|
|
31
|
+
constructor(organizationId: string, flowId: string, options: TrackingOptions, devMode: boolean);
|
|
32
|
+
/**
|
|
33
|
+
* Returns the tracker instance used for sending events.
|
|
34
|
+
* @returns {Tracker} The tracker instance
|
|
35
|
+
*/
|
|
36
|
+
getTracker(): Tracker;
|
|
37
|
+
/**
|
|
38
|
+
* Returns tracking-related user preferences and session information.
|
|
39
|
+
*
|
|
40
|
+
* This method combines browser preferences with session identification data
|
|
41
|
+
* that can be used for tracking and analytics purposes.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Object} An object containing browser preferences and session identifiers
|
|
44
|
+
* @property {string} interactionId - The current session interaction identifier
|
|
45
|
+
* @property {string} guestId - The unique identifier for the current guest/user
|
|
46
|
+
*/
|
|
47
|
+
preferences(): object;
|
|
48
|
+
/**
|
|
49
|
+
* Analyzes a request and generates tracking events based on the provided trigger and options.
|
|
50
|
+
*
|
|
51
|
+
* @param {GetStepTrigger | { stepId?: string }} trigger - The trigger for the step, which can be either a `GetStepTrigger` or an object containing an optional `stepId`.
|
|
52
|
+
* @param {GetStepOptions} options - The options for getting the step, including fields for form data.
|
|
53
|
+
*/
|
|
54
|
+
analyzeRequest(trigger: GetStepTrigger | {
|
|
55
|
+
stepId?: string;
|
|
56
|
+
}, options: GetStepOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* Analyzes the response based on the provided trigger and flow context, and generates tracking events.
|
|
59
|
+
*
|
|
60
|
+
* @param {GetStepTrigger | { stepId?: string }} trigger - The trigger for the step, which can be either a `GetStepTrigger` or an object containing an optional `stepId`.
|
|
61
|
+
* @param {FlowContext} flowContext - The context of the flow, containing information about the current step and its result.
|
|
62
|
+
*/
|
|
63
|
+
analyzeResponse(trigger: GetStepTrigger | {
|
|
64
|
+
stepId?: string;
|
|
65
|
+
}, flowContext: FlowContext): void;
|
|
66
|
+
/**
|
|
67
|
+
* Sends an event to the tracker.
|
|
68
|
+
*
|
|
69
|
+
* This method dispatches an event with the provided name and data to the tracking system.
|
|
70
|
+
* Events represent user interactions or system occurrences that should be recorded for analytics.
|
|
71
|
+
*
|
|
72
|
+
* @param eventName - The name of the event to send
|
|
73
|
+
* @param eventData - The data associated with the event
|
|
74
|
+
*/
|
|
75
|
+
send(eventName: EventName, eventData: Partial<EventData>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Sets base data for the tracker that will be included in all future events.
|
|
78
|
+
*
|
|
79
|
+
* This method defines default properties that will be automatically included
|
|
80
|
+
* in every tracking event sent after this call. This is useful for setting
|
|
81
|
+
* context information that remains constant across multiple events.
|
|
82
|
+
*
|
|
83
|
+
* @param data - The base data to set for the tracker
|
|
84
|
+
*/
|
|
85
|
+
setData(data: EventData): void;
|
|
86
|
+
/**
|
|
87
|
+
* Registers an event listener to be notified when tracking events are emitted.
|
|
88
|
+
*
|
|
89
|
+
* @param {function} listener - The callback function to execute when an event is emitted
|
|
90
|
+
*/
|
|
91
|
+
onEvent(listener: (event: {
|
|
92
|
+
event: EventName;
|
|
93
|
+
data: EventData;
|
|
94
|
+
}) => void): void;
|
|
95
|
+
/**
|
|
96
|
+
* Emits an event to all registered listeners for the specified event name.
|
|
97
|
+
*
|
|
98
|
+
* @param {EventName} eventName - The name of the event to emit
|
|
99
|
+
* @param {EventData} eventData - The data associated with the event
|
|
100
|
+
*/
|
|
101
|
+
private emit;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { TrackingService, TrackingService as default };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Tracker, EventName, EventData } from '@onlive.ai/tracker';
|
|
2
|
+
import { GetStepTrigger, GetStepOptions, FlowContext } from '../client/client.types.js';
|
|
3
|
+
import { TrackingOptions } from './tracking.types.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Service responsible for tracking user interactions within a flow.
|
|
8
|
+
* @description Manages event tracking, analytics data collection, and event emission
|
|
9
|
+
* for user interactions in the application flow
|
|
10
|
+
*/
|
|
11
|
+
declare class TrackingService {
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for the tracking service.
|
|
14
|
+
*/
|
|
15
|
+
private options;
|
|
16
|
+
/**
|
|
17
|
+
* The tracker instance used to send events.
|
|
18
|
+
*/
|
|
19
|
+
private tracker;
|
|
20
|
+
/**
|
|
21
|
+
* List of event listeners for tracking events.
|
|
22
|
+
*/
|
|
23
|
+
private eventListeners;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new TrackingService instance.
|
|
26
|
+
* @param organizationId - The ID of the organization
|
|
27
|
+
* @param flowId - The ID of the flow being tracked
|
|
28
|
+
* @param options - Configuration options for the tracking service
|
|
29
|
+
* @param devMode - Flag indicating whether to run in development mode
|
|
30
|
+
*/
|
|
31
|
+
constructor(organizationId: string, flowId: string, options: TrackingOptions, devMode: boolean);
|
|
32
|
+
/**
|
|
33
|
+
* Returns the tracker instance used for sending events.
|
|
34
|
+
* @returns {Tracker} The tracker instance
|
|
35
|
+
*/
|
|
36
|
+
getTracker(): Tracker;
|
|
37
|
+
/**
|
|
38
|
+
* Returns tracking-related user preferences and session information.
|
|
39
|
+
*
|
|
40
|
+
* This method combines browser preferences with session identification data
|
|
41
|
+
* that can be used for tracking and analytics purposes.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Object} An object containing browser preferences and session identifiers
|
|
44
|
+
* @property {string} interactionId - The current session interaction identifier
|
|
45
|
+
* @property {string} guestId - The unique identifier for the current guest/user
|
|
46
|
+
*/
|
|
47
|
+
preferences(): object;
|
|
48
|
+
/**
|
|
49
|
+
* Analyzes a request and generates tracking events based on the provided trigger and options.
|
|
50
|
+
*
|
|
51
|
+
* @param {GetStepTrigger | { stepId?: string }} trigger - The trigger for the step, which can be either a `GetStepTrigger` or an object containing an optional `stepId`.
|
|
52
|
+
* @param {GetStepOptions} options - The options for getting the step, including fields for form data.
|
|
53
|
+
*/
|
|
54
|
+
analyzeRequest(trigger: GetStepTrigger | {
|
|
55
|
+
stepId?: string;
|
|
56
|
+
}, options: GetStepOptions): void;
|
|
57
|
+
/**
|
|
58
|
+
* Analyzes the response based on the provided trigger and flow context, and generates tracking events.
|
|
59
|
+
*
|
|
60
|
+
* @param {GetStepTrigger | { stepId?: string }} trigger - The trigger for the step, which can be either a `GetStepTrigger` or an object containing an optional `stepId`.
|
|
61
|
+
* @param {FlowContext} flowContext - The context of the flow, containing information about the current step and its result.
|
|
62
|
+
*/
|
|
63
|
+
analyzeResponse(trigger: GetStepTrigger | {
|
|
64
|
+
stepId?: string;
|
|
65
|
+
}, flowContext: FlowContext): void;
|
|
66
|
+
/**
|
|
67
|
+
* Sends an event to the tracker.
|
|
68
|
+
*
|
|
69
|
+
* This method dispatches an event with the provided name and data to the tracking system.
|
|
70
|
+
* Events represent user interactions or system occurrences that should be recorded for analytics.
|
|
71
|
+
*
|
|
72
|
+
* @param eventName - The name of the event to send
|
|
73
|
+
* @param eventData - The data associated with the event
|
|
74
|
+
*/
|
|
75
|
+
send(eventName: EventName, eventData: Partial<EventData>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Sets base data for the tracker that will be included in all future events.
|
|
78
|
+
*
|
|
79
|
+
* This method defines default properties that will be automatically included
|
|
80
|
+
* in every tracking event sent after this call. This is useful for setting
|
|
81
|
+
* context information that remains constant across multiple events.
|
|
82
|
+
*
|
|
83
|
+
* @param data - The base data to set for the tracker
|
|
84
|
+
*/
|
|
85
|
+
setData(data: EventData): void;
|
|
86
|
+
/**
|
|
87
|
+
* Registers an event listener to be notified when tracking events are emitted.
|
|
88
|
+
*
|
|
89
|
+
* @param {function} listener - The callback function to execute when an event is emitted
|
|
90
|
+
*/
|
|
91
|
+
onEvent(listener: (event: {
|
|
92
|
+
event: EventName;
|
|
93
|
+
data: EventData;
|
|
94
|
+
}) => void): void;
|
|
95
|
+
/**
|
|
96
|
+
* Emits an event to all registered listeners for the specified event name.
|
|
97
|
+
*
|
|
98
|
+
* @param {EventName} eventName - The name of the event to emit
|
|
99
|
+
* @param {EventData} eventData - The data associated with the event
|
|
100
|
+
*/
|
|
101
|
+
private emit;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { TrackingService, TrackingService as default };
|