@memberstack/dom 1.9.7 → 1.9.9

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/lib/auth/index.js CHANGED
@@ -44,13 +44,17 @@ exports.getPersistedMember = function () {
44
44
  };
45
45
  exports.setPersistedMember = function (member) {
46
46
  if (member) {
47
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", JSON.stringify(member));
47
+ var data = JSON.stringify(member);
48
+ if (data)
49
+ localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", data);
48
50
  observable.notify(member);
49
51
  }
50
52
  };
51
53
  exports.updatePersistedMember = function (member) {
52
54
  if (member) {
53
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", JSON.stringify(member));
55
+ var data = JSON.stringify(member);
56
+ if (data)
57
+ localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", data);
54
58
  }
55
59
  else {
56
60
  localStorage === null || localStorage === void 0 ? void 0 : localStorage.removeItem("_ms-mem");
package/lib/index.d.ts CHANGED
@@ -10,65 +10,127 @@ declare const _default: {
10
10
  unsubscribe: () => boolean;
11
11
  };
12
12
  } & {
13
- getApp(): Promise<{
13
+ signupWithProvider(params?: import("./types").SignupWithProviderParams): Promise<unknown>;
14
+ loginWithProvider(params?: import("./types").LoginWithProviderParams): Promise<unknown>;
15
+ connectProvider(params?: import("./types").LoginWithProviderParams): Promise<{
14
16
  data: {
15
- id: string;
16
- name: string;
17
- mode: "live" | "sandbox";
18
- plans: {
17
+ providers: {
18
+ provider: string;
19
+ }[];
20
+ };
21
+ }>;
22
+ disconnectProvider(params: import("./types").LoginWithProviderParams): Promise<{
23
+ data: {
24
+ providers: {
25
+ provider: string;
26
+ }[];
27
+ };
28
+ }>;
29
+ getAppAndMember(params?: any): Promise<{
30
+ data: {
31
+ app: {
19
32
  id: string;
20
33
  name: string;
21
- description: string;
22
- status: string;
23
- redirects: {
24
- afterLogin: string;
25
- afterLogout: string;
26
- afterSignup: string;
27
- };
28
- prices?: [] | {
34
+ mode: "live" | "sandbox";
35
+ plans: {
29
36
  id: string;
30
- amount: string;
31
- interval: {
32
- type: string;
33
- count: number;
34
- };
35
37
  name: string;
36
- type: string;
38
+ description: string;
37
39
  status: string;
38
- currency: string;
39
- }[];
40
- }[];
41
- contentGroups: {
42
- id: string;
43
- name: string;
44
- key: string;
45
- allowAllMembers: boolean;
46
- redirect: string;
47
- urls: {
48
- url: string;
49
- filter: string;
40
+ redirects: {
41
+ afterLogin: string;
42
+ afterLogout: string;
43
+ afterSignup: string;
44
+ };
45
+ prices?: [] | {
46
+ id: string;
47
+ amount: string;
48
+ interval: {
49
+ type: string;
50
+ count: number;
51
+ };
52
+ name: string;
53
+ type: string;
54
+ status: string;
55
+ currency: string;
56
+ }[];
50
57
  }[];
51
- plans: {
58
+ contentGroups: {
52
59
  id: string;
60
+ name: string;
61
+ key: string;
62
+ allowAllMembers: boolean;
63
+ activeMemberHasAccess?: boolean;
64
+ redirect: string;
65
+ urls: {
66
+ url: string;
67
+ filter: string;
68
+ }[];
69
+ plans: {
70
+ id: string;
71
+ }[];
53
72
  }[];
54
- }[];
55
- customField: {
56
- order: number;
57
- key: string;
58
- label: string;
59
- hidden: boolean;
60
- }[];
61
- branding: {
62
- logo: string;
63
- colors: {
64
- lightMode: {
65
- primaryButton: string;
73
+ emailVerificationEnabled: boolean;
74
+ requireEmailVerification: boolean;
75
+ customField: {
76
+ order: number;
77
+ key: string;
78
+ label: string;
79
+ hidden: boolean;
80
+ }[];
81
+ branding: {
82
+ logo: string;
83
+ colors: {
84
+ lightMode: {
85
+ primaryButton: string;
86
+ };
66
87
  };
67
88
  };
89
+ authProviders: {
90
+ clientId: string;
91
+ provider: string;
92
+ providerType: string;
93
+ icon: string;
94
+ }[];
95
+ };
96
+ member: {
97
+ id: string;
98
+ verified: boolean;
99
+ auth: {
100
+ email: string;
101
+ hasPassword: boolean;
102
+ providers: {
103
+ provider: string;
104
+ }[];
105
+ };
106
+ loginRedirect: string;
107
+ stripeCustomerId: string;
108
+ createdAt: string;
109
+ metaData: object;
110
+ customFields: object;
111
+ permissions: [] | string[];
112
+ planConnections: {
113
+ id: string;
114
+ active: boolean;
115
+ status: string;
116
+ planId: string;
117
+ type: string;
118
+ payment: {
119
+ amount: number;
120
+ currency: string;
121
+ status: string;
122
+ lastBillingDate: number;
123
+ nextBillingDate: number;
124
+ cancelAtDate: number;
125
+ lastInvoice: string;
126
+ lastReceipt: string;
127
+ card: string;
128
+ };
129
+ }[];
68
130
  };
69
131
  };
70
132
  }>;
71
- getAuthProviders(): Promise<{
133
+ getApp(): Promise<{
72
134
  data: {
73
135
  id: string;
74
136
  name: string;
@@ -101,6 +163,7 @@ declare const _default: {
101
163
  name: string;
102
164
  key: string;
103
165
  allowAllMembers: boolean;
166
+ activeMemberHasAccess?: boolean;
104
167
  redirect: string;
105
168
  urls: {
106
169
  url: string;
@@ -110,6 +173,8 @@ declare const _default: {
110
173
  id: string;
111
174
  }[];
112
175
  }[];
176
+ emailVerificationEnabled: boolean;
177
+ requireEmailVerification: boolean;
113
178
  customField: {
114
179
  order: number;
115
180
  key: string;
@@ -124,9 +189,15 @@ declare const _default: {
124
189
  };
125
190
  };
126
191
  };
192
+ authProviders: {
193
+ clientId: string;
194
+ provider: string;
195
+ providerType: string;
196
+ icon: string;
197
+ }[];
127
198
  };
128
199
  }>;
129
- loginMemberEmailPassword(params: import("./types").LoginMemberEmailPasswordParams): Promise<{
200
+ loginMemberEmailPassword(params: import("./types").LoginMemberEmailPasswordParams, options?: any): Promise<{
130
201
  data: {
131
202
  tokens: {
132
203
  accessToken: string;
@@ -135,8 +206,13 @@ declare const _default: {
135
206
  };
136
207
  member: {
137
208
  id: string;
209
+ verified: boolean;
138
210
  auth: {
139
211
  email: string;
212
+ hasPassword: boolean;
213
+ providers: {
214
+ provider: string;
215
+ }[];
140
216
  };
141
217
  loginRedirect: string;
142
218
  stripeCustomerId: string;
@@ -164,10 +240,21 @@ declare const _default: {
164
240
  }[];
165
241
  };
166
242
  redirect: string;
167
- payment: {
168
- requirePayment: string[];
169
- requireAuthentication: string[];
170
- };
243
+ contentGroups?: {
244
+ id: string;
245
+ name: string;
246
+ key: string;
247
+ allowAllMembers: boolean;
248
+ activeMemberHasAccess?: boolean;
249
+ redirect: string;
250
+ urls: {
251
+ url: string;
252
+ filter: string;
253
+ }[];
254
+ plans: {
255
+ id: string;
256
+ }[];
257
+ }[];
171
258
  };
172
259
  }>;
173
260
  loginMemberAuthProvider(params: import("./types").LoginMemberAuthProviderParams): Promise<{
@@ -179,8 +266,13 @@ declare const _default: {
179
266
  };
180
267
  member: {
181
268
  id: string;
269
+ verified: boolean;
182
270
  auth: {
183
271
  email: string;
272
+ hasPassword: boolean;
273
+ providers: {
274
+ provider: string;
275
+ }[];
184
276
  };
185
277
  loginRedirect: string;
186
278
  stripeCustomerId: string;
@@ -208,10 +300,21 @@ declare const _default: {
208
300
  }[];
209
301
  };
210
302
  redirect: string;
211
- payment: {
212
- requirePayment: string[];
213
- requireAuthentication: string[];
214
- };
303
+ contentGroups?: {
304
+ id: string;
305
+ name: string;
306
+ key: string;
307
+ allowAllMembers: boolean;
308
+ activeMemberHasAccess?: boolean;
309
+ redirect: string;
310
+ urls: {
311
+ url: string;
312
+ filter: string;
313
+ }[];
314
+ plans: {
315
+ id: string;
316
+ }[];
317
+ }[];
215
318
  };
216
319
  }>;
217
320
  getPlan(params: import("./types").GetPlanParams): Promise<{
@@ -270,6 +373,7 @@ declare const _default: {
270
373
  name: string;
271
374
  key: string;
272
375
  allowAllMembers: boolean;
376
+ activeMemberHasAccess?: boolean;
273
377
  redirect: string;
274
378
  urls: {
275
379
  url: string;
@@ -283,8 +387,13 @@ declare const _default: {
283
387
  getCurrentMember(options?: import("./methods/requests").GetCurrentMemberParams): Promise<{
284
388
  data: {
285
389
  id: string;
390
+ verified: boolean;
286
391
  auth: {
287
392
  email: string;
393
+ hasPassword: boolean;
394
+ providers: {
395
+ provider: string;
396
+ }[];
288
397
  };
289
398
  loginRedirect: string;
290
399
  stripeCustomerId: string;
@@ -322,83 +431,6 @@ declare const _default: {
322
431
  json: object;
323
432
  };
324
433
  }>;
325
- getMemberCards(options?: import("./methods/requests").MemberstackOptions): Promise<{
326
- data: {
327
- id: string;
328
- brand: string;
329
- expMonth: string;
330
- expYear: string;
331
- last4: string;
332
- default: boolean;
333
- }[];
334
- }>;
335
- getMemberInvoices(params?: import("./types").GetMemberInvoicesParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
336
- hasNext: boolean;
337
- endCursor: string;
338
- totalCount: number;
339
- data: {
340
- id: string;
341
- status: string;
342
- amount: number;
343
- url: string;
344
- description: string;
345
- number: string;
346
- planConnection: string;
347
- createdAt: string;
348
- currency: string;
349
- }[];
350
- }>;
351
- getMemberReceipts(params?: import("./types").GetMemberReceiptsParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
352
- hasNext: boolean;
353
- endCursor: string;
354
- totalCount: number;
355
- data: {
356
- id: string;
357
- amount: number;
358
- url: string;
359
- stripe?: {
360
- url: string;
361
- };
362
- number: string;
363
- purchase: string;
364
- invoice: string;
365
- createdAt: string;
366
- currency: string;
367
- }[];
368
- }>;
369
- getAuthenticationClientSecret(params: import("./types").GetAuthenticationClientSecretParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
370
- data: string;
371
- }>;
372
- getTotalCheckoutAmount(params: import("./types").GetTotalCheckoutAmountParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
373
- data: {
374
- total: number;
375
- subTotal: number;
376
- currency: string;
377
- setupFee?: {
378
- enabled: boolean;
379
- amount: number;
380
- name: string;
381
- };
382
- freeTrial?: {
383
- days: number;
384
- enabled: boolean;
385
- };
386
- tax?: {
387
- name: string;
388
- percent: number;
389
- description: string;
390
- }[];
391
- };
392
- }>;
393
- purchasePlans(params: import("./types").PurchasePlansParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
394
- data: {
395
- plan: string;
396
- payment: {
397
- requiresPayment: boolean;
398
- requiresAuthentication: boolean;
399
- };
400
- };
401
- }>;
402
434
  addPlan(params: import("./types").AddPlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
403
435
  data: {
404
436
  redirect: string;
@@ -433,43 +465,16 @@ declare const _default: {
433
465
  };
434
466
  }>;
435
467
  removePlan(params: import("./types").RemovePlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<null>;
436
- cancelPlan(params: import("./types").CancelPlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
437
- data: {
438
- id: string;
439
- auth: {
440
- email: string;
441
- };
442
- loginRedirect: string;
443
- stripeCustomerId: string;
444
- createdAt: string;
445
- metaData: object;
446
- customFields: object;
447
- permissions: [] | string[];
448
- planConnections: {
449
- id: string;
450
- active: boolean;
451
- status: string;
452
- planId: string;
453
- type: string;
454
- payment: {
455
- amount: number;
456
- currency: string;
457
- status: string;
458
- lastBillingDate: number;
459
- nextBillingDate: number;
460
- cancelAtDate: number;
461
- lastInvoice: string;
462
- lastReceipt: string;
463
- card: string;
464
- };
465
- }[];
466
- };
467
- }>;
468
468
  updateMember(params: import("./types").UpdateMemberParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
469
469
  data: {
470
470
  id: string;
471
+ verified: boolean;
471
472
  auth: {
472
473
  email: string;
474
+ hasPassword: boolean;
475
+ providers: {
476
+ provider: string;
477
+ }[];
473
478
  };
474
479
  loginRedirect: string;
475
480
  stripeCustomerId: string;
@@ -500,8 +505,13 @@ declare const _default: {
500
505
  updateMemberAuth(params: import("./types").UpdateMemberAuthParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
501
506
  data: {
502
507
  id: string;
508
+ verified: boolean;
503
509
  auth: {
504
510
  email: string;
511
+ hasPassword: boolean;
512
+ providers: {
513
+ provider: string;
514
+ }[];
505
515
  };
506
516
  loginRedirect: string;
507
517
  stripeCustomerId: string;
@@ -529,75 +539,16 @@ declare const _default: {
529
539
  }[];
530
540
  };
531
541
  }>;
532
- addCard(params: import("./types").AddMemberCardParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
533
- data: {
534
- id: string;
535
- auth: {
536
- email: string;
537
- };
538
- loginRedirect: string;
539
- stripeCustomerId: string;
540
- createdAt: string;
541
- metaData: object;
542
- customFields: object;
543
- permissions: [] | string[];
544
- planConnections: {
545
- id: string;
546
- active: boolean;
547
- status: string;
548
- planId: string;
549
- type: string;
550
- payment: {
551
- amount: number;
552
- currency: string;
553
- status: string;
554
- lastBillingDate: number;
555
- nextBillingDate: number;
556
- cancelAtDate: number;
557
- lastInvoice: string;
558
- lastReceipt: string;
559
- card: string;
560
- };
561
- }[];
562
- };
563
- }>;
564
- updateDefaultCard(params: import("./types").UpdateDefaultCardParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
565
- data: {
566
- id: string;
567
- auth: {
568
- email: string;
569
- };
570
- loginRedirect: string;
571
- stripeCustomerId: string;
572
- createdAt: string;
573
- metaData: object;
574
- customFields: object;
575
- permissions: [] | string[];
576
- planConnections: {
577
- id: string;
578
- active: boolean;
579
- status: string;
580
- planId: string;
581
- type: string;
582
- payment: {
583
- amount: number;
584
- currency: string;
585
- status: string;
586
- lastBillingDate: number;
587
- nextBillingDate: number;
588
- cancelAtDate: number;
589
- lastInvoice: string;
590
- lastReceipt: string;
591
- card: string;
592
- };
593
- }[];
594
- };
595
- }>;
596
- updatePlanPayment(params: import("./types").UpdatePlanPaymentParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
542
+ setPassword(params: import("./types").SetPasswordParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
597
543
  data: {
598
544
  id: string;
545
+ verified: boolean;
599
546
  auth: {
600
547
  email: string;
548
+ hasPassword: boolean;
549
+ providers: {
550
+ provider: string;
551
+ }[];
601
552
  };
602
553
  loginRedirect: string;
603
554
  stripeCustomerId: string;
@@ -625,7 +576,7 @@ declare const _default: {
625
576
  }[];
626
577
  };
627
578
  }>;
628
- signupMemberEmailPassword(params: import("./types").SignupMemberEmailPasswordParams): Promise<{
579
+ signupMemberEmailPassword(params: import("./types").SignupMemberEmailPasswordParams, options?: any): Promise<{
629
580
  data: {
630
581
  tokens: {
631
582
  accessToken: string;
@@ -634,8 +585,13 @@ declare const _default: {
634
585
  };
635
586
  member: {
636
587
  id: string;
588
+ verified: boolean;
637
589
  auth: {
638
590
  email: string;
591
+ hasPassword: boolean;
592
+ providers: {
593
+ provider: string;
594
+ }[];
639
595
  };
640
596
  loginRedirect: string;
641
597
  stripeCustomerId: string;
@@ -663,105 +619,33 @@ declare const _default: {
663
619
  }[];
664
620
  };
665
621
  redirect: string;
666
- payment: {
667
- requirePayment: string[];
668
- requireAuthentication: string[];
669
- };
670
- };
671
- }>;
672
- signupMemberAuthProvider(params: import("./types").SignupMemberAuthProviderParams): Promise<{
673
- data: {
674
- tokens: {
675
- accessToken: string;
676
- expires: number;
677
- type: "bearer";
678
- };
679
- member: {
622
+ contentGroups?: {
680
623
  id: string;
681
- auth: {
682
- email: string;
683
- };
684
- loginRedirect: string;
685
- stripeCustomerId: string;
686
- createdAt: string;
687
- metaData: object;
688
- customFields: object;
689
- permissions: [] | string[];
690
- planConnections: {
624
+ name: string;
625
+ key: string;
626
+ allowAllMembers: boolean;
627
+ activeMemberHasAccess?: boolean;
628
+ redirect: string;
629
+ urls: {
630
+ url: string;
631
+ filter: string;
632
+ }[];
633
+ plans: {
691
634
  id: string;
692
- active: boolean;
693
- status: string;
694
- planId: string;
695
- type: string;
696
- payment: {
697
- amount: number;
698
- currency: string;
699
- status: string;
700
- lastBillingDate: number;
701
- nextBillingDate: number;
702
- cancelAtDate: number;
703
- lastInvoice: string;
704
- lastReceipt: string;
705
- card: string;
706
- };
707
635
  }[];
708
- };
709
- redirect: string;
710
- payment: {
711
- requirePayment: string[];
712
- requireAuthentication: string[];
713
- };
636
+ }[];
714
637
  };
715
638
  }>;
639
+ sendMemberVerificationEmail(): Promise<void>;
716
640
  sendMemberResetPasswordEmail(params: import("./types").SendMemberResetPasswordEmailParams): Promise<{
717
641
  data: string;
718
642
  }>;
719
- resetMemberPassword(params: import("./types").ResetMemberPasswordParams): Promise<{
720
- data: {
721
- id: string;
722
- auth: {
723
- email: string;
724
- };
725
- loginRedirect: string;
726
- stripeCustomerId: string;
727
- createdAt: string;
728
- metaData: object;
729
- customFields: object;
730
- permissions: [] | string[];
731
- planConnections: {
732
- id: string;
733
- active: boolean;
734
- status: string;
735
- planId: string;
736
- type: string;
737
- payment: {
738
- amount: number;
739
- currency: string;
740
- status: string;
741
- lastBillingDate: number;
742
- nextBillingDate: number;
743
- cancelAtDate: number;
744
- lastInvoice: string;
745
- lastReceipt: string;
746
- card: string;
747
- };
748
- }[];
749
- };
750
- }>;
643
+ resetMemberPassword(params: import("./types").ResetMemberPasswordParams): Promise<void>;
751
644
  logout(options?: import("./methods/requests").MemberstackOptions): Promise<{
752
645
  data: {
753
646
  redirect?: string;
754
647
  };
755
648
  }>;
756
- replacePlan(params: import("./types").ReplacePlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
757
- data: {
758
- plan: string;
759
- payment: {
760
- requiresPayment: boolean;
761
- requiresAuthentication: boolean;
762
- };
763
- };
764
- }>;
765
649
  decodeToken({ token }: {
766
650
  token: string;
767
651
  }): Promise<Pick<import("jose").JWTPayload, "iat" | "exp"> & {