@metamask-previews/subscription-controller 9.1.0-preview-48ac8a8c1 → 9.1.0-preview-0a1dd02ad

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +0 -22
  2. package/dist/SubscriptionService-structs.d.ts +36 -150
  3. package/dist/SubscriptionService-structs.d.ts.map +1 -1
  4. package/dist/SubscriptionService-structs.js +12 -46
  5. package/dist/SubscriptionService-structs.js.map +1 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/selectors.d.ts +1 -41
  11. package/dist/selectors.d.ts.map +1 -1
  12. package/dist/selectors.js +0 -65
  13. package/dist/selectors.js.map +1 -1
  14. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts +0 -5
  15. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.d.ts.map +1 -1
  16. package/dist/subscription-delegation/SubscriptionDelegationService-method-action-types.js.map +1 -1
  17. package/dist/subscription-delegation/SubscriptionDelegationService.d.ts +1 -6
  18. package/dist/subscription-delegation/SubscriptionDelegationService.d.ts.map +1 -1
  19. package/dist/subscription-delegation/SubscriptionDelegationService.js +15 -35
  20. package/dist/subscription-delegation/SubscriptionDelegationService.js.map +1 -1
  21. package/dist/subscription-delegation/fingerprint.d.ts +0 -11
  22. package/dist/subscription-delegation/fingerprint.d.ts.map +1 -1
  23. package/dist/subscription-delegation/fingerprint.js +0 -40
  24. package/dist/subscription-delegation/fingerprint.js.map +1 -1
  25. package/dist/types.d.ts +17 -107
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/types.js +0 -39
  28. package/dist/types.js.map +1 -1
  29. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -7,28 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add `INVOICE_PAYMENT_STATUSES` / `InvoicePaymentStatus` for typed invoice
