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

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