@telemetryos/root-sdk 1.1.0 → 1.3.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 CHANGED
@@ -1,8 +1,8 @@
1
- import { z as v } from "./index-B98VDFRY.js";
2
- const M = "1.1.0", H = {
3
- version: M
1
+ import { z as N } from "./index-B98VDFRY.js";
2
+ const q = "1.3.0", A = {
3
+ version: q
4
4
  };
5
- class q {
5
+ class E {
6
6
  constructor(e) {
7
7
  this._client = e;
8
8
  }
@@ -15,10 +15,13 @@ class q {
15
15
  * @returns A promise that resolves to the current account object
16
16
  */
17
17
  async getCurrent() {
18
- return (await this._client.request("user.getCurrentAccount", {})).account;
18
+ const e = await this._client.request("accounts.getCurrent", {});
19
+ if (!e.success)
20
+ throw new Error("Failed to fetch current account");
21
+ return e.account;
19
22
  }
20
23
  }
21
- class P {
24
+ class I {
22
25
  constructor(e) {
23
26
  this._client = e;
24
27
  }
@@ -36,7 +39,7 @@ class P {
36
39
  * @returns A promise that resolves to an array of applications having the specified mount point
37
40
  */
38
41
  async getAllByMountPoint(e) {
39
- return (await this._client.request("applications.getByMountPoint", {
42
+ return (await this._client.request("applications.getAllByMountPoint", {
40
43
  mountPoint: e
41
44
  })).applications;
42
45
  }
@@ -56,29 +59,58 @@ class P {
56
59
  })).application;
57
60
  }
58
61
  /**
59
- * Generates a URL for embedding an application with the specified name and mount point.
62
+ * Sets the dependencies for the current application.
60
63
  *
61
- * This method returns a URL that can be used in an iframe src attribute to embed
62
- * the application. The URL includes necessary parameters for the application to
63
- * understand its context and communicate with the platform.
64
+ * This method allows an application to declare which other applications it depends on.
65
+ * The player will download and prepare these dependencies before they can be loaded.
64
66
  *
65
- * Only applications that are associated with the current account can be retrieved.
67
+ * IMPORTANT: This method must be called and awaited before loading any sub-applications
68
+ * in iframes. Only applications that return as 'ready' should be loaded.
66
69
  *
67
- * @param name The name of the application to get the URL for
68
- * @param mountPoint The mount point to use when embedding the application
69
- * @returns A promise that resolves to the URL string for embedding the application
70
+ * @param applicationSpecifiers An array of application specifiers that this application depends on
71
+ * @returns A promise that resolves with arrays of ready and unavailable application specifiers
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const result = await client.applications.setDependencies(['app1-hash', 'app2-hash'])
76
+ * // result.ready: ['app1-hash'] - these can be loaded in iframes
77
+ * // result.unavailable: ['app2-hash'] - these failed to load
78
+ * ```
70
79
  */
71
- async getUrl(e, t) {
72
- return (await this._client.request("applications.getUrl", {
73
- name: e,
74
- mountPoint: t
75
- })).url;
80
+ async setDependencies(e) {
81
+ return await this._client.request("applications.setDependencies", {
82
+ applicationSpecifiers: e
83
+ });
84
+ }
85
+ }
86
+ class P {
87
+ constructor(e) {
88
+ this._client = e;
89
+ }
90
+ /**
91
+ * Retrieves hardware information about the current physical device.
92
+ *
93
+ * This method returns details about the device running the application, such as
94
+ * serial number, model, manufacturer, and platform. This information is only
95
+ * available when running on a physical device (player), not in the admin UI.
96
+ *
97
+ * @returns A promise that resolves to the device hardware information
98
+ * @example
99
+ * // Get hardware info of the current device
100
+ * const info = await devices.getInformation();
101
+ * console.log(`Device: ${info.deviceManufacturer} ${info.deviceModel}`);
102
+ */
103
+ async getInformation() {
104
+ const e = await this._client.request("devices.getInformation", {});
105
+ if (!e.success)
106
+ throw new Error("Failed to get device information");
107
+ return e.deviceInformation;
76
108
  }
77
109
  }
78
- function B(r, e = console.error) {
79
- r().catch(e);
110
+ function F(o, e = console.error) {
111
+ o().catch(e);
80
112
  }
81
- class R {
113
+ class D {
82
114
  constructor(e) {
83
115
  this._client = e;
84
116
  }
@@ -86,7 +118,7 @@ class R {
86
118
  return (await this._client.request("environment.getColorScheme", {})).colorScheme;
87
119
  }
88
120
  subscribeColorScheme(e) {
89
- B(async () => {
121
+ F(async () => {
90
122
  this._client.on("environment.colorSchemeChanged", e), e(await this.getColorScheme());
91
123
  });
92
124
  }
@@ -94,70 +126,53 @@ class R {
94
126
  this._client.off("environment.colorSchemeChanged", e);
95
127
  }
96
128
  }
97
- class C {
129
+ class M {
98
130
  constructor(e) {
99
131
  this._client = e;
100
132
  }
101
133
  /**
102
- * Queries for media folders based on folder properties.
103
- *
104
- * This method allows you to search for media folders that match specific criteria,
105
- * such as name, ID, or other folder properties.
134
+ * Retrieves all media folders in the account.
106
135
  *
107
- * @param query An object with partial MediaFolder properties to match against
108
- * @returns A promise that resolves to an array of matching media folders
136
+ * @returns A promise that resolves to an array of all media folders
109
137
  */
110
- async queryFolders(e) {
111
- return (await this._client.request("media.queryMediaFolders", {
112
- query: e
113
- })).folders;
138
+ async getAllFolders() {
139
+ return (await this._client.request("mediaFolders.getAll", {})).folders;
114
140
  }
115
141
  /**
116
- * Retrieves media folders that have been tagged with a specific tag.
142
+ * Retrieves all media content within a specific folder.
117
143
  *
118
- * @param tagName The name of the tag to search for
119
- * @returns A promise that resolves to an array of media folders with the specified tag
144
+ * @param folderId The unique identifier of the folder
145
+ * @returns A promise that resolves to an array of media content in the folder
120
146
  */
121
- async getFoldersByTag(e) {
122
- return (await this._client.request("media.getMediaFoldersByTag", {
123
- tagName: e
124
- })).folders;
125
- }
126
- /**
127
- * Retrieves a specific media folder by its ID.
128
- *
129
- * @param id The unique identifier of the folder to retrieve
130
- * @returns A promise that resolves to the media folder with the specified ID
131
- */
132
- async getFolderById(e) {
133
- return (await this._client.request("media.getMediaFolderById", {
134
- id: e
135
- })).folder;
147
+ async getAllByFolderId(e) {
148
+ return (await this._client.request("media.getAllByFolderId", {
149
+ folderId: e
150
+ })).contents;
136
151
  }
137
152
  /**
138
- * Retrieves all media content items within a specific folder.
153
+ * Retrieves media content that has been tagged with a specific tag.
139
154
  *
140
- * @param folderId The unique identifier of the folder to get content from
141
- * @returns A promise that resolves to an array of media content items in the folder
155
+ * @param tagName The name of the tag to search for
156
+ * @returns A promise that resolves to an array of media content with the specified tag
142
157
  */
143
- async getMediaContentByFolderId(e) {
144
- return (await this._client.request("media.getMediaContentByFolderId", {
145
- folderId: e
146
- })).folders;
158
+ async getAllByTag(e) {
159
+ return (await this._client.request("media.getAllByTag", {
160
+ tagName: e
161
+ })).contents;
147
162
  }
148
163
  /**
149
164
  * Retrieves a specific media content item by its ID.
150
165
  *
151
166
  * @param id The unique identifier of the media content to retrieve
152
- * @returns A promise that resolves to the media content item with the specified ID
167
+ * @returns A promise that resolves to the media content with the specified ID
153
168
  */
154
- async getMediaContentById(e) {
155
- return (await this._client.request("media.getMediaContentById", {
169
+ async getById(e) {
170
+ return (await this._client.request("media.getById", {
156
171
  id: e
157
172
  })).content;
158
173
  }
159
174
  }
160
- class k {
175
+ class B {
161
176
  constructor(e) {
162
177
  this._client = e;
163
178
  }
@@ -171,7 +186,7 @@ class k {
171
186
  * @returns A StoreSlice instance for the application scope
172
187
  */
173
188
  get application() {
174
- return new w("application", "", this._client);
189
+ return new _("application", "", this._client);
175
190
  }
176
191
  /**
177
192
  * Provides access to the instance store scope.
@@ -185,7 +200,7 @@ class k {
185
200
  * @returns A StoreSlice instance for the instance scope
186
201
  */
187
202
  get instance() {
188
- return new w("instance", this._client._applicationId, this._client);
203
+ return new _("instance", this._client.applicationSpecifier, this._client);
189
204
  }
190
205
  /**
191
206
  * Provides access to the device store scope.
@@ -200,7 +215,7 @@ class k {
200
215
  * @returns A StoreSlice instance for the device scope
201
216
  */
202
217
  get device() {
203
- return new w("device", this._client._applicationId, this._client);
218
+ return new _("device", this._client.applicationSpecifier, this._client);
204
219
  }
205
220
  /**
206
221
  * Provides access to the shared store scope with a specified namespace.
@@ -216,12 +231,12 @@ class k {
216
231
  * @returns A StoreSlice instance for the specified shared namespace
217
232
  */
218
233
  shared(e) {
219
- return new w("shared", e, this._client);
234
+ return new _("shared", e, this._client);
220
235
  }
221
236
  }
222
- class w {
223
- constructor(e, t, s) {
224
- this._kind = e, this._namespace = t, this._client = s;
237
+ class _ {
238
+ constructor(e, t, n) {
239
+ this._kind = e, this._namespace = t, this._client = n;
225
240
  }
226
241
  /**
227
242
  * Saves a value in the store.
@@ -313,7 +328,7 @@ class w {
313
328
  })).success;
314
329
  }
315
330
  }
316
- class E {
331
+ class C {
317
332
  constructor(e) {
318
333
  this._client = e;
319
334
  }
@@ -330,14 +345,156 @@ class E {
330
345
  * console.log(`Current user ID: ${userResult.user.id}`);
331
346
  */
332
347
  async getCurrent() {
333
- return await this._client.request("user.getCurrentUser", {});
348
+ const e = await this._client.request("users.getCurrent", {});
349
+ if (!e.success)
350
+ throw new Error("Failed to fetch current user");
351
+ return e.user;
334
352
  }
335
353
  }
336
- const $ = v.object({
337
- name: v.string(),
338
- data: v.any()
354
+ class k {
355
+ constructor(e) {
356
+ this._client = e;
357
+ }
358
+ /**
359
+ * Retrieves current weather conditions for a specified location using WeatherBit.
360
+ *
361
+ * @param params - Weather request parameters including location and units
362
+ * @returns A promise that resolves to the current weather conditions
363
+ * @throws {Error} If the request fails or location is invalid
364
+ *
365
+ * @example
366
+ * ```typescript
367
+ * // Get weather by city
368
+ * const weather = await weather.getConditions({ city: 'New York', units: 'imperial' })
369
+ *
370
+ * // Get weather by postal code
371
+ * const weather = await weather.getConditions({ postalCode: '10001', units: 'metric' })
372
+ *
373
+ * // Get weather by coordinates
374
+ * const weather = await weather.getConditions({ lat: '40.7128', lon: '-74.0060' })
375
+ * ```
376
+ */
377
+ async getConditions(e) {
378
+ const t = await this._client.request("weather.getConditions", e);
379
+ if (!t.success || !t.conditions)
380
+ throw new Error(t.error || "Failed to fetch weather conditions");
381
+ return t.conditions;
382
+ }
383
+ /**
384
+ * Retrieves daily weather forecast for a specified location using WeatherBit.
385
+ *
386
+ * @param params - Forecast request parameters including location, units, and number of days
387
+ * @returns A promise that resolves to an array of daily forecast data
388
+ * @throws {Error} If the request fails or location is invalid
389
+ *
390
+ * @example
391
+ * ```typescript
392
+ * // Get 5-day forecast
393
+ * const forecast = await weather.getDailyForecast({
394
+ * city: 'London',
395
+ * units: 'metric',
396
+ * days: 5
397
+ * })
398
+ * ```
399
+ */
400
+ async getDailyForecast(e) {
401
+ const t = await this._client.request("weather.getDailyForecast", e);
402
+ if (!t.success || !t.forecast)
403
+ throw new Error(t.error || "Failed to fetch daily forecast");
404
+ return t.forecast;
405
+ }
406
+ /**
407
+ * Retrieves hourly weather forecast for a specified location using WeatherBit.
408
+ *
409
+ * @param params - Forecast request parameters including location, units, and number of hours
410
+ * @returns A promise that resolves to an array of hourly forecast data
411
+ * @throws {Error} If the request fails or location is invalid
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * // Get 24-hour forecast
416
+ * const forecast = await weather.getHourlyForecast({
417
+ * city: 'Tokyo',
418
+ * units: 'metric',
419
+ * hours: 24
420
+ * })
421
+ * ```
422
+ */
423
+ async getHourlyForecast(e) {
424
+ const t = await this._client.request("weather.getHourlyForecast", e);
425
+ if (!t.success || !t.forecast)
426
+ throw new Error(t.error || "Failed to fetch hourly forecast");
427
+ return t.forecast;
428
+ }
429
+ /**
430
+ * Retrieves current weather conditions using AccuWeather.
431
+ *
432
+ * @param params - Weather request parameters including location and units
433
+ * @returns A promise that resolves to the AccuWeather conditions data
434
+ * @throws {Error} If the request fails or location is invalid
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * const weather = await weather.getAccuWeatherConditions({
439
+ * city: 'Paris',
440
+ * units: 'metric'
441
+ * })
442
+ * ```
443
+ */
444
+ async getAccuWeatherConditions(e) {
445
+ const t = await this._client.request("weather.getAccuWeatherConditions", e);
446
+ if (!t.success || !t.data)
447
+ throw new Error(t.error || "Failed to fetch AccuWeather conditions");
448
+ return t.data;
449
+ }
450
+ /**
451
+ * Retrieves daily forecast using AccuWeather.
452
+ *
453
+ * @param params - Forecast request parameters including location and units
454
+ * @returns A promise that resolves to the AccuWeather daily forecast data
455
+ * @throws {Error} If the request fails or location is invalid
456
+ *
457
+ * @example
458
+ * ```typescript
459
+ * const forecast = await weather.getAccuWeatherDailyForecast({
460
+ * city: 'Sydney',
461
+ * units: 'metric'
462
+ * })
463
+ * ```
464
+ */
465
+ async getAccuWeatherDailyForecast(e) {
466
+ const t = await this._client.request("weather.getAccuWeatherDailyForecast", e);
467
+ if (!t.success || !t.data)
468
+ throw new Error(t.error || "Failed to fetch AccuWeather daily forecast");
469
+ return t.data;
470
+ }
471
+ /**
472
+ * Retrieves hourly forecast using AccuWeather.
473
+ *
474
+ * @param params - Forecast request parameters including location and units
475
+ * @returns A promise that resolves to the AccuWeather hourly forecast data
476
+ * @throws {Error} If the request fails or location is invalid
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * const forecast = await weather.getAccuWeatherHourlyForecast({
481
+ * city: 'Berlin',
482
+ * units: 'metric'
483
+ * })
484
+ * ```
485
+ */
486
+ async getAccuWeatherHourlyForecast(e) {
487
+ const t = await this._client.request("weather.getAccuWeatherHourlyForecast", e);
488
+ if (!t.success || !t.data)
489
+ throw new Error(t.error || "Failed to fetch AccuWeather hourly forecast");
490
+ return t.data;
491
+ }
492
+ }
493
+ const T = N.object({
494
+ name: N.string(),
495
+ data: N.any()
339
496
  });
340
- class A {
497
+ class $ {
341
498
  /**
342
499
  * Creates a new RootSettingsNavigation API instance.
343
500
  *
@@ -345,7 +502,7 @@ class A {
345
502
  * @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
346
503
  */
347
504
  constructor(e) {
348
- if (e._client._applicationId !== "rootSettingsNavigation")
505
+ if (e._client._applicationSpecifier !== "rootSettingsNavigation")
349
506
  throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");
350
507
  this._store = e;
351
508
  }
@@ -360,11 +517,11 @@ class A {
360
517
  * @returns A promise that resolves when the navigation has been registered
361
518
  */
362
519
  async setRootSettingsNavigation(e) {
363
- const t = this._store.shared("root-settings-navigation"), s = await t.get("navigation"), o = this._store._client._applicationId;
364
- s[o] = {
365
- applicationId: o,
520
+ const t = this._store.shared("root-settings-navigation"), n = await t.get("navigation"), r = this._store._client._applicationSpecifier;
521
+ n[r] = {
522
+ applicationSpecifier: r,
366
523
  entries: e.entries
367
- }, t.set("navigation", s);
524
+ }, t.set("navigation", n);
368
525
  }
369
526
  /**
370
527
  * Retrieves the current navigation entries for this root application.
@@ -375,8 +532,8 @@ class A {
375
532
  * @returns A promise that resolves to the navigation state for this application
376
533
  */
377
534
  async getRootSettingsNavigation() {
378
- const t = await this._store.shared("root-settings-navigation").get("navigation"), s = this._store._client._applicationId;
379
- return t[s];
535
+ const t = await this._store.shared("root-settings-navigation").get("navigation"), n = this._store._client._applicationSpecifier;
536
+ return t[n];
380
537
  }
381
538
  /**
382
539
  * Retrieves the navigation entries for all root applications.
@@ -391,8 +548,47 @@ class A {
391
548
  return this._store.shared("root-settings-navigation").get("navigation");
392
549
  }
393
550
  }
394
- const f = 1e3 * 30;
395
- class T {
551
+ class x {
552
+ constructor(e) {
553
+ this._client = e;
554
+ }
555
+ async fetch(e, t) {
556
+ let n;
557
+ typeof e == "string" ? n = e : e instanceof URL ? n = e.toString() : (n = e.url, t || (t = {
558
+ method: e.method,
559
+ headers: e.headers,
560
+ body: e.body,
561
+ credentials: e.credentials,
562
+ cache: e.cache,
563
+ redirect: e.redirect,
564
+ referrer: e.referrer,
565
+ integrity: e.integrity
566
+ }));
567
+ let r = {};
568
+ t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((p, c) => {
569
+ r[c] = p;
570
+ }) : Array.isArray(t.headers) ? t.headers.forEach(([p, c]) => {
571
+ r[p] = c;
572
+ }) : r = t.headers);
573
+ const s = await this._client.request("proxy.fetch", {
574
+ url: n,
575
+ method: (t == null ? void 0 : t.method) || "GET",
576
+ headers: r,
577
+ body: (t == null ? void 0 : t.body) || null
578
+ });
579
+ if (!s.success)
580
+ throw new Error(`Proxy fetch failed: ${s.statusText}`);
581
+ const l = new Headers(s.headers), u = {
582
+ status: s.status,
583
+ statusText: s.statusText,
584
+ headers: l
585
+ };
586
+ let a = null;
587
+ return s.body !== null && s.body !== void 0 && (typeof s.body == "string" || s.body instanceof ArrayBuffer ? a = s.body : typeof s.body == "object" && (a = JSON.stringify(s.body))), new Response(a, u);
588
+ }
589
+ }
590
+ const g = 1e3 * 30;
591
+ class W {
396
592
  /**
397
593
  * Creates a new Client instance for communicating with the TelemetryOS platform.
398
594
  *
@@ -418,7 +614,7 @@ class T {
418
614
  * @returns An Accounts instance bound to this client
419
615
  */
420
616
  get accounts() {
421
- return new q(this);
617
+ return new E(this);
422
618
  }
423
619
  /**
424
620
  * Provides access to the users API for retrieving TelemetryOS user information.
@@ -432,13 +628,13 @@ class T {
432
628
  * @returns A Users instance bound to this client
433
629
  */
434
630
  get users() {
435
- return new E(this);
631
+ return new C(this);
436
632
  }
437
633
  /**
438
634
  * Provides access to the store API for data persistence with multiple storage scopes.
439
635
  *
440
636
  * This property returns a new Store instance that allows saving, retrieving, and
441
- * subscribing to data changes across different scopes (global, local, deviceLocal, shared).
637
+ * subscribing to data changes across different scopes (application, instance, device, shared).
442
638
  *
443
639
  * NOTE: Most application developers should use the global store() function
444
640
  * instead of accessing this property directly.
@@ -446,13 +642,13 @@ class T {
446
642
  * @returns A Store instance bound to this client
447
643
  */
448
644
  get store() {
449
- return new k(this);
645
+ return new B(this);
450
646
  }
451
647
  /**
452
- * Provides access to the applications API for discovering and embedding other TelemetryOS applications.
648
+ * Provides access to the applications API for discovering other TelemetryOS applications.
453
649
  *
454
650
  * This property returns a new Applications instance that allows querying for applications
455
- * by name or mount point, and generating URLs for embedding applications in iframes.
651
+ * by name or mount point, and setting application dependencies.
456
652
  *
457
653
  * NOTE: Most application developers should use the global applications() function
458
654
  * instead of accessing this property directly.
@@ -460,7 +656,7 @@ class T {
460
656
  * @returns An Applications instance bound to this client
461
657
  */
462
658
  get applications() {
463
- return new P(this);
659
+ return new I(this);
464
660
  }
465
661
  /**
466
662
  * Provides access to the media API for working with content hosted on the TelemetryOS platform.
@@ -475,7 +671,36 @@ class T {
475
671
  * @returns A Media instance bound to this client
476
672
  */
477
673
  get media() {
478
- return new C(this);
674
+ return new M(this);
675
+ }
676
+ /**
677
+ * Provides access to the proxy API for fetching third-party content through the TelemetryOS proxy service.
678
+ *
679
+ * This property returns a new Proxy instance that allows applications to fetch content from external
680
+ * URLs through the platform's proxy service, which handles authentication, caching, and CORS issues.
681
+ *
682
+ * NOTE: Most application developers should use the global proxy() function
683
+ * instead of accessing this property directly.
684
+ *
685
+ * @returns A Proxy instance bound to this client
686
+ */
687
+ get proxy() {
688
+ return new x(this);
689
+ }
690
+ /**
691
+ * Provides access to the devices API for interacting with the current device.
692
+ *
693
+ * This property returns a new Devices instance that allows applications to get information
694
+ * about the specific device the application is running on, subscribe to device changes,
695
+ * and access device hardware information.
696
+ *
697
+ * NOTE: Most application developers should use the global devices() function
698
+ * instead of accessing this property directly.
699
+ *
700
+ * @returns A Devices instance bound to this client
701
+ */
702
+ get devices() {
703
+ return new P(this);
479
704
  }
480
705
  /**
481
706
  * Provides access to the root settings navigation API for TelemetryOS administration UI integration.
@@ -493,7 +718,22 @@ class T {
493
718
  * @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
494
719
  */
495
720
  get rootSettingsNavigation() {
496
- return new A(this.store);
721
+ return new $(this.store);
722
+ }
723
+ /**
724
+ * Provides access to the weather API for retrieving weather data.
725
+ *
726
+ * This property returns a new Weather instance that allows applications to fetch
727
+ * current weather conditions and forecasts from various providers (WeatherBit, AccuWeather)
728
+ * through the General Integrations Service.
729
+ *
730
+ * NOTE: Most application developers should use the global weather() function
731
+ * instead of accessing this property directly.
732
+ *
733
+ * @returns A Weather instance bound to this client
734
+ */
735
+ get weather() {
736
+ return new k(this);
497
737
  }
498
738
  get applicationName() {
499
739
  return this._applicationName;
@@ -521,33 +761,33 @@ class T {
521
761
  */
522
762
  bind() {
523
763
  var e;
524
- const t = new URL(window.location.href), s = t.searchParams;
525
- this._applicationInstance = (e = s.get("telemetryApplicationId")) !== null && e !== void 0 ? e : "";
526
- const o = s.get("applicationSpecifier");
527
- if (o)
528
- this._applicationSpecifier = o;
764
+ const t = new URL(window.location.href), n = t.searchParams;
765
+ this._applicationInstance = (e = n.get("telemetryApplicationId")) !== null && e !== void 0 ? e : "";
766
+ const r = n.get("applicationSpecifier");
767
+ if (r)
768
+ this._applicationSpecifier = r;
529
769
  else {
530
- const i = t.hostname.split(".");
531
- this._applicationSpecifier = i[0] || "";
770
+ const s = t.hostname.split(".");
771
+ this._applicationSpecifier = s[0] || "";
532
772
  }
533
773
  if (!this._applicationSpecifier || this._applicationSpecifier.length !== 40)
534
774
  throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);
535
775
  if (!this._applicationInstance)
536
776
  throw new Error("Missing telemetryApplicationId query parameter");
537
- this._windowMessageHandler = (i) => {
538
- if (i.source === window)
777
+ this._windowMessageHandler = (s) => {
778
+ if (s.source === window)
539
779
  return;
540
780
  for (let c = 0; c < window.frames.length; c += 1)
541
- window.frames[c].postMessage(i.data, "*");
542
- const l = $.safeParse(i.data);
781
+ window.frames[c].postMessage(s.data, "*");
782
+ const l = T.safeParse(s.data);
543
783
  if (!l.success)
544
784
  return;
545
- const u = l.data, a = this._onHandlers.get(u.name), h = this._onceHandlers.get(u.name);
785
+ const u = l.data, a = this._onHandlers.get(u.name), p = this._onceHandlers.get(u.name);
546
786
  if (a)
547
787
  for (const c of a)
548
788
  c(u.data);
549
- if (h) {
550
- for (const c of h)
789
+ if (p) {
790
+ for (const c of p)
551
791
  c(u.data);
552
792
  this._onceHandlers.delete(u.name);
553
793
  }
@@ -583,15 +823,15 @@ class T {
583
823
  * @param data The data payload to include with the message
584
824
  */
585
825
  send(e, t) {
586
- const s = {
587
- telemetrySdkVersion: y,
826
+ const n = {
827
+ telemetrySdkVersion: b,
588
828
  applicationName: this._applicationName,
589
829
  applicationSpecifier: this._applicationSpecifier,
590
830
  applicationInstance: this._applicationInstance,
591
831
  name: e,
592
832
  data: t
593
833
  };
594
- window.parent.postMessage(s, "*");
834
+ window.parent.postMessage(n, "*");
595
835
  }
596
836
  /**
597
837
  * Sends a message to the TelemetryOS platform and waits for a response.
@@ -611,96 +851,96 @@ class T {
611
851
  * @throws {Error} If the request times out
612
852
  */
613
853
  request(e, t) {
614
- const s = b(), o = {
615
- telemetrySdkVersion: y,
854
+ const n = y(), r = {
855
+ telemetrySdkVersion: b,
616
856
  applicationName: this._applicationName,
617
857
  applicationSpecifier: this._applicationSpecifier,
618
858
  applicationInstance: this._applicationInstance,
619
859
  name: e,
620
860
  data: t,
621
- responseName: s
861
+ responseName: n
622
862
  };
623
- window.parent.postMessage(o, "*");
624
- let i = !1, l;
625
- const u = new Promise((h, c) => {
626
- const d = new Error(`${e} message request with response name of ${s} timed out after ${f}`);
863
+ window.parent.postMessage(r, "*");
864
+ let s = !1, l;
865
+ const u = new Promise((p, c) => {
866
+ const d = new Error(`${e} message request with response name of ${n} timed out after ${g}`);
627
867
  setTimeout(() => {
628
- i = !0, this.off(s, l), c(d);
629
- }, f);
630
- }), a = new Promise((h) => {
868
+ s = !0, this.off(n, l), c(d);
869
+ }, g);
870
+ }), a = new Promise((p) => {
631
871
  l = (c) => {
632
- i || h(c);
633
- }, this.once(s, h);
872
+ s || p(c);
873
+ }, this.once(n, p);
634
874
  });
635
875
  return Promise.race([u, a]);
636
876
  }
637
- async subscribe(e, t, s) {
638
- let o, i;
639
- typeof t == "function" ? i = t : (o = t, i = s);
640
- const l = b(), u = b();
877
+ async subscribe(e, t, n) {
878
+ let r, s;
879
+ typeof t == "function" ? s = t : (r = t, s = n);
880
+ const l = y(), u = y();
641
881
  let a = this._subscriptionNamesBySubjectName.get(e);
642
- a || (a = [], this._subscriptionNamesBySubjectName.set(e, a)), a.push(l), this._subscriptionNamesByHandler.set(i, l), this.on(l, i);
643
- const h = {
644
- telemetrySdkVersion: y,
882
+ a || (a = [], this._subscriptionNamesBySubjectName.set(e, a)), a.push(l), this._subscriptionNamesByHandler.set(s, l), this.on(l, s);
883
+ const p = {
884
+ telemetrySdkVersion: b,
645
885
  applicationName: this._applicationName,
646
886
  applicationSpecifier: this._applicationSpecifier,
647
887
  applicationInstance: this._applicationInstance,
648
888
  name: e,
649
- data: o,
889
+ data: r,
650
890
  responseName: u,
651
891
  subscriptionName: l
652
892
  };
653
- window.parent.postMessage(h, "*");
893
+ window.parent.postMessage(p, "*");
654
894
  let c = !1, d;
655
- const S = new Promise((_, g) => {
656
- const m = new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${f}`);
895
+ const S = new Promise((w, f) => {
896
+ const m = new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${g}`);
657
897
  setTimeout(() => {
658
- c = !0, this.off(u, d), g(m);
659
- }, f);
660
- }), N = new Promise((_) => {
661
- d = (g) => {
662
- c || _(g);
663
- }, this.on(u, _);
898
+ c = !0, this.off(u, d), f(m);
899
+ }, g);
900
+ }), v = new Promise((w) => {
901
+ d = (f) => {
902
+ c || w(f);
903
+ }, this.on(u, w);
664
904
  });
665
- return Promise.race([S, N]);
905
+ return Promise.race([S, v]);
666
906
  }
667
- async unsubscribe(e, t, s) {
668
- let o, i;
669
- typeof t == "function" ? i = t : (o = t, i = s);
670
- const l = b();
907
+ async unsubscribe(e, t, n) {
908
+ let r, s;
909
+ typeof t == "function" ? s = t : (r = t, s = n);
910
+ const l = y();
671
911
  let u = [];
672
- if (i) {
673
- const a = this._subscriptionNamesByHandler.get(i);
912
+ if (s) {
913
+ const a = this._subscriptionNamesByHandler.get(s);
674
914
  if (!a)
675
915
  return { success: !1 };
676
- u = [a], this._subscriptionNamesByHandler.delete(i);
916
+ u = [a], this._subscriptionNamesByHandler.delete(s);
677
917
  } else if (!this._subscriptionNamesBySubjectName.get(e))
678
918
  return { success: !1 };
679
919
  for await (const a of u) {
680
- this.off(a, i);
681
- const h = {
682
- telemetrySdkVersion: y,
920
+ this.off(a, s);
921
+ const p = {
922
+ telemetrySdkVersion: b,
683
923
  applicationInstance: this._applicationInstance,
684
924
  applicationName: this._applicationName,
685
925
  applicationSpecifier: this._applicationSpecifier,
686
926
  name: e,
687
- data: o,
927
+ data: r,
688
928
  responseName: l,
689
929
  unsubscribeName: a
690
930
  };
691
- window.parent.postMessage(h, "*");
931
+ window.parent.postMessage(p, "*");
692
932
  let c = !1, d;
693
- const S = new Promise((g, m) => {
694
- const I = new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${f}`);
933
+ const S = new Promise((f, m) => {
934
+ const H = new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${g}`);
695
935
  setTimeout(() => {
696
- c = !0, this.off(l, d), m(I);
697
- }, f);
698
- }), N = new Promise((g) => {
936
+ c = !0, this.off(l, d), m(H);
937
+ }, g);
938
+ }), v = new Promise((f) => {
699
939
  d = (m) => {
700
- c || g(m);
701
- }, this.once(l, g);
940
+ c || f(m);
941
+ }, this.once(l, f);
702
942
  });
703
- if (!(await Promise.race([S, N])).success)
943
+ if (!(await Promise.race([S, v])).success)
704
944
  return { success: !1 };
705
945
  }
706
946
  return { success: !0 };
@@ -723,9 +963,9 @@ class T {
723
963
  * @param handler The callback function to execute when messages are received
724
964
  */
725
965
  on(e, t) {
726
- var s;
727
- const o = (s = this._onHandlers.get(e)) !== null && s !== void 0 ? s : [];
728
- o.length === 0 && this._onHandlers.set(e, o), o.push(t);
966
+ var n;
967
+ const r = (n = this._onHandlers.get(e)) !== null && n !== void 0 ? n : [];
968
+ r.length === 0 && this._onHandlers.set(e, r), r.push(t);
729
969
  }
730
970
  /**
731
971
  * Registers a one-time handler for a specific message type.
@@ -742,9 +982,9 @@ class T {
742
982
  * @param handler The callback function to execute when the message is received
743
983
  */
744
984
  once(e, t) {
745
- var s;
746
- const o = (s = this._onceHandlers.get(e)) !== null && s !== void 0 ? s : [];
747
- o.length === 0 && this._onceHandlers.set(e, o), o.push(t);
985
+ var n;
986
+ const r = (n = this._onceHandlers.get(e)) !== null && n !== void 0 ? n : [];
987
+ r.length === 0 && this._onceHandlers.set(e, r), r.push(t);
748
988
  }
749
989
  /**
750
990
  * Removes previously registered message handlers.
@@ -762,101 +1002,115 @@ class T {
762
1002
  * all handlers for this message type will be removed.
763
1003
  */
764
1004
  off(e, t) {
765
- const s = this._onHandlers.get(e), o = this._onceHandlers.get(e);
766
- if (!(!s && !o)) {
767
- if (s) {
768
- for (let i = 0; i < s.length; i += 1)
769
- t && s[i] !== t || (s.splice(i, 1), i -= 1);
770
- s.length === 0 && this._onHandlers.delete(e);
1005
+ const n = this._onHandlers.get(e), r = this._onceHandlers.get(e);
1006
+ if (!(!n && !r)) {
1007
+ if (n) {
1008
+ for (let s = 0; s < n.length; s += 1)
1009
+ t && n[s] !== t || (n.splice(s, 1), s -= 1);
1010
+ n.length === 0 && this._onHandlers.delete(e);
771
1011
  }
772
- if (o) {
773
- for (let i = 0; i < o.length; i += 1)
774
- t && o[i] !== t || (o.splice(i, 1), i -= 1);
775
- o.length === 0 && this._onceHandlers.delete(e);
1012
+ if (r) {
1013
+ for (let s = 0; s < r.length; s += 1)
1014
+ t && r[s] !== t || (r.splice(s, 1), s -= 1);
1015
+ r.length === 0 && this._onceHandlers.delete(e);
776
1016
  }
777
1017
  }
778
1018
  }
779
1019
  }
780
- function b() {
1020
+ function y() {
781
1021
  return Math.random().toString(36).slice(2, 9);
782
1022
  }
783
- const y = H.version;
784
- let n = null;
1023
+ const b = A.version;
1024
+ let i = null;
785
1025
  function j() {
786
- return n;
1026
+ return i;
787
1027
  }
788
- function U(r) {
789
- n = new T(r), n.bind();
1028
+ function L(o) {
1029
+ i = new W(o), i.bind();
790
1030
  }
791
- function L() {
792
- n == null || n.unbind(), n = null;
1031
+ function U() {
1032
+ i == null || i.unbind(), i = null;
793
1033
  }
794
- function x(...r) {
795
- return p(n), n.on(...r);
1034
+ function V(...o) {
1035
+ return h(i), i.on(...o);
796
1036
  }
797
- function V(...r) {
798
- return p(n), n.once(...r);
1037
+ function z(...o) {
1038
+ return h(i), i.once(...o);
799
1039
  }
800
- function z(...r) {
801
- return p(n), n.off(...r);
1040
+ function G(...o) {
1041
+ return h(i), i.off(...o);
802
1042
  }
803
- function D(...r) {
804
- return p(n), n.send(...r);
1043
+ function J(...o) {
1044
+ return h(i), i.send(...o);
805
1045
  }
806
- function K(...r) {
807
- return p(n), n.request(...r);
1046
+ function K(...o) {
1047
+ return h(i), i.request(...o);
808
1048
  }
809
- function G(...r) {
810
- return p(n), n.subscribe(...r);
1049
+ function O(...o) {
1050
+ return h(i), i.subscribe(...o);
811
1051
  }
812
- function J(...r) {
813
- return p(n), n.unsubscribe(...r);
814
- }
815
- function Q() {
816
- return p(n), n.store;
817
- }
818
- function W() {
819
- return p(n), n.applications;
1052
+ function Q(...o) {
1053
+ return h(i), i.unsubscribe(...o);
820
1054
  }
821
1055
  function X() {
822
- return p(n), n.media;
1056
+ return h(i), i.store;
823
1057
  }
824
1058
  function Y() {
825
- return p(n), n.accounts;
1059
+ return h(i), i.applications;
826
1060
  }
827
1061
  function Z() {
828
- return p(n), n.users;
1062
+ return h(i), i.media;
1063
+ }
1064
+ function ee() {
1065
+ return h(i), i.accounts;
1066
+ }
1067
+ function te() {
1068
+ return h(i), i.users;
1069
+ }
1070
+ function se() {
1071
+ return h(i), i.devices;
1072
+ }
1073
+ function ne() {
1074
+ return h(i), i.proxy;
1075
+ }
1076
+ function ie() {
1077
+ return h(i), i.rootSettingsNavigation;
829
1078
  }
830
- function O() {
831
- return p(n), n.rootSettingsNavigation;
1079
+ function re() {
1080
+ return h(i), i.weather;
832
1081
  }
833
- function p(r) {
834
- if (!r)
1082
+ function h(o) {
1083
+ if (!o)
835
1084
  throw new Error("SDK is not configured");
836
1085
  }
837
1086
  export {
838
- q as Accounts,
839
- P as Applications,
840
- T as Client,
841
- R as Environment,
842
- C as Media,
843
- k as Store,
844
- E as Users,
845
- Y as accounts,
846
- W as applications,
847
- U as configure,
848
- L as destroy,
1087
+ E as Accounts,
1088
+ I as Applications,
1089
+ W as Client,
1090
+ P as Devices,
1091
+ D as Environment,
1092
+ M as Media,
1093
+ B as Store,
1094
+ C as Users,
1095
+ k as Weather,
1096
+ ee as accounts,
1097
+ Y as applications,
1098
+ L as configure,
1099
+ U as destroy,
1100
+ se as devices,
849
1101
  j as globalClient,
850
- X as media,
851
- z as off,
852
- x as on,
853
- V as once,
1102
+ Z as media,
1103
+ G as off,
1104
+ V as on,
1105
+ z as once,
1106
+ ne as proxy,
854
1107
  K as request,
855
- O as rootSettingsNavigation,
856
- D as send,
857
- Q as store,
858
- G as subscribe,
859
- y as telemetrySdkVersion,
860
- J as unsubscribe,
861
- Z as users
1108
+ ie as rootSettingsNavigation,
1109
+ J as send,
1110
+ X as store,
1111
+ O as subscribe,
1112
+ b as telemetrySdkVersion,
1113
+ Q as unsubscribe,
1114
+ te as users,
1115
+ re as weather
862
1116
  };