@eldrajs/theme-nuxt 0.4.6 → 0.4.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.
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@ Release-please writes the generated notes from commit messages and does not repl
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
- **Selling in more than one currency (WS-1391).** `commerce` on `runtimeConfig.public.eldra` carries `currencies`, the currencies the store offers with its own first, when it offers more than one (a one-currency store's config is unchanged). New server route `GET /_eldra/visitor` answers `{ country }` from Cloudflare's `CF-IPCountry` header, `private, no-store`, so a prerendered page can start a first-time visitor in their country's currency; it answers `null` off Cloudflare.
|
|
8
9
|
- **Campaign landings are captured (WS-546).** A client plugin calls `@eldrajs/sdk`'s
|
|
9
10
|
`captureCampaignAttribution` on the first page and after every navigation, so a theme's cart adds
|
|
10
11
|
carry the campaign a visitor came from (`utm_*` tags only, one `localStorage` key, 30 days). New
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdirSync, existsSync, readFileSync, writeFileSync, copyFileSync, cpSync } from 'node:fs';
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
|
-
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addImports } from '@nuxt/kit';
|
|
4
|
-
import { createEldraClient, resolvePagePath, parseDynamicRoutePattern, catalogRouteTarget, buildDynamicRoutePath, normalizeThemeDesignTokens, EldraClientError, stripStega } from '@eldrajs/theme-core';
|
|
3
|
+
import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addServerHandler, addImports } from '@nuxt/kit';
|
|
4
|
+
import { VISITOR_COUNTRY_PATH, createEldraClient, resolvePagePath, parseDynamicRoutePattern, catalogRouteTarget, buildDynamicRoutePath, normalizeThemeDesignTokens, EldraClientError, stripStega } from '@eldrajs/theme-core';
|
|
5
5
|
import { createEldraClient as createEldraClient$1 } from '@eldrajs/sdk';
|
|
6
6
|
import eldraTheme from '@eldrajs/vite-plugin-theme';
|
|
7
7
|
import { listCatalogDocs, catalogDocRouteRefs } from '../dist/runtime/catalog.js';
|
|
@@ -127,6 +127,11 @@ const eldraModule = defineNuxtModule({
|
|
|
127
127
|
};
|
|
128
128
|
const buildToken = (process.env.ELDRA_BUILD_TOKEN ?? "").trim();
|
|
129
129
|
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
130
|
+
addServerHandler({
|
|
131
|
+
route: VISITOR_COUNTRY_PATH,
|
|
132
|
+
method: "get",
|
|
133
|
+
handler: resolver.resolve("./runtime/server/visitor")
|
|
134
|
+
});
|
|
130
135
|
addPlugin(resolver.resolve("./runtime/analyticsPlugin"));
|
|
131
136
|
if (options.campaignAttribution !== false) {
|
|
132
137
|
addPlugin({ src: resolver.resolve("./runtime/attributionPlugin"), mode: "client" });
|
package/dist/runtime/commerce.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { offeredCurrencies } from "@eldrajs/theme-core";
|
|
1
2
|
export const NO_CURRENCY_WARNING = "[eldra] the store publishes no currency \u2014 prices render as plain numbers";
|
|
2
3
|
export const READ_TIMEOUT_MS = 1e4;
|
|
3
4
|
export async function readStoreCommerce(reader, warn = console.warn) {
|
|
@@ -33,7 +34,8 @@ function toStoreCommerce(value) {
|
|
|
33
34
|
const { currency, taxInclusivePricing, defaultTaxRate } = value;
|
|
34
35
|
if (typeof currency !== "string" || currency === "") return null;
|
|
35
36
|
if (typeof taxInclusivePricing !== "boolean" || typeof defaultTaxRate !== "number") return null;
|
|
36
|
-
|
|
37
|
+
const currencies = offeredCurrencies(currency, value.currencies);
|
|
38
|
+
return currencies.length > 1 ? { currency, taxInclusivePricing, defaultTaxRate, currencies } : { currency, taxInclusivePricing, defaultTaxRate };
|
|
37
39
|
}
|
|
38
40
|
function describe(error) {
|
|
39
41
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { defineEventHandler, getRequestHeader, setResponseHeader } from "h3";
|
|
2
|
+
import { countryFromHeader } from "@eldrajs/theme-core";
|
|
3
|
+
export default defineEventHandler((event) => {
|
|
4
|
+
setResponseHeader(event, "cache-control", "private, no-store");
|
|
5
|
+
return { country: countryFromHeader(getRequestHeader(event, "cf-ipcountry")) };
|
|
6
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/theme-nuxt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Nuxt module for Eldra themes: wires @eldrajs/vite-plugin-theme, the gateway client, draft overlays and the Studio preview bridge into a Nuxt 4 site.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -50,10 +50,11 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/kit": "^4.0.0",
|
|
52
52
|
"defu": "^6.1.4",
|
|
53
|
-
"
|
|
54
|
-
"@eldrajs/theme-
|
|
55
|
-
"@eldrajs/
|
|
56
|
-
"@eldrajs/theme-
|
|
53
|
+
"h3": "^1.15.0",
|
|
54
|
+
"@eldrajs/theme-core": "^0.3.5",
|
|
55
|
+
"@eldrajs/sdk": "^0.5.3",
|
|
56
|
+
"@eldrajs/theme-vue": "^0.2.6",
|
|
57
|
+
"@eldrajs/vite-plugin-theme": "^0.3.5"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@nuxt/module-builder": "^0.8.4",
|