@memberstack/dom 1.0.0-beta.17 → 1.0.0-beta.20

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.
Files changed (49) hide show
  1. package/{dist → lib}/auth/persistence/index.d.ts +1 -1
  2. package/lib/auth/persistence/index.js +13 -0
  3. package/{dist → lib}/auth/persistence/local.d.ts +5 -5
  4. package/lib/auth/persistence/local.js +20 -0
  5. package/{dist → lib}/auth/persistence/methods.d.ts +13 -13
  6. package/lib/auth/persistence/methods.js +87 -0
  7. package/{dist → lib}/auth/persistence/session.d.ts +5 -5
  8. package/lib/auth/persistence/session.js +20 -0
  9. package/{dist → lib}/constants/cookies.d.ts +3 -3
  10. package/lib/constants/cookies.js +7 -0
  11. package/{dist → lib}/constants/endpoint.d.ts +4 -4
  12. package/lib/constants/endpoint.js +7 -0
  13. package/{dist → lib}/constants/storage.d.ts +1 -1
  14. package/lib/constants/storage.js +4 -0
  15. package/lib/constants/window.d.ts +3 -0
  16. package/lib/constants/window.js +6 -0
  17. package/lib/index.d.ts +5 -0
  18. package/lib/index.js +7 -0
  19. package/lib/methods/client.d.ts +36 -0
  20. package/lib/methods/client.js +23 -0
  21. package/{dist → lib}/methods/dom/index.d.ts +2 -2
  22. package/lib/methods/dom/index.js +9 -0
  23. package/lib/methods/dom/methods.d.ts +31 -0
  24. package/lib/methods/dom/methods.js +45 -0
  25. package/lib/methods/dom/script.d.ts +3 -0
  26. package/lib/methods/dom/script.js +40 -0
  27. package/lib/methods/index.d.ts +12 -0
  28. package/lib/methods/index.js +35 -0
  29. package/{dist → lib}/utils/cookies.d.ts +2 -2
  30. package/lib/utils/cookies.js +19 -0
  31. package/lib/utils/interceptor.d.ts +4 -0
  32. package/lib/utils/interceptor.js +18 -0
  33. package/{dist → lib}/utils/proxy.d.ts +2 -2
  34. package/lib/utils/proxy.js +62 -0
  35. package/package.json +6 -18
  36. package/dist/constants/window.d.ts +0 -4
  37. package/dist/dom.cjs.development.js +0 -1262
  38. package/dist/dom.cjs.development.js.map +0 -1
  39. package/dist/dom.cjs.production.min.js +0 -2
  40. package/dist/dom.cjs.production.min.js.map +0 -1
  41. package/dist/dom.esm.js +0 -1259
  42. package/dist/dom.esm.js.map +0 -1
  43. package/dist/index.d.ts +0 -3
  44. package/dist/index.js +0 -8
  45. package/dist/methods/client.d.ts +0 -644
  46. package/dist/methods/dom/methods.d.ts +0 -17
  47. package/dist/methods/dom/script.d.ts +0 -3
  48. package/dist/methods/index.d.ts +0 -25
  49. package/dist/utils/interceptor.d.ts +0 -3