13
- payment status values. ([#10305](https://github.com/MetaMask/core/pull/10305))
14
- - Add `CRYPTO_PAYMENT_ERRORS` / `CryptoPaymentError` and optional `Subscription.lastInvoice` (`SubscriptionInvoice`) for Subscription API crypto payment-execution failures. ([#10305](https://github.com/MetaMask/core/pull/10305))
15
- - Add `selectIsPaymentFailed`, `selectPaymentFailureReason`, `selectIsRenewalNeeded`, and `selectIsDelegationExhausted` selectors keyed by subscription product. ([#10305](https://github.com/MetaMask/core/pull/10305))
16
- - Add `UpdateDelegationPaymentMethodCryptoRequest` so `updatePaymentMethod` can rotate an active crypto subscription with `cryptoAuthMethod` and `delegationHash`. ([#10305](https://github.com/MetaMask/core/pull/10305))
17
- - Add optional `forceNew` to `SubscriptionDelegationService:prepareDelegation` to create a replacement delegation instead of reusing a matching stored one. ([#10305](https://github.com/MetaMask/core/pull/10305))
18
- - Add optional `TokenPaymentInfo.vault` and the `VaultName` type plus `VAULT_NAMES` constants, for the named vault a vault-share settlement token belongs to. `VaultName` is an open `string` because the set of vaults is server-driven. ([#10416](https://github.com/MetaMask/core/pull/10416))
19
- - Add `isVaultShareToken` to identify a yield-bearing vault-share settlement token, replacing the removed `isVaultShare` flag. ([#10416](https://github.com/MetaMask/core/pull/10416))
20
-
21
- ### Changed
22
-
23
- - **BREAKING:** Remove `TokenPaymentInfo.isVaultShare`, which the Subscription API no longer sends. A vault share is now identified by the presence of `accountantAddress` — use `isVaultShareToken`. Leaving the field in place made `getPricing` reject every vault-share token and fail the whole pricing response. ([#10416](https://github.com/MetaMask/core/pull/10416))
24
- - **BREAKING:** Make `Subscription.currentPeriodStart`, `currentPeriodEnd`, `cancelType`, and `isEligibleForSupport` optional so paused or failed crypto subscriptions can validate. ([#10305](https://github.com/MetaMask/core/pull/10305))
25
- - Refresh the access token when Money Account Plus subscription snapshots change, including payment-failure state while status remains active. ([#10305](https://github.com/MetaMask/core/pull/10305))
26
- - Prefer the latest period `startDate` when `prepareDelegation` reuses a matching stored cash-subscription delegation, so a `forceNew` replacement is chosen over an older equivalent record. ([#10305](https://github.com/MetaMask/core/pull/10305))
27
- - Bump `@metamask/profile-sync-controller` from `^32.1.1` to `^32.3.1` ([#10348](https://github.com/MetaMask/core/pull/10348), [#10409](https://github.com/MetaMask/core/pull/10409), [#10418](https://github.com/MetaMask/core/pull/10418))
28
- - Bump `@metamask/transaction-controller` from `^70.1.0` to `^71.0.0` ([#10386](https://github.com/MetaMask/core/pull/10386))
29
- - Bump `@metamask/authenticated-user-storage` from `^4.0.0` to `^4.1.0` ([#10400](https://github.com/MetaMask/core/pull/10400))
30
- - Bump `@tanstack/query-core` from `^5.62.16` to `^5.89.0` ([#9324](https://github.com/MetaMask/core/pull/9324))
31
-
32
10
  ## [9.1.0]
33
11
 
34
12
  ### Added
@@ -8,8 +8,8 @@ export declare const SubscriptionStruct: Struct<{
8
8
  unitAmount: number;
9
9
  unitDecimals: number;
10
10
  }[];
11
- currentPeriodStart?: string | undefined;
12
- currentPeriodEnd?: string | undefined;
11
+ currentPeriodStart: string;
12
+ currentPeriodEnd: string;
13
13
  cancelAtPeriodEnd?: boolean | undefined;
14
14
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
15
15
  interval: "month" | "year";
@@ -34,16 +34,10 @@ export declare const SubscriptionStruct: Struct<{
34
34
  trialEnd?: string | undefined;
35
35
  endDate?: string | undefined;
36
36
  canceledAt?: string | undefined;
37
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
37
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
38
38
  inactiveAt?: string | undefined;
39
- isEligibleForSupport?: boolean | undefined;
39
+ isEligibleForSupport: boolean;
40
40
  billingCycles?: number | undefined;
41
- lastInvoice?: {
42
- id: string;
43
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
44
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
45
- updatedAt: string;
46
- } | undefined;
47
41
  }, {
48
42
  id: Struct<string, null>;
49
43
  products: Struct<{
@@ -67,8 +61,8 @@ export declare const SubscriptionStruct: Struct<{
67
61
  unitAmount: Struct<number, null>;
68
62
  unitDecimals: Struct<number, null>;
69
63
  }>>;
70
- currentPeriodStart: Struct<string | undefined, null>;
71
- currentPeriodEnd: Struct<string | undefined, null>;
64
+ currentPeriodStart: Struct<string, null>;
65
+ currentPeriodEnd: Struct<string, null>;
72
66
  cancelAtPeriodEnd: Struct<boolean | undefined, null>;
73
67
  status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
74
68
  active: "active";
@@ -106,39 +100,15 @@ export declare const SubscriptionStruct: Struct<{
106
100
  trialEnd: Struct<string | undefined, null>;
107
101
  endDate: Struct<string | undefined, null>;
108
102
  canceledAt: Struct<string | undefined, null>;
109
- cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined, {
103
+ cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification", {
110
104
  allowed_at_period_end: "allowed_at_period_end";
111
105
  allowed_immediate: "allowed_immediate";
112
106
  not_allowed: "not_allowed";
113
107
  not_allowed_pending_verification: "not_allowed_pending_verification";
114
108
  }>;
115
109
  inactiveAt: Struct<string | undefined, null>;
116
- isEligibleForSupport: Struct<boolean | undefined, null>;
110
+ isEligibleForSupport: Struct<boolean, null>;
117
111
  billingCycles: Struct<number | undefined, null>;
118
- lastInvoice: Struct<{
119
- id: string;
120
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
121
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
122
- updatedAt: string;
123
- } | undefined, {
124
- id: Struct<string, null>;
125
- status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
126
- FAILED: "FAILED";
127
- PROCESSING: "PROCESSING";
128
- SUCCEEDED: "SUCCEEDED";
129
- UNKNOWN: "UNKNOWN";
130
- }>;
131
- errorCode: Struct<"delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined, {
132
- delegation_not_found: "delegation_not_found";
133
- delegation_revoked: "delegation_revoked";
134
- exceeds_delegation_allowance: "exceeds_delegation_allowance";
135
- insufficient_allowance: "insufficient_allowance";
136
- insufficient_balance: "insufficient_balance";
137
- internal_server_error: "internal_server_error";
138
- recipient_not_allowlisted: "recipient_not_allowlisted";
139
- }>;
140
- updatedAt: Struct<string, null>;
141
- }>;
142
112
  }>;
143
113
  export declare const GetSubscriptionsResponseStruct: Struct<{
144
114
  customerId?: string | undefined;
@@ -150,8 +120,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
150
120
  unitAmount: number;
151
121
  unitDecimals: number;
152
122
  }[];
153
- currentPeriodStart?: string | undefined;
154
- currentPeriodEnd?: string | undefined;
123
+ currentPeriodStart: string;
124
+ currentPeriodEnd: string;
155
125
  cancelAtPeriodEnd?: boolean | undefined;
156
126
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
157
127
  interval: "month" | "year";
@@ -176,16 +146,10 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
176
146
  trialEnd?: string | undefined;
177
147
  endDate?: string | undefined;
178
148
  canceledAt?: string | undefined;
179
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
149
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
180
150
  inactiveAt?: string | undefined;
181
- isEligibleForSupport?: boolean | undefined;
151
+ isEligibleForSupport: boolean;
182
152
  billingCycles?: number | undefined;
183
- lastInvoice?: {
184
- id: string;
185
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
186
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
187
- updatedAt: string;
188
- } | undefined;
189
153
  }[];
190
154
  trialedProducts: ("money_account_plus" | "shield")[];
191
155
  productEntitlements?: {
@@ -213,8 +177,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
213
177
  unitAmount: number;
214
178
  unitDecimals: number;
215
179
  }[];
216
- currentPeriodStart?: string | undefined;
217
- currentPeriodEnd?: string | undefined;
180
+ currentPeriodStart: string;
181
+ currentPeriodEnd: string;
218
182
  cancelAtPeriodEnd?: boolean | undefined;
219
183
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
220
184
  interval: "month" | "year";
@@ -239,16 +203,10 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
239
203
  trialEnd?: string | undefined;
240
204
  endDate?: string | undefined;
241
205
  canceledAt?: string | undefined;
242
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
206
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
243
207
  inactiveAt?: string | undefined;
244
- isEligibleForSupport?: boolean | undefined;
208
+ isEligibleForSupport: boolean;
245
209
  billingCycles?: number | undefined;
246
- lastInvoice?: {
247
- id: string;
248
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
249
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
250
- updatedAt: string;
251
- } | undefined;
252
210
  } | undefined;
253
211
  rewardAccountId?: `${string}:${string}:${string}` | undefined;
254
212
  }, {
@@ -261,8 +219,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
261
219
  unitAmount: number;
262
220
  unitDecimals: number;
263
221
  }[];
264
- currentPeriodStart?: string | undefined;
265
- currentPeriodEnd?: string | undefined;
222
+ currentPeriodStart: string;
223
+ currentPeriodEnd: string;
266
224
  cancelAtPeriodEnd?: boolean | undefined;
267
225
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
268
226
  interval: "month" | "year";
@@ -287,16 +245,10 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
287
245
  trialEnd?: string | undefined;
288
246
  endDate?: string | undefined;
289
247
  canceledAt?: string | undefined;
290
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
248
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
291
249
  inactiveAt?: string | undefined;
292
- isEligibleForSupport?: boolean | undefined;
250
+ isEligibleForSupport: boolean;
293
251
  billingCycles?: number | undefined;
294
- lastInvoice?: {
295
- id: string;
296
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
297
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
298
- updatedAt: string;
299
- } | undefined;
300
252
  }[], Struct<{
301
253
  id: string;
302
254
  products: {
@@ -305,8 +257,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
305
257
  unitAmount: number;
306
258
  unitDecimals: number;
307
259
  }[];
308
- currentPeriodStart?: string | undefined;
309
- currentPeriodEnd?: string | undefined;
260
+ currentPeriodStart: string;
261
+ currentPeriodEnd: string;
310
262
  cancelAtPeriodEnd?: boolean | undefined;
311
263
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
312
264
  interval: "month" | "year";
@@ -331,16 +283,10 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
331
283
  trialEnd?: string | undefined;
332
284
  endDate?: string | undefined;
333
285
  canceledAt?: string | undefined;
334
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
286
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
335
287
  inactiveAt?: string | undefined;
336
- isEligibleForSupport?: boolean | undefined;
288
+ isEligibleForSupport: boolean;
337
289
  billingCycles?: number | undefined;
338
- lastInvoice?: {
339
- id: string;
340
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
341
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
342
- updatedAt: string;
343
- } | undefined;
344
290
  }, {
345
291
  id: Struct<string, null>;
346
292
  products: Struct<{
@@ -364,8 +310,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
364
310
  unitAmount: Struct<number, null>;
365
311
  unitDecimals: Struct<number, null>;
366
312
  }>>;
367
- currentPeriodStart: Struct<string | undefined, null>;
368
- currentPeriodEnd: Struct<string | undefined, null>;
313
+ currentPeriodStart: Struct<string, null>;
314
+ currentPeriodEnd: Struct<string, null>;
369
315
  cancelAtPeriodEnd: Struct<boolean | undefined, null>;
370
316
  status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
371
317
  active: "active";
@@ -403,39 +349,15 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
403
349
  trialEnd: Struct<string | undefined, null>;
404
350
  endDate: Struct<string | undefined, null>;
405
351
  canceledAt: Struct<string | undefined, null>;
406
- cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined, {
352
+ cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification", {
407
353
  allowed_at_period_end: "allowed_at_period_end";
408
354
  allowed_immediate: "allowed_immediate";
409
355
  not_allowed: "not_allowed";
410
356
  not_allowed_pending_verification: "not_allowed_pending_verification";
411
357
  }>;
412
358
  inactiveAt: Struct<string | undefined, null>;
413
- isEligibleForSupport: Struct<boolean | undefined, null>;
359
+ isEligibleForSupport: Struct<boolean, null>;
414
360
  billingCycles: Struct<number | undefined, null>;
415
- lastInvoice: Struct<{
416
- id: string;
417
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
418
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
419
- updatedAt: string;
420
- } | undefined, {
421
- id: Struct<string, null>;
422
- status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
423
- FAILED: "FAILED";
424
- PROCESSING: "PROCESSING";
425
- SUCCEEDED: "SUCCEEDED";
426
- UNKNOWN: "UNKNOWN";
427
- }>;
428
- errorCode: Struct<"delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined, {
429
- delegation_not_found: "delegation_not_found";
430
- delegation_revoked: "delegation_revoked";
431
- exceeds_delegation_allowance: "exceeds_delegation_allowance";
432
- insufficient_allowance: "insufficient_allowance";
433
- insufficient_balance: "insufficient_balance";
434
- internal_server_error: "internal_server_error";
435
- recipient_not_allowlisted: "recipient_not_allowlisted";
436
- }>;
437
- updatedAt: Struct<string, null>;
438
- }>;
439
361
  }>>;
440
362
  trialedProducts: Struct<("money_account_plus" | "shield")[], Struct<"money_account_plus" | "shield", {
441
363
  money_account_plus: "money_account_plus";
@@ -503,8 +425,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
503
425
  unitAmount: number;
504
426
  unitDecimals: number;
505
427
  }[];
506
- currentPeriodStart?: string | undefined;
507
- currentPeriodEnd?: string | undefined;
428
+ currentPeriodStart: string;
429
+ currentPeriodEnd: string;
508
430
  cancelAtPeriodEnd?: boolean | undefined;
509
431
  status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid";
510
432
  interval: "month" | "year";
@@ -529,16 +451,10 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
529
451
  trialEnd?: string | undefined;
530
452
  endDate?: string | undefined;
531
453
  canceledAt?: string | undefined;
532
- cancelType?: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined;
454
+ cancelType: "allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification";
533
455
  inactiveAt?: string | undefined;
534
- isEligibleForSupport?: boolean | undefined;
456
+ isEligibleForSupport: boolean;
535
457
  billingCycles?: number | undefined;
536
- lastInvoice?: {
537
- id: string;
538
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
539
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
540
- updatedAt: string;
541
- } | undefined;
542
458
  } | undefined, {
543
459
  id: Struct<string, null>;
544
460
  products: Struct<{
@@ -562,8 +478,8 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
562
478
  unitAmount: Struct<number, null>;
563
479
  unitDecimals: Struct<number, null>;
564
480
  }>>;
565
- currentPeriodStart: Struct<string | undefined, null>;
566
- currentPeriodEnd: Struct<string | undefined, null>;
481
+ currentPeriodStart: Struct<string, null>;
482
+ currentPeriodEnd: Struct<string, null>;
567
483
  cancelAtPeriodEnd: Struct<boolean | undefined, null>;
568
484
  status: Struct<"active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "provisional" | "trialing" | "unpaid", {
569
485
  active: "active";
@@ -601,39 +517,15 @@ export declare const GetSubscriptionsResponseStruct: Struct<{
601
517
  trialEnd: Struct<string | undefined, null>;
602
518
  endDate: Struct<string | undefined, null>;
603
519
  canceledAt: Struct<string | undefined, null>;
604
- cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification" | undefined, {
520
+ cancelType: Struct<"allowed_at_period_end" | "allowed_immediate" | "not_allowed" | "not_allowed_pending_verification", {
605
521
  allowed_at_period_end: "allowed_at_period_end";
606
522
  allowed_immediate: "allowed_immediate";
607
523
  not_allowed: "not_allowed";
608
524
  not_allowed_pending_verification: "not_allowed_pending_verification";
609
525
  }>;
610
526
  inactiveAt: Struct<string | undefined, null>;
611
- isEligibleForSupport: Struct<boolean | undefined, null>;
527
+ isEligibleForSupport: Struct<boolean, null>;
612
528
  billingCycles: Struct<number | undefined, null>;
613
- lastInvoice: Struct<{
614
- id: string;
615
- status: "FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN";
616
- errorCode?: "delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined;
617
- updatedAt: string;
618
- } | undefined, {
619
- id: Struct<string, null>;
620
- status: Struct<"FAILED" | "PROCESSING" | "SUCCEEDED" | "UNKNOWN", {
621
- FAILED: "FAILED";
622
- PROCESSING: "PROCESSING";
623
- SUCCEEDED: "SUCCEEDED";
624
- UNKNOWN: "UNKNOWN";
625
- }>;
626
- errorCode: Struct<"delegation_not_found" | "delegation_revoked" | "exceeds_delegation_allowance" | "insufficient_allowance" | "insufficient_balance" | "internal_server_error" | "recipient_not_allowlisted" | undefined, {
627
- delegation_not_found: "delegation_not_found";
628
- delegation_revoked: "delegation_revoked";
629
- exceeds_delegation_allowance: "exceeds_delegation_allowance";
630
- insufficient_allowance: "insufficient_allowance";
631
- insufficient_balance: "insufficient_balance";
632
- internal_server_error: "internal_server_error";
633
- recipient_not_allowlisted: "recipient_not_allowlisted";
634
- }>;
635
- updatedAt: Struct<string, null>;
636
- }>;
637
529
  }>;
638
530
  rewardAccountId: Struct<`${string}:${string}:${string}` | undefined, null>;
639
531
  }>;
@@ -789,8 +681,6 @@ export declare const PricingResponseStruct: Struct<{
789
681
  paymentMethods: ({
790
682
  type: "card";
791
683
  products?: ("money_account_plus" | "shield")[] | undefined;
792
- cryptoAuthMethod?: undefined;
793
- chains?: undefined;
794
684
  } | {
795
685
  type: "crypto";
796
686
  cryptoAuthMethod?: "delegation" | "erc20_approval" | undefined;
@@ -865,8 +755,6 @@ export declare const PricingResponseStruct: Struct<{
865
755
  paymentMethods: Struct<({
866
756
  type: "card";
867
757
  products?: ("money_account_plus" | "shield")[] | undefined;
868
- cryptoAuthMethod?: undefined;
869
- chains?: undefined;
870
758
  } | {
871
759
  type: "crypto";
872
760
  cryptoAuthMethod?: "delegation" | "erc20_approval" | undefined;
@@ -881,8 +769,6 @@ export declare const PricingResponseStruct: Struct<{
881
769
  })[], Struct<{
882
770
  type: "card";
883
771
  products?: ("money_account_plus" | "shield")[] | undefined;
884
- cryptoAuthMethod?: undefined;
885
- chains?: undefined;
886
772
  } | {
887
773
  type: "crypto";
888
774
  cryptoAuthMethod?: "delegation" | "erc20_approval" | undefined;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;EAE1C,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;EAGhD,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;;EAEhD,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;EAG/C,CAAC;AAgEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AASH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE9C,CAAC"}
@@ -1,6 +1,6 @@
1
- import { array, boolean, enums, lazy, never, nullable, number, optional, string, type, union, } from '@metamask/superstruct';
1
+ import { array, boolean, enums, lazy, literal, nullable, number, object, optional, string, type, union, } from '@metamask/superstruct';
2
2
  import { StrictHexStruct, CaipAccountIdStruct } from '@metamask/utils';
3
- import { CANCEL_TYPES, CRYPTO_AUTH_METHODS, CRYPTO_PAYMENT_ERRORS, CRYPTO_PAYMENT_METHOD_ERRORS, INVOICE_PAYMENT_STATUSES, PAYMENT_TYPES, PRODUCT_TYPES, RECURRING_INTERVALS, MoneyAccountFeature, ShieldFeature, SUBSCRIPTION_STATUSES, } from './types.js';
3
+ import { CANCEL_TYPES, CRYPTO_AUTH_METHODS, CRYPTO_PAYMENT_METHOD_ERRORS, PAYMENT_TYPES, PRODUCT_TYPES, RECURRING_INTERVALS, MoneyAccountFeature, ShieldFeature, SUBSCRIPTION_STATUSES, } from './types.js';
4
4
  const ProductTypeStruct = enums(Object.values(PRODUCT_TYPES));
5
5
  const CryptoAuthMethodStruct = enums(Object.values(CRYPTO_AUTH_METHODS));
6
6
  const ShieldEntitlementsStruct = type({
@@ -24,10 +24,8 @@ const ProductEntitlementsStruct = type({
24
24
  });
25
25
  const RecurringIntervalStruct = enums(Object.values(RECURRING_INTERVALS));
26
26
  const SubscriptionStatusStruct = enums(Object.values(SUBSCRIPTION_STATUSES));
27
- const InvoicePaymentStatusStruct = enums(Object.values(INVOICE_PAYMENT_STATUSES));
28
27
  const CancelTypeStruct = enums(Object.values(CANCEL_TYPES));
29
28
  const CryptoPaymentMethodErrorStruct = enums(Object.values(CRYPTO_PAYMENT_METHOD_ERRORS));
30
- const CryptoPaymentErrorStruct = enums(Object.values(CRYPTO_PAYMENT_ERRORS));
31
29
  const ProductStruct = type({
32
30
  name: ProductTypeStruct,
33
31
  currency: enums(['usd']),
@@ -58,8 +56,8 @@ const SubscriptionPaymentMethodStruct = union([
58
56
  export const SubscriptionStruct = type({
59
57
  id: string(),
60
58
  products: array(ProductStruct),
61
- currentPeriodStart: optional(string()),
62
- currentPeriodEnd: optional(string()),
59
+ currentPeriodStart: string(),
60
+ currentPeriodEnd: string(),
63
61
  cancelAtPeriodEnd: optional(boolean()),
64
62
  status: SubscriptionStatusStruct,
65
63
  interval: RecurringIntervalStruct,
@@ -69,16 +67,10 @@ export const SubscriptionStruct = type({
69
67
  trialEnd: optional(string()),
70
68
  endDate: optional(string()),
71
69
  canceledAt: optional(string()),
72
- cancelType: optional(CancelTypeStruct),
70
+ cancelType: CancelTypeStruct,
73
71
  inactiveAt: optional(string()),
74
- isEligibleForSupport: optional(boolean()),
72
+ isEligibleForSupport: boolean(),
75
73
  billingCycles: optional(number()),
76
- lastInvoice: optional(type({
77
- id: string(),
78
- status: InvoicePaymentStatusStruct,
79
- errorCode: optional(CryptoPaymentErrorStruct),
80
- updatedAt: string(),
81
- })),
82
74
  });
83
75
  export const GetSubscriptionsResponseStruct = type({
84
76
  customerId: optional(string()),
@@ -152,38 +144,22 @@ const ProductPricingStruct = type({
152
144
  const TokenPaymentInfoConversionRateStruct = type({
153
145
  usd: string(),
154
146
  });
155
- /**
156
- * A settlement token, discriminated by the presence of `accountantAddress`.
157
- *
158
- * Both variants use `type` rather than `object` so that fields the API adds
159
- * later pass through instead of failing the whole union — an exact struct here
160
- * turns any additive pricing change into a hard `getPricing` failure. The
161
- * mutually exclusive fields are still pinned with `optional(never())` on the
162
- * spot variant, so a vault share cannot silently validate as a spot token and
163
- * get valued at face value.
164
- *
165
- * `type` infers an index signature rather than a concrete shape, so the
166
- * inferred struct type has to be widened through `unknown` before it can be
167
- * pinned to `TokenPaymentInfo`. The declared type is the contract; the runtime
168
- * checks above are what enforce it.
169
- */
170
147
  const TokenPaymentInfoStruct = lazy(() => union([
171
- type({
148
+ object({
172
149
  symbol: string(),
173
150
  address: StrictHexStruct,
174
151
  decimals: number(),
175
152
  conversionRate: optional(TokenPaymentInfoConversionRateStruct),
153
+ isVaultShare: literal(true),
176
154
  accountantAddress: StrictHexStruct,
177
- vault: optional(string()),
178
155
  sources: optional(array(TokenPaymentInfoStruct)),
179
156
  }),
180
- type({
157
+ object({
181
158
  symbol: string(),
182
159
  address: StrictHexStruct,
183
160
  decimals: number(),
184
161
  conversionRate: optional(TokenPaymentInfoConversionRateStruct),
185
- accountantAddress: optional(never()),
186
- vault: optional(never()),
162
+ isVaultShare: optional(literal(false)),
187
163
  sources: optional(array(TokenPaymentInfoStruct)),
188
164
  }),
189
165
  ]));
@@ -194,22 +170,12 @@ const ChainPaymentInfoStruct = type({
194
170
  tokens: array(TokenPaymentInfoStruct),
195
171
  isSponsorshipSupported: optional(boolean()),
196
172
  });
197
- /**
198
- * A pricing payment-method row, discriminated by `type`.
199
- *
200
- * `type` rather than `object` for the same reason as
201
- * {@link TokenPaymentInfoStruct}: new fields on a row must not fail the union.
202
- * The crypto-only fields stay pinned with `optional(never())` on the card
203
- * variant so a card row carrying `chains` is still rejected.
204
- */
205
173
  const PricingPaymentMethodStruct = union([
206
- type({
174
+ object({
207
175
  type: enums([PAYMENT_TYPES.byCard]),
208
176
  products: optional(array(ProductTypeStruct)),
209
- cryptoAuthMethod: optional(never()),
210
- chains: optional(never()),
211
177
  }),
212
- type({
178
+ object({
213
179
  type: enums([PAYMENT_TYPES.byCrypto]),
214
180
  cryptoAuthMethod: optional(CryptoAuthMethodStruct),
215
181
  products: optional(array(ProductTypeStruct)),
@@ -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,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,E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,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 literal,\n nullable,\n number,\n object,\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_METHOD_ERRORS,\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 CancelTypeStruct = enums(Object.values(CANCEL_TYPES));\nconst CryptoPaymentMethodErrorStruct = enums(\n Object.values(CRYPTO_PAYMENT_METHOD_ERRORS),\n);\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: string(),\n currentPeriodEnd: 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: CancelTypeStruct,\n inactiveAt: optional(string()),\n isEligibleForSupport: boolean(),\n billingCycles: optional(number()),\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\nconst TokenPaymentInfoStruct: Struct<TokenPaymentInfo> = lazy(() =>\n union([\n object({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n isVaultShare: literal(true),\n accountantAddress: StrictHexStruct,\n sources: optional(array(TokenPaymentInfoStruct)),\n }),\n object({\n symbol: string(),\n address: StrictHexStruct,\n decimals: number(),\n conversionRate: optional(TokenPaymentInfoConversionRateStruct),\n isVaultShare: optional(literal(false)),\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\nconst PricingPaymentMethodStruct = union([\n object({\n type: enums([PAYMENT_TYPES.byCard]),\n products: optional(array(ProductTypeStruct)),\n }),\n object({\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"]}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export type { SubscriptionControllerActions, SubscriptionControllerState, SubscriptionControllerEvents, SubscriptionControllerGetStateAction, SubscriptionControllerMessenger, SubscriptionControllerOptions, SubscriptionControllerStateChangeEvent, } from './SubscriptionController.js';
2
2
  export type { SubscriptionControllerGetPricingAction, SubscriptionControllerGetSubscriptionsAction, SubscriptionControllerGetBenefitsAction, SubscriptionControllerGetSubscriptionByProductAction, SubscriptionControllerGetSubscriptionsEligibilitiesAction, SubscriptionControllerCancelSubscriptionAction, SubscriptionControllerUnCancelSubscriptionAction, SubscriptionControllerStartSubscriptionWithCardAction, SubscriptionControllerStartSubscriptionWithCryptoAction, SubscriptionControllerSubmitSubscriptionCryptoApprovalAction, SubscriptionControllerGetCryptoApproveTransactionParamsAction, SubscriptionControllerUpdatePaymentMethodAction, SubscriptionControllerGetBillingPortalUrlAction, SubscriptionControllerCacheLastSelectedPaymentMethodAction, SubscriptionControllerClearLastSelectedPaymentMethodAction, SubscriptionControllerSubmitSponsorshipIntentsAction, SubscriptionControllerSubmitUserEventAction, SubscriptionControllerAssignUserToCohortAction, SubscriptionControllerLinkRewardsAction, SubscriptionControllerGetTokenApproveAmountAction, SubscriptionControllerGetTokenMinimumBalanceAmountAction, SubscriptionControllerClearStateAction, SubscriptionControllerTriggerAccessTokenRefreshAction, SubscriptionControllerStopAllPollingAction, } from './SubscriptionController-method-action-types.js';
3
3
  export { SubscriptionController, getDefaultSubscriptionControllerState, } from './SubscriptionController.js';
4
- export type { SubscriptionApiError, Subscription, PerpsBenefitUsage, PredictBenefitUsage, SubscriptionBenefitsResponse, SubscriptionBenefitsState, SwapsBenefitUsage, AuthUtils, CancelSubscriptionRequest, CancelType, CancellationReasonCode, ISubscriptionService, StartCryptoSubscriptionRequest, StartDelegationCryptoSubscriptionRequest, StartErc20CryptoSubscriptionRequest, StartCryptoSubscriptionResponse, StartSubscriptionRequest, StartSubscriptionResponse, GetCryptoApproveTransactionRequest, GetCryptoApproveTransactionResponse, SubmitSubscriptionCryptoApprovalRequest, SubscriptionCardPaymentMethod, SubscriptionCryptoPaymentMethod, SubscriptionPaymentMethod, SubscriptionInvoice, InvoicePaymentStatus, SubmitUserEventRequest, SubmitSponsorshipIntentsRequest, SubscriptionEligibility, SubscriptionUserEventType, RecurringInterval, SubscriptionStatus, PaymentType, Product, ProductType, ProductPrice, ProductPricing, TokenPaymentInfo, SpotTokenPaymentInfo, VaultTokenPaymentInfo, VaultName, ChainPaymentInfo, Currency, CryptoAuthMethod, PricingPaymentMethod, PricingCardPaymentMethod, PricingCryptoPaymentMethod, PricingResponse, UpdatePaymentMethodOpts, BillingPortalResponse, CryptoPaymentMethodError, CryptoPaymentError, UpdateErc20PaymentMethodCryptoRequest, UpdateDelegationPaymentMethodCryptoRequest, UpdatePaymentMethodCryptoRequest, UpdatePaymentMethodCardRequest, UpdatePaymentMethodCardResponse, CachedLastSelectedPaymentMethod, CacheLastSelectedPaymentMethodRequest, SubmitSponsorshipIntentsMethodParams, Cohort, CohortName, BalanceCategory, AssignCohortRequest, GetSubscriptionsEligibilitiesRequest, ModalType, MoneyAccountEntitlements, MoneyAccountPlusClaim, ProductEntitlementFeatureMap, ProductEntitlements, ShieldEntitlements, } from './types.js';
5
- export { CANCEL_TYPES, CRYPTO_PAYMENT_METHOD_ERRORS, CRYPTO_PAYMENT_ERRORS, INVOICE_PAYMENT_STATUSES, SUBSCRIPTION_STATUSES, PRODUCT_TYPES, RECURRING_INTERVALS, PAYMENT_TYPES, CRYPTO_AUTH_METHODS, VAULT_NAMES, isVaultShareToken, SubscriptionUserEvent, COHORT_NAMES, BALANCE_CATEGORIES, MODAL_TYPE, MoneyAccountFeature, ShieldFeature, } from './types.js';
4
+ export type { SubscriptionApiError, Subscription, PerpsBenefitUsage, PredictBenefitUsage, SubscriptionBenefitsResponse, SubscriptionBenefitsState, SwapsBenefitUsage, AuthUtils, CancelSubscriptionRequest, CancelType, CancellationReasonCode, ISubscriptionService, StartCryptoSubscriptionRequest, StartDelegationCryptoSubscriptionRequest, StartErc20CryptoSubscriptionRequest, StartCryptoSubscriptionResponse, StartSubscriptionRequest, StartSubscriptionResponse, GetCryptoApproveTransactionRequest, GetCryptoApproveTransactionResponse, SubmitSubscriptionCryptoApprovalRequest, SubscriptionCardPaymentMethod, SubscriptionCryptoPaymentMethod, SubscriptionPaymentMethod, SubmitUserEventRequest, SubmitSponsorshipIntentsRequest, SubscriptionEligibility, SubscriptionUserEventType, RecurringInterval, SubscriptionStatus, PaymentType, Product, ProductType, ProductPrice, ProductPricing, TokenPaymentInfo, SpotTokenPaymentInfo, VaultTokenPaymentInfo, ChainPaymentInfo, Currency, CryptoAuthMethod, PricingPaymentMethod, PricingCardPaymentMethod, PricingCryptoPaymentMethod, PricingResponse, UpdatePaymentMethodOpts, BillingPortalResponse, CryptoPaymentMethodError, UpdatePaymentMethodCryptoRequest, UpdatePaymentMethodCardRequest, UpdatePaymentMethodCardResponse, CachedLastSelectedPaymentMethod, CacheLastSelectedPaymentMethodRequest, SubmitSponsorshipIntentsMethodParams, Cohort, CohortName, BalanceCategory, AssignCohortRequest, GetSubscriptionsEligibilitiesRequest, ModalType, MoneyAccountEntitlements, MoneyAccountPlusClaim, ProductEntitlementFeatureMap, ProductEntitlements, ShieldEntitlements, } from './types.js';
5
+ export { CANCEL_TYPES, CRYPTO_PAYMENT_METHOD_ERRORS, SUBSCRIPTION_STATUSES, PRODUCT_TYPES, RECURRING_INTERVALS, PAYMENT_TYPES, CRYPTO_AUTH_METHODS, SubscriptionUserEvent, COHORT_NAMES, BALANCE_CATEGORIES, MODAL_TYPE, MoneyAccountFeature, ShieldFeature, } from './types.js';
6
6
  export { CANCELLATION_REASONS } from './constants.js';
7
- export { selectHasEntitlement, selectIsActiveSubscriber, selectIsUsageAvailable, selectIsPaymentFailed, selectPaymentFailureReason, selectIsRenewalNeeded, selectIsDelegationExhausted, } from './selectors.js';
7
+ export { selectHasEntitlement, selectIsActiveSubscriber, selectIsUsageAvailable, } from './selectors.js';
8
8
  export { SubscriptionServiceError } from './errors.js';
9
9
  export { Env, SubscriptionControllerErrorMessage, SubscriptionServiceErrorMessage, SubscriptionDelegationServiceErrorMessage, } from './constants.js';
10
10
  export type { SubscriptionServiceOptions, SubscriptionServiceMessenger, SubscriptionServiceActions, SubscriptionServiceEvents, SubscriptionServiceCacheUpdatedEvent, SubscriptionServiceGranularCacheUpdatedEvent, SubscriptionServiceInvalidateQueriesAction, } from './SubscriptionService.js';