@admin-layout/client 12.2.5-alpha.36 → 12.2.5-alpha.37
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/lib/components/UpdateSettings/UpdateSettings.cookie.server.test.d.ts +2 -0
- package/lib/components/UpdateSettings/UpdateSettings.cookie.server.test.d.ts.map +1 -0
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts +6 -2
- package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -1
- package/lib/components/UpdateSettings/UpdateSettings.server.js +8 -4
- package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateSettings.cookie.server.test.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.cookie.server.test.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cookie configuration for storing user settings
|
|
3
3
|
* - Max age: 30 days
|
|
4
|
-
* -
|
|
5
|
-
*
|
|
4
|
+
* - HttpOnly: page scripts cannot read it. The browser gets these values from
|
|
5
|
+
* the `/resources/settings` loader (`modifiedSettings`), never from `document.cookie`.
|
|
6
|
+
* - Secure and domain-scoped in production (HTTPS only, shared across subdomains)
|
|
6
7
|
*/
|
|
7
8
|
export declare const settingsCookie: import("@remix-run/node").Cookie;
|
|
8
9
|
/**
|
|
@@ -31,6 +32,8 @@ export declare function fetchPageSettingsWithFetch(request: Request, overrideIde
|
|
|
31
32
|
* @returns Object containing merged settings and cookie string
|
|
32
33
|
* @returns settings - Fully merged settings (GraphQL + env + cookies + request payload)
|
|
33
34
|
* @returns setCookie - Cookie string to set in response headers
|
|
35
|
+
* @returns cookieSettings - What the settings cookie holds (the user's own changes), for the
|
|
36
|
+
* browser to read through `/resources/settings` now that the cookie is HttpOnly
|
|
34
37
|
*
|
|
35
38
|
* @remarks
|
|
36
39
|
* This utility handles both loader (GET) and action (POST/PUT/DELETE) requests:
|
|
@@ -64,6 +67,7 @@ export declare function settingsLoaderUtil({ request, context, params }: {
|
|
|
64
67
|
}): Promise<{
|
|
65
68
|
settings: any;
|
|
66
69
|
setCookie: string;
|
|
70
|
+
cookieSettings: any;
|
|
67
71
|
}>;
|
|
68
72
|
export declare function getDeviceType(userAgent: string): 'mobile' | 'desktop';
|
|
69
73
|
//# sourceMappingURL=UpdateSettings.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"AAiBA
|
|
1
|
+
{"version":3,"file":"UpdateSettings.server.d.ts","sourceRoot":"","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,kCAOzB,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAAE,MAAM;;GAoG7F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;;;;CAAA;;;;GA4HpE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAQrE"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {createCookie}from'@remix-run/node';import {ConfigCollectionName,ConfigFragmentName,ConfigurationSchemaId}from'common';import {GetPageSettingsDocument}from'common/graphql';import {merge}from'lodash-es';import {print}from'graphql';import {parseEnvLayoutSettings}from'../../utils/parseEnvUiLayoutSettings.js';import {config}from'../../config/env-config.js';import {DEFAULT_SETTINGS}from'../../config/defaultSettings.js';import {generateCdecodeUri,DEFAULT_CONTRIBUTION_TENANT_ID}from'@adminide-stack/core';/**
|
|
2
2
|
* Cookie configuration for storing user settings
|
|
3
3
|
* - Max age: 30 days
|
|
4
|
-
* -
|
|
5
|
-
*
|
|
4
|
+
* - HttpOnly: page scripts cannot read it. The browser gets these values from
|
|
5
|
+
* the `/resources/settings` loader (`modifiedSettings`), never from `document.cookie`.
|
|
6
|
+
* - Secure and domain-scoped in production (HTTPS only, shared across subdomains)
|
|
6
7
|
*/
|
|
7
8
|
const settingsCookie = createCookie('settings', {
|
|
8
9
|
maxAge: 60 * 60 * 24 * 30, // 1 month
|
|
9
|
-
httpOnly:
|
|
10
|
+
httpOnly: true,
|
|
11
|
+
secure: config.isProd,
|
|
10
12
|
sameSite: 'lax',
|
|
11
13
|
path: '/', // Ensure cookie is available for all paths
|
|
12
14
|
domain: config.isProd ? config.APP_DOMAIN : undefined,
|
|
@@ -110,6 +112,8 @@ async function fetchPageSettingsWithFetch(request, overrideIdentifier) {
|
|
|
110
112
|
* @returns Object containing merged settings and cookie string
|
|
111
113
|
* @returns settings - Fully merged settings (GraphQL + env + cookies + request payload)
|
|
112
114
|
* @returns setCookie - Cookie string to set in response headers
|
|
115
|
+
* @returns cookieSettings - What the settings cookie holds (the user's own changes), for the
|
|
116
|
+
* browser to read through `/resources/settings` now that the cookie is HttpOnly
|
|
113
117
|
*
|
|
114
118
|
* @remarks
|
|
115
119
|
* This utility handles both loader (GET) and action (POST/PUT/DELETE) requests:
|
|
@@ -233,7 +237,7 @@ async function settingsLoaderUtil({ request, context, params }) {
|
|
|
233
237
|
// 10. Serialize cookie settings for response headers
|
|
234
238
|
const cookie = await settingsCookie.serialize(cookieUpdatedSettings);
|
|
235
239
|
console.log('✅ FULL_SETTINGS prepared:', Object.keys(fullSettings).length, 'keys');
|
|
236
|
-
return { settings: fullSettings, setCookie: cookie };
|
|
240
|
+
return { settings: fullSettings, setCookie: cookie, cookieSettings: cookieUpdatedSettings ?? {} };
|
|
237
241
|
}
|
|
238
242
|
function getDeviceType(userAgent) {
|
|
239
243
|
if (!userAgent)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateSettings.server.js","sources":["../../../src/components/UpdateSettings/UpdateSettings.server.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AA4CG,IAAA,MAAA,EAAA,MAAA,CAAA,MAAA;AACH,IAAA,QAAA,EAAA,KAAA;;AAoGC,IAAA,MAAA,EAAA,MAAA,CAAA,MAAA,GAAA,MAAA,CAAA,UAAA,GAAA,SAAA;AAED,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCG,QAAA,WAAA,EAAA,QAAA;AACH,QAAA,OAAA;;;;AAAqE;;;;AA4HpE,QAAA,MAAA,EAAA,UAAA;AAED,QAAA,OAAA,EAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "12.2.5-alpha.
|
|
3
|
+
"version": "12.2.5-alpha.37",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"typescript": {
|
|
45
45
|
"definition": "lib/index.d.ts"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "eaffb5a47fc48db0d70699630ca7ad13349fccc8"
|
|
48
48
|
}
|