@memberstack/dom 1.0.0-beta.27 → 1.0.0-beta.28

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