@mappedin/viewer 0.35.2-a875236.0 → 0.35.2-c86a413.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/index.js +38724 -37709
- package/dist/types/src/components/action-toast/action-toast.stories.d.ts +2 -0
- package/dist/types/src/components/action-toast/index.d.ts +10 -0
- package/dist/types/src/components/area-marker/area-marker.stories.d.ts +2 -0
- package/dist/types/src/components/area-marker/index.d.ts +6 -0
- package/dist/types/src/components/collapsible/collapsible.stories.d.ts +2 -0
- package/dist/types/src/components/collapsible/index.d.ts +20 -0
- package/dist/types/src/components/metadata-card/utils.d.ts +5 -0
- package/dist/types/src/components/operation-hours/hours-list.d.ts +9 -0
- package/dist/types/src/components/operation-hours/index.d.ts +7 -0
- package/dist/types/src/components/operation-hours/open-status.d.ts +9 -0
- package/dist/types/src/components/operation-hours/operation-hours.stories.d.ts +4 -0
- package/dist/types/src/components/toast/index.d.ts +8 -2
- package/dist/types/src/components/toast/utils.d.ts +3 -1
- package/dist/types/src/lib/sdk/types.d.ts +1 -0
- package/dist/types/src/lib/time/opening-hours.d.ts +72 -0
- package/dist/types/src/lib/time/opening-hours.test.d.ts +1 -0
- package/dist/types/src/lib/time/time.d.ts +66 -0
- package/dist/types/src/lib/time/time.test.d.ts +1 -0
- package/dist/types/src/lib/time/types.d.ts +33 -0
- package/dist/types/src/lib/time/utils.d.ts +34 -0
- package/dist/types/src/lib/time/utils.test.d.ts +1 -0
- package/dist/types/src/lib/types/theme.d.ts +2 -0
- package/dist/types/src/lib/utils/array-utils.d.ts +4 -0
- package/dist/types/src/lib/utils/data-utils.d.ts +13 -2
- package/dist/types/src/lib/utils/language-utils.d.ts +1 -0
- package/dist/types/src/stores/feature-flag-store/index.d.ts +3 -1
- package/dist/types/src/stores/map-store/controllers/camera.d.ts +2 -2
- package/dist/types/src/stores/root-store/index.d.ts +9 -1
- package/dist/types/src/stores/ui-store/index.d.ts +5 -0
- package/dist/types/src/stores/ui-store/reactive-toasts/similar-places-toast.d.ts +13 -0
- package/dist/types/src/stores/ui-store/reactive-toasts/similar-places-toast.test.d.ts +1 -0
- package/dist/types/src/test-utils/custom-matchers.test.d.ts +1 -0
- package/dist/types/src/test-utils/test-place-types.d.ts +43 -0
- package/dist/types/src/test-utils/test-place-types.test.d.ts +1 -0
- package/dist/types/src/test-utils/test-suite.d.ts +25 -0
- package/dist/types/src/test-utils/test-with-map.d.ts +2 -1
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Trans } from 'react-i18next';
|
|
2
|
+
import { ComponentProps, ReactElement } from 'react';
|
|
3
|
+
type TActionToastProps = {
|
|
4
|
+
text: string | ReactElement<ComponentProps<typeof Trans>>;
|
|
5
|
+
action: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const ActionToast: React.FC<TActionToastProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type TCollapsibleProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the content should be collapsible. If false, the full content will always be shown.
|
|
5
|
+
*/
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The height of the collapsed content.
|
|
9
|
+
*/
|
|
10
|
+
collapsedHeight?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The maximum height of the content when expanded. If the content is shorter than this, it will only
|
|
13
|
+
* expand as much as needed. If the content is taller, it will scroll. If undefined, the content will
|
|
14
|
+
* expand to its natural height.
|
|
15
|
+
*/
|
|
16
|
+
maxHeight?: number | string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
declare const Collapsible: React.FC<PropsWithChildren<TCollapsibleProps>>;
|
|
20
|
+
export default Collapsible;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
import { TOnClickOrPressPayload } from '../button';
|
|
3
3
|
import SocialsItem from '../socials-item';
|
|
4
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
4
5
|
export declare const METADATA_CARD_WIDTH = 320;
|
|
5
6
|
export declare const METADATA_CARD_PADDING = 20;
|
|
6
7
|
export declare const HERO_IMAGE_HEIGHT = 200;
|
|
@@ -50,6 +51,10 @@ export type TMetadataCardProps = {
|
|
|
50
51
|
id: string;
|
|
51
52
|
name: string;
|
|
52
53
|
}[];
|
|
54
|
+
/**
|
|
55
|
+
* Opening hours to show in the card.
|
|
56
|
+
*/
|
|
57
|
+
hours?: OpeningHours;
|
|
53
58
|
/**
|
|
54
59
|
* URL to show on a button just above the directions button.
|
|
55
60
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const HOURS_LIST_HEIGHT = 24;
|
|
4
|
+
type THoursListProps = {
|
|
5
|
+
hours: OpeningHours;
|
|
6
|
+
date?: Date;
|
|
7
|
+
};
|
|
8
|
+
declare const HoursList: React.FC<THoursListProps>;
|
|
9
|
+
export default HoursList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
2
|
+
type TOpenStatusProps = {
|
|
3
|
+
hours: OpeningHours;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
chevron?: 'right' | 'down';
|
|
6
|
+
date?: Date;
|
|
7
|
+
};
|
|
8
|
+
declare const OpenStatus: React.FC<TOpenStatusProps>;
|
|
9
|
+
export default OpenStatus;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { TToast } from './utils';
|
|
2
|
-
|
|
2
|
+
type TToastContainerProps = {
|
|
3
|
+
style?: React.CSSProperties;
|
|
4
|
+
};
|
|
5
|
+
export declare const ToastContainer: React.FC<TToastContainerProps>;
|
|
3
6
|
/**
|
|
4
7
|
* Render a toast on the page.
|
|
5
8
|
*/
|
|
6
|
-
declare const toast:
|
|
9
|
+
declare const toast: {
|
|
10
|
+
(content: TToast["content"], options?: Partial<Omit<TToast, "id" | "content">>): string;
|
|
11
|
+
hide(id: string): void;
|
|
12
|
+
};
|
|
7
13
|
export default toast;
|
|
@@ -10,10 +10,12 @@ export type TToast = TBaseToast & {
|
|
|
10
10
|
content: string | TCustomToastFn;
|
|
11
11
|
};
|
|
12
12
|
export declare enum E_TOAST_EVENT {
|
|
13
|
-
SHOW = "SHOW"
|
|
13
|
+
SHOW = "SHOW",
|
|
14
|
+
HIDE = "HIDE"
|
|
14
15
|
}
|
|
15
16
|
type TToastEventPayload = {
|
|
16
17
|
[E_TOAST_EVENT.SHOW]: TToast;
|
|
18
|
+
[E_TOAST_EVENT.HIDE]: string;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* A singleton event bus for toast events.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Space, MapObject, PointOfInterest, Connection, Annotation, Coordinate, Door, CameraTransform as _CameraTransform, TEventPayload as _TEventPayload, TEvents } from './mappedin-js';
|
|
2
2
|
export declare const PLACE_TYPES: (typeof Space | typeof PointOfInterest | typeof Connection | typeof MapObject | typeof Door | typeof Coordinate | typeof Annotation)[];
|
|
3
3
|
export declare const PLACE_TYPE_STRINGS: ("annotation" | "space" | "point-of-interest" | "connection" | "object" | "door" | "coordinate")[];
|
|
4
|
+
export type PlaceTypeString = (typeof PLACE_TYPE_STRINGS)[number];
|
|
4
5
|
export type PlaceType = (typeof PLACE_TYPES)[number];
|
|
5
6
|
export type Place = InstanceType<PlaceType>;
|
|
6
7
|
export declare const GEOMETRY_TYPES: (typeof Space | typeof MapObject)[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import Time from './time';
|
|
2
|
+
import { TOpeningHours } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Class with a time and day of the week.
|
|
5
|
+
*/
|
|
6
|
+
declare class TimeOfWeek {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(time: Time, day: number);
|
|
9
|
+
get day(): number;
|
|
10
|
+
get time(): Time;
|
|
11
|
+
toLocaleString(locale: string, options?: Partial<{
|
|
12
|
+
includeDay: boolean;
|
|
13
|
+
}>): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A set of opening hours for a location defined in local time within a specific timezone.
|
|
17
|
+
*/
|
|
18
|
+
declare class OpeningHours {
|
|
19
|
+
#private;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new OpeningHours object.
|
|
22
|
+
*/
|
|
23
|
+
constructor(openingHours: TOpeningHours, tz: string);
|
|
24
|
+
/**
|
|
25
|
+
* Return a {@link Time} object in the store's timezone. Defaults to the current date.
|
|
26
|
+
*/
|
|
27
|
+
getTime(date?: Date): Time;
|
|
28
|
+
/**
|
|
29
|
+
* Return a day of the week as a number in the store's timezone. Defaults to the current date.
|
|
30
|
+
*/
|
|
31
|
+
getDay(date?: Date): number;
|
|
32
|
+
/**
|
|
33
|
+
* Return an array of localized, formatted string representations of the opening hours for each
|
|
34
|
+
* day of the week. The first entry in the array is the provided date's opening hours. If no
|
|
35
|
+
* date is provided, the current date is used.
|
|
36
|
+
*/
|
|
37
|
+
toLocaleStrings(locale: string, date?: Date): (readonly [string, string])[];
|
|
38
|
+
/**
|
|
39
|
+
* Return true if the opening hours are open 24/7.
|
|
40
|
+
*/
|
|
41
|
+
isOpen247(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Return true if the opening hours are always closed.
|
|
44
|
+
*/
|
|
45
|
+
isClosed247(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if a given {@link Date} is within the opening hours. Defaults to checking the
|
|
48
|
+
* current date.
|
|
49
|
+
*/
|
|
50
|
+
isOpen(date?: Date): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Return true if a given {@link Date} is within 1 hour of the opening hours. Returns false if
|
|
53
|
+
* the store is already open. Defaults to checking the current date.
|
|
54
|
+
*/
|
|
55
|
+
isOpeningSoon(date?: Date): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Return true if a given {@link Date} is within 1 hour of the closing hours. Returns false if
|
|
58
|
+
* the store is already closed. Defaults to checking the current date.
|
|
59
|
+
*/
|
|
60
|
+
isClosingSoon(date?: Date): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the next time the store will open from a given date. Defaults to checking the current
|
|
63
|
+
* date.
|
|
64
|
+
*/
|
|
65
|
+
opensAt(date?: Date): TimeOfWeek | null;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the next time the store will close from a given date. Defaults to checking the current
|
|
68
|
+
* date.
|
|
69
|
+
*/
|
|
70
|
+
closesAt(date?: Date): TimeOfWeek | null;
|
|
71
|
+
}
|
|
72
|
+
export default OpeningHours;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare const customInspectSymbol: unique symbol;
|
|
2
|
+
/**
|
|
3
|
+
* A time in minutes and hours, without a date.
|
|
4
|
+
*/
|
|
5
|
+
declare class Time {
|
|
6
|
+
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Create a new Time object. If no arguments are provided, the current time is used.
|
|
9
|
+
* If a Date is provided, the time is set to the time of the provided date. If two
|
|
10
|
+
* numbers are provided, the time is set to the given hours and minutes.
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
constructor(date: Date);
|
|
14
|
+
constructor(hour: number, minute: number);
|
|
15
|
+
/**
|
|
16
|
+
* Get the hours of this time.
|
|
17
|
+
*/
|
|
18
|
+
get hours(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Get the minutes of this time.
|
|
21
|
+
*/
|
|
22
|
+
get minutes(): number;
|
|
23
|
+
[customInspectSymbol](): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns true if this time is midnight. This can be either 00:00 or 24:00.
|
|
26
|
+
*/
|
|
27
|
+
isMidnight(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Returns true if this time is noon.
|
|
30
|
+
*/
|
|
31
|
+
isNoon(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if this time is equal to another time. 00:00 and 24:00 are considered
|
|
34
|
+
* to be equal.
|
|
35
|
+
*/
|
|
36
|
+
isEqual(other: Time): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true if this time is later than another time, assuming the times are on the
|
|
39
|
+
* same day. 00:00 is considered to be earlier than any other time; 24:00 is considered
|
|
40
|
+
* to be later than any other time.
|
|
41
|
+
*/
|
|
42
|
+
isLaterThan(other: Time): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Returns true if this time is later than or equal to another time. Unlike {@link isLaterThan},
|
|
45
|
+
* 00:00 is considered to be equal to 24:00.
|
|
46
|
+
*/
|
|
47
|
+
isLaterThanOrEqual(other: Time): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Returns true if the given time is between the start and end time, inclusive.
|
|
50
|
+
*
|
|
51
|
+
* Assumes the start time is on the same day. If the end time is earlier than the start time,
|
|
52
|
+
* it is assumed to be on the next day. If the start time is equal to the end time, it is
|
|
53
|
+
* assumed to include the entire day and this function will always return true.
|
|
54
|
+
*/
|
|
55
|
+
isBetween(start: Time, end: Time): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Return the number of minutes forward in time required to reach another time. If the
|
|
58
|
+
* other time is earlier than this time, it is assumed to be on the next day.
|
|
59
|
+
*/
|
|
60
|
+
minutesTo(other: Time): number;
|
|
61
|
+
/**
|
|
62
|
+
* Return a localized, formatted string representation of the time.
|
|
63
|
+
*/
|
|
64
|
+
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
65
|
+
}
|
|
66
|
+
export default Time;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An array representing a time range in hours and minutes. If the second time is earlier
|
|
3
|
+
* than the first time, it is assumed to be on the next day.
|
|
4
|
+
*/
|
|
5
|
+
export type TTimeRange = [number, number, number, number];
|
|
6
|
+
/**
|
|
7
|
+
* Opening hours for a single day. For a store with hours, it is either a {@link TTimeRange}
|
|
8
|
+
* or a pair of {@link TTimeRange}s, or null if the store is closed for the day. The second
|
|
9
|
+
* time range, if specified, must begin after the first time range ends. Otherwise, the meaning
|
|
10
|
+
* is undefined.
|
|
11
|
+
*/
|
|
12
|
+
export type TSingleDayOpeningHours = [TTimeRange] | [TTimeRange, TTimeRange] | null;
|
|
13
|
+
/**
|
|
14
|
+
* A collection of {@link TSingleDayOpeningHours} for Sunday to Saturday.
|
|
15
|
+
*/
|
|
16
|
+
export type TRegularOpeningHours = [
|
|
17
|
+
TSingleDayOpeningHours,
|
|
18
|
+
TSingleDayOpeningHours,
|
|
19
|
+
TSingleDayOpeningHours,
|
|
20
|
+
TSingleDayOpeningHours,
|
|
21
|
+
TSingleDayOpeningHours,
|
|
22
|
+
TSingleDayOpeningHours,
|
|
23
|
+
TSingleDayOpeningHours
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* A collection of {@link TSingleDayOpeningHours} for every day of the week and for
|
|
27
|
+
* holidays. The first entry is for Sunday, the second for Monday, etc. The last entry
|
|
28
|
+
* is for holidays.
|
|
29
|
+
*/
|
|
30
|
+
export type TOpeningHours = TRegularOpeningHours | [
|
|
31
|
+
...TRegularOpeningHours,
|
|
32
|
+
TSingleDayOpeningHours
|
|
33
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Time from './time';
|
|
2
|
+
import { TSingleDayOpeningHours, TTimeRange } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if the given locale uses a 24-hour time format.
|
|
5
|
+
*/
|
|
6
|
+
export declare const is24HourTime: (locale: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Convert the name of a day of the week to a number between 0 and 6. Returns -1 if the day is not
|
|
9
|
+
* valid.
|
|
10
|
+
*/
|
|
11
|
+
export declare const dayOfWeekNum: (day: string) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Get the current timezone of the client.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getTZ: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Given a timezone and a date, return the hours, minutes, and day of week in that timezone.
|
|
18
|
+
* Day of week is 0-6, where 0 is Sunday. If no timezone is specified, uses the client's local
|
|
19
|
+
* timezone. If no date is specified, uses the current date.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getTimePartsAtTZ: (tz: string, date: Date) => {
|
|
22
|
+
hours: number;
|
|
23
|
+
minutes: number;
|
|
24
|
+
dayOfWeek: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Given a single day's opening hours, return the start and end times. If the opening
|
|
28
|
+
* hours are a pair of time ranges, return the start and end times for both ranges.
|
|
29
|
+
* Returns null if the store is closed for the day.
|
|
30
|
+
*/
|
|
31
|
+
export declare function singleDayOpeningHoursTimes(hours: null): null;
|
|
32
|
+
export declare function singleDayOpeningHoursTimes(hours: [TTimeRange]): [Time, Time];
|
|
33
|
+
export declare function singleDayOpeningHoursTimes(hours: [TTimeRange, TTimeRange]): [Time, Time, Time, Time];
|
|
34
|
+
export declare function singleDayOpeningHoursTimes(hours: TSingleDayOpeningHours): [Time, Time] | [Time, Time, Time, Time] | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -37,6 +37,7 @@ export type TTheme = {
|
|
|
37
37
|
inverted: string;
|
|
38
38
|
link: string;
|
|
39
39
|
error: string;
|
|
40
|
+
error2: string;
|
|
40
41
|
};
|
|
41
42
|
map: {
|
|
42
43
|
labels: {
|
|
@@ -81,6 +82,7 @@ export type TTheme = {
|
|
|
81
82
|
normal: number;
|
|
82
83
|
large: number;
|
|
83
84
|
xlarge: number;
|
|
85
|
+
title: number;
|
|
84
86
|
};
|
|
85
87
|
fontWeight: {
|
|
86
88
|
light: number;
|
|
@@ -13,4 +13,8 @@ export declare const isLength: <L extends number, T>(arr: T[], length: L) => arr
|
|
|
13
13
|
* Utility function to typecheck if an array has a specific length or more.
|
|
14
14
|
*/
|
|
15
15
|
export declare const isAtLeastLength: <L extends number, T>(arr: T[], length: L) => arr is ArrayWithAtLeastLength<L, T>;
|
|
16
|
+
/**
|
|
17
|
+
* Small utility to avoid needing to write `arr.filter((item) => !exclude.includes(item))` everywhere.
|
|
18
|
+
*/
|
|
19
|
+
export declare const exclude: <T>(arr: T[], exclude: T[]) => T[];
|
|
16
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotation, Place, TNavigationTarget } from '../sdk';
|
|
1
|
+
import { Annotation, Place, TNavigationTarget, Floor } from '../sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Whether the location can be assumed to be a washroom
|
|
4
4
|
*/
|
|
@@ -7,11 +7,18 @@ export declare const isWashroom: (place: Place) => boolean;
|
|
|
7
7
|
* Whether the location can be assumed to be a parking spot
|
|
8
8
|
*/
|
|
9
9
|
export declare const isParking: (place: Place) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the location has a name
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasName: (place: Place) => boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Whether the location has any metadata other than name
|
|
12
|
-
* @returns
|
|
13
16
|
*/
|
|
14
17
|
export declare const hasMetaData: (place: Place) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the location has a name or any other metadata
|
|
20
|
+
*/
|
|
21
|
+
export declare const hasNameOrMetaData: (place: Place) => boolean;
|
|
15
22
|
export declare const getCategoryName: (place: Place) => string;
|
|
16
23
|
export declare const getAnnotationName: (annotation: Annotation) => string;
|
|
17
24
|
export type TGetDisplayNameForPlaceOptions = {
|
|
@@ -39,3 +46,7 @@ export declare const isValidPlace: (place: Place) => boolean;
|
|
|
39
46
|
export declare const getNavigationTargetForPlaces: (places: Place[]) => TNavigationTarget | TNavigationTarget[];
|
|
40
47
|
export declare const getSearchIdForPlace: (place: Place) => string | undefined;
|
|
41
48
|
export declare const getCategoryIdForPlace: (place: Place) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a place is on a floor.
|
|
51
|
+
*/
|
|
52
|
+
export declare const isOnFloor: (place: Place, floor: Floor | string | undefined) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLocale: (locale?: string) => string;
|
|
@@ -14,7 +14,8 @@ export declare enum E_FEATURE_FLAGS {
|
|
|
14
14
|
WINTER_MODE = "winter-mode",
|
|
15
15
|
AUTH_URL = "auth-url",
|
|
16
16
|
MULTI_FLOOR_VIEW = "multi-floor-view",
|
|
17
|
-
SAFETY_MODE = "safety-mode"
|
|
17
|
+
SAFETY_MODE = "safety-mode",
|
|
18
|
+
SIMILAR_PLACES_TOAST = "similar-places-toast"
|
|
18
19
|
}
|
|
19
20
|
type TFeatureFlagPayloads = {
|
|
20
21
|
[E_FEATURE_FLAGS.MAKER_POP_UP]: boolean;
|
|
@@ -24,6 +25,7 @@ type TFeatureFlagPayloads = {
|
|
|
24
25
|
[E_FEATURE_FLAGS.AUTH_URL]: string[];
|
|
25
26
|
[E_FEATURE_FLAGS.MULTI_FLOOR_VIEW]: boolean;
|
|
26
27
|
[E_FEATURE_FLAGS.SAFETY_MODE]: boolean;
|
|
28
|
+
[E_FEATURE_FLAGS.SIMILAR_PLACES_TOAST]: boolean;
|
|
27
29
|
};
|
|
28
30
|
type TFeatureFlag<Key extends E_FEATURE_FLAGS> = {
|
|
29
31
|
/**
|
|
@@ -22,8 +22,7 @@ declare class CameraController {
|
|
|
22
22
|
private cameraChangeTimeout;
|
|
23
23
|
private cameraMovingStartTime;
|
|
24
24
|
/**
|
|
25
|
-
* The camera
|
|
26
|
-
* enough for most purposes
|
|
25
|
+
* The camera transform that shows the map in it's default state.
|
|
27
26
|
*/
|
|
28
27
|
private defaultCameraByFloorId;
|
|
29
28
|
/**
|
|
@@ -41,6 +40,7 @@ declare class CameraController {
|
|
|
41
40
|
rootStore: RootStore;
|
|
42
41
|
mapStore: MapStore;
|
|
43
42
|
});
|
|
43
|
+
private updateDefaultCameraForCurrentFloor;
|
|
44
44
|
private getPadding;
|
|
45
45
|
private getCoordinateFromScreenCenter;
|
|
46
46
|
private handleKeyDown;
|
|
@@ -104,7 +104,15 @@ declare class RootStore {
|
|
|
104
104
|
get isAccessible(): boolean;
|
|
105
105
|
get isSafetyModeEnabled(): boolean;
|
|
106
106
|
get isOutdoorsVisible(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The initial pitch from the router params. To get the initial pitch with defaults from the theme,
|
|
109
|
+
* use {@link UIStore.theme.map.initialPitch}.
|
|
110
|
+
*/
|
|
107
111
|
get initialPitch(): number | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The initial bearing from the router params or MVF. To get the initial bearing with defaults from
|
|
114
|
+
* the theme, use {@link UIStore.theme.map.initialBearing}.
|
|
115
|
+
*/
|
|
108
116
|
get initialBearing(): number | undefined;
|
|
109
117
|
get exteriorDoors(): {
|
|
110
118
|
"__#15@#private": any;
|
|
@@ -170,6 +178,7 @@ declare class RootStore {
|
|
|
170
178
|
get selectedMVFFeatures(): Feature<MVFGeometry, {
|
|
171
179
|
id: string;
|
|
172
180
|
}>[] | undefined;
|
|
181
|
+
get similarPlaces(): Place[] | undefined;
|
|
173
182
|
get departures(): Place[] | undefined;
|
|
174
183
|
get placeIdsWithImageLabels(): Set<string>;
|
|
175
184
|
get youAreHere(): Coordinate | undefined;
|
|
@@ -190,7 +199,6 @@ declare class RootStore {
|
|
|
190
199
|
}>): Coordinate | undefined;
|
|
191
200
|
setYouAreHere(coordinate: Coordinate | undefined): void;
|
|
192
201
|
setState(state: E_APP_STATE): void;
|
|
193
|
-
isPlaceOnFloor(place: Place, floor: Floor | undefined): boolean;
|
|
194
202
|
setSelectedPlaces(places: Place[] | undefined | typeof YOU_ARE_HERE_ROUTER_PARAM): void;
|
|
195
203
|
/**
|
|
196
204
|
* Only use this from within the editor preview.
|
|
@@ -13,6 +13,9 @@ declare class UIStore {
|
|
|
13
13
|
private makerPopUpDismissed;
|
|
14
14
|
private searchBarFocusTimeout?;
|
|
15
15
|
private themeBase;
|
|
16
|
+
reactiveToasts: {
|
|
17
|
+
cleanup: () => void;
|
|
18
|
+
}[];
|
|
16
19
|
searchQuery: string;
|
|
17
20
|
departureSearchQuery: string;
|
|
18
21
|
droppedPinNotificationVisible: boolean;
|
|
@@ -55,6 +58,7 @@ declare class UIStore {
|
|
|
55
58
|
inverted: string;
|
|
56
59
|
link: string;
|
|
57
60
|
error: string;
|
|
61
|
+
error2: string;
|
|
58
62
|
}>;
|
|
59
63
|
map: Partial<{
|
|
60
64
|
labels: Partial<{
|
|
@@ -99,6 +103,7 @@ declare class UIStore {
|
|
|
99
103
|
normal: number;
|
|
100
104
|
large: number;
|
|
101
105
|
xlarge: number;
|
|
106
|
+
title: number;
|
|
102
107
|
}>;
|
|
103
108
|
fontWeight: Partial<{
|
|
104
109
|
light: number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type RootStore from '../../root-store';
|
|
2
|
+
declare class SimilarPlacesToast {
|
|
3
|
+
rootStore: RootStore;
|
|
4
|
+
private toastId;
|
|
5
|
+
private reactionDisposers;
|
|
6
|
+
constructor(rootStore: RootStore);
|
|
7
|
+
private onClick;
|
|
8
|
+
private show;
|
|
9
|
+
private hide;
|
|
10
|
+
private update;
|
|
11
|
+
cleanup(): void;
|
|
12
|
+
}
|
|
13
|
+
export default SimilarPlacesToast;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Place, PlaceTypeString } from '../lib/sdk';
|
|
2
|
+
import { TMapViewWithTestUtilities } from './test-mocks';
|
|
3
|
+
import { testWithMap, TTestWithMapOptions } from './test-with-map';
|
|
4
|
+
type TTestPlaceTypeCallback<P extends Place = Place> = (test: Awaited<ReturnType<typeof testWithMap<TMapViewWithTestUtilities>>>, places: P[], type: PlaceTypeString) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Options for testing all place types.
|
|
7
|
+
*/
|
|
8
|
+
type TTestPlaceTypeOptions = Partial<{
|
|
9
|
+
/**
|
|
10
|
+
* The name of the fixture to use for the test.
|
|
11
|
+
*/
|
|
12
|
+
fixture: string;
|
|
13
|
+
/**
|
|
14
|
+
* Options to pass to {@link testWithMap}.
|
|
15
|
+
*/
|
|
16
|
+
testWithMapOptions: TTestWithMapOptions | ((type: PlaceTypeString) => TTestWithMapOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Limit the test for places on the current floor.
|
|
19
|
+
*/
|
|
20
|
+
limitPlacesToCurrentFloor: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* By default, the callback will be passed all places of a given type. Specify a predicate to
|
|
23
|
+
* filter the places to test.
|
|
24
|
+
*/
|
|
25
|
+
predicate: (place: Place) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If specified, the test will only be run for the given types. This overrides {@link exclude}.
|
|
28
|
+
*/
|
|
29
|
+
only: PlaceTypeString[];
|
|
30
|
+
/**
|
|
31
|
+
* If specified, the test will not be run for the given types. This is overridden by {@link only}.
|
|
32
|
+
*/
|
|
33
|
+
exclude: PlaceTypeString[];
|
|
34
|
+
}>;
|
|
35
|
+
export declare const runTest: <P extends Place = Place>(type: PlaceTypeString, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions) => Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Run a test suite by executing a test function for all types that a {@link Place} could be.
|
|
38
|
+
*/
|
|
39
|
+
declare const testPlaceTypes: {
|
|
40
|
+
<P extends Place = Place>(name: string, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions): void;
|
|
41
|
+
only: <P extends Place = Place>(name: string, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions) => void;
|
|
42
|
+
};
|
|
43
|
+
export default testPlaceTypes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A set of given and expected values for testing.
|
|
3
|
+
*/
|
|
4
|
+
export type TTestCondition<Given, Expected> = readonly [Given, Expected];
|
|
5
|
+
/**
|
|
6
|
+
* A test case with a name and a {@link TTestCondition}s.
|
|
7
|
+
*/
|
|
8
|
+
export type TTestCase<Given, Expected> = [string, readonly TTestCondition<Given, Expected>[]];
|
|
9
|
+
/**
|
|
10
|
+
* A suite of {@link TTestCase}s.
|
|
11
|
+
*/
|
|
12
|
+
export type TTestSuite<Given, Expected> = readonly TTestCase<Given, Expected>[];
|
|
13
|
+
/**
|
|
14
|
+
* A callback for running tests in a {@link TTestSuite}.
|
|
15
|
+
*/
|
|
16
|
+
export type TTestSuiteCallback<Given, Expected> = (testName: string, value: TTestCondition<Given, Expected>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Run a callback with tests for each {@link TTestCase} in a {@link TTestSuite}. This is useful for
|
|
19
|
+
* running many tests with the same exact format, where the input and output can be easily abstracted.
|
|
20
|
+
*/
|
|
21
|
+
declare const testSuite: {
|
|
22
|
+
<Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>): void;
|
|
23
|
+
only: <Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>) => void;
|
|
24
|
+
};
|
|
25
|
+
export default testSuite;
|
|
@@ -5,7 +5,7 @@ import { MapData } from '../lib/sdk';
|
|
|
5
5
|
import { TStartViewerOptions, TStartViewerWithLocalDataOptions } from '../lib/types/options';
|
|
6
6
|
import { TMapViewWithTestUtilities } from './test-mocks';
|
|
7
7
|
export declare const loadTestVenueData: (venueFileName?: string) => Promise<ParsedMVF>;
|
|
8
|
-
type TTestWithMapOptions = {
|
|
8
|
+
export type TTestWithMapOptions = {
|
|
9
9
|
startupOptions?: TStartViewerOptions | TStartViewerWithLocalDataOptions;
|
|
10
10
|
initialState?: string | ((data: MapData, mvf: ParsedMVF) => string);
|
|
11
11
|
isMobile?: boolean;
|
|
@@ -24,6 +24,7 @@ type TTestWithMapResult<MV = TMapViewWithTestUtilities> = {
|
|
|
24
24
|
waitForMapInitialized: () => Promise<void>;
|
|
25
25
|
waitForCameraSettled: () => Promise<void>;
|
|
26
26
|
setNextCameraState: TMapViewWithTestUtilities['__test']['setNextCameraState'];
|
|
27
|
+
waitForPinDrop: () => Promise<void>;
|
|
27
28
|
};
|
|
28
29
|
export declare const testWithMap: <MV = TMapViewWithTestUtilities>(venueFileName?: string, options?: TTestWithMapOptions) => Promise<TTestWithMapResult<MV>>;
|
|
29
30
|
export {};
|