@revenuecat/purchases-ui-js 4.7.5 → 4.7.6

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.
@@ -75,7 +75,7 @@ function applyAlpha(baseColor, alpha) {
75
75
  function toHex(val) {
76
76
  return val.toString(16).padStart(2, "0").toUpperCase();
77
77
  }
78
- const textColorsForBackground = (backgroundColor, primaryColor, defaultColors, luminanceThreshold = DEFAULT_LUMINANCE_THRESHOLD) => {
78
+ const textColorsForBackground = (backgroundColor, primaryColor, primaryTextColorOverride, defaultColors, luminanceThreshold = DEFAULT_LUMINANCE_THRESHOLD) => {
79
79
  const textColors = {
80
80
  "grey-text-dark": defaultColors["grey-text-dark"],
81
81
  "grey-text-light": defaultColors["grey-text-light"],
@@ -91,7 +91,10 @@ const textColorsForBackground = (backgroundColor, primaryColor, defaultColors, l
91
91
  }
92
92
  }
93
93
  // Find the text color for the primary color
94
- if (primaryColor?.startsWith("#")) {
94
+ if (primaryTextColorOverride) {
95
+ textColors["primary-text"] = primaryTextColorOverride;
96
+ }
97
+ else if (primaryColor?.startsWith("#")) {
95
98
  const rgb = hexToRGB(primaryColor);
96
99
  if (rgb !== null) {
97
100
  textColors["primary-text"] = isLightColor({ ...rgb, luminanceThreshold })
@@ -125,7 +128,7 @@ const toColors = (colorsMapping, defaultColors, brandingAppearance) => {
125
128
  ? {
126
129
  ...defaultColors,
127
130
  ...mappedColors,
128
- ...textColorsForBackground(mappedColors.background, mappedColors.primary, defaultColors),
131
+ ...textColorsForBackground(mappedColors.background, mappedColors.primary, brandingAppearance.color_buttons_primary_text, defaultColors),
129
132
  ...colorsForButtonStates(mappedColors.primary),
130
133
  }
131
134
  : { ...defaultColors }; //copy, do not reference.
@@ -5,6 +5,7 @@
5
5
  */
6
6
  export interface BrandingAppearance {
7
7
  color_buttons_primary: string;
8
+ color_buttons_primary_text?: string | null;
8
9
  color_accent: string;
9
10
  color_error: string;
10
11
  color_product_info_bg: string;
@@ -13,11 +13,11 @@ function At() {
13
13
  });
14
14
  return { promise: n, resolve: e, reject: t };
15
15
  }
16
- const S = 2, we = 4, Ze = 8, Ft = 1 << 24, ne = 16, Y = 32, he = 64, kn = 128, L = 512, w = 1024, T = 2048, V = 4096, U = 8192, C = 16384, be = 32768, ct = 1 << 25, pe = 65536, dt = 1 << 17, Tn = 1 << 18, Pe = 1 << 19, An = 1 << 20, se = 65536, $e = 1 << 21, Je = 1 << 22, J = 1 << 23, ce = Symbol("$state"), Fn = Symbol("legacy props"), On = Symbol(""), X = new class extends Error {
16
+ const S = 2, we = 4, Ze = 8, Ft = 1 << 24, ne = 16, Y = 32, he = 64, kn = 128, L = 512, w = 1024, T = 2048, V = 4096, U = 8192, C = 16384, be = 32768, ct = 1 << 25, pe = 65536, dt = 1 << 17, Tn = 1 << 18, Pe = 1 << 19, An = 1 << 20, se = 65536, $e = 1 << 21, Je = 1 << 22, J = 1 << 23, ce = Symbol("$state"), Fn = Symbol("legacy props"), In = Symbol(""), X = new class extends Error {
17
17
  name = "StaleReactionError";
18
18
  message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
19
19
  }();
20
- function In() {
20
+ function On() {
21
21
  throw new Error("https://svelte.dev/e/async_derived_orphan");
22
22
  }
23
23
  function Ln() {
@@ -35,7 +35,7 @@ function Rn() {
35
35
  function Nn() {
36
36
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
37
37
  }
38
- function Ot(e) {
38
+ function It(e) {
39
39
  return e === this.v;
40
40
  }
41
41
  function Pn(e, t) {
@@ -128,16 +128,16 @@ function y(e, t) {
128
128
  function Qe(e) {
129
129
  (e.f & L) !== 0 || e.deps === null ? y(e, w) : y(e, V);
130
130
  }
131
- function It(e) {
131
+ function Ot(e) {
132
132
  if (e !== null)
133
133
  for (const t of e)
134
- (t.f & S) === 0 || (t.f & se) === 0 || (t.f ^= se, It(
134
+ (t.f & S) === 0 || (t.f & se) === 0 || (t.f ^= se, Ot(
135
135
  /** @type {Derived} */
136
136
  t.deps
137
137
  ));
138
138
  }
139
139
  function Wn(e, t, n) {
140
- (e.f & T) !== 0 ? t.add(e) : (e.f & V) !== 0 && n.add(e), It(e.deps), y(e, w);
140
+ (e.f & T) !== 0 ? t.add(e) : (e.f & V) !== 0 && n.add(e), Ot(e.deps), y(e, w);
141
141
  }
142
142
  let Ae = !1;
143
143
  function Xn(e) {
@@ -149,7 +149,7 @@ function Xn(e) {
149
149
  }
150
150
  }
151
151
  const G = /* @__PURE__ */ new Set();
152
- let b = null, N = null, Ue = null, ze = !1, fe = null, Oe = null;
152
+ let b = null, N = null, Ue = null, ze = !1, fe = null, Ie = null;
153
153
  var pt = 0;
154
154
  let Yn = 1;
155
155
  class _e {
@@ -270,7 +270,7 @@ class _e {
270
270
  }
271
271
  const t = this.#t;
272
272
  this.#t = [], this.apply();
273
- var n = fe = [], r = [], i = Oe = [];
273
+ var n = fe = [], r = [], i = Ie = [];
274
274
  for (const l of t)
275
275
  try {
276
276
  this.#h(l, n, r);
@@ -282,7 +282,7 @@ class _e {
282
282
  for (const l of i)
283
283
  s.schedule(l);
284
284
  }
285
- if (fe = null, Oe = null, this.#c() || this.#_()) {
285
+ if (fe = null, Ie = null, this.#c() || this.#_()) {
286
286
  this.#p(r), this.#p(n);
287
287
  for (const [l, o] of this.#s)
288
288
  Dt(l, o);
@@ -358,7 +358,7 @@ class _e {
358
358
  try {
359
359
  ze = !0, b = this, this.#d();
360
360
  } finally {
361
- pt = 0, Ue = null, fe = null, Oe = null, ze = !1, b = null, N = null, Q.clear();
361
+ pt = 0, Ue = null, fe = null, Ie = null, ze = !1, b = null, N = null, Q.clear();
362
362
  }
363
363
  }
364
364
  discard() {
@@ -643,7 +643,7 @@ function Be(e) {
643
643
  ctx: B,
644
644
  deps: null,
645
645
  effects: null,
646
- equals: Ot,
646
+ equals: It,
647
647
  f: t,
648
648
  fn: e,
649
649
  reactions: null,
@@ -663,7 +663,7 @@ function Zn(e, t, n) {
663
663
  /** @type {Effect | null} */
664
664
  v
665
665
  );
666
- r === null && In();
666
+ r === null && On();
667
667
  var i = (
668
668
  /** @type {Promise<V>} */
669
669
  /** @type {unknown} */
@@ -803,7 +803,7 @@ function jt(e, t) {
803
803
  // TODO ideally we could skip this altogether, but it causes type errors
804
804
  v: e,
805
805
  reactions: null,
806
- equals: Ot,
806
+ equals: It,
807
807
  rv: 0,
808
808
  wv: 0
809
809
  };
@@ -819,7 +819,7 @@ function Z(e, t, n = !1) {
819
819
  // to ensure we error if state is set inside an inspect effect
820
820
  (!P || (p.f & dt) !== 0) && xe() && (p.f & (S | ne | Je | dt)) !== 0 && (M === null || !de.call(M, e)) && Nn();
821
821
  let r = n ? ue(t) : t;
822
- return We(e, r, Oe);
822
+ return We(e, r, Ie);
823
823
  }
824
824
  function We(e, t, n = null) {
825
825
  if (!e.equals(t)) {
@@ -833,7 +833,7 @@ function We(e, t, n = null) {
833
833
  );
834
834
  (e.f & T) !== 0 && tt(s), N === null && Qe(s);
835
835
  }
836
- e.wv = Jt(), Ht(e, T, n), xe() && v !== null && (v.f & w) !== 0 && (v.f & (Y | he)) === 0 && (O === null ? gr([e]) : O.push(e)), !i.is_fork && Ve.size > 0 && !zt && tr();
836
+ e.wv = Jt(), Ht(e, T, n), xe() && v !== null && (v.f & w) !== 0 && (v.f & (Y | he)) === 0 && (I === null ? gr([e]) : I.push(e)), !i.is_fork && Ve.size > 0 && !zt && tr();
837
837
  }
838
838
  return t;
839
839
  }
@@ -1217,7 +1217,7 @@ function vr(e, t) {
1217
1217
  t.append(n), n = i;
1218
1218
  }
1219
1219
  }
1220
- let Ie = !1, le = !1;
1220
+ let Oe = !1, le = !1;
1221
1221
  function gt(e) {
1222
1222
  le = e;
1223
1223
  }
@@ -1233,9 +1233,9 @@ let M = null;
1233
1233
  function Kt(e) {
1234
1234
  p !== null && (M === null ? M = [e] : M.push(e));
1235
1235
  }
1236
- let A = null, F = 0, O = null;
1236
+ let A = null, F = 0, I = null;
1237
1237
  function gr(e) {
1238
- O = e;
1238
+ I = e;
1239
1239
  }
1240
1240
  let Zt = 1, re = 0, ie = re;
1241
1241
  function bt(e) {
@@ -1286,9 +1286,9 @@ function Qt(e, t, n = !0) {
1286
1286
  }
1287
1287
  }
1288
1288
  function en(e) {
1289
- var t = A, n = F, r = O, i = p, s = M, a = B, l = P, o = ie, f = e.f;
1289
+ var t = A, n = F, r = I, i = p, s = M, a = B, l = P, o = ie, f = e.f;
1290
1290
  A = /** @type {null | Value[]} */
1291
- null, F = 0, O = null, p = (f & (Y | he)) === 0 ? e : null, M = null, Le(e.ctx), P = !1, ie = ++re, e.ac !== null && (Ut(() => {
1291
+ null, F = 0, I = null, p = (f & (Y | he)) === 0 ? e : null, M = null, Le(e.ctx), P = !1, ie = ++re, e.ac !== null && (Ut(() => {
1292
1292
  e.ac.abort(X);
1293
1293
  }), e.ac = null);
1294
1294
  try {
@@ -1310,11 +1310,11 @@ function en(e) {
1310
1310
  for (h = F; h < c.length; h++)
1311
1311
  (c[h].reactions ??= []).push(e);
1312
1312
  } else !_ && c !== null && F < c.length && (Se(e, F), c.length = F);
1313
- if (xe() && O !== null && !P && c !== null && (e.f & (S | V | T)) === 0)
1313
+ if (xe() && I !== null && !P && c !== null && (e.f & (S | V | T)) === 0)
1314
1314
  for (h = 0; h < /** @type {Source[]} */
1315
- O.length; h++)
1315
+ I.length; h++)
1316
1316
  Qt(
1317
- O[h],
1317
+ I[h],
1318
1318
  /** @type {Effect} */
1319
1319
  e
1320
1320
  );
@@ -1325,14 +1325,14 @@ function en(e) {
1325
1325
  if (t !== null)
1326
1326
  for (const g of t)
1327
1327
  g.rv = re;
1328
- O !== null && (r === null ? r = O : r.push(.../** @type {Source[]} */
1329
- O));
1328
+ I !== null && (r === null ? r = I : r.push(.../** @type {Source[]} */
1329
+ I));
1330
1330
  }
1331
1331
  return (e.f & J) !== 0 && (e.f ^= J), d;
1332
1332
  } catch (g) {
1333
1333
  return Un(g);
1334
1334
  } finally {
1335
- e.f ^= $e, A = t, F = n, O = r, p = i, M = s, Le(a), P = l, ie = o;
1335
+ e.f ^= $e, A = t, F = n, I = r, p = i, M = s, Le(a), P = l, ie = o;
1336
1336
  }
1337
1337
  }
1338
1338
  function br(e, t) {
@@ -1365,8 +1365,8 @@ function ge(e) {
1365
1365
  var t = e.f;
1366
1366
  if ((t & C) === 0) {
1367
1367
  y(e, w);
1368
- var n = v, r = Ie;
1369
- v = e, Ie = !0;
1368
+ var n = v, r = Oe;
1369
+ v = e, Oe = !0;
1370
1370
  try {
1371
1371
  (t & (ne | Ft)) !== 0 ? dr(e) : st(e), Xt(e);
1372
1372
  var i = en(e);
@@ -1374,7 +1374,7 @@ function ge(e) {
1374
1374
  var s;
1375
1375
  mn && Bn && (e.f & T) !== 0 && e.deps;
1376
1376
  } finally {
1377
- Ie = r, v = n;
1377
+ Oe = r, v = n;
1378
1378
  }
1379
1379
  }
1380
1380
  }
@@ -1404,7 +1404,7 @@ function k(e) {
1404
1404
  var l = a.v;
1405
1405
  return ((a.f & w) === 0 && a.reactions !== null || nn(a)) && (l = tt(a)), Q.set(a, l), l;
1406
1406
  }
1407
- var o = (a.f & L) === 0 && !P && p !== null && (Ie || (p.f & L) !== 0), f = (a.f & be) === 0;
1407
+ var o = (a.f & L) === 0 && !P && p !== null && (Oe || (p.f & L) !== 0), f = (a.f & be) === 0;
1408
1408
  ke(a) && (o && (a.f |= L), Ct(a)), o && !f && (Bt(a), tn(a));
1409
1409
  }
1410
1410
  if (N?.has(e))
@@ -1672,17 +1672,17 @@ function Fr(e, t, n = !1) {
1672
1672
  }), a || s(-1, null);
1673
1673
  }, i);
1674
1674
  }
1675
- function Or(e, t, n) {
1675
+ function Ir(e, t, n) {
1676
1676
  var r = e == null ? "" : "" + e;
1677
1677
  return t && (r = r ? r + " " + t : t), r === "" ? null : r;
1678
1678
  }
1679
- function Ir(e, t) {
1679
+ function Or(e, t) {
1680
1680
  return e == null ? null : String(e);
1681
1681
  }
1682
1682
  function an(e, t, n, r, i, s) {
1683
1683
  var a = e.__className;
1684
1684
  if (a !== n || a === void 0) {
1685
- var l = Or(n, r);
1685
+ var l = Ir(n, r);
1686
1686
  l == null ? e.removeAttribute("class") : e.className = l, e.__className = n;
1687
1687
  }
1688
1688
  return s;
@@ -1690,7 +1690,7 @@ function an(e, t, n, r, i, s) {
1690
1690
  function on(e, t, n, r) {
1691
1691
  var i = e.__style;
1692
1692
  if (i !== t) {
1693
- var s = Ir(t);
1693
+ var s = Or(t);
1694
1694
  s == null ? e.removeAttribute("style") : e.style.cssText = s, e.__style = t;
1695
1695
  }
1696
1696
  return r;
@@ -1698,7 +1698,7 @@ function on(e, t, n, r) {
1698
1698
  const Lr = Symbol("is custom element"), Mr = Symbol("is html");
1699
1699
  function yt(e, t, n, r) {
1700
1700
  var i = Dr(e);
1701
- i[t] !== (i[t] = n) && (t === "loading" && (e[On] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && Rr(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
1701
+ i[t] !== (i[t] = n) && (t === "loading" && (e[In] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && Rr(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
1702
1702
  }
1703
1703
  function Dr(e) {
1704
1704
  return (
@@ -1838,7 +1838,7 @@ const Cr = {
1838
1838
  regular: "400",
1839
1839
  medium: "500",
1840
1840
  semibold: "600"
1841
- }, I = {
1841
+ }, O = {
1842
1842
  12: "12px",
1843
1843
  14: "14px",
1844
1844
  16: "16px",
@@ -1856,13 +1856,13 @@ const Cr = {
1856
1856
  regular: "0"
1857
1857
  }, m = {
1858
1858
  heading2xl: {
1859
- fontSize: I[28],
1859
+ fontSize: O[28],
1860
1860
  lineHeight: j[120],
1861
1861
  fontWeight: z.semibold,
1862
1862
  letterSpacing: H.tight
1863
1863
  },
1864
1864
  headingXl: {
1865
- fontSize: I[24],
1865
+ fontSize: O[24],
1866
1866
  lineHeight: j[130],
1867
1867
  fontWeight: z.semibold,
1868
1868
  letterSpacing: H.regular
@@ -1880,37 +1880,37 @@ const Cr = {
1880
1880
  letterSpacing: H.regular
1881
1881
  },
1882
1882
  bodyBase: {
1883
- fontSize: I[16],
1883
+ fontSize: O[16],
1884
1884
  lineHeight: j[140],
1885
1885
  fontWeight: z.regular,
1886
1886
  letterSpacing: H.regular
1887
1887
  },
1888
1888
  bodySmall: {
1889
- fontSize: I[14],
1889
+ fontSize: O[14],
1890
1890
  lineHeight: j[140],
1891
1891
  fontWeight: z.regular,
1892
1892
  letterSpacing: H.regular
1893
1893
  },
1894
1894
  labelButton: {
1895
- fontSize: I[16],
1895
+ fontSize: O[16],
1896
1896
  lineHeight: j[140],
1897
1897
  fontWeight: z.regular,
1898
1898
  letterSpacing: H.tight
1899
1899
  },
1900
1900
  labelDefault: {
1901
- fontSize: I[14],
1901
+ fontSize: O[14],
1902
1902
  lineHeight: j[140],
1903
1903
  fontWeight: z.regular,
1904
1904
  letterSpacing: H.tight
1905
1905
  },
1906
1906
  captionDefault: {
1907
- fontSize: I[12],
1907
+ fontSize: O[12],
1908
1908
  lineHeight: j[140],
1909
1909
  fontWeight: z.regular,
1910
1910
  letterSpacing: H.regular
1911
1911
  },
1912
1912
  captionLink: {
1913
- fontSize: I[12],
1913
+ fontSize: O[12],
1914
1914
  lineHeight: j[140],
1915
1915
  fontWeight: z.regular,
1916
1916
  letterSpacing: H.regular
@@ -1918,19 +1918,19 @@ const Cr = {
1918
1918
  }, $ = {
1919
1919
  heading2xl: {
1920
1920
  ...m.heading2xl,
1921
- fontSize: I[36]
1921
+ fontSize: O[36]
1922
1922
  },
1923
1923
  headingXl: {
1924
1924
  ...m.headingXl,
1925
- fontSize: I[32]
1925
+ fontSize: O[32]
1926
1926
  },
1927
1927
  headingLg: {
1928
1928
  ...m.headingLg,
1929
- fontSize: I[24]
1929
+ fontSize: O[24]
1930
1930
  },
1931
1931
  headingMd: {
1932
1932
  ...m.headingMd,
1933
- fontSize: I[18]
1933
+ fontSize: O[18]
1934
1934
  },
1935
1935
  bodyBase: {
1936
1936
  ...m.bodyBase
@@ -2087,23 +2087,25 @@ function xt(e, t) {
2087
2087
  function He(e) {
2088
2088
  return e.toString(16).padStart(2, "0").toUpperCase();
2089
2089
  }
2090
- const Yr = (e, t, n, r = ot) => {
2091
- const i = {
2092
- "grey-text-dark": n["grey-text-dark"],
2093
- "grey-text-light": n["grey-text-light"],
2094
- "grey-ui-dark": n["grey-ui-dark"],
2095
- "grey-ui-light": n["grey-ui-light"],
2096
- "primary-text": n["primary-text"]
2090
+ const Yr = (e, t, n, r, i = ot) => {
2091
+ const s = {
2092
+ "grey-text-dark": r["grey-text-dark"],
2093
+ "grey-text-light": r["grey-text-light"],
2094
+ "grey-ui-dark": r["grey-ui-dark"],
2095
+ "grey-ui-light": r["grey-ui-light"],
2096
+ "primary-text": r["primary-text"]
2097
2097
  };
2098
2098
  if (e?.startsWith("#")) {
2099
- const s = Ee(e);
2100
- s !== null && Object.assign(i, Wr(s));
2099
+ const a = Ee(e);
2100
+ a !== null && Object.assign(s, Wr(a));
2101
2101
  }
2102
- if (t?.startsWith("#")) {
2103
- const s = Ee(t);
2104
- s !== null && (i["primary-text"] = at({ ...s, luminanceThreshold: r }) ? "black" : "white");
2102
+ if (n)
2103
+ s["primary-text"] = n;
2104
+ else if (t?.startsWith("#")) {
2105
+ const a = Ee(t);
2106
+ a !== null && (s["primary-text"] = at({ ...a, luminanceThreshold: i }) ? "black" : "white");
2105
2107
  }
2106
- return i;
2108
+ return s;
2107
2109
  }, qr = (e) => ({
2108
2110
  "primary-hover": xt(e, 0.1),
2109
2111
  "primary-pressed": xt(e, 0.15)
@@ -2128,6 +2130,7 @@ const Yr = (e, t, n, r = ot) => {
2128
2130
  ...Yr(
2129
2131
  r.background,
2130
2132
  r.primary,
2133
+ n.color_buttons_primary_text,
2131
2134
  t
2132
2135
  ),
2133
2136
  ...qr(r.primary)
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.7.5",
5
+ "version": "4.7.6",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },