@stacksjs/mobile 0.75.41 → 0.75.43

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 (2) hide show
  1. package/dist/index.d.ts +175 -170
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -3,40 +3,12 @@
3
3
  * Generated from 5 source files
4
4
  */
5
5
 
6
-
7
6
  // From: src/index.ts
8
- export declare const biometrics: BiometricsApi;
9
- export declare const camera: CameraApi;
10
- export declare const device: DeviceApi;
11
- export declare const haptics: HapticsApi;
12
- export declare const lifecycle: LifecycleApi;
13
- export declare const location: LocationApi;
14
- export declare const notifications: NotificationsApi;
15
- export declare const permissions: PermissionsApi;
16
- export declare const secureStorage: SecureStorageApi;
17
- export declare const share: ShareApi;
18
- export declare const appReview: AppReviewApi;
19
- export declare function normalizeDeepLinkURL(value: unknown): string | null;
20
- /**
21
- * Deep links, asked of the bridge once there is one.
22
- *
23
- * A page mounts before Craft installs its bridge, and a page that follows its
24
- * links from mount (NativeAppShell does) asked too early: getInitialURL found
25
- * no bridge and answered null, and the launch link, delivered a moment later
26
- * marked `initial`, was skipped as already handled. An app opened from a link
27
- * landed on its home screen. Both calls now wait for the bridge; Craft holds
28
- * any link that arrives meanwhile until the first subscriber.
29
- */
30
- export declare const deepLinks: DeepLinksApi;
31
- export declare const keepAwake: KeepAwakeApi;
32
- export declare const network: NetworkApi;
33
- export declare const pushNotifications: PushNotificationsApi;
34
- export declare const health: HealthApi;
35
- export declare const liveActivities: LiveActivitiesApi;
36
- export declare const watchConnectivity: WatchConnectivityApi;
7
+ declare function normalizeDeepLinkURL(value: unknown): string | null;
8
+ declare function host(): CraftHost | undefined;
37
9
  /** Reads the current host, including a bridge injected after this module loaded. */
38
- export declare function getNativeMobileBridge(): CraftMobileBridge | null;
39
- export declare function isNativeMobile(): boolean;
10
+ declare function getNativeMobileBridge(): CraftMobileBridge | null;
11
+ declare function isNativeMobile(): boolean;
40
12
  /**
41
13
  * Whether this page runs inside Craft's phone shell, before the bridge exists.
42
14
  *
@@ -47,7 +19,7 @@ export declare function isNativeMobile(): boolean;
47
19
  * on iOS the `craft` message handler. Craft's macOS windows carry that handler
48
20
  * too, so on iOS an iPhone or iPad user agent is what makes it the phone app.
49
21
  */
50
- export declare function hasNativeMobileHost(): boolean;
22
+ declare function hasNativeMobileHost(): boolean;
51
23
  /**
52
24
  * Resolves `true` inside the phone shell and `false` in a browser, at a moment
53
25
  * when the answer is right.
@@ -57,7 +29,7 @@ export declare function hasNativeMobileHost(): boolean;
57
29
  * a floor for a host that never fires it: a caller waiting on this has to
58
30
  * decide something to render anything.
59
31
  */
60
- export declare function whenNativeMobile(timeoutMs?: number): Promise<boolean>;
32
+ declare function whenNativeMobile(timeoutMs?: number): Promise<boolean>;
61
33
  /**
62
34
  * Resolves once the bridge object (`window.craft`) is installed: `true` then,
63
35
  * `false` in a browser at once, or after `timeoutMs` in a host that never
@@ -66,33 +38,53 @@ export declare function whenNativeMobile(timeoutMs?: number): Promise<boolean>;
66
38
  * Not whenNativeMobile(), which answers `true` as soon as the phone shell is
67
39
  * recognisable, before the bridge exists and before anything can be asked of it.
68
40
  */
