@rtsdk/topia 0.4.0 → 0.5.1

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/README.md CHANGED
@@ -50,12 +50,12 @@ await DroppedAsset.get(assetId, urlSlug, {
50
50
 
51
51
  ### Need an API Key to test locally? This is how you can create one:
52
52
 
53
- - While logged in to [topia.io](https://topia.io/), click on your image (or gray circle) in the top left of the screen to open My Account
54
- - In the side menu, select Integrations
53
+ - Navigate directly to your [integrations page](https://topia.io/t/dashboard/integrations) or follow the steps below from within a world.
54
+ - Click on your image (or circle) at the top left of the left hand navbar.
55
+ - Click Edit Profile. This will bring you to a separate dashboard.
56
+ - Click Integrations on the left nav
55
57
  - Click Generate New API Key and copy the API Key to be used in your .env and while using https://sdk-examples.metaversecloud.com
56
58
 
57
- <br>
58
-
59
59
  Alternatively, visitors of a [topia.io](https://topia.io/) world interact with each other and the interactively configured assets in your world without the need for an API Key. This is all made possible through Interactive Session credentials passed to the SDK with every request, when applicable. What does this mean for you? Not much, actually! All of the magic happens behind the scenes and all you have to do is make sure that new class constructors include an options object like this: `options: WorldOptionalInterface = { attributes: {}, credentials: {} }` and all calls to `this.topia.axios` include the inherited `this.requestOptions` parameter.
60
60
 
61
61
  ![Interactive Application Development Diagram](./InteractiveApplicationDevelopment.png)
package/dist/index.cjs CHANGED
@@ -39666,7 +39666,7 @@ class SDKController {
39666
39666
  topiaPublicApi() {
39667
39667
  return this.topia.axios;
39668
39668
  }
39669
- errorHandler({ error, message = "Something went wrong. Please try again or contact support.", }) {
39669
+ errorHandler({ error, message = "Something went wrong. Please try again or contact support.", params, }) {
39670
39670
  var _a, _b;
39671
39671
  const stackTrace = new Error("Thrown here:");
39672
39672
  let data = {}, errorMessage = message, method = "unknown", stack = "empty", status = 500, url = "unknown";
@@ -39692,6 +39692,7 @@ class SDKController {
39692
39692
  data,
39693
39693
  message: errorMessage,
39694
39694
  method,
39695
+ params,
39695
39696
  stack,
39696
39697
  stackTrace,
39697
39698
  status,
@@ -39742,14 +39743,14 @@ var _DroppedAsset_updateDroppedAsset;
39742
39743
  class DroppedAsset extends Asset {
39743
39744
  constructor(topia, id, urlSlug, options = { attributes: { text: "" }, credentials: {} }) {
39744
39745
  var _a;
39745
- super(topia, id, options);
39746
+ super(topia, id, { attributes: options.attributes, credentials: Object.assign(Object.assign({}, options.credentials), { urlSlug }) });
39746
39747
  // private methods
39747
39748
  _DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
39748
39749
  try {
39749
39750
  yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/${updateType}`, Object.assign({}, payload), this.requestOptions);
39750
39751
  }
39751
39752
  catch (error) {
39752
- throw this.errorHandler({ error });
39753
+ throw this.errorHandler({ error, params: { payload, updateType } });
39753
39754
  }
39754
39755
  }));
39755
39756
  Object.assign(this, options.attributes);
@@ -39841,7 +39842,7 @@ class DroppedAsset extends Asset {
39841
39842
  this.dataObject = dataObject || this.dataObject;
39842
39843
  }
39843
39844
  catch (error) {
39844
- throw this.errorHandler({ error });
39845
+ throw this.errorHandler({ error, params: { dataObject, options } });
39845
39846
  }
39846
39847
  });
39847
39848
  }
@@ -39867,7 +39868,7 @@ class DroppedAsset extends Asset {
39867
39868
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
39868
39869
  }
39869
39870
  catch (error) {
39870
- throw this.errorHandler({ error });
39871
+ throw this.errorHandler({ error, params: { dataObject, options } });
39871
39872
  }
39872
39873
  });
39873
39874
  }
@@ -39892,7 +39893,7 @@ class DroppedAsset extends Asset {
39892
39893
  yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
39893
39894
  }
39894
39895
  catch (error) {
39895
- throw this.errorHandler({ error });
39896
+ throw this.errorHandler({ error, params: { path, amount, options } });
39896
39897
  }
39897
39898
  });
39898
39899
  }
@@ -39911,11 +39912,12 @@ class DroppedAsset extends Asset {
39911
39912
  * ```
39912
39913
  */
39913
39914
  updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }) {
39915
+ const params = { assetBroadcast, assetBroadcastAll, broadcasterEmail };
39914
39916
  try {
39915
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { assetBroadcast, assetBroadcastAll, broadcasterEmail }, "set-asset-broadcast");
39917
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-asset-broadcast");
39916
39918
  }
39917
39919
  catch (error) {
39918
- throw this.errorHandler({ error });
39920
+ throw this.errorHandler({ error, params });
39919
39921
  }
39920
39922
  }
39921
39923
  /**
@@ -39939,21 +39941,22 @@ class DroppedAsset extends Asset {
39939
39941
  * ```
39940
39942
  */
39941
39943
  updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
39944
+ const params = {
39945
+ clickType,
39946
+ clickableLink,
39947
+ clickableLinkTitle,
39948
+ clickableDisplayTextDescription,
39949
+ clickableDisplayTextHeadline,
39950
+ isForceLinkInIframe,
39951
+ isOpenLinkInDrawer,
39952
+ portalName,
39953
+ position,
39954
+ };
39942
39955
  try {
39943
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {
39944
- clickType,
39945
- clickableLink,
39946
- clickableLinkTitle,
39947
- clickableDisplayTextDescription,
39948
- clickableDisplayTextHeadline,
39949
- isForceLinkInIframe,
39950
- isOpenLinkInDrawer,
39951
- portalName,
39952
- position,
39953
- }, "change-click-type");
39956
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "change-click-type");
39954
39957
  }
39955
39958
  catch (error) {
39956
- throw this.errorHandler({ error });
39959
+ throw this.errorHandler({ error, params });
39957
39960
  }
39958
39961
  }
39959
39962
  /**
@@ -39973,11 +39976,12 @@ class DroppedAsset extends Asset {
39973
39976
  * ```
39974
39977
  */
39975
39978
  updateCustomTextAsset(style, text) {
39979
+ const params = { style, text };
39976
39980
  try {
39977
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { style, text }, "set-custom-text");
39981
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-custom-text");
39978
39982
  }
39979
39983
  catch (error) {
39980
- throw this.errorHandler({ error });
39984
+ throw this.errorHandler({ error, params });
39981
39985
  }
39982
39986
  }
39983
39987
  /**
@@ -39999,11 +40003,21 @@ class DroppedAsset extends Asset {
39999
40003
  * ```
40000
40004
  */
40001
40005
  updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }) {
40006
+ const params = {
40007
+ audioRadius,
40008
+ audioSliderVolume,
40009
+ isVideo,
40010
+ mediaLink,
40011
+ mediaName,
40012
+ mediaType,
40013
+ portalName,
40014
+ syncUserMedia,
40015
+ };
40002
40016
  try {
40003
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia }, "change-media-type");
40017
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "change-media-type");
40004
40018
  }
40005
40019
  catch (error) {
40006
- throw this.errorHandler({ error });
40020
+ throw this.errorHandler({ error, params });
40007
40021
  }
40008
40022
  }
