@chrryai/chrry 1.3.0 → 1.3.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.
package/dist/index.d.mts CHANGED
@@ -781,7 +781,7 @@ declare const isFirefox: boolean;
781
781
  declare function getFlag({ code }: {
782
782
  code?: string;
783
783
  }): string;
784
- declare const VERSION = "1.3.0";
784
+ declare const VERSION = "1.3.2";
785
785
  type instructionBase = {
786
786
  id: string;
787
787
  title: string;
package/dist/index.d.ts CHANGED
@@ -781,7 +781,7 @@ declare const isFirefox: boolean;
781
781
  declare function getFlag({ code }: {
782
782
  code?: string;
783
783
  }): string;
784
- declare const VERSION = "1.3.0";
784
+ declare const VERSION = "1.3.2";
785
785
  type instructionBase = {
786
786
  id: string;
787
787
  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.3.0";
21285
+ const VERSION3 = "1.3.2";
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.3.0";
22370
+ VERSION = "1.3.2";
22371
22371
  getSlugFromPathname = (path) => {
22372
22372
  const siteConfig = getSiteConfig();
22373
22373
  return getAppAndStoreSlugs(path, {
@@ -31850,6 +31850,10 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
31850
31850
  };
31851
31851
  const setIsAttaching = (attaching) => {
31852
31852
  if (attaching) {
31853
+ if (!isPrivacyApproved) {
31854
+ setNeedsReview(true);
31855
+ return;
31856
+ }
31853
31857
  if (selectedAgent?.name == "flux") {
31854
31858
  user ? setSelectedAgent(chatGPTAgent) : setSelectedAgent(deepSeekAgent);
31855
31859
  }
@@ -32344,7 +32348,15 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
32344
32348
  (0, import_react51.useEffect)(() => {
32345
32349
  BrowserInstance?.storage?.local?.set?.({ messageId: message?.message?.id });
32346
32350
  }, [message]);
32347
- const handleSubmit = async () => {
32351
+ const handleSubmit = async (approve) => {
32352
+ if (!isPrivacyApproved && !approve) {
32353
+ setNeedsReview(true);
32354
+ return;
32355
+ }
32356
+ if (approve) {
32357
+ setNeedsReview(false);
32358
+ setIsPrivacyApproved(true);
32359
+ }
32348
32360
  addHapticFeedback();
32349
32361
  if (!selectedAgent?.capabilities?.image && files.some((file) => file.type.startsWith("image/"))) {
32350
32362
  setIsAgentModalOpen(true);
@@ -32976,6 +32988,16 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
32976
32988
  token,
32977
32989
  deviceId
32978
32990
  });
32991
+ const [isPrivacyApproved, setIsPrivacyApproved] = useLocalStorage2(
32992
+ "isPrivacyApproved",
32993
+ !!user
32994
+ );
32995
+ const [needsReview, setNeedsReviewInternal] = (0, import_react51.useState)(false);
32996
+ const needsReviewRef = (0, import_react51.useRef)(needsReview);
32997
+ const setNeedsReview = (value) => {
32998
+ setNeedsReviewInternal(value);
32999
+ needsReviewRef.current = value;
33000
+ };
32979
33001
  (0, import_react51.useEffect)(() => {
32980
33002
  threadId && scrollToBottom();
32981
33003
  }, [threadId]);
@@ -33183,6 +33205,91 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
33183
33205
  return () => clearTimeout(timer);
33184
33206
  }
33185
33207
  }, [showSuggestions]);
33208
+ const renderSubmit = () => {
33209
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !isAttaching && /* @__PURE__ */ React.createElement(React.Fragment, null, streamId && isStreaming ? /* @__PURE__ */ React.createElement(
33210
+ "button",
33211
+ {
33212
+ "data-testid": "chat-stop-streaming-button",
33213
+ title: t6("Stop streaming"),
33214
+ className: (0, import_clsx13.default)("link", import_Chat_module.default.sendButton),
33215
+ type: "button",
33216
+ disabled: !isStreaming,
33217
+ onClick: handleStopStreaming
33218
+ },
33219
+ /* @__PURE__ */ React.createElement(icons_exports.CircleStop, { color: "var(--accent-0)", size: 26 })
33220
+ ) : isLoading && !isStreaming ? /* @__PURE__ */ React.createElement(Loading, { width: 28, height: 28 }) : inputRef.current.trim() || files.length > 0 ? /* @__PURE__ */ React.createElement(
33221
+ "button",
33222
+ {
33223
+ "data-testid": "chat-send-button",
33224
+ title: creditsLeft === 0 ? t6("credits_left", { count: creditsLeft }) : needsReviewRef.current ? t6("Accept and send") : t6("Send"),
33225
+ className: (0, import_clsx13.default)("link", import_Chat_module.default.sendButton),
33226
+ type: "submit",
33227
+ disabled: getIsSendDisabled(),
33228
+ onClick: () => handleSubmit(needsReviewRef.current)
33229
+ },
33230
+ needsReviewRef.current ? /* @__PURE__ */ React.createElement(icons_exports.CircleCheck, { size: 30, color: "var(--accent-6)" }) : /* @__PURE__ */ React.createElement(
33231
+ icons_exports.CircleArrowUp,
33232
+ {
33233
+ color: creditsLeft === 0 ? "var(--accent-0)" : getIsSendDisabled() ? "var(--shade-3)" : "var(--accent-6)",
33234
+ size: 30
33235
+ }
33236
+ )
33237
+ ) : isLoading ? /* @__PURE__ */ React.createElement(Loading, { width: 26, height: 26 }) : /* @__PURE__ */ React.createElement(
33238
+ "button",
33239
+ {
33240
+ onClick: () => {
33241
+ if (!isPrivacyApproved) {
33242
+ if (needsReview) {
33243
+ setIsPrivacyApproved(true);
33244
+ setNeedsReview(false);
33245
+ playNotification();
33246
+ addHapticFeedback();
33247
+ setPlayVideo(!playVideo);
33248
+ setIsLoading(true);
33249
+ startVoiceConversation();
33250
+ } else {
33251
+ setNeedsReview(true);
33252
+ }
33253
+ return;
33254
+ }
33255
+ playNotification();
33256
+ addHapticFeedback();
33257
+ setPlayVideo(!playVideo);
33258
+ setIsLoading(true);
33259
+ startVoiceConversation();
33260
+ },
33261
+ disabled: isVoiceDisabled || inConversationRef.current,
33262
+ className: (0, import_clsx13.default)(
33263
+ "link",
33264
+ import_Chat_module.default.voiceButton,
33265
+ isListening ? import_Chat_module.default.voiceButtonListening : ""
33266
+ ),
33267
+ type: "button",
33268
+ title: isListening ? t6("Stop listening") : t6("Start voice input")
33269
+ },
33270
+ needsReview ? /* @__PURE__ */ React.createElement(icons_exports.CircleCheck, { size: 30, color: "var(--accent-6)" }) : /* @__PURE__ */ React.createElement(
33271
+ "div",
33272
+ {
33273
+ className: (0, import_clsx13.default)(import_Chat_module.default.videoContainer),
33274
+ title: t6("Sound")
33275
+ },
33276
+ needsReview ? /* @__PURE__ */ React.createElement(icons_exports.CircleCheck, { size: 30, color: "var(--accent-6)" }) : /* @__PURE__ */ React.createElement(
33277
+ "video",
33278
+ {
33279
+ onLoadedData: () => setIsVideoLoading(false),
33280
+ ref: videoRef,
33281
+ src: `${FRONTEND_URL4}/video/blob.mp4`,
33282
+ style: {},
33283
+ className: import_Chat_module.default.video,
33284
+ loop: true,
33285
+ autoPlay: true,
33286
+ muted: true,
33287
+ playsInline: true
33288
+ }
33289
+ )
33290
+ )
33291
+ )));
33292
+ };
33186
33293
  return /* @__PURE__ */ React.createElement(React.Fragment, null, isAgentModalOpen && /* @__PURE__ */ React.createElement(
33187
33294
  Modal,
33188
33295
  {
@@ -33898,7 +34005,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
33898
34005
  isExtension2 && import_Chat_module.default.extension
33899
34006
  )
33900
34007
  },
33901
- !isLoading && !isAttaching && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
34008
+ !isLoading && !isAttaching && !needsReview && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
33902
34009
  "button",
33903
34010
  {
33904
34011
  "data-testid": isWebSearchEnabled ? "web-search-button-enabled" : "web-search-button-disabled",
@@ -34029,7 +34136,31 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
34029
34136
  )
34030
34137
  },
34031
34138
  /* @__PURE__ */ React.createElement(icons_exports.ImageIcon, { size: 22, color: getButtonColor("image") })
34032
- )) : !isLoading && !isStreaming && /* @__PURE__ */ React.createElement(
34139
+ )) : needsReview ? /* @__PURE__ */ React.createElement(
34140
+ "a",
34141
+ {
34142
+ target: "_blank",
34143
+ className: "button small transparent",
34144
+ onClick: (e) => {
34145
+ if (e.metaKey || e.ctrlKey) {
34146
+ return;
34147
+ }
34148
+ addHapticFeedback();
34149
+ if (checkIsExtension()) {
34150
+ e.preventDefault();
34151
+ BrowserInstance?.runtime?.sendMessage({
34152
+ action: "openInSameTab",
34153
+ url: `${FRONTEND_URL4}/privacy`
34154
+ });
34155
+ return;
34156
+ }
34157
+ window.open(`${FRONTEND_URL4}/privacy`, "_blank");
34158
+ },
34159
+ href: "/privacy"
34160
+ },
34161
+ /* @__PURE__ */ React.createElement(icons_exports.Link, { size: 15 }),
34162
+ t6("Privacy")
34163
+ ) : !isLoading && !isStreaming && /* @__PURE__ */ React.createElement(
34033
34164
  "button",
34034
34165
  {
34035
34166
  "data-testid": "attach-button",
@@ -34060,81 +34191,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
34060
34191
  },
34061
34192
  /* @__PURE__ */ React.createElement(icons_exports.HardDrive, { color: "var(--shade-6)", size: 22 })
34062
34193
  ),
