@metamask/subscription-controller 10.0.1 → 11.0.0
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/CHANGELOG.md +43 -1
- package/dist/SubscriptionController.d.ts.map +1 -1
- package/dist/SubscriptionController.js +11 -5
- package/dist/SubscriptionController.js.map +1 -1
- package/dist/SubscriptionService-method-action-types.d.ts +2 -1
- package/dist/SubscriptionService-method-action-types.d.ts.map +1 -1
- package/dist/SubscriptionService-method-action-types.js.map +1 -1
- package/dist/SubscriptionService-structs.d.ts +33 -47
- package/dist/SubscriptionService-structs.d.ts.map +1 -1
- package/dist/SubscriptionService-structs.js +2 -6
- package/dist/SubscriptionService-structs.js.map +1 -1
- package/dist/SubscriptionService.d.ts +2 -1
- package/dist/SubscriptionService.d.ts.map +1 -1
- package/dist/SubscriptionService.js +4 -3
- package/dist/SubscriptionService.js.map +1 -1
- package/dist/constants.d.ts +8 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts +29 -5
- package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts.map +1 -1
- package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.js.map +1 -1
- package/dist/subscription-delegation/SubscriptionDelegationService.d.ts +33 -11
- package/dist/subscription-delegation/SubscriptionDelegationService.d.ts.map +1 -1
- package/dist/subscription-delegation/SubscriptionDelegationService.js +305 -22
- package/dist/subscription-delegation/SubscriptionDelegationService.js.map +1 -1
- package/dist/subscription-delegation/caveats.d.ts +31 -2
- package/dist/subscription-delegation/caveats.d.ts.map +1 -1
- package/dist/subscription-delegation/caveats.js +49 -9
- package/dist/subscription-delegation/caveats.js.map +1 -1
- package/dist/subscription-delegation/fingerprint.d.ts +1 -0
- package/dist/subscription-delegation/fingerprint.d.ts.map +1 -1
- package/dist/subscription-delegation/fingerprint.js +10 -6
- package/dist/subscription-delegation/fingerprint.js.map +1 -1
- package/dist/subscription-delegation/typed-data.d.ts +23 -0
- package/dist/subscription-delegation/typed-data.d.ts.map +1 -0
- package/dist/subscription-delegation/typed-data.js +75 -0
- package/dist/subscription-delegation/typed-data.js.map +1 -0
- package/dist/subscription-delegation/types.d.ts +105 -12
- package/dist/subscription-delegation/types.d.ts.map +1 -1
- package/dist/subscription-delegation/types.js +3 -4
- package/dist/subscription-delegation/types.js.map +1 -1
- package/dist/types.d.ts +15 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/package.json +16 -13
|
@@ -11,13 +11,13 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
11
11
|
currentPeriodStart?: string | undefined;
|
|
12
12
|
currentPeriodEnd?: string | undefined;
|
|
13
13
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
14
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
14
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
15
15
|
interval: "month" | "year";
|
|
16
16
|
paymentMethod: {
|
|
17
17
|
type: "card";
|
|
18
18
|
card: {
|
|
19
19
|
brand: string;
|
|
20
|
-
displayBrand
|
|
20
|
+
displayBrand?: string | undefined;
|
|
21
21
|
last4: string;
|
|
22
22
|
};
|
|
23
23
|
} | {
|
|
@@ -42,7 +42,7 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
42
42
|
id: string;
|
|
43
43
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
44
44
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
45
|
-
updatedAt
|
|
45
|
+
updatedAt?: string | undefined;
|
|
46
46
|
} | undefined;
|
|
47
47
|
}, {
|
|
48
48
|
id: Struct<string, null>;
|
|
@@ -70,8 +70,9 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
70
70
|
currentPeriodStart: Struct<string | undefined, null>;
|
|
71
71
|
currentPeriodEnd: Struct<string | undefined, null>;
|
|
72
72
|
cancelAtPeriodEnd: Struct<boolean | undefined, null>;
|
|
73
|
-
status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
73
|
+
status: Struct<"active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
74
74
|
active: "active";
|
|
75
|
+
awaiting_funds: "awaiting_funds";
|
|
75
76
|
canceled: "canceled";
|
|
76
77
|
incomplete: "incomplete";
|
|
77
78
|
incomplete_expired: "incomplete_expired";
|
|
@@ -89,7 +90,7 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
89
90
|
type: "card";
|
|
90
91
|
card: {
|
|
91
92
|
brand: string;
|
|
92
|
-
displayBrand
|
|
93
|
+
displayBrand?: string | undefined;
|
|
93
94
|
last4: string;
|
|
94
95
|
};
|
|
95
96
|
} | {
|
|
@@ -119,7 +120,7 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
119
120
|
id: string;
|
|
120
121
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
121
122
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
122
|
-
updatedAt
|
|
123
|
+
updatedAt?: string | undefined;
|
|
123
124
|
} | undefined, {
|
|
124
125
|
id: Struct<string, null>;
|
|
125
126
|
status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
|
|
@@ -137,7 +138,7 @@ export declare const SubscriptionStruct: Struct<{
|
|
|
137
138
|
internal_server_error: "internal_server_error";
|
|
138
139
|
recipient_not_allowlisted: "recipient_not_allowlisted";
|
|
139
140
|
}>;
|
|
140
|
-
updatedAt: Struct<string, null>;
|
|
141
|
+
updatedAt: Struct<string | undefined, null>;
|
|
141
142
|
}>;
|
|
142
143
|
}>;
|
|
143
144
|
export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
@@ -153,13 +154,13 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
153
154
|
currentPeriodStart?: string | undefined;
|
|
154
155
|
currentPeriodEnd?: string | undefined;
|
|
155
156
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
156
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
157
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
157
158
|
interval: "month" | "year";
|
|
158
159
|
paymentMethod: {
|
|
159
160
|
type: "card";
|
|
160
161
|
card: {
|
|
161
162
|
brand: string;
|
|
162
|
-
displayBrand
|
|
163
|
+
displayBrand?: string | undefined;
|
|
163
164
|
last4: string;
|
|
164
165
|
};
|
|
165
166
|
} | {
|
|
@@ -184,7 +185,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
184
185
|
id: string;
|
|
185
186
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
186
187
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
187
|
-
updatedAt
|
|
188
|
+
updatedAt?: string | undefined;
|
|
188
189
|
} | undefined;
|
|
189
190
|
}[];
|
|
190
191
|
trialedProducts: ("money_account_plus" | "shield")[];
|
|
@@ -216,13 +217,13 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
216
217
|
currentPeriodStart?: string | undefined;
|
|
217
218
|
currentPeriodEnd?: string | undefined;
|
|
218
219
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
219
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
220
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
220
221
|
interval: "month" | "year";
|
|
221
222
|
paymentMethod: {
|
|
222
223
|
type: "card";
|
|
223
224
|
card: {
|
|
224
225
|
brand: string;
|
|
225
|
-
displayBrand
|
|
226
|
+
displayBrand?: string | undefined;
|
|
226
227
|
last4: string;
|
|
227
228
|
};
|
|
228
229
|
} | {
|
|
@@ -247,7 +248,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
247
248
|
id: string;
|
|
248
249
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
249
250
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
250
|
-
updatedAt
|
|
251
|
+
updatedAt?: string | undefined;
|
|
251
252
|
} | undefined;
|
|
252
253
|
} | undefined;
|
|
253
254
|
rewardAccountId?: `${string}:${string}:${string}` | undefined;
|
|
@@ -264,13 +265,13 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
264
265
|
currentPeriodStart?: string | undefined;
|
|
265
266
|
currentPeriodEnd?: string | undefined;
|
|
266
267
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
267
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
268
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
268
269
|
interval: "month" | "year";
|
|
269
270
|
paymentMethod: {
|
|
270
271
|
type: "card";
|
|
271
272
|
card: {
|
|
272
273
|
brand: string;
|
|
273
|
-
displayBrand
|
|
274
|
+
displayBrand?: string | undefined;
|
|
274
275
|
last4: string;
|
|
275
276
|
};
|
|
276
277
|
} | {
|
|
@@ -295,7 +296,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
295
296
|
id: string;
|
|
296
297
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
297
298
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
298
|
-
updatedAt
|
|
299
|
+
updatedAt?: string | undefined;
|
|
299
300
|
} | undefined;
|
|
300
301
|
}[], Struct<{
|
|
301
302
|
id: string;
|
|
@@ -308,13 +309,13 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
308
309
|
currentPeriodStart?: string | undefined;
|
|
309
310
|
currentPeriodEnd?: string | undefined;
|
|
310
311
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
311
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
312
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
312
313
|
interval: "month" | "year";
|
|
313
314
|
paymentMethod: {
|
|
314
315
|
type: "card";
|
|
315
316
|
card: {
|
|
316
317
|
brand: string;
|
|
317
|
-
displayBrand
|
|
318
|
+
displayBrand?: string | undefined;
|
|
318
319
|
last4: string;
|
|
319
320
|
};
|
|
320
321
|
} | {
|
|
@@ -339,7 +340,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
339
340
|
id: string;
|
|
340
341
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
341
342
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
342
|
-
updatedAt
|
|
343
|
+
updatedAt?: string | undefined;
|
|
343
344
|
} | undefined;
|
|
344
345
|
}, {
|
|
345
346
|
id: Struct<string, null>;
|
|
@@ -367,8 +368,9 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
367
368
|
currentPeriodStart: Struct<string | undefined, null>;
|
|
368
369
|
currentPeriodEnd: Struct<string | undefined, null>;
|
|
369
370
|
cancelAtPeriodEnd: Struct<boolean | undefined, null>;
|
|
370
|
-
status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
371
|
+
status: Struct<"active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
371
372
|
active: "active";
|
|
373
|
+
awaiting_funds: "awaiting_funds";
|
|
372
374
|
canceled: "canceled";
|
|
373
375
|
incomplete: "incomplete";
|
|
374
376
|
incomplete_expired: "incomplete_expired";
|
|
@@ -386,7 +388,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
386
388
|
type: "card";
|
|
387
389
|
card: {
|
|
388
390
|
brand: string;
|
|
389
|
-
displayBrand
|
|
391
|
+
displayBrand?: string | undefined;
|
|
390
392
|
last4: string;
|
|
391
393
|
};
|
|
392
394
|
} | {
|
|
@@ -416,7 +418,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
416
418
|
id: string;
|
|
417
419
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
418
420
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
419
|
-
updatedAt
|
|
421
|
+
updatedAt?: string | undefined;
|
|
420
422
|
} | undefined, {
|
|
421
423
|
id: Struct<string, null>;
|
|
422
424
|
status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
|
|
@@ -434,7 +436,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
434
436
|
internal_server_error: "internal_server_error";
|
|
435
437
|
recipient_not_allowlisted: "recipient_not_allowlisted";
|
|
436
438
|
}>;
|
|
437
|
-
updatedAt: Struct<string, null>;
|
|
439
|
+
updatedAt: Struct<string | undefined, null>;
|
|
438
440
|
}>;
|
|
439
441
|
}>>;
|
|
440
442
|
trialedProducts: Struct<("money_account_plus" | "shield")[], Struct<"money_account_plus" | "shield", {
|
|
@@ -506,13 +508,13 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
506
508
|
currentPeriodStart?: string | undefined;
|
|
507
509
|
currentPeriodEnd?: string | undefined;
|
|
508
510
|
cancelAtPeriodEnd?: boolean | undefined;
|
|
509
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
511
|
+
status: "active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
510
512
|
interval: "month" | "year";
|
|
511
513
|
paymentMethod: {
|
|
512
514
|
type: "card";
|
|
513
515
|
card: {
|
|
514
516
|
brand: string;
|
|
515
|
-
displayBrand
|
|
517
|
+
displayBrand?: string | undefined;
|
|
516
518
|
last4: string;
|
|
517
519
|
};
|
|
518
520
|
} | {
|
|
@@ -537,7 +539,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
537
539
|
id: string;
|
|
538
540
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
539
541
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
540
|
-
updatedAt
|
|
542
|
+
updatedAt?: string | undefined;
|
|
541
543
|
} | undefined;
|
|
542
544
|
} | undefined, {
|
|
543
545
|
id: Struct<string, null>;
|
|
@@ -565,8 +567,9 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
565
567
|
currentPeriodStart: Struct<string | undefined, null>;
|
|
566
568
|
currentPeriodEnd: Struct<string | undefined, null>;
|
|
567
569
|
cancelAtPeriodEnd: Struct<boolean | undefined, null>;
|
|
568
|
-
status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
570
|
+
status: Struct<"active" | "awaiting_funds" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
569
571
|
active: "active";
|
|
572
|
+
awaiting_funds: "awaiting_funds";
|
|
570
573
|
canceled: "canceled";
|
|
571
574
|
incomplete: "incomplete";
|
|
572
575
|
incomplete_expired: "incomplete_expired";
|
|
@@ -584,7 +587,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
584
587
|
type: "card";
|
|
585
588
|
card: {
|
|
586
589
|
brand: string;
|
|
587
|
-
displayBrand
|
|
590
|
+
displayBrand?: string | undefined;
|
|
588
591
|
last4: string;
|
|
589
592
|
};
|
|
590
593
|
} | {
|
|
@@ -614,7 +617,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
614
617
|
id: string;
|
|
615
618
|
status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
|
|
616
619
|
errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
|
|
617
|
-
updatedAt
|
|
620
|
+
updatedAt?: string | undefined;
|
|
618
621
|
} | undefined, {
|
|
619
622
|
id: Struct<string, null>;
|
|
620
623
|
status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
|
|
@@ -632,7 +635,7 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
|
|
|
632
635
|
internal_server_error: "internal_server_error";
|
|
633
636
|
recipient_not_allowlisted: "recipient_not_allowlisted";
|
|
634
637
|
}>;
|
|
635
|
-
updatedAt: Struct<string, null>;
|
|
638
|
+
updatedAt: Struct<string | undefined, null>;
|
|
636
639
|
}>;
|
|
637
640
|
}>;
|
|
638
641
|
rewardAccountId: Struct<`${string}:${string}:${string}` | undefined, null>;
|
|
@@ -739,23 +742,6 @@ export declare const StartSubscriptionResponseStruct: Struct<{
|
|
|
739
742
|
}, {
|
|
740
743
|
checkoutSessionUrl: Struct<string, null>;
|
|
741
744
|
}>;
|
|
742
|
-
export declare const StartCryptoSubscriptionResponseStruct: Struct<{
|
|
743
|
-
subscriptionId: string;
|
|
744
|
-
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
|
|
745
|
-
}, {
|
|
746
|
-
subscriptionId: Struct<string, null>;
|
|
747
|
-
status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
|
|
748
|
-
active: "active";
|
|
749
|
-
canceled: "canceled";
|
|
750
|
-
incomplete: "incomplete";
|
|
751
|
-
incomplete_expired: "incomplete_expired";
|
|
752
|
-
past_due: "past_due";
|
|
753
|
-
paused: "paused";
|
|
754
|
-
provisional: "provisional";
|
|
755
|
-
trialing: "trialing";
|
|
756
|
-
unpaid: "unpaid";
|
|
757
|
-
}>;
|
|
758
|
-
}>;
|
|
759
745
|
export declare const UpdatePaymentMethodCardResponseStruct: Struct<{
|
|
760
746
|
redirectUrl: string;
|
|
761
747
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionService-structs.d.ts","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAgBpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAqEnD,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"SubscriptionService-structs.d.ts","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAgBpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAqEnD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B7B,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzC,CAAC;AA2BH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;EAE1C,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;;EAEhD,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;EAG/C,CAAC;AA0FH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AASH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE9C,CAAC"}
|
|
@@ -38,7 +38,7 @@ const SubscriptionCardPaymentMethodStruct = type({
|
|
|
38
38
|
type: enums([PAYMENT_TYPES.byCard]),
|
|
39
39
|
card: type({
|
|
40
40
|
brand: string(),
|
|
41
|
-
displayBrand: string(),
|
|
41
|
+
displayBrand: optional(string()),
|
|
42
42
|
last4: string(),
|
|
43
43
|
}),
|
|
44
44
|
});
|
|
@@ -77,7 +77,7 @@ export const SubscriptionStruct = type({
|
|
|
77
77
|
id: string(),
|
|
78
78
|
status: InvoicePaymentStatusStruct,
|
|
79
79
|
errorCode: optional(CryptoPaymentErrorStruct),
|
|
80
|
-
updatedAt: string(),
|
|
80
|
+
updatedAt: optional(string()),
|
|
81
81
|
})),
|
|
82
82
|
});
|
|
83
83
|
export const GetSubscriptionsResponseStruct = type({
|
|
@@ -122,10 +122,6 @@ export const SubscriptionBenefitsResponseStruct = type({
|
|
|
122
122
|
export const StartSubscriptionResponseStruct = type({
|
|
123
123
|
checkoutSessionUrl: string(),
|
|
124
124
|
});
|
|
125
|
-
export const StartCryptoSubscriptionResponseStruct = type({
|
|
126
|
-
subscriptionId: string(),
|
|
127
|
-
status: SubscriptionStatusStruct,
|
|
128
|
-
});
|
|
129
125
|
export const UpdatePaymentMethodCardResponseStruct = type({
|
|
130
126
|
redirectUrl: string(),
|
|
131
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionService-structs.js","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9D,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACzE,MAAM,wBAAwB,GAAG,IAAI,CAAC;IACpC,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;IACtC,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE;CAC3C,CAAC,CAAC;AACH,MAAM,8BAA8B,GAAG,IAAI,C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M,EAAE;IAChB,eAAe,EAAE,MAAM,EAAE;IACzB,QAAQ,EAAE,MAAM,EAAE;IAClB,QAAQ,EAAE,OAAO,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;IAChD,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACjC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IACtC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACtC,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC9B,wBAAwB,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,CACrD,6BAA6B,CAC9B,CAAC","sourcesContent":["import {\n array,\n boolean,\n enums,\n lazy,\n never,\n nullable,\n number,\n optional,\n string,\n type,\n union,\n} from '@metamask/superstruct';\nimport type { Struct } from '@metamask/superstruct';\nimport { StrictHexStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport {\n CANCEL_TYPES,\n CRYPTO_AUTH_METHODS,\n CRYPTO_PAYMENT_ERRORS,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n PAYMENT_TYPES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n MoneyAccountFeature,\n ShieldFeature,\n SUBSCRIPTION_STATUSES,\n} from './types.js';\nimport type { TokenPaymentInfo } from './types.js';\n\nconst ProductTypeStruct = enums(Object.values(PRODUCT_TYPES));\nconst CryptoAuthMethodStruct = enums(Object.values(CRYPTO_AUTH_METHODS));\nconst ShieldEntitlementsStruct = type({\n [ShieldFeature.ShieldClaim]: boolean(),\n [ShieldFeature.PrioritySupport]: boolean(),\n});\nconst MoneyAccountEntitlementsStruct = type({\n [MoneyAccountFeature.SwapFeeWaiver]: boolean(),\n [MoneyAccountFeature.PerpsFeeWaiver]: boolean(),\n [MoneyAccountFeature.PredictFreeTx]: boolean(),\n [MoneyAccountFeature.PremiumApy]: boolean(),\n});\nconst ProductEntitlementsStruct = type({\n [PRODUCT_TYPES.SHIELD]: optional(\n type({\n entitlements: ShieldEntitlementsStruct,\n }),\n ),\n [PRODUCT_TYPES.MONEY_ACCOUNT_PLUS]: optional(\n type({\n plan: string(),\n entitlements: MoneyAccountEntitlementsStruct,\n }),\n ),\n});\nconst RecurringIntervalStruct = enums(Object.values(RECURRING_INTERVALS));\nconst SubscriptionStatusStruct = enums(Object.values(SUBSCRIPTION_STATUSES));\nconst InvoicePaymentStatusStruct = enums(\n Object.values(INVOICE_PAYMENT_STATUSES),\n);\nconst CancelTypeStruct = enums(Object.values(CANCEL_TYPES));\nconst CryptoPaymentMethodErrorStruct = enums(\n Object.values(CRYPTO_PAYMENT_METHOD_ERRORS),\n);\nconst CryptoPaymentErrorStruct = enums(Object.values(CRYPTO_PAYMENT_ERRORS));\n\nconst ProductStruct = type({\n name: ProductTypeStruct,\n currency: enums(['usd']),\n unitAmount: number(),\n unitDecimals: number(),\n});\n\nconst SubscriptionCardPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCard]),\n card: type({\n brand: string(),\n displayBrand: string(),\n last4: string(),\n }),\n});\n\nconst SubscriptionCryptoPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n crypto: type({\n payerAddress: StrictHexStruct,\n chainId: StrictHexStruct,\n tokenSymbol: string(),\n error: optional(CryptoPaymentMethodErrorStruct),\n }),\n});\n\nconst SubscriptionPaymentMethodStruct = union([\n SubscriptionCardPaymentMethodStruct,\n SubscriptionCryptoPaymentMethodStruct,\n]);\n\nexport const SubscriptionStruct = type({\n id: string(),\n products: array(ProductStruct),\n currentPeriodStart: optional(string()),\n currentPeriodEnd: optional(string()),\n cancelAtPeriodEnd: optional(boolean()),\n status: SubscriptionStatusStruct,\n interval: RecurringIntervalStruct,\n paymentMethod: SubscriptionPaymentMethodStruct,\n trialPeriodDays: optional(number()),\n trialStart: optional(string()),\n trialEnd: optional(string()),\n endDate: optional(string()),\n canceledAt: optional(string()),\n cancelType: optional(CancelTypeStruct),\n inactiveAt: optional(string()),\n isEligibleForSupport: optional(boolean()),\n billingCycles: optional(number()),\n lastInvoice: optional(\n type({\n id: string(),\n status: InvoicePaymentStatusStruct,\n errorCode: optional(CryptoPaymentErrorStruct),\n updatedAt: string(),\n }),\n ),\n});\n\nexport const GetSubscriptionsResponseStruct = type({\n customerId: optional(string()),\n subscriptions: array(SubscriptionStruct),\n trialedProducts: array(ProductTypeStruct),\n productEntitlements: optional(ProductEntitlementsStruct),\n lastSubscription: optional(SubscriptionStruct),\n rewardAccountId: optional(CaipAccountIdStruct),\n});\n\nconst SwapsBenefitUsageStruct = type({\n feeBips: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PerpsBenefitUsageStruct = type({\n builderFeeBips: nullable(string()),\n builderCode: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PredictBenefitUsageStruct = type({\n builderCode: nullable(string()),\n capTxCount: optional(number()),\n consumedTxCount: optional(number()),\n remainingTxCount: nullable(number()),\n exhausted: boolean(),\n});\n\nexport const SubscriptionBenefitsResponseStruct = type({\n eligible: boolean(),\n billingPeriodId: nullable(string()),\n products: type({\n swaps: SwapsBenefitUsageStruct,\n perps: PerpsBenefitUsageStruct,\n predict: PredictBenefitUsageStruct,\n }),\n});\n\nexport const StartSubscriptionResponseStruct = type({\n checkoutSessionUrl: string(),\n});\n\nexport const StartCryptoSubscriptionResponseStruct = type({\n subscriptionId: string(),\n status: SubscriptionStatusStruct,\n});\n\nexport const UpdatePaymentMethodCardResponseStruct = type({\n redirectUrl: string(),\n});\n\nexport const BillingPortalResponseStruct = type({\n url: string(),\n});\n\nexport const SubscriptionApiGeneralResponseStruct = type({\n success: boolean(),\n message: optional(string()),\n});\n\nconst ProductPriceStruct = type({\n interval: RecurringIntervalStruct,\n unitAmount: number(),\n unitDecimals: number(),\n currency: enums(['usd']),\n trialPeriodDays: number(),\n minBillingCycles: number(),\n minBillingCyclesForBalance: number(),\n});\n\nconst ProductPricingStruct = type({\n name: ProductTypeStruct,\n prices: array(ProductPriceStruct),\n});\n\nconst TokenPaymentInfoConversionRateStruct = type({\n usd: string(),\n});\n\n/**\n * A settlement token, discriminated by the presence of `accountantAddress`.\n *\n * Both variants use `type` rather than `object` so that fields the API adds\n * later pass through instead of failing the whole union — an exact struct here\n * turns any additive pricing change into a hard `getPricing` failure. The\n * mutually exclusive fields are still pinned with `optional(never())` on the\n * spot variant, so a vault share cannot silently validate as a spot token and\n * get valued at face value.\n *\n * `type` infers an index signature rather than a concrete shape, so the\n * inferred struct type has to be widened through `unknown` before it can be\n * pinned to `TokenPaymentInfo`. The declared type is the contract; the runtime\n * checks above are what enforce it.\n */\nconst TokenPaymentInfoStruct: Struct<TokenPaymentInfo> = lazy(() =>\n union([\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: StrictHexStruct,\n vault: optional(string()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: optional(never()),\n vault: optional(never()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n ]),\n) as Struct<TokenPaymentInfo>;\n\nconst ChainPaymentInfoStruct = type({\n chainId: StrictHexStruct,\n paymentAddress: StrictHexStruct,\n delegateAddress: optional(StrictHexStruct),\n tokens: array(TokenPaymentInfoStruct),\n isSponsorshipSupported: optional(boolean()),\n});\n\n/**\n * A pricing payment-method row, discriminated by `type`.\n *\n * `type` rather than `object` for the same reason as\n * {@link TokenPaymentInfoStruct}: new fields on a row must not fail the union.\n * The crypto-only fields stay pinned with `optional(never())` on the card\n * variant so a card row carrying `chains` is still rejected.\n */\nconst PricingPaymentMethodStruct = union([\n type({\n type: enums([PAYMENT_TYPES.byCard]),\n products: optional(array(ProductTypeStruct)),\n cryptoAuthMethod: optional(never()),\n chains: optional(never()),\n }),\n type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n cryptoAuthMethod: optional(CryptoAuthMethodStruct),\n products: optional(array(ProductTypeStruct)),\n chains: optional(array(ChainPaymentInfoStruct)),\n }),\n]);\n\nexport const PricingResponseStruct = type({\n products: array(ProductPricingStruct),\n paymentMethods: array(PricingPaymentMethodStruct),\n});\n\nconst CohortStruct = type({\n cohort: string(),\n eligibilityRate: number(),\n priority: number(),\n eligible: boolean(),\n});\n\nexport const SubscriptionEligibilityStruct = type({\n product: ProductTypeStruct,\n canSubscribe: optional(boolean()),\n canViewEntryModal: optional(boolean()),\n modalType: optional(enums(['A', 'B'])),\n cohorts: optional(array(CohortStruct)),\n assignedCohort: optional(nullable(string())),\n assignedAt: optional(string()),\n hasAssignedCohortExpired: optional(boolean()),\n});\n\nexport const SubscriptionEligibilityArrayStruct = array(\n SubscriptionEligibilityStruct,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"SubscriptionService-structs.js","sourceRoot":"","sources":["../src/SubscriptionService-structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE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,\n boolean,\n enums,\n lazy,\n never,\n nullable,\n number,\n optional,\n string,\n type,\n union,\n} from '@metamask/superstruct';\nimport type { Struct } from '@metamask/superstruct';\nimport { StrictHexStruct, CaipAccountIdStruct } from '@metamask/utils';\n\nimport {\n CANCEL_TYPES,\n CRYPTO_AUTH_METHODS,\n CRYPTO_PAYMENT_ERRORS,\n CRYPTO_PAYMENT_METHOD_ERRORS,\n INVOICE_PAYMENT_STATUSES,\n PAYMENT_TYPES,\n PRODUCT_TYPES,\n RECURRING_INTERVALS,\n MoneyAccountFeature,\n ShieldFeature,\n SUBSCRIPTION_STATUSES,\n} from './types.js';\nimport type { TokenPaymentInfo } from './types.js';\n\nconst ProductTypeStruct = enums(Object.values(PRODUCT_TYPES));\nconst CryptoAuthMethodStruct = enums(Object.values(CRYPTO_AUTH_METHODS));\nconst ShieldEntitlementsStruct = type({\n [ShieldFeature.ShieldClaim]: boolean(),\n [ShieldFeature.PrioritySupport]: boolean(),\n});\nconst MoneyAccountEntitlementsStruct = type({\n [MoneyAccountFeature.SwapFeeWaiver]: boolean(),\n [MoneyAccountFeature.PerpsFeeWaiver]: boolean(),\n [MoneyAccountFeature.PredictFreeTx]: boolean(),\n [MoneyAccountFeature.PremiumApy]: boolean(),\n});\nconst ProductEntitlementsStruct = type({\n [PRODUCT_TYPES.SHIELD]: optional(\n type({\n entitlements: ShieldEntitlementsStruct,\n }),\n ),\n [PRODUCT_TYPES.MONEY_ACCOUNT_PLUS]: optional(\n type({\n plan: string(),\n entitlements: MoneyAccountEntitlementsStruct,\n }),\n ),\n});\nconst RecurringIntervalStruct = enums(Object.values(RECURRING_INTERVALS));\nconst SubscriptionStatusStruct = enums(Object.values(SUBSCRIPTION_STATUSES));\nconst InvoicePaymentStatusStruct = enums(\n Object.values(INVOICE_PAYMENT_STATUSES),\n);\nconst CancelTypeStruct = enums(Object.values(CANCEL_TYPES));\nconst CryptoPaymentMethodErrorStruct = enums(\n Object.values(CRYPTO_PAYMENT_METHOD_ERRORS),\n);\nconst CryptoPaymentErrorStruct = enums(Object.values(CRYPTO_PAYMENT_ERRORS));\n\nconst ProductStruct = type({\n name: ProductTypeStruct,\n currency: enums(['usd']),\n unitAmount: number(),\n unitDecimals: number(),\n});\n\nconst SubscriptionCardPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCard]),\n card: type({\n brand: string(),\n displayBrand: optional(string()),\n last4: string(),\n }),\n});\n\nconst SubscriptionCryptoPaymentMethodStruct = type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n crypto: type({\n payerAddress: StrictHexStruct,\n chainId: StrictHexStruct,\n tokenSymbol: string(),\n error: optional(CryptoPaymentMethodErrorStruct),\n }),\n});\n\nconst SubscriptionPaymentMethodStruct = union([\n SubscriptionCardPaymentMethodStruct,\n SubscriptionCryptoPaymentMethodStruct,\n]);\n\nexport const SubscriptionStruct = type({\n id: string(),\n products: array(ProductStruct),\n currentPeriodStart: optional(string()),\n currentPeriodEnd: optional(string()),\n cancelAtPeriodEnd: optional(boolean()),\n status: SubscriptionStatusStruct,\n interval: RecurringIntervalStruct,\n paymentMethod: SubscriptionPaymentMethodStruct,\n trialPeriodDays: optional(number()),\n trialStart: optional(string()),\n trialEnd: optional(string()),\n endDate: optional(string()),\n canceledAt: optional(string()),\n cancelType: optional(CancelTypeStruct),\n inactiveAt: optional(string()),\n isEligibleForSupport: optional(boolean()),\n billingCycles: optional(number()),\n lastInvoice: optional(\n type({\n id: string(),\n status: InvoicePaymentStatusStruct,\n errorCode: optional(CryptoPaymentErrorStruct),\n updatedAt: optional(string()),\n }),\n ),\n});\n\nexport const GetSubscriptionsResponseStruct = type({\n customerId: optional(string()),\n subscriptions: array(SubscriptionStruct),\n trialedProducts: array(ProductTypeStruct),\n productEntitlements: optional(ProductEntitlementsStruct),\n lastSubscription: optional(SubscriptionStruct),\n rewardAccountId: optional(CaipAccountIdStruct),\n});\n\nconst SwapsBenefitUsageStruct = type({\n feeBips: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PerpsBenefitUsageStruct = type({\n builderFeeBips: nullable(string()),\n builderCode: nullable(string()),\n capMicroUsd: optional(number()),\n consumedMicroUsd: optional(number()),\n remainingMicroUsd: nullable(number()),\n exhausted: boolean(),\n});\n\nconst PredictBenefitUsageStruct = type({\n builderCode: nullable(string()),\n capTxCount: optional(number()),\n consumedTxCount: optional(number()),\n remainingTxCount: nullable(number()),\n exhausted: boolean(),\n});\n\nexport const SubscriptionBenefitsResponseStruct = type({\n eligible: boolean(),\n billingPeriodId: nullable(string()),\n products: type({\n swaps: SwapsBenefitUsageStruct,\n perps: PerpsBenefitUsageStruct,\n predict: PredictBenefitUsageStruct,\n }),\n});\n\nexport const StartSubscriptionResponseStruct = type({\n checkoutSessionUrl: string(),\n});\n\nexport const UpdatePaymentMethodCardResponseStruct = type({\n redirectUrl: string(),\n});\n\nexport const BillingPortalResponseStruct = type({\n url: string(),\n});\n\nexport const SubscriptionApiGeneralResponseStruct = type({\n success: boolean(),\n message: optional(string()),\n});\n\nconst ProductPriceStruct = type({\n interval: RecurringIntervalStruct,\n unitAmount: number(),\n unitDecimals: number(),\n currency: enums(['usd']),\n trialPeriodDays: number(),\n minBillingCycles: number(),\n minBillingCyclesForBalance: number(),\n});\n\nconst ProductPricingStruct = type({\n name: ProductTypeStruct,\n prices: array(ProductPriceStruct),\n});\n\nconst TokenPaymentInfoConversionRateStruct = type({\n usd: string(),\n});\n\n/**\n * A settlement token, discriminated by the presence of `accountantAddress`.\n *\n * Both variants use `type` rather than `object` so that fields the API adds\n * later pass through instead of failing the whole union — an exact struct here\n * turns any additive pricing change into a hard `getPricing` failure. The\n * mutually exclusive fields are still pinned with `optional(never())` on the\n * spot variant, so a vault share cannot silently validate as a spot token and\n * get valued at face value.\n *\n * `type` infers an index signature rather than a concrete shape, so the\n * inferred struct type has to be widened through `unknown` before it can be\n * pinned to `TokenPaymentInfo`. The declared type is the contract; the runtime\n * checks above are what enforce it.\n */\nconst TokenPaymentInfoStruct: Struct<TokenPaymentInfo> = lazy(() =>\n union([\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: StrictHexStruct,\n vault: optional(string()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n type({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n accountantAddress: optional(never()),\n vault: optional(never()),\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n ]),\n);\n\nconst ChainPaymentInfoStruct = type({\n chainId: StrictHexStruct,\n paymentAddress: StrictHexStruct,\n delegateAddress: optional(StrictHexStruct),\n tokens: array(TokenPaymentInfoStruct),\n isSponsorshipSupported: optional(boolean()),\n});\n\n/**\n * A pricing payment-method row, discriminated by `type`.\n *\n * `type` rather than `object` for the same reason as\n * {@link TokenPaymentInfoStruct}: new fields on a row must not fail the union.\n * The crypto-only fields stay pinned with `optional(never())` on the card\n * variant so a card row carrying `chains` is still rejected.\n */\nconst PricingPaymentMethodStruct = union([\n type({\n type: enums([PAYMENT_TYPES.byCard]),\n products: optional(array(ProductTypeStruct)),\n cryptoAuthMethod: optional(never()),\n chains: optional(never()),\n }),\n type({\n type: enums([PAYMENT_TYPES.byCrypto]),\n cryptoAuthMethod: optional(CryptoAuthMethodStruct),\n products: optional(array(ProductTypeStruct)),\n chains: optional(array(ChainPaymentInfoStruct)),\n }),\n]);\n\nexport const PricingResponseStruct = type({\n products: array(ProductPricingStruct),\n paymentMethods: array(PricingPaymentMethodStruct),\n});\n\nconst CohortStruct = type({\n cohort: string(),\n eligibilityRate: number(),\n priority: number(),\n eligible: boolean(),\n});\n\nexport const SubscriptionEligibilityStruct = type({\n product: ProductTypeStruct,\n canSubscribe: optional(boolean()),\n canViewEntryModal: optional(boolean()),\n modalType: optional(enums(['A', 'B'])),\n cohorts: optional(array(CohortStruct)),\n assignedCohort: optional(nullable(string())),\n assignedAt: optional(string()),\n hasAssignedCohortExpired: optional(boolean()),\n});\n\nexport const SubscriptionEligibilityArrayStruct = array(\n SubscriptionEligibilityStruct,\n);\n"]}
|
|
@@ -80,7 +80,8 @@ export declare class SubscriptionService extends BaseDataService<typeof serviceN
|
|
|
80
80
|
* Starts a subscription with a crypto payment method.
|
|
81
81
|
*
|
|
82
82
|
* @param request - The start crypto subscription request.
|
|
83
|
-
* @returns The created subscription
|
|
83
|
+
* @returns The created subscription. Unlike card checkout, the Subscription
|
|
84
|
+
* API creates the subscription immediately and returns it in full.
|
|
84
85
|
* @throws If `products` is empty.
|
|
85
86
|
* @throws If the request does not use exactly one of `rawTransaction`
|
|
86
87
|
* (ERC-20 approval) or `delegationHash` (delegation).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionService.d.ts","sourceRoot":"","sources":["../src/SubscriptionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EACL,GAAG,EAIJ,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"SubscriptionService.d.ts","sourceRoot":"","sources":["../src/SubscriptionService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCA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2B,CAC/B,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAuB1C;IAED;;;;;OAKG;IACG,uBAAuB,CAC3B,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAmB1C;IAED;;;;OAIG;IACG,yBAAyB,CAC7B,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,IAAI,CAAC,CAiBf;IAED;;;;;OAKG;IACG,6BAA6B,CACjC,OAAO,CAAC,EAAE,oCAAoC,GAC7C,OAAO,CAAC,uBAAuB,EAAE,CAAC,CA4BpC;IAED;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpE;IAED;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYpE;IAED;;;;;;;;OAQG;IACG,wBAAwB,CAC5B,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAaf;IAED;;;;;;OAMG;IACG,WAAW,CACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,8BAA8B,CAAC,CAczC;IAED;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,CAY3C;IAED;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAY1D;CAoKF"}
|
|
@@ -4,7 +4,7 @@ import { create } from '@metamask/superstruct';
|
|
|
4
4
|
import { Env, getEnvUrls, SubscriptionControllerErrorMessage, SubscriptionServiceErrorMessage, } from './constants.js';
|
|
5
5
|
import { createSentryError, getSubscriptionErrorFromResponse, SubscriptionServiceError, } from './errors.js';
|
|
6
6
|
import { createModuleLogger, projectLogger } from './logger.js';
|
|
7
|
-
import { BillingPortalResponseStruct, GetSubscriptionsResponseStruct, PricingResponseStruct,
|
|
7
|
+
import { BillingPortalResponseStruct, GetSubscriptionsResponseStruct, PricingResponseStruct, StartSubscriptionResponseStruct, SubscriptionApiGeneralResponseStruct, SubscriptionBenefitsResponseStruct, SubscriptionEligibilityArrayStruct, SubscriptionStruct, UpdatePaymentMethodCardResponseStruct, } from './SubscriptionService-structs.js';
|
|
8
8
|
import { CRYPTO_AUTH_METHODS } from './types.js';
|
|
9
9
|
export const serviceName = 'SubscriptionService';
|
|
10
10
|
export const SUBSCRIPTION_URL = (env, path) => `${getEnvUrls(env).subscriptionApiUrl}/v1/${path}`;
|
|
@@ -177,7 +177,8 @@ export class SubscriptionService extends BaseDataService {
|
|
|
177
177
|
* Starts a subscription with a crypto payment method.
|
|
178
178
|
*
|
|
179
179
|
* @param request - The start crypto subscription request.
|
|
180
|
-
* @returns The created subscription
|
|
180
|
+
* @returns The created subscription. Unlike card checkout, the Subscription
|
|
181
|
+
* API creates the subscription immediately and returns it in full.
|
|
181
182
|
* @throws If `products` is empty.
|
|
182
183
|
* @throws If the request does not use exactly one of `rawTransaction`
|
|
183
184
|
* (ERC-20 approval) or `delegationHash` (delegation).
|
|
@@ -198,7 +199,7 @@ export class SubscriptionService extends BaseDataService {
|
|
|
198
199
|
body: request,
|
|
199
200
|
errorMessage: SubscriptionServiceErrorMessage.FailedToStartSubscriptionWithCrypto,
|
|
200
201
|
});
|
|
201
|
-
return create(jsonResponse,
|
|
202
|
+
return create(jsonResponse, SubscriptionStruct);
|
|
202
203
|
}
|
|
203
204
|
/**
|
|
204
205
|
* Updates a subscription's card payment method.
|