40009
40023
  /**
@@ -40020,7 +40034,7 @@ class DroppedAsset extends Asset {
40020
40034
  return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { isMutezone }, "set-mute-zone");
40021
40035
  }
40022
40036
  catch (error) {
40023
- throw this.errorHandler({ error });
40037
+ throw this.errorHandler({ error, params: { isMutezone } });
40024
40038
  }
40025
40039
  }
40026
40040
  /**
@@ -40037,7 +40051,7 @@ class DroppedAsset extends Asset {
40037
40051
  return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { isWebhookZoneEnabled }, "set-webhook-zone");
40038
40052
  }
40039
40053
  catch (error) {
40040
- throw this.errorHandler({ error });
40054
+ throw this.errorHandler({ error, params: { isWebhookZoneEnabled } });
40041
40055
  }
40042
40056
  }
40043
40057
  /**
@@ -40050,11 +40064,12 @@ class DroppedAsset extends Asset {
40050
40064
  * ```
40051
40065
  */
40052
40066
  updatePosition(x, y, yOrderAdjust) {
40067
+ const params = { x, y, yOrderAdjust };
40053
40068
  try {
40054
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { x, y, yOrderAdjust }, "set-position");
40069
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-position");
40055
40070
  }
40056
40071
  catch (error) {
40057
- throw this.errorHandler({ error });
40072
+ throw this.errorHandler({ error, params });
40058
40073
  }
