@superwall/runtime 2.6.0 → 2.7.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.
@@ -6,13 +6,19 @@
6
6
  * - `sheet` — take payment in the paywall, in a sheet Superwall renders.
7
7
  * - `applePay` — go straight to Apple Pay, falling back to the sheet where
8
8
  * Apple Pay is unavailable.
9
+ * - `elements` — take payment in a form the paywall builds itself from
10
+ * Stripe's own elements, with `<StripeCheckout>` from
11
+ * `superwall/checkout/stripe` and `useCheckout()` and `<PurchaseButton>`
12
+ * from `superwall/checkout`. A plain `purchase()`
13
+ * opens the sheet. Inside an iOS app the form is unavailable and a
14
+ * purchase opens the hosted checkout.
9
15
  *
10
16
  * The sheet's appearance is fixed and takes nothing from the paywall around
11
- * it. `sheet` and `applePay` carry Stripe's payment UI into the bundle;
12
- * `external` costs nothing. Read this before shipping either:
17
+ * it. `sheet`, `applePay` and `elements` carry Stripe's payment UI into the
18
+ * bundle; `external` costs nothing. Read this before shipping either:
13
19
  * https://superwall.com/docs/web-checkout
14
20
  */
15
- export type SuperwallCheckoutMode = "external" | "sheet" | "applePay";
21
+ export type SuperwallCheckoutMode = "external" | "sheet" | "applePay" | "elements";
16
22
  /**
17
23
  * The mode alone, or the object form to steer it:
18
24
  *
@@ -34,8 +40,8 @@ export type SuperwallCheckoutConfig<TReference extends string = string> = Superw
34
40
  * Whether a web checkout accepts prepaid cards: `"allow"` (the default) or
35
41
  * `"block"`, which makes Stripe refuse them, a defence against free-trial
36
42
  * abuse. It applies to the sheet and the hosted checkout page; an Apple Pay
37
- * payment can't be filtered by card type, so in `applePay` mode only the
38
- * sheet fallback refuses them. Store purchases ignore it.
43
+ * payment or a payment in an `elements` form can't be filtered by card type,
44
+ * so in `applePay` and `elements` mode only the sheet fallback refuses them. Store purchases ignore it.
39
45
  */
40
46
  export type SuperwallPrepaidCards = "allow" | "block";
41
47
  export type SuperwallManagedPaymentsOverride = "USE_MANAGED_PAYMENTS" | "USE_DEFAULT_PAYMENTS";
