@experian-ecs/connected-api-sdk 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/esm/index.mjs +193 -167
- package/dist/esm/index.mjs.map +1 -1
- package/dist/index.d.ts +73 -24
- package/dist/umd/index.umd.js +1 -1
- package/dist/umd/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* OTHER LIABILITY ARISING FROM OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var Tt = Object.defineProperty;
|
|
16
|
+
var gt = (r) => {
|
|
17
17
|
throw TypeError(r);
|
|
18
18
|
};
|
|
19
|
-
var ft = (r, t, e) => t in r ?
|
|
20
|
-
var u = (r, t, e) => ft(r, typeof t != "symbol" ? t + "" : t, e),
|
|
21
|
-
var a = (r, t, e) => (
|
|
19
|
+
var ft = (r, t, e) => t in r ? Tt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
20
|
+
var u = (r, t, e) => ft(r, typeof t != "symbol" ? t + "" : t, e), Y = (r, t, e) => t.has(r) || gt("Cannot " + e);
|
|
21
|
+
var a = (r, t, e) => (Y(r, t, "read from private field"), e ? e.call(r) : t.get(r)), d = (r, t, e) => t.has(r) ? gt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), L = (r, t, e, s) => (Y(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), p = (r, t, e) => (Y(r, t, "access private method"), e);
|
|
22
22
|
function At(r) {
|
|
23
23
|
switch (r.type) {
|
|
24
24
|
case "api_error":
|
|
@@ -26,9 +26,9 @@ function At(r) {
|
|
|
26
26
|
case "auth_error":
|
|
27
27
|
return new Pt(r);
|
|
28
28
|
case "sdk_error":
|
|
29
|
-
return new Ct(r);
|
|
30
|
-
default:
|
|
31
29
|
return new xt(r);
|
|
30
|
+
default:
|
|
31
|
+
return new Et(r);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
class A extends Error {
|
|
@@ -52,45 +52,45 @@ class Pt extends A {
|
|
|
52
52
|
super(t), this.name = "ConnectedSolutionsClientAuthError";
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
class
|
|
55
|
+
class Et extends A {
|
|
56
56
|
constructor(t) {
|
|
57
57
|
super(t), this.name = "ConnectedSolutionsClientUnknownError";
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
class
|
|
60
|
+
class xt extends A {
|
|
61
61
|
constructor(t) {
|
|
62
62
|
super(t), this.name = "ConnectedSolutionsClientSDKError";
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const $t = {
|
|
66
66
|
PRODUCTION: "https://connected-api.experian.com",
|
|
67
67
|
SANDBOX: "https://sandbox.connected-api.experian.com",
|
|
68
68
|
UAT: "https://uat-api.ecs.experian.com",
|
|
69
69
|
INTEGRATION: "https://integration-api.ecs.experian.com",
|
|
70
70
|
DEVELOPMENT: "https://dev-api.ecs.experian.com"
|
|
71
|
-
},
|
|
71
|
+
}, Ct = {
|
|
72
72
|
PRODUCTION: "https://unity-contentstack.integration.us-exp-api.experiancs.com",
|
|
73
73
|
SANDBOX: "https://unity-contentstack.dev.us-exp-api.experiancs.com",
|
|
74
74
|
UAT: "https://unity-contentstack.dev.us-exp-api.experiancs.com",
|
|
75
75
|
INTEGRATION: "https://unity-contentstack.dev.us-exp-api.experiancs.com",
|
|
76
76
|
DEVELOPMENT: "https://unity-contentstack.dev.us-exp-api.experiancs.com"
|
|
77
77
|
};
|
|
78
|
-
var
|
|
79
|
-
class
|
|
78
|
+
var W, O, mt;
|
|
79
|
+
class g {
|
|
80
80
|
constructor(t) {
|
|
81
|
-
d(this,
|
|
81
|
+
d(this, W);
|
|
82
82
|
u(this, "config");
|
|
83
83
|
u(this, "baseUrl", "");
|
|
84
84
|
u(this, "contentstackUrl", "");
|
|
85
85
|
const s = t.environment ?? "PRODUCTION";
|
|
86
|
-
this.config = t, this.baseUrl =
|
|
86
|
+
this.config = t, this.baseUrl = $t[s], this.contentstackUrl = Ct[s];
|
|
87
87
|
}
|
|
88
88
|
setConfig(t) {
|
|
89
89
|
"environment" in t && (this.config.environment = t.environment), "token" in t && (this.config.token = t.token);
|
|
90
90
|
}
|
|
91
91
|
async fetchWithAuth(t, e) {
|
|
92
92
|
try {
|
|
93
|
-
p(this,
|
|
93
|
+
p(this, W, O).call(this);
|
|
94
94
|
const s = typeof Headers < "u" && new Headers(e == null ? void 0 : e.headers);
|
|
95
95
|
s && !s.Authorization && s.set("Authorization", `Bearer ${this.config.token}`);
|
|
96
96
|
const n = {
|
|
@@ -113,28 +113,28 @@ class y {
|
|
|
113
113
|
async fetchRequest(t, e) {
|
|
114
114
|
var s;
|
|
115
115
|
try {
|
|
116
|
-
p(this,
|
|
116
|
+
p(this, W, O).call(this);
|
|
117
117
|
const n = await fetch(t, e);
|
|
118
118
|
if (!(n != null && n.ok)) {
|
|
119
119
|
let i;
|
|
120
|
-
const
|
|
120
|
+
const y = {
|
|
121
121
|
type: "api_error",
|
|
122
122
|
status: n == null ? void 0 : n.status,
|
|
123
123
|
message: n == null ? void 0 : n.statusText
|
|
124
124
|
};
|
|
125
125
|
if ((s = n == null ? void 0 : n.headers.get("content-type")) != null && s.includes("application/json")) {
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const _ = await n.clone().json();
|
|
127
|
+
y.data = _.error;
|
|
128
128
|
}
|
|
129
129
|
throw (n == null ? void 0 : n.status) === 401 ? i = {
|
|
130
|
-
...
|
|
130
|
+
...y,
|
|
131
131
|
type: "auth_error"
|
|
132
132
|
} : i = {
|
|
133
|
-
...
|
|
133
|
+
...y,
|
|
134
134
|
type: "api_error"
|
|
135
135
|
}, A.generateError(i);
|
|
136
136
|
}
|
|
137
|
-
return p(this,
|
|
137
|
+
return p(this, W, mt).call(this, n) ? {
|
|
138
138
|
data: await n.clone().json(),
|
|
139
139
|
error: void 0,
|
|
140
140
|
meta: {
|
|
@@ -162,7 +162,7 @@ class y {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
W = new WeakSet(), O = function() {
|
|
166
166
|
if (!this.config.token) {
|
|
167
167
|
const t = {
|
|
168
168
|
type: "sdk_error",
|
|
@@ -170,12 +170,12 @@ w = new WeakSet(), Z = function() {
|
|
|
170
170
|
};
|
|
171
171
|
throw A.generateError(t);
|
|
172
172
|
}
|
|
173
|
-
},
|
|
173
|
+
}, mt = function(t) {
|
|
174
174
|
var e, s;
|
|
175
175
|
return ((e = t == null ? void 0 : t.headers.get("content-type")) == null ? void 0 : e.includes("application/json")) || ((s = t == null ? void 0 : t.headers.get("content-type")) == null ? void 0 : s.includes("application/octet-stream"));
|
|
176
176
|
};
|
|
177
|
-
var
|
|
178
|
-
const
|
|
177
|
+
var J;
|
|
178
|
+
const k = class k extends g {
|
|
179
179
|
constructor(t) {
|
|
180
180
|
super(t);
|
|
181
181
|
}
|
|
@@ -184,14 +184,14 @@ const v = class v extends y {
|
|
|
184
184
|
...t != null && t.product_config_id ? { product_config_id: t.product_config_id } : {},
|
|
185
185
|
...t != null && t.include_factors ? { include_factors: t.include_factors.toString() } : {},
|
|
186
186
|
...t != null && t.include_ingredients ? { include_ingredients: t.include_ingredients.toString() } : {}
|
|
187
|
-
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(
|
|
187
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(k, J)}${o}`;
|
|
188
188
|
return this.fetchWithAuth(c, e);
|
|
189
189
|
}
|
|
190
190
|
async orderCreditScore(t, e) {
|
|
191
191
|
const s = {
|
|
192
192
|
...t != null && t.include_factors ? { include_factors: t.include_factors.toString() } : {},
|
|
193
193
|
...t != null && t.include_ingredients ? { include_ingredients: t.include_ingredients.toString() } : {}
|
|
194
|
-
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(
|
|
194
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(k, J)}?${o}`;
|
|
195
195
|
return this.fetchWithAuth(c, {
|
|
196
196
|
method: "POST",
|
|
197
197
|
headers: {
|
|
@@ -205,10 +205,10 @@ const v = class v extends y {
|
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
|
|
209
|
-
let
|
|
208
|
+
J = new WeakMap(), d(k, J, "/v1/credit/scores");
|
|
209
|
+
let tt = k;
|
|
210
210
|
var l;
|
|
211
|
-
const h = class h extends
|
|
211
|
+
const h = class h extends g {
|
|
212
212
|
constructor(t) {
|
|
213
213
|
super(t);
|
|
214
214
|
}
|
|
@@ -269,6 +269,13 @@ const h = class h extends y {
|
|
|
269
269
|
...e ?? {}
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
|
+
async deactivateEntitlement({ entitlement_id: t }, e) {
|
|
273
|
+
const s = `${this.baseUrl}${a(h, l)}/${t}/deactivate`;
|
|
274
|
+
return this.fetchWithAuth(s, {
|
|
275
|
+
method: "POST",
|
|
276
|
+
...e ?? {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
272
279
|
async entitleCustomerToNewProduct(t, e) {
|
|
273
280
|
const { product_config_id: s, entitlement_id: n, customer_id: o } = t, c = `${this.baseUrl}${a(h, l)}/${n}/products/${s}/activate`;
|
|
274
281
|
return this.fetchWithAuth(c, {
|
|
@@ -287,30 +294,44 @@ const h = class h extends y {
|
|
|
287
294
|
...e ?? {}
|
|
288
295
|
});
|
|
289
296
|
}
|
|
297
|
+
async deactivateProduct(t, e) {
|
|
298
|
+
const { product_config_id: s, entitlement_id: n } = t, o = `${this.baseUrl}${a(h, l)}/${n}/products/${s}/deactivate`;
|
|
299
|
+
return this.fetchWithAuth(o, {
|
|
300
|
+
method: "POST",
|
|
301
|
+
...e ?? {}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
async removeProductFromEntitlement(t, e) {
|
|
305
|
+
const { product_config_id: s, entitlement_id: n } = t, o = `${this.baseUrl}${a(h, l)}/${n}/products/${s}`;
|
|
306
|
+
return this.fetchWithAuth(o, {
|
|
307
|
+
method: "DELETE",
|
|
308
|
+
...e ?? {}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
290
311
|
async getProductEligibility(t, e) {
|
|
291
312
|
const s = new URLSearchParams(t).toString(), n = `${this.baseUrl}${a(h, l)}/eligibility?${s}`;
|
|
292
313
|
return this.fetchWithAuth(n, e);
|
|
293
314
|
}
|
|
294
315
|
};
|
|
295
316
|
l = new WeakMap(), d(h, l, "/v1/entitlements");
|
|
296
|
-
let
|
|
297
|
-
var
|
|
298
|
-
const
|
|
317
|
+
let et = h;
|
|
318
|
+
var G;
|
|
319
|
+
const H = class H extends g {
|
|
299
320
|
constructor(t) {
|
|
300
321
|
super(t);
|
|
301
322
|
}
|
|
302
323
|
async getCreditAttributes(t) {
|
|
303
|
-
const e = `${this.baseUrl}${a(
|
|
324
|
+
const e = `${this.baseUrl}${a(H, G)}`;
|
|
304
325
|
return this.fetchWithAuth(e, t);
|
|
305
326
|
}
|
|
306
327
|
};
|
|
307
|
-
|
|
328
|
+
G = new WeakMap(), /**
|
|
308
329
|
* Update the path below to the endpoint of the service you are adding
|
|
309
330
|
*/
|
|
310
|
-
d(
|
|
311
|
-
let
|
|
312
|
-
var
|
|
313
|
-
const
|
|
331
|
+
d(H, G, "/v1/credit/attributes");
|
|
332
|
+
let st = H;
|
|
333
|
+
var V;
|
|
334
|
+
const j = class j extends g {
|
|
314
335
|
constructor(t) {
|
|
315
336
|
super(t);
|
|
316
337
|
}
|
|
@@ -318,13 +339,13 @@ const k = class k extends y {
|
|
|
318
339
|
const s = {
|
|
319
340
|
...t,
|
|
320
341
|
...t != null && t.run_all ? { run_all: t.run_all.toString() } : {}
|
|
321
|
-
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(
|
|
342
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(j, V)}${o}`;
|
|
322
343
|
return this.fetchWithAuth(c, e);
|
|
323
344
|
}
|
|
324
345
|
async simulateScenario(t, e) {
|
|
325
346
|
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "";
|
|
326
347
|
return this.fetchWithAuth(
|
|
327
|
-
`${this.baseUrl}${a(
|
|
348
|
+
`${this.baseUrl}${a(j, V)}${c}`,
|
|
328
349
|
{
|
|
329
350
|
method: "POST",
|
|
330
351
|
headers: {
|
|
@@ -337,21 +358,21 @@ const k = class k extends y {
|
|
|
337
358
|
);
|
|
338
359
|
}
|
|
339
360
|
};
|
|
340
|
-
|
|
341
|
-
let
|
|
342
|
-
var
|
|
343
|
-
const
|
|
361
|
+
V = new WeakMap(), d(j, V, "/v1/credit/tools/simulator");
|
|
362
|
+
let nt = j;
|
|
363
|
+
var R, z;
|
|
364
|
+
const S = class S extends g {
|
|
344
365
|
constructor(t) {
|
|
345
366
|
super(t);
|
|
346
367
|
}
|
|
347
368
|
async getCreditScorePlan(t, e) {
|
|
348
|
-
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(
|
|
369
|
+
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(S, R)}${n}`;
|
|
349
370
|
return this.fetchWithAuth(o, {
|
|
350
371
|
...e ?? {}
|
|
351
372
|
});
|
|
352
373
|
}
|
|
353
374
|
async createCreditScorePlan(t, e) {
|
|
354
|
-
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(
|
|
375
|
+
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(S, R)}${c}`;
|
|
355
376
|
return this.fetchWithAuth(i, {
|
|
356
377
|
method: "POST",
|
|
357
378
|
headers: {
|
|
@@ -363,14 +384,14 @@ const T = class T extends y {
|
|
|
363
384
|
});
|
|
364
385
|
}
|
|
365
386
|
async deleteCreditScorePlan(t, e) {
|
|
366
|
-
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(
|
|
387
|
+
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(S, R)}${n}`;
|
|
367
388
|
return this.fetchWithAuth(o, {
|
|
368
389
|
method: "DELETE",
|
|
369
390
|
...e ?? {}
|
|
370
391
|
});
|
|
371
392
|
}
|
|
372
393
|
async getCreditScorePlanRevisions(t, e) {
|
|
373
|
-
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(
|
|
394
|
+
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(S, R)}${a(S, z)}${c}`;
|
|
374
395
|
return this.fetchWithAuth(i, {
|
|
375
396
|
method: "POST",
|
|
376
397
|
body: JSON.stringify(n),
|
|
@@ -382,10 +403,10 @@ const T = class T extends y {
|
|
|
382
403
|
});
|
|
383
404
|
}
|
|
384
405
|
};
|
|
385
|
-
|
|
386
|
-
let
|
|
387
|
-
var
|
|
388
|
-
const
|
|
406
|
+
R = new WeakMap(), z = new WeakMap(), d(S, R, "/v1/credit/tools/planners"), d(S, z, "/revisions");
|
|
407
|
+
let rt = S;
|
|
408
|
+
var N;
|
|
409
|
+
const w = class w extends g {
|
|
389
410
|
constructor(t) {
|
|
390
411
|
super(t);
|
|
391
412
|
}
|
|
@@ -394,29 +415,29 @@ const C = class C extends y {
|
|
|
394
415
|
page_limit: "10",
|
|
395
416
|
next_page_token: "",
|
|
396
417
|
...t ?? {}
|
|
397
|
-
}, n = new URLSearchParams(s).toString(), o = `${this.baseUrl}${a(
|
|
418
|
+
}, n = new URLSearchParams(s).toString(), o = `${this.baseUrl}${a(w, N)}?${n}`;
|
|
398
419
|
return this.fetchWithAuth(o, e);
|
|
399
420
|
}
|
|
400
421
|
async getAlertById({ id: t }, e) {
|
|
401
|
-
const s = `${this.baseUrl}${a(
|
|
422
|
+
const s = `${this.baseUrl}${a(w, N)}/${t}`;
|
|
402
423
|
return this.fetchWithAuth(s, e);
|
|
403
424
|
}
|
|
404
425
|
async markAlertAsRead({ id: t }, e) {
|
|
405
|
-
const s = `${this.baseUrl}${a(
|
|
426
|
+
const s = `${this.baseUrl}${a(w, N)}/${t}/dispose`;
|
|
406
427
|
return this.fetchWithAuth(s, {
|
|
407
428
|
method: "PATCH",
|
|
408
429
|
...e ?? {}
|
|
409
430
|
});
|
|
410
431
|
}
|
|
411
432
|
async getAlertCounts(t) {
|
|
412
|
-
const e = `${this.baseUrl}${a(
|
|
433
|
+
const e = `${this.baseUrl}${a(w, N)}/counts`;
|
|
413
434
|
return this.fetchWithAuth(e, t);
|
|
414
435
|
}
|
|
415
436
|
};
|
|
416
|
-
|
|
417
|
-
let
|
|
437
|
+
N = new WeakMap(), d(w, N, "/v1/events-alerts");
|
|
438
|
+
let at = w;
|
|
418
439
|
var f;
|
|
419
|
-
const b = class b extends
|
|
440
|
+
const b = class b extends g {
|
|
420
441
|
constructor(t) {
|
|
421
442
|
super(t);
|
|
422
443
|
}
|
|
@@ -433,8 +454,8 @@ const b = class b extends y {
|
|
|
433
454
|
...o ?? {},
|
|
434
455
|
...s ? { latest_only: s.toString() } : {},
|
|
435
456
|
...n ? { report_read: n.toString() } : {}
|
|
436
|
-
}, i = new URLSearchParams(c).toString(),
|
|
437
|
-
return this.fetchWithAuth(
|
|
457
|
+
}, i = new URLSearchParams(c).toString(), y = i ? `?${i}` : "", C = `${this.baseUrl}${a(b, f)}/meta${y}`;
|
|
458
|
+
return this.fetchWithAuth(C, e);
|
|
438
459
|
}
|
|
439
460
|
async getReportMetaById(t, e) {
|
|
440
461
|
const { id: s, ...n } = t, o = new URLSearchParams(n).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(b, f)}/${s}/meta${c}`;
|
|
@@ -465,18 +486,18 @@ const b = class b extends y {
|
|
|
465
486
|
}
|
|
466
487
|
};
|
|
467
488
|
f = new WeakMap(), d(b, f, "/v1/credit/reports");
|
|
468
|
-
let
|
|
469
|
-
var
|
|
470
|
-
const
|
|
489
|
+
let ot = b;
|
|
490
|
+
var E;
|
|
491
|
+
const P = class P extends g {
|
|
471
492
|
constructor(t) {
|
|
472
493
|
super(t);
|
|
473
494
|
}
|
|
474
495
|
async getCustomerById(t, e) {
|
|
475
|
-
const s = `${this.baseUrl}${a(
|
|
496
|
+
const s = `${this.baseUrl}${a(P, E)}/${t.customer_id}`;
|
|
476
497
|
return this.fetchWithAuth(s, e);
|
|
477
498
|
}
|
|
478
499
|
async updateCustomer(t, e) {
|
|
479
|
-
const { customer_id: s, ...n } = t, o = `${this.baseUrl}${a(
|
|
500
|
+
const { customer_id: s, ...n } = t, o = `${this.baseUrl}${a(P, E)}/${s}`;
|
|
480
501
|
return this.fetchWithAuth(o, {
|
|
481
502
|
method: "PATCH",
|
|
482
503
|
headers: {
|
|
@@ -488,14 +509,14 @@ const U = class U extends y {
|
|
|
488
509
|
});
|
|
489
510
|
}
|
|
490
511
|
async deleteCustomer(t, e) {
|
|
491
|
-
const s = `${this.baseUrl}${a(
|
|
512
|
+
const s = `${this.baseUrl}${a(P, E)}/${t.customer_id}`;
|
|
492
513
|
return this.fetchWithAuth(s, {
|
|
493
514
|
method: "DELETE",
|
|
494
515
|
...e ?? {}
|
|
495
516
|
});
|
|
496
517
|
}
|
|
497
518
|
async createCustomer(t, e) {
|
|
498
|
-
const s = `${this.baseUrl}${a(
|
|
519
|
+
const s = `${this.baseUrl}${a(P, E)}`;
|
|
499
520
|
return this.fetchWithAuth(s, {
|
|
500
521
|
method: "POST",
|
|
501
522
|
headers: {
|
|
@@ -507,7 +528,7 @@ const U = class U extends y {
|
|
|
507
528
|
});
|
|
508
529
|
}
|
|
509
530
|
async searchCustomers(t, e) {
|
|
510
|
-
const { next_cursor: s = "", ...n } = t, o = `${this.baseUrl}${a(
|
|
531
|
+
const { next_cursor: s = "", ...n } = t, o = `${this.baseUrl}${a(P, E)}/search`;
|
|
511
532
|
return this.fetchWithAuth(o, {
|
|
512
533
|
method: "POST",
|
|
513
534
|
headers: {
|
|
@@ -519,19 +540,19 @@ const U = class U extends y {
|
|
|
519
540
|
});
|
|
520
541
|
}
|
|
521
542
|
};
|
|
522
|
-
|
|
523
|
-
let
|
|
524
|
-
var
|
|
525
|
-
const
|
|
543
|
+
E = new WeakMap(), d(P, E, "/v1/customers");
|
|
544
|
+
let it = P;
|
|
545
|
+
var q;
|
|
546
|
+
const D = class D extends g {
|
|
526
547
|
constructor(t) {
|
|
527
548
|
super(t);
|
|
528
549
|
}
|
|
529
550
|
async getAuthQuestions(t) {
|
|
530
|
-
const e = `${this.baseUrl}${a(
|
|
551
|
+
const e = `${this.baseUrl}${a(D, q)}/questions`;
|
|
531
552
|
return this.fetchWithAuth(e, t);
|
|
532
553
|
}
|
|
533
554
|
async submitAuthAnswers(t, e) {
|
|
534
|
-
const s = `${this.baseUrl}${a(
|
|
555
|
+
const s = `${this.baseUrl}${a(D, q)}/questions`;
|
|
535
556
|
return this.fetchWithAuth(s, {
|
|
536
557
|
method: "POST",
|
|
537
558
|
headers: {
|
|
@@ -543,15 +564,15 @@ const L = class L extends y {
|
|
|
543
564
|
});
|
|
544
565
|
}
|
|
545
566
|
};
|
|
546
|
-
|
|
547
|
-
let
|
|
548
|
-
var
|
|
549
|
-
const
|
|
567
|
+
q = new WeakMap(), d(D, q, "/v1/authentication");
|
|
568
|
+
let ct = D;
|
|
569
|
+
var X;
|
|
570
|
+
const Q = class Q extends g {
|
|
550
571
|
constructor(t) {
|
|
551
572
|
super(t);
|
|
552
573
|
}
|
|
553
574
|
async createRegistration(t, e) {
|
|
554
|
-
const s = `${this.baseUrl}${a(
|
|
575
|
+
const s = `${this.baseUrl}${a(Q, X)}`;
|
|
555
576
|
return this.fetchWithAuth(s, {
|
|
556
577
|
method: "POST",
|
|
557
578
|
headers: {
|
|
@@ -563,41 +584,46 @@ const X = class X extends y {
|
|
|
563
584
|
});
|
|
564
585
|
}
|
|
565
586
|
};
|
|
566
|
-
|
|
567
|
-
let
|
|
568
|
-
var
|
|
569
|
-
const
|
|
587
|
+
X = new WeakMap(), d(Q, X, "/v1/registrations");
|
|
588
|
+
let ut = Q;
|
|
589
|
+
var F;
|
|
590
|
+
const I = class I extends g {
|
|
570
591
|
constructor(t) {
|
|
571
592
|
super(t);
|
|
572
593
|
}
|
|
573
|
-
async getProductConfigs(t) {
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
594
|
+
async getProductConfigs(t, e) {
|
|
595
|
+
const { fromEntries: s, entries: n } = Object, { isArray: o } = Array, c = s(
|
|
596
|
+
n(t).filter(([_, U]) => U != null).map(([_, U]) => [
|
|
597
|
+
_,
|
|
598
|
+
o(U) ? U.join(",") : U.toString()
|
|
599
|
+
])
|
|
600
|
+
), i = new URLSearchParams(c).toString(), y = i ? `?${i}` : "", C = `${this.baseUrl}${a(I, F)}${y}`;
|
|
601
|
+
return this.fetchWithAuth(C, {
|
|
602
|
+
...e || {}
|
|
577
603
|
});
|
|
578
604
|
}
|
|
579
605
|
async getProductConfigById(t, e) {
|
|
580
|
-
const s = `${this.baseUrl}${a(
|
|
606
|
+
const s = `${this.baseUrl}${a(I, F)}/${t.product_config_id}`;
|
|
581
607
|
return this.fetchWithAuth(s, {
|
|
582
608
|
...e ?? {}
|
|
583
609
|
});
|
|
584
610
|
}
|
|
585
611
|
};
|
|
586
|
-
|
|
587
|
-
let
|
|
588
|
-
const
|
|
612
|
+
F = new WeakMap(), d(I, F, "/v1/product-configs");
|
|
613
|
+
let dt = I;
|
|
614
|
+
const Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
589
615
|
__proto__: null,
|
|
590
|
-
AlertsService:
|
|
591
|
-
CreditAttributesService:
|
|
592
|
-
CreditReportsService:
|
|
593
|
-
CreditScorePlannerService:
|
|
594
|
-
CreditScoreSimulatorService:
|
|
595
|
-
CreditScoresService:
|
|
596
|
-
CustomerAuthService:
|
|
597
|
-
CustomersService:
|
|
598
|
-
EntitlementsService:
|
|
599
|
-
ProductConfigsService:
|
|
600
|
-
RegistrationsService:
|
|
616
|
+
AlertsService: at,
|
|
617
|
+
CreditAttributesService: st,
|
|
618
|
+
CreditReportsService: ot,
|
|
619
|
+
CreditScorePlannerService: rt,
|
|
620
|
+
CreditScoreSimulatorService: nt,
|
|
621
|
+
CreditScoresService: tt,
|
|
622
|
+
CustomerAuthService: ct,
|
|
623
|
+
CustomersService: it,
|
|
624
|
+
EntitlementsService: et,
|
|
625
|
+
ProductConfigsService: dt,
|
|
626
|
+
RegistrationsService: ut
|
|
601
627
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
602
628
|
function _t(r) {
|
|
603
629
|
return `${r[0].toLowerCase()}${r.substring(1)}`.replace(
|
|
@@ -606,15 +632,15 @@ function _t(r) {
|
|
|
606
632
|
);
|
|
607
633
|
}
|
|
608
634
|
const wt = typeof process < "u" && process.versions && process.versions.node && typeof window > "u";
|
|
609
|
-
var
|
|
610
|
-
const
|
|
635
|
+
var $, v, M, m, pt, lt, St, bt;
|
|
636
|
+
const B = class B {
|
|
611
637
|
constructor(t) {
|
|
612
|
-
d(this,
|
|
638
|
+
d(this, m);
|
|
613
639
|
u(this, "config");
|
|
614
|
-
d(this,
|
|
615
|
-
d(this,
|
|
640
|
+
d(this, $);
|
|
641
|
+
d(this, v, null);
|
|
616
642
|
u(this, "baseUrl", "");
|
|
617
|
-
this.config = t, this.baseUrl =
|
|
643
|
+
this.config = t, this.baseUrl = $t[t.environment ?? "PRODUCTION"], L(this, $, /* @__PURE__ */ new Map());
|
|
618
644
|
}
|
|
619
645
|
async getAccessToken(t) {
|
|
620
646
|
if (!wt)
|
|
@@ -624,7 +650,7 @@ const I = class I {
|
|
|
624
650
|
});
|
|
625
651
|
try {
|
|
626
652
|
return {
|
|
627
|
-
data: await p(this,
|
|
653
|
+
data: await p(this, m, pt).call(this, t),
|
|
628
654
|
errors: void 0,
|
|
629
655
|
meta: {
|
|
630
656
|
status: 200,
|
|
@@ -643,25 +669,25 @@ const I = class I {
|
|
|
643
669
|
}
|
|
644
670
|
}
|
|
645
671
|
getCacheLength() {
|
|
646
|
-
return a(this,
|
|
672
|
+
return a(this, $).size;
|
|
647
673
|
}
|
|
648
674
|
clearCache() {
|
|
649
|
-
const t = `${this.baseUrl}${a(
|
|
675
|
+
const t = `${this.baseUrl}${a(B, M)}`, e = Array.from(a(this, $).keys()).filter(
|
|
650
676
|
(s) => s.includes(t)
|
|
651
677
|
);
|
|
652
678
|
for (const s of e)
|
|
653
|
-
a(this,
|
|
679
|
+
a(this, $).delete(s);
|
|
654
680
|
}
|
|
655
681
|
};
|
|
656
|
-
|
|
682
|
+
$ = new WeakMap(), v = new WeakMap(), M = new WeakMap(), m = new WeakSet(), pt = async function({
|
|
657
683
|
grantType: t,
|
|
658
684
|
clientId: e,
|
|
659
685
|
clientSecret: s,
|
|
660
686
|
customerId: n
|
|
661
687
|
}) {
|
|
662
|
-
var
|
|
663
|
-
p(this,
|
|
664
|
-
const o = `${this.baseUrl}${a(
|
|
688
|
+
var _;
|
|
689
|
+
p(this, m, St).call(this);
|
|
690
|
+
const o = `${this.baseUrl}${a(B, M)}`, c = {
|
|
665
691
|
method: "POST",
|
|
666
692
|
headers: { "content-type": "application/json" },
|
|
667
693
|
credentials: "include",
|
|
@@ -671,48 +697,48 @@ g = new WeakMap(), R = new WeakMap(), M = new WeakMap(), $ = new WeakSet(), mt =
|
|
|
671
697
|
client_secret: s,
|
|
672
698
|
partner_customer_id: n ?? ""
|
|
673
699
|
})
|
|
674
|
-
}, i = await p(this,
|
|
700
|
+
}, i = await p(this, m, bt).call(this, o, c);
|
|
675
701
|
if (i != null && i.ok) {
|
|
676
|
-
const
|
|
677
|
-
return a(this,
|
|
702
|
+
const K = await i.clone().json();
|
|
703
|
+
return a(this, v) === null && p(this, m, lt).call(this, K.expires_in), K;
|
|
678
704
|
}
|
|
679
|
-
let
|
|
680
|
-
const
|
|
705
|
+
let y;
|
|
706
|
+
const C = {
|
|
681
707
|
status: i == null ? void 0 : i.status,
|
|
682
708
|
message: (i == null ? void 0 : i.statusText) || "",
|
|
683
709
|
data: void 0
|
|
684
710
|
};
|
|
685
|
-
if ((i == null ? void 0 : i.status) === 401 ?
|
|
711
|
+
if ((i == null ? void 0 : i.status) === 401 ? y = {
|
|
686
712
|
type: "auth_error",
|
|
687
|
-
...
|
|
688
|
-
} :
|
|
713
|
+
...C
|
|
714
|
+
} : y = {
|
|
689
715
|
type: "api_error",
|
|
690
|
-
...
|
|
691
|
-
}, (
|
|
692
|
-
const
|
|
693
|
-
|
|
716
|
+
...C
|
|
717
|
+
}, (_ = i == null ? void 0 : i.headers.get("content-type")) != null && _.includes("application/json")) {
|
|
718
|
+
const K = await i.clone().json();
|
|
719
|
+
y.data = K.error;
|
|
694
720
|
}
|
|
695
|
-
throw A.generateError(
|
|
696
|
-
},
|
|
721
|
+
throw A.generateError(y);
|
|
722
|
+
}, lt = function(t) {
|
|
697
723
|
const e = (/* @__PURE__ */ new Date()).getTime(), s = 60 * 60 * 1e3, n = e + s, o = t === null ? t : new Date(n).valueOf();
|
|
698
|
-
|
|
699
|
-
},
|
|
700
|
-
const t = new Date(Date.now()), e = new Date(a(this,
|
|
701
|
-
Rt(t, e) && (p(this,
|
|
702
|
-
},
|
|
724
|
+
L(this, v, o);
|
|
725
|
+
}, St = function() {
|
|
726
|
+
const t = new Date(Date.now()), e = new Date(a(this, v) ?? Number.NaN);
|
|
727
|
+
Rt(t, e) && (p(this, m, lt).call(this, null), a(this, $).clear());
|
|
728
|
+
}, bt = async function(t, e) {
|
|
703
729
|
const s = `${t}${JSON.stringify(e || {})}`;
|
|
704
|
-
if (!a(this,
|
|
730
|
+
if (!a(this, $).has(s)) {
|
|
705
731
|
const n = fetch(t, e ?? {});
|
|
706
|
-
a(this,
|
|
732
|
+
a(this, $).set(s, n);
|
|
707
733
|
}
|
|
708
|
-
return await a(this,
|
|
709
|
-
}, d(
|
|
710
|
-
let
|
|
734
|
+
return await a(this, $).get(s);
|
|
735
|
+
}, d(B, M, "/v1/oauth2/token");
|
|
736
|
+
let ht = B;
|
|
711
737
|
function Rt(r, t) {
|
|
712
738
|
return r > t;
|
|
713
739
|
}
|
|
714
740
|
var x;
|
|
715
|
-
const
|
|
741
|
+
const T = class T extends g {
|
|
716
742
|
// constructor is private so that no other class can access it.
|
|
717
743
|
constructor(e) {
|
|
718
744
|
super(e);
|
|
@@ -728,42 +754,42 @@ const S = class S extends y {
|
|
|
728
754
|
u(this, "entitlements");
|
|
729
755
|
u(this, "productConfigs");
|
|
730
756
|
u(this, "registrations");
|
|
731
|
-
for (const s in
|
|
732
|
-
typeof
|
|
733
|
-
this.auth = new
|
|
757
|
+
for (const s in Z)
|
|
758
|
+
typeof Z[s] == "function" && (this[_t(s)] = new Z[s](e));
|
|
759
|
+
this.auth = new ht({
|
|
734
760
|
environment: e.environment
|
|
735
761
|
});
|
|
736
762
|
}
|
|
737
763
|
// new services go here
|
|
738
764
|
// The method is static as we need to access the method only through the class here
|
|
739
765
|
static getInstance(e) {
|
|
740
|
-
return a(
|
|
766
|
+
return a(T, x) || L(T, x, new T(e)), a(T, x);
|
|
741
767
|
}
|
|
742
768
|
static clearInstance() {
|
|
743
|
-
|
|
769
|
+
L(T, x, null);
|
|
744
770
|
}
|
|
745
771
|
};
|
|
746
|
-
x = new WeakMap(), d(
|
|
747
|
-
let
|
|
772
|
+
x = new WeakMap(), d(T, x, null);
|
|
773
|
+
let yt = T;
|
|
748
774
|
function vt(r) {
|
|
749
|
-
return
|
|
775
|
+
return yt.getInstance(r);
|
|
750
776
|
}
|
|
751
777
|
function Nt(r) {
|
|
752
778
|
return r.progress_status === "TARGET_NOT_MET" || r.progress_status === "COMPLETED";
|
|
753
779
|
}
|
|
754
|
-
function
|
|
780
|
+
function Lt(r) {
|
|
755
781
|
return Nt(r) || r.progress_status === "TARGET_SCORE_AND_PLAN_SET" || r.progress_status === "ON_TRACK" || r.progress_status === "OFF_TRACK";
|
|
756
782
|
}
|
|
757
|
-
function
|
|
783
|
+
function kt(r) {
|
|
758
784
|
return r.score_model.includes("VANTAGE");
|
|
759
785
|
}
|
|
760
786
|
function jt(r) {
|
|
761
787
|
return r.score_model.includes("FICO");
|
|
762
788
|
}
|
|
763
|
-
function
|
|
789
|
+
function Dt(r) {
|
|
764
790
|
return r.target_score !== void 0;
|
|
765
791
|
}
|
|
766
|
-
function
|
|
792
|
+
function It(r) {
|
|
767
793
|
return r.max_actions_per_plan !== void 0;
|
|
768
794
|
}
|
|
769
795
|
function Bt(r) {
|
|
@@ -775,13 +801,13 @@ function Jt(r) {
|
|
|
775
801
|
function Vt(r) {
|
|
776
802
|
return !!(r && "best_action" in r);
|
|
777
803
|
}
|
|
778
|
-
function
|
|
804
|
+
function qt(r) {
|
|
779
805
|
return !!(r && "simulated_score" in r);
|
|
780
806
|
}
|
|
781
807
|
function Ft(r) {
|
|
782
808
|
return !("simulated_score" in r);
|
|
783
809
|
}
|
|
784
|
-
function
|
|
810
|
+
function Mt(r) {
|
|
785
811
|
return !!(r && "slider_min_value" in r && "slider_max_value" in r);
|
|
786
812
|
}
|
|
787
813
|
function Kt(r) {
|
|
@@ -791,22 +817,22 @@ export {
|
|
|
791
817
|
Ut as ConnectedSolutionsClientApiError,
|
|
792
818
|
Pt as ConnectedSolutionsClientAuthError,
|
|
793
819
|
A as ConnectedSolutionsClientError,
|
|
794
|
-
|
|
795
|
-
|
|
820
|
+
xt as ConnectedSolutionsClientSDKError,
|
|
821
|
+
Et as ConnectedSolutionsClientUnknownError,
|
|
796
822
|
vt as createSDK,
|
|
797
823
|
vt as default,
|
|
798
824
|
jt as isFicoPlan,
|
|
799
825
|
Bt as isFicoRevision,
|
|
800
|
-
|
|
826
|
+
Dt as isFicoRevisionsRequest,
|
|
801
827
|
Ft as isFicoScenario,
|
|
802
|
-
|
|
828
|
+
Mt as isFicoScenarioVariation,
|
|
803
829
|
Vt as isFicoSimulator,
|
|
804
830
|
Nt as isPlanCompleted,
|
|
805
|
-
|
|
806
|
-
|
|
831
|
+
Lt as isPlanSet,
|
|
832
|
+
kt as isVantagePlan,
|
|
807
833
|
Jt as isVantageRevision,
|
|
808
|
-
|
|
809
|
-
|
|
834
|
+
It as isVantageRevisionsRequest,
|
|
835
|
+
qt as isVantageScenario,
|
|
810
836
|
Kt as isVantageScenarioVariation
|
|
811
837
|
};
|
|
812
838
|
//# sourceMappingURL=index.mjs.map
|