40059
40074
  }
40060
40075
  /**
@@ -40071,11 +40086,12 @@ class DroppedAsset extends Asset {
40071
40086
  * ```
40072
40087
  */
40073
40088
  updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }) {
40089
+ const params = { isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap };
40074
40090
  try {
40075
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap }, "set-private-zone");
40091
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-private-zone");
40076
40092
  }
40077
40093
  catch (error) {
40078
- throw this.errorHandler({ error });
40094
+ throw this.errorHandler({ error, params });
40079
40095
  }
40080
40096
  }
40081
40097
  /**
@@ -40092,7 +40108,7 @@ class DroppedAsset extends Asset {
40092
40108
  return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { assetScale }, "change-scale");
40093
40109
  }
40094
40110
  catch (error) {
40095
- throw this.errorHandler({ error });
40111
+ throw this.errorHandler({ error, params: { assetScale } });
40096
40112
  }
40097
40113
  }
40098
40114
  /**
@@ -40109,7 +40125,7 @@ class DroppedAsset extends Asset {
40109
40125
  return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { mediaId }, "change-uploaded-media-selected");
40110
40126
  }
40111
40127
  catch (error) {
40112
- throw this.errorHandler({ error });
40128
+ throw this.errorHandler({ error, params: { mediaId } });
40113
40129
  }
40114
40130
  }
40115
40131
  /**
@@ -40122,11 +40138,12 @@ class DroppedAsset extends Asset {
40122
40138
  * ```
40123
40139
  */
40124
40140
  updateWebImageLayers(bottom, top) {
40141
+ const params = { bottom, top };
40125
40142
  try {
40126
- return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { bottom, top }, "set-webimage-layers");
40143
+ return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-webimage-layers");
40127
40144
  }
40128
40145
  catch (error) {
40129
- throw this.errorHandler({ error });
40146
+ throw this.errorHandler({ error, params });
40130
40147
  }
40131
40148
  }
40132
40149
  /**
@@ -40150,23 +40167,13 @@ class DroppedAsset extends Asset {
40150
40167
  */
40151
40168
  addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }) {
40152
40169
  return __awaiter(this, void 0, void 0, function* () {
40170
+ const params = { dataObject, description, isUniqueOnly, title, type, url };
40153
40171
  try {
40154
- const response = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/webhooks`, {
40155
- active: true,
40156
- assetId: this.id,
40157
- dataObject,
40158
- description,
40159
- enteredBy: "",
40160
- isUniqueOnly,
40161
- title,
40162
- type,
40163
- url,
40164
- urlSlug: this.urlSlug,
40165
- }, this.requestOptions);
40172
+ const response = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/webhooks`, Object.assign(Object.assign({}, params), { active: true, assetId: this.id, enteredBy: "", urlSlug: this.urlSlug }), this.requestOptions);
40166
40173
  return response.data.webhookId;
40167
40174
  }
40168
40175
  catch (error) {
40169
- throw this.errorHandler({ error });
40176
+ throw this.errorHandler({ error, params });
40170
40177
  }
40171
40178
  });
40172
40179
  }
@@ -40184,16 +40191,51 @@ class DroppedAsset extends Asset {
40184
40191
  */
40185
40192
  setInteractiveSettings({ isInteractive = false, interactivePublicKey = "", }) {
40186
40193
  return __awaiter(this, void 0, void 0, function* () {
40194
+ const params = {
40195
+ interactivePublicKey,
40196
+ isInteractive,
40197
+ };
40187
40198
  try {
40188
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-asset-interactive-settings`, {
40189
- interactivePublicKey,
40190
- isInteractive,
40191
- }, this.requestOptions);
40199
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-asset-interactive-settings`, params, this.requestOptions);
40192
40200
  this.isInteractive = isInteractive;
40193
40201
  this.interactivePublicKey = interactivePublicKey;
40194
40202
  }
40195
40203
  catch (error) {
40196
- throw this.errorHandler({ error });
40204
+ throw this.errorHandler({ error, params });
40205
+ }
40206
+ });
40207
+ }
40208
+ ////////// analytics
40209
+ /**
40210
+ * @summary
40211
+ * Retrieve analytics for a dropped asset by day, week, month, quarter, or year
40212
+ *
40213
+ * @usage
40214
+ * ```ts
40215
+ * const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
40216
+ * periodType: "quarter",
40217
+ * dateValue: 3,
40218
+ * year: 2023,
40219
+ * });
40220
+ * ```
40221
+ */
40222
+ fetchDroppedAssetAnalytics({ periodType, dateValue, year, }) {
40223
+ return __awaiter(this, void 0, void 0, function* () {
40224
+ try {
40225
+ let query = "";
40226
+ switch (periodType) {
40227
+ case "week":
40228
+ query = `&week=W${dateValue}`;
40229
+ case "month":
40230
+ query = `&month=${dateValue}`;
40231
+ case "quarter":
40232
+ query = `&quarter=Q${dateValue}`;
40233
+ }
40234
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
40235
+ return response.data;
40236
+ }
40237
+ catch (error) {
40238
+ throw this.errorHandler({ error, params: { periodType, dateValue, year } });
40197
40239
  }
40198
40240
  });
40199
40241
  }
