@fctc/widget-logic 4.8.9 → 4.8.10

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/hooks.d.mts CHANGED
@@ -1050,6 +1050,7 @@ declare const useProfile: ({ service }: {
1050
1050
  service?: string;
1051
1051
  }) => {
1052
1052
  context: ContextProfile | undefined;
1053
+ resetProfileCache: () => void;
1053
1054
  data: UserInfo | undefined;
1054
1055
  error: Error;
1055
1056
  isError: true;
@@ -1078,6 +1079,7 @@ declare const useProfile: ({ service }: {
1078
1079
  promise: Promise<UserInfo | undefined>;
1079
1080
  } | {
1080
1081
  context: ContextProfile | undefined;
1082
+ resetProfileCache: () => void;
1081
1083
  data: UserInfo | undefined;
1082
1084
  error: null;
1083
1085
  isError: false;
@@ -1106,6 +1108,7 @@ declare const useProfile: ({ service }: {
1106
1108
  promise: Promise<UserInfo | undefined>;
1107
1109
  } | {
1108
1110
  context: ContextProfile | undefined;
1111
+ resetProfileCache: () => void;
1109
1112
  data: UserInfo | undefined;
1110
1113
  isError: false;
1111
1114
  error: null;
package/dist/hooks.d.ts CHANGED
@@ -1050,6 +1050,7 @@ declare const useProfile: ({ service }: {
1050
1050
  service?: string;
1051
1051
  }) => {
1052
1052
  context: ContextProfile | undefined;
1053
+ resetProfileCache: () => void;
1053
1054
  data: UserInfo | undefined;
1054
1055
  error: Error;
1055
1056
  isError: true;
@@ -1078,6 +1079,7 @@ declare const useProfile: ({ service }: {
1078
1079
  promise: Promise<UserInfo | undefined>;
1079
1080
  } | {
1080
1081
  context: ContextProfile | undefined;
1082
+ resetProfileCache: () => void;
1081
1083
  data: UserInfo | undefined;
1082
1084
  error: null;
1083
1085
  isError: false;
@@ -1106,6 +1108,7 @@ declare const useProfile: ({ service }: {
1106
1108
  promise: Promise<UserInfo | undefined>;
1107
1109
  } | {
1108
1110
  context: ContextProfile | undefined;
1111
+ resetProfileCache: () => void;
1109
1112
  data: UserInfo | undefined;
1110
1113
  isError: false;
1111
1114
  error: null;
package/dist/hooks.js CHANGED
@@ -376,7 +376,6 @@ var useMenu = ({
376
376
  domain,
377
377
  defaultService
378
378
  }) => {
379
- const { env } = (0, provider_exports.useEnv)();
380
379
  const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
381
380
  const [action, callAction] = useCallAction();
382
381
  const [service, setService] = (0, import_react3.useState)("");
@@ -463,6 +462,7 @@ var useProfile = ({ service }) => {
463
462
  const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
464
463
  const getProfile = useGetProfile2(service);
465
464
  const { i18n } = (0, import_react_i18next.useTranslation)();
465
+ const queryClient = (0, import_react_query2.useQueryClient)();
466
466
  const userInfoQuery = (0, import_react_query2.useQuery)({
467
467
  queryKey: ["userInfo"],
468
468
  queryFn: () => getProfile.mutateAsync(),
@@ -492,7 +492,13 @@ var useProfile = ({ service }) => {
492
492
  if (userInfoQuery.isLoading || !userInfoQuery.data) {
493
493
  return null;
494
494
  }
495
- return { ...userInfoQuery, context };
495
+ return {
496
+ ...userInfoQuery,
497
+ context,
498
+ resetProfileCache: () => {
499
+ queryClient.removeQueries({ queryKey: ["userInfo"] });
500
+ }
501
+ };
496
502
  };
497
503
 
498
504
  // src/hooks/core/use-user.ts
package/dist/hooks.mjs CHANGED
@@ -357,7 +357,6 @@ var useMenu = ({
357
357
  domain,
358
358
  defaultService
359
359
  }) => {
360
- const { env } = (0, provider_exports.useEnv)();
361
360
  const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
362
361
  const [action, callAction] = useCallAction();
363
362
  const [service, setService] = useState2("");
@@ -436,7 +435,7 @@ var useDetail = (sub) => {
436
435
  };
437
436
 
438
437
  // src/hooks/core/use-profile.ts
439
- import { useQuery as useQuery2 } from "@tanstack/react-query";
438
+ import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
440
439
  import { useEffect as useEffect3, useMemo } from "react";
441
440
  import { useTranslation } from "react-i18next";
442
441
  var useProfile = ({ service }) => {
@@ -444,6 +443,7 @@ var useProfile = ({ service }) => {
444
443
  const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
445
444
  const getProfile = useGetProfile2(service);
446
445
  const { i18n } = useTranslation();
446
+ const queryClient = useQueryClient();
447
447
  const userInfoQuery = useQuery2({
448
448
  queryKey: ["userInfo"],
449
449
  queryFn: () => getProfile.mutateAsync(),
@@ -473,7 +473,13 @@ var useProfile = ({ service }) => {
473
473
  if (userInfoQuery.isLoading || !userInfoQuery.data) {
474
474
  return null;
475
475
  }
476
- return { ...userInfoQuery, context };
476
+ return {
477
+ ...userInfoQuery,
478
+ context,
479
+ resetProfileCache: () => {
480
+ queryClient.removeQueries({ queryKey: ["userInfo"] });
481
+ }
482
+ };
477
483
  };
478
484
 
479
485
  // src/hooks/core/use-user.ts
package/dist/index.js CHANGED
@@ -4426,7 +4426,6 @@ var useMenu = ({
4426
4426
  domain,
4427
4427
  defaultService
4428
4428
  }) => {
4429
- const { env } = (0, provider_exports.useEnv)();
4430
4429
  const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
4431
4430
  const [action, callAction] = useCallAction();
4432
4431
  const [service, setService] = (0, import_react3.useState)("");
@@ -4513,6 +4512,7 @@ var useProfile = ({ service }) => {
4513
4512
  const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
4514
4513
  const getProfile = useGetProfile2(service);
4515
4514
  const { i18n: i18n2 } = (0, import_react_i18next.useTranslation)();
4515
+ const queryClient = (0, import_react_query2.useQueryClient)();
4516
4516
  const userInfoQuery = (0, import_react_query2.useQuery)({
4517
4517
  queryKey: ["userInfo"],
4518
4518
  queryFn: () => getProfile.mutateAsync(),
@@ -4542,7 +4542,13 @@ var useProfile = ({ service }) => {
4542
4542
  if (userInfoQuery.isLoading || !userInfoQuery.data) {
4543
4543
  return null;
4544
4544
  }
4545
- return { ...userInfoQuery, context };
4545
+ return {
4546
+ ...userInfoQuery,
4547
+ context,
4548
+ resetProfileCache: () => {
4549
+ queryClient.removeQueries({ queryKey: ["userInfo"] });
4550
+ }
4551
+ };
4546
4552
  };
4547
4553
 
4548
4554
  // src/hooks/core/use-user.ts
package/dist/index.mjs CHANGED
@@ -4516,7 +4516,6 @@ var useMenu = ({
4516
4516
  domain,
4517
4517
  defaultService
4518
4518
  }) => {
4519
- const { env } = (0, provider_exports.useEnv)();
4520
4519
  const { useGetMenu: useGetMenu2 } = (0, provider_exports.useService)();
4521
4520
  const [action, callAction] = useCallAction();
4522
4521
  const [service, setService] = useState2("");
@@ -4595,7 +4594,7 @@ var useDetail = (sub) => {
4595
4594
  };
4596
4595
 
4597
4596
  // src/hooks/core/use-profile.ts
4598
- import { useQuery as useQuery2 } from "@tanstack/react-query";
4597
+ import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
4599
4598
  import { useEffect as useEffect3, useMemo } from "react";
4600
4599
  import { useTranslation } from "react-i18next";
4601
4600
  var useProfile = ({ service }) => {
@@ -4603,6 +4602,7 @@ var useProfile = ({ service }) => {
4603
4602
  const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
4604
4603
  const getProfile = useGetProfile2(service);
4605
4604
  const { i18n: i18n2 } = useTranslation();
4605
+ const queryClient = useQueryClient();
4606
4606
  const userInfoQuery = useQuery2({
4607
4607
  queryKey: ["userInfo"],
4608
4608
  queryFn: () => getProfile.mutateAsync(),
@@ -4632,7 +4632,13 @@ var useProfile = ({ service }) => {
4632
4632
  if (userInfoQuery.isLoading || !userInfoQuery.data) {
4633
4633
  return null;
4634
4634
  }
4635
- return { ...userInfoQuery, context };
4635
+ return {
4636
+ ...userInfoQuery,
4637
+ context,
4638
+ resetProfileCache: () => {
4639
+ queryClient.removeQueries({ queryKey: ["userInfo"] });
4640
+ }
4641
+ };
4636
4642
  };
4637
4643
 
4638
4644
  // src/hooks/core/use-user.ts
package/dist/widget.mjs CHANGED
@@ -4382,7 +4382,7 @@ import { useQuery } from "@tanstack/react-query";
4382
4382
  import { useEffect as useEffect3 } from "react";
4383
4383
 
4384
4384
  // src/hooks/core/use-profile.ts
4385
- import { useQuery as useQuery2 } from "@tanstack/react-query";
4385
+ import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
4386
4386
  import { useEffect as useEffect4, useMemo } from "react";
4387
4387
  import { useTranslation } from "react-i18next";
4388
4388
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/widget-logic",
3
- "version": "4.8.9",
3
+ "version": "4.8.10",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",