@revenuecat/purchases-ui-js 2.0.1 → 2.0.2

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 (53) hide show
  1. package/dist/components/button/ButtonNode.stories.svelte +0 -6
  2. package/dist/components/button/ButtonNode.svelte +3 -6
  3. package/dist/components/footer/Footer.stories.svelte +0 -4
  4. package/dist/components/footer/Footer.svelte +3 -3
  5. package/dist/components/image/Image.stories.svelte +2 -13
  6. package/dist/components/image/Image.svelte +1 -2
  7. package/dist/components/package/Package.stories.svelte +2 -6
  8. package/dist/components/package/Package.svelte +4 -11
  9. package/dist/components/paywall/Node.svelte +23 -20
  10. package/dist/components/paywall/Node.svelte.d.ts +9 -8
  11. package/dist/components/paywall/Paywall.svelte +16 -14
  12. package/dist/components/purchase-button/PurchaseButton.stories.svelte +0 -8
  13. package/dist/components/purchase-button/PurchaseButton.svelte +3 -10
  14. package/dist/components/stack/Stack.stories.svelte +11 -43
  15. package/dist/components/stack/Stack.svelte +3 -23
  16. package/dist/components/stack/stack-utils.js +0 -2
  17. package/dist/components/text/TextNode.stories.svelte +0 -12
  18. package/dist/components/text/TextNode.svelte +2 -11
  19. package/dist/components/text/text-utils.d.ts +1 -1
  20. package/dist/components/timeline/Timeline.stories.svelte +0 -5
  21. package/dist/components/timeline/Timeline.svelte +0 -2
  22. package/dist/components/timeline/timeline-utils.js +0 -1
  23. package/dist/data/entities.d.ts +18 -48
  24. package/dist/index.d.ts +10 -10
  25. package/dist/index.js +10 -10
  26. package/dist/stores/localization.d.ts +1 -1
  27. package/dist/stores/localization.js +3 -2
  28. package/dist/stores/paywall.d.ts +5 -4
  29. package/dist/stores/variables.d.ts +1 -2
  30. package/dist/stories/fixtures.d.ts +1 -1
  31. package/dist/stories/fixtures.js +23 -59
  32. package/dist/stories/localization-decorator.js +1 -1
  33. package/dist/stories/paywall-decorator.js +2 -1
  34. package/dist/stories/with-layout.svelte +3 -3
  35. package/dist/types/component.d.ts +6 -0
  36. package/dist/types/components/button.d.ts +2 -2
  37. package/dist/types/components/footer.d.ts +2 -2
  38. package/dist/types/components/package.d.ts +2 -2
  39. package/dist/types/components/purchase-button.d.ts +2 -2
  40. package/dist/ui/atoms/typography.stories.svelte +2 -2
  41. package/dist/ui/atoms/typography.stories.svelte.d.ts +1 -1
  42. package/dist/ui/layout/main-block.svelte +2 -2
  43. package/dist/ui/molecules/button.stories.svelte +2 -2
  44. package/dist/ui/molecules/button.svelte +1 -1
  45. package/dist/ui/theme/theme.d.ts +2 -2
  46. package/dist/ui/theme/theme.js +2 -2
  47. package/dist/ui/theme/utils.d.ts +2 -2
  48. package/dist/utils/style-utils.js +13 -12
  49. package/dist/web-components/index.css +1 -1
  50. package/dist/web-components/index.js +144 -144
  51. package/package.json +1 -1
  52. package/dist/data/state.d.ts +0 -4
  53. /package/dist/{data/state.js → types/component.js} +0 -0
