incyclist-services 1.9.11 → 1.9.13

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.
Files changed (48) hide show
  1. package/lib/cjs/apps/googleMaps/consts.js +10 -0
  2. package/lib/cjs/apps/googleMaps/index.js +1 -0
  3. package/lib/cjs/apps/googleMaps/service.js +46 -1
  4. package/lib/cjs/maps/MapArea/options.js +2 -3
  5. package/lib/cjs/ride/display/service.js +95 -0
  6. package/lib/cjs/ride/index.js +1 -0
  7. package/lib/cjs/ride/page/service.js +69 -1
  8. package/lib/cjs/ride/route/FreeRideDisplayService.js +36 -5
  9. package/lib/cjs/ride/route/GpxDisplayService.js +46 -1
  10. package/lib/cjs/ride/view-restriction/index.js +18 -0
  11. package/lib/cjs/ride/view-restriction/service.js +221 -0
  12. package/lib/cjs/ride/view-restriction/types.js +2 -0
  13. package/lib/cjs/routes/free-ride/option-labels.js +141 -0
  14. package/lib/cjs/routes/free-ride/service.js +217 -117
  15. package/lib/cjs/settings/display/ride/service.js +22 -4
  16. package/lib/esm/apps/googleMaps/consts.js +7 -0
  17. package/lib/esm/apps/googleMaps/index.js +1 -0
  18. package/lib/esm/apps/googleMaps/service.js +46 -1
  19. package/lib/esm/maps/MapArea/options.js +2 -3
  20. package/lib/esm/ride/display/service.js +95 -0
  21. package/lib/esm/ride/index.js +1 -0
  22. package/lib/esm/ride/page/service.js +69 -1
  23. package/lib/esm/ride/route/FreeRideDisplayService.js +36 -5
  24. package/lib/esm/ride/route/GpxDisplayService.js +46 -1
  25. package/lib/esm/ride/view-restriction/index.js +2 -0
  26. package/lib/esm/ride/view-restriction/service.js +217 -0
  27. package/lib/esm/ride/view-restriction/types.js +1 -0
  28. package/lib/esm/routes/free-ride/service.js +217 -117
  29. package/lib/esm/settings/display/ride/service.js +20 -2
  30. package/lib/types/apps/googleMaps/consts.d.ts +7 -0
  31. package/lib/types/apps/googleMaps/index.d.ts +1 -0
  32. package/lib/types/apps/googleMaps/service.d.ts +8 -0
  33. package/lib/types/maps/MapArea/types.d.ts +1 -0
  34. package/lib/types/ride/base/types.d.ts +5 -1
  35. package/lib/types/ride/display/service.d.ts +15 -0
  36. package/lib/types/ride/index.d.ts +1 -0
  37. package/lib/types/ride/page/service.d.ts +10 -0
  38. package/lib/types/ride/page/types.d.ts +10 -0
  39. package/lib/types/ride/route/FreeRideDisplayService.d.ts +4 -1
  40. package/lib/types/ride/route/GpxDisplayService.d.ts +5 -0
  41. package/lib/types/ride/view-restriction/index.d.ts +2 -0
  42. package/lib/types/ride/view-restriction/service.d.ts +30 -0
  43. package/lib/types/ride/view-restriction/types.d.ts +57 -0
  44. package/lib/types/routes/free-ride/service.d.ts +18 -2
  45. package/lib/types/routes/list/types.d.ts +11 -0
  46. package/lib/types/settings/display/ride/service.d.ts +1 -0
  47. package/lib/types/settings/display/ride/types.d.ts +4 -0
  48. package/package.json +3 -3
@@ -1,3 +1,4 @@
1
1
  export * from './base';
2
2
  export * from './display';
3
3
  export * from './page';
4
+ export * from './view-restriction';
@@ -12,6 +12,7 @@ import { RouteListService } from "../../routes/list/service";
12
12
  import type { Route } from "../../routes/base/model/route";
13
13
  import type { VideoDisplayProps } from "../base/types";
14
14
  import type { RouteVideoState } from "../../routes/video-availability/types";
