@payloadcms/tanstack-start 4.0.0-internal.9726517 → 4.0.0-internal.a6582c6
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/exports/client.d.ts +0 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +0 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +1 -3
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +0 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/rsc.browser.d.ts +4 -1
- package/dist/exports/rsc.browser.d.ts.map +1 -1
- package/dist/exports/rsc.browser.js +4 -1
- package/dist/exports/rsc.browser.js.map +1 -1
- package/dist/exports/rsc.d.ts +0 -1
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +0 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/server.d.ts +0 -1
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +0 -1
- package/dist/exports/server.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts +24 -2
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +6 -0
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/routes/adminRoutes.d.ts +3 -2
- package/dist/routes/adminRoutes.d.ts.map +1 -1
- package/dist/routes/adminRoutes.js +26 -36
- package/dist/routes/adminRoutes.js.map +1 -1
- package/dist/routes/layoutRoute.d.ts.map +1 -1
- package/dist/routes/layoutRoute.js +1 -0
- package/dist/routes/layoutRoute.js.map +1 -1
- package/dist/utilities/getRequestLocale.d.ts.map +1 -1
- package/dist/utilities/getRequestLocale.js +1 -2
- package/dist/utilities/getRequestLocale.js.map +1 -1
- package/dist/utilities/handleServerFunctions.d.ts +1 -19
- package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
- package/dist/utilities/handleServerFunctions.js +8 -56
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/loadAdminPage.d.ts.map +1 -1
- package/dist/utilities/loadAdminPage.js +3 -11
- package/dist/utilities/loadAdminPage.js.map +1 -1
- package/dist/withPayload/importProtection.d.ts.map +1 -1
- package/dist/withPayload/importProtection.js +2 -2
- package/dist/withPayload/importProtection.js.map +1 -1
- package/dist/withPayload/workarounds/stripDistStyleImports.js +1 -1
- package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -1
- package/package.json +5 -5
- package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
- package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
- package/dist/elements/DocumentHeaderClient/index.js +0 -116
- package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
- package/dist/elements/RenderComponent/index.d.ts +0 -10
- package/dist/elements/RenderComponent/index.d.ts.map +0 -1
- package/dist/elements/RenderComponent/index.js +0 -12
- package/dist/elements/RenderComponent/index.js.map +0 -1
- package/dist/layouts/Root/index.d.ts +0 -32
- package/dist/layouts/Root/index.d.ts.map +0 -1
- package/dist/layouts/Root/index.js +0 -53
- package/dist/layouts/Root/index.js.map +0 -1
- package/dist/rsc/renderPayloadRSC.d.ts +0 -6
- package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
- package/dist/rsc/renderPayloadRSC.js +0 -6
- package/dist/rsc/renderPayloadRSC.js.map +0 -1
- package/dist/utilities/getPreferences.d.ts +0 -10
- package/dist/utilities/getPreferences.d.ts.map +0 -1
- package/dist/utilities/getPreferences.js +0 -33
- package/dist/utilities/getPreferences.js.map +0 -1
- package/dist/utilities/importMap.server.d.ts +0 -8
- package/dist/utilities/importMap.server.d.ts.map +0 -1
- package/dist/utilities/importMap.server.js +0 -11
- package/dist/utilities/importMap.server.js.map +0 -1
- package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
- package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
- package/dist/utilities/serverFunctionHandlers.js +0 -17
- package/dist/utilities/serverFunctionHandlers.js.map +0 -1
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ProgressBar, RootProvider } from '@payloadcms/ui';
|
|
3
|
-
import { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import '@payloadcms/ui/scss/app.scss';
|
|
6
|
-
import { TanStackRouterAdapter } from '../../elements/RouterAdapter/index.js';
|
|
7
|
-
export function RootLayout({ children, data, serverFunction }) {
|
|
8
|
-
const dir = getLanguageDir({
|
|
9
|
-
languageCode: data.languageCode
|
|
10
|
-
});
|
|
11
|
-
return /*#__PURE__*/ _jsxs("html", {
|
|
12
|
-
"data-theme": data.theme,
|
|
13
|
-
dir: dir,
|
|
14
|
-
lang: data.languageCode,
|
|
15
|
-
suppressHydrationWarning: true,
|
|
16
|
-
children: [
|
|
17
|
-
/*#__PURE__*/ _jsx("head", {
|
|
18
|
-
children: /*#__PURE__*/ _jsx("style", {
|
|
19
|
-
children: `@layer payload-default, payload;`
|
|
20
|
-
})
|
|
21
|
-
}),
|
|
22
|
-
/*#__PURE__*/ _jsxs("body", {
|
|
23
|
-
children: [
|
|
24
|
-
/*#__PURE__*/ _jsxs(RootProvider, {
|
|
25
|
-
config: data.clientConfig,
|
|
26
|
-
dateFNSKey: data.dateFNSKey,
|
|
27
|
-
fallbackLang: data.fallbackLang,
|
|
28
|
-
highContrastMode: false,
|
|
29
|
-
isNavOpen: data.isNavOpen,
|
|
30
|
-
languageCode: data.languageCode,
|
|
31
|
-
languageOptions: data.languageOptions,
|
|
32
|
-
locale: data.locale,
|
|
33
|
-
permissions: data.user ? data.permissions : null,
|
|
34
|
-
RouterAdapter: TanStackRouterAdapter,
|
|
35
|
-
serverFunction: serverFunction,
|
|
36
|
-
theme: data.theme,
|
|
37
|
-
translations: data.translations,
|
|
38
|
-
user: data.user,
|
|
39
|
-
children: [
|
|
40
|
-
/*#__PURE__*/ _jsx(ProgressBar, {}),
|
|
41
|
-
children
|
|
42
|
-
]
|
|
43
|
-
}),
|
|
44
|
-
/*#__PURE__*/ _jsx("div", {
|
|
45
|
-
id: "portal"
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/layouts/Root/index.tsx"],"sourcesContent":["import type { AcceptedLanguages, I18nClient } from '@payloadcms/translations'\nimport type { Theme } from '@payloadcms/ui'\nimport type {\n ClientConfig,\n LanguageOptions,\n SanitizedPermissions,\n ServerFunctionClient,\n User,\n} from 'payload'\n\nimport { ProgressBar, RootProvider } from '@payloadcms/ui'\nimport { getLanguageDir } from '@payloadcms/ui/utilities/getLanguageDir'\nimport React from 'react'\nimport '@payloadcms/ui/scss/app.scss'\n\nimport { TanStackRouterAdapter } from '../../elements/RouterAdapter/index.js'\n\nexport type RootLayoutData = {\n clientConfig: ClientConfig\n dateFNSKey: I18nClient['dateFNSKey']\n fallbackLang: string\n isNavOpen: boolean\n languageCode: string\n languageOptions: LanguageOptions\n locale?: string\n permissions: SanitizedPermissions\n /**\n * Custom admin provider tree (`config.admin.components.providers`) nested\n * around the router `<Outlet />`. Built unrendered by `getLayoutData`; the\n * layout server function renders it to an RSC payload before it reaches the\n * client. `undefined` when no custom providers are configured.\n */\n providers?: React.ReactNode\n theme: Theme\n translations: I18nClient['translations']\n user: null | User\n}\n\nexport type RootLayoutProps = {\n readonly children: React.ReactNode\n readonly data: RootLayoutData\n readonly serverFunction: ServerFunctionClient\n}\n\nexport function RootLayout({ children, data, serverFunction }: RootLayoutProps) {\n const dir = getLanguageDir({ languageCode: data.languageCode })\n\n return (\n <html data-theme={data.theme} dir={dir} lang={data.languageCode} suppressHydrationWarning>\n <head>\n <style>{`@layer payload-default, payload;`}</style>\n </head>\n <body>\n <RootProvider\n config={data.clientConfig}\n dateFNSKey={data.dateFNSKey}\n fallbackLang={data.fallbackLang as AcceptedLanguages}\n highContrastMode={false}\n isNavOpen={data.isNavOpen}\n languageCode={data.languageCode}\n languageOptions={data.languageOptions}\n locale={data.locale}\n permissions={(data.user ? data.permissions : null) as unknown as SanitizedPermissions}\n RouterAdapter={TanStackRouterAdapter}\n serverFunction={serverFunction}\n theme={data.theme}\n translations={data.translations}\n user={data.user}\n >\n <ProgressBar />\n {children}\n </RootProvider>\n <div id=\"portal\" />\n </body>\n </html>\n )\n}\n"],"names":["ProgressBar","RootProvider","getLanguageDir","React","TanStackRouterAdapter","RootLayout","children","data","serverFunction","dir","languageCode","html","data-theme","theme","lang","suppressHydrationWarning","head","style","body","config","clientConfig","dateFNSKey","fallbackLang","highContrastMode","isNavOpen","languageOptions","locale","permissions","user","RouterAdapter","translations","div","id"],"mappings":";AAUA,SAASA,WAAW,EAAEC,YAAY,QAAQ,iBAAgB;AAC1D,SAASC,cAAc,QAAQ,0CAAyC;AACxE,OAAOC,WAAW,QAAO;AACzB,OAAO,+BAA8B;AAErC,SAASC,qBAAqB,QAAQ,wCAAuC;AA6B7E,OAAO,SAASC,WAAW,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAmB;IAC5E,MAAMC,MAAMP,eAAe;QAAEQ,cAAcH,KAAKG,YAAY;IAAC;IAE7D,qBACE,MAACC;QAAKC,cAAYL,KAAKM,KAAK;QAAEJ,KAAKA;QAAKK,MAAMP,KAAKG,YAAY;QAAEK,wBAAwB;;0BACvF,KAACC;0BACC,cAAA,KAACC;8BAAO,CAAC,gCAAgC,CAAC;;;0BAE5C,MAACC;;kCACC,MAACjB;wBACCkB,QAAQZ,KAAKa,YAAY;wBACzBC,YAAYd,KAAKc,UAAU;wBAC3BC,cAAcf,KAAKe,YAAY;wBAC/BC,kBAAkB;wBAClBC,WAAWjB,KAAKiB,SAAS;wBACzBd,cAAcH,KAAKG,YAAY;wBAC/Be,iBAAiBlB,KAAKkB,eAAe;wBACrCC,QAAQnB,KAAKmB,MAAM;wBACnBC,aAAcpB,KAAKqB,IAAI,GAAGrB,KAAKoB,WAAW,GAAG;wBAC7CE,eAAezB;wBACfI,gBAAgBA;wBAChBK,OAAON,KAAKM,KAAK;wBACjBiB,cAAcvB,KAAKuB,YAAY;wBAC/BF,MAAMrB,KAAKqB,IAAI;;0CAEf,KAAC5B;4BACAM;;;kCAEH,KAACyB;wBAAIC,IAAG;;;;;;AAIhB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Import `RenderServerComponent` from `@payloadcms/ui/elements/RenderServerComponent` directly.
|
|
3
|
-
* This re-export will be removed in a future major version.
|
|
4
|
-
*/
|
|
5
|
-
export { RenderServerComponent as RenderRSCComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
6
|
-
//# sourceMappingURL=renderPayloadRSC.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderPayloadRSC.d.ts","sourceRoot":"","sources":["../../src/rsc/renderPayloadRSC.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,qBAAqB,IAAI,kBAAkB,EAAE,MAAM,+CAA+C,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Import `RenderServerComponent` from `@payloadcms/ui/elements/RenderServerComponent` directly.
|
|
3
|
-
* This re-export will be removed in a future major version.
|
|
4
|
-
*/ export { RenderServerComponent as RenderRSCComponent } from '@payloadcms/ui/elements/RenderServerComponent';
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=renderPayloadRSC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/rsc/renderPayloadRSC.tsx"],"sourcesContent":["/**\n * @deprecated Import `RenderServerComponent` from `@payloadcms/ui/elements/RenderServerComponent` directly.\n * This re-export will be removed in a future major version.\n */\nexport { RenderServerComponent as RenderRSCComponent } from '@payloadcms/ui/elements/RenderServerComponent'\n"],"names":["RenderServerComponent","RenderRSCComponent"],"mappings":"AAAA;;;CAGC,GACD,SAASA,yBAAyBC,kBAAkB,QAAQ,gDAA+C"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DefaultDocumentIDType, Payload } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Fetches a user's preference by key. Unlike the Next.js version, this does not
|
|
4
|
-
* use `React.cache()` since TanStack Start has no RSC request-level memoization.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getPreferences<T>(key: string, payload: Payload, userID: DefaultDocumentIDType, userSlug: string): Promise<{
|
|
7
|
-
id: DefaultDocumentIDType;
|
|
8
|
-
value: T;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=getPreferences.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPreferences.d.ts","sourceRoot":"","sources":["../../src/utilities/getPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE7D;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,EAAE,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CA8BlD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetches a user's preference by key. Unlike the Next.js version, this does not
|
|
3
|
-
* use `React.cache()` since TanStack Start has no RSC request-level memoization.
|
|
4
|
-
*/ export async function getPreferences(key, payload, userID, userSlug) {
|
|
5
|
-
const result = await payload.find({
|
|
6
|
-
collection: 'payload-preferences',
|
|
7
|
-
depth: 0,
|
|
8
|
-
limit: 1,
|
|
9
|
-
pagination: false,
|
|
10
|
-
where: {
|
|
11
|
-
and: [
|
|
12
|
-
{
|
|
13
|
-
key: {
|
|
14
|
-
equals: key
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
'user.relationTo': {
|
|
19
|
-
equals: userSlug
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
'user.value': {
|
|
24
|
-
equals: userID
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}).then((res)=>res.docs?.[0]);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=getPreferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getPreferences.ts"],"sourcesContent":["import type { DefaultDocumentIDType, Payload } from 'payload'\n\n/**\n * Fetches a user's preference by key. Unlike the Next.js version, this does not\n * use `React.cache()` since TanStack Start has no RSC request-level memoization.\n */\nexport async function getPreferences<T>(\n key: string,\n payload: Payload,\n userID: DefaultDocumentIDType,\n userSlug: string,\n): Promise<{ id: DefaultDocumentIDType; value: T }> {\n const result = (await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n pagination: false,\n where: {\n and: [\n {\n key: {\n equals: key,\n },\n },\n {\n 'user.relationTo': {\n equals: userSlug,\n },\n },\n {\n 'user.value': {\n equals: userID,\n },\n },\n ],\n },\n })\n .then((res) => res.docs?.[0])) as { id: DefaultDocumentIDType; value: T }\n\n return result\n}\n"],"names":["getPreferences","key","payload","userID","userSlug","result","find","collection","depth","limit","pagination","where","and","equals","then","res","docs"],"mappings":"AAEA;;;CAGC,GACD,OAAO,eAAeA,eACpBC,GAAW,EACXC,OAAgB,EAChBC,MAA6B,EAC7BC,QAAgB;IAEhB,MAAMC,SAAU,MAAMH,QACnBI,IAAI,CAAC;QACJC,YAAY;QACZC,OAAO;QACPC,OAAO;QACPC,YAAY;QACZC,OAAO;YACLC,KAAK;gBACH;oBACEX,KAAK;wBACHY,QAAQZ;oBACV;gBACF;gBACA;oBACE,mBAAmB;wBACjBY,QAAQT;oBACV;gBACF;gBACA;oBACE,cAAc;wBACZS,QAAQV;oBACV;gBACF;aACD;QACH;IACF,GACCW,IAAI,CAAC,CAACC,MAAQA,IAAIC,IAAI,EAAE,CAAC,EAAE;IAE9B,OAAOX;AACT"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the default output path for the generated import map file in a
|
|
3
|
-
* TanStack Start project. Matches the `app/_payload/` convention that Payload's
|
|
4
|
-
* import map auto-discovery probes, so the file is found without a custom
|
|
5
|
-
* `admin.importMap.importMapFile` override.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getImportMapOutputPath(rootDir?: string): string;
|
|
8
|
-
//# sourceMappingURL=importMap.server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"importMap.server.d.ts","sourceRoot":"","sources":["../../src/utilities/importMap.server.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the default output path for the generated import map file in a
|
|
4
|
-
* TanStack Start project. Matches the `app/_payload/` convention that Payload's
|
|
5
|
-
* import map auto-discovery probes, so the file is found without a custom
|
|
6
|
-
* `admin.importMap.importMapFile` override.
|
|
7
|
-
*/ export function getImportMapOutputPath(rootDir) {
|
|
8
|
-
return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=importMap.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/importMap.server.ts"],"sourcesContent":["import path from 'node:path'\n\n/**\n * Returns the default output path for the generated import map file in a\n * TanStack Start project. Matches the `app/_payload/` convention that Payload's\n * import map auto-discovery probes, so the file is found without a custom\n * `admin.importMap.importMapFile` override.\n */\nexport function getImportMapOutputPath(rootDir?: string): string {\n return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js')\n}\n"],"names":["path","getImportMapOutputPath","rootDir","resolve","process","cwd"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B;;;;;CAKC,GACD,OAAO,SAASC,uBAAuBC,OAAgB;IACrD,OAAOF,KAAKG,OAAO,CAACD,WAAWE,QAAQC,GAAG,IAAI,OAAO,YAAY;AACnE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ServerFunction } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Framework-agnostic server-function handlers the TanStack Start dispatcher
|
|
4
|
-
* registers to reach parity with the Next.js adapter
|
|
5
|
-
* (`packages/next/src/utilities/handleServerFunctions.ts`).
|
|
6
|
-
*/
|
|
7
|
-
type SwitchLanguageArgs = {
|
|
8
|
-
lang: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
12
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
13
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
14
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
15
|
-
*/
|
|
16
|
-
export declare const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>>;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=serverFunctionHandlers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serverFunctionHandlers.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AAEH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAcnF,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dispatched from `TranslationProvider` when the user switches the admin
|
|
3
|
-
* language. Writes the `<cookiePrefix>-lng` cookie via the request's
|
|
4
|
-
* `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
|
|
5
|
-
* the provider's `router.refresh()` — reads the new language.
|
|
6
|
-
*/ export const switchLanguageHandler = async ({ lang, req })=>{
|
|
7
|
-
if (!req.server) {
|
|
8
|
-
throw new Error('switch-language requires a ServerAdapter on the request');
|
|
9
|
-
}
|
|
10
|
-
const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`;
|
|
11
|
-
await req.server.setCookie(cookieName, lang, {
|
|
12
|
-
maxAge: 60 * 60 * 24 * 365,
|
|
13
|
-
path: '/'
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=serverFunctionHandlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/serverFunctionHandlers.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\n\n/**\n * Framework-agnostic server-function handlers the TanStack Start dispatcher\n * registers to reach parity with the Next.js adapter\n * (`packages/next/src/utilities/handleServerFunctions.ts`).\n */\n\ntype SwitchLanguageArgs = {\n lang: string\n}\n\n/**\n * Dispatched from `TranslationProvider` when the user switches the admin\n * language. Writes the `<cookiePrefix>-lng` cookie via the request's\n * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by\n * the provider's `router.refresh()` — reads the new language.\n */\nexport const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>> = async ({\n lang,\n req,\n}) => {\n if (!req.server) {\n throw new Error('switch-language requires a ServerAdapter on the request')\n }\n\n const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`\n\n await req.server.setCookie(cookieName, lang, {\n maxAge: 60 * 60 * 24 * 365,\n path: '/',\n })\n}\n"],"names":["switchLanguageHandler","lang","req","server","Error","cookieName","payload","config","cookiePrefix","setCookie","maxAge","path"],"mappings":"AAYA;;;;;CAKC,GACD,OAAO,MAAMA,wBAA2E,OAAO,EAC7FC,IAAI,EACJC,GAAG,EACJ;IACC,IAAI,CAACA,IAAIC,MAAM,EAAE;QACf,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,aAAa,GAAGH,IAAII,OAAO,CAACC,MAAM,CAACC,YAAY,IAAI,UAAU,IAAI,CAAC;IAExE,MAAMN,IAAIC,MAAM,CAACM,SAAS,CAACJ,YAAYJ,MAAM;QAC3CS,QAAQ,KAAK,KAAK,KAAK;QACvBC,MAAM;IACR;AACF,EAAC"}
|