incyclist-services 1.9.1 → 1.9.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/lib/cjs/devices/page/index.js +5 -1
- package/lib/esm/devices/page/index.js +2 -0
- package/lib/esm/devices/page/service.js +6 -70
- package/lib/types/appstate/types.d.ts +1 -1
- package/lib/types/devices/page/index.d.ts +2 -0
- package/lib/types/devices/page/service.d.ts +1 -9
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevicesPageService = exports.initPairingVisitTracker = exports.usePairingVisitTracker = exports.PairingVisitTracker = void 0;
|
|
3
|
+
exports.getDevicesPageService = exports.DesktopPairingPageService = exports.MobilePairingPageService = exports.initPairingVisitTracker = exports.usePairingVisitTracker = exports.PairingVisitTracker = void 0;
|
|
4
4
|
const api_1 = require("../../api");
|
|
5
5
|
const service_1 = require("./mobile/service");
|
|
6
6
|
const service_2 = require("./desktop/service");
|
|
@@ -9,6 +9,10 @@ Object.defineProperty(exports, "PairingVisitTracker", { enumerable: true, get: f
|
|
|
9
9
|
var visit_log_factory_1 = require("./base/visit-log-factory");
|
|
10
10
|
Object.defineProperty(exports, "usePairingVisitTracker", { enumerable: true, get: function () { return visit_log_factory_1.usePairingVisitTracker; } });
|
|
11
11
|
Object.defineProperty(exports, "initPairingVisitTracker", { enumerable: true, get: function () { return visit_log_factory_1.initPairingVisitTracker; } });
|
|
12
|
+
var service_3 = require("./mobile/service");
|
|
13
|
+
Object.defineProperty(exports, "MobilePairingPageService", { enumerable: true, get: function () { return service_3.MobilePairingPageService; } });
|
|
14
|
+
var service_4 = require("./desktop/service");
|
|
15
|
+
Object.defineProperty(exports, "DesktopPairingPageService", { enumerable: true, get: function () { return service_4.DesktopPairingPageService; } });
|
|
12
16
|
const getDevicesPageService = () => {
|
|
13
17
|
const channel = (0, api_1.getBindings)().appInfo.getChannel();
|
|
14
18
|
if (channel === 'desktop' || channel === 'web')
|
|
@@ -3,6 +3,8 @@ import { MobilePairingPageService } from './mobile/service';
|
|
|
3
3
|
import { DesktopPairingPageService } from './desktop/service';
|
|
4
4
|
export { PairingVisitTracker } from './base/visit-log';
|
|
5
5
|
export { usePairingVisitTracker, initPairingVisitTracker } from './base/visit-log-factory';
|
|
6
|
+
export { MobilePairingPageService } from './mobile/service';
|
|
7
|
+
export { DesktopPairingPageService } from './desktop/service';
|
|
6
8
|
export const getDevicesPageService = () => {
|
|
7
9
|
const channel = getBindings().appInfo.getChannel();
|
|
8
10
|
if (channel === 'desktop' || channel === 'web')
|
|
@@ -35,16 +35,14 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
35
35
|
import { EventLogger } from 'gd-eventlog';
|
|
36
36
|
import { Injectable, Singleton } from '../../base/decorators';
|
|
37
37
|
import { IncyclistPageService } from '../../base/pages';
|
|
38
|
-
import { useDevicePairing
|
|
38
|
+
import { useDevicePairing } from '../pairing';
|
|
39
39
|
import { PairingPageStateMachine } from './statemachine';
|
|
40
40
|
import { PageLogObserver } from './logobserver';
|
|
41
41
|
import { useDeviceAccess } from '../access';
|
|
42
|
-
import { IncyclistCapability } from 'incyclist-devices';
|
|
43
42
|
import { useDeviceConfiguration } from '../configuration';
|
|
44
43
|
import { useIncyclist } from '../../ui';
|
|
45
44
|
import { Observer } from '../../base/types';
|
|
46
45
|
import { useDeviceRide } from '../ride';
|
|
47
|
-
import { usePairingVisitTracker } from './visit-log-factory';
|
|
48
46
|
let DevicesPageService = (() => {
|
|
49
47
|
let _classDecorators = [Singleton];
|
|
50
48
|
let _classDescriptor;
|
|
@@ -56,7 +54,6 @@ let DevicesPageService = (() => {
|
|
|
56
54
|
let _getDeviceRide_decorators;
|
|
57
55
|
let _getDeviceConfiguration_decorators;
|
|
58
56
|
let _getIncyclist_decorators;
|
|
59
|
-
let _getPairingVisitTracker_decorators;
|
|
60
57
|
var DevicesPageService = class extends _classSuper {
|
|
61
58
|
static { _classThis = this; }
|
|
62
59
|
static {
|
|
@@ -65,12 +62,10 @@ let DevicesPageService = (() => {
|
|
|
65
62
|
_getDeviceRide_decorators = [Injectable];
|
|
66
63
|
_getDeviceConfiguration_decorators = [Injectable];
|
|
67
64
|
_getIncyclist_decorators = [Injectable];
|
|
68
|
-
_getPairingVisitTracker_decorators = [Injectable];
|
|
69
65
|
__esDecorate(this, null, _getDevicePairing_decorators, { kind: "method", name: "getDevicePairing", static: false, private: false, access: { has: obj => "getDevicePairing" in obj, get: obj => obj.getDevicePairing }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
70
66
|
__esDecorate(this, null, _getDeviceRide_decorators, { kind: "method", name: "getDeviceRide", static: false, private: false, access: { has: obj => "getDeviceRide" in obj, get: obj => obj.getDeviceRide }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
71
67
|
__esDecorate(this, null, _getDeviceConfiguration_decorators, { kind: "method", name: "getDeviceConfiguration", static: false, private: false, access: { has: obj => "getDeviceConfiguration" in obj, get: obj => obj.getDeviceConfiguration }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
72
68
|
__esDecorate(this, null, _getIncyclist_decorators, { kind: "method", name: "getIncyclist", static: false, private: false, access: { has: obj => "getIncyclist" in obj, get: obj => obj.getIncyclist }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
|
-
__esDecorate(this, null, _getPairingVisitTracker_decorators, { kind: "method", name: "getPairingVisitTracker", static: false, private: false, access: { has: obj => "getPairingVisitTracker" in obj, get: obj => obj.getPairingVisitTracker }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
69
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
75
70
|
DevicesPageService = _classThis = _classDescriptor.value;
|
|
76
71
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -83,7 +78,6 @@ let DevicesPageService = (() => {
|
|
|
83
78
|
openedInterfaceSettings;
|
|
84
79
|
interfaceSettingsObserver;
|
|
85
80
|
isPairingForRide = false;
|
|
86
|
-
isVisitOpen = false;
|
|
87
81
|
constructor() {
|
|
88
82
|
super('pairing');
|
|
89
83
|
this.stateMachine = new PairingPageStateMachine();
|
|
@@ -93,7 +87,6 @@ let DevicesPageService = (() => {
|
|
|
93
87
|
try {
|
|
94
88
|
this.logEvent({ message: 'page shown', page: 'Pairing', forRide });
|
|
95
89
|
this.isPairingForRide = forRide ?? false;
|
|
96
|
-
this.openVisit();
|
|
97
90
|
EventLogger.setGlobalConfig('page', 'Pairing');
|
|
98
91
|
super.openPage();
|
|
99
92
|
if (this.promiseOpen !== undefined) {
|
|
@@ -123,7 +116,6 @@ let DevicesPageService = (() => {
|
|
|
123
116
|
closePage() {
|
|
124
117
|
try {
|
|
125
118
|
this.logEvent({ message: 'page closed', page: 'Pairing' });
|
|
126
|
-
this.isVisitOpen = false;
|
|
127
119
|
EventLogger.setGlobalConfig('page', null);
|
|
128
120
|
this.isPairingForRide = false;
|
|
129
121
|
super.closePage();
|
|
@@ -136,7 +128,6 @@ let DevicesPageService = (() => {
|
|
|
136
128
|
}
|
|
137
129
|
async pausePage() {
|
|
138
130
|
try {
|
|
139
|
-
this.trackVisit(t => t.onBackground({ canStartRide: this.canStartRide() }), 'onBackground');
|
|
140
131
|
await this.stateMachine.pause();
|
|
141
132
|
this.logEvent({ message: 'page paused', page: 'Pairing' });
|
|
142
133
|
}
|
|
@@ -146,7 +137,6 @@ let DevicesPageService = (() => {
|
|
|
146
137
|
}
|
|
147
138
|
async resumePage() {
|
|
148
139
|
try {
|
|
149
|
-
this.trackVisit(t => t.onForeground(), 'onForeground');
|
|
150
140
|
this.stateMachine.resume();
|
|
151
141
|
if (this.promiseOpen !== undefined)
|
|
152
142
|
return;
|
|
@@ -183,38 +173,23 @@ let DevicesPageService = (() => {
|
|
|
183
173
|
const ifs = this.state.interfaces ?? [];
|
|
184
174
|
useDeviceAccess().enrichWithAccessState(ifs);
|
|
185
175
|
const interfaces = ifs.map(i => { return this.getInterfaceDisplayProps(i); });
|
|
176
|
+
const capProps = caps.map(c => this.getCapabilityDisplayProps(c));
|
|
186
177
|
const loading = this.promiseOpen != undefined;
|
|
187
|
-
const status = getPairingStatusDisplay({
|
|
188
|
-
platform: 'mobile',
|
|
189
|
-
interfaces: toPairingInterfaceStates(ifs),
|
|
190
|
-
capabilities: caps,
|
|
191
|
-
canStartRide: this.canStartRide(),
|
|
192
|
-
loading,
|
|
193
|
-
rideMode: this.isPairingForRide,
|
|
194
|
-
});
|
|
195
|
-
const capProps = caps.map(c => this.getCapabilityDisplayProps(c, status.id === 'S1'));
|
|
196
178
|
const CP = (cap) => capProps.find(c => c.capability === cap);
|
|
197
179
|
const top = [
|
|
198
180
|
CP('control'),
|
|
199
181
|
CP('power'),
|
|
200
|
-
CP('
|
|
182
|
+
CP('heartrate')
|
|
201
183
|
].filter(c => c !== null && c !== undefined);
|
|
202
184
|
const bottom = [
|
|
203
|
-
CP('heartrate'),
|
|
204
185
|
CP('cadence'),
|
|
186
|
+
CP('speed'),
|
|
205
187
|
CP('app_control')
|
|
206
188
|
].filter(c => c !== null && c !== undefined);
|
|
207
|
-
const trainerSelected = Boolean(caps.find(c => c.capability === IncyclistCapability.Control)?.selected);
|
|
208
|
-
const rowLabels = {
|
|
209
|
-
top: getPairingGuidanceText(getPairingRowLabelId(trainerSelected)),
|
|
210
|
-
bottom: getPairingGuidanceText('row-optional'),
|
|
211
|
-
};
|
|
212
189
|
const buttons = this.getButtonsDisplayProps();
|
|
213
190
|
return {
|
|
214
191
|
title,
|
|
215
|
-
|
|
216
|
-
status,
|
|
217
|
-
capabilities: { top, bottom, rowLabels },
|
|
192
|
+
capabilities: { top, bottom },
|
|
218
193
|
interfaces,
|
|
219
194
|
deviceSelection: this.getDeviceListDisplayProps(),
|
|
220
195
|
showInterfaceSettings: this.openedInterfaceSettings,
|
|
@@ -257,7 +232,7 @@ let DevicesPageService = (() => {
|
|
|
257
232
|
this.interfaceSettingsObserver?.stop();
|
|
258
233
|
this.updatePage();
|
|
259
234
|
}
|
|
260
|
-
getCapabilityDisplayProps(data
|
|
235
|
+
getCapabilityDisplayProps(data) {
|
|
261
236
|
const { capability: cap, deviceName, connectState, value, unit, disabled } = data;
|
|
262
237
|
const capability = this.getTCapability(cap);
|
|
263
238
|
const adapaters = this.state.adapters ?? [];
|
|
@@ -265,19 +240,8 @@ let DevicesPageService = (() => {
|
|
|
265
240
|
const ifName = adapter?.adapter?.getInterface();
|
|
266
241
|
const title = this.getDisplayCapability(cap);
|
|
267
242
|
const onClick = () => { this.openDeviceSelection(cap); };
|
|
268
|
-
const role = PAIRING_CAPABILITY_ROLES.find(r => r.capability === cap)?.role;
|
|
269
|
-
const helpText = {
|
|
270
|
-
full: getCapabilityHelpText(capability, 'full') ?? '',
|
|
271
|
-
short: getCapabilityHelpText(capability, 'short') ?? '',
|
|
272
|
-
};
|
|
273
|
-
let emptyFooter = undefined;
|
|
274
|
-
if (noSearch)
|
|
275
|
-
emptyFooter = 'Not searching';
|
|
276
|
-
else if (role)
|
|
277
|
-
emptyFooter = getEmptyTileFooterText(role);
|
|
278
243
|
return {
|
|
279
244
|
title, capability, deviceName: !disabled ? deviceName : undefined, disabled, connectState, value: value?.toString(), unit, interface: ifName,
|
|
280
|
-
role, helpText, emptyFooter,
|
|
281
245
|
onClick
|
|
282
246
|
};
|
|
283
247
|
}
|
|
@@ -407,34 +371,11 @@ let DevicesPageService = (() => {
|
|
|
407
371
|
};
|
|
408
372
|
return mapping[capabability];
|
|
409
373
|
}
|
|
410
|
-
trackVisit(fn, name) {
|
|
411
|
-
try {
|
|
412
|
-
fn(this.getPairingVisitTracker());
|
|
413
|
-
}
|
|
414
|
-
catch (err) {
|
|
415
|
-
this.logError(err, name);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
openVisit() {
|
|
419
|
-
if (this.isVisitOpen)
|
|
420
|
-
return;
|
|
421
|
-
this.trackVisit(t => t.openVisit({ forRide: this.isPairingForRide }), 'openVisit');
|
|
422
|
-
this.isVisitOpen = true;
|
|
423
|
-
}
|
|
424
|
-
closeVisit(via) {
|
|
425
|
-
this.trackVisit(t => t.closeVisit(via, { canStartRide: this.canStartRide() }), 'closeVisit');
|
|
426
|
-
this.isVisitOpen = false;
|
|
427
|
-
}
|
|
428
|
-
canStartRide() {
|
|
429
|
-
return this.state?.canStartRide ?? false;
|
|
430
|
-
}
|
|
431
374
|
onSkip() {
|
|
432
|
-
this.closeVisit('skip');
|
|
433
375
|
const nextPage = this.getAppState().getPersistedState('page') ?? 'routes';
|
|
434
376
|
this.moveTo(`/${nextPage}`);
|
|
435
377
|
}
|
|
436
378
|
onOK() {
|
|
437
|
-
this.closeVisit('ok');
|
|
438
379
|
this.getDevicePairing().prepareStart();
|
|
439
380
|
this.getDevicePairing().setReadyToStart();
|
|
440
381
|
this.getAppState().setState('paired', true);
|
|
@@ -451,7 +392,6 @@ let DevicesPageService = (() => {
|
|
|
451
392
|
}
|
|
452
393
|
}
|
|
453
394
|
onSimulate() {
|
|
454
|
-
this.closeVisit('simulate');
|
|
455
395
|
const simulator = this.getDeviceConfiguration().getSimulatorAdapterId();
|
|
456
396
|
this.getDevicePairing().prepareStart([simulator]);
|
|
457
397
|
const prevContentPage = this.getPrevContentPage();
|
|
@@ -461,7 +401,6 @@ let DevicesPageService = (() => {
|
|
|
461
401
|
this.moveTo(prevContentPage);
|
|
462
402
|
}
|
|
463
403
|
onCancel() {
|
|
464
|
-
this.closeVisit('cancel');
|
|
465
404
|
const nextPage = this.getAppState().getState('prevPage');
|
|
466
405
|
this.moveTo(`/${nextPage}`);
|
|
467
406
|
}
|
|
@@ -489,9 +428,6 @@ let DevicesPageService = (() => {
|
|
|
489
428
|
getIncyclist() {
|
|
490
429
|
return useIncyclist();
|
|
491
430
|
}
|
|
492
|
-
getPairingVisitTracker() {
|
|
493
|
-
return usePairingVisitTracker();
|
|
494
|
-
}
|
|
495
431
|
};
|
|
496
432
|
return DevicesPageService = _classThis;
|
|
497
433
|
})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type FeatureToggle = '
|
|
1
|
+
export type FeatureToggle = 'WEBBLE_WINDOWS' | 'MOBILE_NEXT_VIDEO' | 'VIDEO_ROUTE' | 'SV_EAGER_INIT';
|
|
2
2
|
export type Interfaces = 'ant' | 'ble' | 'serial' | 'wifi' | 'tcpip';
|
|
3
3
|
export type BLEFeatures = {
|
|
4
4
|
services: Array<string>;
|
|
@@ -2,4 +2,6 @@ import { MobilePairingPageService } from './mobile/service';
|
|
|
2
2
|
import { DesktopPairingPageService } from './desktop/service';
|
|
3
3
|
export { PairingVisitTracker } from './base/visit-log';
|
|
4
4
|
export { usePairingVisitTracker, initPairingVisitTracker } from './base/visit-log-factory';
|
|
5
|
+
export { MobilePairingPageService } from './mobile/service';
|
|
6
|
+
export { DesktopPairingPageService } from './desktop/service';
|
|
5
7
|
export declare const getDevicesPageService: () => MobilePairingPageService | DesktopPairingPageService;
|
|
@@ -6,8 +6,6 @@ import { PageLogObserver } from './logobserver';
|
|
|
6
6
|
import { EnrichedInterfaceSetting, InterfaceState } from '../access';
|
|
7
7
|
import { IncyclistCapability } from 'incyclist-devices';
|
|
8
8
|
import { Observer } from '../../base/types';
|
|
9
|
-
import type { PairingVisitTracker } from './visit-log';
|
|
10
|
-
import type { PairingExitVia } from './types';
|
|
11
9
|
export declare class DevicesPageService extends IncyclistPageService {
|
|
12
10
|
protected promiseOpen: Promise<void> | undefined;
|
|
13
11
|
protected stateMachine: PairingPageStateMachine;
|
|
@@ -16,7 +14,6 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
16
14
|
protected openedInterfaceSettings: TInterface;
|
|
17
15
|
protected interfaceSettingsObserver: Observer | undefined;
|
|
18
16
|
protected isPairingForRide: boolean;
|
|
19
|
-
protected isVisitOpen: boolean;
|
|
20
17
|
constructor();
|
|
21
18
|
openPage(forRide?: boolean): IObserver;
|
|
22
19
|
closePage(): void;
|
|
@@ -30,7 +27,7 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
30
27
|
reconnectInterface(i?: TInterface): void;
|
|
31
28
|
refreshInterface(i?: TInterface): void;
|
|
32
29
|
closeInterfaceSettings(): void;
|
|
33
|
-
protected getCapabilityDisplayProps(data: CapabilityData
|
|
30
|
+
protected getCapabilityDisplayProps(data: CapabilityData): CapabilityDisplayProps;
|
|
34
31
|
protected mapInterfaceState(state: InterfaceState): InterfaceDisplayState;
|
|
35
32
|
protected getInterfaceDisplayProps(info: EnrichedInterfaceSetting): InterfaceDisplayProps;
|
|
36
33
|
protected getDeviceListDisplayProps(): DeviceSelectionProps | undefined;
|
|
@@ -44,10 +41,6 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
44
41
|
protected getButtonsDisplayProps(): PairingButtonProps;
|
|
45
42
|
protected getTCapability(capabability: IncyclistCapability): TIncyclistCapability;
|
|
46
43
|
protected getDisplayCapability(capabability: IncyclistCapability): TDisplayCapability;
|
|
47
|
-
protected trackVisit(fn: (tracker: PairingVisitTracker) => void, name: string): void;
|
|
48
|
-
protected openVisit(): void;
|
|
49
|
-
protected closeVisit(via: PairingExitVia): void;
|
|
50
|
-
protected canStartRide(): boolean;
|
|
51
44
|
protected onSkip(): void;
|
|
52
45
|
protected onOK(): void;
|
|
53
46
|
protected onSimulate(): void;
|
|
@@ -59,6 +52,5 @@ export declare class DevicesPageService extends IncyclistPageService {
|
|
|
59
52
|
protected getDeviceRide(): import("../ride").DeviceRideService;
|
|
60
53
|
protected getDeviceConfiguration(): import("../configuration").DeviceConfigurationService;
|
|
61
54
|
protected getIncyclist(): import("../../ui").UserInterfaceServcie;
|
|
62
|
-
protected getPairingVisitTracker(): PairingVisitTracker;
|
|
63
55
|
}
|
|
64
56
|
export declare const getDevicesPageService: () => DevicesPageService;
|