@@ -1,644 +0,0 @@
1
- export interface ClientConfig {
2
- publicKey: string;
3
- useCookie?: boolean;
4
- token?: string;
5
- apiVersion?: "2021-01-07";
6
- }
7
- export declare const initClient: (props: ClientConfig) => {
8
- getApp(): Promise<{
9
- data: {
10
- id: string;
11
- name: string;
12
- domains?: {
13
- url: string;
14
- verified: boolean;
15
- }[];
16
- plans: {
17
- id: string;
18
- name: string;
19
- description: string;
20
- status: string;
21
- planPaymentOptions?: {
22
- id: string;
23
- amount: string;
24
- interval: {
25
- type: string;
26
- count: number;
27
- };
28
- name: string;
29
- type: string;
30
- status: string;
31
- currency: string;
32
- }[] | [];
33
- }[];
34
- customFields: {
35
- id: string;
36
- key: string;
37
- label: string;
38
- plans: {
39
- id: string;
40
- name: string;
41
- description: string;
42
- status: string;
43
- planPaymentOptions?: {
44
- id: string;
45
- amount: string;
46
- interval: {
47
- type: string;
48
- count: number;
49
- };
50
- name: string;
51
- type: string;
52
- status: string;
53
- currency: string;
54
- }[] | [];
55
- }[];
56
- }[];
57
- };
58
- }>;
59
- getAuthProviders(): Promise<{
60
- data: {
61
- id: string;
62
- name: string;
63
- domains?: {
64
- url: string;
65
- verified: boolean;
66
- }[];
67
- plans: {
68
- id: string;
69
- name: string;
70
- description: string;
71
- status: string;
72
- planPaymentOptions?: {
73
- id: string;
74
- amount: string;
75
- interval: {
76
- type: string;
77
- count: number;
78
- };
79
- name: string;
80
- type: string;
81
- status: string;
82
- currency: string;
83
- }[] | [];
84
- }[];
85
- customFields: {
86
- id: string;
87
- key: string;
88
- label: string;
89
- plans: {
90
- id: string;
91
- name: string;
92
- description: string;
93
- status: string;
94
- planPaymentOptions?: {
95
- id: string;
96
- amount: string;
97
- interval: {
98
- type: string;
99
- count: number;
100
- };
101
- name: string;
102
- type: string;
103
- status: string;
104
- currency: string;
105
- }[] | [];
106
- }[];
107
- }[];
108
- };
109
- }>;
110
- loginMemberEmailPassword(params: import("@memberstack/client/lib/types/params").LoginMemberEmailPasswordParams): Promise<{
111
- data: {
112
- tokens: {
113
- accessToken: string;
114
- refreshToken: string;
115
- expires: number;
116
- type: "bearer";
117
- };
118
- member: {
119
- id: string;
120
- auth: {
121
- email: string;
122
- };
123
- metaData: object;
124
- customFields: object;
125
- permissions: [] | string[];
126
- planConnections: {
127
- id: string;
128
- active: boolean;
129
- status: string;
130
- planId: string;
131
- type: string;
132
- payment: {
133
- amount: number;
134
- currency: string;
135
- status: string;
136
- lastBillingDate: number;
137
- nextBillingDate: number;
138
- cancelAtDate: number;
139
- lastInvoice: string;
140
- lastReceipt: string;
141
- card: string;
142
- };
143
- }[];
144
- };
145
- payment: {
146
- requirePayment: string[];
147
- requireAuthentication: string[];
148
- };
149
- };
150
- }>;
151
- loginMemberAuthProvider(params: import("@memberstack/client/lib/types/params").LoginMemberAuthProviderParams): Promise<{
152
- data: {
153
- tokens: {
154
- accessToken: string;
155
- refreshToken: string;
156
- expires: number;
157
- type: "bearer";
158
- };
159
- member: {
160
- id: string;
161
- auth: {
162
- email: string;
163
- };
164
- metaData: object;
165
- customFields: object;
166
- permissions: [] | string[];
167
- planConnections: {
168
- id: string;
169
- active: boolean;
170
- status: string;
171
- planId: string;
172
- type: string;
173
- payment: {
174
- amount: number;
175
- currency: string;
176
- status: string;
177
- lastBillingDate: number;
178
- nextBillingDate: number;
179
- cancelAtDate: number;
180
- lastInvoice: string;
181
- lastReceipt: string;
182
- card: string;
183
- };
184
- }[];
185
- };
186
- payment: {
187
- requirePayment: string[];
188
- requireAuthentication: string[];
189
- };
190
- };
191
- }>;
192
- getPlan(params: import("@memberstack/client/lib/types/params").GetPlanParams): Promise<{
193
- data: {
194
- id: string;
195
- name: string;
196
- description: string;
197
- status: string;
198
- planPaymentOptions?: {
199
- id: string;
200
- amount: string;
201
- interval: {
202
- type: string;
203
- count: number;
204
- };
205
- name: string;
206
- type: string;
207
- status: string;
208
- currency: string;
209
- }[] | [];
210
- };
211
- }>;
212
- getPlans(params?: import("@memberstack/client/lib/types/params").GetPlansParams): Promise<{
213
- data: {
214
- id: string;
215
- name: string;
216
- description: string;
217
- status: string;
218
- planPaymentOptions?: {
219
- id: string;
220
- amount: string;
221
- interval: {
222
- type: string;
223
- count: number;
224
- };
225
- name: string;
226
- type: string;
227
- status: string;
228
- currency: string;
229
- }[] | [];
230
- }[];
231
- }>;
232
- getCurrentMember(options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
233
- data: {
234
- id: string;
235
- auth: {
236
- email: string;
237
- };
238
- metaData: object;
239
- customFields: object;
240
- permissions: [] | string[];
241
- planConnections: {
242
- id: string;
243
- active: boolean;
244
- status: string;
245
- planId: string;
246
- type: string;
247
- payment: {
248
- amount: number;
249
- currency: string;
250
- status: string;
251
- lastBillingDate: number;
252
- nextBillingDate: number;
253
- cancelAtDate: number;
254
- lastInvoice: string;
255
- lastReceipt: string;
256
- card: string;
257
- };
258
- }[];
259
- };
260
- }>;
261
- getMemberCards(options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
262
- data: {
263
- id: string;
264
- brand: string;
265
- expMonth: string;
266
- expYear: string;
267
- last4: string;
268
- default: boolean;
269
- }[];
270
- }>;
271
- getMemberInvoices(params?: import("@memberstack/client/lib/types/params").GetMemberInvoicesParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
272
- hasNext: boolean;
273
- endCursor: string;
274
- totalCount: number;
275
- data: {
276
- id: string;
277
- status: string;
278
- amount: number;
279
- url: string;
280
- description: string;
281
- number: string;
282
- planConnection: string;
283
- }[];
284
- }>;
285
- getMemberReceipts(params?: import("@memberstack/client/lib/types/params").GetMemberReceiptsParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
286
- hasNext: boolean;
287
- endCursor: string;
288
- totalCount: number;
289
- data: {
290
- id: string;
291
- amount: number;
292
- url: string;
293
- stripe?: {
294
- url: string;
295
- };
296
- number: string;
297
- purchase: string;
298
- invoice: string;
299
- }[];
300
- }>;
301
- getAuthenticationClientSecret(params: import("@memberstack/client/lib/types/params").GetAuthenticationClientSecretParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
302
- data: string;
303
- }>;
304
- getTotalCheckoutAmount(params: import("@memberstack/client/lib/types/params").GetTotalCheckoutAmountParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
305
- data: {
306
- total: number;
307
- subTotal: number;
308
- currency: string;
309
- setupFee?: {
310
- enabled: boolean;
311
- amount: number;
312
- name: string;
313
- };
314
- freeTrial?: {
315
- days: number;
316
- enabled: boolean;
317
- };
318
- tax?: {
319
- name: string;
320
- percent: number;
321
- description: string;
322
- }[];
323
- };
324
- }>;
325
- purchasePlan(params: import("@memberstack/client/lib/types/params").PurchasePlanParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
326
- data: {
327
- plan: string;
328
- payment: {
329
- requiresPayment: boolean;
330
- requiresAuthentication: boolean;
331
- };
332
- };
333
- }>;
334
- cancelPlan(params: import("@memberstack/client/lib/types/params").CancelPlanParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
335
- data: {
336
- id: string;
337
- auth: {
338
- email: string;
339
- };
340
- metaData: object;
341
- customFields: object;
342
- permissions: [] | string[];
343
- planConnections: {
344
- id: string;
345
- active: boolean;
346
- status: string;
347
- planId: string;
348
- type: string;
349
- payment: {
350
- amount: number;
351
- currency: string;
352
- status: string;
353
- lastBillingDate: number;
354
- nextBillingDate: number;
355
- cancelAtDate: number;
356
- lastInvoice: string;
357
- lastReceipt: string;
358
- card: string;
359
- };
360
- }[];
361
- };
362
- }>;
363
- updateMember(params: import("@memberstack/client/lib/types/params").UpdateMemberParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
364
- data: {
365
- id: string;
366
- auth: {
367
- email: string;
368
- };
369
- metaData: object;
370
- customFields: object;
371
- permissions: [] | string[];
372
- planConnections: {
373
- id: string;
374
- active: boolean;
375
- status: string;
376
- planId: string;
377
- type: string;
378
- payment: {
379
- amount: number;
380
- currency: string;
381
- status: string;
382
- lastBillingDate: number;
383
- nextBillingDate: number;
384
- cancelAtDate: number;
385
- lastInvoice: string;
386
- lastReceipt: string;
387
- card: string;
388
- };
389
- }[];
390
- };
391
- }>;
392
- updateMemberAuth(params: import("@memberstack/client/lib/types/params").UpdateMemberAuthParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
393
- data: {
394
- id: string;
395
- auth: {
396
- email: string;
397
- };
398
- metaData: object;
399
- customFields: object;
400
- permissions: [] | string[];
401
- planConnections: {
402
- id: string;
403
- active: boolean;
404
- status: string;
405
- planId: string;
406
- type: string;
407
- payment: {
408
- amount: number;
409
- currency: string;
410
- status: string;
411
- lastBillingDate: number;
412
- nextBillingDate: number;
413
- cancelAtDate: number;
414
- lastInvoice: string;
415
- lastReceipt: string;
416
- card: string;
417
- };
418
- }[];
419
- };
420
- }>;
421
- addCard(params: import("@memberstack/client/lib/types/params").AddMemberCardParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
422
- data: {
423
- id: string;
424
- auth: {
425
- email: string;
426
- };
427
- metaData: object;
428
- customFields: object;
429
- permissions: [] | string[];
430
- planConnections: {
431
- id: string;
432
- active: boolean;
433
- status: string;
434
- planId: string;
435
- type: string;
436
- payment: {
437
- amount: number;
438
- currency: string;
439
- status: string;
440
- lastBillingDate: number;
441
- nextBillingDate: number;
442
- cancelAtDate: number;
443
- lastInvoice: string;
444
- lastReceipt: string;
445
- card: string;
446
- };
447
- }[];
448
- };
449
- }>;
450
- updateDefaultCard(params: import("@memberstack/client/lib/types/params").UpdateDefaultCardParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
451
- data: {
452
- id: string;
453
- auth: {
454
- email: string;
455
- };
456
- metaData: object;
457
- customFields: object;
458
- permissions: [] | string[];
459
- planConnections: {
460
- id: string;
461
- active: boolean;
462
- status: string;
463
- planId: string;
464
- type: string;
465
- payment: {
466
- amount: number;
467
- currency: string;
468
- status: string;
469
- lastBillingDate: number;
470
- nextBillingDate: number;
471
- cancelAtDate: number;
472
- lastInvoice: string;
473
- lastReceipt: string;
474
- card: string;
475
- };
476
- }[];
477
- };
478
- }>;
479
- updatePlanPayment(params: import("@memberstack/client/lib/types/params").UpdatePlanPaymentParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
480
- data: {
481
- id: string;
482
- auth: {
483
- email: string;
484
- };
485
- metaData: object;
486
- customFields: object;
487
- permissions: [] | string[];
488
- planConnections: {
489
- id: string;
490
- active: boolean;
491
- status: string;
492
- planId: string;
493
- type: string;
494
- payment: {
495
- amount: number;
496
- currency: string;
497
- status: string;
498
- lastBillingDate: number;
499
- nextBillingDate: number;
500
- cancelAtDate: number;
501
- lastInvoice: string;
502
- lastReceipt: string;
503
- card: string;
504
- };
505
- }[];
506
- };
507
- }>;
508
- signupMemberEmailPassword(params: import("@memberstack/client/lib/types/params").SignupMemberEmailPasswordParams): Promise<{
509
- data: {
510
- tokens: {
511
- accessToken: string;
512
- refreshToken: string;
513
- expires: number;
514
- type: "bearer";
515
- };
516
- member: {
517
- id: string;
518
- auth: {
519
- email: string;
520
- };
521
- metaData: object;
522
- customFields: object;
523
- permissions: [] | string[];
524
- planConnections: {
525
- id: string;
526
- active: boolean;
527
- status: string;
528
- planId: string;
529
- type: string;
530
- payment: {
531
- amount: number;
532
- currency: string;
533
- status: string;
534
- lastBillingDate: number;
535
- nextBillingDate: number;
536
- cancelAtDate: number;
537
- lastInvoice: string;
538
- lastReceipt: string;
539
- card: string;
540
- };
541
- }[];
542
- };
543
- payment: {
544
- requirePayment: string[];
545
- requireAuthentication: string[];
546
- };
547
- };
548
- }>;
549
- signupMemberAuthProvider(params: import("@memberstack/client/lib/types/params").SignupMemberAuthProviderParams): Promise<{
550
- data: {
551
- tokens: {
552
- accessToken: string;
553
- refreshToken: string;
554
- expires: number;
555
- type: "bearer";
556
- };
557
- member: {
558
- id: string;
559
- auth: {
560
- email: string;
561
- };
562
- metaData: object;
563
- customFields: object;
564
- permissions: [] | string[];
565
- planConnections: {
566
- id: string;
567
- active: boolean;
568
- status: string;
569
- planId: string;
570
- type: string;
571
- payment: {
572
- amount: number;
573
- currency: string;
574
- status: string;
575
- lastBillingDate: number;
576
- nextBillingDate: number;
577
- cancelAtDate: number;
578
- lastInvoice: string;
579
- lastReceipt: string;
580
- card: string;
581
- };
582
- }[];
583
- };
584
- payment: {
585
- requirePayment: string[];
586
- requireAuthentication: string[];
587
- };
588
- };
589
- }>;
590
- refreshMemberTokens(params: import("@memberstack/client/lib/types/params").RefreshMemberTokensParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
591
- data: {
592
- accessToken: string;
593
- refreshToken: string;
594
- expires: number;
595
- type: "bearer";
596
- };
597
- }>;
598
- sendMemberResetPasswordEmail(params: import("@memberstack/client/lib/types/params").SendMemberResetPasswordEmailParams): Promise<{
599
- data: string;
600
- }>;
601
- resetMemberPassword(params: import("@memberstack/client/lib/types/params").ResetMemberPasswordParams): Promise<{
602
- data: {
603
- id: string;
604
- auth: {
605
- email: string;
606
- };
607
- metaData: object;
608
- customFields: object;
609
- permissions: [] | string[];
610
- planConnections: {
611
- id: string;
612
- active: boolean;
613
- status: string;
614
- planId: string;
615
- type: string;
616
- payment: {
617
- amount: number;
618
- currency: string;
619
- status: string;
620
- lastBillingDate: number;
621
- nextBillingDate: number;
622
- cancelAtDate: number;
623
- lastInvoice: string;
624
- lastReceipt: string;
625
- card: string;
626
- };
627
- }[];
628
- };
629
- }>;
630
- logout(options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
631
- data: {
632
- redirect?: string;
633
- };
634
- }>;
635
- replacePlan(params: import("@memberstack/client/lib/types/params").ReplacePlanParams, options?: import("@memberstack/client/lib/methods").MemberstackOptions): Promise<{
636
- data: {
637
- plan: string;
638
- payment: {
639
- requiresPayment: boolean;
640
- requiresAuthentication: boolean;
641
- };
642
- };
643
- }>;
644
- };
@@ -1,17 +0,0 @@
1
- import type { DOMConfig } from "..";
2
- export declare type OpenModalParams = {
3
- type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD";
4
- params?: {
5
- planId?: string;
6
- planPaymentOptionId?: string;
7
- };
8
- options?: {
9
- onCompleted?: (x: any) => any;
10
- onError?: (x: any) => any;
11
- };
12
- };
13
- export declare const load: (props: {
14
- publicKey: string;
15
- }) => void;
16
- export declare const openModal: (props: OpenModalParams & DOMConfig) => void;
17
- export declare const hideModal: () => void;
@@ -1,3 +0,0 @@
1
- export declare function initialize(props: {
2
- publicKey: string;
3
- }): Promise<any>;
@@ -1,25 +0,0 @@
1
- import { Persistence } from "../auth/persistence";
2
- import * as DOM from "./dom/methods";
3
- import { initClient, ClientConfig } from "./client";
4
- declare global {
5
- interface Window {
6
- __MSDOM: any;
7
- APP_ID: string;
8
- }
9
- }
10
- export declare type DOMConfig = ClientConfig & {
11
- persistence?: Persistence;
12
- };
13
- declare const DOMMethods: ({ useCookie, persistence, ...props }: DOMConfig) => {
14
- load: () => void;
15
- hideModal: () => void;
16
- onAuthChange: (cb: any) => {
17
- unsubscribe: () => boolean;
18
- };
19
- openModal: (type: DOM.OpenModalParams["type"], params?: DOM.OpenModalParams["params"], options?: DOM.OpenModalParams["options"]) => void;
20
- };
21
- export declare const init: (props: DOMConfig) => ReturnType<typeof initClient> & ReturnType<typeof DOMMethods>;
22
- export declare const Methods: {
23
- init: (props: DOMConfig) => ReturnType<typeof initClient> & ReturnType<typeof DOMMethods>;
24
- };
25
- export {};
@@ -1,3 +0,0 @@
1
- export declare const initializeInterceptors: ({ persistence }: {
2
- persistence: any;
3
- }) => void;