@chrryai/chrry 1.5.13 → 1.5.15

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.
package/dist/index.js CHANGED
@@ -1902,7 +1902,7 @@ var init_utils = __esm({
1902
1902
  };
1903
1903
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
1904
1904
  config = getSiteConfig(getClientHostname());
1905
- VERSION = config.version || "1.5.13";
1905
+ VERSION = config.version || "1.5.15";
1906
1906
  getSlugFromPathname = (path) => {
1907
1907
  return getAppAndStoreSlugs(path, {
1908
1908
  defaultAppSlug: config.slug,
@@ -23536,6 +23536,7 @@ function AuthProvider({
23536
23536
  );
23537
23537
  return matchedApp?.slug;
23538
23538
  };
23539
+ const lasProcessedSession = (0, import_react19.useRef)(void 0);
23539
23540
  const findAppByPathname = (path, apps2) => {
23540
23541
  const slugFromPath = getSlugFromPathname2(path);
23541
23542
  if (!slugFromPath) return void 0;
@@ -24044,6 +24045,7 @@ function AuthProvider({
24044
24045
  setMemoriesEnabled,
24045
24046
  gift,
24046
24047
  wasGifted,
24048
+ lasProcessedSession,
24047
24049
  setWasGifted,
24048
24050
  showCharacterProfiles,
24049
24051
  setShowCharacterProfiles,
@@ -24211,7 +24213,7 @@ function DataProvider({ children, ...rest }) {
24211
24213
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24212
24214
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24213
24215
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24214
- const VERSION4 = "1.5.13";
24216
+ const VERSION4 = "1.5.15";
24215
24217
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24216
24218
  const {
24217
24219
  API_URL: API_URL2,
@@ -43390,9 +43392,11 @@ function Subscribe({
43390
43392
  cleaned = cleaned.trim();
43391
43393
  return cleaned;
43392
43394
  };
43393
- const [giftedFingerPrint, setGiftedFingerPrint] = (0, import_react67.useState)(
43394
- null
43395
- );
43395
+ const [checkoutFingerPrint, setCheckoutFingerPrintInternal] = (0, import_react67.useState)();
43396
+ const setCheckoutFingerPrint = (fp) => {
43397
+ if (!isE2E) return;
43398
+ setCheckoutFingerPrintInternal(fp);
43399
+ };
43396
43400
  const handlePlanChange = async (newPlan) => {
43397
43401
  setLoading(true);
43398
43402
  try {
@@ -43441,7 +43445,8 @@ function Subscribe({
43441
43445
  session_id: cleanSessionId(sessionId),
43442
43446
  userId,
43443
43447
  guestId,
43444
- email
43448
+ email,
43449
+ checkoutFingerPrint
43445
43450
  }),
43446
43451
  headers: {
43447
43452
  "Content-Type": "application/json",
@@ -43451,15 +43456,11 @@ function Subscribe({
43451
43456
  const data = await response.json();
43452
43457
  if (data.success) {
43453
43458
  track({ name: "subscribe_payment_verified" });
43454
- if (isExtensionRedirect2) {
43455
- import_react_hot_toast13.default.success(t5(`${t5("Subscribed")}. ${t5("Reload your extension")} \u{1F9E9}`));
43456
- } else {
43457
- setPurchaseType(data.gift ? "gift" : "subscription");
43458
- import_react_hot_toast13.default.success(
43459
- data.gift ? t5(`\u{1F970} ${t5("Thank you for your gift")}`) : data.credits ? t5(`${t5("Credits updated")}`) : t5(`${t5("Subscribed")}`)
43460
- );
43461
- setGiftedFingerPrint(data.fingerprint);
43462
- }
43459
+ setPurchaseType(data.gift ? "gift" : "subscription");
43460
+ import_react_hot_toast13.default.success(
43461
+ data.gift ? t5(`\u{1F970} ${t5("Thank you for your gift")}`) : data.credits ? t5(`${t5("Credits updated")}`) : t5(`${t5("Subscribed")}`)
43462
+ );
43463
+ setCheckoutFingerPrint((0, import_uuid5.v4)());
43463
43464
  await fetchSession();
43464
43465
  setTimeout(() => setIsModalOpen(false), 100);
43465
43466
  } else {
@@ -43518,7 +43519,11 @@ function Subscribe({
43518
43519
  };
43519
43520
  const is = useHasHydrated();
43520
43521
  (0, import_react67.useEffect)(() => {
43521
- if (!is) return;
43522
+ if (checkoutFingerPrint) return;
43523
+ setCheckoutFingerPrint((0, import_uuid5.v4)());
43524
+ }, [checkoutFingerPrint]);
43525
+ (0, import_react67.useEffect)(() => {
43526
+ if (!checkoutFingerPrint) return;
43522
43527
  if (typeof window === "undefined" || !window.location) return;
43523
43528
  const params = new URLSearchParams(window.location.search);
43524
43529
  if (params.get("checkout") === "success") {
@@ -43530,7 +43535,7 @@ function Subscribe({
43530
43535
  verifyPayment(sessionId);
43531
43536
  }, 100);
43532
43537
  }
43533
- }, [is]);
43538
+ }, [checkoutFingerPrint]);
43534
43539
  const [selectedPlan, setSelectedPlanInternal] = (0, import_react67.useState)(
43535
43540
  searchParams.get("plan") ?? "plus"
43536
43541
  );
@@ -44055,11 +44060,11 @@ function Subscribe({
44055
44060
  ),
44056
44061
  t5(subs.plan === "pro" ? "Pro" : "Plus")
44057
44062
  );
44058
- })()) : /* @__PURE__ */ import_react67.default.createElement(
44063
+ })()) : is && /* @__PURE__ */ import_react67.default.createElement(
44059
44064
  Button,
44060
44065
  {
44061
44066
  className: "transparent",
44062
- "data-gifted-fingerprint": giftedFingerPrint,
44067
+ "data-gifted-fingerprint": checkoutFingerPrint,
44063
44068
  "data-testid": `subscribe-button`,
44064
44069
  id: "subscribeButton",
44065
44070
  onClick: () => {
@@ -44092,7 +44097,7 @@ function Subscribe({
44092
44097
  }
44093
44098
  ));
44094
44099
  }
44095
- var import_react67, import_clsx8, import_react_hot_toast13;
44100
+ var import_react67, import_uuid5, import_clsx8, import_react_hot_toast13;
44096
44101
  var init_Subscribe = __esm({
44097
44102
  "Subscribe.tsx"() {
44098
44103
  "use strict";
@@ -44101,6 +44106,7 @@ var init_Subscribe = __esm({
44101
44106
  init_MotiView();
44102
44107
  init_providers();
44103
44108
  init_platform();
44109
+ import_uuid5 = require("uuid");
44104
44110
  import_clsx8 = __toESM(require("clsx"));
44105
44111
  init_icons();
44106
44112
  import_react_hot_toast13 = __toESM(require("react-hot-toast"));