@@ -40311,7 +40353,7 @@ class World extends SDKController {
40311
40353
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
40312
40354
  }
40313
40355
  catch (error) {
40314
- throw this.errorHandler({ error });
40356
+ throw this.errorHandler({ error, params: { dataObject, options } });
40315
40357
  }
40316
40358
  });
40317
40359
  /**
@@ -40335,7 +40377,7 @@ class World extends SDKController {
40335
40377
  this.dataObject = dataObject || this.dataObject;
40336
40378
  }
40337
40379
  catch (error) {
40338
- throw this.errorHandler({ error });
40380
+ throw this.errorHandler({ error, params: { dataObject, options } });
40339
40381
  }
40340
40382
  });
40341
40383
  Object.assign(this, options.attributes);
@@ -40391,7 +40433,7 @@ class World extends SDKController {
40391
40433
  */
40392
40434
  updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }) {
40393
40435
  return __awaiter(this, void 0, void 0, function* () {
40394
- const payload = {
40436
+ const params = {
40395
40437
  controls,
40396
40438
  description,
40397
40439
  forceAuthOnLogin,
@@ -40401,12 +40443,12 @@ class World extends SDKController {
40401
40443
  width,
40402
40444
  };
40403
40445
  try {
40404
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/world-details`, payload, this.requestOptions);
40405
- const cleanPayload = removeUndefined(payload);
40446
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/world-details`, params, this.requestOptions);
40447
+ const cleanPayload = removeUndefined(params);
40406
40448
  Object.assign(this, cleanPayload);
40407
40449
  }
40408
40450
  catch (error) {
40409
- throw this.errorHandler({ error });
40451
+ throw this.errorHandler({ error, params });
40410
40452
  }
40411
40453
  });
40412
40454
  }
@@ -40465,7 +40507,7 @@ class World extends SDKController {
40465
40507
  return droppedAssets;
40466
40508
  }
40467
40509
  catch (error) {
40468
- throw this.errorHandler({ error });
40510
+ throw this.errorHandler({ error, params: { uniqueName, isPartial, isReversed } });
40469
40511
  }
40470
40512
  });
40471
40513
  }
@@ -40499,7 +40541,7 @@ class World extends SDKController {
40499
40541
  return droppedAssets;
40500
40542
  }
40501
40543
  catch (error) {
40502
- throw this.errorHandler({ error });
40544
+ throw this.errorHandler({ error, params: { sceneDropId, uniqueName } });
40503
40545
  }
40504
40546
  });
40505
40547
  }
@@ -40624,12 +40666,13 @@ class World extends SDKController {
40624
40666
  */
40625
40667
  dropScene({ assetSuffix, position, sceneId, }) {
40626
40668
  return __awaiter(this, void 0, void 0, function* () {
40669
+ const params = { assetSuffix, position, sceneId };
40627
40670
  try {
40628
- const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, { assetSuffix, position, sceneId }, this.requestOptions);
40671
+ const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
40629
40672
  return result;
40630
40673
  }
40631
40674
  catch (error) {
40632
- throw this.errorHandler({ error });
40675
+ throw this.errorHandler({ error, params });
40633
40676
  }
40634
40677
  });
40635
40678
  }
@@ -40656,7 +40699,7 @@ class World extends SDKController {
40656
40699
  yield this.topiaPublicApi().put(`/world/${this.urlSlug}/change-scene`, { sceneId }, this.requestOptions);
40657
40700
  }
40658
40701
  catch (error) {
40659
- throw this.errorHandler({ error });
40702
+ throw this.errorHandler({ error, params: { sceneId } });
40660
40703
  }
40661
40704
  });
40662
40705
  }
