@memberstack/dom 1.9.8 → 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
@@ -11,8 +11,22 @@ declare const _default: {
11
11
  };
12
12
  } & {
13
13
  signupWithProvider(params?: import("./types").SignupWithProviderParams): Promise<unknown>;
14
- loginWithProvider(params?: import("./types").SignupWithProviderParams): Promise<unknown>;
15
- getAppAndMember(): Promise<{
14
+ loginWithProvider(params?: import("./types").LoginWithProviderParams): Promise<unknown>;
15
+ connectProvider(params?: import("./types").LoginWithProviderParams): Promise<{
16
+ data: {
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<{
16
30
  data: {
17
31
  app: {
18
32
  id: string;
@@ -84,6 +98,10 @@ declare const _default: {
84
98
  verified: boolean;
85
99
  auth: {
86
100
  email: string;
101
+ hasPassword: boolean;
102
+ providers: {
103
+ provider: string;
104
+ }[];
87
105
  };
88
106
  loginRedirect: string;
89
107
  stripeCustomerId: string;
@@ -179,73 +197,6 @@ declare const _default: {
179
197
  }[];
180
198
  };
181
199
  }>;
182
- getAuthProviders(): Promise<{
183
- data: {
184
- id: string;
185
- name: string;
186
- mode: "live" | "sandbox";
187
- plans: {
188
- id: string;
189
- name: string;
190
- description: string;
191
- status: string;
192
- redirects: {
193
- afterLogin: string;
194
- afterLogout: string;
195
- afterSignup: string;
196
- };
197
- prices?: [] | {
198
- id: string;
199
- amount: string;
200
- interval: {
201
- type: string;
202
- count: number;
203
- };
204
- name: string;
205
- type: string;
206
- status: string;
207
- currency: string;
208
- }[];
209
- }[];
210
- contentGroups: {
211
- id: string;
212
- name: string;
213
- key: string;
214
- allowAllMembers: boolean;
215
- activeMemberHasAccess?: boolean;
216
- redirect: string;
217
- urls: {
218
- url: string;
219
- filter: string;
220
- }[];
221
- plans: {
222
- id: string;
223
- }[];
224
- }[];
225
- emailVerificationEnabled: boolean;
226
- requireEmailVerification: boolean;
227
- customField: {
228
- order: number;
229
- key: string;
230
- label: string;
231
- hidden: boolean;
232
- }[];
233
- branding: {
234
- logo: string;
235
- colors: {
236
- lightMode: {
237
- primaryButton: string;
238
- };
239
- };
240
- };
241
- authProviders: {
242
- clientId: string;
243
- provider: string;
244
- providerType: string;
245
- icon: string;
246
- }[];
247
- };
248
- }>;
249
200
  loginMemberEmailPassword(params: import("./types").LoginMemberEmailPasswordParams, options?: any): Promise<{
250
201
  data: {
251
202
  tokens: {
@@ -258,6 +209,10 @@ declare const _default: {
258
209
  verified: boolean;
259
210
  auth: {
260
211
  email: string;
212
+ hasPassword: boolean;
213
+ providers: {
214
+ provider: string;
215
+ }[];
261
216
  };
262
217
  loginRedirect: string;
263
218
  stripeCustomerId: string;
@@ -285,10 +240,6 @@ declare const _default: {
285
240
  }[];
286
241
  };
287
242
  redirect: string;
288
- payment: {
289
- requirePayment: string[];
290
- requireAuthentication: string[];
291
- };
292
243
  contentGroups?: {
293
244
  id: string;
294
245
  name: string;
@@ -318,6 +269,10 @@ declare const _default: {
318
269
  verified: boolean;
319
270
  auth: {
320
271
  email: string;
272
+ hasPassword: boolean;
273
+ providers: {
274
+ provider: string;
275
+ }[];
321
276
  };
322
277
  loginRedirect: string;
323
278
  stripeCustomerId: string;
@@ -345,10 +300,6 @@ declare const _default: {
345
300
  }[];
346
301
  };
347
302
  redirect: string;
348
- payment: {
349
- requirePayment: string[];
350
- requireAuthentication: string[];
351
- };
352
303
  contentGroups?: {
353
304
  id: string;
354
305
  name: string;
@@ -439,6 +390,10 @@ declare const _default: {
439
390
  verified: boolean;
440
391
  auth: {
441
392
  email: string;
393
+ hasPassword: boolean;
394
+ providers: {
395
+ provider: string;
396
+ }[];
442
397
  };
443
398
  loginRedirect: string;
444
399
  stripeCustomerId: string;
@@ -476,83 +431,6 @@ declare const _default: {
476
431
  json: object;
477
432
  };
478
433
  }>;
479
- getMemberCards(options?: import("./methods/requests").MemberstackOptions): Promise<{
480
- data: {
481
- id: string;
482
- brand: string;
483
- expMonth: string;
484
- expYear: string;
485
- last4: string;
486
- default: boolean;
487
- }[];
488
- }>;
489
- getMemberInvoices(params?: import("./types").GetMemberInvoicesParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
490
- hasNext: boolean;
491
- endCursor: string;
492
- totalCount: number;
493
- data: {
494
- id: string;
495
- status: string;
496
- amount: number;
497
- url: string;
498
- description: string;
499
- number: string;
500
- planConnection: string;
501
- createdAt: string;
502
- currency: string;
503
- }[];
504
- }>;
505
- getMemberReceipts(params?: import("./types").GetMemberReceiptsParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
506
- hasNext: boolean;
507
- endCursor: string;
508
- totalCount: number;
509
- data: {
510
- id: string;
511
- amount: number;
512
- url: string;
513
- stripe?: {
514
- url: string;
515
- };
516
- number: string;
517
- purchase: string;
518
- invoice: string;
519
- createdAt: string;
520
- currency: string;
521
- }[];
522
- }>;
523
- getAuthenticationClientSecret(params: import("./types").GetAuthenticationClientSecretParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
524
- data: string;
525
- }>;
526
- getTotalCheckoutAmount(params: import("./types").GetTotalCheckoutAmountParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
527
- data: {
528
- total: number;
529
- subTotal: number;
530
- currency: string;
531
- setupFee?: {
532
- enabled: boolean;
533
- amount: number;
534
- name: string;
535
- };
536
- freeTrial?: {
537
- days: number;
538
- enabled: boolean;
539
- };
540
- tax?: {
541
- name: string;
542
- percent: number;
543
- description: string;
544
- }[];
545
- };
546
- }>;
547
- purchasePlans(params: import("./types").PurchasePlansParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
548
- data: {
549
- plan: string;
550
- payment: {
551
- requiresPayment: boolean;
552
- requiresAuthentication: boolean;
553
- };
554
- };
555
- }>;
556
434
  addPlan(params: import("./types").AddPlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
557
435
  data: {
558
436
  redirect: string;
@@ -587,45 +465,16 @@ declare const _default: {
587
465
  };
588
466
  }>;
589
467
  removePlan(params: import("./types").RemovePlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<null>;
590
- cancelPlan(params: import("./types").CancelPlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
591
- data: {
592
- id: string;
593
- verified: boolean;
594
- auth: {
595
- email: string;
596
- };
597
- loginRedirect: string;
598
- stripeCustomerId: string;
599
- createdAt: string;
600
- metaData: object;
601
- customFields: object;
602
- permissions: [] | string[];
603
- planConnections: {
604
- id: string;
605
- active: boolean;
606
- status: string;
607
- planId: string;
608
- type: string;
609
- payment: {
610
- amount: number;
611
- currency: string;
612
- status: string;
613
- lastBillingDate: number;
614
- nextBillingDate: number;
615
- cancelAtDate: number;
616
- lastInvoice: string;
617
- lastReceipt: string;
618
- card: string;
619
- };
620
- }[];
621
- };
622
- }>;
623
468
  updateMember(params: import("./types").UpdateMemberParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
624
469
  data: {
625
470
  id: string;
626
471
  verified: boolean;
627
472
  auth: {
628
473
  email: string;
474
+ hasPassword: boolean;
475
+ providers: {
476
+ provider: string;
477
+ }[];
629
478
  };
630
479
  loginRedirect: string;
631
480
  stripeCustomerId: string;
@@ -659,6 +508,10 @@ declare const _default: {
659
508
  verified: boolean;
660
509
  auth: {
661
510
  email: string;
511
+ hasPassword: boolean;
512
+ providers: {
513
+ provider: string;
514
+ }[];
662
515
  };
663
516
  loginRedirect: string;
664
517
  stripeCustomerId: string;
@@ -686,78 +539,16 @@ declare const _default: {
686
539
  }[];
687
540
  };
688
541
  }>;
689
- addCard(params: import("./types").AddMemberCardParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
690
- data: {
691
- id: string;
692
- verified: boolean;
693
- auth: {
694
- email: string;
695
- };
696
- loginRedirect: string;
697
- stripeCustomerId: string;
698
- createdAt: string;
699
- metaData: object;
700
- customFields: object;
701
- permissions: [] | string[];
702
- planConnections: {
703
- id: string;
704
- active: boolean;
705
- status: string;
706
- planId: string;
707
- type: string;
708
- payment: {
709
- amount: number;
710
- currency: string;
711
- status: string;
712
- lastBillingDate: number;
713
- nextBillingDate: number;
714
- cancelAtDate: number;
715
- lastInvoice: string;
716
- lastReceipt: string;
717
- card: string;
718
- };
719
- }[];
720
- };
721
- }>;
722
- updateDefaultCard(params: import("./types").UpdateDefaultCardParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
723
- data: {
724
- id: string;
725
- verified: boolean;
726
- auth: {
727
- email: string;
728
- };
729
- loginRedirect: string;
730
- stripeCustomerId: string;
731
- createdAt: string;
732
- metaData: object;
733
- customFields: object;
734
- permissions: [] | string[];
735
- planConnections: {
736
- id: string;
737
- active: boolean;
738
- status: string;
739
- planId: string;
740
- type: string;
741
- payment: {
742
- amount: number;
743
- currency: string;
744
- status: string;
745
- lastBillingDate: number;
746
- nextBillingDate: number;
747
- cancelAtDate: number;
748
- lastInvoice: string;
749
- lastReceipt: string;
750
- card: string;
751
- };
752
- }[];
753
- };
754
- }>;
755
- updatePlanPayment(params: import("./types").UpdatePlanPaymentParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
542
+ setPassword(params: import("./types").SetPasswordParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
756
543
  data: {
757
544
  id: string;
758
545
  verified: boolean;
759
546
  auth: {
760
547
  email: string;
548
+ hasPassword: boolean;
549
+ providers: {
550
+ provider: string;
551
+ }[];
761
552
  };
762
553
  loginRedirect: string;
763
554
  stripeCustomerId: string;
@@ -797,6 +588,10 @@ declare const _default: {
797
588
  verified: boolean;
798
589
  auth: {
799
590
  email: string;
591
+ hasPassword: boolean;
592
+ providers: {
593
+ provider: string;
594
+ }[];
800
595
  };
801
596
  loginRedirect: string;
802
597
  stripeCustomerId: string;
@@ -824,70 +619,6 @@ declare const _default: {
824
619
  }[];
825
620
  };
826
621
  redirect: string;
827
- payment: {
828
- requirePayment: string[];
829
- requireAuthentication: string[];
830
- };
831
- contentGroups?: {
832
- id: string;
833
- name: string;
834
- key: string;
835
- allowAllMembers: boolean;
836
- activeMemberHasAccess?: boolean;
837
- redirect: string;
838
- urls: {
839
- url: string;
840
- filter: string;
841
- }[];
842
- plans: {
843
- id: string;
844
- }[];
845
- }[];
846
- };
847
- }>;
848
- signupMemberAuthProvider(params: import("./types").SignupMemberAuthProviderParams): Promise<{
849
- data: {
850
- tokens: {
851
- accessToken: string;
852
- expires: number;
853
- type: "bearer";
854
- };
855
- member: {
856
- id: string;
857
- verified: boolean;
858
- auth: {
859
- email: string;
860
- };
861
- loginRedirect: string;
862
- stripeCustomerId: string;
863
- createdAt: string;
864
- metaData: object;
865
- customFields: object;
866
- permissions: [] | string[];
867
- planConnections: {
868
- id: string;
869
- active: boolean;
870
- status: string;
871
- planId: string;
872
- type: string;
873
- payment: {
874
- amount: number;
875
- currency: string;
876
- status: string;
877
- lastBillingDate: number;
878
- nextBillingDate: number;
879
- cancelAtDate: number;
880
- lastInvoice: string;
881
- lastReceipt: string;
882
- card: string;
883
- };
884
- }[];
885
- };
886
- redirect: string;
887
- payment: {
888
- requirePayment: string[];
889
- requireAuthentication: string[];
890
- };
891
622
  contentGroups?: {
892
623
  id: string;
893
624
  name: string;
@@ -909,53 +640,12 @@ declare const _default: {
909
640
  sendMemberResetPasswordEmail(params: import("./types").SendMemberResetPasswordEmailParams): Promise<{
910
641
  data: string;
911
642
  }>;
912
- resetMemberPassword(params: import("./types").ResetMemberPasswordParams): Promise<{
913
- data: {
914
- id: string;
915
- verified: boolean;
916
- auth: {
917
- email: string;
918
- };
919
- loginRedirect: string;
920
- stripeCustomerId: string;
921
- createdAt: string;
922
- metaData: object;
923
- customFields: object;
924
- permissions: [] | string[];
925
- planConnections: {
926
- id: string;
927
- active: boolean;
928
- status: string;
929
- planId: string;
930
- type: string;
931
- payment: {
932
- amount: number;
933
- currency: string;
934
- status: string;
935
- lastBillingDate: number;
936
- nextBillingDate: number;
937
- cancelAtDate: number;
938
- lastInvoice: string;
939
- lastReceipt: string;
940
- card: string;
941
- };
942
- }[];
943
- };
944
- }>;
643
+ resetMemberPassword(params: import("./types").ResetMemberPasswordParams): Promise<void>;
945
644
  logout(options?: import("./methods/requests").MemberstackOptions): Promise<{
946
645
  data: {
947
646
  redirect?: string;
948
647
  };
949
648
  }>;
950
- replacePlan(params: import("./types").ReplacePlanParams, options?: import("./methods/requests").MemberstackOptions): Promise<{
951
- data: {
952
- plan: string;
953
- payment: {
954
- requiresPayment: boolean;
955
- requiresAuthentication: boolean;
956
- };
957
- };
958
- }>;
959
649
  decodeToken({ token }: {
960
650
  token: string;
961
651
  }): Promise<Pick<import("jose").JWTPayload, "iat" | "exp"> & {