@chrryai/chrry 1.2.94 → 1.2.96

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.d.mts CHANGED
@@ -780,7 +780,7 @@ declare const isFirefox: boolean;
780
780
  declare function getFlag({ code }: {
781
781
  code?: string;
782
782
  }): string;
783
- declare const VERSION = "1.2.94";
783
+ declare const VERSION = "1.2.96";
784
784
  type instructionBase = {
785
785
  id: string;
786
786
  title: string;
package/dist/index.d.ts CHANGED
@@ -780,7 +780,7 @@ declare const isFirefox: boolean;
780
780
  declare function getFlag({ code }: {
781
781
  code?: string;
782
782
  }): string;
783
- declare const VERSION = "1.2.94";
783
+ declare const VERSION = "1.2.96";
784
784
  type instructionBase = {
785
785
  id: string;
786
786
  title: string;
package/dist/index.js CHANGED
@@ -21282,7 +21282,7 @@ function DataProvider({
21282
21282
  const [instructions, setInstructions] = (0, import_react14.useState)([]);
21283
21283
  const [affiliateStats, setAffiliateStats] = (0, import_react14.useState)(null);
21284
21284
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react14.useState)(false);
21285
- const VERSION3 = "1.2.94";
21285
+ const VERSION3 = "1.2.96";
21286
21286
  const [weather, setWeather] = useLocalStorage("weather", user?.weather || guest?.weather || void 0);
21287
21287
  const {
21288
21288
  API_URL: API_URL2,
@@ -22367,7 +22367,7 @@ var init_utils = __esm({
22367
22367
  window.history.replaceState({}, "", newUrl);
22368
22368
  };
22369
22369
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent.includes("Firefox");
22370
- VERSION = "1.2.94";
22370
+ VERSION = "1.2.96";
22371
22371
  getSlugFromPathname = (path) => {
22372
22372
  const siteConfig = getSiteConfig();
22373
22373
  return getAppAndStoreSlugs(path, {
@@ -23143,20 +23143,18 @@ function AppProvider({
23143
23143
  highlights: formDraft?.highlights || appForm?.watch("highlights"),
23144
23144
  title: formDraft?.title || appForm?.watch("title")
23145
23145
  };
23146
- const [instructions, setInstructions] = (0, import_react21.useState)(
23147
- user?.instructions || guest?.instructions || app?.highlights || []
23148
- );
23149
23146
  const owningApps = apps.filter(
23150
23147
  (app2) => isOwner_default(app2, {
23151
23148
  userId: user?.id,
23152
23149
  guestId: guest?.id
23153
23150
  })
23154
23151
  );
23155
- (0, import_react21.useEffect)(() => {
23156
- const i = user?.instructions || guest?.instructions || [];
23157
- i.length && setInstructions(i);
23158
- }, [user, guest]);
23159
- const siteConfig = getSiteConfig();
23152
+ const contextInstructions = (0, import_react21.useMemo)(
23153
+ () => app ? (user?.instructions || guest?.instructions || []).filter(
23154
+ (i2) => i2.appId === app?.id
23155
+ ) : [],
23156
+ [app?.id, user?.instructions, guest?.instructions]
23157
+ );
23160
23158
  const appFormWatcher = {
23161
23159
  ...watcher,
23162
23160
  image: appForm.watch("image"),
@@ -23172,6 +23170,26 @@ function AppProvider({
23172
23170
  isDefaultValues: watcher.name === t6("MyAgent") && watcher.title === t6("Your personal AI agent") && !watcher.description && (!watcher.highlights || watcher.highlights.length === 0),
23173
23171
  canSubmit: !!(watcher.name && watcher.title) && Object.keys(appForm?.formState.errors).length === 0
23174
23172
  };
23173
+ const i = (0, import_react21.useMemo)(
23174
+ () => contextInstructions.length > 0 ? contextInstructions : app?.highlights?.length ? app.highlights : isManagingApp && appFormWatcher?.highlights?.length ? appFormWatcher.highlights : getExampleInstructions({
23175
+ slug: app?.slug || void 0
23176
+ }),
23177
+ [
23178
+ contextInstructions,
23179
+ app?.id,
23180
+ // IMPORTANT: Track app changes
23181
+ app?.highlights,
23182
+ isManagingApp,
23183
+ JSON.stringify(watcher.highlights),
23184
+ // Stringify for deep comparison
23185
+ app?.slug
23186
+ ]
23187
+ );
23188
+ const [instructions, setInstructions] = (0, import_react21.useState)(i);
23189
+ (0, import_react21.useEffect)(() => {
23190
+ setInstructions(i);
23191
+ }, [i]);
23192
+ const siteConfig = getSiteConfig();
23175
23193
  const suggestSaveApp = !!(appFormWatcher.systemPrompt && appFormWatcher.canSubmit);
23176
23194
  const canEditApp = isAppOwner && !!appFormWatcher?.id && (step === "update" || step === "restore");
23177
23195
  const setAppStatus = (payload) => {
@@ -23311,7 +23329,8 @@ function AppProvider({
23311
23329
  owningApps,
23312
23330
  stores,
23313
23331
  store,
23314
- baseApp
23332
+ baseApp,
23333
+ setInstructions
23315
23334
  }
23316
23335
  },
23317
23336
  children
@@ -23336,6 +23355,7 @@ var init_AppProvider = __esm({
23336
23355
  import_zod3 = require("@hookform/resolvers/zod");
23337
23356
  init_isOwner();
23338
23357
  init_AuthProvider();
23358
+ init_utils();
23339
23359
  import_react_i18next3 = require("react-i18next");
23340
23360
  init_DataProvider();
23341
23361
  init_siteConfig();
@@ -29155,7 +29175,6 @@ function Instructions({
29155
29175
  collaborationStep,
29156
29176
  setCollaborationStep,
29157
29177
  isMemoryConsentManageVisible,
29158
- isMobileDevice,
29159
29178
  setShowAddToHomeScreen,
29160
29179
  showAddToHomeScreen,
29161
29180
  pathname
@@ -29166,6 +29185,8 @@ function Instructions({
29166
29185
  app,
29167
29186
  appFormWatcher,
29168
29187
  canEditApp,
29188
+ instructions,
29189
+ setInstructions,
29169
29190
  appStatus,
29170
29191
  appForm
29171
29192
  } = useApp();
@@ -29187,7 +29208,7 @@ function Instructions({
29187
29208
  (0, import_react45.useEffect)(() => {
29188
29209
  setVisibleInstructionCount(getVisibleInstructionCount());
29189
29210
  }, [viewPortHeight]);
29190
- const { addHapticFeedback, reduceMotion } = useTheme2();
29211
+ const { addHapticFeedback, isDark, isMobileDevice } = useTheme2();
29191
29212
  const isManaging = isManagingApp;
29192
29213
  const [placeHolder, setPlaceHolder] = (0, import_react45.useState)(
29193
29214
  rest.placeholder
@@ -29196,7 +29217,6 @@ function Instructions({
29196
29217
  (0, import_react45.useEffect)(() => {
29197
29218
  setPlaceHolder(rest.placeholder);
29198
29219
  }, [rest.placeholder]);
29199
- const { resolvedTheme } = (0, import_next_themes.useTheme)();
29200
29220
  const city = user?.city || guest?.city;
29201
29221
  const country = user?.country || guest?.country;
29202
29222
  const productionExtensions = ["chrome", "firefox"];
@@ -29311,24 +29331,6 @@ function Instructions({
29311
29331
  };
29312
29332
  input.click();
29313
29333
  };
29314
- const i = (0, import_react45.useMemo)(
29315
- () => contextInstructions.length > 0 ? contextInstructions : app?.highlights?.length ? app.highlights : isManaging && appFormWatcher?.highlights?.length ? appFormWatcher.highlights : getExampleInstructions({
29316
- slug: app?.slug || void 0
29317
- }),
29318
- [
29319
- contextInstructions,
29320
- app?.highlights,
29321
- app?.id,
29322
- app?.slug,
29323
- isManaging,
29324
- appFormWatcher?.highlights,
29325
- app?.name
29326
- ]
29327
- );
29328
- const [instructions, setInstructions] = (0, import_react45.useState)(i);
29329
- (0, import_react45.useEffect)(() => {
29330
- setInstructions(i);
29331
- }, [i]);
29332
29334
  const [showEmojiPicker, setShowEmojiPicker] = (0, import_react45.useState)(false);
29333
29335
  const [selectedEmoji, setSelectedEmoji] = (0, import_react45.useState)("\u{1F338}");
29334
29336
  const [editedTitle, setEditedTitle] = (0, import_react45.useState)("");
@@ -29338,7 +29340,7 @@ function Instructions({
29338
29340
  if (selectedInstruction && isManaging) {
29339
29341
  setInstructions(
29340
29342
  (prev) => prev.map(
29341
- (i2) => i2.id === selectedInstruction.id ? { ...i2, emoji: emojiData.emoji } : i2
29343
+ (i) => i.id === selectedInstruction.id ? { ...i, emoji: emojiData.emoji } : i
29342
29344
  )
29343
29345
  );
29344
29346
  }
@@ -29443,7 +29445,11 @@ function Instructions({
29443
29445
  appForm?.setValue("highlights", updatedHighlights);
29444
29446
  setInstructions(
29445
29447
  (prev) => prev.map(
29446
- (i2) => i2.id === instruction.id ? { ...i2, title: instruction.title, emoji: instruction.emoji } : i2
29448
+ (i) => i.id === instruction.id ? {
29449
+ ...i,
29450
+ title: instruction.title,
29451
+ emoji: instruction.emoji
29452
+ } : i
29447
29453
  )
29448
29454
  );
29449
29455
  import_react_hot_toast7.default.success(t6("Deleted"));
@@ -29473,7 +29479,7 @@ function Instructions({
29473
29479
  }
29474
29480
  setInstructions(
29475
29481
  (prev) => prev.map(
29476
- (i2) => i2.id === instruction.id ? { ...i2, title: editedTitle || i2.title, emoji: selectedEmoji } : i2
29482
+ (i) => i.id === instruction.id ? { ...i, title: editedTitle || i.title, emoji: selectedEmoji } : i
29477
29483
  )
29478
29484
  );
29479
29485
  import_react_hot_toast7.default.success(t6(existingIndex !== -1 ? "Updated" : "Added"));
@@ -29495,7 +29501,7 @@ function Instructions({
29495
29501
  appForm?.setValue("highlights", updatedHighlights);
29496
29502
  setInstructions(
29497
29503
  (prev) => prev.map(
29498
- (i2) => i2.id === instruction.id ? { ...i2, title: editedTitle || i2.title, emoji: selectedEmoji } : i2
29504
+ (i) => i.id === instruction.id ? { ...i, title: editedTitle || i.title, emoji: selectedEmoji } : i
29499
29505
  )
29500
29506
  );
29501
29507
  import_react_hot_toast7.default.success(t6("Updated"));
@@ -29518,12 +29524,12 @@ function Instructions({
29518
29524
  appForm?.setValue("highlights", updatedHighlights);
29519
29525
  setInstructions(
29520
29526
  (prev) => prev.map(
29521
- (i2) => i2.id === instruction.id ? {
29522
- ...i2,
29523
- title: editedTitle || i2.title,
29527
+ (i) => i.id === instruction.id ? {
29528
+ ...i,
29529
+ title: editedTitle || i.title,
29524
29530
  emoji: selectedEmoji,
29525
29531
  content
29526
- } : i2
29532
+ } : i
29527
29533
  )
29528
29534
  );
29529
29535
  import_react_hot_toast7.default.success(t6("Updated"));
@@ -29639,7 +29645,7 @@ function Instructions({
29639
29645
  }, [isOpen, isArtifactsOpen]);
29640
29646
  const removeFile = (index) => {
29641
29647
  addHapticFeedback();
29642
- setFilesInternal((prev) => prev.filter((_, i2) => i2 !== index));
29648
+ setFilesInternal((prev) => prev.filter((_, i) => i !== index));
29643
29649
  };
29644
29650
  const [deletingId, setDeletingId] = (0, import_react45.useState)(null);
29645
29651
  const handleDeleteFile = async (id) => {
@@ -29940,7 +29946,7 @@ ${t6(`The more specific you are, the better AI can assist you!`)}`)
29940
29946
  import_emoji_picker_react.default,
29941
29947
  {
29942
29948
  onEmojiClick: handleEmojiClick,
29943
- theme: resolvedTheme === "dark" ? import_emoji_picker_react.Theme.DARK : import_emoji_picker_react.Theme.LIGHT,
29949
+ theme: isDark ? import_emoji_picker_react.Theme.DARK : import_emoji_picker_react.Theme.LIGHT,
29944
29950
  searchPlaceHolder: t6("Search emoji..."),
29945
29951
  width: 300,
29946
29952
  height: 400,
@@ -30127,7 +30133,7 @@ ${t6(`The more specific you are, the better AI can assist you!`)}`)
30127
30133
  t6("Add-on")
30128
30134
  ) : null))));
30129
30135
  }
30130
- var import_react45, import_Instructions_module, import_clsx11, import_react_hot_toast7, import_fa, import_emoji_picker_react, import_next_themes;
30136
+ var import_react45, import_Instructions_module, import_clsx11, import_react_hot_toast7, import_fa, import_emoji_picker_react;
30131
30137
  var init_Instructions = __esm({
30132
30138
  "Instructions.tsx"() {
30133
30139
  "use strict";
@@ -30149,7 +30155,6 @@ var init_Instructions = __esm({
30149
30155
  init_ConfirmButton();
30150
30156
  import_fa = require("react-icons/fa");
30151
30157
  import_emoji_picker_react = __toESM(require("emoji-picker-react"));
30152
- import_next_themes = require("next-themes");
30153
30158
  init_Agent();
30154
30159
  init_hooks();
30155
30160
  }
@@ -35540,7 +35545,7 @@ function CharacterProfile({
35540
35545
  }, [props.characterProfile]);
35541
35546
  const { t: t6 } = useAppContext();
35542
35547
  const { token, user, guest, setUser, setGuest, setShowCharacterProfiles } = useAuth();
35543
- const { thread: thread2, setShouldRefetchThread } = useChat();
35548
+ const { thread: thread2, refetchThread } = useChat();
35544
35549
  const [showActions, setShowActions] = (0, import_react57.useState)(props.showActions);
35545
35550
  const [isPinning, setIsPinning] = (0, import_react57.useState)(false);
35546
35551
  const [isSharing, setIsSharing] = (0, import_react57.useState)(false);
@@ -35566,7 +35571,7 @@ function CharacterProfile({
35566
35571
  const updatedGuest = await actions.getGuest();
35567
35572
  setGuest(updatedGuest);
35568
35573
  }
35569
- thread2?.characterProfile?.id === characterProfile.id && setShouldRefetchThread(true);
35574
+ thread2?.characterProfile?.id === characterProfile.id && await refetchThread();
35570
35575
  } catch (error) {
35571
35576
  console.error("Error pinning thread:", error);
35572
35577
  } finally {
@@ -35589,7 +35594,7 @@ function CharacterProfile({
35589
35594
  visibility: response?.characterProfileVisibility,
35590
35595
  pinned: response?.pinCharacterProfile
35591
35596
  };
35592
- thread2?.characterProfile?.id === characterProfile.id && setShouldRefetchThread(true);
35597
+ thread2?.characterProfile?.id === characterProfile.id && await refetchThread();
35593
35598
  setCharacterProfile(newCharacterProfile);
35594
35599
  } catch (error) {
35595
35600
  console.error("Error pinning thread:", error);