@@ -40681,7 +40724,7 @@ class World extends SDKController {
40681
40724
  yield this.topiaPublicApi().put(`/world/${this.urlSlug}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
40682
40725
  }
40683
40726
  catch (error) {
40684
- throw this.errorHandler({ error });
40727
+ throw this.errorHandler({ error, params: { path, amount, options } });
40685
40728
  }
40686
40729
  });
40687
40730
  }
@@ -40707,6 +40750,40 @@ class World extends SDKController {
40707
40750
  }
40708
40751
  });
40709
40752
  }
40753
+ ////////// analytics
40754
+ /**
40755
+ * @summary
40756
+ * Retrieve world analytics by day, week, month, quarter, or year
40757
+ *
40758
+ * @usage
40759
+ * ```ts
40760
+ * const analytics = await world.fetchWorldAnalytics({
40761
+ * periodType: "week",
40762
+ * dateValue: 40,
40763
+ * year: 2023,
40764
+ * });
40765
+ * ```
40766
+ */
40767
+ fetchWorldAnalytics({ periodType, dateValue, year, }) {
40768
+ return __awaiter(this, void 0, void 0, function* () {
40769
+ try {
40770
+ let query = "";
40771
+ switch (periodType) {
40772
+ case "week":
40773
+ query = `&week=W${dateValue}`;
40774
+ case "month":
40775
+ query = `&month=${dateValue}`;
40776
+ case "quarter":
40777
+ query = `&quarter=Q${dateValue}`;
40778
+ }
40779
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/world-analytics?year=${year}${query}`, this.requestOptions);
40780
+ return response.data;
40781
+ }
40782
+ catch (error) {
40783
+ throw this.errorHandler({ error, params: { periodType, dateValue, year } });
40784
+ }
40785
+ });
40786
+ }
40710
40787
  }
40711
40788
  _World_droppedAssetsMap = new WeakMap();
40712
40789
 
@@ -40926,7 +41003,7 @@ class User extends SDKController {
40926
41003
  this.dataObject = dataObject || this.dataObject;
40927
41004
  }
40928
41005
  catch (error) {
40929
- throw this.errorHandler({ error });
41006
+ throw this.errorHandler({ error, params: { dataObject, options } });
40930
41007
  }
40931
41008
  });
40932
41009
  }
@@ -40953,7 +41030,7 @@ class User extends SDKController {
40953
41030
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
40954
41031
  }
40955
41032
  catch (error) {
40956
- throw this.errorHandler({ error });
41033
+ throw this.errorHandler({ error, params: { dataObject, options } });
40957
41034
  }
40958
41035
  });
40959
41036
  }
@@ -40978,7 +41055,7 @@ class User extends SDKController {
40978
41055
  yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
40979
41056
  }
40980
41057
  catch (error) {
40981
- throw this.errorHandler({ error });
41058
+ throw this.errorHandler({ error, params: { path, amount, options } });
40982
41059
  }
40983
41060
  });
40984
41061
  }
@@ -40996,7 +41073,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
40996
41073
  */
40997
41074
  class Visitor extends User {
40998
41075
  constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
40999
- super(topia, { credentials: options.credentials });
41076
+ super(topia, { credentials: Object.assign(Object.assign({}, options.credentials), { urlSlug }) });
41000
41077
  Object.assign(this, options.attributes);
41001
41078
  this.id = id;
41002
41079
  this.urlSlug = urlSlug;
@@ -41063,7 +41140,7 @@ class Visitor extends User {
41063
41140
  }, this.requestOptions);
41064
41141
  }
41065
41142
  catch (error) {
41066
- throw this.errorHandler({ error });
41143
+ throw this.errorHandler({ error, params: { shouldTeleportVisitor, x, y } });
41067
41144
  }
41068
41145
  });
41069
41146
  }
@@ -41082,15 +41159,16 @@ class Visitor extends User {
41082
41159
  */
41083
41160
  fireToast({ groupId, title, text }) {
41084
41161
  return __awaiter(this, void 0, void 0, function* () {
41162
+ const params = {
41163
+ groupId,
41164
+ title,
41165
+ text,
41166
+ };
41085
41167
  try {
41086
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, {
41087
- groupId,
41088
- title,
41089
- text,
41090
- }, this.requestOptions);
41168
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, params, this.requestOptions);
41091
41169
  }
41092
41170
  catch (error) {
41093
- throw this.errorHandler({ error });
41171
+ throw this.errorHandler({ error, params });
41094
41172
  }
41095
41173
  });
41096
41174
  }