69
- export declare function whenBridgeReady(timeoutMs?: unknown): Promise<boolean>;
70
- export declare function onMobileReady(callback: (event: CraftReadyEvent) => void): () => void;
71
- export declare function withNativeFeedback<T>(action: () => T | Promise<T>): Promise<T>;
72
- export declare const mobile: MobileApi;
41
+ declare function whenBridgeReady(timeoutMs?: unknown): Promise<boolean>;
42
+ declare function onMobileReady(callback: (event: CraftReadyEvent) => void): () => void;
43
+ declare function withNativeFeedback<T>(action: () => T | Promise<T>): Promise<T>;
44
+ declare const biometrics: BiometricsApi;
45
+ declare const camera: CameraApi;
46
+ declare const device: DeviceApi;
47
+ declare const haptics: HapticsApi;
48
+ declare const lifecycle: LifecycleApi;
49
+ declare const location: LocationApi;
50
+ declare const notifications: NotificationsApi;
51
+ declare const permissions: PermissionsApi;
52
+ declare const secureStorage: SecureStorageApi;
53
+ declare const share: ShareApi;
54
+ declare const appReview: AppReviewApi;
55
+ /**
56
+ * Deep links, asked of the bridge once there is one.
57
+ *
58
+ * A page mounts before Craft installs its bridge, and a page that follows its
59
+ * links from mount (NativeAppShell does) asked too early: getInitialURL found
60
+ * no bridge and answered null, and the launch link, delivered a moment later
61
+ * marked `initial`, was skipped as already handled. An app opened from a link
62
+ * landed on its home screen. Both calls now wait for the bridge; Craft holds
63
+ * any link that arrives meanwhile until the first subscriber.
64
+ */
65
+ declare const deepLinks: DeepLinksApi;
66
+ declare const keepAwake: KeepAwakeApi;
67
+ declare const network: NetworkApi;
68
+ declare const pushNotifications: PushNotificationsApi;
69
+ declare const health: HealthApi;
70
+ declare const liveActivities: LiveActivitiesApi;
71
+ declare const watchConnectivity: WatchConnectivityApi;
72
+ declare const mobile: MobileApi;
73
+ declare interface CraftHost extends EventTarget {
74
+ craft?: unknown
75
+ }
73
76
 
74
77
  // From: src/gestures.ts
75
- /** Where a page scrolls: the window, or a stand-in with the same shape. */
76
- export declare interface ScrollHost extends EventTarget {
77
- scrollY?: number
78
- document?: { scrollingElement?: { scrollTop: number } | null }
79
- }
80
78
  /**
81
79
  * The page's vertical scroll offset. Negative while iOS rubber-bands past the
82
80
  * top, which is what pull-to-refresh reads.
83
81
  */
84
- export declare function pageScrollTop(host?: ScrollHost | undefined): number;
82
+ declare function pageScrollTop(host?: ScrollHost | undefined): number;
85
83
  /**
86
84
  * Calls `callback` with the page's scroll offset now and on every scroll, at
87
85
  * most once a frame. Returns the unsubscribe.
88
86
  */
89
- export declare function observePageScroll(callback: (offset: number) => void, host?: ScrollHost | undefined): () => void;
90
- export declare interface PullToRefreshOptions {
91
- threshold?: number
92
- onPull?: (distance: number, armed: boolean) => void
93
- onRefresh: () => unknown | Promise<unknown>
94
- host?: ScrollHost
95
- }
87
+ declare function observePageScroll(callback: (offset: number) => void, host?: ScrollHost | undefined): () => void;
96
88
  /**
97
89
  * How far a pull has travelled.
98
90
  *
@@ -101,7 +93,7 @@ export declare interface PullToRefreshOptions {
101
93
  * browsers stop at zero, so there the finger's travel counts, halved to feel
102
94
  * like the same resistance.
103
95
  */
104
- export declare function pullDistance(scrollTop: number, fingerTravel: number): number;
96
+ declare function pullDistance(scrollTop: number, fingerTravel: number): number;
105
97
  /**
106
98
  * Pull-to-refresh for the whole page.
107
99
  *
@@ -109,20 +101,27 @@ export declare function pullDistance(scrollTop: number, fingerTravel: number): n
109
101
  * medium haptic tap, the moment a native list does; pulling back under 80% of
110
102
  * it disarms. Letting go while armed runs `onRefresh`.
111
103
  */
112
- export declare function observePullToRefresh(options: PullToRefreshOptions): () => void;
104
+ declare function observePullToRefresh(options: PullToRefreshOptions): () => void;
105
+ /** Where a page scrolls: the window, or a stand-in with the same shape. */
106
+ declare interface ScrollHost extends EventTarget {
107
+ scrollY?: number
108
+ document?: { scrollingElement?: { scrollTop: number } | null }
109
+ }
110
+ declare interface PullToRefreshOptions {
111
+ threshold?: number
112
+ onPull?: (distance: number, armed: boolean) => void
113
+ onRefresh: () => unknown | Promise<unknown>
114
+ host?: ScrollHost
115
+ }
113
116
 