@@ -1,5 +1,5 @@
1
- import type { SharedComponentProps, StackProps } from "../../data/entities";
2
- export interface PurchaseButtonProps extends SharedComponentProps {
1
+ import type { BaseComponent, StackProps } from "../../data/entities";
2
+ export interface PurchaseButtonProps extends BaseComponent {
3
3
  type: "purchase_button";
4
4
  stack: StackProps;
5
5
  }
@@ -1,9 +1,9 @@
1
1
  <script module lang="ts">
2
+ import { withLayout } from "../../stories/with-layout";
3
+ import { default as Typography } from "./typography.svelte";
2
4
  import { defineMeta } from "@storybook/addon-svelte-csf";
3
5
  import { type ComponentProps } from "svelte";
4
6
  import { brandingViewportModes } from "../../../../.storybook/modes";
5
- import { withLayout } from "../../stories/with-layout";
6
- import { default as Typography } from "../../ui/atoms/typography.svelte";
7
7
 
8
8
  const { Story } = defineMeta({
9
9
  component: Typography,
@@ -1,4 +1,4 @@
1
- import { default as Typography } from "../../ui/atoms/typography.svelte";
1
+ import { default as Typography } from "./typography.svelte";
2
2
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
- import { Theme } from "../theme/theme";
3
2
  import { onMount } from "svelte";
4
- import SectionLayout from "./section-layout.svelte";
3
+ import { Theme } from "../theme/theme";
5
4
  import type { BrandingAppearance } from "../utils/branding";
5
+ import SectionLayout from "./section-layout.svelte";
6
6
 
7
7
  export let brandingAppearance: BrandingAppearance | null | undefined =
8
8
  undefined;
@@ -1,8 +1,8 @@
1
1
  <script module lang="ts">
2
- import { defineMeta, type StoryContext } from "@storybook/addon-svelte-csf";
3
- import type { ComponentProps } from "svelte";
4
2
  import { brandingAppearances } from "../../stories/fixtures";
5
3
  import { withLayout } from "../../stories/with-layout";
4
+ import { defineMeta, type StoryContext } from "@storybook/addon-svelte-csf";
5
+ import type { ComponentProps } from "svelte";
6
6
  import { default as Button } from "./button.svelte";
7
7
 
8
8
  const { Story } = defineMeta({
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import ProcessingAnimation from "../utils/processing-animation.svelte";
3
2
  import Typography from "../atoms/typography.svelte";
4
3
  import { Theme } from "../theme/theme";
4
+ import ProcessingAnimation from "../utils/processing-animation.svelte";
5
5
  import type { UIButtonProps } from "./types";
6
6
 
7
7
  const {
@@ -1,6 +1,6 @@
1
- import type { Shape } from "./shapes";
2
- import type { Colors } from "./colors";
3
1
  import type { BrandingAppearance } from "../utils/branding";
2
+ import type { Colors } from "./colors";
3
+ import type { Shape } from "./shapes";
4
4
  export declare class Theme {
5
5
  private readonly brandingAppearance;
6
6
  constructor(brandingAppearance?: BrandingAppearance | null | undefined);
@@ -1,6 +1,6 @@
1
- import { toFormColors, toFormStyleVar, toProductInfoStyleVar, toShape, toSpacingVars, toTextStyleVar, } from "./utils";
2
- import { DEFAULT_TEXT_STYLES } from "./text";
3
1
  import { DEFAULT_SPACING } from "./spacing";
2
+ import { DEFAULT_TEXT_STYLES } from "./text";
3
+ import { toFormColors, toFormStyleVar, toProductInfoStyleVar, toShape, toSpacingVars, toTextStyleVar, } from "./utils";
4
4
  export class Theme {
5
5
  brandingAppearance;
6
6
  constructor(brandingAppearance) {
@@ -1,8 +1,8 @@
1
+ import type { BrandingAppearance } from "../utils/branding";
1
2
  import { type Colors } from "./colors";
2
3
  import { type Shape } from "./shapes";
3
- import { type TextStyles } from "./text";
4
4
  import type { Spacing } from "./spacing";
5
- import type { BrandingAppearance } from "../utils/branding";
5
+ import { type TextStyles } from "./text";
6
6
  export declare const DEFAULT_LUMINANCE_THRESHOLD = 0.37;
7
7
  /**
8
8
  * Applies an alpha value to a color.
@@ -293,31 +293,32 @@ export function stringifyStyles(styles) {
293
293
  */
294
294
  export function findSelectedPackageId(paywallData) {
295
295
  const traverseNode = (node) => {
296
- if (node.type === "package" &&
297
- node.is_selected_by_default) {
296
+ if (node.type === "package" && node.is_selected_by_default) {
298
297
  return node;
299
298
  }
300
- if (node.components && Array.isArray(node.components)) {
301
- for (const c of node.components) {
302
- const pkg = traverseNode(c);
303
- if (pkg) {
299
+ if ("components" in node && Array.isArray(node.components)) {
300
+ for (const component of node.components) {
301
+ const pkg = traverseNode(component);
302
+ if (pkg !== undefined) {
304
303
  return pkg;
305
304
  }
306
305
  }
307
306
  }
308
- if (node.stack !== undefined) {
307
+ if ("stack" in node) {
309
308
  const pkg = traverseNode(node.stack);
310
- if (pkg) {
309
+ if (pkg !== undefined) {
311
310
  return pkg;
312
311
  }
313
312
  }
314
313
  return undefined;
315
314
  };
316
- const p = traverseNode(paywallData.components_config.base.stack);
317
- if (p === undefined) {
318
- return undefined;
315
+ for (const component of paywallData.components_config.base.stack.components) {
316
+ const pkg = traverseNode(component);
317
+ if (pkg !== undefined) {
318
+ return pkg?.package_id;
319
+ }
319
320
  }
320
- return p.package_id;
321
+ return undefined;
321
322
  }
322
323
  export const getActiveStateProps = (overrides, componentState) => {
323
324
  if (!componentState)
@@ -1 +1 @@
1
- .rcb-processing.svelte-2j2b59{width:var(--width, 12px);aspect-ratio:1;border-radius:50%;animation:svelte-2j2b59-l5 1.5s infinite linear}@keyframes svelte-2j2b59-l5{0%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}25%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff;background:#fff2}50%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff}75%{box-shadow:var(--shadow-offset) 0 #fff,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}to{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}}.rcb-typography-heading-2xl.svelte-byrjto{font:var(--rc-text-heading2xl-mobile)}.rcb-typography-heading-xl.svelte-byrjto{font:var(--rc-text-headingXl-mobile)}.rcb-typography-heading-lg.svelte-byrjto{font:var(--rc-text-headingLg-mobile)}.rcb-typography-heading-md.svelte-byrjto{font:var(--rc-text-headingMd-mobile)}.rcb-typography-body-base.svelte-byrjto{font:var(--rc-text-bodyBase-mobile)}.rcb-typography-body-small.svelte-byrjto{font:var(--rc-text-bodySmall-mobile)}.rcb-typography-label-button.svelte-byrjto{font:var(--rc-text-labelButton-mobile)}.rcb-typography-label-default.svelte-byrjto{font:var(--rc-text-labelDefault-mobile)}.rcb-typography-caption-default.svelte-byrjto{font:var(--rc-text-captionDefault-mobile)}.rcb-typography-caption-link.svelte-byrjto{font:var(--rc-text-captionLink-mobile)}@container layout-query-container (width >= 768px){.rcb-typography-heading-2xl.svelte-byrjto{font:var(--rc-text-heading2xl-desktop)}.rcb-typography-heading-xl.svelte-byrjto{font:var(--rc-text-headingXl-desktop)}.rcb-typography-heading-lg.svelte-byrjto{font:var(--rc-text-headingLg-desktop)}.rcb-typography-heading-md.svelte-byrjto{font:var(--rc-text-headingMd-desktop)}.rcb-typography-body-base.svelte-byrjto{font:var(--rc-text-bodyBase-desktop)}.rcb-typography-body-small.svelte-byrjto{font:var(--rc-text-bodySmall-desktop)}.rcb-typography-label-button.svelte-byrjto{font:var(--rc-text-labelButton-desktop)}.rcb-typography-label-default.svelte-byrjto{font:var(--rc-text-labelDefault-desktop)}.rcb-typography-caption-default.svelte-byrjto{font:var(--rc-text-captionDefault-desktop)}.rcb-typography-caption-link.svelte-byrjto{font:var(--rc-text-captionLink-desktop)}}button.svelte-td7xvm{border:none;border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;height:var(--rc-spacing-inputHeight-mobile);color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;transition:background-color .15s ease-in-out;-webkit-user-select:none;user-select:none}@container layout-query-container (width >= 768px){button.svelte-td7xvm{height:var(--rc-spacing-inputHeight-desktop)}}button.svelte-td7xvm:focus-visible{outline:2px solid var(--rc-color-focus)}button.intent-primary.svelte-td7xvm{background-color:var(--rc-color-primary);color:var(--rc-color-primary-text)}button.svelte-td7xvm:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);outline:none}button.intent-primary.svelte-td7xvm:not(:disabled):hover{background-color:var(--rc-color-primary-hover)}button.intent-primary.svelte-td7xvm:not(:disabled):active,button.svelte-td7xvm:active{background-color:var(--rc-color-primary-pressed);outline:none}button.intent-primary.svelte-td7xvm:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}
1
+ .rcb-typography-heading-2xl.svelte-byrjto{font:var(--rc-text-heading2xl-mobile)}.rcb-typography-heading-xl.svelte-byrjto{font:var(--rc-text-headingXl-mobile)}.rcb-typography-heading-lg.svelte-byrjto{font:var(--rc-text-headingLg-mobile)}.rcb-typography-heading-md.svelte-byrjto{font:var(--rc-text-headingMd-mobile)}.rcb-typography-body-base.svelte-byrjto{font:var(--rc-text-bodyBase-mobile)}.rcb-typography-body-small.svelte-byrjto{font:var(--rc-text-bodySmall-mobile)}.rcb-typography-label-button.svelte-byrjto{font:var(--rc-text-labelButton-mobile)}.rcb-typography-label-default.svelte-byrjto{font:var(--rc-text-labelDefault-mobile)}.rcb-typography-caption-default.svelte-byrjto{font:var(--rc-text-captionDefault-mobile)}.rcb-typography-caption-link.svelte-byrjto{font:var(--rc-text-captionLink-mobile)}@container layout-query-container (width >= 768px){.rcb-typography-heading-2xl.svelte-byrjto{font:var(--rc-text-heading2xl-desktop)}.rcb-typography-heading-xl.svelte-byrjto{font:var(--rc-text-headingXl-desktop)}.rcb-typography-heading-lg.svelte-byrjto{font:var(--rc-text-headingLg-desktop)}.rcb-typography-heading-md.svelte-byrjto{font:var(--rc-text-headingMd-desktop)}.rcb-typography-body-base.svelte-byrjto{font:var(--rc-text-bodyBase-desktop)}.rcb-typography-body-small.svelte-byrjto{font:var(--rc-text-bodySmall-desktop)}.rcb-typography-label-button.svelte-byrjto{font:var(--rc-text-labelButton-desktop)}.rcb-typography-label-default.svelte-byrjto{font:var(--rc-text-labelDefault-desktop)}.rcb-typography-caption-default.svelte-byrjto{font:var(--rc-text-captionDefault-desktop)}.rcb-typography-caption-link.svelte-byrjto{font:var(--rc-text-captionLink-desktop)}}.rcb-processing.svelte-2j2b59{width:var(--width, 12px);aspect-ratio:1;border-radius:50%;animation:svelte-2j2b59-l5 1.5s infinite linear}@keyframes svelte-2j2b59-l5{0%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}25%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff;background:#fff2}50%{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff}75%{box-shadow:var(--shadow-offset) 0 #fff,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}to{box-shadow:var(--shadow-offset) 0 #fff2,calc(-1 * var(--shadow-offset)) 0 #fff2;background:#fff2}}button.svelte-td7xvm{border:none;border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;height:var(--rc-spacing-inputHeight-mobile);color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;transition:background-color .15s ease-in-out;-webkit-user-select:none;user-select:none}@container layout-query-container (width >= 768px){button.svelte-td7xvm{height:var(--rc-spacing-inputHeight-desktop)}}button.svelte-td7xvm:focus-visible{outline:2px solid var(--rc-color-focus)}button.intent-primary.svelte-td7xvm{background-color:var(--rc-color-primary);color:var(--rc-color-primary-text)}button.svelte-td7xvm:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);outline:none}button.intent-primary.svelte-td7xvm:not(:disabled):hover{background-color:var(--rc-color-primary-hover)}button.intent-primary.svelte-td7xvm:not(:disabled):active,button.svelte-td7xvm:active{background-color:var(--rc-color-primary-pressed);outline:none}button.intent-primary.svelte-td7xvm:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}
@@ -961,80 +961,55 @@ function et(t, e, n, r) {
961
961
  return p(Q);
962
962
  };
963
963
  }
964
- en();
965
- var Rn = /* @__PURE__ */ Ct('<div class="rcb-processing svelte-2j2b59"></div>');
964
+ var Rn = /* @__PURE__ */ Ct("<span><!></span>");
966
965
  function Bn(t, e) {
967
- let n = et(e, "size", 8, "medium");
968
- const r = {
969
- small: { width: "8px", offset: "10px" },
970
- medium: { width: "12px", offset: "20px" },
971
- large: { width: "16px", offset: "30px" }
972
- };
973
- var i = Rn();
974
- Pt(() => ft(i, "style", `--shadow-offset: ${r[n()].offset ?? ""}; --width: ${r[n()].width ?? ""};`)), dt(t, i);
975
- }
976
- var Pn = /* @__PURE__ */ Ct("<span><!></span>");
977
- function Mn(t, e) {
978
966
  xe(e, !0);
979
967
  const n = et(e, "size", 3, "body-base");
980
- var r = Pn(), i = oe(r);
968
+ var r = Rn(), i = oe(r);
981
969
  Te(i, () => e.children ?? Ot), Pt(() => ke(r, `rcb-typography rcb-typography-${n() ?? ""} svelte-byrjto`)), dt(t, r), we();
982
970
  }
983
- const zn = {
984
- error: "#B0171F",
985
- warning: "#f4e971",
986
- focus: "#1148B8",
987
- accent: "#767676",
988
- primary: "#576CDB",
989
- "primary-hover": "rgba(87, 108, 219, .8)",
990
- "primary-pressed": "rgba(87, 108, 219, .9)",
991
- "primary-text": "#ffffff",
992
- white: "#ffffff",
993
- "grey-text-dark": "rgba(0,0,0,1)",
994
- "grey-text-light": "rgba(0,0,0,0.7)",
995
- "grey-ui-dark": "rgba(0,0,0,0.3)",
996
- "grey-ui-light": "rgba(0,0,0,0.1)",
997
- "input-background": "white",
998
- background: "white"
999
- }, Cn = {
1000
- error: "#B0171F",
1001
- warning: "#f4e971",
1002
- focus: "#1148B8",
1003
- accent: "#767676",
1004
- primary: "#576CDB",
1005
- "primary-hover": "rgba(87, 108, 219, .8)",
1006
- "primary-pressed": "rgba(87, 108, 219, .9)",
1007
- "primary-text": "#ffffff",
1008
- white: "#ffffff",
1009
- "grey-text-dark": "rgba(0,0,0,1)",
1010
- "grey-text-light": "rgba(0,0,0,0.7)",
1011
- "grey-ui-dark": "rgba(0,0,0,0.3)",
1012
- "grey-ui-light": "rgba(0,0,0,0.1)",
1013
- "input-background": "white",
1014
- background: "#EFF3FA"
1015
- }, Fe = {
1016
- error: "color_error",
1017
- focus: "color_accent",
1018
- accent: "color_accent",
1019
- primary: "color_buttons_primary"
1020
- }, jn = {
1021
- ...Fe,
1022
- "input-background": "color_form_bg",
1023
- background: "color_form_bg"
1024
- }, $n = {
1025
- ...Fe,
1026
- "input-background": "color_product_info_bg",
1027
- background: "color_product_info_bg"
1028
- }, Ie = {
1029
- "input-border-radius": "4px",
1030
- "input-button-border-radius": "8px"
1031
- }, Hn = {
1032
- "input-border-radius": "0px",
1033
- "input-button-border-radius": "0px"
1034
- }, Vn = {
1035
- "input-border-radius": "12px",
1036
- "input-button-border-radius": "9999px"
1037
- }, Qt = Ie, te = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif", I = {
971
+ const Pn = {
972
+ outerPadding: {
973
+ mobile: "clamp(1.3125rem, 5.6vw, 1.5rem)",
974
+ desktop: "clamp(1.5rem, 9.44vw, 5rem)"
975
+ },
976
+ outerPaddingSmall: {
977
+ mobile: "clamp(0.75rem, 4.2vw, 1rem)",
978
+ desktop: "clamp(1.5rem, 9.44vw, 5rem)"
979
+ },
980
+ gapSmall: {
981
+ mobile: "0.25rem",
982
+ desktop: "0.375rem"
983
+ },
984
+ gapMedium: {
985
+ mobile: "0.5rem",
986
+ desktop: "0.75rem"
987
+ },
988
+ gapLarge: {
989
+ mobile: "0.75rem",
990
+ desktop: "0.75rem"
991
+ },
992
+ gapXLarge: {
993
+ mobile: "1rem",
994
+ desktop: "1.5rem"
995
+ },
996
+ gapXXLarge: {
997
+ mobile: "1.25rem",
998
+ desktop: "2.25rem"
999
+ },
1000
+ gapXXXLarge: {
1001
+ mobile: "2.25rem",
1002
+ desktop: "4.5rem"
1003
+ },
1004
+ inputHeight: {
1005
+ mobile: "3rem",
1006
+ desktop: "3rem"
1007
+ },
1008
+ gapStripeElement: {
1009
+ mobile: "0.70rem",
1010
+ desktop: "1rem"
1011
+ }
1012
+ }, Qt = "-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif", I = {
1038
1013
  regular: "400",
1039
1014
  medium: "500",
1040
1015
  semibold: "600"
@@ -1150,7 +1125,7 @@ const zn = {
1150
1125
  captionLink: {
1151
1126
  ...d.captionLink
1152
1127
  }
1153
- }, Un = {
1128
+ }, Mn = {
1154
1129
  heading2xl: {
1155
1130
  mobile: d.heading2xl,
1156
1131
  desktop: L.heading2xl
@@ -1191,7 +1166,61 @@ const zn = {
1191
1166
  desktop: L.captionLink,
1192
1167
  mobile: d.captionLink
1193
1168
  }
1194
- }, rt = (t) => t.length == 7 ? {
1169
+ }, zn = {
1170
+ error: "#B0171F",
1171
+ warning: "#f4e971",
1172
+ focus: "#1148B8",
1173
+ accent: "#767676",
1174
+ primary: "#576CDB",
1175
+ "primary-hover": "rgba(87, 108, 219, .8)",
1176
+ "primary-pressed": "rgba(87, 108, 219, .9)",
1177
+ "primary-text": "#ffffff",
1178
+ white: "#ffffff",
1179
+ "grey-text-dark": "rgba(0,0,0,1)",
1180
+ "grey-text-light": "rgba(0,0,0,0.7)",
1181
+ "grey-ui-dark": "rgba(0,0,0,0.3)",
1182
+ "grey-ui-light": "rgba(0,0,0,0.1)",
1183
+ "input-background": "white",
1184
+ background: "white"
1185
+ }, Cn = {
1186
+ error: "#B0171F",
1187
+ warning: "#f4e971",
1188
+ focus: "#1148B8",
1189
+ accent: "#767676",
1190
+ primary: "#576CDB",
1191
+ "primary-hover": "rgba(87, 108, 219, .8)",
1192
+ "primary-pressed": "rgba(87, 108, 219, .9)",
1193
+ "primary-text": "#ffffff",
1194
+ white: "#ffffff",
1195
+ "grey-text-dark": "rgba(0,0,0,1)",
1196
+ "grey-text-light": "rgba(0,0,0,0.7)",
1197
+ "grey-ui-dark": "rgba(0,0,0,0.3)",
1198
+ "grey-ui-light": "rgba(0,0,0,0.1)",
1199
+ "input-background": "white",
1200
+ background: "#EFF3FA"
1201
+ }, Fe = {
1202
+ error: "color_error",
1203
+ focus: "color_accent",
1204
+ accent: "color_accent",
1205
+ primary: "color_buttons_primary"
1206
+ }, jn = {
1207
+ ...Fe,
1208
+ "input-background": "color_form_bg",
1209
+ background: "color_form_bg"
1210
+ }, $n = {
1211
+ ...Fe,
1212
+ "input-background": "color_product_info_bg",
1213
+ background: "color_product_info_bg"
1214
+ }, Ie = {
1215
+ "input-border-radius": "4px",
1216
+ "input-button-border-radius": "8px"
1217
+ }, Hn = {
1218
+ "input-border-radius": "0px",
1219
+ "input-button-border-radius": "0px"
1220
+ }, Vn = {
1221
+ "input-border-radius": "12px",
1222
+ "input-button-border-radius": "9999px"
1223
+ }, te = Ie, rt = (t) => t.length == 7 ? {
1195
1224
  r: parseInt(t.slice(1, 3), 16),
1196
1225
  g: parseInt(t.slice(3, 5), 16),
1197
1226
  b: parseInt(t.slice(5, 7), 16)
@@ -1207,7 +1236,7 @@ const zn = {
1207
1236
  }) => {
1208
1237
  const i = (a) => (a = a / 255, a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4));
1209
1238
  return 0.2126 * i(t) + 0.7152 * i(e) + 0.0722 * i(n) > r;
1210
- }, $t = 0.37, qn = (t, e = $t) => {
1239
+ }, $t = 0.37, Un = (t, e = $t) => {
1211
1240
  const n = jt({ ...t, luminanceThreshold: e }) ? "0,0,0" : "255,255,255";
1212
1241
  return {
1213
1242
  "grey-text-dark": `rgb(${n})`,
@@ -1216,7 +1245,7 @@ const zn = {
1216
1245
  "grey-ui-light": `rgba(${n},0.1)`
1217
1246
  };
1218
1247
  };
1219
- function Wn(t, e, n) {
1248
+ function qn(t, e, n) {
1220
1249
  const r = rt(t) || { r: 0, g: 0, b: 0 }, i = rt(e) || { r: 255, g: 255, b: 255 }, l = Math.round(i.r * n + r.r * (1 - n)), a = Math.round(i.g * n + r.g * (1 - n)), _ = Math.round(i.b * n + r.b * (1 - n));
1221
1250
  return `#${Tt(l)}${Tt(a)}${Tt(_)}`;
1222
1251
  }
@@ -1228,12 +1257,12 @@ function ee(t, e) {
1228
1257
  ...l,
1229
1258
  luminanceThreshold: $t
1230
1259
  }) ? "#000000" : "#FFFFFF";
1231
- return Wn(i, _, r);
1260
+ return qn(i, _, r);
1232
1261
  }
1233
1262
  function Tt(t) {
1234
1263
  return t.toString(16).padStart(2, "0").toUpperCase();
1235
1264
  }
1236
- const Xn = (t, e, n, r = $t) => {
1265
+ const Wn = (t, e, n, r = $t) => {
1237
1266
  const i = {
1238
1267
  "grey-text-dark": n["grey-text-dark"],
1239
1268
  "grey-text-light": n["grey-text-light"],
@@ -1243,27 +1272,27 @@ const Xn = (t, e, n, r = $t) => {
1243
1272
  };
1244
1273
  if (t != null && t.startsWith("#")) {
1245
1274
  const l = rt(t);
1246
- l !== null && Object.assign(i, qn(l));
1275
+ l !== null && Object.assign(i, Un(l));
1247
1276
  }
1248
1277
  if (e != null && e.startsWith("#")) {
1249
1278
  const l = rt(e);
1250
1279
  l !== null && (i["primary-text"] = jt({ ...l, luminanceThreshold: r }) ? "black" : "white");
1251
1280
  }
1252
1281
  return i;
1253
- }, Yn = (t) => ({
1282
+ }, Xn = (t) => ({
1254
1283
  "primary-hover": ee(t, 0.1),
1255
1284
  "primary-pressed": ee(t, 0.15)
1256
- }), Gn = (t, e) => t || e, Kn = (t, e, n) => {
1285
+ }), Yn = (t, e) => t || e, Gn = (t, e, n) => {
1257
1286
  const r = Object.entries(t).map(([i, l]) => [
1258
1287
  i,
1259
- Gn(
1288
+ Yn(
1260
1289
  n ? n[l] : null,
1261
1290
  e[i]
1262
1291
  )
1263
1292
  ]);
1264
1293
  return Object.fromEntries(r);
1265
1294
  }, Oe = (t, e, n) => {
1266
- const r = Kn(
1295
+ const r = Gn(
1267
1296
  t,
1268
1297
  e,
1269
1298
  n
@@ -1271,14 +1300,14 @@ const Xn = (t, e, n, r = $t) => {
1271
1300
  return n ? {
1272
1301
  ...e,
1273
1302
  ...r,
1274
- ...Xn(
1303
+ ...Wn(
1275
1304
  r.background,
1276
1305
  r.primary,
1277
1306
  e
1278
1307
  ),
1279
- ...Yn(r.primary)
1308
+ ...Xn(r.primary)
1280
1309
  } : { ...e };
1281
- }, Zn = (t) => Oe(
1310
+ }, Kn = (t) => Oe(
1282
1311
  $n,
1283
1312
  Cn,
1284
1313
  t
@@ -1288,7 +1317,7 @@ const Xn = (t, e, n, r = $t) => {
1288
1317
  t
1289
1318
  ), Ht = (t) => {
1290
1319
  if (!t)
1291
- return Qt;
1320
+ return te;
1292
1321
  switch (t.shapes) {
1293
1322
  case "rounded":
1294
1323
  return Ie;
@@ -1297,18 +1326,18 @@ const Xn = (t, e, n, r = $t) => {
1297
1326
  case "pill":
1298
1327
  return Vn;
1299
1328
  default:
1300
- return Qt;
1329
+ return te;
1301
1330
  }
1302
- }, ht = (t = "", e) => e.map(([n, r]) => `--rc-${t}-${n}: ${r}`).join("; "), Jn = (t) => {
1331
+ }, ht = (t = "", e) => e.map(([n, r]) => `--rc-${t}-${n}: ${r}`).join("; "), Zn = (t) => {
1303
1332
  const e = ht(
1304
1333
  "color",
1305
- Object.entries(Zn(t))
1334
+ Object.entries(Kn(t))
1306
1335
  ), n = ht(
1307
1336
  "shape",
1308
1337
  Object.entries(Ht(t))
1309
1338
  );
1310
1339
  return [e, n].join("; ");
1311
- }, Qn = (t) => {
1340
+ }, Jn = (t) => {
1312
1341
  const e = ht(
1313
1342
  "color",
1314
1343
  Object.entries(De(t))
@@ -1317,56 +1346,15 @@ const Xn = (t, e, n, r = $t) => {
1317
1346
  Object.entries(Ht(t))
1318
1347
  );
1319
1348
  return [e, n].join("; ");
1320
- }, tr = (t = "", e) => Object.entries(e).flatMap(([n, { desktop: r, mobile: i }]) => [
1321
- `--rc-${t}-${n}-desktop: normal normal ${r.fontWeight} ${r.fontSize}/${r.lineHeight} ${te}`,
1322
- `--rc-${t}-${n}-mobile: normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${te}`,
1349
+ }, Qn = (t = "", e) => Object.entries(e).flatMap(([n, { desktop: r, mobile: i }]) => [
1350
+ `--rc-${t}-${n}-desktop: normal normal ${r.fontWeight} ${r.fontSize}/${r.lineHeight} ${Qt}`,
1351
+ `--rc-${t}-${n}-mobile: normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${Qt}`,
1323
1352
  `--rc-${t}-${n}-desktop-font-size: ${r.fontSize}`,
1324
1353
  `--rc-${t}-${n}-mobile-font-size: ${i.fontSize}`
1325
- ]).join("; "), er = (t = "", e) => Object.entries(e).map(
1354
+ ]).join("; "), tr = (t = "", e) => Object.entries(e).map(
1326
1355
  ([n, { mobile: r, desktop: i }]) => `--rc-${t}-${n}-mobile: ${r}; --rc-${t}-${n}-desktop: ${i};`
1327
- ).join(" "), nr = {
1328
- outerPadding: {
1329
- mobile: "clamp(1.3125rem, 5.6vw, 1.5rem)",
1330
- desktop: "clamp(1.5rem, 9.44vw, 5rem)"
1331
- },
1332
- outerPaddingSmall: {
1333
- mobile: "clamp(0.75rem, 4.2vw, 1rem)",
1334
- desktop: "clamp(1.5rem, 9.44vw, 5rem)"
1335
- },
1336
- gapSmall: {
1337
- mobile: "0.25rem",
1338
- desktop: "0.375rem"
1339
- },
1340
- gapMedium: {
1341
- mobile: "0.5rem",
1342
- desktop: "0.75rem"
1343
- },
1344
- gapLarge: {
1345
- mobile: "0.75rem",
1346
- desktop: "0.75rem"
1347
- },
1348
- gapXLarge: {
1349
- mobile: "1rem",
1350
- desktop: "1.5rem"
1351
- },
1352
- gapXXLarge: {
1353
- mobile: "1.25rem",
1354
- desktop: "2.25rem"
1355
- },
1356
- gapXXXLarge: {
1357
- mobile: "2.25rem",
1358
- desktop: "4.5rem"
1359
- },
1360
- inputHeight: {
1361
- mobile: "3rem",
1362
- desktop: "3rem"
1363
- },
1364
- gapStripeElement: {
1365
- mobile: "0.70rem",
1366
- desktop: "1rem"
1367
- }
1368
- };
1369
- class rr {
1356
+ ).join(" ");
1357
+ class er {
1370
1358
  constructor(e) {
1371
1359
  qt(this, "brandingAppearance");
1372
1360
  e ? this.brandingAppearance = e : this.brandingAppearance = void 0;
@@ -1378,28 +1366,40 @@ class rr {
1378
1366
  return De(this.brandingAppearance);
1379
1367
  }
1380
1368
  get formStyleVars() {
1381
- return Qn(this.brandingAppearance);
1369
+ return Jn(this.brandingAppearance);
1382
1370
  }
1383
1371
  get productInfoStyleVars() {
1384
- return Jn(this.brandingAppearance);
1372
+ return Zn(this.brandingAppearance);
1385
1373
  }
1386
1374
  get spacing() {
1387
- return nr;
1375
+ return Pn;
1388
1376
  }
1389
1377
  get textStyles() {
1390
- return Un;
1378
+ return Mn;
1391
1379
  }
1392
1380
  get textStyleVars() {
1393
- return tr("text", this.textStyles);
1381
+ return Qn("text", this.textStyles);
1394
1382
  }
1395
1383
  get spacingStyleVars() {
1396
- return er("spacing", this.spacing);
1384
+ return tr("spacing", this.spacing);
1397
1385
  }
1398
1386
  }
1387
+ en();
1388
+ var nr = /* @__PURE__ */ Ct('<div class="rcb-processing svelte-2j2b59"></div>');
1389
+ function rr(t, e) {
1390
+ let n = et(e, "size", 8, "medium");
1391
+ const r = {
1392
+ small: { width: "8px", offset: "10px" },
1393
+ medium: { width: "12px", offset: "20px" },
1394
+ large: { width: "16px", offset: "30px" }
1395
+ };
1396
+ var i = nr();
1397
+ Pt(() => ft(i, "style", `--shadow-offset: ${r[n()].offset ?? ""}; --width: ${r[n()].width ?? ""};`)), dt(t, i);
1398
+ }
1399
1399
  var ir = /* @__PURE__ */ Ct("<button><!></button>");
1400
1400
  function ar(t, e) {
1401
1401
  xe(e, !0);
1402
- const n = et(e, "intent", 3, "primary"), r = et(e, "disabled", 3, !1), i = et(e, "loading", 3, !1), l = /* @__PURE__ */ P(() => new rr(e.brandingAppearance)), a = /* @__PURE__ */ P(() => p(l).textStyleVars), _ = /* @__PURE__ */ P(() => p(l).spacingStyleVars), f = /* @__PURE__ */ P(() => p(l).productInfoStyleVars), s = /* @__PURE__ */ P(() => p(l).formStyleVars), u = /* @__PURE__ */ P(() => [
1402
+ const n = et(e, "intent", 3, "primary"), r = et(e, "disabled", 3, !1), i = et(e, "loading", 3, !1), l = /* @__PURE__ */ P(() => new er(e.brandingAppearance)), a = /* @__PURE__ */ P(() => p(l).textStyleVars), _ = /* @__PURE__ */ P(() => p(l).spacingStyleVars), f = /* @__PURE__ */ P(() => p(l).productInfoStyleVars), s = /* @__PURE__ */ P(() => p(l).formStyleVars), u = /* @__PURE__ */ P(() => [
1403
1403
  e.styleOverrides,
1404
1404
  p(a),
1405
1405
  p(_),
@@ -1414,9 +1414,9 @@ function ar(t, e) {
1414
1414
  var c = oe(o);
1415
1415
  {
1416
1416
  var g = (m) => {
1417
- Bn(m, { size: "small" });
1417
+ rr(m, { size: "small" });
1418
1418
  }, w = (m) => {
1419
- Mn(m, {
1419
+ Bn(m, {
1420
1420
  size: "body-base",
1421
1421
  children: (y, U) => {
1422
1422
  var z = On(), C = un(z);
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": "2.0.1",
5
+ "version": "2.0.2",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },
@@ -1,4 +0,0 @@
1
- import type { VariableDictionary } from "../utils/variable-utils";
2
- export interface PurchaseState {
3
- variablesPerPackage?: Record<string, VariableDictionary>;
4
- }
File without changes