analytica.click 0.0.264 → 0.0.267
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/index.d.ts +6 -14
- package/dist/index.js +3 -1775
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,1776 +1,4 @@
|
|
1
|
-
var __create = Object.create;
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __defProps = Object.defineProperties;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
-
var __spreadValues = (a, b) => {
|
13
|
-
for (var prop in b || (b = {}))
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
if (__getOwnPropSymbols)
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
-
if (__propIsEnum.call(b, prop))
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
20
|
-
}
|
21
|
-
return a;
|
22
|
-
};
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
-
var __commonJS = (cb, mod) => function __require() {
|
25
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
26
|
-
};
|
27
|
-
var __export = (target, all) => {
|
28
|
-
for (var name in all)
|
29
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
30
|
-
};
|
31
|
-
var __copyProps = (to, from, except, desc) => {
|
32
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
33
|
-
for (let key of __getOwnPropNames(from))
|
34
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
35
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
36
|
-
}
|
37
|
-
return to;
|
38
|
-
};
|
39
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
40
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
41
|
-
mod
|
42
|
-
));
|
43
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
44
|
-
var __async = (__this, __arguments, generator) => {
|
45
|
-
return new Promise((resolve, reject) => {
|
46
|
-
var fulfilled = (value) => {
|
47
|
-
try {
|
48
|
-
step(generator.next(value));
|
49
|
-
} catch (e) {
|
50
|
-
reject(e);
|
51
|
-
}
|
52
|
-
};
|
53
|
-
var rejected = (value) => {
|
54
|
-
try {
|
55
|
-
step(generator.throw(value));
|
56
|
-
} catch (e) {
|
57
|
-
reject(e);
|
58
|
-
}
|
59
|
-
};
|
60
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
61
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
62
|
-
});
|
63
|
-
};
|
64
|
-
|
65
|
-
// ../common/dist/api/base.js
|
66
|
-
var require_base = __commonJS({
|
67
|
-
"../common/dist/api/base.js"(exports) {
|
68
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
69
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
70
|
-
};
|
71
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
72
|
-
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
73
|
-
var axios_1 = __importDefault(require("axios"));
|
74
|
-
exports.BASE_PATH = "https://api.analytica.click".replace(/\/+$/, "");
|
75
|
-
exports.COLLECTION_FORMATS = {
|
76
|
-
csv: ",",
|
77
|
-
ssv: " ",
|
78
|
-
tsv: " ",
|
79
|
-
pipes: "|"
|
80
|
-
};
|
81
|
-
var BaseAPI = class {
|
82
|
-
constructor(configuration, basePath = exports.BASE_PATH, axios = axios_1.default) {
|
83
|
-
this.basePath = basePath;
|
84
|
-
this.axios = axios;
|
85
|
-
if (configuration) {
|
86
|
-
this.configuration = configuration;
|
87
|
-
this.basePath = configuration.basePath || this.basePath;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
};
|
91
|
-
exports.BaseAPI = BaseAPI;
|
92
|
-
var RequiredError = class extends Error {
|
93
|
-
constructor(field, msg) {
|
94
|
-
super(msg);
|
95
|
-
this.field = field;
|
96
|
-
this.name = "RequiredError";
|
97
|
-
}
|
98
|
-
};
|
99
|
-
exports.RequiredError = RequiredError;
|
100
|
-
}
|
101
|
-
});
|
102
|
-
|
103
|
-
// ../common/dist/api/api.js
|
104
|
-
var require_api = __commonJS({
|
105
|
-
"../common/dist/api/api.js"(exports) {
|
106
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
107
|
-
if (k2 === void 0)
|
108
|
-
k2 = k;
|
109
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
110
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
111
|
-
desc = { enumerable: true, get: function() {
|
112
|
-
return m[k];
|
113
|
-
} };
|
114
|
-
}
|
115
|
-
Object.defineProperty(o, k2, desc);
|
116
|
-
} : function(o, m, k, k2) {
|
117
|
-
if (k2 === void 0)
|
118
|
-
k2 = k;
|
119
|
-
o[k2] = m[k];
|
120
|
-
});
|
121
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
122
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
123
|
-
} : function(o, v) {
|
124
|
-
o["default"] = v;
|
125
|
-
});
|
126
|
-
var __importStar = exports && exports.__importStar || function(mod) {
|
127
|
-
if (mod && mod.__esModule)
|
128
|
-
return mod;
|
129
|
-
var result = {};
|
130
|
-
if (mod != null) {
|
131
|
-
for (var k in mod)
|
132
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
133
|
-
__createBinding(result, mod, k);
|
134
|
-
}
|
135
|
-
__setModuleDefault(result, mod);
|
136
|
-
return result;
|
137
|
-
};
|
138
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
139
|
-
function adopt(value) {
|
140
|
-
return value instanceof P ? value : new P(function(resolve) {
|
141
|
-
resolve(value);
|
142
|
-
});
|
143
|
-
}
|
144
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
145
|
-
function fulfilled(value) {
|
146
|
-
try {
|
147
|
-
step(generator.next(value));
|
148
|
-
} catch (e) {
|
149
|
-
reject(e);
|
150
|
-
}
|
151
|
-
}
|
152
|
-
function rejected(value) {
|
153
|
-
try {
|
154
|
-
step(generator["throw"](value));
|
155
|
-
} catch (e) {
|
156
|
-
reject(e);
|
157
|
-
}
|
158
|
-
}
|
159
|
-
function step(result) {
|
160
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
161
|
-
}
|
162
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
163
|
-
});
|
164
|
-
};
|
165
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
166
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
167
|
-
};
|
168
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
169
|
-
exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = exports.Sentiment = void 0;
|
170
|
-
var globalImportUrl = __importStar(require("url"));
|
171
|
-
var axios_1 = __importDefault(require("axios"));
|
172
|
-
var base_1 = require_base();
|
173
|
-
var Sentiment;
|
174
|
-
(function(Sentiment2) {
|
175
|
-
Sentiment2["Good"] = "good";
|
176
|
-
Sentiment2["Bad"] = "bad";
|
177
|
-
Sentiment2["Neutral"] = "neutral";
|
178
|
-
})(Sentiment = exports.Sentiment || (exports.Sentiment = {}));
|
179
|
-
var DefaultApiAxiosParamCreator = function(configuration) {
|
180
|
-
return {
|
181
|
-
accountGet: (options = {}) => __awaiter(this, void 0, void 0, function* () {
|
182
|
-
const localVarPath = `/account`;
|
183
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
184
|
-
let baseOptions;
|
185
|
-
if (configuration) {
|
186
|
-
baseOptions = configuration.baseOptions;
|
187
|
-
}
|
188
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
189
|
-
const localVarHeaderParameter = {};
|
190
|
-
const localVarQueryParameter = {};
|
191
|
-
if (configuration && configuration.apiKey) {
|
192
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
193
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
194
|
-
}
|
195
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
196
|
-
delete localVarUrlObj.search;
|
197
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
198
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
199
|
-
return {
|
200
|
-
url: globalImportUrl.format(localVarUrlObj),
|
201
|
-
options: localVarRequestOptions
|
202
|
-
};
|
203
|
-
}),
|
204
|
-
archiveError: (id, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
205
|
-
if (id === null || id === void 0) {
|
206
|
-
throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling archiveError.");
|
207
|
-
}
|
208
|
-
const localVarPath = `/errors/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
209
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
210
|
-
let baseOptions;
|
211
|
-
if (configuration) {
|
212
|
-
baseOptions = configuration.baseOptions;
|
213
|
-
}
|
214
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
|
215
|
-
const localVarHeaderParameter = {};
|
216
|
-
const localVarQueryParameter = {};
|
217
|
-
if (configuration && configuration.apiKey) {
|
218
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
219
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
220
|
-
}
|
221
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
222
|
-
delete localVarUrlObj.search;
|
223
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
224
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
225
|
-
return {
|
226
|
-
url: globalImportUrl.format(localVarUrlObj),
|
227
|
-
options: localVarRequestOptions
|
228
|
-
};
|
229
|
-
}),
|
230
|
-
archiveErrors: (archiveErrors, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
231
|
-
if (archiveErrors === null || archiveErrors === void 0) {
|
232
|
-
throw new base_1.RequiredError("archiveErrors", "Required parameter archiveErrors was null or undefined when calling archiveErrors.");
|
233
|
-
}
|
234
|
-
const localVarPath = `/errors`;
|
235
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
236
|
-
let baseOptions;
|
237
|
-
if (configuration) {
|
238
|
-
baseOptions = configuration.baseOptions;
|
239
|
-
}
|
240
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "DELETE" }, baseOptions), options);
|
241
|
-
const localVarHeaderParameter = {};
|
242
|
-
const localVarQueryParameter = {};
|
243
|
-
if (configuration && configuration.apiKey) {
|
244
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
245
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
246
|
-
}
|
247
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
248
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
249
|
-
delete localVarUrlObj.search;
|
250
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
251
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
252
|
-
const needsSerialization = typeof archiveErrors !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
253
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(archiveErrors !== void 0 ? archiveErrors : {}) : archiveErrors || "";
|
254
|
-
return {
|
255
|
-
url: globalImportUrl.format(localVarUrlObj),
|
256
|
-
options: localVarRequestOptions
|
257
|
-
};
|
258
|
-
}),
|
259
|
-
bingIntegrationPost: (bingIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
260
|
-
if (bingIntegration === null || bingIntegration === void 0) {
|
261
|
-
throw new base_1.RequiredError("bingIntegration", "Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");
|
262
|
-
}
|
263
|
-
const localVarPath = `/account/integrations/bing`;
|
264
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
265
|
-
let baseOptions;
|
266
|
-
if (configuration) {
|
267
|
-
baseOptions = configuration.baseOptions;
|
268
|
-
}
|
269
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
270
|
-
const localVarHeaderParameter = {};
|
271
|
-
const localVarQueryParameter = {};
|
272
|
-
if (configuration && configuration.apiKey) {
|
273
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
274
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
275
|
-
}
|
276
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
277
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
278
|
-
delete localVarUrlObj.search;
|
279
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
280
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
281
|
-
const needsSerialization = typeof bingIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
282
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(bingIntegration !== void 0 ? bingIntegration : {}) : bingIntegration || "";
|
283
|
-
return {
|
284
|
-
url: globalImportUrl.format(localVarUrlObj),
|
285
|
-
options: localVarRequestOptions
|
286
|
-
};
|
287
|
-
}),
|
288
|
-
getTrackingAllSites: (minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
289
|
-
if (minDate === null || minDate === void 0) {
|
290
|
-
throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingAllSites.");
|
291
|
-
}
|
292
|
-
if (maxDate === null || maxDate === void 0) {
|
293
|
-
throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingAllSites.");
|
294
|
-
}
|
295
|
-
const localVarPath = `/site/tracking`;
|
296
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
297
|
-
let baseOptions;
|
298
|
-
if (configuration) {
|
299
|
-
baseOptions = configuration.baseOptions;
|
300
|
-
}
|
301
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
302
|
-
const localVarHeaderParameter = {};
|
303
|
-
const localVarQueryParameter = {};
|
304
|
-
if (configuration && configuration.apiKey) {
|
305
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
306
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
307
|
-
}
|
308
|
-
if (minDate !== void 0) {
|
309
|
-
localVarQueryParameter["minDate"] = minDate;
|
310
|
-
}
|
311
|
-
if (maxDate !== void 0) {
|
312
|
-
localVarQueryParameter["maxDate"] = maxDate;
|
313
|
-
}
|
314
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
315
|
-
delete localVarUrlObj.search;
|
316
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
317
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
318
|
-
return {
|
319
|
-
url: globalImportUrl.format(localVarUrlObj),
|
320
|
-
options: localVarRequestOptions
|
321
|
-
};
|
322
|
-
}),
|
323
|
-
getTrackingSite: (id, minDate, maxDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
324
|
-
if (id === null || id === void 0) {
|
325
|
-
throw new base_1.RequiredError("id", "Required parameter id was null or undefined when calling getTrackingSite.");
|
326
|
-
}
|
327
|
-
if (minDate === null || minDate === void 0) {
|
328
|
-
throw new base_1.RequiredError("minDate", "Required parameter minDate was null or undefined when calling getTrackingSite.");
|
329
|
-
}
|
330
|
-
if (maxDate === null || maxDate === void 0) {
|
331
|
-
throw new base_1.RequiredError("maxDate", "Required parameter maxDate was null or undefined when calling getTrackingSite.");
|
332
|
-
}
|
333
|
-
const localVarPath = `/site/tracking/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(id)));
|
334
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
335
|
-
let baseOptions;
|
336
|
-
if (configuration) {
|
337
|
-
baseOptions = configuration.baseOptions;
|
338
|
-
}
|
339
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "GET" }, baseOptions), options);
|
340
|
-
const localVarHeaderParameter = {};
|
341
|
-
const localVarQueryParameter = {};
|
342
|
-
if (configuration && configuration.apiKey) {
|
343
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
344
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
345
|
-
}
|
346
|
-
if (minDate !== void 0) {
|
347
|
-
localVarQueryParameter["minDate"] = minDate;
|
348
|
-
}
|
349
|
-
if (maxDate !== void 0) {
|
350
|
-
localVarQueryParameter["maxDate"] = maxDate;
|
351
|
-
}
|
352
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
353
|
-
delete localVarUrlObj.search;
|
354
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
355
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
356
|
-
return {
|
357
|
-
url: globalImportUrl.format(localVarUrlObj),
|
358
|
-
options: localVarRequestOptions
|
359
|
-
};
|
360
|
-
}),
|
361
|
-
googleIntegrationPost: (googleIntegration, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
362
|
-
if (googleIntegration === null || googleIntegration === void 0) {
|
363
|
-
throw new base_1.RequiredError("googleIntegration", "Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");
|
364
|
-
}
|
365
|
-
const localVarPath = `/account/integrations/google`;
|
366
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
367
|
-
let baseOptions;
|
368
|
-
if (configuration) {
|
369
|
-
baseOptions = configuration.baseOptions;
|
370
|
-
}
|
371
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
372
|
-
const localVarHeaderParameter = {};
|
373
|
-
const localVarQueryParameter = {};
|
374
|
-
if (configuration && configuration.apiKey) {
|
375
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
376
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
377
|
-
}
|
378
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
379
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
380
|
-
delete localVarUrlObj.search;
|
381
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
382
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
383
|
-
const needsSerialization = typeof googleIntegration !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
384
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(googleIntegration !== void 0 ? googleIntegration : {}) : googleIntegration || "";
|
385
|
-
return {
|
386
|
-
url: globalImportUrl.format(localVarUrlObj),
|
387
|
-
options: localVarRequestOptions
|
388
|
-
};
|
389
|
-
}),
|
390
|
-
postErrors: (postError, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
391
|
-
if (postError === null || postError === void 0) {
|
392
|
-
throw new base_1.RequiredError("postError", "Required parameter postError was null or undefined when calling postErrors.");
|
393
|
-
}
|
394
|
-
const localVarPath = `/errors`;
|
395
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
396
|
-
let baseOptions;
|
397
|
-
if (configuration) {
|
398
|
-
baseOptions = configuration.baseOptions;
|
399
|
-
}
|
400
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
401
|
-
const localVarHeaderParameter = {};
|
402
|
-
const localVarQueryParameter = {};
|
403
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
404
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
405
|
-
delete localVarUrlObj.search;
|
406
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
407
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
408
|
-
const needsSerialization = typeof postError !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
409
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postError !== void 0 ? postError : {}) : postError || "";
|
410
|
-
return {
|
411
|
-
url: globalImportUrl.format(localVarUrlObj),
|
412
|
-
options: localVarRequestOptions
|
413
|
-
};
|
414
|
-
}),
|
415
|
-
postPageTrack: (postSiteTrack, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
416
|
-
if (postSiteTrack === null || postSiteTrack === void 0) {
|
417
|
-
throw new base_1.RequiredError("postSiteTrack", "Required parameter postSiteTrack was null or undefined when calling postPageTrack.");
|
418
|
-
}
|
419
|
-
const localVarPath = `/site`;
|
420
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
421
|
-
let baseOptions;
|
422
|
-
if (configuration) {
|
423
|
-
baseOptions = configuration.baseOptions;
|
424
|
-
}
|
425
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
426
|
-
const localVarHeaderParameter = {};
|
427
|
-
const localVarQueryParameter = {};
|
428
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
429
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
430
|
-
delete localVarUrlObj.search;
|
431
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
432
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
433
|
-
const needsSerialization = typeof postSiteTrack !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
434
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postSiteTrack !== void 0 ? postSiteTrack : {}) : postSiteTrack || "";
|
435
|
-
return {
|
436
|
-
url: globalImportUrl.format(localVarUrlObj),
|
437
|
-
options: localVarRequestOptions
|
438
|
-
};
|
439
|
-
}),
|
440
|
-
putFeedback: (feedbackPutData, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
441
|
-
if (feedbackPutData === null || feedbackPutData === void 0) {
|
442
|
-
throw new base_1.RequiredError("feedbackPutData", "Required parameter feedbackPutData was null or undefined when calling putFeedback.");
|
443
|
-
}
|
444
|
-
const localVarPath = `/feedback`;
|
445
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
446
|
-
let baseOptions;
|
447
|
-
if (configuration) {
|
448
|
-
baseOptions = configuration.baseOptions;
|
449
|
-
}
|
450
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "PUT" }, baseOptions), options);
|
451
|
-
const localVarHeaderParameter = {};
|
452
|
-
const localVarQueryParameter = {};
|
453
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
454
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
455
|
-
delete localVarUrlObj.search;
|
456
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
457
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
458
|
-
const needsSerialization = typeof feedbackPutData !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
459
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(feedbackPutData !== void 0 ? feedbackPutData : {}) : feedbackPutData || "";
|
460
|
-
return {
|
461
|
-
url: globalImportUrl.format(localVarUrlObj),
|
462
|
-
options: localVarRequestOptions
|
463
|
-
};
|
464
|
-
}),
|
465
|
-
sitePost: (postAccount, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
466
|
-
if (postAccount === null || postAccount === void 0) {
|
467
|
-
throw new base_1.RequiredError("postAccount", "Required parameter postAccount was null or undefined when calling sitePost.");
|
468
|
-
}
|
469
|
-
const localVarPath = `/account/site`;
|
470
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
471
|
-
let baseOptions;
|
472
|
-
if (configuration) {
|
473
|
-
baseOptions = configuration.baseOptions;
|
474
|
-
}
|
475
|
-
const localVarRequestOptions = Object.assign(Object.assign({ method: "POST" }, baseOptions), options);
|
476
|
-
const localVarHeaderParameter = {};
|
477
|
-
const localVarQueryParameter = {};
|
478
|
-
if (configuration && configuration.apiKey) {
|
479
|
-
const localVarApiKeyValue = typeof configuration.apiKey === "function" ? yield configuration.apiKey("authorization") : yield configuration.apiKey;
|
480
|
-
localVarHeaderParameter["authorization"] = localVarApiKeyValue;
|
481
|
-
}
|
482
|
-
localVarHeaderParameter["Content-Type"] = "application/json";
|
483
|
-
localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
|
484
|
-
delete localVarUrlObj.search;
|
485
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
486
|
-
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
487
|
-
const needsSerialization = typeof postAccount !== "string" || localVarRequestOptions.headers["Content-Type"] === "application/json";
|
488
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(postAccount !== void 0 ? postAccount : {}) : postAccount || "";
|
489
|
-
return {
|
490
|
-
url: globalImportUrl.format(localVarUrlObj),
|
491
|
-
options: localVarRequestOptions
|
492
|
-
};
|
493
|
-
})
|
494
|
-
};
|
495
|
-
};
|
496
|
-
exports.DefaultApiAxiosParamCreator = DefaultApiAxiosParamCreator;
|
497
|
-
var DefaultApiFp = function(configuration) {
|
498
|
-
return {
|
499
|
-
accountGet(options) {
|
500
|
-
return __awaiter(this, void 0, void 0, function* () {
|
501
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).accountGet(options);
|
502
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
503
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
504
|
-
return axios.request(axiosRequestArgs);
|
505
|
-
};
|
506
|
-
});
|
507
|
-
},
|
508
|
-
archiveError(id, options) {
|
509
|
-
return __awaiter(this, void 0, void 0, function* () {
|
510
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveError(id, options);
|
511
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
512
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
513
|
-
return axios.request(axiosRequestArgs);
|
514
|
-
};
|
515
|
-
});
|
516
|
-
},
|
517
|
-
archiveErrors(archiveErrors, options) {
|
518
|
-
return __awaiter(this, void 0, void 0, function* () {
|
519
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).archiveErrors(archiveErrors, options);
|
520
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
521
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
522
|
-
return axios.request(axiosRequestArgs);
|
523
|
-
};
|
524
|
-
});
|
525
|
-
},
|
526
|
-
bingIntegrationPost(bingIntegration, options) {
|
527
|
-
return __awaiter(this, void 0, void 0, function* () {
|
528
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).bingIntegrationPost(bingIntegration, options);
|
529
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
530
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
531
|
-
return axios.request(axiosRequestArgs);
|
532
|
-
};
|
533
|
-
});
|
534
|
-
},
|
535
|
-
getTrackingAllSites(minDate, maxDate, options) {
|
536
|
-
return __awaiter(this, void 0, void 0, function* () {
|
537
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingAllSites(minDate, maxDate, options);
|
538
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
539
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
540
|
-
return axios.request(axiosRequestArgs);
|
541
|
-
};
|
542
|
-
});
|
543
|
-
},
|
544
|
-
getTrackingSite(id, minDate, maxDate, options) {
|
545
|
-
return __awaiter(this, void 0, void 0, function* () {
|
546
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).getTrackingSite(id, minDate, maxDate, options);
|
547
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
548
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
549
|
-
return axios.request(axiosRequestArgs);
|
550
|
-
};
|
551
|
-
});
|
552
|
-
},
|
553
|
-
googleIntegrationPost(googleIntegration, options) {
|
554
|
-
return __awaiter(this, void 0, void 0, function* () {
|
555
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).googleIntegrationPost(googleIntegration, options);
|
556
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
557
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
558
|
-
return axios.request(axiosRequestArgs);
|
559
|
-
};
|
560
|
-
});
|
561
|
-
},
|
562
|
-
postErrors(postError, options) {
|
563
|
-
return __awaiter(this, void 0, void 0, function* () {
|
564
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postErrors(postError, options);
|
565
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
566
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
567
|
-
return axios.request(axiosRequestArgs);
|
568
|
-
};
|
569
|
-
});
|
570
|
-
},
|
571
|
-
postPageTrack(postSiteTrack, options) {
|
572
|
-
return __awaiter(this, void 0, void 0, function* () {
|
573
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).postPageTrack(postSiteTrack, options);
|
574
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
575
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
576
|
-
return axios.request(axiosRequestArgs);
|
577
|
-
};
|
578
|
-
});
|
579
|
-
},
|
580
|
-
putFeedback(feedbackPutData, options) {
|
581
|
-
return __awaiter(this, void 0, void 0, function* () {
|
582
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).putFeedback(feedbackPutData, options);
|
583
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
584
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
585
|
-
return axios.request(axiosRequestArgs);
|
586
|
-
};
|
587
|
-
});
|
588
|
-
},
|
589
|
-
sitePost(postAccount, options) {
|
590
|
-
return __awaiter(this, void 0, void 0, function* () {
|
591
|
-
const localVarAxiosArgs = yield (0, exports.DefaultApiAxiosParamCreator)(configuration).sitePost(postAccount, options);
|
592
|
-
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
|
593
|
-
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
|
594
|
-
return axios.request(axiosRequestArgs);
|
595
|
-
};
|
596
|
-
});
|
597
|
-
}
|
598
|
-
};
|
599
|
-
};
|
600
|
-
exports.DefaultApiFp = DefaultApiFp;
|
601
|
-
var DefaultApiFactory = function(configuration, basePath, axios) {
|
602
|
-
return {
|
603
|
-
accountGet(options) {
|
604
|
-
return (0, exports.DefaultApiFp)(configuration).accountGet(options).then((request) => request(axios, basePath));
|
605
|
-
},
|
606
|
-
archiveError(id, options) {
|
607
|
-
return (0, exports.DefaultApiFp)(configuration).archiveError(id, options).then((request) => request(axios, basePath));
|
608
|
-
},
|
609
|
-
archiveErrors(archiveErrors, options) {
|
610
|
-
return (0, exports.DefaultApiFp)(configuration).archiveErrors(archiveErrors, options).then((request) => request(axios, basePath));
|
611
|
-
},
|
612
|
-
bingIntegrationPost(bingIntegration, options) {
|
613
|
-
return (0, exports.DefaultApiFp)(configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(axios, basePath));
|
614
|
-
},
|
615
|
-
getTrackingAllSites(minDate, maxDate, options) {
|
616
|
-
return (0, exports.DefaultApiFp)(configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(axios, basePath));
|
617
|
-
},
|
618
|
-
getTrackingSite(id, minDate, maxDate, options) {
|
619
|
-
return (0, exports.DefaultApiFp)(configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(axios, basePath));
|
620
|
-
},
|
621
|
-
googleIntegrationPost(googleIntegration, options) {
|
622
|
-
return (0, exports.DefaultApiFp)(configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(axios, basePath));
|
623
|
-
},
|
624
|
-
postErrors(postError, options) {
|
625
|
-
return (0, exports.DefaultApiFp)(configuration).postErrors(postError, options).then((request) => request(axios, basePath));
|
626
|
-
},
|
627
|
-
postPageTrack(postSiteTrack, options) {
|
628
|
-
return (0, exports.DefaultApiFp)(configuration).postPageTrack(postSiteTrack, options).then((request) => request(axios, basePath));
|
629
|
-
},
|
630
|
-
putFeedback(feedbackPutData, options) {
|
631
|
-
return (0, exports.DefaultApiFp)(configuration).putFeedback(feedbackPutData, options).then((request) => request(axios, basePath));
|
632
|
-
},
|
633
|
-
sitePost(postAccount, options) {
|
634
|
-
return (0, exports.DefaultApiFp)(configuration).sitePost(postAccount, options).then((request) => request(axios, basePath));
|
635
|
-
}
|
636
|
-
};
|
637
|
-
};
|
638
|
-
exports.DefaultApiFactory = DefaultApiFactory;
|
639
|
-
var DefaultApi4 = class extends base_1.BaseAPI {
|
640
|
-
accountGet(options) {
|
641
|
-
return (0, exports.DefaultApiFp)(this.configuration).accountGet(options).then((request) => request(this.axios, this.basePath));
|
642
|
-
}
|
643
|
-
archiveError(id, options) {
|
644
|
-
return (0, exports.DefaultApiFp)(this.configuration).archiveError(id, options).then((request) => request(this.axios, this.basePath));
|
645
|
-
}
|
646
|
-
archiveErrors(archiveErrors, options) {
|
647
|
-
return (0, exports.DefaultApiFp)(this.configuration).archiveErrors(archiveErrors, options).then((request) => request(this.axios, this.basePath));
|
648
|
-
}
|
649
|
-
bingIntegrationPost(bingIntegration, options) {
|
650
|
-
return (0, exports.DefaultApiFp)(this.configuration).bingIntegrationPost(bingIntegration, options).then((request) => request(this.axios, this.basePath));
|
651
|
-
}
|
652
|
-
getTrackingAllSites(minDate, maxDate, options) {
|
653
|
-
return (0, exports.DefaultApiFp)(this.configuration).getTrackingAllSites(minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
|
654
|
-
}
|
655
|
-
getTrackingSite(id, minDate, maxDate, options) {
|
656
|
-
return (0, exports.DefaultApiFp)(this.configuration).getTrackingSite(id, minDate, maxDate, options).then((request) => request(this.axios, this.basePath));
|
657
|
-
}
|
658
|
-
googleIntegrationPost(googleIntegration, options) {
|
659
|
-
return (0, exports.DefaultApiFp)(this.configuration).googleIntegrationPost(googleIntegration, options).then((request) => request(this.axios, this.basePath));
|
660
|
-
}
|
661
|
-
postErrors(postError, options) {
|
662
|
-
return (0, exports.DefaultApiFp)(this.configuration).postErrors(postError, options).then((request) => request(this.axios, this.basePath));
|
663
|
-
}
|
664
|
-
postPageTrack(postSiteTrack, options) {
|
665
|
-
return (0, exports.DefaultApiFp)(this.configuration).postPageTrack(postSiteTrack, options).then((request) => request(this.axios, this.basePath));
|
666
|
-
}
|
667
|
-
putFeedback(feedbackPutData, options) {
|
668
|
-
return (0, exports.DefaultApiFp)(this.configuration).putFeedback(feedbackPutData, options).then((request) => request(this.axios, this.basePath));
|
669
|
-
}
|
670
|
-
sitePost(postAccount, options) {
|
671
|
-
return (0, exports.DefaultApiFp)(this.configuration).sitePost(postAccount, options).then((request) => request(this.axios, this.basePath));
|
672
|
-
}
|
673
|
-
};
|
674
|
-
exports.DefaultApi = DefaultApi4;
|
675
|
-
}
|
676
|
-
});
|
677
|
-
|
678
|
-
// ../common/dist/helpers/logsend.js
|
679
|
-
var require_logsend = __commonJS({
|
680
|
-
"../common/dist/helpers/logsend.js"(exports) {
|
681
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
682
|
-
exports.getErrorKey = exports.isValidLogMessage = void 0;
|
683
|
-
var hashCode_1 = require("ag-common/dist/common/helpers/hashCode");
|
684
|
-
var log_1 = require("ag-common/dist/common/helpers/log");
|
685
|
-
function isValidLogMessage2(m) {
|
686
|
-
if (!m) {
|
687
|
-
(0, log_1.info)("no message?");
|
688
|
-
return false;
|
689
|
-
}
|
690
|
-
if (m.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)) {
|
691
|
-
(0, log_1.info)("ignoring react devtools message");
|
692
|
-
return false;
|
693
|
-
}
|
694
|
-
if (m === JSON.stringify([{}])) {
|
695
|
-
(0, log_1.info)("empty message payload?");
|
696
|
-
return false;
|
697
|
-
}
|
698
|
-
return true;
|
699
|
-
}
|
700
|
-
exports.isValidLogMessage = isValidLogMessage2;
|
701
|
-
var getErrorKey2 = (message = "") => {
|
702
|
-
var _a2, _b, _c;
|
703
|
-
let messageHash = "";
|
704
|
-
try {
|
705
|
-
const ob = JSON.parse(message);
|
706
|
-
const toClean = Array.isArray(ob) && ((_a2 = ob[0]) === null || _a2 === void 0 ? void 0 : _a2.match(/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/));
|
707
|
-
if (toClean) {
|
708
|
-
(0, log_1.info)("removing date from hash");
|
709
|
-
ob[0] = "(date)";
|
710
|
-
messageHash = (0, hashCode_1.hashCode)(JSON.stringify(ob));
|
711
|
-
} else {
|
712
|
-
messageHash = ob.message || ob.name || ob.description || void 0;
|
713
|
-
}
|
714
|
-
} catch (e) {
|
715
|
-
}
|
716
|
-
if (!messageHash) {
|
717
|
-
messageHash = (_c = (_b = (0, hashCode_1.hashCode)(message)) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
|
718
|
-
}
|
719
|
-
return messageHash;
|
720
|
-
};
|
721
|
-
exports.getErrorKey = getErrorKey2;
|
722
|
-
}
|
723
|
-
});
|
724
|
-
|
725
|
-
// ../common-ui/dist/components/ErrorBoundary/index.js
|
726
|
-
var require_ErrorBoundary = __commonJS({
|
727
|
-
"../common-ui/dist/components/ErrorBoundary/index.js"(exports) {
|
728
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
729
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
730
|
-
};
|
731
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
732
|
-
exports.ErrorBoundary = void 0;
|
733
|
-
var Modal_1 = require("ag-common/dist/ui/components/Modal");
|
734
|
-
var react_1 = __importDefault(require("react"));
|
735
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
736
|
-
var Base = styled_components_1.default.div`
|
1
|
+
var xt=Object.create;var H=Object.defineProperty,Et=Object.defineProperties,_t=Object.getOwnPropertyDescriptor,St=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertyNames,_e=Object.getOwnPropertySymbols,Rt=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var Se=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))qe.call(t,r)&&Se(e,r,t[r]);if(_e)for(var r of _e(t))Dt.call(t,r)&&Se(e,r,t[r]);return e},m=(e,t)=>Et(e,St(t));var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vt=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},Re=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qt(t))!qe.call(e,o)&&o!==r&&H(e,o,{get:()=>t[o],enumerable:!(n=_t(t,o))||n.enumerable});return e};var k=(e,t,r)=>(r=e!=null?xt(Rt(e)):{},Re(t||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e)),It=e=>Re(H({},"__esModule",{value:!0}),e);var y=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{s(r.next(l))}catch(c){o(c)}},a=l=>{try{s(r.throw(l))}catch(c){o(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,a);s((r=r.apply(e,t)).next())});var Ve=z(j=>{var Ft=j&&j.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0});j.RequiredError=j.BaseAPI=j.COLLECTION_FORMATS=j.BASE_PATH=void 0;var Ut=Ft(require("axios"));j.BASE_PATH="https://api.analytica.click".replace(/\/+$/,"");j.COLLECTION_FORMATS={csv:",",ssv:" ",tsv:" ",pipes:"|"};var he=class{constructor(t,r=j.BASE_PATH,n=Ut.default){this.basePath=r,this.axios=n,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}};j.BaseAPI=he;var me=class extends Error{constructor(t,r){super(r),this.field=t,this.name="RequiredError"}};j.RequiredError=me});var X=z(d=>{var Bt=d&&d.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Kt=d&&d.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Jt=d&&d.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Bt(t,e,r);return Kt(t,e),t},O=d&&d.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(p){try{c(n.next(p))}catch(f){a(f)}}function l(p){try{c(n.throw(p))}catch(f){a(f)}}function c(p){p.done?i(p.value):o(p.value).then(s,l)}c((n=n.apply(e,t||[])).next())})},Nt=d&&d.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0});d.DefaultApi=d.DefaultApiFactory=d.DefaultApiFp=d.DefaultApiAxiosParamCreator=d.Sentiment=void 0;var A=Jt(require("url")),T=Nt(require("axios")),b=Ve(),Lt;(function(e){e.Good="good",e.Bad="bad",e.Neutral="neutral"})(Lt=d.Sentiment||(d.Sentiment={}));var Ht=function(e){return{accountGet:(t={})=>O(this,void 0,void 0,function*(){let r="/account",n=A.parse(r,!0),o;e&&(o=e.baseOptions);let i=Object.assign(Object.assign({method:"GET"},o),t),a={},s={};if(e&&e.apiKey){let c=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;a.authorization=c}n.query=Object.assign(Object.assign(Object.assign({},n.query),s),t.query),delete n.search;let l=o&&o.headers?o.headers:{};return i.headers=Object.assign(Object.assign(Object.assign({},a),l),t.headers),{url:A.format(n),options:i}}),archiveError:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("id","Required parameter id was null or undefined when calling archiveError.");let n="/errors/{id}".replace("{id}",encodeURIComponent(String(t))),o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"DELETE"},i),r),s={},l={};if(e&&e.apiKey){let p=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=p}o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};return a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers),{url:A.format(o),options:a}}),archiveErrors:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("archiveErrors","Required parameter archiveErrors was null or undefined when calling archiveErrors.");let n="/errors",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"DELETE"},i),r),s={},l={};if(e&&e.apiKey){let f=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=f}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),bingIntegrationPost:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("bingIntegration","Required parameter bingIntegration was null or undefined when calling bingIntegrationPost.");let n="/account/integrations/bing",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},l={};if(e&&e.apiKey){let f=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=f}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),getTrackingAllSites:(t,r,n={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingAllSites.");if(r==null)throw new b.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingAllSites.");let o="/site/tracking",i=A.parse(o,!0),a;e&&(a=e.baseOptions);let s=Object.assign(Object.assign({method:"GET"},a),n),l={},c={};if(e&&e.apiKey){let f=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;l.authorization=f}t!==void 0&&(c.minDate=t),r!==void 0&&(c.maxDate=r),i.query=Object.assign(Object.assign(Object.assign({},i.query),c),n.query),delete i.search;let p=a&&a.headers?a.headers:{};return s.headers=Object.assign(Object.assign(Object.assign({},l),p),n.headers),{url:A.format(i),options:s}}),getTrackingSite:(t,r,n,o={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("id","Required parameter id was null or undefined when calling getTrackingSite.");if(r==null)throw new b.RequiredError("minDate","Required parameter minDate was null or undefined when calling getTrackingSite.");if(n==null)throw new b.RequiredError("maxDate","Required parameter maxDate was null or undefined when calling getTrackingSite.");let i="/site/tracking/{id}".replace("{id}",encodeURIComponent(String(t))),a=A.parse(i,!0),s;e&&(s=e.baseOptions);let l=Object.assign(Object.assign({method:"GET"},s),o),c={},p={};if(e&&e.apiKey){let E=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;c.authorization=E}r!==void 0&&(p.minDate=r),n!==void 0&&(p.maxDate=n),a.query=Object.assign(Object.assign(Object.assign({},a.query),p),o.query),delete a.search;let f=s&&s.headers?s.headers:{};return l.headers=Object.assign(Object.assign(Object.assign({},c),f),o.headers),{url:A.format(a),options:l}}),googleIntegrationPost:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("googleIntegration","Required parameter googleIntegration was null or undefined when calling googleIntegrationPost.");let n="/account/integrations/google",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},l={};if(e&&e.apiKey){let f=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=f}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),postErrors:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("postError","Required parameter postError was null or undefined when calling postErrors.");let n="/errors",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},l={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),postPageTrack:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("postSiteTrack","Required parameter postSiteTrack was null or undefined when calling postPageTrack.");let n="/site",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},l={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),putFeedback:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("feedbackPutData","Required parameter feedbackPutData was null or undefined when calling putFeedback.");let n="/feedback",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"PUT"},i),r),s={},l={};s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}}),sitePost:(t,r={})=>O(this,void 0,void 0,function*(){if(t==null)throw new b.RequiredError("postAccount","Required parameter postAccount was null or undefined when calling sitePost.");let n="/account/site",o=A.parse(n,!0),i;e&&(i=e.baseOptions);let a=Object.assign(Object.assign({method:"POST"},i),r),s={},l={};if(e&&e.apiKey){let f=typeof e.apiKey=="function"?yield e.apiKey("authorization"):yield e.apiKey;s.authorization=f}s["Content-Type"]="application/json",o.query=Object.assign(Object.assign(Object.assign({},o.query),l),r.query),delete o.search;let c=i&&i.headers?i.headers:{};a.headers=Object.assign(Object.assign(Object.assign({},s),c),r.headers);let p=typeof t!="string"||a.headers["Content-Type"]==="application/json";return a.data=p?JSON.stringify(t!==void 0?t:{}):t||"",{url:A.format(o),options:a}})}};d.DefaultApiAxiosParamCreator=Ht;var zt=function(e){return{accountGet(t){return O(this,void 0,void 0,function*(){let r=yield(0,d.DefaultApiAxiosParamCreator)(e).accountGet(t);return(n=T.default,o=b.BASE_PATH)=>{let i=Object.assign(Object.assign({},r.options),{url:o+r.url});return n.request(i)}})},archiveError(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).archiveError(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},archiveErrors(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).archiveErrors(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},bingIntegrationPost(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).bingIntegrationPost(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},getTrackingAllSites(t,r,n){return O(this,void 0,void 0,function*(){let o=yield(0,d.DefaultApiAxiosParamCreator)(e).getTrackingAllSites(t,r,n);return(i=T.default,a=b.BASE_PATH)=>{let s=Object.assign(Object.assign({},o.options),{url:a+o.url});return i.request(s)}})},getTrackingSite(t,r,n,o){return O(this,void 0,void 0,function*(){let i=yield(0,d.DefaultApiAxiosParamCreator)(e).getTrackingSite(t,r,n,o);return(a=T.default,s=b.BASE_PATH)=>{let l=Object.assign(Object.assign({},i.options),{url:s+i.url});return a.request(l)}})},googleIntegrationPost(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).googleIntegrationPost(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},postErrors(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).postErrors(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},postPageTrack(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).postPageTrack(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},putFeedback(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).putFeedback(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})},sitePost(t,r){return O(this,void 0,void 0,function*(){let n=yield(0,d.DefaultApiAxiosParamCreator)(e).sitePost(t,r);return(o=T.default,i=b.BASE_PATH)=>{let a=Object.assign(Object.assign({},n.options),{url:i+n.url});return o.request(a)}})}}};d.DefaultApiFp=zt;var Mt=function(e,t,r){return{accountGet(n){return(0,d.DefaultApiFp)(e).accountGet(n).then(o=>o(r,t))},archiveError(n,o){return(0,d.DefaultApiFp)(e).archiveError(n,o).then(i=>i(r,t))},archiveErrors(n,o){return(0,d.DefaultApiFp)(e).archiveErrors(n,o).then(i=>i(r,t))},bingIntegrationPost(n,o){return(0,d.DefaultApiFp)(e).bingIntegrationPost(n,o).then(i=>i(r,t))},getTrackingAllSites(n,o,i){return(0,d.DefaultApiFp)(e).getTrackingAllSites(n,o,i).then(a=>a(r,t))},getTrackingSite(n,o,i,a){return(0,d.DefaultApiFp)(e).getTrackingSite(n,o,i,a).then(s=>s(r,t))},googleIntegrationPost(n,o){return(0,d.DefaultApiFp)(e).googleIntegrationPost(n,o).then(i=>i(r,t))},postErrors(n,o){return(0,d.DefaultApiFp)(e).postErrors(n,o).then(i=>i(r,t))},postPageTrack(n,o){return(0,d.DefaultApiFp)(e).postPageTrack(n,o).then(i=>i(r,t))},putFeedback(n,o){return(0,d.DefaultApiFp)(e).putFeedback(n,o).then(i=>i(r,t))},sitePost(n,o){return(0,d.DefaultApiFp)(e).sitePost(n,o).then(i=>i(r,t))}}};d.DefaultApiFactory=Mt;var ye=class extends b.BaseAPI{accountGet(t){return(0,d.DefaultApiFp)(this.configuration).accountGet(t).then(r=>r(this.axios,this.basePath))}archiveError(t,r){return(0,d.DefaultApiFp)(this.configuration).archiveError(t,r).then(n=>n(this.axios,this.basePath))}archiveErrors(t,r){return(0,d.DefaultApiFp)(this.configuration).archiveErrors(t,r).then(n=>n(this.axios,this.basePath))}bingIntegrationPost(t,r){return(0,d.DefaultApiFp)(this.configuration).bingIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}getTrackingAllSites(t,r,n){return(0,d.DefaultApiFp)(this.configuration).getTrackingAllSites(t,r,n).then(o=>o(this.axios,this.basePath))}getTrackingSite(t,r,n,o){return(0,d.DefaultApiFp)(this.configuration).getTrackingSite(t,r,n,o).then(i=>i(this.axios,this.basePath))}googleIntegrationPost(t,r){return(0,d.DefaultApiFp)(this.configuration).googleIntegrationPost(t,r).then(n=>n(this.axios,this.basePath))}postErrors(t,r){return(0,d.DefaultApiFp)(this.configuration).postErrors(t,r).then(n=>n(this.axios,this.basePath))}postPageTrack(t,r){return(0,d.DefaultApiFp)(this.configuration).postPageTrack(t,r).then(n=>n(this.axios,this.basePath))}putFeedback(t,r){return(0,d.DefaultApiFp)(this.configuration).putFeedback(t,r).then(n=>n(this.axios,this.basePath))}sitePost(t,r){return(0,d.DefaultApiFp)(this.configuration).sitePost(t,r).then(n=>n(this.axios,this.basePath))}};d.DefaultApi=ye});var Fe=z(U=>{Object.defineProperty(U,"__esModule",{value:!0});U.getErrorKey=U.isValidLogMessage=void 0;var Ie=require("ag-common/dist/common/helpers/hashCode"),Z=require("ag-common/dist/common/helpers/log");function $t(e){return e?e.match(/^"?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}"?$/)?((0,Z.info)("ignoring react devtools message"),!1):e===JSON.stringify([{}])?((0,Z.info)("empty message payload?"),!1):!0:((0,Z.info)("no message?"),!1)}U.isValidLogMessage=$t;var Gt=(e="")=>{var t,r,n;let o="";try{let i=JSON.parse(e);Array.isArray(i)&&((t=i[0])===null||t===void 0?void 0:t.match(/^\[?[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\]?$/))?((0,Z.info)("removing date from hash"),i[0]="(date)",o=(0,Ie.hashCode)(JSON.stringify(i))):o=i.message||i.name||i.description||void 0}catch{}return o||(o=(n=(r=(0,Ie.hashCode)(e))===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""),o};U.getErrorKey=Gt});var Ze=z(K=>{var Xe=K&&K.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(K,"__esModule",{value:!0});K.ErrorBoundary=void 0;var ir=require("ag-common/dist/ui/components/Modal"),oe=Xe(require("react")),or=Xe(require("styled-components")),ar=or.default.div`
|
737
2
|
font-size: 2rem;
|
738
|
-
`;
|
739
|
-
|
740
|
-
constructor(props) {
|
741
|
-
super(props);
|
742
|
-
this.state = { hasError: void 0 };
|
743
|
-
}
|
744
|
-
static getDerivedStateFromError(errorV) {
|
745
|
-
var _a2;
|
746
|
-
const href = typeof window !== "undefined" && ((_a2 = window === null || window === void 0 ? void 0 : window.location) === null || _a2 === void 0 ? void 0 : _a2.href);
|
747
|
-
return {
|
748
|
-
hasError: Object.assign(Object.assign(Object.assign(Object.assign({}, errorV), { message: (errorV === null || errorV === void 0 ? void 0 : errorV.message) || errorV }), (errorV === null || errorV === void 0 ? void 0 : errorV.stack) && { stack: errorV === null || errorV === void 0 ? void 0 : errorV.stack }), href && { href })
|
749
|
-
};
|
750
|
-
}
|
751
|
-
render() {
|
752
|
-
const { hasError } = this.state;
|
753
|
-
const { children, notify } = this.props;
|
754
|
-
if (hasError) {
|
755
|
-
if (notify) {
|
756
|
-
notify(hasError);
|
757
|
-
}
|
758
|
-
return react_1.default.createElement(
|
759
|
-
Modal_1.Modal,
|
760
|
-
{ open: true, setOpen: () => {
|
761
|
-
} },
|
762
|
-
react_1.default.createElement(
|
763
|
-
Base,
|
764
|
-
null,
|
765
|
-
"A fatal error has occurred - the admin has been notified.",
|
766
|
-
react_1.default.createElement("button", { type: "button", onClick: () => window.location.reload() }, "Press here to restart app")
|
767
|
-
)
|
768
|
-
);
|
769
|
-
}
|
770
|
-
return children;
|
771
|
-
}
|
772
|
-
};
|
773
|
-
exports.ErrorBoundary = ErrorBoundary2;
|
774
|
-
}
|
775
|
-
});
|
776
|
-
|
777
|
-
// ../common-ui/dist/helpers/dom.js
|
778
|
-
var require_dom = __commonJS({
|
779
|
-
"../common-ui/dist/helpers/dom.js"(exports) {
|
780
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
781
|
-
exports.stringify = exports.extractQs = exports.getClientY = exports.getChildrenPositions = exports.getChildrenArray = void 0;
|
782
|
-
var log_1 = require("ag-common/dist/common/helpers/log");
|
783
|
-
var querystring_1 = require("querystring");
|
784
|
-
var getChildrenArray = (ref) => {
|
785
|
-
var _a2;
|
786
|
-
const children = ((_a2 = ref.current) === null || _a2 === void 0 ? void 0 : _a2.children) || [];
|
787
|
-
const ret = [];
|
788
|
-
for (let i = 0; i < children.length; i += 1) {
|
789
|
-
ret.push(children[i]);
|
790
|
-
}
|
791
|
-
return ret;
|
792
|
-
};
|
793
|
-
exports.getChildrenArray = getChildrenArray;
|
794
|
-
var getChildrenPositions = (ref) => (0, exports.getChildrenArray)(ref).map((c) => c.getBoundingClientRect().top + c.getBoundingClientRect().height);
|
795
|
-
exports.getChildrenPositions = getChildrenPositions;
|
796
|
-
var getClientY = (e) => {
|
797
|
-
var _a2, _b, _c, _d;
|
798
|
-
if (!e) {
|
799
|
-
return void 0;
|
800
|
-
}
|
801
|
-
let ret;
|
802
|
-
if ((e === null || e === void 0 ? void 0 : e.changedTouches) || (e === null || e === void 0 ? void 0 : e.touches)) {
|
803
|
-
const et = e;
|
804
|
-
ret = ((_b = (_a2 = et.changedTouches) === null || _a2 === void 0 ? void 0 : _a2[0]) === null || _b === void 0 ? void 0 : _b.clientY) || ((_d = (_c = et.touches) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.clientY);
|
805
|
-
} else if (e === null || e === void 0 ? void 0 : e.clientY) {
|
806
|
-
const me = e;
|
807
|
-
ret = me.clientY;
|
808
|
-
}
|
809
|
-
return ret;
|
810
|
-
};
|
811
|
-
exports.getClientY = getClientY;
|
812
|
-
var sanatiseString = (str) => str.replace(/[^a-zA-Z0-9\-_]/gim, "");
|
813
|
-
function extractQs2({ search, sanatise }) {
|
814
|
-
if (!search) {
|
815
|
-
return {};
|
816
|
-
}
|
817
|
-
const qs = (0, querystring_1.parse)(search.replace(/^[?]/, ""));
|
818
|
-
const ret = {};
|
819
|
-
Object.keys(qs).forEach((qk1) => {
|
820
|
-
const qk = !sanatise ? qk1 : sanatiseString(qk1);
|
821
|
-
if (qk1 !== qk) {
|
822
|
-
(0, log_1.debug)("sanatising qs input key for ", qk);
|
823
|
-
}
|
824
|
-
if (Array.isArray(qs[qk])) {
|
825
|
-
ret[qk] = qs[qk].join("");
|
826
|
-
} else {
|
827
|
-
ret[qk] = qs[qk];
|
828
|
-
}
|
829
|
-
const newV = !sanatise ? ret[qk] : sanatiseString(ret[qk]);
|
830
|
-
if (newV !== ret[qk]) {
|
831
|
-
(0, log_1.debug)("sanatising qs input for ", qk);
|
832
|
-
ret[qk] = newV;
|
833
|
-
}
|
834
|
-
});
|
835
|
-
return ret;
|
836
|
-
}
|
837
|
-
exports.extractQs = extractQs2;
|
838
|
-
var stringify3 = (p) => {
|
839
|
-
const params = new URLSearchParams();
|
840
|
-
Object.entries(p).forEach(([a, b]) => params.append(a, b));
|
841
|
-
return params;
|
842
|
-
};
|
843
|
-
exports.stringify = stringify3;
|
844
|
-
}
|
845
|
-
});
|
846
|
-
|
847
|
-
// src/index.tsx
|
848
|
-
var src_exports = {};
|
849
|
-
__export(src_exports, {
|
850
|
-
AnalyticaConfigContext: () => AnalyticaConfigContext,
|
851
|
-
AnalyticaConfigProvider: () => AnalyticaConfigProvider,
|
852
|
-
CognitoAuthContext: () => CognitoAuthContext,
|
853
|
-
CognitoAuthProvider: () => CognitoAuthProvider,
|
854
|
-
DashboardAuthValidation: () => DashboardAuthValidation,
|
855
|
-
ErrorBoundary: () => ErrorBoundary,
|
856
|
-
ExternalComponent: () => ExternalComponent,
|
857
|
-
Feedback: () => Feedback,
|
858
|
-
decodeIdToken: () => decodeIdToken,
|
859
|
-
errorTrack: () => errorTrack,
|
860
|
-
feedback: () => feedback,
|
861
|
-
getUserFromIdToken: () => getUserFromIdToken,
|
862
|
-
page: () => page,
|
863
|
-
tokenMissing: () => tokenMissing,
|
864
|
-
track: () => track,
|
865
|
-
useFeedback: () => useFeedback,
|
866
|
-
useTrack: () => useTrack
|
867
|
-
});
|
868
|
-
module.exports = __toCommonJS(src_exports);
|
869
|
-
|
870
|
-
// src/helpers/object.ts
|
871
|
-
var takeObject = (ob, num) => {
|
872
|
-
const part = [];
|
873
|
-
const rest = {};
|
874
|
-
let c = 0;
|
875
|
-
Object.entries(ob).forEach(([index, item]) => {
|
876
|
-
if (c < num) {
|
877
|
-
part.push(item);
|
878
|
-
} else {
|
879
|
-
rest[index] = item;
|
880
|
-
}
|
881
|
-
c += 1;
|
882
|
-
});
|
883
|
-
return { part, rest };
|
884
|
-
};
|
885
|
-
|
886
|
-
// src/helpers/errorTrack.tsx
|
887
|
-
var import_log = require("ag-common/dist/common/helpers/log");
|
888
|
-
var import_callOpenApi = require("ag-common/dist/ui/helpers/callOpenApi");
|
889
|
-
var import_api = __toESM(require_api());
|
890
|
-
var import_logsend = __toESM(require_logsend());
|
891
|
-
function callOpenApi(p) {
|
892
|
-
return (0, import_callOpenApi.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
893
|
-
func: (d) => p.func(d),
|
894
|
-
newDefaultApi: (opts) => new import_api.DefaultApi(opts),
|
895
|
-
logout: () => window.location.reload(),
|
896
|
-
refreshToken: () => __async(this, null, function* () {
|
897
|
-
return void 0;
|
898
|
-
})
|
899
|
-
}));
|
900
|
-
}
|
901
|
-
var _a;
|
902
|
-
var isLocal = typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost";
|
903
|
-
var errorBuffer = {};
|
904
|
-
var errorTimer;
|
905
|
-
var overrideBaseUrlSet;
|
906
|
-
var errorPush = () => __async(void 0, null, function* () {
|
907
|
-
var _a2, _b;
|
908
|
-
try {
|
909
|
-
if (Object.keys(errorBuffer).length > 100) {
|
910
|
-
const firstKey = Object.keys(errorBuffer)[0];
|
911
|
-
const first = errorBuffer[firstKey];
|
912
|
-
const x1 = yield callOpenApi({
|
913
|
-
apiUrl: overrideBaseUrlSet,
|
914
|
-
func: (s) => {
|
915
|
-
var _a3;
|
916
|
-
return s.postErrors([
|
917
|
-
{
|
918
|
-
key: first.key,
|
919
|
-
data: __spreadProps(__spreadValues({}, first.data), {
|
920
|
-
message: `error overload!: ${(_a3 = first.data.message) != null ? _a3 : "?"}`
|
921
|
-
})
|
922
|
-
}
|
923
|
-
]);
|
924
|
-
}
|
925
|
-
});
|
926
|
-
errorBuffer = {};
|
927
|
-
if (x1.error) {
|
928
|
-
throw x1.error;
|
929
|
-
}
|
930
|
-
return {};
|
931
|
-
}
|
932
|
-
const { part, rest } = takeObject(errorBuffer, 10);
|
933
|
-
errorBuffer = rest;
|
934
|
-
const x = yield callOpenApi({
|
935
|
-
apiUrl: overrideBaseUrlSet,
|
936
|
-
func: (s) => s.postErrors(part)
|
937
|
-
});
|
938
|
-
if (x.error) {
|
939
|
-
throw x.error;
|
940
|
-
}
|
941
|
-
} catch (e) {
|
942
|
-
return { error: (_b = (_a2 = e == null ? void 0 : e.error) == null ? void 0 : _a2.message) != null ? _b : e.message };
|
943
|
-
} finally {
|
944
|
-
if (errorBuffer.length) {
|
945
|
-
errorTimer = setTimeout(errorPush, 1e3);
|
946
|
-
} else {
|
947
|
-
errorTimer = void 0;
|
948
|
-
}
|
949
|
-
}
|
950
|
-
});
|
951
|
-
var errorTrack = (_0) => __async(void 0, [_0], function* ({
|
952
|
-
data,
|
953
|
-
overrideBaseUrl = "https://api.analytica.click"
|
954
|
-
}) {
|
955
|
-
var _a2;
|
956
|
-
if (isLocal) {
|
957
|
-
(0, import_log.debug)(
|
958
|
-
`local error tracking ignored:${data.data.message} ${JSON.stringify(
|
959
|
-
data
|
960
|
-
)}, to ${overrideBaseUrl}`
|
961
|
-
);
|
962
|
-
return {};
|
963
|
-
}
|
964
|
-
if (!(0, import_logsend.isValidLogMessage)((_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.message)) {
|
965
|
-
return {};
|
966
|
-
}
|
967
|
-
(0, import_log.debug)("error track", data.data.message, JSON.stringify(data));
|
968
|
-
const key = (0, import_logsend.getErrorKey)(data.data.message);
|
969
|
-
errorBuffer[key] = data;
|
970
|
-
overrideBaseUrlSet = overrideBaseUrl;
|
971
|
-
if (!errorTimer) {
|
972
|
-
errorTimer = setTimeout(errorPush, 500);
|
973
|
-
}
|
974
|
-
return {};
|
975
|
-
});
|
976
|
-
|
977
|
-
// src/components/AnalyticaConfig/index.tsx
|
978
|
-
var import_react = __toESM(require("react"));
|
979
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
980
|
-
var stubState = {
|
981
|
-
analyticaToken: void 0,
|
982
|
-
overrideBaseUrl: void 0
|
983
|
-
};
|
984
|
-
var AnalyticaConfigContext = import_react.default.createContext(stubState);
|
985
|
-
function overloadConsole(values) {
|
986
|
-
if (!values.analyticaToken) {
|
987
|
-
return;
|
988
|
-
}
|
989
|
-
const tempError = window.console.error;
|
990
|
-
window.console.error = (...obj) => errorTrack({
|
991
|
-
data: {
|
992
|
-
data: { href: window.location.href, message: JSON.stringify(obj) },
|
993
|
-
key: values.analyticaToken
|
994
|
-
},
|
995
|
-
overrideBaseUrl: values.overrideBaseUrl
|
996
|
-
}).finally(() => tempError(...obj));
|
997
|
-
const tempWarn = window.console.warn;
|
998
|
-
window.console.warn = (...obj) => errorTrack({
|
999
|
-
data: {
|
1000
|
-
data: { href: window.location.href, message: JSON.stringify(obj) },
|
1001
|
-
key: values.analyticaToken
|
1002
|
-
},
|
1003
|
-
overrideBaseUrl: values.overrideBaseUrl
|
1004
|
-
}).finally(() => tempWarn(...obj));
|
1005
|
-
}
|
1006
|
-
var AnalyticaConfigProvider = ({
|
1007
|
-
children,
|
1008
|
-
values
|
1009
|
-
}) => {
|
1010
|
-
const [state, setState] = (0, import_react.useState)(values);
|
1011
|
-
(0, import_react.useEffect)(() => {
|
1012
|
-
if (JSON.stringify(values) !== JSON.stringify(state)) {
|
1013
|
-
setState(values);
|
1014
|
-
}
|
1015
|
-
}, [state, values]);
|
1016
|
-
(0, import_react.useEffect)(() => {
|
1017
|
-
overloadConsole(values);
|
1018
|
-
}, []);
|
1019
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnalyticaConfigContext.Provider, {
|
1020
|
-
value: state,
|
1021
|
-
children
|
1022
|
-
});
|
1023
|
-
};
|
1024
|
-
|
1025
|
-
// src/helpers/log.ts
|
1026
|
-
var tokenMissing = (comp) => `[Analytica.${comp}] Please load analytica token in AnalyticaConfigProvider to use this component`;
|
1027
|
-
|
1028
|
-
// src/helpers/feedback.tsx
|
1029
|
-
var import_log3 = require("ag-common/dist/common/helpers/log");
|
1030
|
-
var import_react2 = require("react");
|
1031
|
-
var import_callOpenApi2 = require("ag-common/dist/ui/helpers/callOpenApi");
|
1032
|
-
var import_api2 = __toESM(require_api());
|
1033
|
-
function callOpenApi2(p) {
|
1034
|
-
return (0, import_callOpenApi2.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
1035
|
-
func: (d) => p.func(d),
|
1036
|
-
newDefaultApi: (opts) => new import_api2.DefaultApi(opts),
|
1037
|
-
logout: () => window.location.reload(),
|
1038
|
-
refreshToken: () => __async(this, null, function* () {
|
1039
|
-
return void 0;
|
1040
|
-
})
|
1041
|
-
}));
|
1042
|
-
}
|
1043
|
-
var feedback = (_0) => __async(void 0, [_0], function* ({
|
1044
|
-
data,
|
1045
|
-
analyticaToken,
|
1046
|
-
overrideBaseUrl = "https://api.analytica.click"
|
1047
|
-
}) {
|
1048
|
-
var _a2;
|
1049
|
-
if (typeof window !== "undefined" && ((_a2 = window == null ? void 0 : window.location) == null ? void 0 : _a2.hostname) === "localhost") {
|
1050
|
-
(0, import_log3.debug)(
|
1051
|
-
`local feedback ignored:${JSON.stringify(data)}, to ${overrideBaseUrl}`
|
1052
|
-
);
|
1053
|
-
return {};
|
1054
|
-
}
|
1055
|
-
(0, import_log3.debug)("feedback", JSON.stringify(data));
|
1056
|
-
const x = yield callOpenApi2({
|
1057
|
-
apiUrl: overrideBaseUrl,
|
1058
|
-
func: (s) => s.putFeedback({ key: analyticaToken, data })
|
1059
|
-
});
|
1060
|
-
if (x.error) {
|
1061
|
-
return { error: x.error.message };
|
1062
|
-
}
|
1063
|
-
return {};
|
1064
|
-
});
|
1065
|
-
var useFeedback = () => {
|
1066
|
-
const { analyticaToken, overrideBaseUrl } = (0, import_react2.useContext)(
|
1067
|
-
AnalyticaConfigContext
|
1068
|
-
);
|
1069
|
-
if (!analyticaToken) {
|
1070
|
-
(0, import_log3.warn)(tokenMissing("useFeedback"));
|
1071
|
-
return { trackWithToken: () => ({ error: "no token" }) };
|
1072
|
-
}
|
1073
|
-
return {
|
1074
|
-
trackWithToken: (d) => feedback(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
|
1075
|
-
};
|
1076
|
-
};
|
1077
|
-
|
1078
|
-
// src/components/UserProvider/picture.ts
|
1079
|
-
var parsePicture = (raw) => {
|
1080
|
-
var _a2, _b;
|
1081
|
-
try {
|
1082
|
-
return (_b = (_a2 = JSON.parse(raw)) == null ? void 0 : _a2.data) == null ? void 0 : _b.url;
|
1083
|
-
} catch (e) {
|
1084
|
-
return raw;
|
1085
|
-
}
|
1086
|
-
};
|
1087
|
-
|
1088
|
-
// src/helpers/jwt.ts
|
1089
|
-
var import_jsonwebtoken = require("jsonwebtoken");
|
1090
|
-
var decodeIdToken = (s) => (0, import_jsonwebtoken.decode)(s);
|
1091
|
-
var getUserFromIdToken = (idToken) => {
|
1092
|
-
var _a2;
|
1093
|
-
const idJwt = decodeIdToken(idToken);
|
1094
|
-
if (!idJwt) {
|
1095
|
-
throw new Error("bad token");
|
1096
|
-
}
|
1097
|
-
const defUser = {
|
1098
|
-
userId: idJwt.email,
|
1099
|
-
fullname: idJwt.name,
|
1100
|
-
nickname: idJwt.nickname,
|
1101
|
-
picture: parsePicture(idJwt.picture),
|
1102
|
-
updatedAt: new Date().getTime(),
|
1103
|
-
idJwt,
|
1104
|
-
isAdmin: (_a2 = idJwt == null ? void 0 : idJwt["cognito:groups"]) == null ? void 0 : _a2.includes("Admin")
|
1105
|
-
};
|
1106
|
-
return defUser;
|
1107
|
-
};
|
1108
|
-
|
1109
|
-
// src/helpers/track.ts
|
1110
|
-
var import_log5 = require("ag-common/dist/common/helpers/log");
|
1111
|
-
var import_react3 = require("react");
|
1112
|
-
var import_api3 = __toESM(require_api());
|
1113
|
-
var import_callOpenApi3 = require("ag-common/dist/ui/helpers/callOpenApi");
|
1114
|
-
function callOpenApi3(p) {
|
1115
|
-
return (0, import_callOpenApi3.callOpenApi)(__spreadProps(__spreadValues({}, p), {
|
1116
|
-
func: (d) => p.func(d),
|
1117
|
-
newDefaultApi: (opts) => new import_api3.DefaultApi(opts),
|
1118
|
-
logout: () => window.location.reload(),
|
1119
|
-
refreshToken: () => __async(this, null, function* () {
|
1120
|
-
return void 0;
|
1121
|
-
})
|
1122
|
-
}));
|
1123
|
-
}
|
1124
|
-
var track = (_0) => __async(void 0, [_0], function* ({
|
1125
|
-
analyticaToken,
|
1126
|
-
userData,
|
1127
|
-
overrideBaseUrl = "https://api.analytica.click",
|
1128
|
-
eventName
|
1129
|
-
}) {
|
1130
|
-
var _a2, _b, _c;
|
1131
|
-
let data = { eventName };
|
1132
|
-
if (typeof window !== "undefined") {
|
1133
|
-
data = __spreadProps(__spreadValues({}, data), {
|
1134
|
-
pageLocation: window.location.href,
|
1135
|
-
browserResolution: `${(_a2 = window == null ? void 0 : window.screen) == null ? void 0 : _a2.width}:${(_b = window == null ? void 0 : window.screen) == null ? void 0 : _b.height}`
|
1136
|
-
});
|
1137
|
-
}
|
1138
|
-
if (typeof document !== "undefined") {
|
1139
|
-
data = __spreadProps(__spreadValues({}, data), {
|
1140
|
-
pageReferrer: document.referrer,
|
1141
|
-
pageTitle: document.title
|
1142
|
-
});
|
1143
|
-
}
|
1144
|
-
if (typeof navigator !== "undefined") {
|
1145
|
-
data = __spreadProps(__spreadValues({}, data), {
|
1146
|
-
browserLanguage: navigator.language
|
1147
|
-
});
|
1148
|
-
}
|
1149
|
-
if (typeof window !== "undefined" && ((_c = window == null ? void 0 : window.location) == null ? void 0 : _c.hostname) === "localhost") {
|
1150
|
-
(0, import_log5.debug)(`local page ignored: ${JSON.stringify(data)}, to ${overrideBaseUrl}`);
|
1151
|
-
return {};
|
1152
|
-
}
|
1153
|
-
const x = yield callOpenApi3({
|
1154
|
-
apiUrl: overrideBaseUrl,
|
1155
|
-
func: (s) => s.postPageTrack({
|
1156
|
-
key: analyticaToken,
|
1157
|
-
data,
|
1158
|
-
userData
|
1159
|
-
})
|
1160
|
-
});
|
1161
|
-
if (x.error) {
|
1162
|
-
return { error: x.error.message };
|
1163
|
-
}
|
1164
|
-
return {};
|
1165
|
-
});
|
1166
|
-
var page = (_0) => __async(void 0, [_0], function* ({
|
1167
|
-
analyticaToken,
|
1168
|
-
userData,
|
1169
|
-
overrideBaseUrl = "https://api.analytica.click"
|
1170
|
-
}) {
|
1171
|
-
return track({ analyticaToken, userData, overrideBaseUrl, eventName: "PAGE" });
|
1172
|
-
});
|
1173
|
-
var useTrack = () => {
|
1174
|
-
const { analyticaToken, overrideBaseUrl } = (0, import_react3.useContext)(
|
1175
|
-
AnalyticaConfigContext
|
1176
|
-
);
|
1177
|
-
if (!analyticaToken) {
|
1178
|
-
(0, import_log5.warn)(tokenMissing("useTrack"));
|
1179
|
-
const def = () => __async(void 0, null, function* () {
|
1180
|
-
return { error: "no token" };
|
1181
|
-
});
|
1182
|
-
return { page: def, track: def };
|
1183
|
-
}
|
1184
|
-
return {
|
1185
|
-
page: (d) => page(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl })),
|
1186
|
-
track: (d) => track(__spreadProps(__spreadValues({}, d), { analyticaToken, overrideBaseUrl }))
|
1187
|
-
};
|
1188
|
-
};
|
1189
|
-
|
1190
|
-
// src/components/ErrorBoundary/index.tsx
|
1191
|
-
var import_ErrorBoundary = __toESM(require_ErrorBoundary());
|
1192
|
-
var import_react4 = require("react");
|
1193
|
-
var import_log6 = require("ag-common/dist/common/helpers/log");
|
1194
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
1195
|
-
function onBrowserError(_0) {
|
1196
|
-
return __async(this, arguments, function* ({
|
1197
|
-
ev,
|
1198
|
-
analyticaToken,
|
1199
|
-
filterBrowserError
|
1200
|
-
}) {
|
1201
|
-
if (filterBrowserError && filterBrowserError(ev) === false) {
|
1202
|
-
return;
|
1203
|
-
}
|
1204
|
-
const message = (ev == null ? void 0 : ev.message) || (ev == null ? void 0 : ev.error);
|
1205
|
-
const { href } = window.location;
|
1206
|
-
const stack = ev == null ? void 0 : ev.stack;
|
1207
|
-
const filename = ev == null ? void 0 : ev.filename;
|
1208
|
-
yield errorTrack({
|
1209
|
-
data: {
|
1210
|
-
key: analyticaToken,
|
1211
|
-
data: {
|
1212
|
-
message,
|
1213
|
-
stack,
|
1214
|
-
filename,
|
1215
|
-
href
|
1216
|
-
}
|
1217
|
-
}
|
1218
|
-
});
|
1219
|
-
});
|
1220
|
-
}
|
1221
|
-
var ErrorBoundary = ({
|
1222
|
-
children,
|
1223
|
-
filterBrowserError
|
1224
|
-
}) => {
|
1225
|
-
const { analyticaToken } = (0, import_react4.useContext)(AnalyticaConfigContext);
|
1226
|
-
(0, import_react4.useEffect)(() => {
|
1227
|
-
if (!analyticaToken) {
|
1228
|
-
return () => {
|
1229
|
-
};
|
1230
|
-
}
|
1231
|
-
const obe = (ev) => onBrowserError({ ev, analyticaToken, filterBrowserError });
|
1232
|
-
window.addEventListener("error", obe);
|
1233
|
-
return () => {
|
1234
|
-
window.removeEventListener("error", obe);
|
1235
|
-
};
|
1236
|
-
}, [analyticaToken, filterBrowserError]);
|
1237
|
-
if (!analyticaToken) {
|
1238
|
-
(0, import_log6.warn)(tokenMissing("ErrorBoundary"));
|
1239
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
1240
|
-
children
|
1241
|
-
});
|
1242
|
-
}
|
1243
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ErrorBoundary.ErrorBoundary, {
|
1244
|
-
notify: (data) => __async(void 0, null, function* () {
|
1245
|
-
const { href } = window.location;
|
1246
|
-
yield errorTrack({
|
1247
|
-
data: {
|
1248
|
-
key: analyticaToken,
|
1249
|
-
data: __spreadProps(__spreadValues({}, data), {
|
1250
|
-
href
|
1251
|
-
})
|
1252
|
-
}
|
1253
|
-
});
|
1254
|
-
}),
|
1255
|
-
children
|
1256
|
-
});
|
1257
|
-
};
|
1258
|
-
|
1259
|
-
// src/components/ExternalComponent/index.tsx
|
1260
|
-
var import_react5 = __toESM(require("react"));
|
1261
|
-
var import_createRequires = require("@paciolan/remote-component/dist/createRequires");
|
1262
|
-
var import_useRemoteComponent = require("@paciolan/remote-component/dist/hooks/useRemoteComponent");
|
1263
|
-
var import_react_dom = __toESM(require("react-dom"));
|
1264
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
1265
|
-
var styled = require("styled-components");
|
1266
|
-
var cache = {};
|
1267
|
-
var ExternalComponent = ({
|
1268
|
-
url,
|
1269
|
-
props
|
1270
|
-
}) => {
|
1271
|
-
const requires = (0, import_createRequires.createRequires)(() => ({
|
1272
|
-
react: import_react5.default,
|
1273
|
-
"react-dom": import_react_dom.default,
|
1274
|
-
"styled-components": styled
|
1275
|
-
}));
|
1276
|
-
let Component;
|
1277
|
-
let loading = false;
|
1278
|
-
let error2;
|
1279
|
-
if (cache[url]) {
|
1280
|
-
Component = cache[url];
|
1281
|
-
} else {
|
1282
|
-
[loading, error2, Component] = (0, import_useRemoteComponent.createUseRemoteComponent)({ requires })(url);
|
1283
|
-
}
|
1284
|
-
if (!cache[url] && !loading && !error2 && Component) {
|
1285
|
-
cache[url] = Component;
|
1286
|
-
}
|
1287
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
1288
|
-
children: [
|
1289
|
-
!loading && !error2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadValues({}, props)),
|
1290
|
-
error2 && error2
|
1291
|
-
]
|
1292
|
-
});
|
1293
|
-
};
|
1294
|
-
|
1295
|
-
// src/components/Feedback/index.tsx
|
1296
|
-
var import_react6 = require("react");
|
1297
|
-
var import_log7 = require("ag-common/dist/common/helpers/log");
|
1298
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
1299
|
-
var Feedback = (props) => {
|
1300
|
-
const { analyticaToken, overrideBaseUrl, devMode } = (0, import_react6.useContext)(
|
1301
|
-
AnalyticaConfigContext
|
1302
|
-
);
|
1303
|
-
if (!analyticaToken) {
|
1304
|
-
(0, import_log7.warn)(tokenMissing("Feedback"));
|
1305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
1306
|
-
}
|
1307
|
-
const int = __spreadProps(__spreadValues({}, props), {
|
1308
|
-
submitFeedback: feedback,
|
1309
|
-
analyticaToken,
|
1310
|
-
overrideBaseUrl
|
1311
|
-
});
|
1312
|
-
let url = `https://cdn.analytica.click/feedback.js`;
|
1313
|
-
if (devMode) {
|
1314
|
-
url = `/feedback.js`;
|
1315
|
-
}
|
1316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalComponent, {
|
1317
|
-
url,
|
1318
|
-
props: int
|
1319
|
-
});
|
1320
|
-
};
|
1321
|
-
|
1322
|
-
// src/components/UserProvider/cognito.ts
|
1323
|
-
var import_cognitoidentity = __toESM(require("aws-sdk/clients/cognitoidentity"));
|
1324
|
-
function getAwsCreds(_0) {
|
1325
|
-
return __async(this, arguments, function* ({
|
1326
|
-
user,
|
1327
|
-
config
|
1328
|
-
}) {
|
1329
|
-
var _a2, _b, _c;
|
1330
|
-
if (!((_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.id_token) || !user.idJwt || !config.identityPool) {
|
1331
|
-
return void 0;
|
1332
|
-
}
|
1333
|
-
const idToken = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.id_token;
|
1334
|
-
const logins = {
|
1335
|
-
[user.idJwt.iss.replace("https://", "")]: idToken
|
1336
|
-
};
|
1337
|
-
const cognito = new import_cognitoidentity.default({ region: config.AWSRegion });
|
1338
|
-
const identityId = yield cognito.getId({
|
1339
|
-
IdentityPoolId: config.identityPool,
|
1340
|
-
Logins: logins
|
1341
|
-
}).promise();
|
1342
|
-
if (!(identityId == null ? void 0 : identityId.IdentityId)) {
|
1343
|
-
return void 0;
|
1344
|
-
}
|
1345
|
-
const roleArn = (_c = user.idJwt) == null ? void 0 : _c["cognito:preferred_role"];
|
1346
|
-
const params = {
|
1347
|
-
CustomRoleArn: roleArn,
|
1348
|
-
IdentityId: identityId.IdentityId,
|
1349
|
-
Logins: logins
|
1350
|
-
};
|
1351
|
-
const { Credentials: creds } = yield cognito.getCredentialsForIdentity(params).promise();
|
1352
|
-
if (!(creds == null ? void 0 : creds.AccessKeyId) || !creds.SecretKey || !creds.SessionToken || !creds.Expiration) {
|
1353
|
-
return void 0;
|
1354
|
-
}
|
1355
|
-
const credentials = {
|
1356
|
-
accessKeyId: creds.AccessKeyId,
|
1357
|
-
sessionToken: creds.SessionToken,
|
1358
|
-
secretAccessKey: creds.SecretKey
|
1359
|
-
};
|
1360
|
-
return credentials;
|
1361
|
-
});
|
1362
|
-
}
|
1363
|
-
|
1364
|
-
// src/components/UserProvider/jwt.ts
|
1365
|
-
var jwtExpired = (j) => !(j == null ? void 0 : j.expires_at) || new Date().getTime() > j.expires_at;
|
1366
|
-
var jwtGenerateExpiresAt = ({ expires_in }) => new Date().getTime() + parseInt(`${expires_in}000`, 10);
|
1367
|
-
|
1368
|
-
// src/components/UserProvider/refreshToken.ts
|
1369
|
-
var import_axiosHelper = require("ag-common/dist/ui/helpers/axiosHelper");
|
1370
|
-
var import_log8 = require("ag-common/dist/common/helpers/log");
|
1371
|
-
var import_dom = __toESM(require_dom());
|
1372
|
-
function refreshToken(_0) {
|
1373
|
-
return __async(this, arguments, function* ({
|
1374
|
-
user,
|
1375
|
-
setUser,
|
1376
|
-
setError,
|
1377
|
-
config,
|
1378
|
-
logout
|
1379
|
-
}) {
|
1380
|
-
var _a2, _b;
|
1381
|
-
try {
|
1382
|
-
if (((_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.id_token) && !jwtExpired(user == null ? void 0 : user.jwt)) {
|
1383
|
-
return user;
|
1384
|
-
}
|
1385
|
-
const token = (_b = user == null ? void 0 : user.jwt) == null ? void 0 : _b.refresh_token;
|
1386
|
-
if (!token || !user) {
|
1387
|
-
(0, import_log8.warn)("no refresh token, wipe");
|
1388
|
-
logout();
|
1389
|
-
return void 0;
|
1390
|
-
}
|
1391
|
-
const resp = yield (0, import_axiosHelper.axiosHelper)({
|
1392
|
-
url: config.cognitoRefresh,
|
1393
|
-
verb: "post",
|
1394
|
-
body: (0, import_dom.stringify)({
|
1395
|
-
grant_type: "refresh_token",
|
1396
|
-
client_id: config.ClientId,
|
1397
|
-
refresh_token: token
|
1398
|
-
}),
|
1399
|
-
headers: {
|
1400
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
1401
|
-
}
|
1402
|
-
});
|
1403
|
-
const newUser = __spreadProps(__spreadValues({}, user), {
|
1404
|
-
jwt: __spreadProps(__spreadValues({}, resp.data), {
|
1405
|
-
refresh_token: token,
|
1406
|
-
expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
|
1407
|
-
})
|
1408
|
-
});
|
1409
|
-
newUser.credentials = yield getAwsCreds({ user: newUser, config });
|
1410
|
-
setUser(newUser);
|
1411
|
-
return newUser;
|
1412
|
-
} catch (e) {
|
1413
|
-
const es = e.toString();
|
1414
|
-
if (es.includes(400) || es.includes(401) || es.includes(403)) {
|
1415
|
-
(0, import_log8.debug)("old refresh token, wipe");
|
1416
|
-
setUser(void 0);
|
1417
|
-
setError(void 0);
|
1418
|
-
return void 0;
|
1419
|
-
}
|
1420
|
-
setError(e);
|
1421
|
-
}
|
1422
|
-
return void 0;
|
1423
|
-
});
|
1424
|
-
}
|
1425
|
-
|
1426
|
-
// src/components/UserProvider/getTokensFromCode.ts
|
1427
|
-
var import_axiosHelper2 = require("ag-common/dist/ui/helpers/axiosHelper");
|
1428
|
-
var import_dom2 = __toESM(require_dom());
|
1429
|
-
function getTokensFromCode(_0) {
|
1430
|
-
return __async(this, arguments, function* ({
|
1431
|
-
code,
|
1432
|
-
setUser,
|
1433
|
-
redirectUrl,
|
1434
|
-
config
|
1435
|
-
}) {
|
1436
|
-
try {
|
1437
|
-
const resp = yield (0, import_axiosHelper2.axiosHelper)({
|
1438
|
-
verb: "post",
|
1439
|
-
url: config.cognitoRefresh,
|
1440
|
-
body: (0, import_dom2.stringify)({
|
1441
|
-
grant_type: "authorization_code",
|
1442
|
-
client_id: config.ClientId,
|
1443
|
-
code,
|
1444
|
-
redirect_uri: redirectUrl
|
1445
|
-
}),
|
1446
|
-
headers: {
|
1447
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
1448
|
-
}
|
1449
|
-
});
|
1450
|
-
const newUser = __spreadProps(__spreadValues({}, getUserFromIdToken(resp.data.id_token)), {
|
1451
|
-
jwt: __spreadProps(__spreadValues({}, resp.data), {
|
1452
|
-
expires_at: jwtGenerateExpiresAt({ expires_in: resp.data.expires_in })
|
1453
|
-
})
|
1454
|
-
});
|
1455
|
-
if (config.identityPool) {
|
1456
|
-
newUser.credentials = yield getAwsCreds({ user: newUser, config });
|
1457
|
-
}
|
1458
|
-
setUser(newUser);
|
1459
|
-
return true;
|
1460
|
-
} catch (e) {
|
1461
|
-
}
|
1462
|
-
return false;
|
1463
|
-
});
|
1464
|
-
}
|
1465
|
-
|
1466
|
-
// src/components/UserProvider/index.tsx
|
1467
|
-
var import_log9 = require("ag-common/dist/common/helpers/log");
|
1468
|
-
var import_react7 = __toESM(require("react"));
|
1469
|
-
var import_useLocalStorage = require("ag-common/dist/ui/helpers/useLocalStorage");
|
1470
|
-
var import_cookie = require("ag-common/dist/ui/helpers/cookie");
|
1471
|
-
var import_dom3 = __toESM(require_dom());
|
1472
|
-
var import_useGranularHook = require("ag-common/dist/ui/helpers/useGranularHook");
|
1473
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
1474
|
-
var CognitoAuthContext = import_react7.default.createContext(
|
1475
|
-
void 0
|
1476
|
-
);
|
1477
|
-
var getStatefulUrl = ({
|
1478
|
-
redirectUrl,
|
1479
|
-
qs
|
1480
|
-
}) => {
|
1481
|
-
let url = redirectUrl || "/";
|
1482
|
-
if (qs == null ? void 0 : qs.state) {
|
1483
|
-
try {
|
1484
|
-
if (!url.includes("?")) {
|
1485
|
-
url += "?";
|
1486
|
-
} else {
|
1487
|
-
url += "&";
|
1488
|
-
}
|
1489
|
-
url += `state=${qs.state}`;
|
1490
|
-
} catch (e) {
|
1491
|
-
(0, import_log9.warn)("bad state passed in");
|
1492
|
-
}
|
1493
|
-
}
|
1494
|
-
return url;
|
1495
|
-
};
|
1496
|
-
var CognitoAuthProvider = ({
|
1497
|
-
config,
|
1498
|
-
children,
|
1499
|
-
goToPageUrl,
|
1500
|
-
location,
|
1501
|
-
redirectUrl = location.origin,
|
1502
|
-
onMessage,
|
1503
|
-
cookieDocument
|
1504
|
-
}) => {
|
1505
|
-
var _a2, _b;
|
1506
|
-
const [error2, setError] = (0, import_react7.useState)();
|
1507
|
-
const [idTokenRaw, setIdToken] = (0, import_cookie.useCookieString)({
|
1508
|
-
name: "id_token",
|
1509
|
-
cookieDocument: typeof window === "undefined" ? cookieDocument : void 0,
|
1510
|
-
defaultValue: ""
|
1511
|
-
});
|
1512
|
-
let idToken = idTokenRaw;
|
1513
|
-
if (idToken && !decodeIdToken(idToken)) {
|
1514
|
-
(0, import_log9.warn)(`bad token, wiping`);
|
1515
|
-
(0, import_cookie.wipeCookies)("id_token");
|
1516
|
-
idToken = "";
|
1517
|
-
}
|
1518
|
-
let defUser;
|
1519
|
-
if (idToken && !(0, import_useLocalStorage.getLocalStorageItem)("user", void 0)) {
|
1520
|
-
defUser = getUserFromIdToken(idToken);
|
1521
|
-
}
|
1522
|
-
const [user, setUserRaw] = (0, import_useLocalStorage.UseLocalStorage)("user", defUser);
|
1523
|
-
const setUser = (value2) => {
|
1524
|
-
setUserRaw(value2);
|
1525
|
-
return;
|
1526
|
-
};
|
1527
|
-
const [loading, setLoading] = (0, import_react7.useState)(false);
|
1528
|
-
const qs = (0, import_dom3.extractQs)({
|
1529
|
-
search: typeof window === "undefined" ? "" : window.location.search,
|
1530
|
-
sanatise: false
|
1531
|
-
});
|
1532
|
-
const logout = () => __async(void 0, null, function* () {
|
1533
|
-
(0, import_cookie.wipeCookies)("id_token");
|
1534
|
-
(0, import_useLocalStorage.clearLocalStorageItem)("user");
|
1535
|
-
setIdToken("");
|
1536
|
-
setUser(void 0);
|
1537
|
-
setError(void 0);
|
1538
|
-
setLoading(true);
|
1539
|
-
yield goToPageUrl({ url: location.origin, login: false });
|
1540
|
-
setLoading(false);
|
1541
|
-
});
|
1542
|
-
(0, import_react7.useEffect)(() => {
|
1543
|
-
var _a3;
|
1544
|
-
const newT = (_a3 = user == null ? void 0 : user.jwt) == null ? void 0 : _a3.id_token;
|
1545
|
-
if (!!newT && newT !== idToken) {
|
1546
|
-
setIdToken(newT || "");
|
1547
|
-
}
|
1548
|
-
}, [idToken, setIdToken, user, (_a2 = user == null ? void 0 : user.jwt) == null ? void 0 : _a2.id_token]);
|
1549
|
-
const loginWithRedirect = (stateqs) => __async(void 0, null, function* () {
|
1550
|
-
var _a3;
|
1551
|
-
if (error2 || loading || location.hash && Object.keys(location.hash).length > 0 || location.search && ((_a3 = Object.keys(location.search)) == null ? void 0 : _a3.length) > 0) {
|
1552
|
-
return;
|
1553
|
-
}
|
1554
|
-
setLoading(true);
|
1555
|
-
const state = {
|
1556
|
-
back: location.pathname
|
1557
|
-
};
|
1558
|
-
let url = config.vendToken + redirectUrl;
|
1559
|
-
if (stateqs) {
|
1560
|
-
url += `&state=${stateqs}`;
|
1561
|
-
}
|
1562
|
-
yield goToPageUrl({
|
1563
|
-
url,
|
1564
|
-
state,
|
1565
|
-
login: true
|
1566
|
-
});
|
1567
|
-
});
|
1568
|
-
(0, import_useGranularHook.useGranularEffect)(
|
1569
|
-
() => {
|
1570
|
-
function run() {
|
1571
|
-
return __async(this, null, function* () {
|
1572
|
-
var _a3, _b2, _c, _d;
|
1573
|
-
const hasQs = !!(qs == null ? void 0 : qs.code) || !!(qs == null ? void 0 : qs.error);
|
1574
|
-
const expired = jwtExpired(user == null ? void 0 : user.jwt);
|
1575
|
-
const onlyJwt = !(user == null ? void 0 : user.userId) && !!(user == null ? void 0 : user.jwt);
|
1576
|
-
if (loading || error2 || ((_a3 = user == null ? void 0 : user.idJwt) == null ? void 0 : _a3.email) && !hasQs && !expired) {
|
1577
|
-
return;
|
1578
|
-
}
|
1579
|
-
try {
|
1580
|
-
setLoading(true);
|
1581
|
-
if (qs == null ? void 0 : qs.error) {
|
1582
|
-
const newerror = {
|
1583
|
-
message: (qs == null ? void 0 : qs.error_description) || "auth error"
|
1584
|
-
};
|
1585
|
-
if (JSON.stringify(newerror || {}) !== JSON.stringify(error2 || {})) {
|
1586
|
-
setError(newerror);
|
1587
|
-
}
|
1588
|
-
return;
|
1589
|
-
}
|
1590
|
-
if ((qs == null ? void 0 : qs.code) && !expired) {
|
1591
|
-
yield goToPageUrl({ url: redirectUrl, login: false });
|
1592
|
-
return;
|
1593
|
-
}
|
1594
|
-
if (qs == null ? void 0 : qs.code) {
|
1595
|
-
if (expired) {
|
1596
|
-
yield getTokensFromCode({
|
1597
|
-
code: qs.code,
|
1598
|
-
redirectUrl,
|
1599
|
-
config,
|
1600
|
-
setUser
|
1601
|
-
});
|
1602
|
-
}
|
1603
|
-
yield goToPageUrl({
|
1604
|
-
url: getStatefulUrl({ redirectUrl, qs }),
|
1605
|
-
login: false
|
1606
|
-
});
|
1607
|
-
return;
|
1608
|
-
}
|
1609
|
-
if (expired && ((_b2 = user == null ? void 0 : user.jwt) == null ? void 0 : _b2.refresh_token)) {
|
1610
|
-
yield refreshToken({
|
1611
|
-
setUser,
|
1612
|
-
setError,
|
1613
|
-
user,
|
1614
|
-
config,
|
1615
|
-
logout
|
1616
|
-
});
|
1617
|
-
return;
|
1618
|
-
}
|
1619
|
-
if (onlyJwt) {
|
1620
|
-
const token = (_d = (_c = user == null ? void 0 : user.jwt) == null ? void 0 : _c.id_token) == null ? void 0 : _d.substr(
|
1621
|
-
user.jwt.id_token.indexOf(" ") + 1
|
1622
|
-
);
|
1623
|
-
if (!user || !token) {
|
1624
|
-
(0, import_log9.info)("logging out no token");
|
1625
|
-
setUser(void 0);
|
1626
|
-
setError(void 0);
|
1627
|
-
} else {
|
1628
|
-
setUser(__spreadProps(__spreadValues({}, getUserFromIdToken(token)), {
|
1629
|
-
jwt: user.jwt,
|
1630
|
-
credentials: user.credentials
|
1631
|
-
}));
|
1632
|
-
}
|
1633
|
-
}
|
1634
|
-
} finally {
|
1635
|
-
setLoading(false);
|
1636
|
-
}
|
1637
|
-
});
|
1638
|
-
}
|
1639
|
-
void run();
|
1640
|
-
},
|
1641
|
-
[user == null ? void 0 : user.jwt, qs],
|
1642
|
-
[
|
1643
|
-
config,
|
1644
|
-
error2,
|
1645
|
-
goToPageUrl,
|
1646
|
-
logout,
|
1647
|
-
loading,
|
1648
|
-
qs,
|
1649
|
-
redirectUrl,
|
1650
|
-
setUser,
|
1651
|
-
user
|
1652
|
-
]
|
1653
|
-
);
|
1654
|
-
(0, import_react7.useEffect)(() => {
|
1655
|
-
var _a3;
|
1656
|
-
if (error2) {
|
1657
|
-
(0, import_log9.error)(JSON.stringify(error2));
|
1658
|
-
if (onMessage) {
|
1659
|
-
onMessage(`error:${(_a3 = error2.response) == null ? void 0 : _a3.status}`, { appearance: "error" });
|
1660
|
-
}
|
1661
|
-
}
|
1662
|
-
}, [onMessage, error2]);
|
1663
|
-
const l2 = !error2 && (loading || !!(qs == null ? void 0 : qs.code));
|
1664
|
-
const value = {
|
1665
|
-
loading: l2,
|
1666
|
-
isAuthenticated: !error2 && !!((_b = user == null ? void 0 : user.idJwt) == null ? void 0 : _b.email),
|
1667
|
-
refreshToken: () => refreshToken({
|
1668
|
-
setUser,
|
1669
|
-
setError,
|
1670
|
-
user,
|
1671
|
-
config,
|
1672
|
-
logout
|
1673
|
-
}),
|
1674
|
-
loginWithRedirect,
|
1675
|
-
logout,
|
1676
|
-
error: error2,
|
1677
|
-
user
|
1678
|
-
};
|
1679
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CognitoAuthContext.Provider, {
|
1680
|
-
value,
|
1681
|
-
children
|
1682
|
-
});
|
1683
|
-
};
|
1684
|
-
|
1685
|
-
// src/components/UserProvider/DashboardAuthValidation.tsx
|
1686
|
-
var import_log10 = require("ag-common/dist/common/helpers/log");
|
1687
|
-
var import_string = require("ag-common/dist/common/helpers/string");
|
1688
|
-
var import_Loader = require("ag-common/dist/ui/components/Loader");
|
1689
|
-
var import_useGranularHook2 = require("ag-common/dist/ui/helpers/useGranularHook");
|
1690
|
-
var import_useQueryString = require("ag-common/dist/ui/helpers/useQueryString");
|
1691
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
1692
|
-
var DashboardAuthValidation = ({
|
1693
|
-
rc: { request, pushPath },
|
1694
|
-
cac: {
|
1695
|
-
error: authError,
|
1696
|
-
loginWithRedirect,
|
1697
|
-
logout,
|
1698
|
-
isAuthenticated,
|
1699
|
-
loading: authLoading
|
1700
|
-
},
|
1701
|
-
getDashboardPath,
|
1702
|
-
getUnauthedPage,
|
1703
|
-
addToast
|
1704
|
-
}) => {
|
1705
|
-
(0, import_useGranularHook2.useGranularEffect)(
|
1706
|
-
() => {
|
1707
|
-
if (authError) {
|
1708
|
-
const emailOption = authError.message.includes("email") ? ` We require the use of your email for the functionality of this app.
|
1709
|
-
You can update your settings at https://www.facebook.com/settings?tab=applications` : "";
|
1710
|
-
addToast(
|
1711
|
-
`An Error has occured with your login attempt.${emailOption}`,
|
1712
|
-
{
|
1713
|
-
appearance: "error"
|
1714
|
-
}
|
1715
|
-
);
|
1716
|
-
(0, import_log10.error)(`auth error:`, JSON.stringify(authError, null, 2));
|
1717
|
-
void logout();
|
1718
|
-
}
|
1719
|
-
},
|
1720
|
-
[authError],
|
1721
|
-
[authError, addToast, logout]
|
1722
|
-
);
|
1723
|
-
const forceLogin = Object.keys(request.url.query || {}).includes("login");
|
1724
|
-
if (forceLogin) {
|
1725
|
-
if (!isAuthenticated) {
|
1726
|
-
void loginWithRedirect(request.url.query.state);
|
1727
|
-
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1728
|
-
}
|
1729
|
-
if (isAuthenticated) {
|
1730
|
-
void pushPath(getDashboardPath());
|
1731
|
-
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1732
|
-
}
|
1733
|
-
}
|
1734
|
-
if (request.url.query.state && isAuthenticated) {
|
1735
|
-
const decoded = JSON.parse((0, import_string.fromBase64)(request.url.query.state));
|
1736
|
-
if (decoded.redirect) {
|
1737
|
-
void pushPath(decoded.redirect);
|
1738
|
-
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1739
|
-
}
|
1740
|
-
}
|
1741
|
-
const serverAuthLoading = import_useQueryString.isServer && !authError && !authLoading && !isAuthenticated && Object.keys(request.url.query || {}).includes("code");
|
1742
|
-
if (authLoading || serverAuthLoading) {
|
1743
|
-
return {
|
1744
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Loader.Loader, {
|
1745
|
-
name: "authload"
|
1746
|
-
}),
|
1747
|
-
openApiDisabled: true
|
1748
|
-
};
|
1749
|
-
}
|
1750
|
-
if (!isAuthenticated && !authLoading && !authError && getUnauthedPage) {
|
1751
|
-
void pushPath(getUnauthedPage());
|
1752
|
-
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1753
|
-
}
|
1754
|
-
const openApiDisabled = !isAuthenticated || authLoading || !!authError;
|
1755
|
-
return { openApiDisabled };
|
1756
|
-
};
|
1757
|
-
// Annotate the CommonJS export names for ESM import in node:
|
1758
|
-
0 && (module.exports = {
|
1759
|
-
AnalyticaConfigContext,
|
1760
|
-
AnalyticaConfigProvider,
|
1761
|
-
CognitoAuthContext,
|
1762
|
-
CognitoAuthProvider,
|
1763
|
-
DashboardAuthValidation,
|
1764
|
-
ErrorBoundary,
|
1765
|
-
ExternalComponent,
|
1766
|
-
Feedback,
|
1767
|
-
decodeIdToken,
|
1768
|
-
errorTrack,
|
1769
|
-
feedback,
|
1770
|
-
getUserFromIdToken,
|
1771
|
-
page,
|
1772
|
-
tokenMissing,
|
1773
|
-
track,
|
1774
|
-
useFeedback,
|
1775
|
-
useTrack
|
1776
|
-
});
|
3
|
+
`,we=class extends oe.default.Component{constructor(t){super(t),this.state={hasError:void 0}}static getDerivedStateFromError(t){var r;let n=typeof window<"u"&&((r=window?.location)===null||r===void 0?void 0:r.href);return{hasError:Object.assign(Object.assign(Object.assign(Object.assign({},t),{message:t?.message||t}),t?.stack&&{stack:t?.stack}),n&&{href:n})}}render(){let{hasError:t}=this.state,{children:r,notify:n}=this.props;return t?(n&&n(t),oe.default.createElement(ir.Modal,{open:!0,setOpen:()=>{}},oe.default.createElement(ar,null,"A fatal error has occurred - the admin has been notified.",oe.default.createElement("button",{type:"button",onClick:()=>window.location.reload()},"Press here to restart app")))):r}};K.ErrorBoundary=we});var fe=z(v=>{Object.defineProperty(v,"__esModule",{value:!0});v.stringify=v.extractQs=v.getClientY=v.getChildrenPositions=v.getChildrenArray=void 0;var lt=require("ag-common/dist/common/helpers/log"),ur=require("querystring"),pr=e=>{var t;let r=((t=e.current)===null||t===void 0?void 0:t.children)||[],n=[];for(let o=0;o<r.length;o+=1)n.push(r[o]);return n};v.getChildrenArray=pr;var fr=e=>(0,v.getChildrenArray)(e).map(t=>t.getBoundingClientRect().top+t.getBoundingClientRect().height);v.getChildrenPositions=fr;var gr=e=>{var t,r,n,o;if(!e)return;let i;if(e?.changedTouches||e?.touches){let a=e;i=((r=(t=a.changedTouches)===null||t===void 0?void 0:t[0])===null||r===void 0?void 0:r.clientY)||((o=(n=a.touches)===null||n===void 0?void 0:n[0])===null||o===void 0?void 0:o.clientY)}else e?.clientY&&(i=e.clientY);return i};v.getClientY=gr;var dt=e=>e.replace(/[^a-zA-Z0-9\-_]/gim,"");function hr({search:e,sanatise:t}){if(!e)return{};let r=(0,ur.parse)(e.replace(/^[?]/,"")),n={};return Object.keys(r).forEach(o=>{let i=t?dt(o):o;o!==i&&(0,lt.debug)("sanatising qs input key for ",i),Array.isArray(r[i])?n[i]=r[i].join(""):n[i]=r[i];let a=t?dt(n[i]):n[i];a!==n[i]&&((0,lt.debug)("sanatising qs input for ",i),n[i]=a)}),n}v.extractQs=hr;var mr=e=>{let t=new URLSearchParams;return Object.entries(e).forEach(([r,n])=>t.append(r,n)),t};v.stringify=mr});var Or={};Vt(Or,{AnalyticaConfigContext:()=>P,AnalyticaConfigProvider:()=>Xt,CognitoAuthContext:()=>bt,CognitoAuthProvider:()=>br,DashboardAuthValidation:()=>vt,ErrorBoundary:()=>cr,ExternalComponent:()=>ke,Feedback:()=>dr,decodeIdToken:()=>ne,errorTrack:()=>D,feedback:()=>re,getUserFromIdToken:()=>B,page:()=>Ye,tokenMissing:()=>x,track:()=>Oe,useFeedback:()=>tr,useTrack:()=>nr});module.exports=It(Or);var De=(e,t)=>{let r=[],n={},o=0;return Object.entries(e).forEach(([i,a])=>{o<t?r.push(a):n[i]=a,o+=1}),{part:r,rest:n}};var be=require("ag-common/dist/common/helpers/log"),Ke=require("ag-common/dist/ui/helpers/callOpenApi"),Je=k(X()),te=k(Fe());function Ue(e){return(0,Ke.callOpenApi)(m(g({},e),{func:t=>e.func(t),newDefaultApi:t=>new Je.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>y(this,null,function*(){})}))}var Be,Wt=typeof window!="undefined"&&((Be=window==null?void 0:window.location)==null?void 0:Be.hostname)==="localhost",_={},ee,Ae,Ne=()=>y(void 0,null,function*(){var e,t;try{if(Object.keys(_).length>100){let i=Object.keys(_)[0],a=_[i],s=yield Ue({apiUrl:Ae,func:l=>{var c;return l.postErrors([{key:a.key,data:m(g({},a.data),{message:`error overload!: ${(c=a.data.message)!=null?c:"?"}`})}])}});if(_={},s.error)throw s.error;return{}}let{part:r,rest:n}=De(_,10);_=n;let o=yield Ue({apiUrl:Ae,func:i=>i.postErrors(r)});if(o.error)throw o.error}catch(r){return{error:(t=(e=r==null?void 0:r.error)==null?void 0:e.message)!=null?t:r.message}}finally{_.length?ee=setTimeout(Ne,1e3):ee=void 0}}),D=r=>y(void 0,[r],function*({data:e,overrideBaseUrl:t="https://api.analytica.click"}){var o;if(Wt)return(0,be.debug)(`local error tracking ignored:${e.data.message} ${JSON.stringify(e)}, to ${t}`),{};if(!(0,te.isValidLogMessage)((o=e==null?void 0:e.data)==null?void 0:o.message))return{};(0,be.debug)("error track",e.data.message,JSON.stringify(e));let n=(0,te.getErrorKey)(e.data.message);return _[n]=e,Ae=t,ee||(ee=setTimeout(Ne,500)),{}});var V=k(require("react")),Zt=require("react/jsx-runtime"),Qt={analyticaToken:void 0,overrideBaseUrl:void 0},P=V.default.createContext(Qt);function Yt(e){if(!e.analyticaToken)return;let t=window.console.error;window.console.error=(...n)=>D({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>t(...n));let r=window.console.warn;window.console.warn=(...n)=>D({data:{data:{href:window.location.href,message:JSON.stringify(n)},key:e.analyticaToken},overrideBaseUrl:e.overrideBaseUrl}).finally(()=>r(...n))}var Xt=({children:e,values:t})=>{let[r,n]=(0,V.useState)(t);return(0,V.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(r)&&n(t)},[r,t]),(0,V.useEffect)(()=>{Yt(t)},[]),(0,Zt.jsx)(P.Provider,{value:r,children:e})};var x=e=>`[Analytica.${e}] Please load analytica token in AnalyticaConfigProvider to use this component`;var M=require("ag-common/dist/common/helpers/log"),Le=require("react"),He=require("ag-common/dist/ui/helpers/callOpenApi"),ze=k(X());function er(e){return(0,He.callOpenApi)(m(g({},e),{func:t=>e.func(t),newDefaultApi:t=>new ze.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>y(this,null,function*(){})}))}var re=n=>y(void 0,[n],function*({data:e,analyticaToken:t,overrideBaseUrl:r="https://api.analytica.click"}){var i;if(typeof window!="undefined"&&((i=window==null?void 0:window.location)==null?void 0:i.hostname)==="localhost")return(0,M.debug)(`local feedback ignored:${JSON.stringify(e)}, to ${r}`),{};(0,M.debug)("feedback",JSON.stringify(e));let o=yield er({apiUrl:r,func:a=>a.putFeedback({key:t,data:e})});return o.error?{error:o.error.message}:{}}),tr=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Le.useContext)(P);return e?{trackWithToken:r=>re(m(g({},r),{analyticaToken:e,overrideBaseUrl:t}))}:((0,M.warn)(x("useFeedback")),{trackWithToken:()=>({error:"no token"})})};var Me=e=>{var t,r;try{return(r=(t=JSON.parse(e))==null?void 0:t.data)==null?void 0:r.url}catch(n){return e}};var $e=require("jsonwebtoken"),ne=e=>(0,$e.decode)(e),B=e=>{var n;let t=ne(e);if(!t)throw new Error("bad token");return{userId:t.email,fullname:t.name,nickname:t.nickname,picture:Me(t.picture),updatedAt:new Date().getTime(),idJwt:t,isAdmin:(n=t==null?void 0:t["cognito:groups"])==null?void 0:n.includes("Admin")}};var ie=require("ag-common/dist/common/helpers/log"),Ge=require("react"),We=k(X()),Qe=require("ag-common/dist/ui/helpers/callOpenApi");function rr(e){return(0,Qe.callOpenApi)(m(g({},e),{func:t=>e.func(t),newDefaultApi:t=>new We.DefaultApi(t),logout:()=>window.location.reload(),refreshToken:()=>y(this,null,function*(){})}))}var Oe=o=>y(void 0,[o],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click",eventName:n}){var s,l,c;let i={eventName:n};if(typeof window!="undefined"&&(i=m(g({},i),{pageLocation:window.location.href,browserResolution:`${(s=window==null?void 0:window.screen)==null?void 0:s.width}:${(l=window==null?void 0:window.screen)==null?void 0:l.height}`})),typeof document!="undefined"&&(i=m(g({},i),{pageReferrer:document.referrer,pageTitle:document.title})),typeof navigator!="undefined"&&(i=m(g({},i),{browserLanguage:navigator.language})),typeof window!="undefined"&&((c=window==null?void 0:window.location)==null?void 0:c.hostname)==="localhost")return(0,ie.debug)(`local page ignored: ${JSON.stringify(i)}, to ${r}`),{};let a=yield rr({apiUrl:r,func:p=>p.postPageTrack({key:e,data:i,userData:t})});return a.error?{error:a.error.message}:{}}),Ye=n=>y(void 0,[n],function*({analyticaToken:e,userData:t,overrideBaseUrl:r="https://api.analytica.click"}){return Oe({analyticaToken:e,userData:t,overrideBaseUrl:r,eventName:"PAGE"})}),nr=()=>{let{analyticaToken:e,overrideBaseUrl:t}=(0,Ge.useContext)(P);if(!e){(0,ie.warn)(x("useTrack"));let r=()=>y(void 0,null,function*(){return{error:"no token"}});return{page:r,track:r}}return{page:r=>Ye(m(g({},r),{analyticaToken:e,overrideBaseUrl:t})),track:r=>Oe(m(g({},r),{analyticaToken:e,overrideBaseUrl:t}))}};var et=k(Ze()),se=require("react"),tt=require("ag-common/dist/common/helpers/log");var ae=require("react/jsx-runtime");function sr(n){return y(this,arguments,function*({ev:e,analyticaToken:t,filterBrowserError:r}){if(r&&r(e)===!1)return;let o=(e==null?void 0:e.message)||(e==null?void 0:e.error),{href:i}=window.location,a=e==null?void 0:e.stack,s=e==null?void 0:e.filename;yield D({data:{key:t,data:{message:o,stack:a,filename:s,href:i}}})})}var cr=({children:e,filterBrowserError:t})=>{let{analyticaToken:r}=(0,se.useContext)(P);return(0,se.useEffect)(()=>{if(!r)return()=>{};let n=o=>sr({ev:o,analyticaToken:r,filterBrowserError:t});return window.addEventListener("error",n),()=>{window.removeEventListener("error",n)}},[r,t]),r?(0,ae.jsx)(et.ErrorBoundary,{notify:n=>y(void 0,null,function*(){let{href:o}=window.location;yield D({data:{key:r,data:m(g({},n),{href:o})}})}),children:e}):((0,tt.warn)(x("ErrorBoundary")),(0,ae.jsx)(ae.Fragment,{children:e}))};var rt=k(require("react")),nt=require("@paciolan/remote-component/dist/createRequires"),it=require("@paciolan/remote-component/dist/hooks/useRemoteComponent"),ot=k(require("react-dom"));var $=require("react/jsx-runtime"),lr=require("styled-components"),ce={},ke=({url:e,props:t})=>{let r=(0,nt.createRequires)(()=>({react:rt.default,"react-dom":ot.default,"styled-components":lr})),n,o=!1,i;return ce[e]?n=ce[e]:[o,i,n]=(0,it.createUseRemoteComponent)({requires:r})(e),!ce[e]&&!o&&!i&&n&&(ce[e]=n),(0,$.jsxs)($.Fragment,{children:[!o&&!i&&(0,$.jsx)(n,g({},t)),i&&i]})};var at=require("react"),st=require("ag-common/dist/common/helpers/log");var le=require("react/jsx-runtime"),dr=e=>{let{analyticaToken:t,overrideBaseUrl:r,devMode:n}=(0,at.useContext)(P);if(!t)return(0,st.warn)(x("Feedback")),(0,le.jsx)(le.Fragment,{});let o=m(g({},e),{submitFeedback:re,analyticaToken:t,overrideBaseUrl:r}),i="https://cdn.analytica.click/feedback.js";return n&&(i="/feedback.js"),(0,le.jsx)(ke,{url:i,props:o})};var ct=k(require("aws-sdk/clients/cognitoidentity"));function de(r){return y(this,arguments,function*({user:e,config:t}){var f,E,u;if(!((f=e==null?void 0:e.jwt)!=null&&f.id_token)||!e.idJwt||!t.identityPool)return;let n=(E=e==null?void 0:e.jwt)==null?void 0:E.id_token,o={[e.idJwt.iss.replace("https://","")]:n},i=new ct.default({region:t.AWSRegion}),a=yield i.getId({IdentityPoolId:t.identityPool,Logins:o}).promise();if(!(a!=null&&a.IdentityId))return;let l={CustomRoleArn:(u=e.idJwt)==null?void 0:u["cognito:preferred_role"],IdentityId:a.IdentityId,Logins:o},{Credentials:c}=yield i.getCredentialsForIdentity(l).promise();return!(c!=null&&c.AccessKeyId)||!c.SecretKey||!c.SessionToken||!c.Expiration?void 0:{accessKeyId:c.AccessKeyId,sessionToken:c.SessionToken,secretAccessKey:c.SecretKey}})}var ue=e=>!(e!=null&&e.expires_at)||new Date().getTime()>e.expires_at,pe=({expires_in:e})=>new Date().getTime()+parseInt(`${e}000`,10);var ut=require("ag-common/dist/ui/helpers/axiosHelper"),ge=require("ag-common/dist/common/helpers/log"),pt=k(fe());function je(i){return y(this,arguments,function*({user:e,setUser:t,setError:r,config:n,logout:o}){var a,s;try{if(((a=e==null?void 0:e.jwt)==null?void 0:a.id_token)&&!ue(e==null?void 0:e.jwt))return e;let l=(s=e==null?void 0:e.jwt)==null?void 0:s.refresh_token;if(!l||!e){(0,ge.warn)("no refresh token, wipe"),o();return}let c=yield(0,ut.axiosHelper)({url:n.cognitoRefresh,verb:"post",body:(0,pt.stringify)({grant_type:"refresh_token",client_id:n.ClientId,refresh_token:l}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),p=m(g({},e),{jwt:m(g({},c.data),{refresh_token:l,expires_at:pe({expires_in:c.data.expires_in})})});return p.credentials=yield de({user:p,config:n}),t(p),p}catch(l){let c=l.toString();if(c.includes(400)||c.includes(401)||c.includes(403)){(0,ge.debug)("old refresh token, wipe"),t(void 0),r(void 0);return}r(l)}})}var ft=require("ag-common/dist/ui/helpers/axiosHelper"),gt=k(fe());function ht(o){return y(this,arguments,function*({code:e,setUser:t,redirectUrl:r,config:n}){try{let i=yield(0,ft.axiosHelper)({verb:"post",url:n.cognitoRefresh,body:(0,gt.stringify)({grant_type:"authorization_code",client_id:n.ClientId,code:e,redirect_uri:r}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}),a=m(g({},B(i.data.id_token)),{jwt:m(g({},i.data),{expires_at:pe({expires_in:i.data.expires_in})})});return n.identityPool&&(a.credentials=yield de({user:a,config:n})),t(a),!0}catch(i){}return!1})}var I=require("ag-common/dist/common/helpers/log"),S=k(require("react")),J=require("ag-common/dist/ui/helpers/useLocalStorage"),G=require("ag-common/dist/ui/helpers/cookie"),mt=k(fe()),yt=require("ag-common/dist/ui/helpers/useGranularHook");var Ar=require("react/jsx-runtime"),bt=S.default.createContext(void 0),yr=({redirectUrl:e,qs:t})=>{let r=e||"/";if(t!=null&&t.state)try{r.includes("?")?r+="&":r+="?",r+=`state=${t.state}`}catch(n){(0,I.warn)("bad state passed in")}return r},br=({config:e,children:t,goToPageUrl:r,location:n,redirectUrl:o=n.origin,onMessage:i,cookieDocument:a})=>{var ve,Te;let[s,l]=(0,S.useState)(),[c,p]=(0,G.useCookieString)({name:"id_token",cookieDocument:typeof window=="undefined"?a:void 0,defaultValue:""}),f=c;f&&!ne(f)&&((0,I.warn)("bad token, wiping"),(0,G.wipeCookies)("id_token"),f="");let E;f&&!(0,J.getLocalStorageItem)("user",void 0)&&(E=B(f));let[u,Tt]=(0,J.UseLocalStorage)("user",E),q=w=>{Tt(w)},[W,N]=(0,S.useState)(!1),h=(0,mt.extractQs)({search:typeof window=="undefined"?"":window.location.search,sanatise:!1}),Q=()=>y(void 0,null,function*(){(0,G.wipeCookies)("id_token"),(0,J.clearLocalStorageItem)("user"),p(""),q(void 0),l(void 0),N(!0),yield r({url:n.origin,login:!1}),N(!1)});(0,S.useEffect)(()=>{var F;let w=(F=u==null?void 0:u.jwt)==null?void 0:F.id_token;!!w&&w!==f&&p(w||"")},[f,p,u,(ve=u==null?void 0:u.jwt)==null?void 0:ve.id_token]);let Pt=w=>y(void 0,null,function*(){var Y;if(s||W||n.hash&&Object.keys(n.hash).length>0||n.search&&((Y=Object.keys(n.search))==null?void 0:Y.length)>0)return;N(!0);let F={back:n.pathname},R=e.vendToken+o;w&&(R+=`&state=${w}`),yield r({url:R,state:F,login:!0})});(0,yt.useGranularEffect)(()=>{function w(){return y(this,null,function*(){var Pe,Ce,xe,Ee;let F=!!(h!=null&&h.code)||!!(h!=null&&h.error),R=ue(u==null?void 0:u.jwt),Y=!(u!=null&&u.userId)&&!!(u!=null&&u.jwt);if(!(W||s||((Pe=u==null?void 0:u.idJwt)==null?void 0:Pe.email)&&!F&&!R))try{if(N(!0),h!=null&&h.error){let L={message:(h==null?void 0:h.error_description)||"auth error"};JSON.stringify(L||{})!==JSON.stringify(s||{})&&l(L);return}if((h==null?void 0:h.code)&&!R){yield r({url:o,login:!1});return}if(h!=null&&h.code){R&&(yield ht({code:h.code,redirectUrl:o,config:e,setUser:q})),yield r({url:yr({redirectUrl:o,qs:h}),login:!1});return}if(R&&((Ce=u==null?void 0:u.jwt)==null?void 0:Ce.refresh_token)){yield je({setUser:q,setError:l,user:u,config:e,logout:Q});return}if(Y){let L=(Ee=(xe=u==null?void 0:u.jwt)==null?void 0:xe.id_token)==null?void 0:Ee.substr(u.jwt.id_token.indexOf(" ")+1);!u||!L?((0,I.info)("logging out no token"),q(void 0),l(void 0)):q(m(g({},B(L)),{jwt:u.jwt,credentials:u.credentials}))}}finally{N(!1)}})}w()},[u==null?void 0:u.jwt,h],[e,s,r,Q,W,h,o,q,u]),(0,S.useEffect)(()=>{var w;s&&((0,I.error)(JSON.stringify(s)),i&&i(`error:${(w=s.response)==null?void 0:w.status}`,{appearance:"error"}))},[i,s]);let Ct={loading:!s&&(W||!!(h!=null&&h.code)),isAuthenticated:!s&&!!((Te=u==null?void 0:u.idJwt)!=null&&Te.email),refreshToken:()=>je({setUser:q,setError:l,user:u,config:e,logout:Q}),loginWithRedirect:Pt,logout:Q,error:s,user:u};return(0,Ar.jsx)(bt.Provider,{value:Ct,children:t})};var At=require("ag-common/dist/common/helpers/log"),Ot=require("ag-common/dist/common/helpers/string"),wt=require("ag-common/dist/ui/components/Loader"),kt=require("ag-common/dist/ui/helpers/useGranularHook"),jt=require("ag-common/dist/ui/helpers/useQueryString"),C=require("react/jsx-runtime"),vt=({rc:{request:e,pushPath:t},cac:{error:r,loginWithRedirect:n,logout:o,isAuthenticated:i,loading:a},getDashboardPath:s,getUnauthedPage:l,addToast:c})=>{if((0,kt.useGranularEffect)(()=>{if(r){let u=r.message.includes("email")?` We require the use of your email for the functionality of this app.
|
4
|
+
You can update your settings at https://www.facebook.com/settings?tab=applications`:"";c(`An Error has occured with your login attempt.${u}`,{appearance:"error"}),(0,At.error)("auth error:",JSON.stringify(r,null,2)),o()}},[r],[r,c,o]),Object.keys(e.url.query||{}).includes("login")){if(!i)return n(e.url.query.state),{render:(0,C.jsx)(C.Fragment,{}),openApiDisabled:!0};if(i)return t(s()),{render:(0,C.jsx)(C.Fragment,{}),openApiDisabled:!0}}if(e.url.query.state&&i){let u=JSON.parse((0,Ot.fromBase64)(e.url.query.state));if(u.redirect)return t(u.redirect),{render:(0,C.jsx)(C.Fragment,{}),openApiDisabled:!0}}let f=jt.isServer&&!r&&!a&&!i&&Object.keys(e.url.query||{}).includes("code");return a||f?{render:(0,C.jsx)(wt.Loader,{name:"authload"}),openApiDisabled:!0}:!i&&!a&&!r&&l?(t(l()),{render:(0,C.jsx)(C.Fragment,{}),openApiDisabled:!0}):{openApiDisabled:!i||a||!!r}};0&&(module.exports={AnalyticaConfigContext,AnalyticaConfigProvider,CognitoAuthContext,CognitoAuthProvider,DashboardAuthValidation,ErrorBoundary,ExternalComponent,Feedback,decodeIdToken,errorTrack,feedback,getUserFromIdToken,page,tokenMissing,track,useFeedback,useTrack});
|