114
117
  // From: src/navigation.ts
115
- /** The part of the window back navigation reads. */
116
- export declare interface HistoryHost {
117
- history?: { state: unknown, back: () => void }
118
- }
119
118
  /** Whether going back stays inside this app. */
120
- export declare function canGoBack(host?: HistoryHost | undefined): boolean;
119
+ declare function canGoBack(host?: HistoryHost | undefined): boolean;
121
120
  /**
122
121
  * Goes back through history when that stays inside the app, and says whether
123
122
  * it did. When it answers `false` the caller follows its own link.
124
123
  */
125
- export declare function goBack(host?: HistoryHost | undefined): boolean;
124
+ declare function goBack(host?: HistoryHost | undefined): boolean;
126
125
  /**
127
126
  * The in-app path a deep link opens, or null when it is not this app's.
128
127
  *
@@ -131,7 +130,7 @@ export declare function goBack(host?: HistoryHost | undefined): boolean;
131
130
  * this app's origin opens its own path. A link to anywhere else is not
132
131
  * followed from inside the app.
133
132
  */
134
- export declare function deepLinkPath(link: string, origin?: string | undefined): string | null;
133
+ declare function deepLinkPath(link: string, origin?: string | undefined): string | null;
135
134
  /**
136
135
  * Opens every deep link the app receives with `go`: the one it was launched
137
136
  * with, once, and each one after. Returns the unsubscribe.
@@ -139,32 +138,17 @@ export declare function deepLinkPath(link: string, origin?: string | undefined):
139
138
  * The launch link is remembered for the session, so a full page load inside
140
139
  * the app does not open it again.
141
140
  */
142
- export declare function followDeepLinks(go: (path: string) => void, links: DeepLinksApi): () => void;
141
+ declare function followDeepLinks(go: (path: string) => void, links: DeepLinksApi): () => void;
142
+ /** The part of the window back navigation reads. */
143
+ declare interface HistoryHost {
144
+ history?: { state: unknown, back: () => void }
145
+ }
143
146
 
144
147
  // From: src/route.ts
145
- /** A fix as Craft records it. */
146
- export declare interface RouteFix extends Location {
147
- altitudeAccuracy?: number
148
- }
149
- export declare interface RouteStats {
150
- distanceM: number
151
- movingS: number
152
- paceSPerKm: number | null
153
- averagePaceSPerKm: number | null
154
- speedMps: number | null
155
- accuracyM: number | null
156
- fixes: number
157
- }
158
- export declare interface RouteStatsOptions {
159
- maxAccuracyM?: number
160
- paceWindowS?: number
161
- }
162
- /** Fixes further apart than this, seconds, are a break in the route (a pause). */
163
- export declare const ROUTE_GAP_S: unknown;
164
148
  /** Great-circle distance between two fixes, metres. */
165
- export declare function fixDistance(a: { latitude: number, longitude: number }, b: { latitude: number, longitude: number }): number;
149
+ declare function fixDistance(a: { latitude: number, longitude: number }, b: { latitude: number, longitude: number }): number;
166
150
  /** The fixes worth counting, oldest first: a known position, accurate enough. */
167
- export declare function usableFixes<T extends RouteFix>(fixes: readonly T[], maxAccuracyM?: number): T[];
151
+ declare function usableFixes<T extends RouteFix>(fixes: readonly T[], maxAccuracyM?: number): T[];
168
152
  /**
169
153
  * The live numbers for a recording.
170
154
  *
@@ -175,18 +159,43 @@ export declare function usableFixes<T extends RouteFix>(fixes: readonly T[], max
175
159
  * at 10 m), and then becomes the anchor. Fixes more than ROUTE_GAP_S apart
176
160
  * (a pause) are a break: the ground between them is not counted.
177
161
  */
178
- export declare function routeStats(fixes: readonly RouteFix[], options?: RouteStatsOptions): RouteStats;
162
+ declare function routeStats(fixes: readonly RouteFix[], options?: RouteStatsOptions): RouteStats;
179
163
  /** "5:12" per kilometre, or "–" without a pace. */
180
- export declare function paceLabel(secondsPerKm: number | null | undefined): string;
164
+ declare function paceLabel(secondsPerKm: number | null | undefined): string;
181
165
  /** "24.3" kilometres per hour. */