15
+ import type { RideViewNoticeActionId, RideViewRestrictionDialogProps } from "../view-restriction/types";
15
16
  export declare class RidePageService extends IncyclistPageService implements IRidePageService {
16
17
  protected eventHandler: Record<string, any>;
17
18
  protected workoutEventHandler: Record<string, any>;
@@ -26,6 +27,7 @@ export declare class RidePageService extends IncyclistPageService implements IRi
26
27
  protected prevRidesVisibleRows: number;
27
28
  protected prevRidesMode: 'condensed' | 'list';
28
29
  protected gestureHintDismissed: boolean;
30
+ protected rideViewRestrictionDialog: RideViewRestrictionDialogProps | null;
29
31
  protected prevRidesShown: boolean;
30
32
  protected nearbyRiders?: RidePageDisplayProps['nearbyRiders'];
31
33
  protected nearbyRidersSubscribed: boolean;
@@ -62,6 +64,14 @@ export declare class RidePageService extends IncyclistPageService implements IRi
62
64
  protected getVideoEntryRouteId(entry: VideoDisplayProps): string | undefined;
63
65
  protected getActiveVideoPaths(video: VideoDisplayProps | undefined, videos: Array<VideoDisplayProps> | undefined): Array<string>;
64
66
  protected getGPXRideDisplayProps(): GPXRidePageDisplayProps;
67
+ protected canShowRideViewRestrictionNotice(base: ReturnType<RidePageService['buildBaseDisplayProps']>): boolean;
68
+ onRideViewNoticeAction(id: RideViewNoticeActionId): void;
69
+ onRideViewNoticeClosed(): void;
70
+ onOpenRideViewRestrictionDialog(): void;
71
+ onCloseRideViewRestrictionDialog(): void;
72
+ onRideViewReminderChanged(enabled: boolean): void;
73
+ onDiscardSimulatedRide(): Promise<void>;
74
+ protected openRideViewRestrictionDialog(): void;
65
75
  protected buildWorkoutOverlayProps(props: CurrentRideDisplayProps & {
66
76
  showWorkout?: boolean;
67
77
  }): Partial<RidePageDisplayProps>;
@@ -6,6 +6,7 @@ import type { LoadButtonMode, PowerAdjustmentResult } from "../../workouts/ride/
6
6
  import type { WorkoutGraphPlanBar } from "../../workouts/base/graph/types";
7
7
  import type { Avatar } from "../../avatars";
8
8
  import type { ActiveRideListAvatar } from "../../activities";
9
+ import type { RideViewNoticeActionId, RideViewRestriction, RideViewRestrictionDialogProps, RideViewRestrictionNoticeProps } from "../view-restriction/types";
9
10
  export interface StartGateProps {
10
11
  title: string;
11
12
  body: string;
@@ -113,6 +114,9 @@ export interface GPXRidePageDisplayProps extends RidePageDisplayProps {
113
114
  ts: number;
114
115
  };
115
116
  svHasCoverage?: boolean;
117
+ rideViewRestriction?: RideViewRestriction;
118
+ rideViewRestrictionNotice?: RideViewRestrictionNoticeProps;
119
+ rideViewRestrictionDialog?: RideViewRestrictionDialogProps | null;
116
120
  }
117
121
  export type AnyRidePageDisplayProps = VideoRidePageDisplayProps | GPXRidePageDisplayProps | RidePageDisplayProps;
118
122
  interface RidePageCallbacks {
@@ -127,6 +131,12 @@ interface RidePageCallbacks {
127
131
  onEndRide(): void;
128
132
  onRefreshSecrets(): void;
129
133
  onContinueAnyway(): void;
134
+ onRideViewNoticeAction(id: RideViewNoticeActionId): void;
135
+ onRideViewNoticeClosed(): void;
136
+ onOpenRideViewRestrictionDialog(): void;
137
+ onCloseRideViewRestrictionDialog(): void;
138
+ onRideViewReminderChanged(enabled: boolean): void;
139
+ onDiscardSimulatedRide(): Promise<void>;
130
140
  onStop(): void;
131
141
  onStopWorkout(): void;
132
142
  onStepBack(): void;
@@ -20,6 +20,7 @@ export declare class FreeRideDisplayService extends GpxDisplayService {
20
20
  protected prevViewport: MapViewPort;
21
21
  protected tsLastOptionChange: number;
22
22
  protected optionsVisible: boolean;
23
+ protected lastLoggedButtons: string | undefined;
23
24
  protected mapProps: MapOverlayDisplayProps;
24
25
  protected distanceRemaining: number;
25
26
  protected timeRemaining: number;
@@ -53,6 +54,8 @@ export declare class FreeRideDisplayService extends GpxDisplayService {
53
54
  getOverlayProps(overlay: any, props?: CurrentRideDisplayProps): MapOverlayDisplayProps;
54
55
  onActivityUpdate(activityPos: ActivityUpdate, data: any): void;
55
56
  getLogProps(): object;
57
+ protected getOptionsState(): 'loading' | 'ready' | 'none' | 'failed';
58
+ protected getButtonsLogInfo(): string;
56
59
  protected getOptionsId(): string;
57
60
  protected getMapProps(): Partial<MapOverlayDisplayProps>;
58
61
  protected _createRouteFromPoints(points: RoutePoint[]): void;
@@ -66,7 +69,7 @@ export declare class FreeRideDisplayService extends GpxDisplayService {
66
69
  protected getViewport(): MapViewPort;
67
70
  protected getMapBounds(): number[][] | undefined;
68
71
  protected getMapCenter(): LatLng;
69
- protected onOptionsVisibleChanged(visible: any): void;
72
+ protected onOptionsVisibleChanged(visible: boolean, reason?: string): void;
70
73
  protected emitRouteUpdate(): void;
71
74
  protected emitOptionsUpdate(): void;
72
75
  protected updatePosition(activityPos: ActivityUpdate): CurrentPosition;
@@ -39,6 +39,7 @@ export declare class GpxDisplayService extends RouteDisplayService {
39
39
  ts: number;
40
40
  };
41
41
  protected svHasCoverage: boolean;
42
+ protected restrictionEvaluated: boolean;
42
43
  protected svPhaseDelayTimeout: NodeJS.Timeout;
43
44
  protected svSlowTimeout: NodeJS.Timeout;
44
45
  protected svStartTimeout: NodeJS.Timeout;
@@ -46,6 +47,9 @@ export declare class GpxDisplayService extends RouteDisplayService {
46
47
  constructor();
47
48
  protected initView(): void;
48
49
  getStreetViewProps(rideProps: CurrentRideDisplayProps): any;
50
+ start(): void;
51
+ protected startViewRestriction(): void;
52
+ protected endViewRestriction(): void;
49
53
  isSideViewsSupported(): boolean;
50
54
  protected getInitialStreetViewPosition(): CurrentPosition;
51
55
  protected getSatelliteViewPosition(): CurrentPosition;
@@ -132,5 +136,6 @@ export declare class GpxDisplayService extends RouteDisplayService {
132
136
  protected getGoogleMaps(): GoogleMapsService;
133
137
  protected getBindings(): import("../../api").IncyclistBindings;
134
138
  protected getRideSettingsDisplay(): import("../../settings/display").RideSettingsDisplayService;
139
+ protected getRideViewRestriction(): import("../view-restriction/service").RideViewRestrictionService;
135
140
  protected getAppState(): import("../../appstate").AppStateService;
136
141
  }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './service';
@@ -0,0 +1,30 @@
1
+ import { IncyclistService } from '../../base/service';
2
+ import { RideViewDeviceOption, RideViewNoticeActionId, RideViewOwnKeyOption, RideViewRestriction, RideViewRestrictionDialogProps, RideViewRestrictionNoticeProps, RideViewRestrictionStartProps } from './types';
3
+ type NoticeState = 'inactive' | 'armed' | 'due' | 'acknowledged' | 'closed';
4
+ export declare class RideViewRestrictionService extends IncyclistService {
5
+ protected restriction?: RideViewRestriction;
6
+ protected noticeState: NoticeState;
7
+ protected noticeId: number;
8
+ constructor();
9
+ beginRide(props: RideViewRestrictionStartProps): void;
10
+ onRideStarted(): void;
11
+ endRide(): void;
12
+ getActiveRestriction(): RideViewRestriction | undefined;
13
+ getNotice(): RideViewRestrictionNoticeProps | undefined;
14
+ onNoticeAction(id: RideViewNoticeActionId): void;
15
+ onNoticeClosed(): void;
16
+ isReminderEnabled(): boolean;
17
+ setReminderEnabled(enabled: boolean): void;
18
+ getDialogProps(props?: {
19
+ inRide?: boolean;
20
+ }): RideViewRestrictionDialogProps;
21
+ protected isNoticeWanted(restriction: RideViewRestriction): boolean;
22
+ protected getDeviceOption(inRide: boolean): RideViewDeviceOption;
23
+ protected getOwnKeyOption(): RideViewOwnKeyOption;
24
+ protected isMobile(): boolean;
25
+ protected getAppState(): import("../../appstate/service").AppStateService;
26
+ protected getGoogleMaps(): import("../../apps/googleMaps/service").GoogleMapsService;
27
+ protected getBindings(): import("../../api").IncyclistBindings;
28
+ }
29
+ export declare const useRideViewRestriction: () => RideViewRestrictionService;
30
+ export {};
@@ -0,0 +1,57 @@
1
+ export type RideViewRestrictionCause = 'simulation';
2
+ export type RideViewRestrictionView = 'sv' | 'sat' | 'map';
3
+ export interface RideViewRestriction {
4
+ cause: RideViewRestrictionCause;
5
+ preferredView: RideViewRestrictionView;
6
+ }
7
+ export interface RideViewRestrictionStartProps {
8
+ simulated: boolean;
9
+ preferredView: RideViewRestrictionView;
10
+ }
11
+ export type RideViewNoticeActionId = 'how-to' | 'dont-show-again' | 'change-this';
12
+ export interface RideViewRestrictionNoticeProps {
13
+ id: number;
14
+ state: 'message' | 'acknowledged';
15
+ text?: string;
16
+ actions: Array<{
17
+ id: RideViewNoticeActionId;
18
+ label: string;
19
+ }>;
20
+ }
21
+ export interface RideViewDeviceOption {
22
+ id: 'device';
23
+ heading?: string;
24
+ text: string;
25
+ discard?: {
26
+ label: string;
27
+ confirm: {
28
+ question: string;
29
+ confirmLabel: string;
30
+ cancelLabel: string;
31
+ };
32
+ };
33
+ }
34
+ export interface RideViewOwnKeyOption {
35
+ id: 'own-key';
36
+ heading: string;
37
+ text: string;
38
+ addKey?: {
39
+ label: string;
40
+ };
41
+ helpLink: {
42
+ label: string;
43
+ url: string;
44
+ };
45
+ pendingRestart?: {
46
+ text: string;
47
+ };
48
+ }
49
+ export interface RideViewRestrictionDialogProps {
50
+ title: string;
51
+ body: string;
52
+ options: Array<RideViewDeviceOption | RideViewOwnKeyOption>;
53
+ reminder?: {
54
+ label: string;
55
+ checked: boolean;
56
+ };
57
+ }
@@ -12,13 +12,20 @@ export declare class FreeRideService extends IncyclistService {
12
12
  protected initialized: boolean;
13
13
  protected ivInit?: NodeJS.Timeout;
14
14
  protected cntInitRetry: number;
15
+ protected rideSeq: number;
16
+ protected selectedBy: 'auto' | 'user';
17
+ protected startSource: 'default' | 'last' | 'search' | 'map';
15
18
  constructor();
16
19
  init(): void;
17
20
  isInitialized(): boolean;
18
- selectStartPosition(position?: LatLng | undefined): Promise<{
21
+ selectStartPosition(position?: LatLng | undefined, opts?: {
22
+ source?: 'search' | 'map';
23
+ }): Promise<{
19
24
  position: IncyclistNode;
20
25
  options: FreeRideOption[];
21
26
  }>;
27
+ getStartSource(): 'default' | 'last' | 'search' | 'map';
28
+ protected getDefaultSource(position?: LatLng): 'default' | 'last';
22
29
  getStartPosition(): IncyclistNode;
23
30
  getRouteDefinitionDisplayProps(): {
24
31
  position: IncyclistNode;
@@ -42,6 +49,7 @@ export declare class FreeRideService extends IncyclistService {
42
49
  protected buildId(opt: FreeRideContinuation): string;
43
50
  getOptions(): FreeRideContinuation[];
44
51
  isLastQueryValid(): boolean;
52
+ selectOptionByUser(option: FreeRideContinuation | string | number): FreeRideContinuation[];
45
53
  selectOption(option: FreeRideContinuation | string | number): FreeRideContinuation[];
46
54
  applyOption(option?: FreeRideContinuation): void;
47
55
  applyStartOption(startOption?: FreeRideOption): void;
@@ -50,7 +58,15 @@ export declare class FreeRideService extends IncyclistService {
50
58
  protected getPath(option: FreeRideContinuation): FreeRidePoint[];
51
59
  buildUIOptions(opts?: FreeRideContinuation[]): FreeRideOption[];
52
60
  protected buildStartOptions(): FreeRideOption[];
53
- protected getStartOptions(map: IMapArea): Promise<void>;
61
+ protected getWayTags(option: FreeRideContinuation): Record<string, string> | undefined;
62
+ protected getOptionHeading(option: FreeRideContinuation): number | undefined;
63
+ protected getOptionsLogProps(): {
64
+ count: number;
65
+ named: number;
66
+ degraded: number;
67
+ };
68
+ protected getSelectionLogProps(): Record<string, string | number | boolean>;
69
+ protected getStartOptions(map: IMapArea, rideSeq?: number): Promise<void>;
54
70
  protected setStartPosition(position?: LatLng): void;
55
71
  protected getDefaultStartPosition(): IncyclistNode;
56
72
  protected getOptionText(option: FreeRideContinuation): string;
@@ -22,6 +22,7 @@ export interface FreeRideSegment {
22
22
  path: Array<FreeRidePoints>;
23
23
  }
24
24
  export type FreeRidePoint = IncyclistNode & RoutePoint;
25
+ export type FreeRideManeuver = 'straight' | 'slight-left' | 'slight-right' | 'left' | 'right' | 'sharp-left' | 'sharp-right' | 'keep-left' | 'keep-right' | 'u-turn' | 'roundabout' | 'unknown';
25
26
  export interface FreeRideOption {
26
27
  id: string;
27
28
  color: string;
@@ -33,6 +34,16 @@ export interface FreeRideOption {
33
34
  distance: number;
34
35
  direction: number;
35
36
  };
37
+ index?: number;
38
+ maneuver?: FreeRideManeuver;
39
+ maneuverText?: string;
40
+ compass?: string;
41
+ heading?: number;
42
+ roadName?: string;
43
+ roadLabel?: string;
44
+ isDefault?: boolean;
45
+ selectedBy?: 'auto' | 'user';
46
+ degraded?: boolean;
36
47
  }
37
48
  export interface FreeRideStartSettings {
38
49
  position: LatLng;
@@ -23,6 +23,7 @@ export declare class RideSettingsDisplayService extends IncyclistService {
23
23
  protected isMobile(): boolean;
24
24
  protected isAndroid(): boolean;
25
25
  protected isIOS(): boolean;
26
+ protected getRideViewRestriction(): import("../../../ride/view-restriction/service").RideViewRestrictionService;
26
27
  protected getUserSettings(): UserSettingsService;
27
28
  protected getBindings(): import("../../../api").IncyclistBindings;
28
29
  }
@@ -3,6 +3,7 @@ export interface TRideViewOption {
3
3
  label: string;
4
4
  disabled?: boolean;
5
5
  message?: string;
6
+ reason?: 'simulation';
6
7
  }
7
8
  export interface TVideoOption {
8
9
  enableAudio: boolean;
@@ -10,6 +11,9 @@ export interface TVideoOption {
10
11
  export interface RideSettingsDisplayProps {
11
12
  rideView: TRideView;
12
13
  rideViewOptions: Map<TRideView, TRideViewOption>;
14
+ rideViewHelp?: {
15
+ label: string;
16
+ };
13
17
  showVideo?: boolean;
14
18
  videoOptions?: TVideoOption;
15
19
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.9.11",
3
+ "version": "1.9.13",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },
7
7
  "dependencies": {
8
- "@garmin/fitsdk": "^21.217.0",
9
- "axios": "^1.20.0",
8
+ "@garmin/fitsdk": "^21.218.0",
9
+ "axios": "^1.21.0",
10
10
  "incyclist-devices": "^3.0.42",
11
11
  "promise.any": "^2.0.6",
12
12
  "semver": "^7.7.4",