@@ -41109,15 +41187,16 @@ class Visitor extends User {
41109
41187
  */
41110
41188
  openIframe({ link, shouldOpenInDrawer, title }) {
41111
41189
  return __awaiter(this, void 0, void 0, function* () {
41190
+ const params = {
41191
+ link,
41192
+ shouldOpenInDrawer,
41193
+ title,
41194
+ };
41112
41195
  try {
41113
- yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, {
41114
- link,
41115
- shouldOpenInDrawer,
41116
- title,
41117
- }, this.requestOptions);
41196
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, params, this.requestOptions);
41118
41197
  }
41119
41198
  catch (error) {
41120
- throw this.errorHandler({ error });
41199
+ throw this.errorHandler({ error, params });
41121
41200
  }
41122
41201
  });
41123
41202
  }
@@ -41140,6 +41219,32 @@ class Visitor extends User {
41140
41219
  }
41141
41220
  });
41142
41221
  }
41222
+ /**
41223
+ * @summary
41224
+ * Grant expression to a visitor by id or name.
41225
+ *
41226
+ * @usage
41227
+ * ```ts
41228
+ * await visitor.grantExpression({ name: "Eyes" });
41229
+ * ```
41230
+ */
41231
+ grantExpression({ id, name }) {
41232
+ return __awaiter(this, void 0, void 0, function* () {
41233
+ if (!id && !name)
41234
+ throw "An expression id or name is required.";
41235
+ try {
41236
+ let expressionId = id;
41237
+ if (name) {
41238
+ expressionId = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
41239
+ }
41240
+ const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
41241
+ return result;
41242
+ }
41243
+ catch (error) {
41244
+ throw this.errorHandler({ error, params: { id, name } });
41245
+ }
41246
+ });
41247
+ }
41143
41248
  /**
41144
41249
  * @summary
41145
41250
  * Retrieves the data object for a visitor.
@@ -41182,7 +41287,7 @@ class Visitor extends User {
41182
41287
  this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
41183
41288
  }
41184
41289
  catch (error) {
41185
- throw this.errorHandler({ error });
41290
+ throw this.errorHandler({ error, params: { dataObject, options } });
41186
41291
  }
41187
41292
  });
41188
41293
  }
@@ -41207,7 +41312,7 @@ class Visitor extends User {
41207
41312
  this.dataObject = dataObject || this.dataObject;
41208
41313
  }
41209
41314
  catch (error) {
41210
- throw this.errorHandler({ error });
41315
+ throw this.errorHandler({ error, params: { dataObject, options } });
41211
41316
  }
41212
41317
  });
41213
41318
  }
@@ -41232,7 +41337,7 @@ class Visitor extends User {
41232
41337
  yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
41233
41338
  }
41234
41339
  catch (error) {
41235
- throw this.errorHandler({ error });
41340
+ throw this.errorHandler({ error, params: { path, amount, options } });
41236
41341
  }
41237
41342
  });
41238
41343
  }
@@ -41435,8 +41540,23 @@ class DroppedAssetFactory extends SDKController {
41435
41540
  return droppedAsset;
41436
41541
  });
41437
41542
  }
41543
+ getWithUniqueName(uniqueName, urlSlug, interactivePublicKey, interactiveSecret) {
41544
+ return __awaiter(this, void 0, void 0, function* () {
41545
+ const params = { uniqueName, urlSlug, interactivePublicKey, interactiveSecret };
41546
+ const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
41547
+ try {
41548
+ const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers: { interactiveJWT, publickey: interactivePublicKey } });
41549
+ const { id } = response.data;
41550
+ return new DroppedAsset(this.topia, id, urlSlug, { attributes: response.data });
41551
+ }
41552
+ catch (error) {
41553
+ throw this.errorHandler({ error, params });
41554
+ }
41555
+ });
41556
+ }
41438
41557
  drop(asset, { interactivePublicKey, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
41439
41558
  return __awaiter(this, void 0, void 0, function* () {
41559
+ const params = { interactivePublicKey, sceneDropId, uniqueName, urlSlug, yOrderAdjust };
41440
41560
  try {
41441
41561
  const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
41442
41562
  assetId: asset.id,
@@ -41450,7 +41570,7 @@ class DroppedAssetFactory extends SDKController {
41450
41570
  return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
41451
41571
  }
41452
41572
  catch (error) {
41453
- throw this.errorHandler({ error });
41573
+ throw this.errorHandler({ error, params });
41454
41574
  }
41455
41575
  });
41456
41576
  }