182
- export declare function speedLabel(metresPerSecond: number | null | undefined): string;
183
- export declare interface RouteRecorderOptions extends RouteStatsOptions {
166
+ declare function speedLabel(metresPerSecond: number | null | undefined): string;
167
+ /**
168
+ * A recording to follow: start, pause, resume and stop the native recording,
169
+ * and the live numbers read back from it every few seconds while the page is
170
+ * in front. Reading pauses with the page hidden; the recording does not.
171
+ */
172
+ declare function createRouteRecorder(options: RouteRecorderOptions): RouteRecorder;
173
+ /** Fixes further apart than this, seconds, are a break in the route (a pause). */
174
+ declare const ROUTE_GAP_S: 30;
175
+ /** A fix as Craft records it. */
176
+ declare interface RouteFix extends Location {
177
+ altitudeAccuracy?: number
178
+ }
179
+ declare interface RouteStats {
180
+ distanceM: number
181
+ movingS: number
182
+ paceSPerKm: number | null
183
+ averagePaceSPerKm: number | null
184
+ speedMps: number | null
185
+ accuracyM: number | null
186
+ fixes: number
187
+ }
188
+ declare interface RouteStatsOptions {
189
+ maxAccuracyM?: number
190
+ paceWindowS?: number
191
+ }
192
+ declare interface RouteRecorderOptions extends RouteStatsOptions {
184
193
  intervalMs?: number
185
194
  onUpdate?: (stats: RouteStats) => void
186
195
  location: LocationApi
187
196
  locationOptions?: LocationOptions
188
197
  }
189
- export declare interface RouteRecorder {
198
+ declare interface RouteRecorder {
190
199
  start: () => Promise<RouteStats>
191
200
  attach: () => Promise<LocationRecordingState | null>
192
201
  pause: () => Promise<void>
@@ -195,16 +204,10 @@ export declare interface RouteRecorder {
195
204
  refresh: () => Promise<RouteStats>
196
205
  readonly stats: RouteStats
197
206
  }
198
- /**
199
- * A recording to follow: start, pause, resume and stop the native recording,
200
- * and the live numbers read back from it every few seconds while the page is
201
- * in front. Reading pauses with the page hidden; the recording does not.
202
- */
203
- export declare function createRouteRecorder(options: RouteRecorderOptions): RouteRecorder;
204
207
 
205
208
  // From: src/types.ts
206
209
  /** Enabled native features, not the hardware report from device.getCapabilities(). */
207
- export declare interface CraftMobileCapabilities {
210
+ declare interface CraftMobileCapabilities {
208
211
  haptics?: boolean
209
212
  speechRecognition?: boolean
210
213
  share?: boolean
@@ -249,15 +252,15 @@ export declare interface CraftMobileCapabilities {
249
252
  screenCapture?: boolean
250
253
  }
251
254
  /** Browser-safe metadata from Craft's iOS or Android bridge. */
252
- export declare interface CraftMobileBridge {
255
+ declare interface CraftMobileBridge {
253
256
  readonly platform: 'ios' | 'android'
254
257
  readonly capabilities: Readonly<CraftMobileCapabilities>
255
258
  }
256
- export declare interface CraftReadyEvent extends Event {
259
+ declare interface CraftReadyEvent extends Event {
257
260
  detail?: { platform?: string }
258
261
  }
259
262
  /** Services retain their web fallbacks; nativeBridge describes only a native host. */
260
- export declare interface MobileApi {
263
+ declare interface MobileApi {
261
264
  readonly nativeBridge: CraftMobileBridge | null
262
265
  biometrics: BiometricsApi
263
266
  camera: CameraApi
@@ -282,7 +285,7 @@ export declare interface MobileApi {
282
285
  onReady: (callback: (event: CraftReadyEvent) => void) => () => void
283
286
  withFeedback: <T>(action: () => T | Promise<T>) => Promise<T>
284
287
  }
285
- export declare interface DeviceInfo {
288
+ declare interface DeviceInfo {
286
289
  platform: 'ios' | 'android' | 'macos' | 'windows' | 'linux'
287
290
  osVersion: string
288
291
  model: string
@@ -293,7 +296,7 @@ export declare interface DeviceInfo {
293
296
  battery?: { level: number, isCharging: boolean }
294
297
  network?: { type: 'wifi' | 'cellular' | 'ethernet' | 'none', isConnected: boolean }
295
298
  }
296
- export declare interface DeviceCapabilities {
299
+ declare interface DeviceCapabilities {
297
300
  camera: boolean
298
301
  biometrics: boolean
299
302
  nfc: boolean
@@ -307,37 +310,21 @@ export declare interface DeviceCapabilities {
307
310
  faceId: boolean
308
311
  touchId: boolean
309
312
  }
310
- export type HapticStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
311
- export type HapticNotificationType = 'success' | 'warning' | 'error';
312
- export type PermissionType = | 'camera'
313
- | 'microphone'
314
- | 'photos'
315
- | 'location'
316
- | 'locationAlways'
317
- | 'notifications'
318
- | 'contacts'
319
- | 'calendar'
320
- | 'reminders'
321
- | 'bluetooth'
322
- | 'motion'
323
- | 'health';
324
- export type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restricted';
325
- export declare interface CameraOptions {
313
+ declare interface CameraOptions {
326
314
  camera?: 'front' | 'back'
327
315
  quality?: number
328
316
  maxWidth?: number
329
317
  maxHeight?: number
330
318
  saveToGallery?: boolean
331
319
  }
332
- export declare interface PhotoResult {
320
+ declare interface PhotoResult {
333
321
  base64: string
334
322
  uri: string
335
323
  width: number
336
324
  height: number
337
325
  mimeType: string
338
326
  }
339
- export type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris';
340
- export declare interface Location {
327
+ declare interface Location {
341
328
  latitude: number
342
329
  longitude: number
343
330
  altitude?: number
@@ -346,29 +333,28 @@ export declare interface Location {
346
333
  speed?: number
347
334
  timestamp: number
348
335
  }
349
- export declare interface LocationOptions {
336
+ declare interface LocationOptions {
350
337
  enableHighAccuracy?: boolean
351
338
  timeout?: number
352
339
  maximumAge?: number
353
340
  }
354
- export declare interface LocationRecordingState {
341
+ declare interface LocationRecordingState {
355
342
  id: string | null
356
343
  active: boolean
357
344
  paused: boolean
358
345
  startedAt: number | null
359
346
  sampleCount?: number
360
347
  }
361
- export declare interface LocationRecordingResult extends LocationRecordingState {
348
+ declare interface LocationRecordingResult extends LocationRecordingState {
362
349
  locations: Location[]
363
350
  }
364
- export declare interface ShareOptions {
351
+ declare interface ShareOptions {
365
352
  text?: string
366
353
  url?: string
367
354
  title?: string
368
355
  files?: string[]
369
356
  }
370
- export type AppState = 'active' | 'inactive' | 'background';
371
- export declare interface NotificationOptions {
357
+ declare interface NotificationOptions {
372
358
  title: string
373
359
  body?: string
374
360
  badge?: number
@@ -376,7 +362,7 @@ export declare interface NotificationOptions {
376
362
  data?: Record<string, unknown>
377
363
  scheduleAt?: number
378
364
  }
379
- export declare interface DeviceApi {
365
+ declare interface DeviceApi {
380
366
  getInfo: () => Promise<DeviceInfo>
381
367
  getCapabilities: () => Promise<DeviceCapabilities>
382
368
  isMobile: () => boolean
@@ -385,37 +371,37 @@ export declare interface DeviceApi {
385
371
  getLocale: () => string
386
372
  getTimezone: () => string
387
373
  }
388
- export declare interface HapticsApi {
374
+ declare interface HapticsApi {
389
375
  impact: (style?: HapticStyle) => Promise<void>
390
376
  notification: (type?: HapticNotificationType) => Promise<void>
391
377
  selection: () => Promise<void>
392
378
  vibrate: (pattern: number[]) => Promise<void>
393
379
  }
394
- export declare interface PermissionsApi {
380
+ declare interface PermissionsApi {
395
381
  check: (permission: PermissionType) => Promise<PermissionStatus>
396
382
  request: (permission: PermissionType) => Promise<PermissionStatus>
397
383
  checkMultiple: (permissions: PermissionType[]) => Promise<Record<PermissionType, PermissionStatus>>
398
384
  requestMultiple: (permissions: PermissionType[]) => Promise<Record<PermissionType, PermissionStatus>>
399
385
  openSettings: () => Promise<void>
400
386
  }
401
- export declare interface CameraApi {
387
+ declare interface CameraApi {
402
388
  takePicture: (options?: CameraOptions) => Promise<PhotoResult>
403
389
  pickImage: () => Promise<PhotoResult>
404
390
  pickMultiple: (options?: { maxCount?: number }) => Promise<PhotoResult[]>
405
391
  isAvailable: () => Promise<boolean>
406
392
  }
407
- export declare interface BiometricsApi {
393
+ declare interface BiometricsApi {
408
394
  isAvailable: () => Promise<boolean>
409
395
  getBiometricType: () => Promise<BiometricType | null>
410
396
  authenticate: (reason: string) => Promise<boolean>
411
397
  }
412
- export declare interface SecureStorageApi {
398
+ declare interface SecureStorageApi {
413
399
  set: (key: string, value: string) => Promise<void>
414
400
  get: (key: string) => Promise<string | null>
415
401
  delete: (key: string) => Promise<void>
416
402
  clear: () => Promise<void>
417
403
  }
418
- export declare interface LocationApi {
404
+ declare interface LocationApi {
419
405
  getCurrentPosition: (options?: LocationOptions) => Promise<Location>
420
406
  watchPosition: (callback: (location: Location) => void, options?: LocationOptions) => number
421
407
  clearWatch: (watchId: number) => void
@@ -426,72 +412,60 @@ export declare interface LocationApi {
426
412
  getRecordingState: () => Promise<LocationRecordingState>
427
413
  readRecording: () => Promise<Location[]>
428
414
  }
429
- export declare interface ShareApi {
415
+ declare interface ShareApi {
430
416
  share: (options: ShareOptions) => Promise<boolean>
431
417
  isAvailable: () => boolean
432
418
  }
433
- export declare interface LifecycleApi {
419
+ declare interface LifecycleApi {
434
420
  getState: () => AppState
435
421
  onStateChange: (callback: (state: AppState) => void) => () => void
436
422
  }
437
- export declare interface NotificationsApi {
423
+ declare interface NotificationsApi {
438
424
  show: (options: NotificationOptions) => Promise<void>
439
425
  schedule: (options: NotificationOptions) => Promise<void>
440
426
  cancelAll: () => Promise<void>
441
427
  setBadge: (count: number) => Promise<void>
442
428
  }
443
- export declare interface KeepAwakeApi {
429
+ declare interface KeepAwakeApi {
444
430
  enable: () => Promise<void>
445
431
  disable: () => Promise<void>
446
432
  }
447
- export declare interface DeepLinksApi {
433
+ declare interface DeepLinksApi {
448
434
  getInitialURL: () => Promise<string | null>
449
435
  onLink: (callback: (url: string, link?: { initial: boolean }) => void) => () => void
450
436
  }
451
- export declare interface NetworkStatus {
437
+ declare interface NetworkStatus {
452
438
  type: 'wifi' | 'cellular' | 'ethernet' | 'none' | 'unknown'
453
439
  isConnected: boolean
454
440
  }
455
- export declare interface NetworkApi {
441
+ declare interface NetworkApi {
456
442
  getStatus: () => Promise<NetworkStatus>
457
443
  onChange: (callback: (status: NetworkStatus) => void) => () => void
458
444
  }
459
- export declare interface AppReviewApi {
445
+ declare interface AppReviewApi {
460
446
  request: () => Promise<boolean>
461
447
  }
462
- export declare interface PushNotificationsApi {
448
+ declare interface PushNotificationsApi {
463
449
  register: () => Promise<string>
464
450
  onToken: (callback: (token: string) => void) => () => void
465
451
  onNotification: (callback: (data: Record<string, unknown>) => void) => () => void
466
452
  }
467
- export type HealthDataType = | 'steps'
468
- | 'heartRate'
469
- | 'activeEnergy'
470
- | 'distance'
471
- | 'workouts'
472
- | 'restingHeartRate'
473
- | 'heartRateVariability'
474
- | 'bodyMass'
475
- | 'sleep';
476
- /** The types with one value per day. `sleep` is hours asleep, counted on the day you woke. */
477
- export type HealthDailyType = Exclude<HealthDataType, 'workouts'>;
478
- export declare interface HealthDataOptions {
453
+ declare interface HealthDataOptions {
479
454
  startDate?: number
480
455
  endDate?: number
481
456
  }
482
- export declare interface HealthDataResult {
457
+ declare interface HealthDataResult {
483
458
  value: number
484
459
  unit: string
485
460
  }
486
- export type HealthWorkoutType = 'running' | 'walking' | 'hiking' | 'cycling';
487
- export declare interface HealthWorkoutLocation {
461
+ declare interface HealthWorkoutLocation {
488
462
  latitude: number
489
463
  longitude: number
490
464
  altitude?: number
491
465
  accuracy?: number
492
466
  timestamp: number
493
467
  }
494
- export declare interface HealthWorkout {
468
+ declare interface HealthWorkout {
495
469
  activityId: string
496
470
  type: HealthWorkoutType
497
471
  startDate: number
@@ -500,20 +474,16 @@ export declare interface HealthWorkout {
500
474
  activeEnergyCalories?: number
501
475
  locations?: HealthWorkoutLocation[]
502
476
  }
503
- export declare interface HealthWorkoutResult {
477
+ declare interface HealthWorkoutResult {
504
478
  id: string
505
479
  }
506
- export declare interface HealthWorkoutQuery {
480
+ declare interface HealthWorkoutQuery {
507
481
  startDate?: number
508
482
  endDate?: number
509
483
  limit?: number
510
484
  }
511
- /** The activity of a workout read from Apple Health, named independently of the SDK. */
512
- export type HealthWorkoutActivity = | 'running' | 'cycling' | 'walking' | 'hiking' | 'swimming' | 'rowing' | 'elliptical'
513
- | 'stairClimbing' | 'yoga' | 'pilates' | 'strength' | 'hiit' | 'crossTraining'
514
- | 'crossCountrySkiing' | 'skiing' | 'paddling' | 'climbing' | 'dance' | 'mobility' | 'other';
515
485
  /** A workout recorded by the watch, or by any app that writes to Apple Health. */
516
- export declare interface HealthWorkoutSample {
486
+ declare interface HealthWorkoutSample {
517
487
  id: string
518
488
  type: HealthWorkoutActivity
519
489
  startDate: number
@@ -527,40 +497,75 @@ export declare interface HealthWorkoutSample {
527
497
  averageHeartRate?: number
528
498
  maxHeartRate?: number
529
499
  }
530
- export declare interface HealthDailyValue {
500
+ declare interface HealthDailyValue {
531
501
  date: string
532
502
  value: number
533
503
  unit: string
534
504
  }
535
- export declare interface HealthAuthorizationOptions {
505
+ declare interface HealthAuthorizationOptions {
536
506
  write?: boolean
537
507
  }
538
- export declare interface HealthApi {
508
+ declare interface HealthApi {
539
509
  requestAuthorization: (types: HealthDataType[], options?: HealthAuthorizationOptions) => Promise<boolean>
540
510
  getData: (type: HealthDataType, options?: HealthDataOptions) => Promise<HealthDataResult>
541
511
  saveWorkout: (workout: HealthWorkout) => Promise<HealthWorkoutResult>
542
512
  getWorkouts: (options?: HealthWorkoutQuery) => Promise<HealthWorkoutSample[]>
543
513
  getDailyStatistics: (type: HealthDailyType, options?: HealthDataOptions) => Promise<HealthDailyValue[]>
544
514
  }
545
- export declare interface LiveActivityState {
515
+ declare interface LiveActivityState {
546
516
  status?: string
547
517
  distanceMeters?: number
548
518
  durationSeconds?: number
549
519
  progress?: number
550
520
  }
551
- export declare interface LiveActivityOptions extends LiveActivityState {
521
+ declare interface LiveActivityOptions extends LiveActivityState {
552
522
  activityId: string
553
523
  title: string
554
524
  }
555
- export declare interface LiveActivitiesApi {
525
+ declare interface LiveActivitiesApi {
556
526
  start: (options: LiveActivityOptions) => Promise<{ id: string }>
557
527
  update: (state: LiveActivityState) => Promise<void>
558
528
  end: () => Promise<void>
559
529
  }
560
- export declare interface WatchConnectivityApi {
530
+ declare interface WatchConnectivityApi {
561
531
  send: (message: Record<string, unknown>) => Promise<Record<string, unknown>>
562
532
  updateContext: (context: Record<string, unknown>) => Promise<void>
563
533
  isReachable: () => Promise<boolean>
564
534
  onMessage: (callback: (message: Record<string, unknown>) => void) => () => void
565
535
  onReachabilityChange: (callback: (reachable: boolean) => void) => () => void
566
536
  }
537
+ type HapticStyle = 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
538
+ type HapticNotificationType = 'success' | 'warning' | 'error';
539
+ type PermissionType = | 'camera'
540
+ | 'microphone'
541
+ | 'photos'
542
+ | 'location'
543
+ | 'locationAlways'
544
+ | 'notifications'
545
+ | 'contacts'
546
+ | 'calendar'
547
+ | 'reminders'
548
+ | 'bluetooth'
549
+ | 'motion'
550
+ | 'health';
551
+ type PermissionStatus = 'granted' | 'denied' | 'undetermined' | 'restricted';
552
+ type BiometricType = 'faceId' | 'touchId' | 'fingerprint' | 'face' | 'iris';
553
+ type AppState = 'active' | 'inactive' | 'background';
554
+ type HealthDataType = | 'steps'
555
+ | 'heartRate'
556
+ | 'activeEnergy'
557
+ | 'distance'
558
+ | 'workouts'
559
+ | 'restingHeartRate'
560
+ | 'heartRateVariability'
561
+ | 'bodyMass'
562
+ | 'sleep';
563
+ /** The types with one value per day. `sleep` is hours asleep, counted on the day you woke. */
564
+ type HealthDailyType = Exclude<HealthDataType, 'workouts'>;
565
+ type HealthWorkoutType = 'running' | 'walking' | 'hiking' | 'cycling';
566
+ /** The activity of a workout read from Apple Health, named independently of the SDK. */
567
+ type HealthWorkoutActivity = | 'running' | 'cycling' | 'walking' | 'hiking' | 'swimming' | 'rowing' | 'elliptical'
568
+ | 'stairClimbing' | 'yoga' | 'pilates' | 'strength' | 'hiit' | 'crossTraining'
569
+ | 'crossCountrySkiing' | 'skiing' | 'paddling' | 'climbing' | 'dance' | 'mobility' | 'other';
570
+
571
+ export { normalizeDeepLinkURL, getNativeMobileBridge, isNativeMobile, hasNativeMobileHost, whenNativeMobile, whenBridgeReady, onMobileReady, withNativeFeedback, biometrics, camera, device, haptics, lifecycle, location, notifications, permissions, secureStorage, share, appReview, deepLinks, keepAwake, network, pushNotifications, health, liveActivities, watchConnectivity, mobile, pageScrollTop, observePageScroll, pullDistance, observePullToRefresh, ScrollHost, PullToRefreshOptions, canGoBack, goBack, deepLinkPath, followDeepLinks, HistoryHost, fixDistance, usableFixes, routeStats, paceLabel, speedLabel, createRouteRecorder, ROUTE_GAP_S, RouteFix, RouteStats, RouteStatsOptions, RouteRecorderOptions, RouteRecorder, CraftMobileCapabilities, CraftMobileBridge, CraftReadyEvent, MobileApi, DeviceInfo, DeviceCapabilities, CameraOptions, PhotoResult, Location, LocationOptions, LocationRecordingState, LocationRecordingResult, ShareOptions, NotificationOptions, DeviceApi, HapticsApi, PermissionsApi, CameraApi, BiometricsApi, SecureStorageApi, LocationApi, ShareApi, LifecycleApi, NotificationsApi, KeepAwakeApi, DeepLinksApi, NetworkStatus, NetworkApi, AppReviewApi, PushNotificationsApi, HealthDataOptions, HealthDataResult, HealthWorkoutLocation, HealthWorkout, HealthWorkoutResult, HealthWorkoutQuery, HealthWorkoutSample, HealthDailyValue, HealthAuthorizationOptions, HealthApi, LiveActivityState, LiveActivityOptions, LiveActivitiesApi, WatchConnectivityApi, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, BiometricType, AppState, HealthDataType, HealthDailyType, HealthWorkoutType, HealthWorkoutActivity };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/mobile",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.41",
5
+ "version": "0.75.43",
6
6
  "description": "Craft-powered native mobile runtime for Stacks and STX applications",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "craft-native": ">=0.0.107"
36
36
  },
37
37
  "devDependencies": {
38
- "@stacksjs/build": "0.75.41",
38
+ "@stacksjs/build": "0.75.43",
39
39
  "better-dx": "^0.2.24"
40
40
  }
41
41
  }