@wix/auto_sdk_identity_authentication 1.0.14 → 1.0.16

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.
@@ -0,0 +1,794 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ AddressTag: () => AddressTag,
24
+ EmailTag: () => EmailTag,
25
+ FactorStatus: () => FactorStatus,
26
+ FactorType: () => FactorType,
27
+ MfaReason: () => MfaReason,
28
+ PhoneTag: () => PhoneTag,
29
+ PrivacyStatus: () => PrivacyStatus,
30
+ Reason: () => Reason,
31
+ StateType: () => StateType,
32
+ Status: () => Status,
33
+ StatusName: () => StatusName,
34
+ TenantType: () => TenantType,
35
+ UserVerificationRequirement: () => UserVerificationRequirement,
36
+ changePassword: () => changePassword2,
37
+ loginCallback: () => loginCallback2,
38
+ loginV2: () => loginV22,
39
+ logout: () => logout2,
40
+ registerV2: () => registerV22,
41
+ signOn: () => signOn2,
42
+ verify: () => verify2
43
+ });
44
+ module.exports = __toCommonJS(index_typings_exports);
45
+
46
+ // src/iam-authentication-v1-authentication-authentication.universal.ts
47
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
48
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
49
+
50
+ // src/iam-authentication-v1-authentication-authentication.http.ts
51
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
52
+ var import_float = require("@wix/sdk-runtime/transformations/float");
53
+ var import_float2 = require("@wix/sdk-runtime/transformations/float");
54
+ var import_bytes = require("@wix/sdk-runtime/transformations/bytes");
55
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
56
+ var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
57
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
58
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
59
+ function resolveWixIamAuthenticationV1AuthenticationServiceUrl(opts) {
60
+ const domainToMappings = {
61
+ _: [
62
+ {
63
+ srcPath: "/_api/iam/authentication",
64
+ destPath: ""
65
+ }
66
+ ],
67
+ "users._base_domain_": [
68
+ {
69
+ srcPath: "/iam/wix/google",
70
+ destPath: "/v1/sso/callback/root/0e6a50f5-b523-4e29-990d-f37fa2ffdd69"
71
+ },
72
+ {
73
+ srcPath: "/authentication",
74
+ destPath: ""
75
+ }
76
+ ],
77
+ "www.wixapis.com": [
78
+ {
79
+ srcPath: "/_api/iam/authentication",
80
+ destPath: ""
81
+ },
82
+ {
83
+ srcPath: "/iam/authentication",
84
+ destPath: ""
85
+ }
86
+ ],
87
+ "bo._base_domain_": [
88
+ {
89
+ srcPath: "/_api/iam/authentication",
90
+ destPath: ""
91
+ }
92
+ ],
93
+ "wixbo.ai": [
94
+ {
95
+ srcPath: "/_api/iam/authentication",
96
+ destPath: ""
97
+ }
98
+ ],
99
+ "wix-bo.com": [
100
+ {
101
+ srcPath: "/_api/iam/authentication",
102
+ destPath: ""
103
+ }
104
+ ],
105
+ "dev._base_domain_": [
106
+ {
107
+ srcPath: "/_api/iam/authentication",
108
+ destPath: ""
109
+ }
110
+ ],
111
+ "manage._base_domain_": [
112
+ {
113
+ srcPath: "/_api/authentication",
114
+ destPath: ""
115
+ }
116
+ ],
117
+ "www._base_domain_": [
118
+ {
119
+ srcPath: "/_api/iam/authentication",
120
+ destPath: ""
121
+ }
122
+ ]
123
+ };
124
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
125
+ }
126
+ var PACKAGE_NAME = "@wix/auto_sdk_identity_authentication";
127
+ function registerV2(payload) {
128
+ function __registerV2({ host }) {
129
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
130
+ {
131
+ transformFn: import_float.transformSDKFloatToRESTFloat,
132
+ paths: [{ path: "profile.customFields.value.numValue" }]
133
+ },
134
+ {
135
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
136
+ paths: [{ path: "profile.customFields.value.dateValue" }]
137
+ }
138
+ ]);
139
+ const metadata = {
140
+ entityFqdn: "wix.iam.authentication.v1.authentication",
141
+ method: "POST",
142
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.RegisterV2",
143
+ packageName: PACKAGE_NAME,
144
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
145
+ protoPath: "/v2/register",
146
+ data: serializedData,
147
+ host
148
+ }),
149
+ data: serializedData,
150
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
151
+ {
152
+ transformFn: import_bytes.transformRESTBytesToSDKBytes,
153
+ paths: [
154
+ {
155
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.challenge"
156
+ },
157
+ {
158
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.allowCredentials.id"
159
+ },
160
+ {
161
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.extensions.largeBlobWrite"
162
+ }
163
+ ]
164
+ },
165
+ {
166
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
167
+ paths: [
168
+ { path: "identity.createdDate" },
169
+ { path: "identity.updatedDate" },
170
+ { path: "identity.identityProfile.customFields.value.dateValue" },
171
+ { path: "additionalData.*.dateValue" }
172
+ ]
173
+ },
174
+ {
175
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
176
+ paths: [
177
+ { path: "identity.identityProfile.customFields.value.numValue" },
178
+ { path: "additionalData.*.numValue" }
179
+ ]
180
+ }
181
+ ])
182
+ };
183
+ return metadata;
184
+ }
185
+ return __registerV2;
186
+ }
187
+ function loginV2(payload) {
188
+ function __loginV2({ host }) {
189
+ const metadata = {
190
+ entityFqdn: "wix.iam.authentication.v1.authentication",
191
+ method: "POST",
192
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.LoginV2",
193
+ packageName: PACKAGE_NAME,
194
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
195
+ protoPath: "/v2/login",
196
+ data: payload,
197
+ host
198
+ }),
199
+ data: payload,
200
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
201
+ {
202
+ transformFn: import_bytes.transformRESTBytesToSDKBytes,
203
+ paths: [
204
+ {
205
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.challenge"
206
+ },
207
+ {
208
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.allowCredentials.id"
209
+ },
210
+ {
211
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.extensions.largeBlobWrite"
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
217
+ paths: [
218
+ { path: "identity.createdDate" },
219
+ { path: "identity.updatedDate" },
220
+ { path: "identity.identityProfile.customFields.value.dateValue" },
221
+ { path: "additionalData.*.dateValue" }
222
+ ]
223
+ },
224
+ {
225
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
226
+ paths: [
227
+ { path: "identity.identityProfile.customFields.value.numValue" },
228
+ { path: "additionalData.*.numValue" }
229
+ ]
230
+ }
231
+ ])
232
+ };
233
+ return metadata;
234
+ }
235
+ return __loginV2;
236
+ }
237
+ function changePassword(payload) {
238
+ function __changePassword({ host }) {
239
+ const metadata = {
240
+ entityFqdn: "wix.iam.authentication.v1.authentication",
241
+ method: "POST",
242
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.ChangePassword",
243
+ packageName: PACKAGE_NAME,
244
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
245
+ protoPath: "/v2/change-password",
246
+ data: payload,
247
+ host
248
+ }),
249
+ data: payload
250
+ };
251
+ return metadata;
252
+ }
253
+ return __changePassword;
254
+ }
255
+ function loginCallback(payload) {
256
+ function __loginCallback({ host }) {
257
+ const metadata = {
258
+ entityFqdn: "wix.iam.authentication.v1.authentication",
259
+ method: "GET",
260
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.LoginCallback",
261
+ packageName: PACKAGE_NAME,
262
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
263
+ protoPath: "/v1/callback",
264
+ data: payload,
265
+ host
266
+ }),
267
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
268
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
269
+ {
270
+ transformFn: import_bytes.transformRESTBytesToSDKBytes,
271
+ paths: [{ path: "body" }]
272
+ }
273
+ ])
274
+ };
275
+ return metadata;
276
+ }
277
+ return __loginCallback;
278
+ }
279
+ function signOn(payload) {
280
+ function __signOn({ host }) {
281
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
282
+ {
283
+ transformFn: import_float.transformSDKFloatToRESTFloat,
284
+ paths: [{ path: "profile.customFields.value.numValue" }]
285
+ },
286
+ {
287
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
288
+ paths: [{ path: "profile.customFields.value.dateValue" }]
289
+ }
290
+ ]);
291
+ const metadata = {
292
+ entityFqdn: "wix.iam.authentication.v1.authentication",
293
+ method: "POST",
294
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.SignOn",
295
+ packageName: PACKAGE_NAME,
296
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
297
+ protoPath: "/v2/sign-on",
298
+ data: serializedData,
299
+ host
300
+ }),
301
+ data: serializedData,
302
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
303
+ {
304
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
305
+ paths: [
306
+ { path: "identity.createdDate" },
307
+ { path: "identity.updatedDate" },
308
+ { path: "identity.identityProfile.customFields.value.dateValue" }
309
+ ]
310
+ },
311
+ {
312
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
313
+ paths: [
314
+ { path: "identity.identityProfile.customFields.value.numValue" }
315
+ ]
316
+ }
317
+ ])
318
+ };
319
+ return metadata;
320
+ }
321
+ return __signOn;
322
+ }
323
+ function logout(payload) {
324
+ function __logout({ host }) {
325
+ const metadata = {
326
+ entityFqdn: "wix.iam.authentication.v1.authentication",
327
+ method: "GET",
328
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.Logout",
329
+ packageName: PACKAGE_NAME,
330
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
331
+ protoPath: "/v1/logout",
332
+ data: payload,
333
+ host
334
+ }),
335
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
336
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
337
+ {
338
+ transformFn: import_bytes.transformRESTBytesToSDKBytes,
339
+ paths: [{ path: "body" }]
340
+ }
341
+ ])
342
+ };
343
+ return metadata;
344
+ }
345
+ return __logout;
346
+ }
347
+ function verify(payload) {
348
+ function __verify({ host }) {
349
+ const metadata = {
350
+ entityFqdn: "wix.iam.authentication.v1.authentication",
351
+ method: "POST",
352
+ methodFqn: "wix.iam.authentication.v1.AuthenticationService.Verify",
353
+ packageName: PACKAGE_NAME,
354
+ url: resolveWixIamAuthenticationV1AuthenticationServiceUrl({
355
+ protoPath: "/v2/{factorType}/verify",
356
+ data: payload,
357
+ host
358
+ }),
359
+ data: payload,
360
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
361
+ {
362
+ transformFn: import_bytes.transformRESTBytesToSDKBytes,
363
+ paths: [
364
+ {
365
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.challenge"
366
+ },
367
+ {
368
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.allowCredentials.id"
369
+ },
370
+ {
371
+ path: "mfaChallengeData.verificationChallengeData.webauthnData.extensions.largeBlobWrite"
372
+ }
373
+ ]
374
+ },
375
+ {
376
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
377
+ paths: [
378
+ { path: "identity.createdDate" },
379
+ { path: "identity.updatedDate" },
380
+ { path: "identity.identityProfile.customFields.value.dateValue" },
381
+ { path: "additionalData.*.dateValue" }
382
+ ]
383
+ },
384
+ {
385
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
386
+ paths: [
387
+ { path: "identity.identityProfile.customFields.value.numValue" },
388
+ { path: "additionalData.*.numValue" }
389
+ ]
390
+ }
391
+ ])
392
+ };
393
+ return metadata;
394
+ }
395
+ return __verify;
396
+ }
397
+
398
+ // src/iam-authentication-v1-authentication-authentication.universal.ts
399
+ var import_address = require("@wix/sdk-runtime/transformations/address");
400
+ var import_address2 = require("@wix/sdk-runtime/transformations/address");
401
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
402
+ var PrivacyStatus = /* @__PURE__ */ ((PrivacyStatus2) => {
403
+ PrivacyStatus2["UNDEFINED"] = "UNDEFINED";
404
+ PrivacyStatus2["PUBLIC"] = "PUBLIC";
405
+ PrivacyStatus2["PRIVATE"] = "PRIVATE";
406
+ return PrivacyStatus2;
407
+ })(PrivacyStatus || {});
408
+ var EmailTag = /* @__PURE__ */ ((EmailTag2) => {
409
+ EmailTag2["UNTAGGED"] = "UNTAGGED";
410
+ EmailTag2["MAIN"] = "MAIN";
411
+ EmailTag2["HOME"] = "HOME";
412
+ EmailTag2["WORK"] = "WORK";
413
+ return EmailTag2;
414
+ })(EmailTag || {});
415
+ var PhoneTag = /* @__PURE__ */ ((PhoneTag2) => {
416
+ PhoneTag2["UNTAGGED"] = "UNTAGGED";
417
+ PhoneTag2["MAIN"] = "MAIN";
418
+ PhoneTag2["HOME"] = "HOME";
419
+ PhoneTag2["MOBILE"] = "MOBILE";
420
+ PhoneTag2["WORK"] = "WORK";
421
+ PhoneTag2["FAX"] = "FAX";
422
+ return PhoneTag2;
423
+ })(PhoneTag || {});
424
+ var AddressTag = /* @__PURE__ */ ((AddressTag2) => {
425
+ AddressTag2["UNTAGGED"] = "UNTAGGED";
426
+ AddressTag2["HOME"] = "HOME";
427
+ AddressTag2["WORK"] = "WORK";
428
+ AddressTag2["BILLING"] = "BILLING";
429
+ AddressTag2["SHIPPING"] = "SHIPPING";
430
+ return AddressTag2;
431
+ })(AddressTag || {});
432
+ var StateType = /* @__PURE__ */ ((StateType2) => {
433
+ StateType2["UNKNOWN_STATE"] = "UNKNOWN_STATE";
434
+ StateType2["SUCCESS"] = "SUCCESS";
435
+ StateType2["REQUIRE_OWNER_APPROVAL"] = "REQUIRE_OWNER_APPROVAL";
436
+ StateType2["REQUIRE_EMAIL_VERIFICATION"] = "REQUIRE_EMAIL_VERIFICATION";
437
+ StateType2["STATUS_CHECK"] = "STATUS_CHECK";
438
+ return StateType2;
439
+ })(StateType || {});
440
+ var StatusName = /* @__PURE__ */ ((StatusName2) => {
441
+ StatusName2["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
442
+ StatusName2["PENDING"] = "PENDING";
443
+ StatusName2["ACTIVE"] = "ACTIVE";
444
+ StatusName2["DELETED"] = "DELETED";
445
+ StatusName2["BLOCKED"] = "BLOCKED";
446
+ StatusName2["OFFLINE"] = "OFFLINE";
447
+ return StatusName2;
448
+ })(StatusName || {});
449
+ var Reason = /* @__PURE__ */ ((Reason2) => {
450
+ Reason2["UNKNOWN_REASON"] = "UNKNOWN_REASON";
451
+ Reason2["PENDING_ADMIN_APPROVAL_REQUIRED"] = "PENDING_ADMIN_APPROVAL_REQUIRED";
452
+ Reason2["PENDING_EMAIL_VERIFICATION_REQUIRED"] = "PENDING_EMAIL_VERIFICATION_REQUIRED";
453
+ return Reason2;
454
+ })(Reason || {});
455
+ var FactorType = /* @__PURE__ */ ((FactorType2) => {
456
+ FactorType2["UNKNOWN_FACTOR_TYPE"] = "UNKNOWN_FACTOR_TYPE";
457
+ FactorType2["PASSWORD"] = "PASSWORD";
458
+ FactorType2["SMS"] = "SMS";
459
+ FactorType2["CALL"] = "CALL";
460
+ FactorType2["EMAIL"] = "EMAIL";
461
+ FactorType2["TOTP"] = "TOTP";
462
+ FactorType2["PUSH"] = "PUSH";
463
+ FactorType2["WEBAUTHN"] = "WEBAUTHN";
464
+ return FactorType2;
465
+ })(FactorType || {});
466
+ var Status = /* @__PURE__ */ ((Status2) => {
467
+ Status2["INACTIVE"] = "INACTIVE";
468
+ Status2["ACTIVE"] = "ACTIVE";
469
+ Status2["REQUIRE_REENROLL"] = "REQUIRE_REENROLL";
470
+ return Status2;
471
+ })(Status || {});
472
+ var FactorStatus = /* @__PURE__ */ ((FactorStatus2) => {
473
+ FactorStatus2["UNKNOWN_FACTOR_STATUS"] = "UNKNOWN_FACTOR_STATUS";
474
+ FactorStatus2["ENABLED"] = "ENABLED";
475
+ FactorStatus2["REQUIRE_ACTIVATION"] = "REQUIRE_ACTIVATION";
476
+ FactorStatus2["REQUIRE_REENROLL"] = "REQUIRE_REENROLL";
477
+ FactorStatus2["ENABLED_BY_RULE"] = "ENABLED_BY_RULE";
478
+ FactorStatus2["DISABLED_BY_RULE"] = "DISABLED_BY_RULE";
479
+ return FactorStatus2;
480
+ })(FactorStatus || {});
481
+ var MfaReason = /* @__PURE__ */ ((MfaReason2) => {
482
+ MfaReason2["UNKNOWN_MFA_REASON"] = "UNKNOWN_MFA_REASON";
483
+ MfaReason2["USER_SETTINGS"] = "USER_SETTINGS";
484
+ MfaReason2["HIGH_RISK_LOGIN"] = "HIGH_RISK_LOGIN";
485
+ return MfaReason2;
486
+ })(MfaReason || {});
487
+ var UserVerificationRequirement = /* @__PURE__ */ ((UserVerificationRequirement2) => {
488
+ UserVerificationRequirement2["USER_VERIFICATION_UNSPECIFIED"] = "USER_VERIFICATION_UNSPECIFIED";
489
+ UserVerificationRequirement2["USER_VERIFICATION_REQUIRED"] = "USER_VERIFICATION_REQUIRED";
490
+ UserVerificationRequirement2["USER_VERIFICATION_PREFERRED"] = "USER_VERIFICATION_PREFERRED";
491
+ UserVerificationRequirement2["USER_VERIFICATION_DISCOURAGED"] = "USER_VERIFICATION_DISCOURAGED";
492
+ return UserVerificationRequirement2;
493
+ })(UserVerificationRequirement || {});
494
+ var TenantType = /* @__PURE__ */ ((TenantType2) => {
495
+ TenantType2["UNKNOWN_TENANT_TYPE"] = "UNKNOWN_TENANT_TYPE";
496
+ TenantType2["ACCOUNT"] = "ACCOUNT";
497
+ TenantType2["SITE"] = "SITE";
498
+ TenantType2["ROOT"] = "ROOT";
499
+ return TenantType2;
500
+ })(TenantType || {});
501
+ async function registerV22(loginId, options) {
502
+ const { httpClient, sideEffects } = arguments[2];
503
+ const payload = (0, import_transform_paths2.transformPaths)(
504
+ (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
505
+ loginId,
506
+ password: options?.password,
507
+ profile: options?.profile,
508
+ captchaTokens: options?.captchaTokens,
509
+ clientMetaData: options?.clientMetaData
510
+ }),
511
+ [
512
+ {
513
+ transformFn: import_address.transformSDKAddressToRESTAddress,
514
+ paths: [{ path: "profile.addresses.address" }]
515
+ }
516
+ ]
517
+ );
518
+ const reqOpts = registerV2(payload);
519
+ sideEffects?.onSiteCall?.();
520
+ try {
521
+ const result = await httpClient.request(reqOpts);
522
+ sideEffects?.onSuccess?.(result);
523
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
524
+ (0, import_transform_paths2.transformPaths)(result.data, [
525
+ {
526
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
527
+ paths: [{ path: "identity.identityProfile.addresses.address" }]
528
+ }
529
+ ])
530
+ );
531
+ } catch (err) {
532
+ const transformedError = (0, import_transform_error.transformError)(
533
+ err,
534
+ {
535
+ spreadPathsToArguments: {},
536
+ explicitPathsToArguments: {
537
+ loginId: "$[0]",
538
+ password: "$[1].password",
539
+ profile: "$[1].profile",
540
+ captchaTokens: "$[1].captchaTokens",
541
+ clientMetaData: "$[1].clientMetaData"
542
+ },
543
+ singleArgumentUnchanged: false
544
+ },
545
+ ["loginId", "options"]
546
+ );
547
+ sideEffects?.onError?.(err);
548
+ throw transformedError;
549
+ }
550
+ }
551
+ async function loginV22(loginId, options) {
552
+ const { httpClient, sideEffects } = arguments[2];
553
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
554
+ loginId,
555
+ password: options?.password,
556
+ captchaTokens: options?.captchaTokens,
557
+ clientMetaData: options?.clientMetaData
558
+ });
559
+ const reqOpts = loginV2(payload);
560
+ sideEffects?.onSiteCall?.();
561
+ try {
562
+ const result = await httpClient.request(reqOpts);
563
+ sideEffects?.onSuccess?.(result);
564
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
565
+ (0, import_transform_paths2.transformPaths)(result.data, [
566
+ {
567
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
568
+ paths: [{ path: "identity.identityProfile.addresses.address" }]
569
+ }
570
+ ])
571
+ );
572
+ } catch (err) {
573
+ const transformedError = (0, import_transform_error.transformError)(
574
+ err,
575
+ {
576
+ spreadPathsToArguments: {},
577
+ explicitPathsToArguments: {
578
+ loginId: "$[0]",
579
+ password: "$[1].password",
580
+ captchaTokens: "$[1].captchaTokens",
581
+ clientMetaData: "$[1].clientMetaData"
582
+ },
583
+ singleArgumentUnchanged: false
584
+ },
585
+ ["loginId", "options"]
586
+ );
587
+ sideEffects?.onError?.(err);
588
+ throw transformedError;
589
+ }
590
+ }
591
+ async function changePassword2(newPassword) {
592
+ const { httpClient, sideEffects } = arguments[1];
593
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
594
+ newPassword
595
+ });
596
+ const reqOpts = changePassword(payload);
597
+ sideEffects?.onSiteCall?.();
598
+ try {
599
+ const result = await httpClient.request(reqOpts);
600
+ sideEffects?.onSuccess?.(result);
601
+ } catch (err) {
602
+ const transformedError = (0, import_transform_error.transformError)(
603
+ err,
604
+ {
605
+ spreadPathsToArguments: {},
606
+ explicitPathsToArguments: { newPassword: "$[0]" },
607
+ singleArgumentUnchanged: false
608
+ },
609
+ ["newPassword"]
610
+ );
611
+ sideEffects?.onError?.(err);
612
+ throw transformedError;
613
+ }
614
+ }
615
+ async function loginCallback2(options) {
616
+ const { httpClient, sideEffects } = arguments[1];
617
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
618
+ state: options?.state,
619
+ sessionToken: options?.sessionToken
620
+ });
621
+ const reqOpts = loginCallback(payload);
622
+ sideEffects?.onSiteCall?.();
623
+ try {
624
+ const result = await httpClient.request(reqOpts);
625
+ sideEffects?.onSuccess?.(result);
626
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
627
+ } catch (err) {
628
+ const transformedError = (0, import_transform_error.transformError)(
629
+ err,
630
+ {
631
+ spreadPathsToArguments: {},
632
+ explicitPathsToArguments: {
633
+ state: "$[0].state",
634
+ sessionToken: "$[0].sessionToken"
635
+ },
636
+ singleArgumentUnchanged: false
637
+ },
638
+ ["options"]
639
+ );
640
+ sideEffects?.onError?.(err);
641
+ throw transformedError;
642
+ }
643
+ }
644
+ async function signOn2(loginId, options) {
645
+ const { httpClient, sideEffects } = arguments[2];
646
+ const payload = (0, import_transform_paths2.transformPaths)(
647
+ (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
648
+ loginId,
649
+ profile: options?.profile,
650
+ verifyEmail: options?.verifyEmail,
651
+ mergeExistingContact: options?.mergeExistingContact
652
+ }),
653
+ [
654
+ {
655
+ transformFn: import_address.transformSDKAddressToRESTAddress,
656
+ paths: [{ path: "profile.addresses.address" }]
657
+ }
658
+ ]
659
+ );
660
+ const reqOpts = signOn(payload);
661
+ sideEffects?.onSiteCall?.();
662
+ try {
663
+ const result = await httpClient.request(reqOpts);
664
+ sideEffects?.onSuccess?.(result);
665
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
666
+ (0, import_transform_paths2.transformPaths)(result.data, [
667
+ {
668
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
669
+ paths: [{ path: "identity.identityProfile.addresses.address" }]
670
+ }
671
+ ])
672
+ );
673
+ } catch (err) {
674
+ const transformedError = (0, import_transform_error.transformError)(
675
+ err,
676
+ {
677
+ spreadPathsToArguments: {},
678
+ explicitPathsToArguments: {
679
+ loginId: "$[0]",
680
+ profile: "$[1].profile",
681
+ verifyEmail: "$[1].verifyEmail",
682
+ mergeExistingContact: "$[1].mergeExistingContact"
683
+ },
684
+ singleArgumentUnchanged: false
685
+ },
686
+ ["loginId", "options"]
687
+ );
688
+ sideEffects?.onError?.(err);
689
+ throw transformedError;
690
+ }
691
+ }
692
+ async function logout2(options) {
693
+ const { httpClient, sideEffects } = arguments[1];
694
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
695
+ postLogoutRedirectUri: options?.postLogoutRedirectUri,
696
+ clientId: options?.clientId
697
+ });
698
+ const reqOpts = logout(payload);
699
+ sideEffects?.onSiteCall?.();
700
+ try {
701
+ const result = await httpClient.request(reqOpts);
702
+ sideEffects?.onSuccess?.(result);
703
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
704
+ } catch (err) {
705
+ const transformedError = (0, import_transform_error.transformError)(
706
+ err,
707
+ {
708
+ spreadPathsToArguments: {},
709
+ explicitPathsToArguments: {
710
+ postLogoutRedirectUri: "$[0].postLogoutRedirectUri",
711
+ clientId: "$[0].clientId"
712
+ },
713
+ singleArgumentUnchanged: false
714
+ },
715
+ ["options"]
716
+ );
717
+ sideEffects?.onError?.(err);
718
+ throw transformedError;
719
+ }
720
+ }
721
+ async function verify2(factorType, options) {
722
+ const { httpClient, sideEffects } = arguments[2];
723
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
724
+ factorType,
725
+ stateToken: options?.stateToken,
726
+ rememberThisDevice: options?.rememberThisDevice,
727
+ smsData: options?.smsData,
728
+ callData: options?.callData,
729
+ emailData: options?.emailData,
730
+ totpData: options?.totpData,
731
+ pushData: options?.pushData,
732
+ webauthnData: options?.webauthnData
733
+ });
734
+ const reqOpts = verify(payload);
735
+ sideEffects?.onSiteCall?.();
736
+ try {
737
+ const result = await httpClient.request(reqOpts);
738
+ sideEffects?.onSuccess?.(result);
739
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
740
+ (0, import_transform_paths2.transformPaths)(result.data, [
741
+ {
742
+ transformFn: import_address2.transformRESTAddressToSDKAddress,
743
+ paths: [{ path: "identity.identityProfile.addresses.address" }]
744
+ }
745
+ ])
746
+ );
747
+ } catch (err) {
748
+ const transformedError = (0, import_transform_error.transformError)(
749
+ err,
750
+ {
751
+ spreadPathsToArguments: {},
752
+ explicitPathsToArguments: {
753
+ factorType: "$[0]",
754
+ stateToken: "$[1].stateToken",
755
+ rememberThisDevice: "$[1].rememberThisDevice",
756
+ smsData: "$[1].smsData",
757
+ callData: "$[1].callData",
758
+ emailData: "$[1].emailData",
759
+ totpData: "$[1].totpData",
760
+ pushData: "$[1].pushData",
761
+ webauthnData: "$[1].webauthnData"
762
+ },
763
+ singleArgumentUnchanged: false
764
+ },
765
+ ["factorType", "options"]
766
+ );
767
+ sideEffects?.onError?.(err);
768
+ throw transformedError;
769
+ }
770
+ }
771
+ // Annotate the CommonJS export names for ESM import in node:
772
+ 0 && (module.exports = {
773
+ AddressTag,
774
+ EmailTag,
775
+ FactorStatus,
776
+ FactorType,
777
+ MfaReason,
778
+ PhoneTag,
779
+ PrivacyStatus,
780
+ Reason,
781
+ StateType,
782
+ Status,
783
+ StatusName,
784
+ TenantType,
785
+ UserVerificationRequirement,
786
+ changePassword,
787
+ loginCallback,
788
+ loginV2,
789
+ logout,
790
+ registerV2,
791
+ signOn,
792
+ verify
793
+ });
794
+ //# sourceMappingURL=index.typings.js.map