@driveflux/api-functions 0.0.7-next.0 → 0.0.7-next.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/dist/auth/confirm.js +73 -327
- package/dist/auth/emails.js +43 -210
- package/dist/auth/formatter.js +11 -11
- package/dist/auth/otp.js +122 -392
- package/dist/auth/register.js +100 -396
- package/dist/auth/tokens.js +115 -430
- package/dist/auth/verifications.js +177 -583
- package/dist/constants.js +5 -4
- package/dist/mailjet/calls/manage-contacts-in-list.js +22 -166
- package/dist/mailjet/calls/manage-subscription-status.js +13 -153
- package/dist/mailjet/calls/request-service.js +18 -183
- package/dist/mailjet/refresh-email-preferences.js +26 -225
- package/dist/mailjet/set-contact.js +23 -214
- package/dist/mailjet/types.js +2 -1
- package/dist/mailjet/utils/convert-to-array.js +9 -58
- package/dist/mailjet/utils/extract-email-preferences.js +41 -217
- package/dist/mailjet/utils/lists.js +30 -249
- package/dist/mailjet/utils/update-email-references.js +27 -208
- package/dist/notion/client.js +48 -197
- package/dist/notion/helpful.js +29 -170
- package/dist/notion/schemas/block.js +49 -43
- package/dist/notion/schemas/common.js +17 -14
- package/dist/notion/schemas/database.js +125 -159
- package/dist/notion/schemas/emoji.js +3 -2
- package/dist/notion/schemas/file.js +10 -10
- package/dist/notion/schemas/kb.js +9 -8
- package/dist/notion/schemas/page.js +126 -171
- package/dist/notion/schemas/parent.js +9 -8
- package/dist/notion/schemas/user.js +21 -20
- package/dist/reservation/agree.js +19 -158
- package/dist/reservation/checks.js +23 -178
- package/dist/reservation/display-vehicle.js +142 -514
- package/dist/reservation/fetch-or-create.js +197 -482
- package/dist/reservation/invoice.js +198 -496
- package/dist/reservation/payer.js +28 -177
- package/dist/reservation/reserve.js +31 -191
- package/dist/reservation/types.js +2 -1
- package/dist/reservation/vehicle.js +24 -186
- package/dist/slack.js +67 -273
- package/dist/validation.js +81 -139
- package/dist/vehicle/vehicle-pricing/constants.js +33 -36
- package/dist/vehicle/vehicle-pricing/index.js +99 -257
- package/dist/vehicle/vehicle-pricing/types.js +2 -1
- package/package.json +9 -9
package/dist/auth/register.js
CHANGED
|
@@ -1,202 +1,3 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
-
try {
|
|
3
|
-
var info = gen[key](arg);
|
|
4
|
-
var value = info.value;
|
|
5
|
-
} catch (error) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _async_to_generator(fn) {
|
|
16
|
-
return function() {
|
|
17
|
-
var self = this, args = arguments;
|
|
18
|
-
return new Promise(function(resolve, reject) {
|
|
19
|
-
var gen = fn.apply(self, args);
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
-
}
|
|
23
|
-
function _throw(err) {
|
|
24
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
-
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread(target) {
|
|
44
|
-
for(var i = 1; i < arguments.length; i++){
|
|
45
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
var ownKeys = Object.keys(source);
|
|
47
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
ownKeys.forEach(function(key) {
|
|
53
|
-
_define_property(target, key, source[key]);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
function ownKeys(object, enumerableOnly) {
|
|
59
|
-
var keys = Object.keys(object);
|
|
60
|
-
if (Object.getOwnPropertySymbols) {
|
|
61
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
-
if (enumerableOnly) {
|
|
63
|
-
symbols = symbols.filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
keys.push.apply(keys, symbols);
|
|
68
|
-
}
|
|
69
|
-
return keys;
|
|
70
|
-
}
|
|
71
|
-
function _object_spread_props(target, source) {
|
|
72
|
-
source = source != null ? source : {};
|
|
73
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
-
} else {
|
|
76
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
function _object_without_properties(source, excluded) {
|
|
83
|
-
if (source == null) return {};
|
|
84
|
-
var target = _object_without_properties_loose(source, excluded);
|
|
85
|
-
var key, i;
|
|
86
|
-
if (Object.getOwnPropertySymbols) {
|
|
87
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
88
|
-
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
89
|
-
key = sourceSymbolKeys[i];
|
|
90
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
91
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
92
|
-
target[key] = source[key];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return target;
|
|
96
|
-
}
|
|
97
|
-
function _object_without_properties_loose(source, excluded) {
|
|
98
|
-
if (source == null) return {};
|
|
99
|
-
var target = {};
|
|
100
|
-
var sourceKeys = Object.keys(source);
|
|
101
|
-
var key, i;
|
|
102
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
103
|
-
key = sourceKeys[i];
|
|
104
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
105
|
-
target[key] = source[key];
|
|
106
|
-
}
|
|
107
|
-
return target;
|
|
108
|
-
}
|
|
109
|
-
function _ts_generator(thisArg, body) {
|
|
110
|
-
var f, y, t, _ = {
|
|
111
|
-
label: 0,
|
|
112
|
-
sent: function() {
|
|
113
|
-
if (t[0] & 1) throw t[1];
|
|
114
|
-
return t[1];
|
|
115
|
-
},
|
|
116
|
-
trys: [],
|
|
117
|
-
ops: []
|
|
118
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
119
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
120
|
-
return this;
|
|
121
|
-
}), g;
|
|
122
|
-
function verb(n) {
|
|
123
|
-
return function(v) {
|
|
124
|
-
return step([
|
|
125
|
-
n,
|
|
126
|
-
v
|
|
127
|
-
]);
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function step(op) {
|
|
131
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
132
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
133
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
134
|
-
if (y = 0, t) op = [
|
|
135
|
-
op[0] & 2,
|
|
136
|
-
t.value
|
|
137
|
-
];
|
|
138
|
-
switch(op[0]){
|
|
139
|
-
case 0:
|
|
140
|
-
case 1:
|
|
141
|
-
t = op;
|
|
142
|
-
break;
|
|
143
|
-
case 4:
|
|
144
|
-
_.label++;
|
|
145
|
-
return {
|
|
146
|
-
value: op[1],
|
|
147
|
-
done: false
|
|
148
|
-
};
|
|
149
|
-
case 5:
|
|
150
|
-
_.label++;
|
|
151
|
-
y = op[1];
|
|
152
|
-
op = [
|
|
153
|
-
0
|
|
154
|
-
];
|
|
155
|
-
continue;
|
|
156
|
-
case 7:
|
|
157
|
-
op = _.ops.pop();
|
|
158
|
-
_.trys.pop();
|
|
159
|
-
continue;
|
|
160
|
-
default:
|
|
161
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
162
|
-
_ = 0;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
166
|
-
_.label = op[1];
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
170
|
-
_.label = t[1];
|
|
171
|
-
t = op;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
if (t && _.label < t[2]) {
|
|
175
|
-
_.label = t[2];
|
|
176
|
-
_.ops.push(op);
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
if (t[2]) _.ops.pop();
|
|
180
|
-
_.trys.pop();
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
op = body.call(thisArg, _);
|
|
184
|
-
} catch (e) {
|
|
185
|
-
op = [
|
|
186
|
-
6,
|
|
187
|
-
e
|
|
188
|
-
];
|
|
189
|
-
y = 0;
|
|
190
|
-
} finally{
|
|
191
|
-
f = t = 0;
|
|
192
|
-
}
|
|
193
|
-
if (op[0] & 5) throw op[1];
|
|
194
|
-
return {
|
|
195
|
-
value: op[0] ? op[1] : void 0,
|
|
196
|
-
done: true
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
1
|
import { cleanupPhoneNumber } from '@driveflux/api-functions/auth/formatter';
|
|
201
2
|
import { refreshEmailPreferences } from '@driveflux/api-functions/mailjet/refresh-email-preferences';
|
|
202
3
|
import { dateValidation } from '@driveflux/api-functions/validation';
|
|
@@ -214,211 +15,114 @@ import { SALT_ROUNDS } from '../constants.js';
|
|
|
214
15
|
import { setContactInList } from '../mailjet/set-contact';
|
|
215
16
|
import { clearToken, verifyToken } from './tokens';
|
|
216
17
|
import { sendVerificationEmail } from './verifications.js';
|
|
217
|
-
|
|
18
|
+
const Body = z.object({
|
|
218
19
|
firstName: z.string(),
|
|
219
20
|
lastName: z.string(),
|
|
220
|
-
phoneNumber: z.string().transform(
|
|
221
|
-
|
|
222
|
-
}),
|
|
223
|
-
authMethod: z.enum([
|
|
224
|
-
'mobile',
|
|
225
|
-
'email',
|
|
226
|
-
'facebook',
|
|
227
|
-
'google',
|
|
228
|
-
'apple'
|
|
229
|
-
]),
|
|
21
|
+
phoneNumber: z.string().transform((s) => s.replace(/[\s-]/g, '')),
|
|
22
|
+
authMethod: z.enum(['mobile', 'email', 'facebook', 'google', 'apple']),
|
|
230
23
|
code: z.string().optional().nullable(),
|
|
231
24
|
keepCode: z.boolean().optional().default(false),
|
|
232
|
-
email: z
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
25
|
+
email: z
|
|
26
|
+
.string()
|
|
27
|
+
.email()
|
|
28
|
+
.transform((s) => s.toLowerCase().trim()),
|
|
29
|
+
dateOfBirth: dateValidation
|
|
30
|
+
.refine((d) => {
|
|
236
31
|
return isAfter(d, subYears(new Date(), 25));
|
|
237
32
|
}, {
|
|
238
|
-
path: [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}).optional(),
|
|
33
|
+
path: ['dateOfBirth'],
|
|
34
|
+
message: 'You must be at least 25 years old to signup for the service.',
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
243
37
|
password: z.string().min(6).optional(),
|
|
244
38
|
noMarketing: z.boolean().optional(),
|
|
245
39
|
pageSource: z.string().optional().nullable(),
|
|
246
|
-
skipPassword: z.boolean().optional().nullable()
|
|
40
|
+
skipPassword: z.boolean().optional().nullable(),
|
|
247
41
|
});
|
|
248
|
-
export
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
password: hashedPassword
|
|
334
|
-
}, body), {
|
|
335
|
-
phoneNumber: formattedPohoneNumber,
|
|
336
|
-
preferredCurrency: 'MYR',
|
|
337
|
-
preferredLocale: 'en',
|
|
338
|
-
phoneNumberVerified: phoneNumberVerified,
|
|
339
|
-
consented: true,
|
|
340
|
-
groups: [
|
|
341
|
-
'member'
|
|
342
|
-
],
|
|
343
|
-
consents: {
|
|
344
|
-
create: {
|
|
345
|
-
id: generateId('UserConsent'),
|
|
346
|
-
ipAddress: Array.isArray(xForwardedFor) ? (xForwardedFor === null || xForwardedFor === void 0 ? void 0 : xForwardedFor[0]) || '0.0.0.0' : xForwardedFor || '0.0.0.0',
|
|
347
|
-
consentType: 'terms',
|
|
348
|
-
email: body.email
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
signupParams: {
|
|
352
|
-
method: authMethod,
|
|
353
|
-
source: pageSource
|
|
354
|
-
},
|
|
355
|
-
registrationComplete: true,
|
|
356
|
-
accounts: {
|
|
357
|
-
create: {
|
|
358
|
-
id: generateId('Account'),
|
|
359
|
-
object: 'account',
|
|
360
|
-
type: 'default',
|
|
361
|
-
provider: 'credentials',
|
|
362
|
-
providerAccountId: id
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
})
|
|
366
|
-
})
|
|
367
|
-
];
|
|
368
|
-
case 7:
|
|
369
|
-
user = _state.sent();
|
|
370
|
-
return [
|
|
371
|
-
4,
|
|
372
|
-
prisma.token.create({
|
|
373
|
-
data: {
|
|
374
|
-
id: generateId('Token'),
|
|
375
|
-
user: {
|
|
376
|
-
connect: {
|
|
377
|
-
id: user.id
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
expiresAt: addDays(new Date(), 365),
|
|
381
|
-
scope: 'all'
|
|
382
|
-
}
|
|
383
|
-
})
|
|
384
|
-
];
|
|
385
|
-
case 8:
|
|
386
|
-
token = _state.sent();
|
|
387
|
-
// We don't want this to be a task. It should be instant
|
|
388
|
-
return [
|
|
389
|
-
4,
|
|
390
|
-
sendVerificationEmail(user.id)
|
|
391
|
-
];
|
|
392
|
-
case 9:
|
|
393
|
-
_state.sent();
|
|
394
|
-
if (!!noMarketing) return [
|
|
395
|
-
3,
|
|
396
|
-
11
|
|
397
|
-
];
|
|
398
|
-
return [
|
|
399
|
-
4,
|
|
400
|
-
setContactInList(user.id, {
|
|
401
|
-
generalMarketing: true
|
|
402
|
-
})
|
|
403
|
-
];
|
|
404
|
-
case 10:
|
|
405
|
-
_state.sent();
|
|
406
|
-
_state.label = 11;
|
|
407
|
-
case 11:
|
|
408
|
-
return [
|
|
409
|
-
4,
|
|
410
|
-
refreshEmailPreferences(user.id)
|
|
411
|
-
];
|
|
412
|
-
case 12:
|
|
413
|
-
_state.sent();
|
|
414
|
-
return [
|
|
415
|
-
2,
|
|
416
|
-
new Ok({
|
|
417
|
-
token: token,
|
|
418
|
-
user: user
|
|
419
|
-
})
|
|
420
|
-
];
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
})();
|
|
42
|
+
export const handleRegister = async (b, xForwardedFor) => {
|
|
43
|
+
const { noMarketing, password, authMethod, phoneNumber, code, keepCode, pageSource, skipPassword, ...body } = Body.parse(b);
|
|
44
|
+
let phoneNumberVerified = false;
|
|
45
|
+
if (code) {
|
|
46
|
+
const tokenResult = await verifyToken(code, { scope: 'verify-phone' });
|
|
47
|
+
if (tokenResult.err) {
|
|
48
|
+
return new Err(makeProblem(PROBLEM_CONFLICT, 'Invalid OTP token'));
|
|
49
|
+
}
|
|
50
|
+
if (!keepCode) {
|
|
51
|
+
await clearToken(tokenResult.val.id);
|
|
52
|
+
}
|
|
53
|
+
phoneNumberVerified = true;
|
|
54
|
+
}
|
|
55
|
+
if (!password && !skipPassword) {
|
|
56
|
+
return new Err(makeProblem(PROBLEM_CONFLICT, 'Password is invalid'));
|
|
57
|
+
}
|
|
58
|
+
// Check if the user exists
|
|
59
|
+
const foundUser = await prisma.user.findFirst({
|
|
60
|
+
where: { email: body.email },
|
|
61
|
+
});
|
|
62
|
+
if (foundUser) {
|
|
63
|
+
return new Err(makeProblem(PROBLEM_CONFLICT, 'A user with this email address already exists. Did you mean to login?'));
|
|
64
|
+
}
|
|
65
|
+
const formattedPohoneNumber = cleanupPhoneNumber(phoneNumber);
|
|
66
|
+
const id = generateId('User');
|
|
67
|
+
const hashedPassword = await bcrypt.hash(password ?? nanoid(), SALT_ROUNDS);
|
|
68
|
+
const user = await prisma.user.create({
|
|
69
|
+
data: {
|
|
70
|
+
id,
|
|
71
|
+
password: hashedPassword,
|
|
72
|
+
...body,
|
|
73
|
+
phoneNumber: formattedPohoneNumber,
|
|
74
|
+
preferredCurrency: 'MYR',
|
|
75
|
+
preferredLocale: 'en',
|
|
76
|
+
phoneNumberVerified,
|
|
77
|
+
consented: true,
|
|
78
|
+
groups: ['member'],
|
|
79
|
+
consents: {
|
|
80
|
+
create: {
|
|
81
|
+
id: generateId('UserConsent'),
|
|
82
|
+
ipAddress: Array.isArray(xForwardedFor)
|
|
83
|
+
? xForwardedFor?.[0] || '0.0.0.0'
|
|
84
|
+
: xForwardedFor || '0.0.0.0',
|
|
85
|
+
consentType: 'terms',
|
|
86
|
+
email: body.email,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
signupParams: {
|
|
90
|
+
method: authMethod,
|
|
91
|
+
source: pageSource,
|
|
92
|
+
},
|
|
93
|
+
registrationComplete: true,
|
|
94
|
+
accounts: {
|
|
95
|
+
create: {
|
|
96
|
+
id: generateId('Account'),
|
|
97
|
+
object: 'account',
|
|
98
|
+
type: 'default',
|
|
99
|
+
provider: 'credentials',
|
|
100
|
+
providerAccountId: id,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const token = await prisma.token.create({
|
|
106
|
+
data: {
|
|
107
|
+
id: generateId('Token'),
|
|
108
|
+
user: {
|
|
109
|
+
connect: {
|
|
110
|
+
id: user.id,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
expiresAt: addDays(new Date(), 365),
|
|
114
|
+
scope: 'all',
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
// We don't want this to be a task. It should be instant
|
|
118
|
+
await sendVerificationEmail(user.id);
|
|
119
|
+
if (!noMarketing) {
|
|
120
|
+
await setContactInList(user.id, { generalMarketing: true });
|
|
121
|
+
}
|
|
122
|
+
await refreshEmailPreferences(user.id);
|
|
123
|
+
return new Ok({
|
|
124
|
+
token,
|
|
125
|
+
user,
|
|
126
|
+
});
|
|
424
127
|
};
|
|
128
|
+
//# sourceMappingURL=register.js.map
|