@superwall/runtime 2.1.1 → 2.2.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.
@@ -274,6 +274,7 @@ const createSession = (options) => {
274
274
  openUrl: (url, urlOptions = {}) => post(outgoing.openUrl(url, urlOptions.browserType)),
275
275
  openExternalUrl: (url) => post(outgoing.openExternalUrl(url)),
276
276
  openDeepLink: (link) => post(outgoing.openDeepLink(link)),
277
+ customAction: (name) => post(outgoing.custom(name)),
277
278
  customPlacement: (name, params = {}) => post(outgoing.customPlacement(name, params)),
278
279
  setUserAttributes: (attributes) => {
279
280
  const entries = Object.entries(attributes).map(([key, value]) => ({
@@ -10,6 +10,7 @@ export declare const restore: () => Outgoing<"restore">;
10
10
  export declare const openUrl: (url: string, browserType?: "payment_sheet") => Outgoing<"open_url">;
11
11
  export declare const openExternalUrl: (url: string) => Outgoing<"open_url_external">;
12
12
  export declare const openDeepLink: (link: string) => Outgoing<"open_deep_link">;
13
+ export declare const custom: (name: string) => Outgoing<"custom">;
13
14
  export declare const customPlacement: (name: string, params: Record<string, unknown>) => Outgoing<"custom_placement">;
14
15
  export declare const userAttributeUpdated: (attributes: Outgoing<"user_attribute_updated">["attributes"]) => Outgoing<"user_attribute_updated">;
15
16
  export declare const requestStoreReview: (reviewType: Outgoing<"request_store_review">["review_type"]) => Outgoing<"request_store_review">;
@@ -20,6 +20,7 @@ export const openDeepLink = (link) => ({
20
20
  event_name: "open_deep_link",
21
21
  link,
22
22
  });
23
+ export const custom = (name) => ({ event_name: "custom", data: name });
23
24
  export const customPlacement = (name, params) => ({ event_name: "custom_placement", name, params });
24
25
  export const userAttributeUpdated = (attributes) => ({ event_name: "user_attribute_updated", attributes });
25
26
  export const requestStoreReview = (reviewType) => ({
@@ -144,6 +144,7 @@ export interface SuperwallSession<out TProduct extends SuperwallProduct = Superw
144
144
  }) => void;
145
145
  openExternalUrl: (url: string) => void;
146
146
  openDeepLink: (link: string) => void;
147
+ customAction: (name: string) => void;
147
148
  customPlacement: (name: string, params?: Record<string, unknown>) => void;
148
149
  setUserAttributes: (attributes: SuperwallUserAttributes) => void;
149
150
  requestStoreReview: (reviewType: Outgoing<"request_store_review">["review_type"]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superwall/runtime",
3
- "version": "2.1.1",
3
+ "version": "2.2.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.1.1"
42
+ "@superwall/protocol": "2.2.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@superwall/host": "workspace:*",
@@ -331,6 +331,7 @@ const createSession = (options: SuperwallSessionOptions): SuperwallSession => {
331
331
  openUrl: (url, urlOptions = {}) => post(outgoing.openUrl(url, urlOptions.browserType)),
332
332
  openExternalUrl: (url) => post(outgoing.openExternalUrl(url)),
333
333
  openDeepLink: (link) => post(outgoing.openDeepLink(link)),
334
+ customAction: (name) => post(outgoing.custom(name)),
334
335
  customPlacement: (name, params = {}) => post(outgoing.customPlacement(name, params)),
335
336
  setUserAttributes: (attributes) => {
336
337
  const entries = Object.entries(attributes).map(([key, value]) => ({
@@ -35,6 +35,8 @@ export const openDeepLink = (link: string): Outgoing<"open_deep_link"> => ({
35
35
  link,
36
36
  });
37
37
 
38
+ export const custom = (name: string): Outgoing<"custom"> => ({ event_name: "custom", data: name });
39
+
38
40
  export const customPlacement = (
39
41
  name: string,
40
42
  params: Record<string, unknown>,
@@ -191,6 +191,7 @@ export interface SuperwallSession<out TProduct extends SuperwallProduct = Superw
191
191
  openUrl: (url: string, options?: { browserType?: "payment_sheet" }) => void;
192
192
  openExternalUrl: (url: string) => void;
193
193
  openDeepLink: (link: string) => void;
194
+ customAction: (name: string) => void;
194
195
  customPlacement: (name: string, params?: Record<string, unknown>) => void;
195
196
  setUserAttributes: (attributes: SuperwallUserAttributes) => void;
196
197
  requestStoreReview: (reviewType: Outgoing<"request_store_review">["review_type"]) => void;