@davi-ai/retorik-map 2.0.0 → 2.0.2
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/index.d.ts +142 -108
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -28867
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +163 -28867
- package/dist/index.modern.js.map +1 -1
- package/package.json +19 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,110 +1,144 @@
|
|
|
1
|
-
import { LatLngExpression } from "leaflet";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
'
|
|
86
|
-
'
|
|
87
|
-
'
|
|
88
|
-
'
|
|
89
|
-
'
|
|
90
|
-
'
|
|
91
|
-
'
|
|
92
|
-
'
|
|
93
|
-
'
|
|
94
|
-
'
|
|
95
|
-
'
|
|
96
|
-
'
|
|
97
|
-
'
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
import { LatLngExpression } from "leaflet";
|
|
2
|
+
export enum POIType {
|
|
3
|
+
restaurant = "restaurant",
|
|
4
|
+
afaire = "afaire",
|
|
5
|
+
avoir = "avoir",
|
|
6
|
+
hebergement = "hebergement",
|
|
7
|
+
produit = "produit",
|
|
8
|
+
service = "service"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @param {string | undefined} iconUrl path to the icon that will appear on the button and the pin on the map
|
|
12
|
+
* @param {string | undefined} label label on the button, use this if the same label is used in every language
|
|
13
|
+
* @param {Record<string, string> | undefined} localizedLabel use this if there are different labels for different languages. Each tuple must be set as <locale>: <label> (for example: "fr-FR": "bonjour")
|
|
14
|
+
*/
|
|
15
|
+
interface FilterData {
|
|
16
|
+
iconUrl?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
localizedLabel?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Used to create a new category to filter POI
|
|
22
|
+
* @param {string} name category name, used in graphql / elasticsearch generic queries to get corresponding POI
|
|
23
|
+
* @param {string | undefined} color color set on filter button and pin icons on the map
|
|
24
|
+
* @param {FilterData} filter data used on the filter button and the pin icon on the map
|
|
25
|
+
*/
|
|
26
|
+
interface CustomCategory {
|
|
27
|
+
name: string;
|
|
28
|
+
color?: string;
|
|
29
|
+
filter?: FilterData;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Used to modify basic hospitality categories
|
|
33
|
+
* @param {boolean} display false to prevent this category from being displayed
|
|
34
|
+
* @param {string | undefined} label category's label, use this if the same label is used in every language
|
|
35
|
+
* @param {Record<string, string> | undefined} localizedLabel this if there are different labels for different languages. Each tuple must be set as <locale>: <label> (for example: "fr-FR": "bonjour")
|
|
36
|
+
* @param {string | undefined} color use this to change the color of the button and the pin on the map for this category
|
|
37
|
+
*/
|
|
38
|
+
interface HospitalityCategory {
|
|
39
|
+
display: boolean;
|
|
40
|
+
label?: string;
|
|
41
|
+
localizedLabel?: Record<string, string>;
|
|
42
|
+
color?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Category settings
|
|
46
|
+
* @param {Array<CustomCategory> | undefined} categories use this to display POI from categories outside of the hospitality field
|
|
47
|
+
* @param hospitalityCategories use this to change the data (label / color) of the hospitality categories
|
|
48
|
+
* @param {Array<HospitalityPOIType>} showFilter can't be used with hospitalityCategories. Use this to tell which basic hospitality categories you want to display
|
|
49
|
+
*/
|
|
50
|
+
export interface MapSettings {
|
|
51
|
+
categories?: Array<CustomCategory>;
|
|
52
|
+
hospitalityCategories?: {
|
|
53
|
+
restaurant?: HospitalityCategory;
|
|
54
|
+
afaire?: HospitalityCategory;
|
|
55
|
+
avoir?: HospitalityCategory;
|
|
56
|
+
hebergement?: HospitalityCategory;
|
|
57
|
+
produit?: HospitalityCategory;
|
|
58
|
+
service?: HospitalityCategory;
|
|
59
|
+
};
|
|
60
|
+
showFilter?: Array<POIType>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated not used anymore since v2.0.1, see the settings field instead
|
|
64
|
+
*/
|
|
65
|
+
export interface MapLabel {
|
|
66
|
+
title: string;
|
|
67
|
+
afaire: string;
|
|
68
|
+
restaurant: string;
|
|
69
|
+
hebergement: string;
|
|
70
|
+
avoir: string;
|
|
71
|
+
produit: string;
|
|
72
|
+
service: string;
|
|
73
|
+
}
|
|
74
|
+
export interface Tenant {
|
|
75
|
+
name: string;
|
|
76
|
+
retorikName: string;
|
|
77
|
+
areaLocation: Array<Array<LatLngExpression>>;
|
|
78
|
+
aroundMeDistance?: number;
|
|
79
|
+
}
|
|
80
|
+
export const MapIcon: () => JSX.Element;
|
|
81
|
+
export const labels: {
|
|
82
|
+
'ar-EG': string;
|
|
83
|
+
'ar-SA': string;
|
|
84
|
+
'ca-ES': string;
|
|
85
|
+
'cs-CZ': string;
|
|
86
|
+
'da-DK': string;
|
|
87
|
+
'de-AT': string;
|
|
88
|
+
'de-CH': string;
|
|
89
|
+
'de-DE': string;
|
|
90
|
+
'en-CA': string;
|
|
91
|
+
'en-GB': string;
|
|
92
|
+
'en-HK': string;
|
|
93
|
+
'en-IE': string;
|
|
94
|
+
'en-IN': string;
|
|
95
|
+
'en-US': string;
|
|
96
|
+
'es-ES': string;
|
|
97
|
+
'es-MX': string;
|
|
98
|
+
'fi-FI': string;
|
|
99
|
+
'fr-BE': string;
|
|
100
|
+
'fr-CA': string;
|
|
101
|
+
'fr-CH': string;
|
|
102
|
+
'fr-FR': string;
|
|
103
|
+
'hi-IN': string;
|
|
104
|
+
'hu-HU': string;
|
|
105
|
+
'id-ID': string;
|
|
106
|
+
'it-IT': string;
|
|
107
|
+
'ja-JP': string;
|
|
108
|
+
'ko-KR': string;
|
|
109
|
+
'nb-NO': string;
|
|
110
|
+
'nl-BE': string;
|
|
111
|
+
'nl-NL': string;
|
|
112
|
+
'pl-PL': string;
|
|
113
|
+
'pt-BR': string;
|
|
114
|
+
'pt-PT': string;
|
|
115
|
+
'ru-RU': string;
|
|
116
|
+
'sv-SE': string;
|
|
117
|
+
'th-TH': string;
|
|
118
|
+
'tr-TR': string;
|
|
119
|
+
'zh-CN': string;
|
|
120
|
+
'zh-HK': string;
|
|
121
|
+
'zh-TW': string;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Interactive map's props
|
|
125
|
+
* @param {string | undefined} activeTenant the key of the active tenant defined in tenantList
|
|
126
|
+
* @param {boolean | undefined} isDevTenant using a dev tenant ?
|
|
127
|
+
* @param {Record<string, Tenant>} tenantList list of the tenants with their data that can be used in this instance of interactive map
|
|
128
|
+
* @param {LatLngExpression | undefined} userLocation position of the user
|
|
129
|
+
* @param {LatLngExpression | undefined} mapCenter position of the center of the map
|
|
130
|
+
* @param {number | undefined} limitAroundCenter limit the map around the center, default 200km. Min zoom will be set depending on this number with 3 breakpoints : 0->199 / 200->599 / 599->?
|
|
131
|
+
* @param {MapSettings | undefined} settings categogy settings
|
|
132
|
+
*/
|
|
133
|
+
interface MapProps {
|
|
134
|
+
activeTenant?: string;
|
|
135
|
+
isDevTenant?: boolean;
|
|
136
|
+
tenantList: Record<string, Tenant>;
|
|
137
|
+
userLocation?: LatLngExpression;
|
|
138
|
+
mapCenter?: LatLngExpression;
|
|
139
|
+
limitAroundCenter?: number;
|
|
140
|
+
settings?: MapSettings;
|
|
141
|
+
}
|
|
142
|
+
export const Map: ({ activeTenant, isDevTenant, tenantList, userLocation, mapCenter, limitAroundCenter, settings }: MapProps) => JSX.Element;
|
|
109
143
|
|
|
110
144
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";
|
|
1
|
+
{"mappings":";ACyCA;IACE,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,WAAW,gBAAgB;IAC3B,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AExCD;;;;GAIG;AACH;IACE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC;AAED;;;;;GAKG;AACH;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,KA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CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,WAAW,CAAA;CACvB;AAYD,OAAA,MAAM,uGAQH,QAAQ,KAAG,WA6Eb,CAAA","sources":["src/src/features/authSlice.ts","src/src/models/POI.ts","src/src/features/poiSlice.ts","src/src/models/Map.ts","src/src/features/mapSlice.ts","src/src/models/Tenant.ts","src/src/features/tenantSlice.ts","src/src/features/botSlice.ts","src/src/stores/globalStore.ts","src/src/components/Icons/MapIcon.tsx","src/src/translations/labels.ts","src/src/components/BotPOIExtensionDisplay.tsx","src/src/styles/icons/dataUrlIcons.ts","src/src/utils/botUtils.ts","src/src/models/constants.ts","src/src/components/MapFilterItem.tsx","src/src/components/MapFilter.tsx","src/src/utils/MarkerIcons.ts","src/src/components/LocationMarker.tsx","src/src/utils/globalUtils.ts","src/src/utils/routeUtils.ts","src/src/components/Icons/CyclingRegularIcon.tsx","src/src/components/Icons/DrivingCarIcon.tsx","src/src/components/Icons/FootWalkingIcon.tsx","src/src/components/Icons/OpenLocationIcon.tsx","src/src/components/Icons/RoundIcon.tsx","src/src/components/Icons/TriangleIcon.tsx","src/src/components/Icons/index.ts","src/src/components/RoutesItem.tsx","src/src/components/Routes.tsx","src/src/components/QRCodeComponent.tsx","src/src/components/POIDetail.tsx","src/src/components/CustomLoader.tsx","src/src/components/Map.tsx","src/src/utils/poiUtils.ts","src/src/services/tenantService.ts","src/src/components/POILoader.tsx","src/src/index_module.tsx","src/index_module.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"import React, { useMemo } from 'react'\r\nimport { Provider } from 'react-redux'\r\nimport L from 'leaflet'\r\nimport type { LatLngExpression } from 'leaflet'\r\nimport { BotPOIExtensionDisplay } from './components/BotPOIExtensionDisplay'\r\nimport type { Tenant } from './models/Tenant'\r\nimport { MapDisplay } from './components/Map'\r\nimport { POILoader } from './components/POILoader'\r\nimport { setupStore } from './stores/globalStore'\r\nimport { hospitalityImages } from './styles/icons/dataUrlIcons'\r\n\r\nimport {\r\n iconRestaurant,\r\n iconAFaire,\r\n iconHebergement,\r\n iconAVoir,\r\n iconProduit,\r\n iconService,\r\n createGenericIcon\r\n} from './utils/MarkerIcons'\r\n\r\nimport './styles/module.scss'\r\nimport type { MapLabel, MapSettings } from './models/Map'\r\nimport { HospitalityPOIType as POIType } from './models/POI'\r\nimport { defaultColor } from './models/constants'\r\n\r\n/**\r\n * Interactive map's props\r\n * @param {string | undefined} activeTenant the key of the active tenant defined in tenantList\r\n * @param {boolean | undefined} isDevTenant using a dev tenant ?\r\n * @param {Record<string, Tenant>} tenantList list of the tenants with their data that can be used in this instance of interactive map\r\n * @param {LatLngExpression | undefined} userLocation position of the user\r\n * @param {LatLngExpression | undefined} mapCenter position of the center of the map\r\n * @param {number | undefined} limitAroundCenter limit the map around the center, default 200km. Min zoom will be set depending on this number with 3 breakpoints : 0->199 / 200->599 / 599->?\r\n * @param {MapSettings | undefined} settings categogy settings\r\n */\r\ninterface MapProps {\r\n activeTenant?: string\r\n isDevTenant?: boolean\r\n tenantList: Record<string, Tenant>\r\n userLocation?: LatLngExpression\r\n mapCenter?: LatLngExpression\r\n limitAroundCenter?: number\r\n settings?: MapSettings\r\n}\r\n\r\nconst defaultHospitalityIcons: { [name: string]: L.Icon } = {\r\n restaurant: iconRestaurant,\r\n afaire: iconAFaire,\r\n avoir: iconAVoir,\r\n hebergement: iconHebergement,\r\n produit: iconProduit,\r\n service: iconService\r\n}\r\n\r\nconst store = setupStore()\r\nconst Map = ({\r\n activeTenant,\r\n isDevTenant,\r\n tenantList,\r\n userLocation,\r\n mapCenter,\r\n limitAroundCenter,\r\n settings\r\n}: MapProps): JSX.Element => {\r\n const hospitalityCategories = useMemo<Array<string>>(() => {\r\n if (settings?.categories) {\r\n if (settings?.hospitalityCategories) {\r\n return Object.keys(settings.hospitalityCategories).filter(\r\n (key) => settings.hospitalityCategories?.[key]?.display\r\n )\r\n }\r\n } else if (settings?.hospitalityCategories) {\r\n return Object.keys(settings.hospitalityCategories).filter(\r\n (key) => settings.hospitalityCategories?.[key]?.display\r\n )\r\n } else if (settings?.showFilter) {\r\n return settings.showFilter\r\n }\r\n\r\n // By default return all hospitality categories\r\n return Object.keys(POIType)\r\n }, [settings])\r\n\r\n const leafletIcons = useMemo<{ [type: string]: L.Icon }>(() => {\r\n const tempIcons = { ...defaultHospitalityIcons }\r\n\r\n // Create pin icons for categories\r\n if (settings?.categories) {\r\n settings.categories.forEach((category) => {\r\n const icon = createGenericIcon(\r\n category.color || defaultColor,\r\n category.filter?.iconUrl\r\n )\r\n tempIcons[category.name] = icon\r\n })\r\n }\r\n\r\n // Modify pin icons for hospitality categories that have their default color changed\r\n if (settings?.hospitalityCategories) {\r\n Object.entries(settings.hospitalityCategories).forEach(\r\n ([type, values]) => {\r\n if (values.display && values.color) {\r\n const icon = createGenericIcon(\r\n values.color,\r\n hospitalityImages[type]\r\n )\r\n tempIcons[type] = icon\r\n }\r\n }\r\n )\r\n }\r\n\r\n return tempIcons\r\n }, [settings])\r\n\r\n return (\r\n <React.Fragment>\r\n {activeTenant && (\r\n <Provider store={store}>\r\n <MapDisplay\r\n activeTenant={activeTenant}\r\n isDevTenant={isDevTenant}\r\n tenantList={tenantList}\r\n userLocation={userLocation}\r\n mapCenter={mapCenter}\r\n limitAroundCenter={limitAroundCenter}\r\n settings={settings}\r\n icons={leafletIcons}\r\n />\r\n <POILoader\r\n retorikName={tenantList[activeTenant].retorikName}\r\n useDevTenant={!!isDevTenant}\r\n customCategories={settings?.categories}\r\n hospitalityCategories={hospitalityCategories}\r\n />\r\n <BotPOIExtensionDisplay />\r\n </Provider>\r\n )}\r\n </React.Fragment>\r\n )\r\n}\r\n\r\nexport { MapIcon } from './components/Icons/MapIcon'\r\nexport { Map, POIType }\r\nexport { labels } from './translations/labels'\r\nexport type { MapSettings, MapLabel }\r\nexport type { Tenant } from './models/Tenant'\r\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|