@mappedin/viewer 0.35.2-3613294.0 → 0.35.2-69c7cd1.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 +20 -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 +64 -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/utils/language-utils.d.ts +1 -0
- package/dist/types/src/test-utils/test-suite.d.ts +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7704,6 +7704,26 @@ const m7e = "Loading...", y7e = "Stairs", C7e = "Elevator", v7e = "Connection",
|
|
|
7704
7704
|
"context-menu": {
|
|
7705
7705
|
"directions-to-point": "Directions to this point",
|
|
7706
7706
|
"share-point": "Share this point"
|
|
7707
|
+
},
|
|
7708
|
+
"operation-hours": {
|
|
7709
|
+
midnight: "Midnight",
|
|
7710
|
+
noon: "Noon",
|
|
7711
|
+
"open-24-hours": "Open 24 Hours",
|
|
7712
|
+
closed: "Closed",
|
|
7713
|
+
"sunday-short": "Sun",
|
|
7714
|
+
"monday-short": "Mon",
|
|
7715
|
+
"tuesday-short": "Tue",
|
|
7716
|
+
"wednesday-short": "Wed",
|
|
7717
|
+
"thursday-short": "Thu",
|
|
7718
|
+
"friday-short": "Fri",
|
|
7719
|
+
"saturday-short": "Sat",
|
|
7720
|
+
"sunday-time": "{{time}} Sunday",
|
|
7721
|
+
"monday-time": "{{time}} Monday",
|
|
7722
|
+
"tuesday-time": "{{time}} Tuesday",
|
|
7723
|
+
"wednesday-time": "{{time}} Wednesday",
|
|
7724
|
+
"thursday-time": "{{time}} Thursday",
|
|
7725
|
+
"friday-time": "{{time}} Friday",
|
|
7726
|
+
"saturday-time": "{{time}} Saturday"
|
|
7707
7727
|
}
|
|
7708
7728
|
}, N7e = {
|
|
7709
7729
|
"access-features": "Access Features",
|
|
@@ -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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A time in minutes and hours, without a date.
|
|
3
|
+
*/
|
|
4
|
+
declare class Time {
|
|
5
|
+
#private;
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Time object. If no arguments are provided, the current time is used.
|
|
8
|
+
* If a Date is provided, the time is set to the time of the provided date. If two
|
|
9
|
+
* numbers are provided, the time is set to the given hours and minutes.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
constructor(date: Date);
|
|
13
|
+
constructor(hour: number, minute: number);
|
|
14
|
+
/**
|
|
15
|
+
* Get the hours of this time.
|
|
16
|
+
*/
|
|
17
|
+
get hours(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Get the minutes of this time.
|
|
20
|
+
*/
|
|
21
|
+
get minutes(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns true if this time is midnight. This can be either 00:00 or 24:00.
|
|
24
|
+
*/
|
|
25
|
+
isMidnight(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Returns true if this time is noon.
|
|
28
|
+
*/
|
|
29
|
+
isNoon(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if this time is equal to another time. 00:00 and 24:00 are considered
|
|
32
|
+
* to be equal.
|
|
33
|
+
*/
|
|
34
|
+
isEqual(other: Time): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if this time is later than another time, assuming the times are on the
|
|
37
|
+
* same day. 00:00 is considered to be earlier than any other time; 24:00 is considered
|
|
38
|
+
* to be later than any other time.
|
|
39
|
+
*/
|
|
40
|
+
isLaterThan(other: Time): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Returns true if this time is later than or equal to another time. Unlike {@link isLaterThan},
|
|
43
|
+
* 00:00 is considered to be equal to 24:00.
|
|
44
|
+
*/
|
|
45
|
+
isLaterThanOrEqual(other: Time): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if the given time is between the start and end time, inclusive.
|
|
48
|
+
*
|
|
49
|
+
* Assumes the start time is on the same day. If the end time is earlier than the start time,
|
|
50
|
+
* it is assumed to be on the next day. If the start time is equal to the end time, it is
|
|
51
|
+
* assumed to include the entire day and this function will always return true.
|
|
52
|
+
*/
|
|
53
|
+
isBetween(start: Time, end: Time): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Return the number of minutes forward in time required to reach another time. If the
|
|
56
|
+
* other time is earlier than this time, it is assumed to be on the next day.
|
|
57
|
+
*/
|
|
58
|
+
minutesTo(other: Time): number;
|
|
59
|
+
/**
|
|
60
|
+
* Return a localized, formatted string representation of the time.
|
|
61
|
+
*/
|
|
62
|
+
toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
63
|
+
}
|
|
64
|
+
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLocale: (locale?: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* Run a callback with tests for each {@link TTestCase} in a {@link TTestSuite}. This is useful for
|
|
15
|
+
* running many tests with the same exact format, where the input and output can be easily abstracted.
|
|
16
|
+
*/
|
|
17
|
+
declare const testSuite: <Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: (language: string, value: TTestCondition<Given, Expected>) => void) => void;
|
|
18
|
+
export default testSuite;
|