@korioinc/next-core 1.0.7 → 1.0.9

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.
@@ -7,6 +7,7 @@ interface RequestOptions extends Omit<RequestInit, 'method' | 'headers' | 'body'
7
7
  method?: RequestMethod;
8
8
  headers?: Record<string, string>;
9
9
  body?: unknown;
10
+ params?: Record<string, string>;
10
11
  cache?: RequestCache;
11
12
  credentials?: RequestCredentials;
12
13
  next?: NextFetchOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-client/index.ts"],"names":[],"mappings":"AAMA,KAAK,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,KAAK,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEzE,UAAU,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC;IACzG,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC,CAgGxG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-client/index.ts"],"names":[],"mappings":"AAMA,KAAK,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,KAAK,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEzE,UAAU,cAAe,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,CAAC;IACzG,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC,CAsGxG"}
@@ -8,12 +8,17 @@ import { deleteCookie, getCookie, setCookie } from 'cookies-next/server';
8
8
  * @returns Promise with the response data
9
9
  */
10
10
  export async function requestApi(endpoint, options = {}) {
11
- const { method = 'GET', headers = {}, body, cache, credentials, next } = options;
11
+ const { method = 'GET', headers = {}, body, params, cache, credentials, next } = options;
12
12
  // Get configuration
13
13
  const cfg = getConfig();
14
14
  const apiConfig = cfg.api;
15
15
  // Prepare URL
16
- const url = `${apiConfig.baseUrl}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`;
16
+ const url = new URL(`${apiConfig.baseUrl}${endpoint.startsWith('/') ? endpoint : `/${endpoint}`}`);
17
+ if (params) {
18
+ Object.entries(params).forEach(([key, value]) => {
19
+ url.searchParams.append(key, value.toString());
20
+ });
21
+ }
17
22
  // Get access token from cookie
18
23
  const cookieCfg = cfg.cookie;
19
24
  const accessTokenName = cookieCfg.accessTokenName;
@@ -49,7 +54,7 @@ export async function requestApi(endpoint, options = {}) {
49
54
  requestOptions.body = body instanceof FormData ? body : JSON.stringify(body);
50
55
  }
51
56
  try {
52
- const response = await fetch(url, requestOptions);
57
+ const response = await fetch(url.toString(), requestOptions);
53
58
  const refreshedToken = response.headers.get('x-refreshed-token');
54
59
  if (refreshedToken) {
55
60
  // Update the access token cookie
@@ -5,11 +5,11 @@ type SupportedLocales = string;
5
5
  type AllMessagesType = {
6
6
  [key: string]: Messages;
7
7
  };
8
- export declare const allMessages: AllMessagesType;
8
+ declare const allMessages: AllMessagesType;
9
+ export { allMessages };
9
10
  type AllI18nInstances = {
10
11
  [K in SupportedLocales]: I18n;
11
12
  };
12
13
  export declare const allI18nInstances: AllI18nInstances;
13
14
  export declare const getI18nInstance: (locale: SupportedLocales) => I18n;
14
- export {};
15
15
  //# sourceMappingURL=lingui.setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lingui.setup.d.ts","sourceRoot":"","sources":["../../src/i18n/lingui.setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAG/C,OAAO,aAAa,CAAC;AAIrB,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAe/B,KAAK,eAAe,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAC;AAGnD,eAAO,MAAM,WAAW,EAAE,eAKzB,CAAC;AAEF,KAAK,gBAAgB,GAAG;KAAG,CAAC,IAAI,gBAAgB,GAAG,IAAI;CAAE,CAAC;AAE1D,eAAO,MAAM,gBAAgB,EAAE,gBAQL,CAAC;AAE3B,eAAO,MAAM,eAAe,GAAI,QAAQ,gBAAgB,KAAG,IAM1D,CAAC"}
1
+ {"version":3,"file":"lingui.setup.d.ts","sourceRoot":"","sources":["../../src/i18n/lingui.setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAK/C,OAAO,aAAa,CAAC;AAIrB,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAG/B,KAAK,eAAe,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAC;AAWnD,QAAA,MAAM,WAAW,EAAE,eAAgE,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,KAAK,gBAAgB,GAAG;KAAG,CAAC,IAAI,gBAAgB,GAAG,IAAI;CAAE,CAAC;AAE1D,eAAO,MAAM,gBAAgB,EAAE,gBAQL,CAAC;AAE3B,eAAO,MAAM,eAAe,GAAI,QAAQ,gBAAgB,KAAG,IAM1D,CAAC"}
@@ -1,18 +1,16 @@
1
1
  import { setupI18n } from '@lingui/core';
2
2
  import linguiConfig from 'lingui.config';
3
+ import * as appLoader from 'lingui.loader';
3
4
  import 'server-only';
4
5
  const { locales } = linguiConfig;
5
- async function loadCatalog(locale) {
6
- const { messages } = await import(`lang/${locale}.po`);
7
- return {
8
- [locale]: messages,
9
- };
10
- }
11
- const catalogs = await Promise.all(locales.map(loadCatalog));
12
- // transform array of catalogs into a single object
13
- export const allMessages = catalogs.reduce((acc, oneCatalog) => {
14
- return { ...acc, ...oneCatalog };
15
- }, {});
6
+ // Load catalogs via app-provided loader
7
+ const loader = appLoader;
8
+ const entries = await Promise.all(locales.map(async (l) => {
9
+ const messages = await loader.load(l);
10
+ return [l, messages];
11
+ }));
12
+ const allMessages = Object.fromEntries(entries);
13
+ export { allMessages };
16
14
  export const allI18nInstances = locales.reduce((acc, locale) => {
17
15
  const messages = allMessages[locale] ?? {};
18
16
  const i18n = setupI18n({
@@ -0,0 +1,5 @@
1
+ import type { Messages } from '@lingui/core';
2
+ export interface CatalogLoader {
3
+ load(locale: string): Promise<Messages>;
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACzC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ declare module 'lingui.loader' {
2
+ import type { Messages } from '@lingui/core';
3
+ export function load(locale: string): Promise<Messages>;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korioinc/next-core",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./ads": {
@@ -62,27 +62,26 @@
62
62
  "LICENSE"
63
63
  ],
64
64
  "devDependencies": {
65
- "@headlessui/react": "^2.2.7",
66
- "@lingui/conf": "^5.5.0",
67
- "@lingui/core": "^5.5.0",
68
- "@lingui/react": "^5.5.0",
65
+ "@headlessui/react": "^2.2.8",
66
+ "@lingui/conf": "5.5.0",
67
+ "@lingui/core": "5.5.0",
68
+ "@lingui/react": "5.5.0",
69
69
  "@tailwindcss/typography": "^0.5.16",
70
70
  "@types/negotiator": "^0.6.4",
71
- "@types/node": "^22.18.1",
71
+ "@types/node": "^22.18.3",
72
72
  "@types/react": "^19.1.12",
73
73
  "@types/react-dom": "^19.1.9",
74
74
  "eslint": "^9.35.0",
75
75
  "next-themes": "^0.4.6",
76
+ "react": "19.1.1",
77
+ "react-dom": "19.1.1",
76
78
  "tailwindcss": "^4.1.13",
77
79
  "tsc-alias": "^1.8.16",
78
80
  "tw-animate-css": "^1.3.8",
79
81
  "typescript": "^5.9.2",
80
- "react": "^19.1.0",
81
- "react-dom": "^19.1.0",
82
82
  "@korioinc/next-configs": "1.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "schema-dts": "^1.1.5",
86
85
  "@floating-ui/react": "^0.27.16",
87
86
  "@formatjs/intl-localematcher": "^0.6.1",
88
87
  "clsx": "^2.1.1",
@@ -92,9 +91,10 @@
92
91
  "localforage": "^1.10.0",
93
92
  "negotiator": "^1.0.0",
94
93
  "pretendard": "^1.3.9",
94
+ "schema-dts": "^1.1.5",
95
95
  "tailwind-merge": "^3.3.1",
96
- "valtio": "^2.0.0",
97
- "@korioinc/next-conf": "1.0.5"
96
+ "valtio": "^2.1.7",
97
+ "@korioinc/next-conf": "1.0.6"
98
98
  },
99
99
  "publishConfig": {
100
100
  "access": "public",
@@ -107,14 +107,14 @@
107
107
  },
108
108
  "author": "Korio Inc.",
109
109
  "peerDependencies": {
110
+ "@headlessui/react": ">=2.2.0",
110
111
  "@lingui/core": ">=5.0.0",
111
112
  "@lingui/react": ">=5.0.0",
112
- "@headlessui/react": ">=2.2.0",
113
113
  "next": ">=15",
114
114
  "next-themes": ">=0.4.5",
115
- "tailwindcss": ">=4.0.0",
116
115
  "react": ">=19",
117
- "react-dom": ">=19"
116
+ "react-dom": ">=19",
117
+ "tailwindcss": ">=4.0.0"
118
118
  },
119
119
  "scripts": {
120
120
  "build": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json && cp -r src/styles dist/ && cp -r src/types dist/",