@jotul/jotul-widgets 1.0.2 → 1.0.4
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/README.md +13 -0
- package/dist/JotulWidget.css +1 -1
- package/dist/JotulWidget.d.ts +2 -2
- package/dist/JotulWidget.js +53 -17
- package/dist/components/ProductPageWidget.d.ts +4 -1
- package/dist/components/ProductPageWidget.js +169 -4
- package/dist/components/product-page/DealerList.d.ts +9 -1
- package/dist/components/product-page/DealerList.js +27 -3
- package/dist/components/product-page/InquiryForm.d.ts +2 -1
- package/dist/components/product-page/InquiryForm.js +4 -2
- package/dist/components/product-page/LocationSearch.d.ts +2 -1
- package/dist/components/product-page/LocationSearch.js +18 -3
- package/dist/i18n/locales/cz.json +41 -0
- package/dist/i18n/locales/de.json +41 -0
- package/dist/i18n/locales/en.json +41 -0
- package/dist/i18n/locales/fi.json +41 -0
- package/dist/i18n/locales/fr.json +41 -0
- package/dist/i18n/locales/nl.json +41 -0
- package/dist/i18n/locales/no.json +41 -0
- package/dist/i18n/locales/pl.json +41 -0
- package/dist/i18n/locales/se.json +41 -0
- package/dist/i18n/widgetStrings.d.ts +7 -5
- package/dist/i18n/widgetStrings.js +54 -148
- package/dist/images/dealer-pin-exclusive.svg +24 -0
- package/dist/images/dealer-pin.svg +11 -0
- package/dist/images/jotul-exclusive-dealer.png +0 -0
- package/dist/types.d.ts +14 -0
- package/dist/utils.js +11 -1
- package/package.json +8 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 20">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #fff;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cls-2 {
|
|
10
|
+
fill: #2d2d2d;
|
|
11
|
+
}
|
|
12
|
+
</style>
|
|
13
|
+
</defs>
|
|
14
|
+
<path class="cls-2" d="M8,0C3.58,0,0,3.58,0,8s8,12,8,12c0,0,8-7.58,8-12S12.42,0,8,0Z"/>
|
|
15
|
+
<g>
|
|
16
|
+
<path class="cls-1" d="M6.24,9.72c.02.08.04.15.04.37,0,.11,0,.47-.2.71-.09.11-.23.19-.38.19-.24,0-.34-.18-.37-.24l.91-1.03ZM6.86,9.01s.04-.04.02-.05c-.03-.04-.24-.02-.26-.01-.01,0-.03.01-.05.04l-.11.12c-.11-.08-.31-.21-.73-.21-.78,0-1.24.56-1.24,1.29,0,.28.07.59.31.84l-.23.27s-.03.03-.02.04c0,.03.24.02.26.01.03,0,.04-.02.06-.04l.11-.13c.1.08.32.23.75.23.72,0,1.23-.52,1.23-1.3,0-.33-.09-.59-.31-.84l.21-.25ZM5.23,10.52c-.03-.08-.06-.17-.06-.43,0-.57.3-.87.6-.87.2,0,.33.14.37.26l-.91,1.04Z"/>
|
|
17
|
+
<path class="cls-1" d="M8.46,9.44v1.81c0,.06-.02.09-.09.09h-.49c-.08,0-.11-.02-.11-.09v-1.81h-.5c-.07,0-.1-.01-.1-.08v-.33s.01-.08.09-.08h1.71c.05,0,.09,0,.09.08v.33s0,.08-.09.08h-.51Z"/>
|
|
18
|
+
<path class="cls-1" d="M11.39,10.62c0,.18-.01.4-.24.57-.11.09-.34.2-.75.2-.3,0-.54-.06-.71-.17-.27-.17-.28-.39-.28-.62v-1.59c0-.05.02-.07.09-.07h.52c.07,0,.09,0,.09.08v1.54c0,.15,0,.39.38.39.34,0,.35-.25.36-.39v-1.54c0-.06.02-.08.09-.08h.36c.07,0,.1,0,.1.08v1.6h0Z"/>
|
|
19
|
+
<path class="cls-1" d="M9.2,6.46c-.05.33-.16.44-.63.97-.41.45-.33.93-.33.93-1.06-.45-1.26-1.57-1.26-1.57-.32.53-.09,1.25-.09,1.25-.25-.15-.72-.33-1.01-.49-.46-.25-.48-.52-.48-.52-.18.52.04.93.04.93,0,0-1.04-.34-.91-1.41.11-.91.85-1.33.85-1.33,0,0-.07.77.55,1.04,0,0-.06-.79.34-1.43.49-.77,1.26-1,1.6-1.03,0,0-.34.28-.28.84.06.47.29.66.26,1.26,0,0,.44-.17.65-.71.18-.46.08-.92.08-.92,0,0,.97.19,1.38.93.27.48.28,1.05.28,1.05.59-.27.49-1.04.49-1.04,0,0,.74.42.85,1.33.14,1.07-.9,1.39-.9,1.39,0,0,.24-.42.06-.93,0,0-.24.65-1.53.93,0,0,.43-.71.01-1.5Z"/>
|
|
20
|
+
<path class="cls-1" d="M12.56,10.83h.76s.09,0,.09.08v.35c0,.08-.04.08-.09.08h-1.37c-.07,0-.09-.01-.09-.09v-2.22c0-.08.05-.08.09-.08h.52c.05,0,.09,0,.09.08v1.81Z"/>
|
|
21
|
+
<path class="cls-1" d="M4.15,9.03c0-.08-.05-.08-.09-.08h-.52c-.05,0-.09,0-.09.08v1.52c0,.31-.11.38-.34.4-.21.02-.4-.11-.4-.11-.07-.05-.11-.03-.11.03v.34c0,.09.31.2.54.2.36,0,.61-.08.77-.2.15-.11.24-.25.24-.53v-1.64Z"/>
|
|
22
|
+
<path class="cls-1" d="M13.18,9.15s-.02.05-.07.05h-.03v-.09h.05s.05.01.05.04ZM13.24,9.39l-.07-.1s-.02-.04-.03-.05c.05,0,.08-.04.08-.09,0-.05-.03-.08-.11-.08h-.11v.32h.05v-.14h.02l.09.14h.06ZM13.12,8.98c.14,0,.24.11.24.25s-.11.24-.24.24-.24-.11-.24-.25.11-.24.24-.24ZM13.12,8.95c-.15,0-.28.12-.28.28s.12.28.28.28.28-.13.28-.28c0-.17-.12-.28-.28-.28Z"/>
|
|
23
|
+
</g>
|
|
24
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 20">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: #ef2b18;
|
|
7
|
+
}
|
|
8
|
+
</style>
|
|
9
|
+
</defs>
|
|
10
|
+
<path class="cls-1" d="M8,0C3.58,0,0,3.58,0,8s8,12,8,12c0,0,8-7.58,8-12S12.42,0,8,0ZM7.91,11.35c-1.8,0-3.26-1.46-3.26-3.26s1.46-3.26,3.26-3.26,3.26,1.46,3.26,3.26-1.46,3.26-3.26,3.26Z"/>
|
|
11
|
+
</svg>
|
|
Binary file
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
1
2
|
export type JotulWidgetType = 'productPage' | 'dealerFinder' | 'warrantyForm';
|
|
2
3
|
export type WidgetAuthClientResponse = {
|
|
3
4
|
apiVersion?: string;
|
|
@@ -52,6 +53,13 @@ export type JotulWidgetButtonStyling = {
|
|
|
52
53
|
export type JotulWidgetStyling = {
|
|
53
54
|
button?: JotulWidgetButtonStyling;
|
|
54
55
|
};
|
|
56
|
+
export type ProductPageTriggerRenderProps = {
|
|
57
|
+
onOpen: () => void;
|
|
58
|
+
isLoading: boolean;
|
|
59
|
+
label: string;
|
|
60
|
+
className: string;
|
|
61
|
+
style?: CSSProperties;
|
|
62
|
+
};
|
|
55
63
|
export type JotulWidgetProps = {
|
|
56
64
|
type?: string;
|
|
57
65
|
endpoint?: string;
|
|
@@ -63,6 +71,12 @@ export type JotulWidgetProps = {
|
|
|
63
71
|
market?: string;
|
|
64
72
|
brands?: string[];
|
|
65
73
|
styling?: JotulWidgetStyling;
|
|
74
|
+
/**
|
|
75
|
+
* Optional custom trigger for `productPage` widgets.
|
|
76
|
+
* - Pass a ReactNode for simple custom markup.
|
|
77
|
+
* - Pass a render function to fully control button behavior and bind `onOpen`.
|
|
78
|
+
*/
|
|
79
|
+
productPageTrigger?: ReactNode | ((props: ProductPageTriggerRenderProps) => ReactNode);
|
|
66
80
|
};
|
|
67
81
|
export type DealerRecord = Record<string, unknown>;
|
|
68
82
|
export type InquiryFormValues = {
|
package/dist/utils.js
CHANGED
|
@@ -32,7 +32,17 @@ export function getDealerName(dealer, unknownLabel) {
|
|
|
32
32
|
export function getDealerAddressLines(dealer) {
|
|
33
33
|
const address = asText(dealer.address);
|
|
34
34
|
const postalCode = asText(dealer.postalCode);
|
|
35
|
-
|
|
35
|
+
const city = asText(dealer.city);
|
|
36
|
+
const county = asText(dealer.county);
|
|
37
|
+
const normalizedCity = city?.trim().toLowerCase();
|
|
38
|
+
const normalizedCounty = county?.trim().toLowerCase();
|
|
39
|
+
const countyForDisplay = normalizedCity && normalizedCounty && normalizedCity === normalizedCounty
|
|
40
|
+
? null
|
|
41
|
+
: county;
|
|
42
|
+
const locationLine = [postalCode, city, countyForDisplay]
|
|
43
|
+
.filter((value) => !!value)
|
|
44
|
+
.join(', ');
|
|
45
|
+
return [address, locationLine || null].filter((value) => Boolean(value));
|
|
36
46
|
}
|
|
37
47
|
export function createInquiryFormValues(productName, dealerName) {
|
|
38
48
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jotul/jotul-widgets",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"sideEffects": [
|
|
@@ -19,13 +19,19 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@types/leaflet": "^1.9.21",
|
|
22
23
|
"autoprefixer": "^10.4.21",
|
|
23
24
|
"postcss": "^8.5.3",
|
|
24
25
|
"tailwindcss": "^3.4.17"
|
|
25
26
|
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"leaflet": "^1.9.4",
|
|
29
|
+
"react-leaflet": "^5.0.0"
|
|
30
|
+
},
|
|
26
31
|
"scripts": {
|
|
27
32
|
"build:css": "tailwindcss -i ./src/tw-entry.css -o ./dist/JotulWidget.css --minify",
|
|
28
|
-
"build": "
|
|
33
|
+
"build:assets": "mkdir -p ./dist/images ./dist/i18n/locales && cp -R ./src/images/. ./dist/images/ && cp -R ./src/i18n/locales/. ./dist/i18n/locales/",
|
|
34
|
+
"build": "tsc -p tsconfig.build.json && npm run build:css && npm run build:assets",
|
|
29
35
|
"clean": "rm -rf dist",
|
|
30
36
|
"watch:css": "tailwindcss -i ./src/tw-entry.css -o ./dist/JotulWidget.css --watch",
|
|
31
37
|
"watch:ts": "tsc -p tsconfig.build.json -w --preserveWatchOutput",
|