34063
- !isAttaching && /* @__PURE__ */ React.createElement(React.Fragment, null, streamId && isStreaming ? /* @__PURE__ */ React.createElement(
34064
- "button",
34065
- {
34066
- "data-testid": "chat-stop-streaming-button",
34067
- title: t6("Stop streaming"),
34068
- className: (0, import_clsx13.default)("link", import_Chat_module.default.sendButton),
34069
- type: "button",
34070
- disabled: !isStreaming,
34071
- onClick: handleStopStreaming
34072
- },
34073
- /* @__PURE__ */ React.createElement(icons_exports.CircleStop, { color: "var(--accent-0)", size: 26 })
34074
- ) : isLoading && !isStreaming ? /* @__PURE__ */ React.createElement(Loading, { width: 28, height: 28 }) : inputRef.current.trim() || files.length > 0 ? /* @__PURE__ */ React.createElement(
34075
- "button",
34076
- {
34077
- "data-testid": "chat-send-button",
34078
- title: creditsLeft === 0 ? t6("credits_left", { count: creditsLeft }) : t6("Send"),
34079
- className: (0, import_clsx13.default)("link", import_Chat_module.default.sendButton),
34080
- type: "submit",
34081
- disabled: getIsSendDisabled(),
34082
- onClick: () => handleSubmit()
34083
- },
34084
- /* @__PURE__ */ React.createElement(
34085
- icons_exports.CircleArrowUp,
34086
- {
34087
- color: creditsLeft === 0 ? "var(--accent-0)" : getIsSendDisabled() ? "var(--shade-3)" : "var(--accent-6)",
34088
- size: 30
34089
- }
34090
- )
34091
- ) : isLoading ? /* @__PURE__ */ React.createElement(Loading, { width: 26, height: 26 }) : /* @__PURE__ */ React.createElement(
34092
- "button",
34093
- {
34094
- onClick: (e) => {
34095
- playNotification();
34096
- addHapticFeedback();
34097
- e.preventDefault();
34098
- setPlayVideo(!playVideo);
34099
- setIsLoading(true);
34100
- startVoiceConversation();
34101
- },
34102
- disabled: isVoiceDisabled || inConversationRef.current,
34103
- className: (0, import_clsx13.default)(
34104
- "link",
34105
- import_Chat_module.default.voiceButton,
34106
- isListening ? import_Chat_module.default.voiceButtonListening : ""
34107
- ),
34108
- type: "button",
34109
- title: isListening ? t6("Stop listening") : t6("Start voice input")
34110
- },
34111
- /* @__PURE__ */ React.createElement(
34112
- "div",
34113
- {
34114
- className: (0, import_clsx13.default)(
34115
- import_Chat_module.default.videoContainer
34116
- // isVideoLoading || inConversationRef.current
34117
- // ? styles.loading
34118
- // : "",
34119
- ),
34120
- title: t6("Sound")
34121
- },
34122
- /* @__PURE__ */ React.createElement(
34123
- "video",
34124
- {
34125
- onLoadedData: () => setIsVideoLoading(false),
34126
- ref: videoRef,
34127
- src: `${FRONTEND_URL4}/video/blob.mp4`,
34128
- style: {},
34129
- className: import_Chat_module.default.video,
34130
- loop: true,
34131
- autoPlay: true,
34132
- muted: true,
34133
- playsInline: true
34134
- }
34135
- )
34136
- )
34137
- ))
34194
+ renderSubmit()
34138
34195
  ))
34139
34196
  ), !isChatFloating && /* @__PURE__ */ React.createElement(
34140
34197
  "div",