@solomon-tech/webanalytics-sdk 1.0.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/README.md +20 -0
- package/dist/sdk/cookies/fbp.d.ts +3 -0
- package/dist/sdk/cookies/fbp.js +21 -0
- package/dist/sdk/cookies/legacy.d.ts +2 -0
- package/dist/sdk/cookies/legacy.js +16 -0
- package/dist/sdk/cookies/session.d.ts +2 -0
- package/dist/sdk/cookies/session.js +25 -0
- package/dist/sdk/cookies/user.d.ts +2 -0
- package/dist/sdk/cookies/user.js +25 -0
- package/dist/sdk/cookies/uuid.d.ts +0 -0
- package/dist/sdk/cookies/uuid.js +1 -0
- package/dist/sdk/events.d.ts +292 -0
- package/dist/sdk/events.js +366 -0
- package/dist/sdk/publish.d.ts +3 -0
- package/dist/sdk/publish.js +78 -0
- package/dist/sdk/sdk/core/client.d.ts +12 -0
- package/dist/sdk/sdk/core/client.js +81 -0
- package/dist/sdk/sdk/core/events.d.ts +52 -0
- package/dist/sdk/sdk/core/events.js +1 -0
- package/dist/sdk/sdk/core/types.d.ts +15 -0
- package/dist/sdk/sdk/core/types.js +1 -0
- package/dist/sdk/sdk/index.d.ts +6 -0
- package/dist/sdk/sdk/index.js +2 -0
- package/dist/sdk/sdk/node/client.d.ts +13 -0
- package/dist/sdk/sdk/node/client.js +134 -0
- package/dist/sdk/sdk/node/index.d.ts +7 -0
- package/dist/sdk/sdk/node/index.js +2 -0
- package/dist/sdk/solomon-sdk.esm.min.js +1 -0
- package/dist/sdk/solomon-sdk.min.js +1 -0
- package/dist/sdk/solomon-sdk.node.esm.min.js +1 -0
- package/dist/sdk/utils.d.ts +11 -0
- package/dist/sdk/utils.js +208 -0
- package/package.json +69 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getSessionId } from "./cookies/session";
|
|
11
|
+
import { getUserId } from "./cookies/user";
|
|
12
|
+
import { getFbp, getFbc } from "./cookies/fbp";
|
|
13
|
+
import { getLegacyId } from "./cookies/legacy";
|
|
14
|
+
import { getUtmParameter, getCookie, setCookie, getLocalStorage, setAllStorage, getCompanyId } from "./utils";
|
|
15
|
+
function generateUUIDv4() {
|
|
16
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
17
|
+
const r = (crypto.getRandomValues(new Uint8Array(1))[0] & 15) >> 0;
|
|
18
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
19
|
+
return v.toString(16);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var Type;
|
|
23
|
+
(function (Type) {
|
|
24
|
+
Type["VIEW_PAGE"] = "VIEW_PAGE";
|
|
25
|
+
Type["CONTENT_VIEW"] = "CONTENT_VIEW";
|
|
26
|
+
Type["ADD_TO_CART"] = "ADD_TO_CART";
|
|
27
|
+
Type["INITIATE_CHECKOUT"] = "INITIATE_CHECKOUT";
|
|
28
|
+
Type["ADD_SHIPPING_INFO"] = "ADD_SHIPPING_INFO";
|
|
29
|
+
Type["ADD_CUSTOMER_INFO"] = "ADD_CUSTOMER_INFO";
|
|
30
|
+
Type["ADD_PAYMENT_INFO"] = "ADD_PAYMENT_INFO";
|
|
31
|
+
Type["CHECKOUT_COMPLETED"] = "CHECKOUT_COMPLETED";
|
|
32
|
+
})(Type || (Type = {}));
|
|
33
|
+
const getAccountId = () => {
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
|
+
if (typeof window !== "undefined" && ((_a = window.__SOLOMON__) === null || _a === void 0 ? void 0 : _a.accountId)) {
|
|
36
|
+
return window.__SOLOMON__.accountId;
|
|
37
|
+
}
|
|
38
|
+
if (typeof self !== "undefined" && ((_b = self.__SOLOMON__) === null || _b === void 0 ? void 0 : _b.accountId)) {
|
|
39
|
+
return self.__SOLOMON__.accountId;
|
|
40
|
+
}
|
|
41
|
+
if (typeof window !== "undefined" && ((_c = window.SOLOMON) === null || _c === void 0 ? void 0 : _c.accountId)) {
|
|
42
|
+
return window.SOLOMON.accountId;
|
|
43
|
+
}
|
|
44
|
+
if (typeof self !== "undefined" && ((_d = self.SOLOMON) === null || _d === void 0 ? void 0 : _d.accountId)) {
|
|
45
|
+
return self.SOLOMON.accountId;
|
|
46
|
+
}
|
|
47
|
+
return "";
|
|
48
|
+
};
|
|
49
|
+
const getUniqueId = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const localStorageKey = 'uniqueId';
|
|
51
|
+
const cookieKey = 'uniqueId';
|
|
52
|
+
const utmTerm = getUtmParameter('utm_term');
|
|
53
|
+
const getCurrentHostname = () => {
|
|
54
|
+
var _a, _b, _c, _d;
|
|
55
|
+
if (typeof window !== "undefined" && window.location) {
|
|
56
|
+
return window.location.hostname;
|
|
57
|
+
}
|
|
58
|
+
if (typeof self !== "undefined" && ((_d = (_c = (_b = (_a = self === null || self === void 0 ? void 0 : self.Shopify) === null || _a === void 0 ? void 0 : _a.init) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.document) === null || _d === void 0 ? void 0 : _d.location)) {
|
|
59
|
+
return self.Shopify.init.context.document.location.hostname;
|
|
60
|
+
}
|
|
61
|
+
return '';
|
|
62
|
+
};
|
|
63
|
+
const getReferrer = () => {
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
|
+
if (typeof document !== "undefined" && document.referrer) {
|
|
66
|
+
return document.referrer;
|
|
67
|
+
}
|
|
68
|
+
if (typeof self !== "undefined" && ((_d = (_c = (_b = (_a = self === null || self === void 0 ? void 0 : self.Shopify) === null || _a === void 0 ? void 0 : _a.init) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.document) === null || _d === void 0 ? void 0 : _d.referrer)) {
|
|
69
|
+
return self.Shopify.init.context.document.referrer;
|
|
70
|
+
}
|
|
71
|
+
return '';
|
|
72
|
+
};
|
|
73
|
+
let uniqueId;
|
|
74
|
+
const pattern = /^[a-z0-9]{9}_([0-9]+)$/;
|
|
75
|
+
const currentHostname = getCurrentHostname();
|
|
76
|
+
const referrer = getReferrer();
|
|
77
|
+
const localStorageValue = yield getLocalStorage(localStorageKey);
|
|
78
|
+
if (localStorageValue) {
|
|
79
|
+
uniqueId = localStorageValue;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const cookieValue = yield getCookie(cookieKey);
|
|
83
|
+
if (cookieValue) {
|
|
84
|
+
uniqueId = cookieValue;
|
|
85
|
+
yield setAllStorage(localStorageKey, uniqueId, 365 * 24 * 60 * 60 * 1000);
|
|
86
|
+
}
|
|
87
|
+
else if (utmTerm && pattern.test(utmTerm) && referrer.indexOf(currentHostname) !== -1) {
|
|
88
|
+
uniqueId = utmTerm;
|
|
89
|
+
yield setAllStorage(localStorageKey, uniqueId, 365 * 24 * 60 * 60 * 1000);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
uniqueId = Math.random().toString(36).substr(2, 9) + "_" + new Date().getTime();
|
|
93
|
+
yield setAllStorage(localStorageKey, uniqueId, 365 * 24 * 60 * 60 * 1000);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (localStorageValue) {
|
|
97
|
+
yield setCookie(cookieKey, uniqueId, 365 * 24 * 60 * 60 * 1000);
|
|
98
|
+
}
|
|
99
|
+
return uniqueId;
|
|
100
|
+
});
|
|
101
|
+
const SolomonEvent = (companyId, type, payload, custom_aliases) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
103
|
+
return {
|
|
104
|
+
company_id: companyId,
|
|
105
|
+
event_id: generateUUIDv4(),
|
|
106
|
+
event_time: new Date().toISOString(),
|
|
107
|
+
session_id: yield getSessionId(),
|
|
108
|
+
user_id: yield getUserId(),
|
|
109
|
+
fbp: yield getFbp(),
|
|
110
|
+
fbc: yield getFbc(),
|
|
111
|
+
legacy_id: yield getLegacyId(),
|
|
112
|
+
custom_aliases: yield custom_aliases,
|
|
113
|
+
event_type: String(type),
|
|
114
|
+
page_referrer: (_e = (_d = (_c = (_b = (_a = self === null || self === void 0 ? void 0 : self.Shopify) === null || _a === void 0 ? void 0 : _a.init) === null || _b === void 0 ? void 0 : _b.context) === null || _c === void 0 ? void 0 : _c.document) === null || _d === void 0 ? void 0 : _d.referrer) !== null && _e !== void 0 ? _e : document === null || document === void 0 ? void 0 : document.referrer,
|
|
115
|
+
page_path: (_o = (_l = (_k = (_j = (_h = (_g = (_f = self === null || self === void 0 ? void 0 : self.Shopify) === null || _f === void 0 ? void 0 : _f.init) === null || _g === void 0 ? void 0 : _g.context) === null || _h === void 0 ? void 0 : _h.document) === null || _j === void 0 ? void 0 : _j.location) === null || _k === void 0 ? void 0 : _k.pathname) !== null && _l !== void 0 ? _l : (_m = window === null || window === void 0 ? void 0 : window.location) === null || _m === void 0 ? void 0 : _m.pathname) !== null && _o !== void 0 ? _o : '',
|
|
116
|
+
utm_source: (_p = getUtmParameter('utm_source')) !== null && _p !== void 0 ? _p : '',
|
|
117
|
+
utm_medium: (_q = getUtmParameter('utm_medium')) !== null && _q !== void 0 ? _q : '',
|
|
118
|
+
utm_campaign: (_r = getUtmParameter('utm_campaign')) !== null && _r !== void 0 ? _r : '',
|
|
119
|
+
utm_term: (_s = getUtmParameter('utm_term')) !== null && _s !== void 0 ? _s : '',
|
|
120
|
+
utm_content: (_t = getUtmParameter('utm_content')) !== null && _t !== void 0 ? _t : '',
|
|
121
|
+
sol_source: (_u = getUtmParameter('sol_source')) !== null && _u !== void 0 ? _u : '',
|
|
122
|
+
sol_medium: (_v = getUtmParameter('sol_medium')) !== null && _v !== void 0 ? _v : '',
|
|
123
|
+
sol_campaign: (_w = getUtmParameter('sol_campaign')) !== null && _w !== void 0 ? _w : '',
|
|
124
|
+
sol_content: (_x = getUtmParameter('sol_content')) !== null && _x !== void 0 ? _x : '',
|
|
125
|
+
event_payload: payload,
|
|
126
|
+
voxus_url: (_y = localStorage.getItem('analytics:session')) !== null && _y !== void 0 ? _y : '',
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
const updateUTMParametersInCookie = (eventData) => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
const utmKeys = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'sol_source', 'sol_medium', 'sol_campaign', 'sol_content'];
|
|
131
|
+
const existingParams = {};
|
|
132
|
+
const existingCookie = yield getCookie('utmsTrack');
|
|
133
|
+
if (existingCookie) {
|
|
134
|
+
existingCookie.split('&').forEach((part) => {
|
|
135
|
+
const item = part.split('=');
|
|
136
|
+
if (item.length === 2) {
|
|
137
|
+
existingParams[item[0]] = item[1];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const newUtmParams = {
|
|
142
|
+
utm_source: eventData.utm_source,
|
|
143
|
+
utm_medium: eventData.utm_medium,
|
|
144
|
+
utm_campaign: eventData.utm_campaign,
|
|
145
|
+
utm_content: eventData.utm_content,
|
|
146
|
+
sol_source: eventData.sol_source,
|
|
147
|
+
sol_medium: eventData.sol_medium,
|
|
148
|
+
sol_campaign: eventData.sol_campaign,
|
|
149
|
+
sol_content: eventData.sol_content,
|
|
150
|
+
};
|
|
151
|
+
let hasAnyNewUtm = false;
|
|
152
|
+
for (const key of utmKeys) {
|
|
153
|
+
if (newUtmParams[key]) {
|
|
154
|
+
hasAnyNewUtm = true;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const getBaseDomain = (hostname) => {
|
|
159
|
+
const parts = hostname.split('.');
|
|
160
|
+
const compositeTLDs = [
|
|
161
|
+
'com.br', 'net.br', 'org.br', 'gov.br', 'edu.br',
|
|
162
|
+
'co.uk', 'co.jp', 'co.kr', 'co.za', 'co.in',
|
|
163
|
+
'com.au', 'com.mx', 'com.ar', 'com.co'
|
|
164
|
+
];
|
|
165
|
+
if (parts.length <= 2) {
|
|
166
|
+
return hostname;
|
|
167
|
+
}
|
|
168
|
+
const lastTwoParts = parts.slice(-2).join('.');
|
|
169
|
+
if (compositeTLDs.includes(lastTwoParts)) {
|
|
170
|
+
return parts.slice(-3).join('.');
|
|
171
|
+
}
|
|
172
|
+
return parts.slice(-2).join('.');
|
|
173
|
+
};
|
|
174
|
+
let hasExternalReferrer = false;
|
|
175
|
+
const referrer = eventData.referrer || '';
|
|
176
|
+
const currentDomain = eventData.current_domain || '';
|
|
177
|
+
if (referrer && currentDomain) {
|
|
178
|
+
try {
|
|
179
|
+
const referrerUrl = new URL(referrer);
|
|
180
|
+
const baseDomain = getBaseDomain(currentDomain);
|
|
181
|
+
const allowedDomains = [
|
|
182
|
+
'mercadopago.com',
|
|
183
|
+
'myshopify.com'
|
|
184
|
+
];
|
|
185
|
+
const isSameDomain = referrerUrl.hostname.includes(baseDomain);
|
|
186
|
+
const isAllowedGateway = allowedDomains.some(domain => referrerUrl.hostname.includes(domain));
|
|
187
|
+
hasExternalReferrer = !isSameDomain && !isAllowedGateway;
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
hasExternalReferrer = false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
let updatedParams = {};
|
|
194
|
+
if ((hasAnyNewUtm || hasExternalReferrer) && getCompanyId() != 'Sz8mKHeQqQcPpUnSyET0') {
|
|
195
|
+
updatedParams['utm_term'] = eventData.utm_term;
|
|
196
|
+
for (const key of utmKeys) {
|
|
197
|
+
if (newUtmParams[key]) {
|
|
198
|
+
updatedParams[key] = newUtmParams[key];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
for (const key in existingParams) {
|
|
204
|
+
if (existingParams.hasOwnProperty(key)) {
|
|
205
|
+
updatedParams[key] = existingParams[key];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (eventData.utm_term) {
|
|
209
|
+
updatedParams['utm_term'] = eventData.utm_term;
|
|
210
|
+
}
|
|
211
|
+
for (const key of utmKeys) {
|
|
212
|
+
if (newUtmParams[key]) {
|
|
213
|
+
updatedParams[key] = newUtmParams[key];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const updatedString = [];
|
|
218
|
+
for (const key in updatedParams) {
|
|
219
|
+
if (updatedParams.hasOwnProperty(key)) {
|
|
220
|
+
updatedString.push(key + '=' + updatedParams[key]);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
yield setCookie('utmsTrack', updatedString.join('&'), 30 * 24 * 60 * 60 * 1000);
|
|
224
|
+
yield setCookie('track_utms', updatedString.join('&'), 30 * 24 * 60 * 60 * 1000);
|
|
225
|
+
yield setCookie('yeverUtmsTrack', updatedString.join('&'), 30 * 24 * 60 * 60 * 1000);
|
|
226
|
+
});
|
|
227
|
+
const TouchpointEvent = (account_id, custom_aliases, platform) => __awaiter(void 0, void 0, void 0, function* () {
|
|
228
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
229
|
+
let isSeller = new URLSearchParams(window.location.search).get('vendedor') === 'true';
|
|
230
|
+
if (document.referrer.includes('desk.hyperflow.global') || document.referrer.includes('app.yampi.com') || document.referrer.includes('app.reportana.com')) {
|
|
231
|
+
isSeller = true;
|
|
232
|
+
}
|
|
233
|
+
if (isSeller) {
|
|
234
|
+
setCookie('is_seller', 'true', 365);
|
|
235
|
+
localStorage.setItem('is_seller', 'true');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if ((yield getCookie('is_seller')) === 'true' || isSeller || localStorage.getItem('is_seller') === 'true') {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const fbp = (yield getFbp()) || (yield getCookie('_fbp')) || "";
|
|
242
|
+
const fbc = (yield getFbc()) || (yield getCookie('_fbc')) || "";
|
|
243
|
+
const fbclid = getUtmParameter('fbclid') || (yield getCookie('_fbclid')) || "";
|
|
244
|
+
const gaId = (yield getCookie('_ga')) || "";
|
|
245
|
+
const localeStr = typeof navigator !== "undefined" ? navigator.language.replace('-', '_') : '';
|
|
246
|
+
const utmTerm = (_a = getUtmParameter('utm_term')) !== null && _a !== void 0 ? _a : '';
|
|
247
|
+
const queryParams = (_j = (_g = (_f = (_e = (_d = (_c = (_b = self === null || self === void 0 ? void 0 : self.Shopify) === null || _b === void 0 ? void 0 : _b.init) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.document) === null || _e === void 0 ? void 0 : _e.location) === null || _f === void 0 ? void 0 : _f.search) !== null && _g !== void 0 ? _g : (_h = window === null || window === void 0 ? void 0 : window.location) === null || _h === void 0 ? void 0 : _h.search) !== null && _j !== void 0 ? _j : '';
|
|
248
|
+
let timezone = '';
|
|
249
|
+
try {
|
|
250
|
+
if (typeof navigator !== "undefined") {
|
|
251
|
+
const timezoneMatch = /.*\s(.+)/.exec((new Date()).toLocaleDateString(navigator.language, { timeZoneName: 'short' }));
|
|
252
|
+
timezone = timezoneMatch ? timezoneMatch[1] : '';
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch (e) {
|
|
256
|
+
timezone = '';
|
|
257
|
+
}
|
|
258
|
+
let cartToken = '';
|
|
259
|
+
let customAliases = yield custom_aliases;
|
|
260
|
+
if (platform === 'shoppub') {
|
|
261
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.customer_id) || '';
|
|
262
|
+
}
|
|
263
|
+
else if (platform === 'shopify' || platform === 'nuvemshop' || platform === 'tray' || platform === 'vtex' || platform === 'trinio' || platform === 'magento' || platform === 'buda' || platform === 'linx') {
|
|
264
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.cart_token) || '';
|
|
265
|
+
}
|
|
266
|
+
else if (platform === 'magazord') {
|
|
267
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.email) || '';
|
|
268
|
+
}
|
|
269
|
+
else if (platform === 'yampi' || platform === 'woocommerce') {
|
|
270
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.transaction_id) || (customAliases === null || customAliases === void 0 ? void 0 : customAliases.cart_token) || '';
|
|
271
|
+
}
|
|
272
|
+
else if (platform === 'uappi' || platform === 'bagy' || platform === 'wake' || platform === 'wbuy') {
|
|
273
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.order_id) || '';
|
|
274
|
+
}
|
|
275
|
+
else if (platform === 'cartpanda') {
|
|
276
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.cart_token) || '';
|
|
277
|
+
}
|
|
278
|
+
else if (platform === 'b4you') {
|
|
279
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.cart_token) || (customAliases === null || customAliases === void 0 ? void 0 : customAliases.customer_id) || '';
|
|
280
|
+
}
|
|
281
|
+
else if (platform === 'loja_integrada') {
|
|
282
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.transaction_id) || '';
|
|
283
|
+
}
|
|
284
|
+
else if (platform === 'custom') {
|
|
285
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.user_id) || '';
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
cartToken = (customAliases === null || customAliases === void 0 ? void 0 : customAliases.cart_token) || (customAliases === null || customAliases === void 0 ? void 0 : customAliases.customer_id) || (customAliases === null || customAliases === void 0 ? void 0 : customAliases.email) || '';
|
|
289
|
+
}
|
|
290
|
+
let isReload = false;
|
|
291
|
+
try {
|
|
292
|
+
const navEntry = performance.getEntriesByType('navigation')[0];
|
|
293
|
+
isReload = (navEntry === null || navEntry === void 0 ? void 0 : navEntry.type) === 'reload';
|
|
294
|
+
}
|
|
295
|
+
catch (e) {
|
|
296
|
+
isReload = ((_k = performance === null || performance === void 0 ? void 0 : performance.navigation) === null || _k === void 0 ? void 0 : _k.type) === 1;
|
|
297
|
+
}
|
|
298
|
+
let referrer = (_q = (_p = (_o = (_m = (_l = self === null || self === void 0 ? void 0 : self.Shopify) === null || _l === void 0 ? void 0 : _l.init) === null || _m === void 0 ? void 0 : _m.context) === null || _o === void 0 ? void 0 : _o.document) === null || _p === void 0 ? void 0 : _p.referrer) !== null && _q !== void 0 ? _q : document === null || document === void 0 ? void 0 : document.referrer;
|
|
299
|
+
if ((window === null || window === void 0 ? void 0 : window.pageViewFired) || isReload) {
|
|
300
|
+
referrer = '';
|
|
301
|
+
}
|
|
302
|
+
window.pageViewFired = true;
|
|
303
|
+
var eventData = {
|
|
304
|
+
id: yield getUniqueId(),
|
|
305
|
+
referrer: referrer,
|
|
306
|
+
path: (_y = (_w = (_v = (_u = (_t = (_s = (_r = self === null || self === void 0 ? void 0 : self.Shopify) === null || _r === void 0 ? void 0 : _r.init) === null || _s === void 0 ? void 0 : _s.context) === null || _t === void 0 ? void 0 : _t.document) === null || _u === void 0 ? void 0 : _u.location) === null || _v === void 0 ? void 0 : _v.pathname) !== null && _w !== void 0 ? _w : (_x = window === null || window === void 0 ? void 0 : window.location) === null || _x === void 0 ? void 0 : _x.pathname) !== null && _y !== void 0 ? _y : '',
|
|
307
|
+
utm_source: (_z = getUtmParameter('utm_source')) !== null && _z !== void 0 ? _z : '',
|
|
308
|
+
utm_medium: (_0 = getUtmParameter('utm_medium')) !== null && _0 !== void 0 ? _0 : '',
|
|
309
|
+
utm_campaign: (_1 = getUtmParameter('utm_campaign')) !== null && _1 !== void 0 ? _1 : '',
|
|
310
|
+
utm_term: yield getUniqueId(),
|
|
311
|
+
utm_content: (_2 = getUtmParameter('utm_content')) !== null && _2 !== void 0 ? _2 : '',
|
|
312
|
+
sol_source: (_3 = getUtmParameter('sol_source')) !== null && _3 !== void 0 ? _3 : '',
|
|
313
|
+
sol_medium: (_4 = getUtmParameter('sol_medium')) !== null && _4 !== void 0 ? _4 : '',
|
|
314
|
+
sol_campaign: (_5 = getUtmParameter('sol_campaign')) !== null && _5 !== void 0 ? _5 : '',
|
|
315
|
+
sol_content: (_6 = getUtmParameter('sol_content')) !== null && _6 !== void 0 ? _6 : '',
|
|
316
|
+
fbp: fbp,
|
|
317
|
+
fbc: fbc,
|
|
318
|
+
ga_id: gaId,
|
|
319
|
+
fbclid: fbclid,
|
|
320
|
+
locale: localeStr ? localeStr.charAt(0).toUpperCase() + localeStr.slice(1) : '',
|
|
321
|
+
timezone: timezone,
|
|
322
|
+
osVersion: typeof navigator !== "undefined" ? navigator.appVersion.split(" ")[0] : '',
|
|
323
|
+
screenWidth: typeof screen !== "undefined" ? screen.width : 0,
|
|
324
|
+
screenHeight: typeof screen !== "undefined" ? screen.height : 0,
|
|
325
|
+
density: typeof window !== "undefined" ? window.devicePixelRatio : 1,
|
|
326
|
+
cpuCores: typeof navigator !== "undefined" ? navigator.hardwareConcurrency : 0,
|
|
327
|
+
queryParams: queryParams,
|
|
328
|
+
debug: '',
|
|
329
|
+
old_id: utmTerm,
|
|
330
|
+
shopify_id: account_id,
|
|
331
|
+
current_domain: typeof window !== "undefined" ? window.location.hostname : '',
|
|
332
|
+
cart_token: cartToken,
|
|
333
|
+
email: (_7 = (yield custom_aliases)) === null || _7 === void 0 ? void 0 : _7.email,
|
|
334
|
+
};
|
|
335
|
+
yield updateUTMParametersInCookie(eventData);
|
|
336
|
+
eventData.utmsTrack = yield getCookie('utmsTrack');
|
|
337
|
+
return eventData;
|
|
338
|
+
});
|
|
339
|
+
const ViewPageEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
340
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.VIEW_PAGE, payload, aliases);
|
|
341
|
+
});
|
|
342
|
+
const EventTouchpoint = (aliases, platform, account_id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
343
|
+
return yield TouchpointEvent(account_id || getAccountId(), aliases, platform);
|
|
344
|
+
});
|
|
345
|
+
const ContentViewEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
346
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.CONTENT_VIEW, payload, aliases);
|
|
347
|
+
});
|
|
348
|
+
const AddToCartEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
349
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.ADD_TO_CART, payload, aliases);
|
|
350
|
+
});
|
|
351
|
+
const InitiateCheckoutEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
352
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.INITIATE_CHECKOUT, payload, aliases);
|
|
353
|
+
});
|
|
354
|
+
const AddCustomerInfoEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
355
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.ADD_CUSTOMER_INFO, payload, aliases);
|
|
356
|
+
});
|
|
357
|
+
const AddShippingInfoEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
358
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.ADD_SHIPPING_INFO, payload, aliases);
|
|
359
|
+
});
|
|
360
|
+
const AddPaymentInfoEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
361
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.ADD_PAYMENT_INFO, payload, aliases);
|
|
362
|
+
});
|
|
363
|
+
const CheckoutCompletedEvent = (payload, aliases, companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
364
|
+
return yield SolomonEvent(companyId || getCompanyId(), Type.CHECKOUT_COMPLETED, payload, aliases);
|
|
365
|
+
});
|
|
366
|
+
export { SolomonEvent, Type, ViewPageEvent as createViewPage, ContentViewEvent, AddToCartEvent, InitiateCheckoutEvent, AddPaymentInfoEvent, AddCustomerInfoEvent, AddShippingInfoEvent, CheckoutCompletedEvent, EventTouchpoint as eventTouchpoint };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
const BACKEND_URL = "https://webanalytics.solomon.com.br/event?mode=web";
|
|
11
|
+
const EVENTS_URL = "https://pixel.solomon.com.br/event";
|
|
12
|
+
const publish = (event_promise) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
var _a;
|
|
14
|
+
const event = yield event_promise;
|
|
15
|
+
const url = ((_a = window.__SOLOMON__) === null || _a === void 0 ? void 0 : _a.webanalyticsUrl)
|
|
16
|
+
? window.__SOLOMON__.webanalyticsUrl + "/event?mode=web"
|
|
17
|
+
: BACKEND_URL;
|
|
18
|
+
try {
|
|
19
|
+
;
|
|
20
|
+
const response = yield fetch(url, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
mode: "cors",
|
|
23
|
+
credentials: "omit",
|
|
24
|
+
headers: { "content-type": "application/json" },
|
|
25
|
+
body: JSON.stringify(event),
|
|
26
|
+
});
|
|
27
|
+
if (response.ok) {
|
|
28
|
+
const text = yield response.text();
|
|
29
|
+
if (text) {
|
|
30
|
+
const data = JSON.parse(text);
|
|
31
|
+
console.debug('[Solomon] Evento enviado com sucesso:', data);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.debug('[Solomon] Evento enviado com sucesso (sem corpo)');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.error('[Solomon] Erro HTTP ao enviar evento:', response.status, response.statusText);
|
|
39
|
+
const errorText = yield response.text().catch(() => 'Unable to read error response');
|
|
40
|
+
console.error('[Solomon] Response error details:', errorText);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Erro ao enviar evento:', error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const publish_event = (event_promise) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
var _a;
|
|
49
|
+
const event = yield event_promise;
|
|
50
|
+
const url = ((_a = window.__SOLOMON__) === null || _a === void 0 ? void 0 : _a.pixelUrl)
|
|
51
|
+
? window.__SOLOMON__.pixelUrl + "/event"
|
|
52
|
+
: EVENTS_URL;
|
|
53
|
+
try {
|
|
54
|
+
const response = yield fetch(url, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
mode: 'cors',
|
|
57
|
+
credentials: 'omit',
|
|
58
|
+
headers: { 'content-type': 'application/json' },
|
|
59
|
+
body: JSON.stringify(event),
|
|
60
|
+
});
|
|
61
|
+
if (response.ok) {
|
|
62
|
+
const text = yield response.text();
|
|
63
|
+
if (text) {
|
|
64
|
+
const data = JSON.parse(text);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.debug('Evento enviado com sucesso (sem corpo)');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.error('Erro HTTP ao enviar evento:', response.status, response.statusText);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error('Erro ao enviar evento:', error);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export { publish, publish_event };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SolomonEvent, SolomonPayload } from "./events";
|
|
2
|
+
import { CustomAliases } from "./types";
|
|
3
|
+
export interface SDKConfig {
|
|
4
|
+
companyId: string;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
useTouchpoint?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class SolomonSDK {
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config: SDKConfig);
|
|
11
|
+
track<E extends SolomonEvent>(event: E, payload?: SolomonPayload<E>, aliases?: CustomAliases): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { SolomonEvent as SolomonEventFn, createViewPage, ContentViewEvent, AddToCartEvent, InitiateCheckoutEvent, AddShippingInfoEvent, AddCustomerInfoEvent, AddPaymentInfoEvent, CheckoutCompletedEvent, eventTouchpoint } from "../../events";
|
|
11
|
+
import { publish, publish_event } from "../../publish";
|
|
12
|
+
export class SolomonSDK {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
if (this.config.debug) {
|
|
16
|
+
console.log("[SolomonSDK] initialized", config);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
track(event, payload, aliases) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
if (this.config.debug) {
|
|
22
|
+
console.log("[SolomonSDK] Tracking event:", event, payload);
|
|
23
|
+
}
|
|
24
|
+
const aliasesPromise = aliases ? Promise.resolve(aliases) : undefined;
|
|
25
|
+
try {
|
|
26
|
+
let eventPromise;
|
|
27
|
+
switch (event) {
|
|
28
|
+
case "VIEW_PAGE": {
|
|
29
|
+
const url = typeof window !== "undefined" ? window.location.href : "";
|
|
30
|
+
const path = typeof window !== "undefined" ? window.location.pathname : undefined;
|
|
31
|
+
eventPromise = createViewPage({ url, path }, aliasesPromise, this.config.companyId);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case "CONTENT_VIEW": {
|
|
35
|
+
eventPromise = ContentViewEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "ADD_TO_CART": {
|
|
39
|
+
eventPromise = AddToCartEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case "INITIATE_CHECKOUT": {
|
|
43
|
+
eventPromise = InitiateCheckoutEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "ADD_SHIPPING_INFO": {
|
|
47
|
+
eventPromise = AddShippingInfoEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case "ADD_CUSTOMER_INFO": {
|
|
51
|
+
eventPromise = AddCustomerInfoEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case "ADD_PAYMENT_INFO": {
|
|
55
|
+
eventPromise = AddPaymentInfoEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "CHECKOUT_COMPLETED": {
|
|
59
|
+
eventPromise = CheckoutCompletedEvent(Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise, this.config.companyId);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
eventPromise = SolomonEventFn(this.config.companyId, event, Object.assign(Object.assign({}, payload), { url: typeof window !== "undefined" ? window.location.href : undefined, path: typeof window !== "undefined" ? window.location.pathname : undefined }), aliasesPromise);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (this.config.useTouchpoint) {
|
|
67
|
+
const touchpointPromise = eventTouchpoint(aliasesPromise, "custom", this.config.companyId);
|
|
68
|
+
yield publish_event(touchpointPromise);
|
|
69
|
+
}
|
|
70
|
+
yield publish(eventPromise);
|
|
71
|
+
if (this.config.debug) {
|
|
72
|
+
console.log("[SolomonSDK] Event tracked successfully:", event);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error("[SolomonSDK] Error tracking event:", error);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type SolomonEvent = "VIEW_PAGE" | "CONTENT_VIEW" | "ADD_TO_CART" | "INITIATE_CHECKOUT" | "ADD_SHIPPING_INFO" | "ADD_CUSTOMER_INFO" | "ADD_PAYMENT_INFO" | "CHECKOUT_COMPLETED" | (string & {});
|
|
2
|
+
export type ViewContentPayload = {
|
|
3
|
+
id: string;
|
|
4
|
+
variant?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
price?: number;
|
|
7
|
+
};
|
|
8
|
+
export type AddToCartPayload = {
|
|
9
|
+
item_id: string;
|
|
10
|
+
item_quantity: number;
|
|
11
|
+
};
|
|
12
|
+
export type InitiateCheckoutPayload = {
|
|
13
|
+
items: {
|
|
14
|
+
item_id: string;
|
|
15
|
+
item_quantity: number;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
export type AddShippingInfoPayload = {
|
|
19
|
+
items: {
|
|
20
|
+
item_id: string;
|
|
21
|
+
item_quantity: number;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
export type AddCustomerInfoPayload = {
|
|
25
|
+
items: {
|
|
26
|
+
item_id: string;
|
|
27
|
+
item_quantity: number;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
export type AddPaymentInfoPayload = {
|
|
31
|
+
items: {
|
|
32
|
+
item_id: string;
|
|
33
|
+
item_quantity: number;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
export type CheckoutCompletedPayload = {
|
|
37
|
+
items: {
|
|
38
|
+
item_id: string;
|
|
39
|
+
item_quantity: number;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
export interface EventPayloadMap {
|
|
43
|
+
VIEW_PAGE: null;
|
|
44
|
+
ADD_TO_CART: AddToCartPayload;
|
|
45
|
+
INITIATE_CHECKOUT: InitiateCheckoutPayload;
|
|
46
|
+
ADD_SHIPPING_INFO: AddShippingInfoPayload;
|
|
47
|
+
ADD_CUSTOMER_INFO: AddCustomerInfoPayload;
|
|
48
|
+
ADD_PAYMENT_INFO: AddPaymentInfoPayload;
|
|
49
|
+
CHECKOUT_COMPLETED: CheckoutCompletedPayload;
|
|
50
|
+
CONTENT_VIEW: ViewContentPayload;
|
|
51
|
+
}
|
|
52
|
+
export type SolomonPayload<E extends SolomonEvent> = E extends keyof EventPayloadMap ? EventPayloadMap[E] : Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Product = {
|
|
2
|
+
id: string;
|
|
3
|
+
variant: string;
|
|
4
|
+
title: string;
|
|
5
|
+
price: number;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
export type CustomAliases = {
|
|
9
|
+
user_id?: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
phone?: string;
|
|
12
|
+
customer_id?: string;
|
|
13
|
+
cart_token?: string;
|
|
14
|
+
order_id?: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SolomonSDK } from "./core/client";
|
|
2
|
+
export type { SDKConfig } from "./core/client";
|
|
3
|
+
export type { SolomonEvent, SolomonPayload } from "./core/events";
|
|
4
|
+
export type { CustomAliases, Product } from "./core/types";
|
|
5
|
+
export type { ViewContentPayload, AddToCartPayload, InitiateCheckoutPayload, AddShippingInfoPayload, AddCustomerInfoPayload, AddPaymentInfoPayload, CheckoutCompletedPayload } from "./core/events";
|
|
6
|
+
export { SolomonSDK as default } from "./core/client";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SolomonEvent, SolomonPayload } from "../core/events";
|
|
2
|
+
import type { CustomAliases } from "../core/types";
|
|
3
|
+
import type { SDKConfig } from "../core/client";
|
|
4
|
+
export interface NodeSDKConfig extends SDKConfig {
|
|
5
|
+
webanalyticsUrl?: string;
|
|
6
|
+
pixelUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class SolomonSDK {
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config: NodeSDKConfig);
|
|
11
|
+
track<E extends SolomonEvent>(event: E, payload?: SolomonPayload<E>, aliases?: CustomAliases): Promise<void>;
|
|
12
|
+
private sendTouchpoint;
|
|
13
|
+
}
|