@dev.smartpricing/platform-layer 0.0.6 → 0.0.7

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.
@@ -16,3 +16,29 @@ export function isPublicAuthRoute(pathname: string): boolean {
16
16
  if (!pathname.startsWith('/auth/')) return false
17
17
  return !AUTHENTICATED_AUTH_PATHS.some(p => pathname.startsWith(p))
18
18
  }
19
+
20
+ /**
21
+ * Reads a cookie value by name from `document.cookie`. Returns `undefined` when
22
+ * the cookie is absent or `document` is unavailable (SSR/build). Mirrors the
23
+ * reader in `apps/frontend/app/composables/useRest.ts`.
24
+ */
25
+ export function readCookie(name: string): string | undefined {
26
+ if (typeof document === 'undefined') return undefined
27
+ const prefix = `${name}=`
28
+ for (const part of document.cookie.split('; ')) {
29
+ if (part.startsWith(prefix)) return decodeURIComponent(part.slice(prefix.length))
30
+ }
31
+ return undefined
32
+ }
33
+
34
+ /**
35
+ * Resolves the environment-scoped CSRF cookie name: prod keeps the bare base
36
+ * name, every other environment gets a `_<env>` suffix so sessions from
37
+ * different environments don't collide on the shared `.smartness.com` domain.
38
+ *
39
+ * Must stay in sync with the backend's `envScopedCookieName`
40
+ * (`apps/backend/src/utils/env.ts`).
41
+ */
42
+ export function envScopedCsrfCookieName(baseName: string, environment: string): string {
43
+ return environment === 'prod' ? baseName : `${baseName}_${environment}`
44
+ }
package/nuxt.config.ts CHANGED
@@ -33,7 +33,10 @@ export default defineNuxtConfig({
33
33
  strictMessage: false,
34
34
  },
35
35
  detectBrowserLanguage: {
36
- useCookie: true,
36
+ useCookie: true,
37
+ cookieKey: "smt_lang",
38
+ fallbackLocale: "en",
39
+ cookieDomain: ".smartness.com",
37
40
  },
38
41
  },
39
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev.smartpricing/platform-layer",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./nuxt.config.ts",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "nuxt": "^4.4.2",
22
- "nuxt-ui-layer": "github:smartpricing/smartness-nuxt-ui#v1.7.1-platform.1",
22
+ "nuxt-ui-layer": "github:smartpricing/smartness-nuxt-ui#v1.7.2",
23
23
  "vue": "latest"
24
24
  },
25
25
  "peerDependencies": {