@magicpixel/rn-mp-client-sdk 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +29 -0
- package/lib/commonjs/common/app-types.js +6 -0
- package/lib/commonjs/common/app-types.js.map +1 -0
- package/lib/commonjs/common/constants.js +51 -0
- package/lib/commonjs/common/constants.js.map +1 -0
- package/lib/commonjs/common/data-store.js +361 -0
- package/lib/commonjs/common/data-store.js.map +1 -0
- package/lib/commonjs/common/event-bus.js +42 -0
- package/lib/commonjs/common/event-bus.js.map +1 -0
- package/lib/commonjs/common/logger.js +30 -0
- package/lib/commonjs/common/logger.js.map +1 -0
- package/lib/commonjs/common/network-service.js +90 -0
- package/lib/commonjs/common/network-service.js.map +1 -0
- package/lib/commonjs/common/reporter.js +107 -0
- package/lib/commonjs/common/reporter.js.map +1 -0
- package/lib/commonjs/common/utils.js +276 -0
- package/lib/commonjs/common/utils.js.map +1 -0
- package/lib/commonjs/coverage/clover.xml +6 -0
- package/lib/commonjs/coverage/coverage-final.json +1 -0
- package/lib/commonjs/coverage/lcov-report/base.css +224 -0
- package/lib/commonjs/coverage/lcov-report/block-navigation.js +83 -0
- package/lib/commonjs/coverage/lcov-report/block-navigation.js.map +1 -0
- package/lib/commonjs/coverage/lcov-report/favicon.png +0 -0
- package/lib/commonjs/coverage/lcov-report/index.html +101 -0
- package/lib/commonjs/coverage/lcov-report/prettify.css +1 -0
- package/lib/commonjs/coverage/lcov-report/prettify.js +995 -0
- package/lib/commonjs/coverage/lcov-report/prettify.js.map +1 -0
- package/lib/commonjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/lib/commonjs/coverage/lcov-report/sorter.js +212 -0
- package/lib/commonjs/coverage/lcov-report/sorter.js.map +1 -0
- package/lib/commonjs/coverage/lcov.info +0 -0
- package/lib/commonjs/eedl/eedl.js +262 -0
- package/lib/commonjs/eedl/eedl.js.map +1 -0
- package/lib/commonjs/index.js +214 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/mp-client-sdk.js +33 -0
- package/lib/commonjs/models/mp-client-sdk.js.map +1 -0
- package/lib/commonjs/processors/data-element.processor.js +191 -0
- package/lib/commonjs/processors/data-element.processor.js.map +1 -0
- package/lib/commonjs/processors/qc.processor.js +111 -0
- package/lib/commonjs/processors/qc.processor.js.map +1 -0
- package/lib/commonjs/processors/tag.processor.js +432 -0
- package/lib/commonjs/processors/tag.processor.js.map +1 -0
- package/lib/commonjs/processors/trans-function.processor.js +91 -0
- package/lib/commonjs/processors/trans-function.processor.js.map +1 -0
- package/lib/commonjs/processors/visit-id.processor.js +172 -0
- package/lib/commonjs/processors/visit-id.processor.js.map +1 -0
- package/lib/module/common/app-types.js +2 -0
- package/lib/module/common/app-types.js.map +1 -0
- package/lib/module/common/constants.js +41 -0
- package/lib/module/common/constants.js.map +1 -0
- package/lib/module/common/data-store.js +346 -0
- package/lib/module/common/data-store.js.map +1 -0
- package/lib/module/common/event-bus.js +31 -0
- package/lib/module/common/event-bus.js.map +1 -0
- package/lib/module/common/logger.js +21 -0
- package/lib/module/common/logger.js.map +1 -0
- package/lib/module/common/network-service.js +73 -0
- package/lib/module/common/network-service.js.map +1 -0
- package/lib/module/common/reporter.js +88 -0
- package/lib/module/common/reporter.js.map +1 -0
- package/lib/module/common/utils.js +263 -0
- package/lib/module/common/utils.js.map +1 -0
- package/lib/module/coverage/clover.xml +6 -0
- package/lib/module/coverage/coverage-final.json +1 -0
- package/lib/module/coverage/lcov-report/base.css +224 -0
- package/lib/module/coverage/lcov-report/block-navigation.js +81 -0
- package/lib/module/coverage/lcov-report/block-navigation.js.map +1 -0
- package/lib/module/coverage/lcov-report/favicon.png +0 -0
- package/lib/module/coverage/lcov-report/index.html +101 -0
- package/lib/module/coverage/lcov-report/prettify.css +1 -0
- package/lib/module/coverage/lcov-report/prettify.js +993 -0
- package/lib/module/coverage/lcov-report/prettify.js.map +1 -0
- package/lib/module/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/lib/module/coverage/lcov-report/sorter.js +210 -0
- package/lib/module/coverage/lcov-report/sorter.js.map +1 -0
- package/lib/module/coverage/lcov.info +0 -0
- package/lib/module/eedl/eedl.js +246 -0
- package/lib/module/eedl/eedl.js.map +1 -0
- package/lib/module/index.js +176 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/mp-client-sdk.js +24 -0
- package/lib/module/models/mp-client-sdk.js.map +1 -0
- package/lib/module/processors/data-element.processor.js +176 -0
- package/lib/module/processors/data-element.processor.js.map +1 -0
- package/lib/module/processors/qc.processor.js +90 -0
- package/lib/module/processors/qc.processor.js.map +1 -0
- package/lib/module/processors/tag.processor.js +396 -0
- package/lib/module/processors/tag.processor.js.map +1 -0
- package/lib/module/processors/trans-function.processor.js +73 -0
- package/lib/module/processors/trans-function.processor.js.map +1 -0
- package/lib/module/processors/visit-id.processor.js +144 -0
- package/lib/module/processors/visit-id.processor.js.map +1 -0
- package/lib/typescript/common/app-types.d.ts +101 -0
- package/lib/typescript/common/constants.d.ts +21 -0
- package/lib/typescript/common/data-store.d.ts +81 -0
- package/lib/typescript/common/event-bus.d.ts +6 -0
- package/lib/typescript/common/logger.d.ts +5 -0
- package/lib/typescript/common/network-service.d.ts +8 -0
- package/lib/typescript/common/reporter.d.ts +12 -0
- package/lib/typescript/common/utils.d.ts +38 -0
- package/lib/typescript/eedl/eedl.d.ts +46 -0
- package/lib/typescript/index.d.ts +18 -0
- package/lib/typescript/models/mp-client-sdk.d.ts +157 -0
- package/lib/typescript/processors/data-element.processor.d.ts +12 -0
- package/lib/typescript/processors/qc.processor.d.ts +4 -0
- package/lib/typescript/processors/tag.processor.d.ts +27 -0
- package/lib/typescript/processors/trans-function.processor.d.ts +12 -0
- package/lib/typescript/processors/visit-id.processor.d.ts +7 -0
- package/package.json +170 -0
- package/src/common/app-types.ts +128 -0
- package/src/common/constants.ts +43 -0
- package/src/common/data-store.ts +333 -0
- package/src/common/event-bus.ts +35 -0
- package/src/common/logger.ts +19 -0
- package/src/common/network-service.ts +85 -0
- package/src/common/reporter.ts +110 -0
- package/src/common/utils.ts +281 -0
- package/src/coverage/clover.xml +6 -0
- package/src/coverage/coverage-final.json +1 -0
- package/src/coverage/lcov-report/base.css +224 -0
- package/src/coverage/lcov-report/block-navigation.js +87 -0
- package/src/coverage/lcov-report/favicon.png +0 -0
- package/src/coverage/lcov-report/index.html +101 -0
- package/src/coverage/lcov-report/prettify.css +1 -0
- package/src/coverage/lcov-report/prettify.js +2 -0
- package/src/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/coverage/lcov-report/sorter.js +196 -0
- package/src/coverage/lcov.info +0 -0
- package/src/eedl/eedl.ts +233 -0
- package/src/index.tsx +258 -0
- package/src/models/mp-client-sdk.ts +174 -0
- package/src/processors/data-element.processor.ts +249 -0
- package/src/processors/qc.processor.ts +115 -0
- package/src/processors/tag.processor.ts +527 -0
- package/src/processors/trans-function.processor.ts +85 -0
- package/src/processors/visit-id.processor.ts +164 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MapLike } from '../common/app-types';
|
|
2
|
+
import type { ClientSdkDeItem } from '../models/mp-client-sdk';
|
|
3
|
+
export declare class DataElementProcessor {
|
|
4
|
+
/**
|
|
5
|
+
* Process all the data elements at once, or if a set of keys are specified, processes only
|
|
6
|
+
* those keys and updates the dataElements object in global-fns file
|
|
7
|
+
* @param sdkDataElements
|
|
8
|
+
* @param eventData
|
|
9
|
+
* @param optDeKeys
|
|
10
|
+
*/
|
|
11
|
+
static processDataElements(sdkDataElements: MapLike<ClientSdkDeItem>, eventData?: Record<string, any>, optDeKeys?: string[]): Promise<MapLike<any>>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare class TagProcessor {
|
|
2
|
+
private static findApplicableTags;
|
|
3
|
+
/**
|
|
4
|
+
* Core function which actually puts the tag on page based on the tag type (JS or Image)
|
|
5
|
+
* @param eventName
|
|
6
|
+
* @param evtId
|
|
7
|
+
*/
|
|
8
|
+
static processTags(eventName: string, evtId: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Takes all the placeholders in a tag and replaces them with actual values from data elements or
|
|
11
|
+
* actual static values. Method returns an object with errCd and replaced content and a boolean identifier
|
|
12
|
+
* to denote if this process failed or not
|
|
13
|
+
* @param tagInfo
|
|
14
|
+
* @param tag
|
|
15
|
+
* @param provider
|
|
16
|
+
* @param prStatus
|
|
17
|
+
* @param dataElements
|
|
18
|
+
* @param transFunctions
|
|
19
|
+
*/
|
|
20
|
+
private static hydrateTag;
|
|
21
|
+
private static findPlaceHolders;
|
|
22
|
+
private static resourceParamsToActualValues;
|
|
23
|
+
private static parseParamValue;
|
|
24
|
+
private static replacePlaceHolders;
|
|
25
|
+
private static checkTagDateValidity;
|
|
26
|
+
private static replaceValues;
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process all the data elements at once, or if a set of keys are specified, processes only
|
|
3
|
+
* those keys and updates the dataElements object in global-fns file
|
|
4
|
+
* @param dataElements
|
|
5
|
+
* @param sdkTransFunctions
|
|
6
|
+
* @param optTfnKeys
|
|
7
|
+
*/
|
|
8
|
+
import type { MapLike } from '../common/app-types';
|
|
9
|
+
import type { ClientSdkTfnItem } from '../models/mp-client-sdk';
|
|
10
|
+
export declare class TransFunctionProcessor {
|
|
11
|
+
static processTransformationFunctions(dataElements: MapLike<any>, sdkTransFunctions: MapLike<ClientSdkTfnItem>, optTfnKeys?: string[]): MapLike<any>;
|
|
12
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@magicpixel/rn-mp-client-sdk",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "test",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"rn-mp-client-sdk.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!**/__tests__",
|
|
21
|
+
"!**/__fixtures__",
|
|
22
|
+
"!**/__mocks__"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"typescript": "tsc --noEmit",
|
|
27
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
|
+
"prepare": "bob build",
|
|
29
|
+
"release": "release-it",
|
|
30
|
+
"example": "yarn --cwd example",
|
|
31
|
+
"bootstrap": "yarn example && yarn && yarn example pods",
|
|
32
|
+
"postpublish": "node quick-version-increment.js"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"react-native",
|
|
36
|
+
"ios",
|
|
37
|
+
"android"
|
|
38
|
+
],
|
|
39
|
+
"repository": "https://github.com/mp",
|
|
40
|
+
"author": "MP Engineering <engineering@magicpixel.io> (https://magicpixel.io)",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/mp/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/mp#readme",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@arkweid/lefthook": "^0.7.7",
|
|
52
|
+
"@babel/eslint-parser": "^7.18.2",
|
|
53
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
54
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
55
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
56
|
+
"@types/flat": "^5.0.2",
|
|
57
|
+
"@types/jest": "29.0.3",
|
|
58
|
+
"@types/react": "~17.0.21",
|
|
59
|
+
"@types/react-native": "0.68.0",
|
|
60
|
+
"commitlint": "^17.0.2",
|
|
61
|
+
"eslint": "^8.4.1",
|
|
62
|
+
"eslint-config-prettier": "^8.5.0",
|
|
63
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
+
"jest": "29.1.1",
|
|
65
|
+
"pod-install": "^0.1.0",
|
|
66
|
+
"prettier": "^2.0.5",
|
|
67
|
+
"react": "17.0.2",
|
|
68
|
+
"react-native": "0.68.2",
|
|
69
|
+
"react-native-builder-bob": "^0.18.3",
|
|
70
|
+
"release-it": "^15.0.0",
|
|
71
|
+
"ts-jest": "^29.0.2",
|
|
72
|
+
"tsconfig-paths": "^4.1.0",
|
|
73
|
+
"typescript": "^4.5.2"
|
|
74
|
+
},
|
|
75
|
+
"resolutions": {
|
|
76
|
+
"@types/react": "17.0.21"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"react": "*",
|
|
80
|
+
"react-native": "*"
|
|
81
|
+
},
|
|
82
|
+
"jest": {
|
|
83
|
+
"preset": "react-native",
|
|
84
|
+
"transform": {
|
|
85
|
+
".+\\.(t|j)s$": "ts-jest"
|
|
86
|
+
},
|
|
87
|
+
"modulePathIgnorePatterns": [
|
|
88
|
+
"<rootDir>/example/node_modules",
|
|
89
|
+
"<rootDir>/lib/"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"commitlint": {
|
|
93
|
+
"extends": [
|
|
94
|
+
"@commitlint/config-conventional"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"release-it": {
|
|
98
|
+
"git": {
|
|
99
|
+
"commitMessage": "chore: release ${version}",
|
|
100
|
+
"tagName": "v${version}"
|
|
101
|
+
},
|
|
102
|
+
"npm": {
|
|
103
|
+
"publish": true
|
|
104
|
+
},
|
|
105
|
+
"github": {
|
|
106
|
+
"release": true
|
|
107
|
+
},
|
|
108
|
+
"plugins": {
|
|
109
|
+
"@release-it/conventional-changelog": {
|
|
110
|
+
"preset": "angular"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"eslintConfig": {
|
|
115
|
+
"root": true,
|
|
116
|
+
"parser": "@babel/eslint-parser",
|
|
117
|
+
"extends": [
|
|
118
|
+
"@react-native-community",
|
|
119
|
+
"prettier"
|
|
120
|
+
],
|
|
121
|
+
"rules": {
|
|
122
|
+
"prettier/prettier": [
|
|
123
|
+
"error",
|
|
124
|
+
{
|
|
125
|
+
"quoteProps": "consistent",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"tabWidth": 2,
|
|
128
|
+
"trailingComma": "es5",
|
|
129
|
+
"useTabs": false
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"eslintIgnore": [
|
|
135
|
+
"node_modules/",
|
|
136
|
+
"lib/"
|
|
137
|
+
],
|
|
138
|
+
"prettier": {
|
|
139
|
+
"quoteProps": "consistent",
|
|
140
|
+
"singleQuote": true,
|
|
141
|
+
"tabWidth": 2,
|
|
142
|
+
"trailingComma": "es5",
|
|
143
|
+
"useTabs": false
|
|
144
|
+
},
|
|
145
|
+
"react-native-builder-bob": {
|
|
146
|
+
"source": "src",
|
|
147
|
+
"output": "lib",
|
|
148
|
+
"targets": [
|
|
149
|
+
"commonjs",
|
|
150
|
+
"module",
|
|
151
|
+
[
|
|
152
|
+
"typescript",
|
|
153
|
+
{
|
|
154
|
+
"project": "tsconfig.build.json"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"dependencies": {
|
|
160
|
+
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
161
|
+
"@react-native-firebase/analytics": "^15.6.0",
|
|
162
|
+
"@react-native-firebase/app": "^15.6.0",
|
|
163
|
+
"expo-device": "^4.3.0",
|
|
164
|
+
"flat": "^5.0.2",
|
|
165
|
+
"nanoid": "^4.0.0",
|
|
166
|
+
"performant-array-to-tree": "^1.11.0",
|
|
167
|
+
"react-native-event-listeners": "^1.0.7",
|
|
168
|
+
"ts-node": "^10.9.1"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { Logger } from './logger';
|
|
2
|
+
|
|
3
|
+
export interface MapLike<T = any> {
|
|
4
|
+
[key: string]: T;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface RunQueueModel {
|
|
8
|
+
sseOnly: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
dcrName: string;
|
|
11
|
+
eventId: string;
|
|
12
|
+
dcrPayload?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type TypedAny = Record<
|
|
16
|
+
string,
|
|
17
|
+
| string
|
|
18
|
+
| number
|
|
19
|
+
| boolean
|
|
20
|
+
| string[]
|
|
21
|
+
| boolean[]
|
|
22
|
+
| number[]
|
|
23
|
+
| Record<string, string | number | boolean | string[] | boolean[] | number[]>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type EventProcessorFn = (payload: TypedAny) => void;
|
|
27
|
+
|
|
28
|
+
export interface AppCustomerInfo {
|
|
29
|
+
first_name?: string;
|
|
30
|
+
last_name?: string;
|
|
31
|
+
email?: string;
|
|
32
|
+
phone_number: number;
|
|
33
|
+
country_code: number;
|
|
34
|
+
city?: string;
|
|
35
|
+
state?: string;
|
|
36
|
+
country?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface AppPageLoad {
|
|
40
|
+
page_name: string;
|
|
41
|
+
is_entry?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface DeJsvHelper {
|
|
45
|
+
log: typeof Logger.logDbg;
|
|
46
|
+
err: typeof Logger.logError;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface QcInfoItem {
|
|
50
|
+
nm: string;
|
|
51
|
+
id: string;
|
|
52
|
+
st: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface TagInfoItem {
|
|
56
|
+
id: string;
|
|
57
|
+
nm: string;
|
|
58
|
+
pr: string;
|
|
59
|
+
prNm: string;
|
|
60
|
+
status: boolean;
|
|
61
|
+
qc: string | string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ReplaceMode = 'kph' | 'rph';
|
|
65
|
+
|
|
66
|
+
export interface HydrateTagInfo {
|
|
67
|
+
isInError: boolean;
|
|
68
|
+
content: string | number | null;
|
|
69
|
+
errCd: string; // error code
|
|
70
|
+
errMsg: string; // any descriptive error message
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ReportTagItem {
|
|
74
|
+
st: 200 | 900 | 1000 | number; // what happened to this tag?
|
|
75
|
+
t: string; // tag id
|
|
76
|
+
p: string; // provider id
|
|
77
|
+
tNm: string;
|
|
78
|
+
req: any; // request payload
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface Report {
|
|
82
|
+
envName: string; // environment name inside magic pixel
|
|
83
|
+
envId: string; // environment id inside magic pixel
|
|
84
|
+
pname?: string; // page name
|
|
85
|
+
evt: string; // dcr event if that triggered this report
|
|
86
|
+
evtId: string; // event id
|
|
87
|
+
dt?: number; // device type (converted to int)
|
|
88
|
+
ln?: number; // language (converted to int)
|
|
89
|
+
bw?: number; // browser name (converted to int)
|
|
90
|
+
dm?: string; // clean domain name
|
|
91
|
+
items: ReportTagItem[]; // list of tag items fired on that page for that condition
|
|
92
|
+
tagCt: number; // expected tag count on this page
|
|
93
|
+
dws: 'j' | 'n'; // down stream configuration. java or node
|
|
94
|
+
v: string; // client sdk version for this call
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface UrlInfo {
|
|
98
|
+
tfUrl: string;
|
|
99
|
+
errUrl: string;
|
|
100
|
+
rptUrl: string;
|
|
101
|
+
infoUrl: string;
|
|
102
|
+
baseUrl: string;
|
|
103
|
+
attrInfoUrl: string;
|
|
104
|
+
idlUrl: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface VisitInfo {
|
|
108
|
+
visitId: string;
|
|
109
|
+
visitTs: number;
|
|
110
|
+
visitCt: number;
|
|
111
|
+
visitDepth: number;
|
|
112
|
+
visitVer: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface VisitorInfo {
|
|
116
|
+
dId: string;
|
|
117
|
+
mId: string;
|
|
118
|
+
st: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface SdkInitOptions {
|
|
122
|
+
orgId: string;
|
|
123
|
+
env: string;
|
|
124
|
+
projectId: string;
|
|
125
|
+
baseUrl: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type EventBusCallback = (event: string, payload: any) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { customAlphabet } from 'nanoid/non-secure';
|
|
2
|
+
import type { BaseResourceParamType } from '../models/mp-client-sdk';
|
|
3
|
+
|
|
4
|
+
export class Constants {
|
|
5
|
+
static PLACEHOLDER_REGEX = new RegExp(/({{)([A-Z_0-9 -]+)(}})/gi);
|
|
6
|
+
|
|
7
|
+
static LARGE_RANDOM_POOL = customAlphabet(
|
|
8
|
+
'1234567090abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
9
|
+
21
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
static MP_DL_EVT = 'mp_dl_event';
|
|
13
|
+
static CUST_EVT = 'custom_event';
|
|
14
|
+
|
|
15
|
+
// Tag Report - Status Constants
|
|
16
|
+
static ST_OK = 200; // tag fired successfully
|
|
17
|
+
static ST_VAL_FAIL = 400; // tag validation failed - meaning one of the items marked as mandatory was found empty
|
|
18
|
+
static ST_ERR = 500; // tag was ok, but provider side failure. may be url is constructed wrong, or provider is down
|
|
19
|
+
static ST_DEP_FAIL = 1000; // processing tag dependencies failed - may be missing parameters or attributes
|
|
20
|
+
static ST_PR_BL = 1002; // provider is black listed in the data governance screen
|
|
21
|
+
static ST_PR_EXC = 1001; // tag was found, but no provider was bundled. SDK build issue. Report with high importance
|
|
22
|
+
|
|
23
|
+
static PR_TYP_JS = 'js';
|
|
24
|
+
static PR_TYP_IMG = 'img';
|
|
25
|
+
static PR_TYP_APP = 'app';
|
|
26
|
+
|
|
27
|
+
static PR_S_TYP_R = 'r';
|
|
28
|
+
|
|
29
|
+
static sortAscending = (
|
|
30
|
+
a: BaseResourceParamType,
|
|
31
|
+
b: BaseResourceParamType
|
|
32
|
+
): number => (a.o > b.o ? 1 : -1);
|
|
33
|
+
|
|
34
|
+
// this data structure is returned by the api and stored in this key
|
|
35
|
+
// {"dId":"VNiBG7JNfoGAyvqxhxMqd","mId":"JW0FRrCtAj9K7uyNmL1ht","st":0}
|
|
36
|
+
static KEY_MP_IDL_VISITOR_ID_INFO = 'mp_idl_visitor_info';
|
|
37
|
+
|
|
38
|
+
// visitor info data structure
|
|
39
|
+
// {"visitId": "123123sdfsf", "visitCt": 1, "visitDepth": 1, visitVer: 1}
|
|
40
|
+
static KEY_MP_IDL_VISIT_ID_INFO = 'mp_idl_visit_info';
|
|
41
|
+
|
|
42
|
+
static KEY_MP_DEBUG_ID = 'mp_debug_id';
|
|
43
|
+
}
|