@experian-ecs/connected-api-sdk 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +12 -0
- package/LICENSE.txt +12 -0
- package/README.md +606 -0
- package/dist/esm/index.mjs +809 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.d.ts +1364 -0
- package/dist/umd/index.umd.js +16 -0
- package/dist/umd/index.umd.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2025 EXPERIAN. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This code is provided for inclusion in a website and is intended solely for execution by end
|
|
6
|
+
* users in web browsers or on an application server. Unauthorized modification, redistribution, or any other use is prohibited. This
|
|
7
|
+
* notice should be included with any use of this code.
|
|
8
|
+
*
|
|
9
|
+
* THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
10
|
+
* BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
11
|
+
* IN NO EVENT SHALL CSIDENTITY CORPORATION OR ITS AFFILIATES BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
12
|
+
* OTHER LIABILITY ARISING FROM OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var Tt = Object.defineProperty;
|
|
16
|
+
var yt = (r) => {
|
|
17
|
+
throw TypeError(r);
|
|
18
|
+
};
|
|
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), Q = (r, t, e) => t.has(r) || yt("Cannot " + e);
|
|
21
|
+
var a = (r, t, e) => (Q(r, t, "read from private field"), e ? e.call(r) : t.get(r)), d = (r, t, e) => t.has(r) ? yt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), W = (r, t, e, s) => (Q(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), p = (r, t, e) => (Q(r, t, "access private method"), e);
|
|
22
|
+
function Ut(r) {
|
|
23
|
+
switch (r.type) {
|
|
24
|
+
case "api_error":
|
|
25
|
+
return new At(r);
|
|
26
|
+
case "auth_error":
|
|
27
|
+
return new Pt(r);
|
|
28
|
+
case "sdk_error":
|
|
29
|
+
return new _t(r);
|
|
30
|
+
default:
|
|
31
|
+
return new Ct(r);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class U extends Error {
|
|
35
|
+
constructor(e) {
|
|
36
|
+
var s;
|
|
37
|
+
super(e.message);
|
|
38
|
+
u(this, "message");
|
|
39
|
+
u(this, "data");
|
|
40
|
+
u(this, "status");
|
|
41
|
+
this.message = ((s = e.data) == null ? void 0 : s.message) || e.message || "", this.data = e.data, this.status = e.status;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
u(U, "generateError", Ut);
|
|
45
|
+
class At extends U {
|
|
46
|
+
constructor(t) {
|
|
47
|
+
super(t), this.name = "ConnectedSolutionsClientApiError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class Pt extends U {
|
|
51
|
+
constructor(t) {
|
|
52
|
+
super(t), this.name = "ConnectedSolutionsClientAuthError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class Ct extends U {
|
|
56
|
+
constructor(t) {
|
|
57
|
+
super(t), this.name = "ConnectedSolutionsClientUnknownError";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class _t extends U {
|
|
61
|
+
constructor(t) {
|
|
62
|
+
super(t), this.name = "ConnectedSolutionsClientSDKError";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const gt = {
|
|
66
|
+
PRODUCTION: "https://api.ecs.experian.com",
|
|
67
|
+
SANDBOX: "https://sandbox-api.ecs.experian.com",
|
|
68
|
+
UAT: "https://uat-api.ecs.experian.com",
|
|
69
|
+
INTEGRATION: "https://integration-api.ecs.experian.com",
|
|
70
|
+
DEVELOPMENT: "https://dev-api.ecs.experian.com"
|
|
71
|
+
}, xt = {
|
|
72
|
+
PRODUCTION: "https://unity-contentstack.integration.us-exp-api.experiancs.com/",
|
|
73
|
+
SANDBOX: "https://unity-contentstack.dev.us-exp-api.experiancs.com/"
|
|
74
|
+
};
|
|
75
|
+
var E, Z, $t;
|
|
76
|
+
class y {
|
|
77
|
+
constructor(t) {
|
|
78
|
+
d(this, E);
|
|
79
|
+
u(this, "config");
|
|
80
|
+
u(this, "baseUrl", "");
|
|
81
|
+
u(this, "contentstackUrl", "");
|
|
82
|
+
const s = t.environment ?? "PRODUCTION";
|
|
83
|
+
this.config = t, this.baseUrl = gt[s], this.contentstackUrl = xt[s];
|
|
84
|
+
}
|
|
85
|
+
setConfig(t) {
|
|
86
|
+
"environment" in t && (this.config.environment = t.environment), "token" in t && (this.config.token = t.token);
|
|
87
|
+
}
|
|
88
|
+
async fetchWithAuth(t, e) {
|
|
89
|
+
try {
|
|
90
|
+
p(this, E, Z).call(this);
|
|
91
|
+
const s = typeof Headers < "u" && new Headers(e == null ? void 0 : e.headers);
|
|
92
|
+
s && !s.Authorization && s.set("Authorization", `Bearer ${this.config.token}`);
|
|
93
|
+
const n = {
|
|
94
|
+
...e,
|
|
95
|
+
headers: s || (e == null ? void 0 : e.headers) || {}
|
|
96
|
+
};
|
|
97
|
+
return await this.fetchRequest(t, n);
|
|
98
|
+
} catch (s) {
|
|
99
|
+
const n = s;
|
|
100
|
+
return {
|
|
101
|
+
data: void 0,
|
|
102
|
+
error: n,
|
|
103
|
+
meta: {
|
|
104
|
+
status: n.status ?? 500,
|
|
105
|
+
statusText: n.message ?? ""
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async fetchRequest(t, e) {
|
|
111
|
+
var s;
|
|
112
|
+
try {
|
|
113
|
+
p(this, E, Z).call(this);
|
|
114
|
+
const n = await fetch(t, e);
|
|
115
|
+
if (!(n != null && n.ok)) {
|
|
116
|
+
let i;
|
|
117
|
+
const m = {
|
|
118
|
+
type: "api_error",
|
|
119
|
+
status: n == null ? void 0 : n.status,
|
|
120
|
+
message: n == null ? void 0 : n.statusText
|
|
121
|
+
};
|
|
122
|
+
if ((s = n == null ? void 0 : n.headers.get("content-type")) != null && s.includes("application/json")) {
|
|
123
|
+
const M = await n.clone().json();
|
|
124
|
+
m.data = M.error;
|
|
125
|
+
}
|
|
126
|
+
throw (n == null ? void 0 : n.status) === 401 ? i = {
|
|
127
|
+
...m,
|
|
128
|
+
type: "auth_error"
|
|
129
|
+
} : i = {
|
|
130
|
+
...m,
|
|
131
|
+
type: "api_error"
|
|
132
|
+
}, U.generateError(i);
|
|
133
|
+
}
|
|
134
|
+
return p(this, E, $t).call(this, n) ? {
|
|
135
|
+
data: await n.clone().json(),
|
|
136
|
+
error: void 0,
|
|
137
|
+
meta: {
|
|
138
|
+
status: n.status,
|
|
139
|
+
statusText: n.statusText
|
|
140
|
+
}
|
|
141
|
+
} : {
|
|
142
|
+
data: void 0,
|
|
143
|
+
error: void 0,
|
|
144
|
+
meta: {
|
|
145
|
+
status: n.status,
|
|
146
|
+
statusText: n.statusText
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
} catch (n) {
|
|
150
|
+
const o = n;
|
|
151
|
+
return {
|
|
152
|
+
data: void 0,
|
|
153
|
+
error: o,
|
|
154
|
+
meta: {
|
|
155
|
+
status: o.status ?? 500,
|
|
156
|
+
statusText: o.message
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
E = new WeakSet(), Z = function() {
|
|
163
|
+
if (!this.config.token) {
|
|
164
|
+
const t = {
|
|
165
|
+
type: "sdk_error",
|
|
166
|
+
message: "You must first obtain and set a token before using an SDK method"
|
|
167
|
+
};
|
|
168
|
+
throw U.generateError(t);
|
|
169
|
+
}
|
|
170
|
+
}, $t = function(t) {
|
|
171
|
+
var e, s;
|
|
172
|
+
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"));
|
|
173
|
+
};
|
|
174
|
+
var I;
|
|
175
|
+
const v = class v extends y {
|
|
176
|
+
constructor(t) {
|
|
177
|
+
super(t);
|
|
178
|
+
}
|
|
179
|
+
async getCreditScores(t, e) {
|
|
180
|
+
const s = {
|
|
181
|
+
...t != null && t.product_config_id ? { product_config_id: t.product_config_id } : {},
|
|
182
|
+
...t != null && t.include_factors ? { include_factors: t.include_factors.toString() } : {},
|
|
183
|
+
...t != null && t.include_ingredients ? { include_ingredients: t.include_ingredients.toString() } : {}
|
|
184
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(v, I)}${o}`;
|
|
185
|
+
return this.fetchWithAuth(c, e);
|
|
186
|
+
}
|
|
187
|
+
async orderCreditScore(t, e) {
|
|
188
|
+
const s = {
|
|
189
|
+
...t != null && t.include_factors ? { include_factors: t.include_factors.toString() } : {},
|
|
190
|
+
...t != null && t.include_ingredients ? { include_ingredients: t.include_ingredients.toString() } : {}
|
|
191
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(v, I)}?${o}`;
|
|
192
|
+
return this.fetchWithAuth(c, {
|
|
193
|
+
method: "POST",
|
|
194
|
+
headers: {
|
|
195
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
196
|
+
"Content-Type": "application/json"
|
|
197
|
+
},
|
|
198
|
+
body: JSON.stringify({
|
|
199
|
+
product_config_id: t.product_config_id
|
|
200
|
+
}),
|
|
201
|
+
...e ?? {}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
I = new WeakMap(), d(v, I, "/v1/credit/scores");
|
|
206
|
+
let O = v;
|
|
207
|
+
var l;
|
|
208
|
+
const h = class h extends y {
|
|
209
|
+
constructor(t) {
|
|
210
|
+
super(t);
|
|
211
|
+
}
|
|
212
|
+
async getEntitlements(t, e) {
|
|
213
|
+
return this.fetchWithAuth(
|
|
214
|
+
`${this.baseUrl}${a(h, l)}?customer_id=${t.customer_id}`,
|
|
215
|
+
e
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
async getEntitlementById({ entitlement_id: t }, e) {
|
|
219
|
+
return this.fetchWithAuth(
|
|
220
|
+
`${this.baseUrl}${a(h, l)}/${t}`,
|
|
221
|
+
e
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
async createEntitlement(t, e) {
|
|
225
|
+
return this.fetchWithAuth(
|
|
226
|
+
`${this.baseUrl}${a(h, l)}`,
|
|
227
|
+
{
|
|
228
|
+
method: "POST",
|
|
229
|
+
headers: {
|
|
230
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
231
|
+
"Content-Type": "application/json"
|
|
232
|
+
},
|
|
233
|
+
body: JSON.stringify(t),
|
|
234
|
+
...e ?? {}
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
async updateEntitlement(t, e) {
|
|
239
|
+
const { entitlement_id: s, ...n } = t;
|
|
240
|
+
return this.fetchWithAuth(
|
|
241
|
+
`${this.baseUrl}${a(h, l)}/${s}`,
|
|
242
|
+
{
|
|
243
|
+
method: "PUT",
|
|
244
|
+
headers: {
|
|
245
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
246
|
+
"Content-Type": "application/json"
|
|
247
|
+
},
|
|
248
|
+
body: JSON.stringify(n),
|
|
249
|
+
...e ?? {}
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
async deleteEntitlement({ entitlement_id: t }, e) {
|
|
254
|
+
return this.fetchWithAuth(
|
|
255
|
+
`${this.baseUrl}${a(h, l)}/${t}`,
|
|
256
|
+
{
|
|
257
|
+
method: "DELETE",
|
|
258
|
+
...e ?? {}
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
async activateEntitlement({ entitlement_id: t }, e) {
|
|
263
|
+
const s = `${this.baseUrl}${a(h, l)}/${t}/activate`;
|
|
264
|
+
return this.fetchWithAuth(s, {
|
|
265
|
+
method: "POST",
|
|
266
|
+
...e ?? {}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
async entitleCustomerToNewProduct(t, e) {
|
|
270
|
+
const { product_config_id: s, entitlement_id: n, customer_id: o } = t, c = `${this.baseUrl}${a(h, l)}/${n}/products/${s}/activate`;
|
|
271
|
+
return this.fetchWithAuth(c, {
|
|
272
|
+
method: "POST",
|
|
273
|
+
...e ?? {},
|
|
274
|
+
headers: {
|
|
275
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
276
|
+
"X-Customer-ID": o
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async activateProduct(t, e) {
|
|
281
|
+
const { product_config_id: s, entitlement_id: n } = t, o = `${this.baseUrl}${a(h, l)}/${n}/products/${s}/activate`;
|
|
282
|
+
return this.fetchWithAuth(o, {
|
|
283
|
+
method: "POST",
|
|
284
|
+
...e ?? {}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
async getProductEligibility(t, e) {
|
|
288
|
+
const s = new URLSearchParams(t).toString(), n = `${this.baseUrl}${a(h, l)}/eligibility?${s}`;
|
|
289
|
+
return this.fetchWithAuth(n, e);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
l = new WeakMap(), d(h, l, "/v1/entitlements");
|
|
293
|
+
let tt = h;
|
|
294
|
+
var K;
|
|
295
|
+
const G = class G extends y {
|
|
296
|
+
constructor(t) {
|
|
297
|
+
super(t);
|
|
298
|
+
}
|
|
299
|
+
async getCreditAttributes(t) {
|
|
300
|
+
const e = `${this.baseUrl}${a(G, K)}`;
|
|
301
|
+
return this.fetchWithAuth(e, t);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
K = new WeakMap(), /**
|
|
305
|
+
* Update the path below to the endpoint of the service you are adding
|
|
306
|
+
*/
|
|
307
|
+
d(G, K, "/v1/credit/attributes");
|
|
308
|
+
let et = G;
|
|
309
|
+
var B;
|
|
310
|
+
const L = class L extends y {
|
|
311
|
+
constructor(t) {
|
|
312
|
+
super(t);
|
|
313
|
+
}
|
|
314
|
+
async getSimulations(t, e) {
|
|
315
|
+
const s = {
|
|
316
|
+
...t,
|
|
317
|
+
...t != null && t.run_all ? { run_all: t.run_all.toString() } : {}
|
|
318
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(L, B)}${o}`;
|
|
319
|
+
return this.fetchWithAuth(c, e);
|
|
320
|
+
}
|
|
321
|
+
async simulateScenario(t, e) {
|
|
322
|
+
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "";
|
|
323
|
+
return this.fetchWithAuth(
|
|
324
|
+
`${this.baseUrl}${a(L, B)}${c}`,
|
|
325
|
+
{
|
|
326
|
+
method: "POST",
|
|
327
|
+
headers: {
|
|
328
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
329
|
+
"Content-Type": "application/json"
|
|
330
|
+
},
|
|
331
|
+
body: JSON.stringify(n),
|
|
332
|
+
...e ?? {}
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
B = new WeakMap(), d(L, B, "/v1/credit/tools/simulator");
|
|
338
|
+
let st = L;
|
|
339
|
+
var x, H;
|
|
340
|
+
const b = class b extends y {
|
|
341
|
+
constructor(t) {
|
|
342
|
+
super(t);
|
|
343
|
+
}
|
|
344
|
+
async getCreditScorePlan(t, e) {
|
|
345
|
+
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(b, x)}${n}`;
|
|
346
|
+
return this.fetchWithAuth(o, {
|
|
347
|
+
...e ?? {}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
async createCreditScorePlan(t, e) {
|
|
351
|
+
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(b, x)}${c}`;
|
|
352
|
+
return this.fetchWithAuth(i, {
|
|
353
|
+
method: "POST",
|
|
354
|
+
headers: {
|
|
355
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
356
|
+
"Content-Type": "application/json"
|
|
357
|
+
},
|
|
358
|
+
body: JSON.stringify(n),
|
|
359
|
+
...e ?? {}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
async deleteCreditScorePlan(t, e) {
|
|
363
|
+
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(b, x)}${n}`;
|
|
364
|
+
return this.fetchWithAuth(o, {
|
|
365
|
+
method: "DELETE",
|
|
366
|
+
...e ?? {}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
async getCreditScorePlanRevisions(t, e) {
|
|
370
|
+
const { product_config_id: s, ...n } = t, o = new URLSearchParams({ product_config_id: s }).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(b, x)}${a(b, H)}${c}`;
|
|
371
|
+
return this.fetchWithAuth(i, {
|
|
372
|
+
method: "POST",
|
|
373
|
+
body: JSON.stringify(n),
|
|
374
|
+
headers: {
|
|
375
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
376
|
+
"Content-Type": "application/json"
|
|
377
|
+
},
|
|
378
|
+
...e ?? {}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
x = new WeakMap(), H = new WeakMap(), d(b, x, "/v1/credit/tools/planners"), d(b, H, "/revisions");
|
|
383
|
+
let nt = b;
|
|
384
|
+
var w;
|
|
385
|
+
const _ = class _ extends y {
|
|
386
|
+
constructor(t) {
|
|
387
|
+
super(t);
|
|
388
|
+
}
|
|
389
|
+
async getAlerts(t, e) {
|
|
390
|
+
const s = {
|
|
391
|
+
page_limit: "10",
|
|
392
|
+
next_page_token: "",
|
|
393
|
+
...t ?? {}
|
|
394
|
+
}, n = new URLSearchParams(s).toString(), o = `${this.baseUrl}${a(_, w)}?${n}`;
|
|
395
|
+
return this.fetchWithAuth(o, e);
|
|
396
|
+
}
|
|
397
|
+
async getAlertById({ id: t }, e) {
|
|
398
|
+
const s = `${this.baseUrl}${a(_, w)}/${t}`;
|
|
399
|
+
return this.fetchWithAuth(s, e);
|
|
400
|
+
}
|
|
401
|
+
async markAlertAsRead({ id: t }, e) {
|
|
402
|
+
const s = `${this.baseUrl}${a(_, w)}/${t}/dispose`;
|
|
403
|
+
return this.fetchWithAuth(s, {
|
|
404
|
+
method: "PATCH",
|
|
405
|
+
...e ?? {}
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
async getAlertCounts(t) {
|
|
409
|
+
const e = `${this.baseUrl}${a(_, w)}/counts`;
|
|
410
|
+
return this.fetchWithAuth(e, t);
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
w = new WeakMap(), d(_, w, "/v1/events-alerts");
|
|
414
|
+
let rt = _;
|
|
415
|
+
var f;
|
|
416
|
+
const S = class S extends y {
|
|
417
|
+
constructor(t) {
|
|
418
|
+
super(t);
|
|
419
|
+
}
|
|
420
|
+
async getReports(t, e) {
|
|
421
|
+
const s = new URLSearchParams(t).toString(), n = s ? `?${s}` : "", o = `${this.baseUrl}${a(S, f)}${n}`;
|
|
422
|
+
return this.fetchWithAuth(o, e);
|
|
423
|
+
}
|
|
424
|
+
async getReportById(t, e) {
|
|
425
|
+
const { id: s, ...n } = t, o = new URLSearchParams(n).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(S, f)}/${t.id}${c}`;
|
|
426
|
+
return this.fetchWithAuth(i, e);
|
|
427
|
+
}
|
|
428
|
+
async getReportsMeta(t, e) {
|
|
429
|
+
const { latest_only: s, report_read: n, ...o } = t ?? {}, c = {
|
|
430
|
+
...o ?? {},
|
|
431
|
+
...s ? { latest_only: s.toString() } : {},
|
|
432
|
+
...n ? { report_read: n.toString() } : {}
|
|
433
|
+
}, i = new URLSearchParams(c).toString(), m = i ? `?${i}` : "", N = `${this.baseUrl}${a(S, f)}/meta${m}`;
|
|
434
|
+
return this.fetchWithAuth(N, e);
|
|
435
|
+
}
|
|
436
|
+
async getReportMetaById(t, e) {
|
|
437
|
+
const { id: s, ...n } = t, o = new URLSearchParams(n).toString(), c = o ? `?${o}` : "", i = `${this.baseUrl}${a(S, f)}/${s}/meta${c}`;
|
|
438
|
+
return this.fetchWithAuth(i, e);
|
|
439
|
+
}
|
|
440
|
+
async markReportAsRead(t, e) {
|
|
441
|
+
const s = `${this.baseUrl}${a(S, f)}/${t.id}/read`;
|
|
442
|
+
return this.fetchWithAuth(s, {
|
|
443
|
+
method: "PUT",
|
|
444
|
+
...e ?? {}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
async orderReport(t, e) {
|
|
448
|
+
const s = {
|
|
449
|
+
...t.include_fields ? { include_fields: t.include_fields.toString() } : {}
|
|
450
|
+
}, n = new URLSearchParams(s).toString(), o = n ? `?${n}` : "", c = `${this.baseUrl}${a(S, f)}${o}`;
|
|
451
|
+
return this.fetchWithAuth(c, {
|
|
452
|
+
method: "POST",
|
|
453
|
+
headers: {
|
|
454
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
455
|
+
"Content-Type": "application/json"
|
|
456
|
+
},
|
|
457
|
+
body: JSON.stringify({
|
|
458
|
+
product_config_id: t.product_config_id
|
|
459
|
+
}),
|
|
460
|
+
...e ?? {}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
f = new WeakMap(), d(S, f, "/v1/credit/reports");
|
|
465
|
+
let at = S;
|
|
466
|
+
var P;
|
|
467
|
+
const A = class A extends y {
|
|
468
|
+
constructor(t) {
|
|
469
|
+
super(t);
|
|
470
|
+
}
|
|
471
|
+
async getCustomerById(t, e) {
|
|
472
|
+
const s = `${this.baseUrl}${a(A, P)}/${t.customer_id}`;
|
|
473
|
+
return this.fetchWithAuth(s, e);
|
|
474
|
+
}
|
|
475
|
+
async updateCustomer(t, e) {
|
|
476
|
+
const { customer_id: s, ...n } = t, o = `${this.baseUrl}${a(A, P)}/${s}`;
|
|
477
|
+
return this.fetchWithAuth(o, {
|
|
478
|
+
method: "PATCH",
|
|
479
|
+
headers: {
|
|
480
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
481
|
+
"Content-Type": "application/json"
|
|
482
|
+
},
|
|
483
|
+
body: JSON.stringify(n ?? {}),
|
|
484
|
+
...e ?? {}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
async deleteCustomer(t, e) {
|
|
488
|
+
const s = `${this.baseUrl}${a(A, P)}/${t.customer_id}`;
|
|
489
|
+
return this.fetchWithAuth(s, {
|
|
490
|
+
method: "DELETE",
|
|
491
|
+
...e ?? {}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
async createCustomer(t, e) {
|
|
495
|
+
const s = `${this.baseUrl}${a(A, P)}`;
|
|
496
|
+
return this.fetchWithAuth(s, {
|
|
497
|
+
method: "POST",
|
|
498
|
+
headers: {
|
|
499
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
500
|
+
"Content-Type": "application/json"
|
|
501
|
+
},
|
|
502
|
+
body: JSON.stringify(t ?? {}),
|
|
503
|
+
...e ?? {}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
async searchCustomers(t, e) {
|
|
507
|
+
const { next_cursor: s = "", ...n } = t, o = `${this.baseUrl}${a(A, P)}/search`;
|
|
508
|
+
return this.fetchWithAuth(o, {
|
|
509
|
+
method: "POST",
|
|
510
|
+
headers: {
|
|
511
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
512
|
+
"Content-Type": "application/json"
|
|
513
|
+
},
|
|
514
|
+
body: JSON.stringify({ next_cursor: s, ...n ?? {} }),
|
|
515
|
+
...e ?? {}
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
P = new WeakMap(), d(A, P, "/v1/customers");
|
|
520
|
+
let ot = A;
|
|
521
|
+
var J;
|
|
522
|
+
const j = class j extends y {
|
|
523
|
+
constructor(t) {
|
|
524
|
+
super(t);
|
|
525
|
+
}
|
|
526
|
+
async getAuthQuestions(t) {
|
|
527
|
+
const e = `${this.baseUrl}${a(j, J)}/questions`;
|
|
528
|
+
return this.fetchWithAuth(e, t);
|
|
529
|
+
}
|
|
530
|
+
async submitAuthAnswers(t, e) {
|
|
531
|
+
const s = `${this.baseUrl}${a(j, J)}/questions`;
|
|
532
|
+
return this.fetchWithAuth(s, {
|
|
533
|
+
method: "POST",
|
|
534
|
+
headers: {
|
|
535
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
536
|
+
"Content-Type": "application/json"
|
|
537
|
+
},
|
|
538
|
+
body: JSON.stringify(t),
|
|
539
|
+
...e ?? {}
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
J = new WeakMap(), d(j, J, "/v1/authentication");
|
|
544
|
+
let it = j;
|
|
545
|
+
var z;
|
|
546
|
+
const X = class X extends y {
|
|
547
|
+
constructor(t) {
|
|
548
|
+
super(t);
|
|
549
|
+
}
|
|
550
|
+
async createRegistration(t, e) {
|
|
551
|
+
const s = `${this.baseUrl}${a(X, z)}`;
|
|
552
|
+
return this.fetchWithAuth(s, {
|
|
553
|
+
method: "POST",
|
|
554
|
+
headers: {
|
|
555
|
+
...(e == null ? void 0 : e.headers) ?? {},
|
|
556
|
+
"Content-Type": "application/json"
|
|
557
|
+
},
|
|
558
|
+
body: JSON.stringify(t ?? {}),
|
|
559
|
+
...e ?? {}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
z = new WeakMap(), d(X, z, "/v1/registrations");
|
|
564
|
+
let ct = X;
|
|
565
|
+
var V;
|
|
566
|
+
const k = class k extends y {
|
|
567
|
+
constructor(t) {
|
|
568
|
+
super(t);
|
|
569
|
+
}
|
|
570
|
+
async getProductConfigs(t) {
|
|
571
|
+
const e = `${this.baseUrl}${a(k, V)}`;
|
|
572
|
+
return this.fetchWithAuth(e, {
|
|
573
|
+
...t || {}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
async getProductConfigById(t, e) {
|
|
577
|
+
const s = `${this.baseUrl}${a(k, V)}/${t.product_config_id}`;
|
|
578
|
+
return this.fetchWithAuth(s, {
|
|
579
|
+
...e ?? {}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
V = new WeakMap(), d(k, V, "/v1/product-configs");
|
|
584
|
+
let ut = k;
|
|
585
|
+
const Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
586
|
+
__proto__: null,
|
|
587
|
+
AlertsService: rt,
|
|
588
|
+
CreditAttributesService: et,
|
|
589
|
+
CreditReportsService: at,
|
|
590
|
+
CreditScorePlannerService: nt,
|
|
591
|
+
CreditScoreSimulatorService: st,
|
|
592
|
+
CreditScoresService: O,
|
|
593
|
+
CustomerAuthService: it,
|
|
594
|
+
CustomersService: ot,
|
|
595
|
+
EntitlementsService: tt,
|
|
596
|
+
ProductConfigsService: ut,
|
|
597
|
+
RegistrationsService: ct
|
|
598
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
599
|
+
function wt(r) {
|
|
600
|
+
return `${r[0].toLowerCase()}${r.substring(1)}`.replace(
|
|
601
|
+
"Service",
|
|
602
|
+
""
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
const Et = typeof process < "u" && process.versions && process.versions.node && typeof window > "u";
|
|
606
|
+
var g, R, F, $, mt, ht, pt, bt;
|
|
607
|
+
const D = class D {
|
|
608
|
+
constructor(t) {
|
|
609
|
+
d(this, $);
|
|
610
|
+
u(this, "config");
|
|
611
|
+
d(this, g);
|
|
612
|
+
d(this, R, null);
|
|
613
|
+
u(this, "baseUrl", "");
|
|
614
|
+
this.config = t, this.baseUrl = gt[t.environment ?? "PRODUCTION"], W(this, g, /* @__PURE__ */ new Map());
|
|
615
|
+
}
|
|
616
|
+
async getAccessToken(t) {
|
|
617
|
+
if (!Et)
|
|
618
|
+
throw U.generateError({
|
|
619
|
+
type: "sdk_error",
|
|
620
|
+
message: "getAccessToken is not supported in browser"
|
|
621
|
+
});
|
|
622
|
+
try {
|
|
623
|
+
return {
|
|
624
|
+
data: await p(this, $, mt).call(this, t),
|
|
625
|
+
errors: void 0,
|
|
626
|
+
meta: {
|
|
627
|
+
status: 200,
|
|
628
|
+
statusText: "OK"
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
} catch (s) {
|
|
632
|
+
return this.clearCache(), {
|
|
633
|
+
data: void 0,
|
|
634
|
+
error: s,
|
|
635
|
+
meta: {
|
|
636
|
+
status: s.status,
|
|
637
|
+
statusText: s.message
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
getCacheLength() {
|
|
643
|
+
return a(this, g).size;
|
|
644
|
+
}
|
|
645
|
+
clearCache() {
|
|
646
|
+
const t = `${this.baseUrl}${a(D, F)}`, e = Array.from(a(this, g).keys()).filter(
|
|
647
|
+
(s) => s.includes(t)
|
|
648
|
+
);
|
|
649
|
+
for (const s of e)
|
|
650
|
+
a(this, g).delete(s);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
g = new WeakMap(), R = new WeakMap(), F = new WeakMap(), $ = new WeakSet(), mt = async function({
|
|
654
|
+
grantType: t,
|
|
655
|
+
clientId: e,
|
|
656
|
+
clientSecret: s,
|
|
657
|
+
customerId: n
|
|
658
|
+
}) {
|
|
659
|
+
var M;
|
|
660
|
+
p(this, $, pt).call(this);
|
|
661
|
+
const o = `${this.baseUrl}${a(D, F)}`, c = {
|
|
662
|
+
method: "POST",
|
|
663
|
+
headers: { "content-type": "application/json" },
|
|
664
|
+
credentials: "include",
|
|
665
|
+
body: JSON.stringify({
|
|
666
|
+
grant_type: t,
|
|
667
|
+
client_id: e,
|
|
668
|
+
client_secret: s,
|
|
669
|
+
partner_customer_id: n ?? ""
|
|
670
|
+
})
|
|
671
|
+
}, i = await p(this, $, bt).call(this, o, c);
|
|
672
|
+
if (i != null && i.ok) {
|
|
673
|
+
const q = await i.clone().json();
|
|
674
|
+
return a(this, R) === null && p(this, $, ht).call(this, q.expires_in), q;
|
|
675
|
+
}
|
|
676
|
+
let m;
|
|
677
|
+
const N = {
|
|
678
|
+
status: i == null ? void 0 : i.status,
|
|
679
|
+
message: (i == null ? void 0 : i.statusText) || "",
|
|
680
|
+
data: void 0
|
|
681
|
+
};
|
|
682
|
+
if ((i == null ? void 0 : i.status) === 401 ? m = {
|
|
683
|
+
type: "auth_error",
|
|
684
|
+
...N
|
|
685
|
+
} : m = {
|
|
686
|
+
type: "api_error",
|
|
687
|
+
...N
|
|
688
|
+
}, (M = i == null ? void 0 : i.headers.get("content-type")) != null && M.includes("application/json")) {
|
|
689
|
+
const q = await i.clone().json();
|
|
690
|
+
m.data = q.error;
|
|
691
|
+
}
|
|
692
|
+
throw U.generateError(m);
|
|
693
|
+
}, ht = function(t) {
|
|
694
|
+
const e = (/* @__PURE__ */ new Date()).getTime(), s = 60 * 60 * 1e3, n = e + s, o = t === null ? t : new Date(n).valueOf();
|
|
695
|
+
W(this, R, o);
|
|
696
|
+
}, pt = function() {
|
|
697
|
+
const t = new Date(Date.now()), e = new Date(a(this, R) ?? Number.NaN);
|
|
698
|
+
Rt(t, e) && (p(this, $, ht).call(this, null), a(this, g).clear());
|
|
699
|
+
}, bt = async function(t, e) {
|
|
700
|
+
const s = `${t}${JSON.stringify(e || {})}`;
|
|
701
|
+
if (!a(this, g).has(s)) {
|
|
702
|
+
const n = fetch(t, e ?? {});
|
|
703
|
+
a(this, g).set(s, n);
|
|
704
|
+
}
|
|
705
|
+
return await a(this, g).get(s);
|
|
706
|
+
}, d(D, F, "/v1/oauth2/token");
|
|
707
|
+
let dt = D;
|
|
708
|
+
function Rt(r, t) {
|
|
709
|
+
return r > t;
|
|
710
|
+
}
|
|
711
|
+
var C;
|
|
712
|
+
const T = class T extends y {
|
|
713
|
+
// constructor is private so that no other class can access it.
|
|
714
|
+
constructor(e) {
|
|
715
|
+
super(e);
|
|
716
|
+
u(this, "alerts");
|
|
717
|
+
u(this, "auth");
|
|
718
|
+
u(this, "creditReports");
|
|
719
|
+
u(this, "creditScores");
|
|
720
|
+
u(this, "creditAttributes");
|
|
721
|
+
u(this, "creditScorePlanner");
|
|
722
|
+
u(this, "creditScoreSimulator");
|
|
723
|
+
u(this, "customerAuth");
|
|
724
|
+
u(this, "customers");
|
|
725
|
+
u(this, "entitlements");
|
|
726
|
+
u(this, "productConfigs");
|
|
727
|
+
u(this, "registrations");
|
|
728
|
+
for (const s in Y)
|
|
729
|
+
typeof Y[s] == "function" && (this[wt(s)] = new Y[s](e));
|
|
730
|
+
this.auth = new dt({
|
|
731
|
+
environment: e.environment
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
// new services go here
|
|
735
|
+
// The method is static as we need to access the method only through the class here
|
|
736
|
+
static getInstance(e) {
|
|
737
|
+
return a(T, C) || W(T, C, new T(e)), a(T, C);
|
|
738
|
+
}
|
|
739
|
+
static clearInstance() {
|
|
740
|
+
W(T, C, null);
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
C = new WeakMap(), d(T, C, null);
|
|
744
|
+
let lt = T;
|
|
745
|
+
function vt(r) {
|
|
746
|
+
return lt.getInstance(r);
|
|
747
|
+
}
|
|
748
|
+
function Nt(r) {
|
|
749
|
+
return r.progress_status === "TARGET_NOT_MET" || r.progress_status === "COMPLETED";
|
|
750
|
+
}
|
|
751
|
+
function Lt(r) {
|
|
752
|
+
return Nt(r) || r.progress_status === "TARGET_SCORE_AND_PLAN_SET" || r.progress_status === "ON_TRACK" || r.progress_status === "OFF_TRACK";
|
|
753
|
+
}
|
|
754
|
+
function jt(r) {
|
|
755
|
+
return r.score_model.includes("VANTAGE");
|
|
756
|
+
}
|
|
757
|
+
function kt(r) {
|
|
758
|
+
return r.score_model.includes("FICO");
|
|
759
|
+
}
|
|
760
|
+
function Dt(r) {
|
|
761
|
+
return r.target_score !== void 0;
|
|
762
|
+
}
|
|
763
|
+
function It(r) {
|
|
764
|
+
return r.max_actions_per_plan !== void 0;
|
|
765
|
+
}
|
|
766
|
+
function Bt(r) {
|
|
767
|
+
return r.score_model.includes("FICO");
|
|
768
|
+
}
|
|
769
|
+
function Jt(r) {
|
|
770
|
+
return r.score_model.includes("VANTAGE");
|
|
771
|
+
}
|
|
772
|
+
function Vt(r) {
|
|
773
|
+
return !!(r && "best_action" in r);
|
|
774
|
+
}
|
|
775
|
+
function Ft(r) {
|
|
776
|
+
return !!(r && "simulated_score" in r);
|
|
777
|
+
}
|
|
778
|
+
function Mt(r) {
|
|
779
|
+
return !("simulated_score" in r);
|
|
780
|
+
}
|
|
781
|
+
function qt(r) {
|
|
782
|
+
return !!(r && "slider_min_value" in r && "slider_max_value" in r);
|
|
783
|
+
}
|
|
784
|
+
function Kt(r) {
|
|
785
|
+
return !!(r && "value" in r && "simulated_score" in r);
|
|
786
|
+
}
|
|
787
|
+
export {
|
|
788
|
+
At as ConnectedSolutionsClientApiError,
|
|
789
|
+
Pt as ConnectedSolutionsClientAuthError,
|
|
790
|
+
U as ConnectedSolutionsClientError,
|
|
791
|
+
_t as ConnectedSolutionsClientSDKError,
|
|
792
|
+
Ct as ConnectedSolutionsClientUnknownError,
|
|
793
|
+
vt as createSDK,
|
|
794
|
+
vt as default,
|
|
795
|
+
kt as isFicoPlan,
|
|
796
|
+
Bt as isFicoRevision,
|
|
797
|
+
Dt as isFicoRevisionsRequest,
|
|
798
|
+
Mt as isFicoScenario,
|
|
799
|
+
qt as isFicoScenarioVariation,
|
|
800
|
+
Vt as isFicoSimulator,
|
|
801
|
+
Nt as isPlanCompleted,
|
|
802
|
+
Lt as isPlanSet,
|
|
803
|
+
jt as isVantagePlan,
|
|
804
|
+
Jt as isVantageRevision,
|
|
805
|
+
It as isVantageRevisionsRequest,
|
|
806
|
+
Ft as isVantageScenario,
|
|
807
|
+
Kt as isVantageScenarioVariation
|
|
808
|
+
};
|
|
809
|
+
//# sourceMappingURL=index.mjs.map
|