@pocketprep/types 1.19.40 → 1.19.42

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.
@@ -15,7 +15,7 @@ jobs:
15
15
  - uses: actions/checkout@v2
16
16
  - uses: actions/setup-node@v2
17
17
  with:
18
- node-version: 20.17.0
18
+ node-version: 24.22.1
19
19
  registry-url: https://registry.npmjs.org/
20
20
  - run: npm ci
21
21
  - run: npm run lint
@@ -0,0 +1,83 @@
1
+ import Stripe from 'stripe'
2
+
3
+ /*
4
+ * The price contracts clients read from nest's `GET /billing/prices`. Prices
5
+ * are Stripe's own objects passed through unchanged, as Parse returns them, so
6
+ * any field the server dropped would fail at runtime rather than at compile
7
+ * time. Additions are safe; removals are not.
8
+ */
9
+
10
+ /**
11
+ * How often a recurring price bills, derived from its Stripe interval.
12
+ *
13
+ * Not `cadence`: `Study.Class.RecommendationConfig.cadence` already spends
14
+ * that word on a quiz count throttling how often a recommendation reappears.
15
+ */
16
+ export type BillingInterval = 'monthly' | 'quarterly' | 'yearly'
17
+
18
+ /**
19
+ * A Stripe Price, plus a server-derived {@link BillingPrice.billingInterval}.
20
+ *
21
+ * It saves clients from parsing `nickname`, which is free text edited in the
22
+ * Stripe dashboard.
23
+ */
24
+ export interface BillingPrice extends Stripe.Price {
25
+ /**
26
+ * Billing interval derived from `recurring`. Absent for one-time prices and
27
+ * for any interval that is not monthly, quarterly, or yearly.
28
+ *
29
+ * Named apart from Stripe's own `recurring.interval` (`month` / `year`),
30
+ * which this is derived from but does not restate.
31
+ */
32
+ billingInterval?: BillingInterval
33
+ }
34
+
35
+ /**
36
+ * Which client a member's plans are for. Each bundle sells the same plans at
37
+ * two sets of prices: `_mobile` lookup keys for members who arrive from the
38
+ * app, and the rest for members who start on web.
39
+ */
40
+ export type PricePlatform = 'web' | 'mobile'
41
+
42
+ /**
43
+ * The Amplitude price test that chose a member's plans, and their variant in
44
+ * it. When the member actually sees the plans, the client records a
45
+ * `$exposure` event whose `flag_key`, `variant` and `experiment_key`
46
+ * properties are these three fields.
47
+ */
48
+ export interface PriceTest {
49
+ /** The test's key in Amplitude, `pricing-test-<lowercased bundle id>[-<test name>]`. */
50
+ flagKey: string
51
+ /** The member's variant key, `control` included. */
52
+ variant: string
53
+ /**
54
+ * Which run of the experiment assigned the variant (`exp-1`, `exp-2` after
55
+ * a restart), so the exposure counts toward the right run. Absent when
56
+ * Amplitude names none.
57
+ */
58
+ experimentKey?: string
59
+ }
60
+
61
+ /**
62
+ * Narrows the price list to the plans a signed-in member sees for one bundle
63
+ * on one platform. Both or neither: a bundle without a platform can't choose
64
+ * between its web and `_mobile` prices, and a platform alone names no plans.
65
+ */
66
+ export interface FetchBillingPricesParams {
67
+ bundleId?: string
68
+ platform?: PricePlatform
69
+ }
70
+
71
+ export interface FetchBillingPricesResponse {
72
+ /**
73
+ * Every active price; or, when a signed-in member asks for one bundle on
74
+ * one platform, the monthly, quarterly and yearly plans they see there, in
75
+ * that order.
76
+ */
77
+ prices: BillingPrice[]
78
+ /**
79
+ * The price test that chose `prices`, control included. Absent when no
80
+ * test applies to the member, so there is no exposure to record.
81
+ */
82
+ priceTest?: PriceTest
83
+ }
package/API/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './QuestionMetric'
6
6
  export * from './Session'
7
7
  export * from './User'
8
8
  export * from './LevelUp'
9
+ export * from './Billing'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketprep/types",
3
- "version": "1.19.40",
3
+ "version": "1.19.42",
4
4
  "description": "Pocket Prep type declarations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://github.com/Pocket-Prep/types#readme",
24
24
  "dependencies": {
25
25
  "@types/parse": "3.0.9",
26
- "stripe": "18.3.0"
26
+ "stripe": "19.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@stylistic/eslint-plugin": "2.8.0",