@chrryai/chrry 1.2.52 → 1.2.54

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
@@ -782,7 +782,7 @@ declare const isFirefox: boolean;
782
782
  declare function getFlag({ code }: {
783
783
  code?: string;
784
784
  }): string;
785
- declare const VERSION = "1.2.52";
785
+ declare const VERSION = "1.2.54";
786
786
  type instructionBase = {
787
787
  id: string;
788
788
  title: string;
@@ -1367,10 +1367,11 @@ declare function deleteApp({ token, id, API_URL, }: {
1367
1367
  id: string;
1368
1368
  API_URL?: string;
1369
1369
  }): Promise<any>;
1370
- declare function reorderApps({ token, apps, autoInstall, API_URL, }: {
1370
+ declare function reorderApps({ token, apps, autoInstall, storeId, API_URL, }: {
1371
1371
  token: string;
1372
1372
  apps: app[];
1373
1373
  autoInstall?: boolean;
1374
+ storeId?: string;
1374
1375
  API_URL?: string;
1375
1376
  }): Promise<any>;
1376
1377
  declare const getSession: ({ deviceId, fingerprint, gift, isStandalone, appId, token, API_URL, VERSION, app, appSlug, agentName, chrryUrl, routeType, userAgent, pathname, screenWidth, screenHeight, translate, locale, }: {
@@ -1509,7 +1510,7 @@ declare const getActions: ({ API_URL, token, }: {
1509
1510
  createApp: (data: appFormData) => Promise<any>;
1510
1511
  updateApp: (id: string, data: appFormData) => Promise<any>;
1511
1512
  deleteApp: (id: string) => Promise<any>;
1512
- reorderApps: (apps: app[], autoInstall?: boolean) => Promise<any>;
1513
+ reorderApps: (apps: app[], autoInstall?: boolean, storeId?: string) => Promise<any>;
1513
1514
  getApps: () => Promise<Paginated<appWithStore>>;
1514
1515
  getSession: (params: {
1515
1516
  deviceId: string | undefined;
package/dist/index.d.ts CHANGED
@@ -782,7 +782,7 @@ declare const isFirefox: boolean;
782
782
  declare function getFlag({ code }: {
783
783
  code?: string;
784
784
  }): string;
785
- declare const VERSION = "1.2.52";
785
+ declare const VERSION = "1.2.54";
786
786
  type instructionBase = {
787
787
  id: string;
788
788
  title: string;
@@ -1367,10 +1367,11 @@ declare function deleteApp({ token, id, API_URL, }: {
1367
1367
  id: string;
1368
1368
  API_URL?: string;
1369
1369
  }): Promise<any>;
1370
- declare function reorderApps({ token, apps, autoInstall, API_URL, }: {
1370
+ declare function reorderApps({ token, apps, autoInstall, storeId, API_URL, }: {
1371
1371
  token: string;
1372
1372
  apps: app[];
1373
1373
  autoInstall?: boolean;
1374
+ storeId?: string;
1374
1375
  API_URL?: string;
1375
1376
  }): Promise<any>;
1376
1377
  declare const getSession: ({ deviceId, fingerprint, gift, isStandalone, appId, token, API_URL, VERSION, app, appSlug, agentName, chrryUrl, routeType, userAgent, pathname, screenWidth, screenHeight, translate, locale, }: {
@@ -1509,7 +1510,7 @@ declare const getActions: ({ API_URL, token, }: {
1509
1510
  createApp: (data: appFormData) => Promise<any>;
1510
1511
  updateApp: (id: string, data: appFormData) => Promise<any>;
1511
1512
  deleteApp: (id: string) => Promise<any>;
1512
- reorderApps: (apps: app[], autoInstall?: boolean) => Promise<any>;
1513
+ reorderApps: (apps: app[], autoInstall?: boolean, storeId?: string) => Promise<any>;
1513
1514
  getApps: () => Promise<Paginated<appWithStore>>;
1514
1515
  getSession: (params: {
1515
1516
  deviceId: string | undefined;
package/dist/index.js CHANGED
@@ -3423,6 +3423,7 @@ async function reorderApps({
3423
3423
  token,
3424
3424
  apps,
3425
3425
  autoInstall,
3426
+ storeId,
3426
3427
  API_URL: API_URL2 = API_URL
3427
3428
  }) {
3428
3429
  const response = await fetch(`${API_URL2}/apps/reorder`, {
@@ -3432,6 +3433,8 @@ async function reorderApps({
3432
3433
  Authorization: `Bearer ${token}`
3433
3434
  },
3434
3435
  body: JSON.stringify({
3436
+ storeId,
3437
+ // Optional: store context for ordering
3435
3438
  apps: apps.map((app, index) => ({
3436
3439
  appId: app.id,
3437
3440
  order: index,
@@ -4071,7 +4074,7 @@ var init_lib = __esm({
4071
4074
  createApp: (data) => createApp({ token, data, API_URL: API_URL2 }),
4072
4075
  updateApp: (id, data) => updateApp({ token, id, data, API_URL: API_URL2 }),
4073
4076
  deleteApp: (id) => deleteApp({ token, id, API_URL: API_URL2 }),
4074
- reorderApps: (apps, autoInstall) => reorderApps({ token, apps, autoInstall, API_URL: API_URL2 }),
4077
+ reorderApps: (apps, autoInstall, storeId) => reorderApps({ token, apps, autoInstall, storeId, API_URL: API_URL2 }),
4075
4078
  getApps: () => getApps({ token, API_URL: API_URL2 }),
4076
4079
  getSession: (params) => getSession({ ...params, API_URL: API_URL2, token })
4077
4080
  };
@@ -20658,7 +20661,7 @@ function DataProvider({
20658
20661
  const [instructions, setInstructions] = (0, import_react14.useState)([]);
20659
20662
  const [affiliateStats, setAffiliateStats] = (0, import_react14.useState)(null);
20660
20663
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react14.useState)(false);
20661
- const VERSION3 = "1.2.52";
20664
+ const VERSION3 = "1.2.54";
20662
20665
  const [weather, setWeather] = useLocalStorage("weather", user?.weather || guest?.weather || void 0);
20663
20666
  const {
20664
20667
  API_URL: API_URL2,
@@ -21699,7 +21702,7 @@ var init_utils = __esm({
21699
21702
  window.history.replaceState({}, "", newUrl);
21700
21703
  };
21701
21704
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent.includes("Firefox");
21702
- VERSION = "1.2.52";
21705
+ VERSION = "1.2.54";
21703
21706
  getSlugFromPathname = (path) => {
21704
21707
  const siteConfig = getSiteConfig();
21705
21708
  return getAppAndStoreSlugs(path, {
@@ -22283,10 +22286,12 @@ function AppProvider({
22283
22286
  return false;
22284
22287
  }
22285
22288
  if (result) {
22286
- await refetchSession(result);
22287
22289
  if (canEditApp) {
22288
22290
  toast_default.success(`${t6("Updated")} \u{1F680}`);
22289
22291
  setApp(result);
22292
+ await refetchSession();
22293
+ } else {
22294
+ await refetchSession(result);
22290
22295
  }
22291
22296
  clearFormDraft();
22292
22297
  return true;
@@ -26793,10 +26798,6 @@ function Agent({
26793
26798
  const { t: t6 } = useAppContext();
26794
26799
  const { chrry, baseApp, allApps } = useAuth();
26795
26800
  const { app, apps, appForm, appFormWatcher, appStatus, setAppStatus } = useApp();
26796
- console.log(
26797
- `\u{1F680} ~ file: Agent.tsx:68 ~ appFormWatcher:`,
26798
- appFormWatcher.extends
26799
- );
26800
26801
  const { aiAgents } = useChat();
26801
26802
  const { isMobileDevice, removeParam: removeParam2, searchParams, addParam: addParam2, addParams } = useNavigationContext();
26802
26803
  const {
@@ -28897,11 +28898,11 @@ ${t6(`The more specific you are, the better AI can assist you!`)}`)
28897
28898
  instructions.slice(
28898
28899
  0,
28899
28900
  isMemoryConsentManageVisible ? 3 : visibleInstructionCount
28900
- ).map((instruction, index) => {
28901
+ ).map((instruction) => {
28901
28902
  return /* @__PURE__ */ import_react44.default.createElement(
28902
28903
  "button",
28903
28904
  {
28904
- key: index,
28905
+ key: instruction.id,
28905
28906
  className: (0, import_clsx11.default)(
28906
28907
  "link",
28907
28908
  "instructionItem",
@@ -29143,7 +29144,8 @@ function useAppReorder({
29143
29144
  apps,
29144
29145
  setApps,
29145
29146
  onSave,
29146
- autoInstall
29147
+ autoInstall,
29148
+ storeId
29147
29149
  }) {
29148
29150
  const { t: t6 } = useAppContext();
29149
29151
  const { token, API_URL: API_URL2 } = useAuth();
@@ -29169,18 +29171,30 @@ function useAppReorder({
29169
29171
  await onSave(apps);
29170
29172
  } else {
29171
29173
  try {
29172
- const response = await actions.reorderApps(apps, autoInstall);
29174
+ const appsToSave = apps.map((appItem) => {
29175
+ const { store, ...appData } = appItem;
29176
+ return appData;
29177
+ });
29178
+ const response = await actions.reorderApps(
29179
+ appsToSave,
29180
+ autoInstall,
29181
+ storeId
29182
+ );
29173
29183
  if (response?.error) {
29174
29184
  import_react_hot_toast8.toast.error(t6(response.error));
29175
29185
  return;
29176
29186
  }
29177
- console.log("\u2705 App order saved successfully");
29187
+ console.log("\u2705 App order saved successfully", response);
29188
+ if (response?.message) {
29189
+ import_react_hot_toast8.toast.success(response.message);
29190
+ }
29178
29191
  } catch (error) {
29179
29192
  console.error("\u274C Failed to save app order:", error);
29193
+ import_react_hot_toast8.toast.error(t6("failed_to_save_order"));
29180
29194
  }
29181
29195
  }
29182
29196
  },
29183
- [apps, onSave, token, autoInstall]
29197
+ [apps, onSave, token, autoInstall, storeId, actions, t6]
29184
29198
  );
29185
29199
  const handleDragStart = (0, import_react47.useCallback)((index) => {
29186
29200
  console.log("Started dragging app at index:", index);
@@ -29352,7 +29366,8 @@ function App({
29352
29366
  const reorder = useAppReorder({
29353
29367
  apps: appsState,
29354
29368
  setApps,
29355
- autoInstall: true
29369
+ autoInstall: false,
29370
+ storeId: store?.id
29356
29371
  });
29357
29372
  const { isWeb: isWeb2 } = usePlatform();
29358
29373
  const [imageDimensionWarning, setImageDimensionWarning] = import_react49.default.useState(null);