@revenuecat/purchases-ui-js 4.14.1 → 4.15.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.
@@ -89,6 +89,12 @@
89
89
  componentName: props.name,
90
90
  componentValue: "screen_redirect",
91
91
  };
92
+ case "cookie_settings":
93
+ return {
94
+ componentType: "button",
95
+ componentName: props.name,
96
+ componentValue: "navigate_to_cookie_settings",
97
+ };
92
98
  case "privacy_policy":
93
99
  case "terms":
94
100
  case "url": {
@@ -106,6 +106,7 @@
106
106
  /** Called when a `close_workflow` button is pressed to dismiss the paywall/workflow. */
107
107
  onClose?: () => void;
108
108
  onVisitCustomerCenterClicked?: () => void;
109
+ onCookieSettingsClicked?: () => void;
109
110
  onRestorePurchasesClicked?: () => void;
110
111
  onNavigateToUrlClicked?: (url: string) => void;
111
112
  /**
@@ -180,6 +181,7 @@
180
181
  onBackClicked,
181
182
  onClose,
182
183
  onVisitCustomerCenterClicked,
184
+ onCookieSettingsClicked,
183
185
  onRestorePurchasesClicked,
184
186
  onNavigateToUrlClicked,
185
187
  onCompleteWorkflowNavigate,
@@ -322,6 +324,9 @@
322
324
  case "screen_redirect":
323
325
  onActionTriggered?.("screen_redirect");
324
326
  return;
327
+ case "cookie_settings":
328
+ onCookieSettingsClicked?.();
329
+ return;
325
330
  case "privacy_policy":
326
331
  case "terms":
327
332
  case "url":
@@ -478,6 +483,9 @@
478
483
  let headerHeight = $state(0);
479
484
  let footerHeight = $state(0);
480
485
 
486
+ // A horizontal root's direction is row, so the spacer would incorrectly sit beside the content
487
+ const spacerFitsRoot = stack.dimension.type !== "horizontal";
488
+
481
489
  const contentColumnStyle = $derived(
482
490
  maxContentWidth
483
491
  ? `max-width: ${maxContentWidth}; margin-inline: auto;`
@@ -501,6 +509,12 @@
501
509
  <div class="paywall-content" style={contentColumnStyle}>
502
510
  <Stack
503
511
  {...stack}
512
+ padding={sticky_footer && !spacerFitsRoot
513
+ ? {
514
+ ...stack.padding,
515
+ bottom: (stack.padding?.bottom ?? 0) + footerHeight,
516
+ }
517
+ : stack.padding}
504
518
  class="paywall-content-scroll"
505
519
  style={mapPaywallContentStackStyle(
506
520
  stack.size.height,
@@ -508,9 +522,9 @@
508
522
  headerHeight,
509
523
  )}
510
524
  >
511
- {#if sticky_footer}
512
- <!-- Adds a real flex item rather than bottom padding to clear
513
- a footer because iOS Safari ignores the padding if the content
525
+ {#if sticky_footer && spacerFitsRoot}
526
+ <!-- Adds a real flex item rather than bottom padding to clear
527
+ a footer because iOS Safari ignores the padding if the content
514
528
  still fits on screen leaving content stuck behind the footer. -->
515
529
  <div
516
530
  class="footer-scroll-spacer"
@@ -33,6 +33,7 @@ interface Props {
33
33
  /** Called when a `close_workflow` button is pressed to dismiss the paywall/workflow. */
34
34
  onClose?: () => void;
35
35
  onVisitCustomerCenterClicked?: () => void;
36
+ onCookieSettingsClicked?: () => void;
36
37
  onRestorePurchasesClicked?: () => void;
37
38
  onNavigateToUrlClicked?: (url: string) => void;
38
39
  /**
@@ -64,7 +64,8 @@ export function mapStackSize(size, parentDimension) {
64
64
  }
65
65
  export function mapDimension(dimension) {
66
66
  if (dimension.type === "zlayer") {
67
- return {};
67
+ // The default direction is row, so we need to set it to column to keep the flow vertical.
68
+ return { "flex-direction": "column" };
68
69
  }
69
70
  const direction = dimension.type === "vertical" ? "column" : "row";
70
71
  const justify = DISTRIBUTION_MAP[dimension.distribution] || "center";
@@ -61,6 +61,7 @@
61
61
  onNavigateToUrlClicked?: (url: string) => void;
62
62
  onRestorePurchasesClicked?: () => void;
63
63
  onVisitCustomerCenterClicked?: () => void;
64
+ onCookieSettingsClicked?: () => void;
64
65
  walletButtonRender?: WalletButtonRender;
65
66
  prepareWalletPurchase?: WalletPurchasePrepare;
66
67
  onWalletPurchaseClicked?: WalletPurchaseStart;
@@ -99,6 +100,7 @@
99
100
  onNavigateToUrlClicked,
100
101
  onRestorePurchasesClicked,
101
102
  onVisitCustomerCenterClicked,
103
+ onCookieSettingsClicked,
102
104
  walletButtonRender,
103
105
  prepareWalletPurchase,
104
106
  onWalletPurchaseClicked,
@@ -141,6 +143,7 @@
141
143
  }}
142
144
  {onCompleteWorkflowNavigate}
143
145
  onVisitCustomerCenterClicked={() => onVisitCustomerCenterClicked?.()}
146
+ onCookieSettingsClicked={() => onCookieSettingsClicked?.()}
144
147
  {onBackClicked}
145
148
  {onClose}
146
149
  onRestorePurchasesClicked={() => onRestorePurchasesClicked?.()}
@@ -35,6 +35,7 @@ interface Props {
35
35
  onNavigateToUrlClicked?: (url: string) => void;
36
36
  onRestorePurchasesClicked?: () => void;
37
37
  onVisitCustomerCenterClicked?: () => void;
38
+ onCookieSettingsClicked?: () => void;
38
39
  walletButtonRender?: WalletButtonRender;
39
40
  prepareWalletPurchase?: WalletPurchasePrepare;
40
41
  onWalletPurchaseClicked?: WalletPurchaseStart;
@@ -88,6 +88,7 @@
88
88
  onNavigateToUrlClicked?: (url: string) => void;
89
89
  onRestorePurchasesClicked?: () => void;
90
90
  onVisitCustomerCenterClicked?: () => void;
91
+ onCookieSettingsClicked?: () => void;
91
92
  onComponentInteraction?: OnComponentInteraction;
92
93
  onClose?: () => void;
93
94
  onExitBack?: () => void;
@@ -132,6 +133,7 @@
132
133
  onNavigateToUrlClicked,
133
134
  onRestorePurchasesClicked,
134
135
  onVisitCustomerCenterClicked,
136
+ onCookieSettingsClicked,
135
137
  onComponentInteraction,
136
138
  onClose,
137
139
  onExitBack,
@@ -401,6 +403,7 @@
401
403
  {onNavigateToUrlClicked}
402
404
  {onRestorePurchasesClicked}
403
405
  {onVisitCustomerCenterClicked}
406
+ {onCookieSettingsClicked}
404
407
  {onComponentInteraction}
405
408
  onBackClicked={handleBackClicked}
406
409
  onClose={() => {
@@ -42,6 +42,7 @@ interface Props {
42
42
  onNavigateToUrlClicked?: (url: string) => void;
43
43
  onRestorePurchasesClicked?: () => void;
44
44
  onVisitCustomerCenterClicked?: () => void;
45
+ onCookieSettingsClicked?: () => void;
45
46
  onComponentInteraction?: OnComponentInteraction;
46
47
  onClose?: () => void;
47
48
  onExitBack?: () => void;
@@ -17,7 +17,7 @@ interface CloseAction {
17
17
  }
18
18
  interface NavigateToAction {
19
19
  type: "navigate_to";
20
- destination: "customer_center" | "offer_code" | "screen_redirect";
20
+ destination: "customer_center" | "offer_code" | "screen_redirect" | "cookie_settings";
21
21
  }
22
22
  interface NavigateToSheetAction {
23
23
  type: "navigate_to";
@@ -16,7 +16,7 @@ interface PackageTransition {
16
16
  destinationPackageId: string;
17
17
  defaultPackageId?: string;
18
18
  }
19
- type ButtonInteractionValue = "workflow" | "navigate_to_url" | "navigate_back" | "close_workflow" | "restore_purchases" | "navigate_to_customer_center" | "screen_redirect" | "navigate_to_privacy_policy" | "navigate_to_terms" | "navigate_to_sheet" | "navigate_to_offer_code" | "navigate_to_web_paywall_link";
19
+ type ButtonInteractionValue = "workflow" | "navigate_to_url" | "navigate_back" | "close_workflow" | "restore_purchases" | "navigate_to_customer_center" | "navigate_to_cookie_settings" | "screen_redirect" | "navigate_to_privacy_policy" | "navigate_to_terms" | "navigate_to_sheet" | "navigate_to_offer_code" | "navigate_to_web_paywall_link";
20
20
  export type TabInteractionData = ComponentInteractionBase<"tab"> & IndexedTransition;
21
21
  export type SwitchInteractionData = ComponentInteractionBase<"switch", "on" | "off">;
22
22
  export type CarouselInteractionData = ComponentInteractionBase<"carousel"> & IndexedTransition;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@revenuecat/purchases-ui-js",
3
3
  "description": "Web components for Paywalls. Powered by RevenueCat",
4
4
  "private": false,
5
- "version": "4.14.1",
5
+ "version": "4.15.0",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },