@jotul/jotul-widgets 1.1.0 → 1.2.1
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/JotulWidget.css +1 -1
- package/dist/JotulWidget.d.ts +2 -2
- package/dist/JotulWidget.js +10 -7
- package/dist/api.js +12 -0
- package/dist/components/FindDealerDrawerWidget.d.ts +5 -2
- package/dist/components/FindDealerDrawerWidget.js +21 -22
- package/dist/components/ProductPageWidget.d.ts +5 -2
- package/dist/components/ProductPageWidget.js +26 -39
- package/dist/components/product-page/CampaignStatus.d.ts +6 -0
- package/dist/components/product-page/CampaignStatus.js +48 -0
- package/dist/components/product-page/DealerList.d.ts +4 -2
- package/dist/components/product-page/DealerList.js +14 -8
- package/dist/components/product-page/StatusBanner.d.ts +1 -1
- package/dist/components/product-page/StatusBanner.js +3 -1
- package/dist/i18n/locales/cz.json +5 -1
- package/dist/i18n/locales/de.json +5 -1
- package/dist/i18n/locales/en.json +5 -1
- package/dist/i18n/locales/fi.json +5 -1
- package/dist/i18n/locales/fr.json +5 -1
- package/dist/i18n/locales/nl.json +5 -1
- package/dist/i18n/locales/no.json +5 -1
- package/dist/i18n/locales/pl.json +5 -1
- package/dist/i18n/locales/se.json +5 -1
- package/dist/i18n/widgetStrings.d.ts +4 -0
- package/dist/images/dealer-pin-ildstedet.svg +31 -0
- package/dist/images/ildstedet-dealer.svg +702 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +18 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +12 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { checkWidgetAuthorization, DEFAULT_WIDGET_LOCALE_TAG, normalizeWidgetLocale, resolveWidgetUiLocale, searchDealersByCoordinates, searchDealersByPostalCode, JotulWidget, type CheckWidgetAuthorizationOptions, type DealerSearchResponse, type JotulWidgetButtonStyling, type JotulWidgetLocale, type JotulWidgetProps, type JotulWidgetStyling, type JotulWidgetType, type WidgetAuthClientResponse, } from './JotulWidget';
|
|
1
|
+
export { checkWidgetAuthorization, DEFAULT_WIDGET_LOCALE_TAG, normalizeWidgetLocale, resolveWidgetUiLocale, searchDealersByCoordinates, searchDealersByPostalCode, JotulWidget, type CheckWidgetAuthorizationOptions, type DealerSearchResponse, type JotulWidgetBorderStyling, type JotulWidgetButtonStyling, type JotulWidgetLocale, type JotulWidgetProps, type JotulWidgetStyling, type JotulWidgetType, type WidgetAuthClientResponse, } from './JotulWidget';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
export type JotulWidgetType = 'productPage' | 'findDealerDrawer' | 'dealerFinder' | 'warrantyForm';
|
|
3
|
+
export type JotulWidgetScope = 'ildstedet';
|
|
3
4
|
export type WidgetAuthClientResponse = {
|
|
4
5
|
apiVersion?: string;
|
|
5
6
|
ok: boolean;
|
|
@@ -22,6 +23,13 @@ export type DealerSearchResponse = {
|
|
|
22
23
|
};
|
|
23
24
|
total?: number;
|
|
24
25
|
dealers?: Array<Record<string, unknown>>;
|
|
26
|
+
campaign?: {
|
|
27
|
+
name?: string | null;
|
|
28
|
+
slug?: string | null;
|
|
29
|
+
salesMessage?: string | null;
|
|
30
|
+
from?: string | null;
|
|
31
|
+
to?: string | null;
|
|
32
|
+
} | null;
|
|
25
33
|
error?: string;
|
|
26
34
|
};
|
|
27
35
|
export type LocationSuggestion = {
|
|
@@ -42,7 +50,10 @@ export type CheckWidgetAuthorizationOptions = {
|
|
|
42
50
|
locale?: string;
|
|
43
51
|
/** ISO 3166-1 alpha-2 market/country (e.g. `NO`, `SE`) sent to the API as `market`. */
|
|
44
52
|
market?: string;
|
|
53
|
+
scope?: JotulWidgetScope;
|
|
45
54
|
brands?: string[];
|
|
55
|
+
/** Optional Sanity campaign slug used to limit dealer results to campaign dealers. */
|
|
56
|
+
campaignSlug?: string;
|
|
46
57
|
};
|
|
47
58
|
/** CSS values for primary CTAs; also used for map cluster bubbles (`backgroundColor` fill, `textColor` on the count). */
|
|
48
59
|
export type JotulWidgetButtonStyling = {
|
|
@@ -50,8 +61,12 @@ export type JotulWidgetButtonStyling = {
|
|
|
50
61
|
backgroundColor?: string;
|
|
51
62
|
textColor?: string;
|
|
52
63
|
};
|
|
64
|
+
export type JotulWidgetBorderStyling = {
|
|
65
|
+
borderColor?: string;
|
|
66
|
+
};
|
|
53
67
|
export type JotulWidgetStyling = {
|
|
54
68
|
button?: JotulWidgetButtonStyling;
|
|
69
|
+
border?: JotulWidgetBorderStyling;
|
|
55
70
|
};
|
|
56
71
|
export type WidgetTriggerRenderProps = {
|
|
57
72
|
onOpen: () => void;
|
|
@@ -69,7 +84,10 @@ export type JotulWidgetProps = {
|
|
|
69
84
|
locale?: string;
|
|
70
85
|
/** ISO 3166-1 alpha-2 market filter for dealers and geocoder country bias (`NO`, `SE`, …). */
|
|
71
86
|
market?: string;
|
|
87
|
+
scope?: JotulWidgetScope;
|
|
72
88
|
brands?: string[];
|
|
89
|
+
/** Optional Sanity campaign slug used to limit dealer results to campaign dealers. */
|
|
90
|
+
campaignSlug?: string;
|
|
73
91
|
styling?: JotulWidgetStyling;
|
|
74
92
|
/**
|
|
75
93
|
* Optional custom trigger for widgets with an open action (`productPage`, `findDealerDrawer`).
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const VALID_WIDGET_TYPES: JotulWidgetType[];
|
|
|
4
4
|
export declare function isWidgetType(value: string | undefined): value is JotulWidgetType;
|
|
5
5
|
export declare function asText(value: unknown): string | null;
|
|
6
6
|
export declare function formatDistance(dealer: DealerRecord): string | null;
|
|
7
|
+
export declare function isExclusiveDealer(dealer: DealerRecord): boolean;
|
|
7
8
|
export declare function getDealerKey(dealer: DealerRecord, index: number): string;
|
|
8
9
|
export declare function getDealerName(dealer: DealerRecord, unknownLabel: string): string;
|
|
9
10
|
/** True when the tapped map pin matches a dealer already in the current successful search payload. */
|
package/dist/utils.js
CHANGED
|
@@ -24,6 +24,18 @@ export function formatDistance(dealer) {
|
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
+
export function isExclusiveDealer(dealer) {
|
|
28
|
+
const rawExclusive = dealer.exclusive;
|
|
29
|
+
return (rawExclusive === true ||
|
|
30
|
+
rawExclusive === 1 ||
|
|
31
|
+
rawExclusive === '1' ||
|
|
32
|
+
rawExclusive === 'true' ||
|
|
33
|
+
rawExclusive === 'TRUE' ||
|
|
34
|
+
rawExclusive === 'yes' ||
|
|
35
|
+
rawExclusive === 'YES' ||
|
|
36
|
+
rawExclusive === 'y' ||
|
|
37
|
+
rawExclusive === 'Y');
|
|
38
|
+
}
|
|
27
39
|
export function getDealerKey(dealer, index) {
|
|
28
40
|
return String(dealer.dealerId ?? dealer.name ?? index);
|
|
29
41
|
}
|