@rudra-js/react 0.8.3 → 0.9.0
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/render-context.js
CHANGED
|
@@ -17,15 +17,15 @@ function formatMoney(price, currency, locale) {
|
|
|
17
17
|
}
|
|
18
18
|
export function defaultFormatPrice(product, locale) {
|
|
19
19
|
if (!Number.isFinite(product.price)) {
|
|
20
|
-
throw new TypeError(`price for SKU ${product.sku} is ${String(product.price)}, not a finite number
|
|
21
|
-
'
|
|
20
|
+
throw new TypeError(`price for SKU ${product.sku} is ${String(product.price)}, not a finite number. ` +
|
|
21
|
+
'Catalog objects must satisfy productSchema from @rudra-js/core');
|
|
22
22
|
}
|
|
23
23
|
return formatMoney(product.price, product.currency, locale);
|
|
24
24
|
}
|
|
25
25
|
export function defaultFormatBundlePrice(bundle, locale) {
|
|
26
26
|
if (!Number.isFinite(bundle.price)) {
|
|
27
|
-
throw new TypeError(`price for bundle ${bundle.id} is ${String(bundle.price)}, not a finite number
|
|
28
|
-
'
|
|
27
|
+
throw new TypeError(`price for bundle ${bundle.id} is ${String(bundle.price)}, not a finite number. ` +
|
|
28
|
+
'Bundle objects must satisfy bundleSchema from @rudra-js/core');
|
|
29
29
|
}
|
|
30
30
|
return formatMoney(bundle.price, bundle.currency, locale);
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-context.js","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,YAAY,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,QAAsC,EACtC,GAAW;IAEX,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,OAAO,EAAE,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,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AAQ,EAAE,CAAC,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,MAAe;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,SAAS,CACjB,iBAAiB,OAAO,CAAC,GAAG,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB;YAC/E,gEAAgE,CACnE,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAc,EAAE,MAAe;IACtE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,SAAS,CACjB,oBAAoB,MAAM,CAAC,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB;YAC/E,8DAA8D,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rudra-js/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "React renderer for rudra-js: renders an LLM-designed product-recommendation block from your own catalog, on the server or in the browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rudra-js",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@rudra-js/core": "^0.
|
|
57
|
+
"@rudra-js/core": "^0.9.0",
|
|
58
58
|
"react": "^18.2.0 || ^19.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@rudra-js/core": "0.
|
|
61
|
+
"@rudra-js/core": "0.9.0",
|
|
62
62
|
"@types/react": "^19.3.0",
|
|
63
63
|
"@types/react-dom": "^19.3.0",
|
|
64
64
|
"react": "^19.3.1",
|
package/src/render-context.ts
CHANGED
|
@@ -33,8 +33,8 @@ function formatMoney(price: number, currency: string, locale?: string): string {
|
|
|
33
33
|
export function defaultFormatPrice(product: Product, locale?: string): string {
|
|
34
34
|
if (!Number.isFinite(product.price)) {
|
|
35
35
|
throw new TypeError(
|
|
36
|
-
`price for SKU ${product.sku} is ${String(product.price)}, not a finite number
|
|
37
|
-
'
|
|
36
|
+
`price for SKU ${product.sku} is ${String(product.price)}, not a finite number. ` +
|
|
37
|
+
'Catalog objects must satisfy productSchema from @rudra-js/core',
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
return formatMoney(product.price, product.currency, locale);
|
|
@@ -43,8 +43,8 @@ export function defaultFormatPrice(product: Product, locale?: string): string {
|
|
|
43
43
|
export function defaultFormatBundlePrice(bundle: Bundle, locale?: string): string {
|
|
44
44
|
if (!Number.isFinite(bundle.price)) {
|
|
45
45
|
throw new TypeError(
|
|
46
|
-
`price for bundle ${bundle.id} is ${String(bundle.price)}, not a finite number
|
|
47
|
-
'
|
|
46
|
+
`price for bundle ${bundle.id} is ${String(bundle.price)}, not a finite number. ` +
|
|
47
|
+
'Bundle objects must satisfy bundleSchema from @rudra-js/core',
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
return formatMoney(bundle.price, bundle.currency, locale);
|