@compilot/js-sdk 2.141.0-dev → 2.143.0-dev
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/compilot-js-sdk.cjs.dev.cjs +210 -402
- package/dist/compilot-js-sdk.cjs.prod.cjs +210 -402
- package/dist/compilot-js-sdk.esm.mjs +210 -402
- package/dist/package.json +2 -2
- package/package.json +5 -5
|
@@ -8,274 +8,116 @@ import { WebhookEventPayload } from '@nexeraid/identity-schemas/webhooks';
|
|
|
8
8
|
export { AllNexeraEventTypes } from '@nexeraid/identity-schemas/webhooks';
|
|
9
9
|
import { Webhook } from 'svix';
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
return r;
|
|
14
|
-
};
|
|
15
|
-
var t,
|
|
16
|
-
r = {},
|
|
17
|
-
e = Object.prototype,
|
|
18
|
-
n = e.hasOwnProperty,
|
|
19
|
-
o = "function" == typeof Symbol ? Symbol : {},
|
|
20
|
-
i = o.iterator || "@@iterator",
|
|
21
|
-
a = o.asyncIterator || "@@asyncIterator",
|
|
22
|
-
u = o.toStringTag || "@@toStringTag";
|
|
23
|
-
function c(t, r, e, n) {
|
|
24
|
-
Object.defineProperty(t, r, {
|
|
25
|
-
value: e,
|
|
26
|
-
enumerable: !n,
|
|
27
|
-
configurable: !n,
|
|
28
|
-
writable: !n
|
|
29
|
-
});
|
|
30
|
-
}
|
|
11
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
12
|
+
var i = Object.defineProperty;
|
|
31
13
|
try {
|
|
32
|
-
|
|
33
|
-
} catch (
|
|
34
|
-
|
|
35
|
-
return t[r] = e;
|
|
36
|
-
};
|
|
14
|
+
i({}, "", {});
|
|
15
|
+
} catch (e) {
|
|
16
|
+
i = 0;
|
|
37
17
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
18
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
19
|
+
if (r) i ? i(e, r, {
|
|
20
|
+
value: n,
|
|
21
|
+
enumerable: !t,
|
|
22
|
+
configurable: !t,
|
|
23
|
+
writable: !t
|
|
24
|
+
}) : e[r] = n;else {
|
|
25
|
+
function o(r, n) {
|
|
26
|
+
_regeneratorDefine(e, r, function (e) {
|
|
27
|
+
return this._invoke(r, n, e);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
31
|
+
}
|
|
32
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _regenerator() {
|
|
36
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
37
|
+
var e,
|
|
38
|
+
t,
|
|
39
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
40
|
+
n = r.iterator || "@@iterator",
|
|
41
|
+
o = r.toStringTag || "@@toStringTag";
|
|
42
|
+
function i(r, n, o, i) {
|
|
43
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
44
|
+
u = Object.create(c.prototype);
|
|
45
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
46
|
+
var i,
|
|
47
|
+
c,
|
|
48
|
+
u,
|
|
49
|
+
f = 0,
|
|
50
|
+
p = o || [],
|
|
51
|
+
y = !1,
|
|
52
|
+
G = {
|
|
53
|
+
p: 0,
|
|
54
|
+
n: 0,
|
|
55
|
+
v: e,
|
|
56
|
+
a: d,
|
|
57
|
+
f: d.bind(e, 4),
|
|
58
|
+
d: function (t, r) {
|
|
59
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
};
|
|
62
|
+
function d(r, n) {
|
|
63
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
64
|
+
var o,
|
|
65
|
+
i = p[t],
|
|
66
|
+
d = G.p,
|
|
67
|
+
l = i[2];
|
|
68
|
+
r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
69
|
+
}
|
|
70
|
+
if (o || r > 1) return a;
|
|
71
|
+
throw y = !0, n;
|
|
72
|
+
}
|
|
73
|
+
return function (o, p, l) {
|
|
74
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
75
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
76
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
77
|
+
try {
|
|
78
|
+
if (f = 2, i) {
|
|
79
|
+
if (c || (o = "next"), t = i[o]) {
|
|
80
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
81
|
+
if (!t.done) return t;
|
|
82
|
+
u = t.value, c < 2 && (c = 0);
|
|
83
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
84
|
+
i = e;
|
|
85
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
86
|
+
} catch (t) {
|
|
87
|
+
i = e, c = 1, u = t;
|
|
88
|
+
} finally {
|
|
89
|
+
f = 1;
|
|
73
90
|
}
|
|
74
|
-
"throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
|
|
75
91
|
}
|
|
92
|
+
return {
|
|
93
|
+
value: t,
|
|
94
|
+
done: y
|
|
95
|
+
};
|
|
76
96
|
};
|
|
77
|
-
}(r,
|
|
78
|
-
}
|
|
79
|
-
function s(t, r, e) {
|
|
80
|
-
try {
|
|
81
|
-
return {
|
|
82
|
-
type: "normal",
|
|
83
|
-
arg: t.call(r, e)
|
|
84
|
-
};
|
|
85
|
-
} catch (t) {
|
|
86
|
-
return {
|
|
87
|
-
type: "throw",
|
|
88
|
-
arg: t
|
|
89
|
-
};
|
|
90
|
-
}
|
|
97
|
+
}(r, o, i), !0), u;
|
|
91
98
|
}
|
|
92
|
-
|
|
93
|
-
var f = {};
|
|
99
|
+
var a = {};
|
|
94
100
|
function Generator() {}
|
|
95
101
|
function GeneratorFunction() {}
|
|
96
102
|
function GeneratorFunctionPrototype() {}
|
|
97
|
-
|
|
98
|
-
c(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
|
|
105
|
-
function g(t) {
|
|
106
|
-
["next", "throw", "return"].forEach(function (r) {
|
|
107
|
-
c(t, r, function (t) {
|
|
108
|
-
return this._invoke(r, t);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
103
|
+
t = Object.getPrototypeOf;
|
|
104
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
105
|
+
return this;
|
|
106
|
+
}), t),
|
|
107
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
108
|
+
function f(e) {
|
|
109
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
function e(o, i, a, u) {
|
|
114
|
-
var c = s(t[o], t, i);
|
|
115
|
-
if ("throw" !== c.type) {
|
|
116
|
-
var h = c.arg,
|
|
117
|
-
f = h.value;
|
|
118
|
-
return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
|
|
119
|
-
e("next", t, a, u);
|
|
120
|
-
}, function (t) {
|
|
121
|
-
e("throw", t, a, u);
|
|
122
|
-
}) : r.resolve(f).then(function (t) {
|
|
123
|
-
h.value = t, a(h);
|
|
124
|
-
}, function (t) {
|
|
125
|
-
return e("throw", t, a, u);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
u(c.arg);
|
|
129
|
-
}
|
|
130
|
-
var o;
|
|
131
|
-
c(this, "_invoke", function (t, n) {
|
|
132
|
-
function i() {
|
|
133
|
-
return new r(function (r, o) {
|
|
134
|
-
e(t, n, r, o);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return o = o ? o.then(i, i) : i();
|
|
138
|
-
}, !0);
|
|
139
|
-
}
|
|
140
|
-
function d(r, e) {
|
|
141
|
-
var n = e.method,
|
|
142
|
-
o = r.i[n];
|
|
143
|
-
if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
|
|
144
|
-
var i = s(o, r.i, e.arg);
|
|
145
|
-
if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
|
|
146
|
-
var a = i.arg;
|
|
147
|
-
return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
|
|
148
|
-
}
|
|
149
|
-
function w(t) {
|
|
150
|
-
this.tryEntries.push(t);
|
|
151
|
-
}
|
|
152
|
-
function m(r) {
|
|
153
|
-
var e = r[4] || {};
|
|
154
|
-
e.type = "normal", e.arg = t, r[4] = e;
|
|
155
|
-
}
|
|
156
|
-
function Context(t) {
|
|
157
|
-
this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
|
|
158
|
-
}
|
|
159
|
-
function x(r) {
|
|
160
|
-
if (null != r) {
|
|
161
|
-
var e = r[i];
|
|
162
|
-
if (e) return e.call(r);
|
|
163
|
-
if ("function" == typeof r.next) return r;
|
|
164
|
-
if (!isNaN(r.length)) {
|
|
165
|
-
var o = -1,
|
|
166
|
-
a = function e() {
|
|
167
|
-
for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
|
|
168
|
-
return e.value = t, e.done = !0, e;
|
|
169
|
-
};
|
|
170
|
-
return a.next = a;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
throw new TypeError(typeof r + " is not iterable");
|
|
174
|
-
}
|
|
175
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) {
|
|
176
|
-
var r = "function" == typeof t && t.constructor;
|
|
177
|
-
return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
|
|
178
|
-
}, r.mark = function (t) {
|
|
179
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
|
|
180
|
-
}, r.awrap = function (t) {
|
|
181
|
-
return {
|
|
182
|
-
__await: t
|
|
183
|
-
};
|
|
184
|
-
}, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
|
|
111
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
185
112
|
return this;
|
|
186
|
-
}),
|
|
187
|
-
void 0 === i && (i = Promise);
|
|
188
|
-
var a = new AsyncIterator(h(t, e, n, o), i);
|
|
189
|
-
return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
|
|
190
|
-
return t.done ? t.value : a.next();
|
|
191
|
-
});
|
|
192
|
-
}, g(v), c(v, u, "Generator"), c(v, i, function () {
|
|
193
|
-
return this;
|
|
194
|
-
}), c(v, "toString", function () {
|
|
113
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
195
114
|
return "[object Generator]";
|
|
196
|
-
}),
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return function t() {
|
|
201
|
-
for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
|
|
202
|
-
return t.done = !0, t;
|
|
115
|
+
}), (_regenerator = function () {
|
|
116
|
+
return {
|
|
117
|
+
w: i,
|
|
118
|
+
m: f
|
|
203
119
|
};
|
|
204
|
-
}
|
|
205
|
-
constructor: Context,
|
|
206
|
-
reset: function (r) {
|
|
207
|
-
if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
|
|
208
|
-
},
|
|
209
|
-
stop: function () {
|
|
210
|
-
this.done = !0;
|
|
211
|
-
var t = this.tryEntries[0][4];
|
|
212
|
-
if ("throw" === t.type) throw t.arg;
|
|
213
|
-
return this.rval;
|
|
214
|
-
},
|
|
215
|
-
dispatchException: function (r) {
|
|
216
|
-
if (this.done) throw r;
|
|
217
|
-
var e = this;
|
|
218
|
-
function n(t) {
|
|
219
|
-
a.type = "throw", a.arg = r, e.next = t;
|
|
220
|
-
}
|
|
221
|
-
for (var o = e.tryEntries.length - 1; o >= 0; --o) {
|
|
222
|
-
var i = this.tryEntries[o],
|
|
223
|
-
a = i[4],
|
|
224
|
-
u = this.prev,
|
|
225
|
-
c = i[1],
|
|
226
|
-
h = i[2];
|
|
227
|
-
if (-1 === i[0]) return n("end"), !1;
|
|
228
|
-
if (!c && !h) throw Error("try statement without catch or finally");
|
|
229
|
-
if (null != i[0] && i[0] <= u) {
|
|
230
|
-
if (u < c) return this.method = "next", this.arg = t, n(c), !0;
|
|
231
|
-
if (u < h) return n(h), !1;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
abrupt: function (t, r) {
|
|
236
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
237
|
-
var n = this.tryEntries[e];
|
|
238
|
-
if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
|
|
239
|
-
var o = n;
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
|
|
244
|
-
var i = o ? o[4] : {};
|
|
245
|
-
return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
|
|
246
|
-
},
|
|
247
|
-
complete: function (t, r) {
|
|
248
|
-
if ("throw" === t.type) throw t.arg;
|
|
249
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
|
|
250
|
-
},
|
|
251
|
-
finish: function (t) {
|
|
252
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
253
|
-
var e = this.tryEntries[r];
|
|
254
|
-
if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
catch: function (t) {
|
|
258
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
259
|
-
var e = this.tryEntries[r];
|
|
260
|
-
if (e[0] === t) {
|
|
261
|
-
var n = e[4];
|
|
262
|
-
if ("throw" === n.type) {
|
|
263
|
-
var o = n.arg;
|
|
264
|
-
m(e);
|
|
265
|
-
}
|
|
266
|
-
return o;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
throw Error("illegal catch attempt");
|
|
270
|
-
},
|
|
271
|
-
delegateYield: function (r, e, n) {
|
|
272
|
-
return this.delegate = {
|
|
273
|
-
i: x(r),
|
|
274
|
-
r: e,
|
|
275
|
-
n: n
|
|
276
|
-
}, "next" === this.method && (this.arg = t), f;
|
|
277
|
-
}
|
|
278
|
-
}, r;
|
|
120
|
+
})();
|
|
279
121
|
}
|
|
280
122
|
|
|
281
123
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -347,27 +189,24 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
|
|
|
347
189
|
compilotApiClient = _ref.compilotApiClient;
|
|
348
190
|
var externalIdToCustomerIdMap = new Map();
|
|
349
191
|
var getCustomerId = /*#__PURE__*/function () {
|
|
350
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/
|
|
192
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(externalCustomerId) {
|
|
351
193
|
var customer;
|
|
352
|
-
return
|
|
353
|
-
while (1) switch (_context.
|
|
194
|
+
return _regenerator().w(function (_context) {
|
|
195
|
+
while (1) switch (_context.n) {
|
|
354
196
|
case 0:
|
|
355
197
|
if (externalIdToCustomerIdMap.has(externalCustomerId)) {
|
|
356
|
-
_context.
|
|
198
|
+
_context.n = 2;
|
|
357
199
|
break;
|
|
358
200
|
}
|
|
359
|
-
_context.
|
|
201
|
+
_context.n = 1;
|
|
360
202
|
return compilotApiClient.customers.internalCustomerRouterGetCustomerByExternalCustomerId({
|
|
361
203
|
externalCustomerId: externalCustomerId
|
|
362
204
|
});
|
|
363
|
-
case
|
|
364
|
-
customer = _context.
|
|
205
|
+
case 1:
|
|
206
|
+
customer = _context.v;
|
|
365
207
|
externalIdToCustomerIdMap.set(externalCustomerId, customer.id);
|
|
366
|
-
case
|
|
367
|
-
return _context.
|
|
368
|
-
case 6:
|
|
369
|
-
case "end":
|
|
370
|
-
return _context.stop();
|
|
208
|
+
case 2:
|
|
209
|
+
return _context.a(2, externalIdToCustomerIdMap.get(externalCustomerId));
|
|
371
210
|
}
|
|
372
211
|
}, _callee);
|
|
373
212
|
}));
|
|
@@ -376,115 +215,115 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
|
|
|
376
215
|
};
|
|
377
216
|
}();
|
|
378
217
|
return /*#__PURE__*/function () {
|
|
379
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/
|
|
218
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
380
219
|
var customerId, emails, emailExists, _customerId, phones, phoneExists, _customerId2, wallet, wallets, walletExists;
|
|
381
|
-
return
|
|
382
|
-
while (1) switch (_context2.
|
|
220
|
+
return _regenerator().w(function (_context2) {
|
|
221
|
+
while (1) switch (_context2.n) {
|
|
383
222
|
case 0:
|
|
384
223
|
if (!params.information.email) {
|
|
385
|
-
_context2.
|
|
224
|
+
_context2.n = 3;
|
|
386
225
|
break;
|
|
387
226
|
}
|
|
388
|
-
_context2.
|
|
227
|
+
_context2.n = 1;
|
|
389
228
|
return getCustomerId(params.externalCustomerId);
|
|
390
|
-
case
|
|
391
|
-
customerId = _context2.
|
|
229
|
+
case 1:
|
|
230
|
+
customerId = _context2.v;
|
|
392
231
|
logger.debug({
|
|
393
232
|
msg: "Fetching emails for customer",
|
|
394
233
|
customerId: customerId
|
|
395
234
|
});
|
|
396
|
-
_context2.
|
|
235
|
+
_context2.n = 2;
|
|
397
236
|
return compilotApiClient.customers.internalCustomerRouterEmailsGetCustomerEmails({
|
|
398
237
|
customerId: customerId
|
|
399
238
|
});
|
|
400
|
-
case
|
|
401
|
-
emails = _context2.
|
|
239
|
+
case 2:
|
|
240
|
+
emails = _context2.v;
|
|
402
241
|
emailExists = emails.some(function (row) {
|
|
403
242
|
return row.email === params.information.email;
|
|
404
243
|
});
|
|
405
244
|
if (emailExists) {
|
|
406
|
-
_context2.
|
|
245
|
+
_context2.n = 3;
|
|
407
246
|
break;
|
|
408
247
|
}
|
|
409
248
|
logger.info({
|
|
410
249
|
msg: "Creating email for customer",
|
|
411
250
|
customerId: customerId
|
|
412
251
|
});
|
|
413
|
-
_context2.
|
|
252
|
+
_context2.n = 3;
|
|
414
253
|
return compilotApiClient.customers.internalCustomerRouterEmailsCreateCustomerEmail({
|
|
415
254
|
customerId: customerId,
|
|
416
255
|
requestBody: {
|
|
417
256
|
email: params.information.email
|
|
418
257
|
}
|
|
419
258
|
});
|
|
420
|
-
case
|
|
259
|
+
case 3:
|
|
421
260
|
if (!params.information.phone) {
|
|
422
|
-
_context2.
|
|
261
|
+
_context2.n = 6;
|
|
423
262
|
break;
|
|
424
263
|
}
|
|
425
|
-
_context2.
|
|
264
|
+
_context2.n = 4;
|
|
426
265
|
return getCustomerId(params.externalCustomerId);
|
|
427
|
-
case
|
|
428
|
-
_customerId = _context2.
|
|
266
|
+
case 4:
|
|
267
|
+
_customerId = _context2.v;
|
|
429
268
|
logger.debug({
|
|
430
269
|
msg: "Fetching phones for customer",
|
|
431
270
|
customerId: _customerId
|
|
432
271
|
});
|
|
433
|
-
_context2.
|
|
272
|
+
_context2.n = 5;
|
|
434
273
|
return compilotApiClient.customers.internalCustomerRouterPhoneNumbersGetCustomerPhoneNumbers({
|
|
435
274
|
customerId: _customerId
|
|
436
275
|
});
|
|
437
|
-
case
|
|
438
|
-
phones = _context2.
|
|
276
|
+
case 5:
|
|
277
|
+
phones = _context2.v;
|
|
439
278
|
phoneExists = phones.some(function (row) {
|
|
440
279
|
return row.phoneNumber === params.information.phone;
|
|
441
280
|
});
|
|
442
281
|
if (phoneExists) {
|
|
443
|
-
_context2.
|
|
282
|
+
_context2.n = 6;
|
|
444
283
|
break;
|
|
445
284
|
}
|
|
446
285
|
logger.info({
|
|
447
286
|
msg: "Creating phone for customer",
|
|
448
287
|
customerId: _customerId
|
|
449
288
|
});
|
|
450
|
-
_context2.
|
|
289
|
+
_context2.n = 6;
|
|
451
290
|
return compilotApiClient.customers.internalCustomerRouterPhoneNumbersCreateCustomerPhoneNumber({
|
|
452
291
|
customerId: _customerId,
|
|
453
292
|
requestBody: {
|
|
454
293
|
phoneNumber: params.information.phone
|
|
455
294
|
}
|
|
456
295
|
});
|
|
457
|
-
case
|
|
296
|
+
case 6:
|
|
458
297
|
if (!params.information.wallet) {
|
|
459
|
-
_context2.
|
|
298
|
+
_context2.n = 9;
|
|
460
299
|
break;
|
|
461
300
|
}
|
|
462
|
-
_context2.
|
|
301
|
+
_context2.n = 7;
|
|
463
302
|
return getCustomerId(params.externalCustomerId);
|
|
464
|
-
case
|
|
465
|
-
_customerId2 = _context2.
|
|
303
|
+
case 7:
|
|
304
|
+
_customerId2 = _context2.v;
|
|
466
305
|
logger.debug({
|
|
467
306
|
msg: "Fetching wallets for customer",
|
|
468
307
|
customerId: _customerId2
|
|
469
308
|
});
|
|
470
309
|
wallet = params.information.wallet;
|
|
471
|
-
_context2.
|
|
310
|
+
_context2.n = 8;
|
|
472
311
|
return compilotApiClient.customers.internalCustomerRouterWalletsGetCustomerWallets({
|
|
473
312
|
customerId: _customerId2
|
|
474
313
|
});
|
|
475
|
-
case
|
|
476
|
-
wallets = _context2.
|
|
314
|
+
case 8:
|
|
315
|
+
wallets = _context2.v;
|
|
477
316
|
walletExists = wallets.some(function (row) {
|
|
478
317
|
return row.wallet === wallet.address && row.blockchainNamespace === wallet.namespace;
|
|
479
318
|
});
|
|
480
319
|
if (walletExists) {
|
|
481
|
-
_context2.
|
|
320
|
+
_context2.n = 9;
|
|
482
321
|
break;
|
|
483
322
|
}
|
|
484
323
|
logger.info("Creating wallet for customer", {
|
|
485
324
|
customerId: _customerId2
|
|
486
325
|
});
|
|
487
|
-
_context2.
|
|
326
|
+
_context2.n = 9;
|
|
488
327
|
return compilotApiClient.customers.internalCustomerRouterWalletsCreateCustomerWallet({
|
|
489
328
|
customerId: _customerId2,
|
|
490
329
|
requestBody: {
|
|
@@ -492,9 +331,8 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
|
|
|
492
331
|
blockchainNamespace: wallet.namespace
|
|
493
332
|
}
|
|
494
333
|
});
|
|
495
|
-
case
|
|
496
|
-
|
|
497
|
-
return _context2.stop();
|
|
334
|
+
case 9:
|
|
335
|
+
return _context2.a(2);
|
|
498
336
|
}
|
|
499
337
|
}, _callee2);
|
|
500
338
|
}));
|
|
@@ -564,21 +402,18 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
|
|
|
564
402
|
/** @hidden */
|
|
565
403
|
var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
|
|
566
404
|
return /*#__PURE__*/function () {
|
|
567
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
405
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
568
406
|
var res;
|
|
569
|
-
return
|
|
570
|
-
while (1) switch (_context.
|
|
407
|
+
return _regenerator().w(function (_context) {
|
|
408
|
+
while (1) switch (_context.n) {
|
|
571
409
|
case 0:
|
|
572
|
-
_context.
|
|
410
|
+
_context.n = 1;
|
|
573
411
|
return deps.identityApiClient.auth.createSession({
|
|
574
412
|
requestBody: params
|
|
575
413
|
});
|
|
576
|
-
case
|
|
577
|
-
res = _context.
|
|
578
|
-
return _context.
|
|
579
|
-
case 4:
|
|
580
|
-
case "end":
|
|
581
|
-
return _context.stop();
|
|
414
|
+
case 1:
|
|
415
|
+
res = _context.v;
|
|
416
|
+
return _context.a(2, res);
|
|
582
417
|
}
|
|
583
418
|
}, _callee);
|
|
584
419
|
}));
|
|
@@ -648,21 +483,18 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
|
|
|
648
483
|
/** @hidden */
|
|
649
484
|
var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
|
|
650
485
|
return /*#__PURE__*/function () {
|
|
651
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
486
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
652
487
|
var res;
|
|
653
|
-
return
|
|
654
|
-
while (1) switch (_context.
|
|
488
|
+
return _regenerator().w(function (_context) {
|
|
489
|
+
while (1) switch (_context.n) {
|
|
655
490
|
case 0:
|
|
656
|
-
_context.
|
|
491
|
+
_context.n = 1;
|
|
657
492
|
return deps.identityApiClient.auth.createWalletChallenge({
|
|
658
493
|
requestBody: params
|
|
659
494
|
});
|
|
660
|
-
case
|
|
661
|
-
res = _context.
|
|
662
|
-
return _context.
|
|
663
|
-
case 4:
|
|
664
|
-
case "end":
|
|
665
|
-
return _context.stop();
|
|
495
|
+
case 1:
|
|
496
|
+
res = _context.v;
|
|
497
|
+
return _context.a(2, res);
|
|
666
498
|
}
|
|
667
499
|
}, _callee);
|
|
668
500
|
}));
|
|
@@ -695,19 +527,16 @@ var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
|
|
|
695
527
|
/** @hidden */
|
|
696
528
|
var getCustomerSessionDataFactory = function getCustomerSessionDataFactory(deps) {
|
|
697
529
|
return /*#__PURE__*/function () {
|
|
698
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
530
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
699
531
|
var identityApiClient;
|
|
700
|
-
return
|
|
701
|
-
while (1) switch (_context.
|
|
532
|
+
return _regenerator().w(function (_context) {
|
|
533
|
+
while (1) switch (_context.n) {
|
|
702
534
|
case 0:
|
|
703
535
|
identityApiClient = createIdentityApiClient({
|
|
704
536
|
env: deps.env,
|
|
705
537
|
jwt: params.authSession.token
|
|
706
538
|
});
|
|
707
|
-
return _context.
|
|
708
|
-
case 2:
|
|
709
|
-
case "end":
|
|
710
|
-
return _context.stop();
|
|
539
|
+
return _context.a(2, identityApiClient.identity.getIdentitySessionIds());
|
|
711
540
|
}
|
|
712
541
|
}, _callee);
|
|
713
542
|
}));
|
|
@@ -741,21 +570,18 @@ var getCustomerSessionDataFactory = function getCustomerSessionDataFactory(deps)
|
|
|
741
570
|
/** @hidden */
|
|
742
571
|
var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerIdFactory(deps) {
|
|
743
572
|
return /*#__PURE__*/function () {
|
|
744
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
573
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
745
574
|
var customer;
|
|
746
|
-
return
|
|
747
|
-
while (1) switch (_context.
|
|
575
|
+
return _regenerator().w(function (_context) {
|
|
576
|
+
while (1) switch (_context.n) {
|
|
748
577
|
case 0:
|
|
749
|
-
_context.
|
|
578
|
+
_context.n = 1;
|
|
750
579
|
return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerDetails({
|
|
751
580
|
id: params.customerId
|
|
752
581
|
});
|
|
753
|
-
case
|
|
754
|
-
customer = _context.
|
|
755
|
-
return _context.
|
|
756
|
-
case 4:
|
|
757
|
-
case "end":
|
|
758
|
-
return _context.stop();
|
|
582
|
+
case 1:
|
|
583
|
+
customer = _context.v;
|
|
584
|
+
return _context.a(2, customer.status);
|
|
759
585
|
}
|
|
760
586
|
}, _callee);
|
|
761
587
|
}));
|
|
@@ -789,19 +615,16 @@ var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerI
|
|
|
789
615
|
/** @hidden */
|
|
790
616
|
var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByExternalCustomerIdFactory(deps) {
|
|
791
617
|
return /*#__PURE__*/function () {
|
|
792
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
618
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
793
619
|
var customer;
|
|
794
|
-
return
|
|
795
|
-
while (1) switch (_context.
|
|
620
|
+
return _regenerator().w(function (_context) {
|
|
621
|
+
while (1) switch (_context.n) {
|
|
796
622
|
case 0:
|
|
797
|
-
_context.
|
|
623
|
+
_context.n = 1;
|
|
798
624
|
return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerByExternalCustomerId(params);
|
|
799
|
-
case
|
|
800
|
-
customer = _context.
|
|
801
|
-
return _context.
|
|
802
|
-
case 4:
|
|
803
|
-
case "end":
|
|
804
|
-
return _context.stop();
|
|
625
|
+
case 1:
|
|
626
|
+
customer = _context.v;
|
|
627
|
+
return _context.a(2, customer.status);
|
|
805
628
|
}
|
|
806
629
|
}, _callee);
|
|
807
630
|
}));
|
|
@@ -834,23 +657,20 @@ var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByE
|
|
|
834
657
|
/** @hidden */
|
|
835
658
|
var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory(deps) {
|
|
836
659
|
return /*#__PURE__*/function () {
|
|
837
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
660
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
838
661
|
var customer;
|
|
839
|
-
return
|
|
840
|
-
while (1) switch (_context.
|
|
662
|
+
return _regenerator().w(function (_context) {
|
|
663
|
+
while (1) switch (_context.n) {
|
|
841
664
|
case 0:
|
|
842
|
-
_context.
|
|
665
|
+
_context.n = 1;
|
|
843
666
|
return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerByProjectAndWalletAddress({
|
|
844
667
|
address: params.walletAddress,
|
|
845
668
|
cmsProjectId: params.workspaceId,
|
|
846
669
|
type: params.type
|
|
847
670
|
});
|
|
848
|
-
case
|
|
849
|
-
customer = _context.
|
|
850
|
-
return _context.
|
|
851
|
-
case 4:
|
|
852
|
-
case "end":
|
|
853
|
-
return _context.stop();
|
|
671
|
+
case 1:
|
|
672
|
+
customer = _context.v;
|
|
673
|
+
return _context.a(2, customer.status);
|
|
854
674
|
}
|
|
855
675
|
}, _callee);
|
|
856
676
|
}));
|
|
@@ -883,18 +703,18 @@ var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory
|
|
|
883
703
|
/** @hidden */
|
|
884
704
|
var getCustomerWalletsFactory = function getCustomerWalletsFactory(deps) {
|
|
885
705
|
return /*#__PURE__*/function () {
|
|
886
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
706
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
887
707
|
var customer;
|
|
888
|
-
return
|
|
889
|
-
while (1) switch (_context.
|
|
708
|
+
return _regenerator().w(function (_context) {
|
|
709
|
+
while (1) switch (_context.n) {
|
|
890
710
|
case 0:
|
|
891
|
-
_context.
|
|
711
|
+
_context.n = 1;
|
|
892
712
|
return deps.compilotApiClient.customers.internalCustomerRouterWalletsGetCustomerWallets({
|
|
893
713
|
customerId: params.customerId
|
|
894
714
|
});
|
|
895
|
-
case
|
|
896
|
-
customer = _context.
|
|
897
|
-
return _context.
|
|
715
|
+
case 1:
|
|
716
|
+
customer = _context.v;
|
|
717
|
+
return _context.a(2, customer.map(function (wallet) {
|
|
898
718
|
return {
|
|
899
719
|
address: wallet.wallet,
|
|
900
720
|
chain: wallet.blockchainNamespace,
|
|
@@ -903,9 +723,6 @@ var getCustomerWalletsFactory = function getCustomerWalletsFactory(deps) {
|
|
|
903
723
|
}).filter(function (wallet) {
|
|
904
724
|
return wallet.chain !== null;
|
|
905
725
|
}));
|
|
906
|
-
case 4:
|
|
907
|
-
case "end":
|
|
908
|
-
return _context.stop();
|
|
909
726
|
}
|
|
910
727
|
}, _callee);
|
|
911
728
|
}));
|
|
@@ -1017,31 +834,28 @@ var getTxAuthDataSignatureFactory = function getTxAuthDataSignatureFactory(deps)
|
|
|
1017
834
|
// use a mapping so we get a type error here when we add a new namespace
|
|
1018
835
|
var mapping = {
|
|
1019
836
|
eip155: function () {
|
|
1020
|
-
var _eip = _asyncToGenerator(/*#__PURE__*/
|
|
837
|
+
var _eip = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
1021
838
|
var res;
|
|
1022
|
-
return
|
|
1023
|
-
while (1) switch (_context.
|
|
839
|
+
return _regenerator().w(function (_context) {
|
|
840
|
+
while (1) switch (_context.n) {
|
|
1024
841
|
case 0:
|
|
1025
842
|
if (!(params.namespace !== "eip155")) {
|
|
1026
|
-
_context.
|
|
843
|
+
_context.n = 1;
|
|
1027
844
|
break;
|
|
1028
845
|
}
|
|
1029
846
|
throw new Error("Unsupported namespace: ".concat(params.namespace));
|
|
1030
|
-
case
|
|
1031
|
-
_context.
|
|
847
|
+
case 1:
|
|
848
|
+
_context.n = 2;
|
|
1032
849
|
return deps.compilotApiClient.sigGating.publicRouterSignatureGatingGetTxAuthDataSignature({
|
|
1033
850
|
requestBody: params,
|
|
1034
851
|
workflowId: params.workflowId
|
|
1035
852
|
});
|
|
1036
|
-
case
|
|
1037
|
-
res = _context.
|
|
1038
|
-
return _context.
|
|
853
|
+
case 2:
|
|
854
|
+
res = _context.v;
|
|
855
|
+
return _context.a(2, ExtendedTxAuthDataSignatureResponse.parse(_objectSpread2({
|
|
1039
856
|
namespace: params.namespace,
|
|
1040
857
|
userAddress: params.userAddress
|
|
1041
858
|
}, res)));
|
|
1042
|
-
case 6:
|
|
1043
|
-
case "end":
|
|
1044
|
-
return _context.stop();
|
|
1045
859
|
}
|
|
1046
860
|
}, _callee);
|
|
1047
861
|
}));
|
|
@@ -1051,31 +865,28 @@ var getTxAuthDataSignatureFactory = function getTxAuthDataSignatureFactory(deps)
|
|
|
1051
865
|
return eip155;
|
|
1052
866
|
}(),
|
|
1053
867
|
tezos: function () {
|
|
1054
|
-
var _tezos = _asyncToGenerator(/*#__PURE__*/
|
|
868
|
+
var _tezos = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
|
|
1055
869
|
var res;
|
|
1056
|
-
return
|
|
1057
|
-
while (1) switch (_context2.
|
|
870
|
+
return _regenerator().w(function (_context2) {
|
|
871
|
+
while (1) switch (_context2.n) {
|
|
1058
872
|
case 0:
|
|
1059
873
|
if (!(params.namespace !== "tezos")) {
|
|
1060
|
-
_context2.
|
|
874
|
+
_context2.n = 1;
|
|
1061
875
|
break;
|
|
1062
876
|
}
|
|
1063
877
|
throw new Error("Unsupported namespace: ".concat(params.namespace));
|
|
1064
|
-
case
|
|
1065
|
-
_context2.
|
|
878
|
+
case 1:
|
|
879
|
+
_context2.n = 2;
|
|
1066
880
|
return deps.compilotApiClient.sigGating.publicRouterSignatureGatingGetTezosTxAuthDataSignature({
|
|
1067
881
|
requestBody: params,
|
|
1068
882
|
workflowId: params.workflowId
|
|
1069
883
|
});
|
|
1070
|
-
case
|
|
1071
|
-
res = _context2.
|
|
1072
|
-
return _context2.
|
|
884
|
+
case 2:
|
|
885
|
+
res = _context2.v;
|
|
886
|
+
return _context2.a(2, ExtendedTezosTxAuthDataSignatureResponse.parse(_objectSpread2({
|
|
1073
887
|
namespace: params.namespace,
|
|
1074
888
|
userAddress: params.userAddress
|
|
1075
889
|
}, res)));
|
|
1076
|
-
case 6:
|
|
1077
|
-
case "end":
|
|
1078
|
-
return _context2.stop();
|
|
1079
890
|
}
|
|
1080
891
|
}, _callee2);
|
|
1081
892
|
}));
|
|
@@ -1350,21 +1161,18 @@ var validateWebhookEventFactory = function validateWebhookEventFactory(_ref) {
|
|
|
1350
1161
|
/** @hidden */
|
|
1351
1162
|
var verifyWeb3ChallengeFactory = function verifyWeb3ChallengeFactory(deps) {
|
|
1352
1163
|
return /*#__PURE__*/function () {
|
|
1353
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
1164
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
1354
1165
|
var res;
|
|
1355
|
-
return
|
|
1356
|
-
while (1) switch (_context.
|
|
1166
|
+
return _regenerator().w(function (_context) {
|
|
1167
|
+
while (1) switch (_context.n) {
|
|
1357
1168
|
case 0:
|
|
1358
|
-
_context.
|
|
1169
|
+
_context.n = 1;
|
|
1359
1170
|
return deps.identityApiClient.auth.verifyWalletChallenge({
|
|
1360
1171
|
requestBody: params
|
|
1361
1172
|
});
|
|
1362
|
-
case
|
|
1363
|
-
res = _context.
|
|
1364
|
-
return _context.
|
|
1365
|
-
case 4:
|
|
1366
|
-
case "end":
|
|
1367
|
-
return _context.stop();
|
|
1173
|
+
case 1:
|
|
1174
|
+
res = _context.v;
|
|
1175
|
+
return _context.a(2, res);
|
|
1368
1176
|
}
|
|
1369
1177
|
}, _callee);
|
|
1370
1178
|
}));
|