@droppii-org/chat-mobile 0.2.14 → 0.2.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.
@@ -4,10 +4,11 @@ import { useQuery } from '@tanstack/react-query';
4
4
  import { commonQueryKeys } from "../query-keys.js";
5
5
  import { apiInstance } from "../../services/apis.js";
6
6
  import { ENDPOINTS } from "../../services/endpoints.js";
7
+ import { normalizeUrl } from "../../utils/url.js";
7
8
  export const useFetchUrlMetadata = url => useQuery({
8
- queryKey: commonQueryKeys.urlMetadata(url || ''),
9
+ queryKey: commonQueryKeys.urlMetadata(normalizeUrl(url || '')),
9
10
  queryFn: async () => {
10
- const path = `${ENDPOINTS.chatService.urlMetadata}?url=${url}`;
11
+ const path = `${ENDPOINTS.chatService.urlMetadata}?url=${normalizeUrl(url || '')}`;
11
12
  const res = await apiInstance?.get(path);
12
13
  return res?.data?.data?.title ? {
13
14
  ...res?.data?.data,
@@ -1 +1 @@
1
- {"version":3,"names":["useQuery","commonQueryKeys","apiInstance","ENDPOINTS","useFetchUrlMetadata","url","queryKey","urlMetadata","queryFn","path","chatService","res","get","data","title","enabled"],"sourceRoot":"../../../../src","sources":["hooks/useLinkPreview/useFetchUrlMetadata.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,eAAe,QAAQ,kBAAe;AAC/C,SAASC,WAAW,QAAQ,wBAAqB;AAGjD,SAASC,SAAS,QAAQ,6BAA0B;AAEpD,OAAO,MAAMC,mBAAmB,GAAIC,GAAY,IAC9CL,QAAQ,CAAC;EACPM,QAAQ,EAAEL,eAAe,CAACM,WAAW,CAACF,GAAG,IAAI,EAAE,CAAC;EAChDG,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,IAAI,GAAG,GAAGN,SAAS,CAACO,WAAW,CAACH,WAAW,QAAQF,GAAG,EAAE;IAC9D,MAAMM,GAAG,GAAG,MAAMT,WAAW,EAAEU,GAAG,CAA6BH,IAAI,CAAC;IACpE,OAAOE,GAAG,EAAEE,IAAI,EAAEA,IAAI,EAAEC,KAAK,GACzB;MACE,GAAGH,GAAG,EAAEE,IAAI,EAAEA,IAAI;MAClBR;IACF,CAAC,GACD,IAAI;EACV,CAAC;EACDU,OAAO,EAAE,CAAC,CAACV;AACb,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useQuery","commonQueryKeys","apiInstance","ENDPOINTS","normalizeUrl","useFetchUrlMetadata","url","queryKey","urlMetadata","queryFn","path","chatService","res","get","data","title","enabled"],"sourceRoot":"../../../../src","sources":["hooks/useLinkPreview/useFetchUrlMetadata.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,eAAe,QAAQ,kBAAe;AAC/C,SAASC,WAAW,QAAQ,wBAAqB;AAGjD,SAASC,SAAS,QAAQ,6BAA0B;AACpD,SAASC,YAAY,QAAQ,oBAAiB;AAE9C,OAAO,MAAMC,mBAAmB,GAAIC,GAAY,IAC9CN,QAAQ,CAAC;EACPO,QAAQ,EAAEN,eAAe,CAACO,WAAW,CAACJ,YAAY,CAACE,GAAG,IAAI,EAAE,CAAC,CAAC;EAC9DG,OAAO,EAAE,MAAAA,CAAA,KAAY;IACnB,MAAMC,IAAI,GAAG,GAAGP,SAAS,CAACQ,WAAW,CAACH,WAAW,QAAQJ,YAAY,CAACE,GAAG,IAAI,EAAE,CAAC,EAAE;IAClF,MAAMM,GAAG,GAAG,MAAMV,WAAW,EAAEW,GAAG,CAA6BH,IAAI,CAAC;IACpE,OAAOE,GAAG,EAAEE,IAAI,EAAEA,IAAI,EAAEC,KAAK,GACzB;MACE,GAAGH,GAAG,EAAEE,IAAI,EAAEA,IAAI;MAClBR;IACF,CAAC,GACD,IAAI;EACV,CAAC;EACDU,OAAO,EAAE,CAAC,CAACV;AACb,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchUrlMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useFetchUrlMetadata.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM;;;;;UAc5C,CAAC"}
1
+ {"version":3,"file":"useFetchUrlMetadata.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/useLinkPreview/useFetchUrlMetadata.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM;;;;;UAc5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-mobile",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "Droppii chat mobile",
5
5
  "keywords": [
6
6
  "react-native",
@@ -69,7 +69,7 @@
69
69
  "example-legacy": "yarn workspace @droppii-org/chat-mobile-example-legacy"
70
70
  },
71
71
  "dependencies": {
72
- "@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc9",
72
+ "@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc10",
73
73
  "@legendapp/list": "^3.0.6",
74
74
  "axios": "^1.16.1",
75
75
  "lodash": "^4.18.1",
@@ -4,12 +4,13 @@ import { apiInstance } from '../../services/apis';
4
4
  import type { BaseResponse } from '../../types/auth';
5
5
  import type { IUrlMetadata } from '../../types/common';
6
6
  import { ENDPOINTS } from '../../services/endpoints';
7
+ import { normalizeUrl } from '../../utils/url';
7
8
 
8
9
  export const useFetchUrlMetadata = (url?: string) =>
9
10
  useQuery({
10
- queryKey: commonQueryKeys.urlMetadata(url || ''),
11
+ queryKey: commonQueryKeys.urlMetadata(normalizeUrl(url || '')),
11
12
  queryFn: async () => {
12
- const path = `${ENDPOINTS.chatService.urlMetadata}?url=${url}`;
13
+ const path = `${ENDPOINTS.chatService.urlMetadata}?url=${normalizeUrl(url || '')}`;
13
14
  const res = await apiInstance?.get<BaseResponse<IUrlMetadata>>(path);
14
15
  return res?.data?.data?.title
15
16
  ? {