@@ -99,8 +99,10 @@ export type SuperwallPurchaseOptions = {
99
99
  * How this purchase checks out on the web when the product is a Stripe
100
100
  * product, overriding the config's `checkout` mode for this call — a
101
101
  * button that always opens the sheet on a paywall whose default is
102
- * `"applePay"`. Inside an iOS app a Stripe purchase always opens the
103
- * hosted checkout whatever this says. Ignored by store purchases.
102
+ * `"applePay"`. `"elements"` opens the sheet here: an `elements` form
103
+ * pays through its own `useCheckout().submit()`. Inside an iOS app a
104
+ * Stripe purchase always opens the hosted checkout whatever this says.
105
+ * Ignored by store purchases.
104
106
  * Default: the config's `checkout` mode.
105
107
  */
106
108
  checkout?: SuperwallCheckoutMode;
@@ -68,6 +68,13 @@ export type SuperwallDeviceVariables = {
68
68
  fontScale?: number;
69
69
  preferredContentSizeCategory?: string;
70
70
  isLowPowerModeEnabled?: boolean;
71
+ /**
72
+ * @deprecated The native SDK always reports `true`, so this says nothing
73
+ * about Apple Pay. To know whether Apple Pay is set up with a card, in the
74
+ * app or on the web, use `useApplePay().available` or `checkApplePay()` from
75
+ * `superwall/hooks`. In `checkout: "applePay"` mode Stripe's
76
+ * `canMakePayment()` decides, reported by `useApplePay(product).product`.
77
+ */
71
78
  isApplePayAvailable?: boolean;
72
79
  isMac?: boolean;
73
80
  isSandbox?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superwall/runtime",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Framework-agnostic runtime for headless Superwall paywalls: bridge, session, products, localization, mock host.",
5
5
  "keywords": [
6
6
  "paywall",
@@ -39,7 +39,7 @@
39
39
  "clean": "rm -rf dist coverage"
40
40
  },
41
41
  "dependencies": {
42
- "@superwall/protocol": "2.6.0"
42
+ "@superwall/protocol": "2.7.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@superwall/host": "workspace:*",
@@ -6,13 +6,19 @@
6
6
  * - `sheet` — take payment in the paywall, in a sheet Superwall renders.
7
7
  * - `applePay` — go straight to Apple Pay, falling back to the sheet where
8
8
  * Apple Pay is unavailable.
9
+ * - `elements` — take payment in a form the paywall builds itself from
10
+ * Stripe's own elements, with `<StripeCheckout>` from
11
+ * `superwall/checkout/stripe` and `useCheckout()` and `<PurchaseButton>`
12
+ * from `superwall/checkout`. A plain `purchase()`
13
+ * opens the sheet. Inside an iOS app the form is unavailable and a
14
+ * purchase opens the hosted checkout.
9
15
  *
10
16
  * The sheet's appearance is fixed and takes nothing from the paywall around
11
- * it. `sheet` and `applePay` carry Stripe's payment UI into the bundle;
12
- * `external` costs nothing. Read this before shipping either:
17
+ * it. `sheet`, `applePay` and `elements` carry Stripe's payment UI into the
18
+ * bundle; `external` costs nothing. Read this before shipping either:
13
19
  * https://superwall.com/docs/web-checkout
14
20
  */
15
- export type SuperwallCheckoutMode = "external" | "sheet" | "applePay";
21
+ export type SuperwallCheckoutMode = "external" | "sheet" | "applePay" | "elements";
16
22
 
17
23
  /**
18
24
  * The mode alone, or the object form to steer it:
@@ -38,8 +44,8 @@ export type SuperwallCheckoutConfig<TReference extends string = string> =
38
44
  * Whether a web checkout accepts prepaid cards: `"allow"` (the default) or
39
45
  * `"block"`, which makes Stripe refuse them, a defence against free-trial
40
46
  * abuse. It applies to the sheet and the hosted checkout page; an Apple Pay
41
- * payment can't be filtered by card type, so in `applePay` mode only the
42
- * sheet fallback refuses them. Store purchases ignore it.
47
+ * payment or a payment in an `elements` form can't be filtered by card type,
48
+ * so in `applePay` and `elements` mode only the sheet fallback refuses them. Store purchases ignore it.
43
49
  */
44
50
  export type SuperwallPrepaidCards = "allow" | "block";
45
51
 
@@ -143,8 +143,10 @@ export type SuperwallPurchaseOptions = {
143
143
  * How this purchase checks out on the web when the product is a Stripe
144
144
  * product, overriding the config's `checkout` mode for this call — a
145
145
  * button that always opens the sheet on a paywall whose default is
146
- * `"applePay"`. Inside an iOS app a Stripe purchase always opens the
147
- * hosted checkout whatever this says. Ignored by store purchases.
146
+ * `"applePay"`. `"elements"` opens the sheet here: an `elements` form
147
+ * pays through its own `useCheckout().submit()`. Inside an iOS app a
148
+ * Stripe purchase always opens the hosted checkout whatever this says.
149
+ * Ignored by store purchases.
148
150
  * Default: the config's `checkout` mode.
149
151
  */
150
152
  checkout?: SuperwallCheckoutMode;
@@ -73,6 +73,13 @@ export type SuperwallDeviceVariables = {
73
73
  fontScale?: number;
74
74
  preferredContentSizeCategory?: string;
75
75
  isLowPowerModeEnabled?: boolean;
76
+ /**
77
+ * @deprecated The native SDK always reports `true`, so this says nothing
78
+ * about Apple Pay. To know whether Apple Pay is set up with a card, in the
79
+ * app or on the web, use `useApplePay().available` or `checkApplePay()` from
80
+ * `superwall/hooks`. In `checkout: "applePay"` mode Stripe's
81
+ * `canMakePayment()` decides, reported by `useApplePay(product).product`.
82
+ */
76
83
  isApplePayAvailable?: boolean;
77
84
  isMac?: boolean;
78
85
  isSandbox?: string;