@rtsdk/topia 0.13.0 → 0.14.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.cjs CHANGED
@@ -39811,6 +39811,33 @@ var DroppedAssetMediaType;
39811
39811
  DroppedAssetMediaType["LINK"] = "link";
39812
39812
  })(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
39813
39813
 
39814
+ const getBrowserWarning = () => {
39815
+ if (typeof window !== "undefined") {
39816
+ console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
39817
+ }
39818
+ };
39819
+
39820
+ /**
39821
+ * Parses object, removes keys with undefined value, and returns clean object.
39822
+ */
39823
+ const removeUndefined = (obj) => {
39824
+ Object.keys(obj).forEach((key) => {
39825
+ if (obj[key] === undefined) {
39826
+ delete obj[key];
39827
+ }
39828
+ });
39829
+ return obj;
39830
+ };
39831
+
39832
+ /**
39833
+ * Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
39834
+ */
39835
+ const scatterVisitors = (original, scatterBy) => {
39836
+ const min = original - scatterBy;
39837
+ const max = original + scatterBy;
39838
+ return Math.floor(Math.random() * (max - min) + min);
39839
+ };
39840
+
39814
39841
  var _DroppedAsset_updateDroppedAsset;
39815
39842
  /**
39816
39843
  * @summary
@@ -39866,6 +39893,71 @@ class DroppedAsset extends Asset {
39866
39893
  }
39867
39894
  });
39868
39895
  }
39896
+ /**
39897
+ * @summary
39898
+ * Updates dropped asset details.
39899
+ *
39900
+ * @usage
39901
+ * ```ts
39902
+ * const payload = {
39903
+ * assetScale: 1,
39904
+ * clickType: "link",
39905
+ * clickableDisplayTextDescription: "Description",
39906
+ * clickableDisplayTextHeadline: "Headline",
39907
+ * clickableLink: "https://topia.io",
39908
+ * clickableLinkTitle: "Topia",
39909
+ * flipped: false,
39910
+ * isTextTopLayer: false,
39911
+ * layer0: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
39912
+ * layer1: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
39913
+ * position: { x: 0, y: 0 },
39914
+ * specialType: "webImage",
39915
+ * text: "My Asset",
39916
+ * textColor: "#000000",
39917
+ * textSize: 20,
39918
+ * textWeight: "normal",
39919
+ * textWidth: 200,
39920
+ * uniqueName: "example",
39921
+ * yOrderAdjust: 0,
39922
+ * }
39923
+ * await droppedAsset.updateDroppedAsset();
39924
+ * const { assetName } = droppedAsset;
39925
+ * ```
39926
+ */
39927
+ updateDroppedAsset({ assetScale, clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, flipped, isTextTopLayer, layer0, layer1, position, specialType, text, textColor, textSize, textWeight, textWidth, uniqueName, yOrderAdjust, }) {
39928
+ return __awaiter(this, void 0, void 0, function* () {
39929
+ const params = {
39930
+ assetScale,
39931
+ clickType,
39932
+ clickableLink,
39933
+ clickableLinkTitle,
39934
+ clickableDisplayTextDescription,
39935
+ clickableDisplayTextHeadline,
39936
+ flipped,
39937
+ isTextTopLayer,
39938
+ layer0,
39939
+ layer1,
39940
+ position,
39941
+ specialType,
39942
+ text,
39943
+ textColor,
39944
+ textSize,
39945
+ textWeight,
39946
+ textWidth,
39947
+ uniqueName,
39948
+ yOrderAdjust,
39949
+ };
39950
+ const filteredParams = removeUndefined(params);
39951
+ try {
39952
+ const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}`, filteredParams, this.requestOptions);
39953
+ const droppedAssetDetails = response.data;
39954
+ Object.assign(this, droppedAssetDetails);
39955
+ }
39956
+ catch (error) {
39957
+ throw this.errorHandler({ error, params, sdkMethod: "DroppedAsset.updateDroppedAsset" });
39958
+ }
39959
+ });
39960
+ }
39869
39961
  /**
39870
39962
  * @summary
39871
39963
  * Delete dropped asset.
@@ -40427,33 +40519,6 @@ class Scene extends SDKController {
40427
40519
  }
40428
40520
  }
40429
40521
 
40430
- const getBrowserWarning = () => {
40431
- if (typeof window !== "undefined") {
40432
- console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
40433
- }
40434
- };
40435
-
40436
- /**
40437
- * Parses object, removes keys with undefined value, and returns clean object.
40438
- */
40439
- const removeUndefined = (obj) => {
40440
- Object.keys(obj).forEach((key) => {
40441
- if (obj[key] === undefined) {
40442
- delete obj[key];
40443
- }
40444
- });
40445
- return obj;
40446
- };
40447
-
40448
- /**
40449
- * Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
40450
- */
40451
- const scatterVisitors = (original, scatterBy) => {
40452
- const min = original - scatterBy;
40453
- const max = original + scatterBy;
40454
- return Math.floor(Math.random() * (max - min) + min);
40455
- };
40456
-
40457
40522
  /**
40458
40523
  * @summary
40459
40524
  * Create a single instance of Topia axios used for all calls to the public API in all classes
@@ -40955,7 +41020,7 @@ class World extends SDKController {
40955
41020
  const params = { allowNonAdmins, assetSuffix, position, sceneDropId, sceneId };
40956
41021
  try {
40957
41022
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
40958
- return result;
41023
+ return result.data;
40959
41024
  }
40960
41025
  catch (error) {
40961
41026
  throw this.errorHandler({ error, params, sdkMethod: "World.dropScene" });
@@ -41032,7 +41097,7 @@ class World extends SDKController {
41032
41097
  if (!particleId)
41033
41098
  return "No particleId found.";
41034
41099
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
41035
- return result;
41100
+ return result.data;
41036
41101
  }
41037
41102
  catch (error) {
41038
41103
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
@@ -41906,7 +41971,7 @@ class Visitor extends User {
41906
41971
  expressionId = response.data[0].id;
41907
41972
  }
41908
41973
  const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
41909
- return result;
41974
+ return result.data;
41910
41975
  }
41911
41976
  catch (error) {
41912
41977
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.grantExpression" });
@@ -41956,7 +42021,7 @@ class Visitor extends User {
41956
42021
  if (!particleId)
41957
42022
  return "No particleId found.";
41958
42023
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
41959
- return result;
42024
+ return result.data;
41960
42025
  }
41961
42026
  catch (error) {
41962
42027
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
package/dist/index.d.ts CHANGED
@@ -66,8 +66,9 @@ type WorldOptions = {
66
66
  };
67
67
 
68
68
  type ResponseType$1 = {
69
- message: string;
70
- success: boolean;
69
+ message?: string;
70
+ statusCode?: number;
71
+ success?: boolean;
71
72
  };
72
73
 
73
74
  /**
@@ -134,6 +135,38 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
134
135
  * ```
135
136
  */
136
137
  fetchDroppedAssetById(): Promise<void | ResponseType$1>;
138
+ /**
139
+ * @summary
140
+ * Updates dropped asset details.
141
+ *
142
+ * @usage
143
+ * ```ts
144
+ * const payload = {
145
+ * assetScale: 1,
146
+ * clickType: "link",
147
+ * clickableDisplayTextDescription: "Description",
148
+ * clickableDisplayTextHeadline: "Headline",
149
+ * clickableLink: "https://topia.io",
150
+ * clickableLinkTitle: "Topia",
151
+ * flipped: false,
152
+ * isTextTopLayer: false,
153
+ * layer0: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
154
+ * layer1: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
155
+ * position: { x: 0, y: 0 },
156
+ * specialType: "webImage",
157
+ * text: "My Asset",
158
+ * textColor: "#000000",
159
+ * textSize: 20,
160
+ * textWeight: "normal",
161
+ * textWidth: 200,
162
+ * uniqueName: "example",
163
+ * yOrderAdjust: 0,
164
+ * }
165
+ * await droppedAsset.updateDroppedAsset();
166
+ * const { assetName } = droppedAsset;
167
+ * ```
168
+ */
169
+ updateDroppedAsset({ assetScale, clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, flipped, isTextTopLayer, layer0, layer1, position, specialType, text, textColor, textSize, textWeight, textWidth, uniqueName, yOrderAdjust, }: UpdateDroppedAssetInterface): Promise<void | ResponseType$1>;
137
170
  /**
138
171
  * @summary
139
172
  * Delete dropped asset.
@@ -678,7 +711,7 @@ declare class World extends SDKController implements WorldInterface {
678
711
  position: object;
679
712
  sceneDropId?: string;
680
713
  sceneId: string;
681
- }): Promise<object | ResponseType$1>;
714
+ }): Promise<ResponseType$1>;
682
715
  /**
683
716
  * @summary
684
717
  * Replace the current scene of a world.
@@ -721,7 +754,7 @@ declare class World extends SDKController implements WorldInterface {
721
754
  name?: string;
722
755
  duration?: number;
723
756
  position?: object;
724
- }): Promise<object | ResponseType$1 | string>;
757
+ }): Promise<ResponseType$1 | string>;
725
758
  /**
726
759
  * @summary
727
760
  * Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
@@ -1300,7 +1333,7 @@ declare class Visitor extends User implements VisitorInterface {
1300
1333
  grantExpression({ id, name }: {
1301
1334
  id?: string;
1302
1335
  name?: string;
1303
- }): Promise<object | ResponseType$1>;
1336
+ }): Promise<ResponseType$1>;
1304
1337
  /**
1305
1338
  * @summary
1306
1339
  * Get all particles available
@@ -1310,7 +1343,7 @@ declare class Visitor extends User implements VisitorInterface {
1310
1343
  * await visitor.getAllParticles();
1311
1344
  * ```
1312
1345
  */
1313
- getAllParticles(): Promise<object | ResponseType$1>;
1346
+ getAllParticles(): Promise<ResponseType$1>;
1314
1347
  /**
1315
1348
  * @summary
1316
1349
  * Trigger a particle effect on a visitor
@@ -1324,7 +1357,7 @@ declare class Visitor extends User implements VisitorInterface {
1324
1357
  id?: string;
1325
1358
  name?: string;
1326
1359
  duration?: number;
1327
- }): Promise<object | ResponseType$1 | string>;
1360
+ }): Promise<ResponseType$1 | string>;
1328
1361
  /**
1329
1362
  * @summary
1330
1363
  * Retrieves the data object for a visitor.
@@ -1591,6 +1624,30 @@ interface UpdateBroadcastInterface {
1591
1624
  assetBroadcastAll?: boolean;
1592
1625
  broadcasterEmail?: string;
1593
1626
  }
1627
+ interface UpdateDroppedAssetInterface {
1628
+ assetScale?: number;
1629
+ clickType?: DroppedAssetClickType;
1630
+ clickableLink?: string;
1631
+ clickableLinkTitle?: string;
1632
+ clickableDisplayTextDescription?: string;
1633
+ clickableDisplayTextHeadline?: string;
1634
+ flipped?: boolean;
1635
+ isTextTopLayer?: boolean;
1636
+ layer0?: string;
1637
+ layer1?: string;
1638
+ position?: {
1639
+ x: number;
1640
+ y: number;
1641
+ };
1642
+ specialType?: string;
1643
+ text?: string | null;
1644
+ textColor?: string | null;
1645
+ textSize?: number | null;
1646
+ textWidth?: number | null;
1647
+ textWeight?: string | null;
1648
+ uniqueName?: string;
1649
+ yOrderAdjust?: number;
1650
+ }
1594
1651
  interface UpdateClickTypeInterface {
1595
1652
  clickType?: DroppedAssetClickType;
1596
1653
  clickableLink?: string;
@@ -2375,4 +2432,4 @@ declare class WorldFactory extends SDKController {
2375
2432
  }>;
2376
2433
  }
2377
2434
 
2378
- export { Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType$1 as ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
2435
+ export { Asset, AssetFactory, AssetInterface, AssetOptionalInterface, AssetOptions, AssetType, DroppedAsset, DroppedAssetClickType, DroppedAssetFactory, DroppedAssetInterface, DroppedAssetMediaType, DroppedAssetOptionalInterface, DroppedAssetOptions, FireToastInterface, InteractiveCredentials, MoveAllVisitorsInterface, MoveVisitorInterface, OpenIframeInterface, ResponseType$1 as ResponseType, SDKController, SDKInterface, Scene, SceneFactory, SceneInterface, SceneOptionalInterface, Topia, TopiaInterface, UpdateBroadcastInterface, UpdateClickTypeInterface, UpdateDroppedAssetInterface, UpdateMediaTypeInterface, UpdatePrivateZoneInterface, User, UserFactory, UserInterface, UserOptionalInterface, UserOptions, Visitor, VisitorFactory, VisitorInterface, VisitorOptionalInterface, VisitorOptions, VisitorType, VisitorsToMoveArrayType, VisitorsToMoveType, WebRTCConnector, WebRTCConnectorFactory, WebRTCConnectorInterface, WebRTCConnectorOptionalInterface, WebhookInterface, World, WorldActivity, WorldActivityFactory, WorldActivityOptionalInterface, WorldDetailsInterface, WorldFactory, WorldInterface, WorldOptionalInterface, WorldOptions, WorldWebhooksInterface };
package/dist/index.js CHANGED
@@ -39809,6 +39809,33 @@ var DroppedAssetMediaType;
39809
39809
  DroppedAssetMediaType["LINK"] = "link";
39810
39810
  })(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
39811
39811
 
39812
+ const getBrowserWarning = () => {
39813
+ if (typeof window !== "undefined") {
39814
+ console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
39815
+ }
39816
+ };
39817
+
39818
+ /**
39819
+ * Parses object, removes keys with undefined value, and returns clean object.
39820
+ */
39821
+ const removeUndefined = (obj) => {
39822
+ Object.keys(obj).forEach((key) => {
39823
+ if (obj[key] === undefined) {
39824
+ delete obj[key];
39825
+ }
39826
+ });
39827
+ return obj;
39828
+ };
39829
+
39830
+ /**
39831
+ * Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
39832
+ */
39833
+ const scatterVisitors = (original, scatterBy) => {
39834
+ const min = original - scatterBy;
39835
+ const max = original + scatterBy;
39836
+ return Math.floor(Math.random() * (max - min) + min);
39837
+ };
39838
+
39812
39839
  var _DroppedAsset_updateDroppedAsset;
39813
39840
  /**
39814
39841
  * @summary
@@ -39864,6 +39891,71 @@ class DroppedAsset extends Asset {
39864
39891
  }
39865
39892
  });
39866
39893
  }
39894
+ /**
39895
+ * @summary
39896
+ * Updates dropped asset details.
39897
+ *
39898
+ * @usage
39899
+ * ```ts
39900
+ * const payload = {
39901
+ * assetScale: 1,
39902
+ * clickType: "link",
39903
+ * clickableDisplayTextDescription: "Description",
39904
+ * clickableDisplayTextHeadline: "Headline",
39905
+ * clickableLink: "https://topia.io",
39906
+ * clickableLinkTitle: "Topia",
39907
+ * flipped: false,
39908
+ * isTextTopLayer: false,
39909
+ * layer0: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
39910
+ * layer1: "https://www.shutterstock.com/image-vector/colorful-illustration-test-word-260nw-1438324490.jpg",
39911
+ * position: { x: 0, y: 0 },
39912
+ * specialType: "webImage",
39913
+ * text: "My Asset",
39914
+ * textColor: "#000000",
39915
+ * textSize: 20,
39916
+ * textWeight: "normal",
39917
+ * textWidth: 200,
39918
+ * uniqueName: "example",
39919
+ * yOrderAdjust: 0,
39920
+ * }
39921
+ * await droppedAsset.updateDroppedAsset();
39922
+ * const { assetName } = droppedAsset;
39923
+ * ```
39924
+ */
39925
+ updateDroppedAsset({ assetScale, clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, flipped, isTextTopLayer, layer0, layer1, position, specialType, text, textColor, textSize, textWeight, textWidth, uniqueName, yOrderAdjust, }) {
39926
+ return __awaiter(this, void 0, void 0, function* () {
39927
+ const params = {
39928
+ assetScale,
39929
+ clickType,
39930
+ clickableLink,
39931
+ clickableLinkTitle,
39932
+ clickableDisplayTextDescription,
39933
+ clickableDisplayTextHeadline,
39934
+ flipped,
39935
+ isTextTopLayer,
39936
+ layer0,
39937
+ layer1,
39938
+ position,
39939
+ specialType,
39940
+ text,
39941
+ textColor,
39942
+ textSize,
39943
+ textWeight,
39944
+ textWidth,
39945
+ uniqueName,
39946
+ yOrderAdjust,
39947
+ };
39948
+ const filteredParams = removeUndefined(params);
39949
+ try {
39950
+ const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}`, filteredParams, this.requestOptions);
39951
+ const droppedAssetDetails = response.data;
39952
+ Object.assign(this, droppedAssetDetails);
39953
+ }
39954
+ catch (error) {
39955
+ throw this.errorHandler({ error, params, sdkMethod: "DroppedAsset.updateDroppedAsset" });
39956
+ }
39957
+ });
39958
+ }
39867
39959
  /**
39868
39960
  * @summary
39869
39961
  * Delete dropped asset.
@@ -40425,33 +40517,6 @@ class Scene extends SDKController {
40425
40517
  }
40426
40518
  }
40427
40519
 
40428
- const getBrowserWarning = () => {
40429
- if (typeof window !== "undefined") {
40430
- console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
40431
- }
40432
- };
40433
-
40434
- /**
40435
- * Parses object, removes keys with undefined value, and returns clean object.
40436
- */
40437
- const removeUndefined = (obj) => {
40438
- Object.keys(obj).forEach((key) => {
40439
- if (obj[key] === undefined) {
40440
- delete obj[key];
40441
- }
40442
- });
40443
- return obj;
40444
- };
40445
-
40446
- /**
40447
- * Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
40448
- */
40449
- const scatterVisitors = (original, scatterBy) => {
40450
- const min = original - scatterBy;
40451
- const max = original + scatterBy;
40452
- return Math.floor(Math.random() * (max - min) + min);
40453
- };
40454
-
40455
40520
  /**
40456
40521
  * @summary
40457
40522
  * Create a single instance of Topia axios used for all calls to the public API in all classes
@@ -40953,7 +41018,7 @@ class World extends SDKController {
40953
41018
  const params = { allowNonAdmins, assetSuffix, position, sceneDropId, sceneId };
40954
41019
  try {
40955
41020
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
40956
- return result;
41021
+ return result.data;
40957
41022
  }
40958
41023
  catch (error) {
40959
41024
  throw this.errorHandler({ error, params, sdkMethod: "World.dropScene" });
@@ -41030,7 +41095,7 @@ class World extends SDKController {
41030
41095
  if (!particleId)
41031
41096
  return "No particleId found.";
41032
41097
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position, duration }, this.requestOptions);
41033
- return result;
41098
+ return result.data;
41034
41099
  }
41035
41100
  catch (error) {
41036
41101
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "World.triggerParticle" });
@@ -41904,7 +41969,7 @@ class Visitor extends User {
41904
41969
  expressionId = response.data[0].id;
41905
41970
  }
41906
41971
  const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
41907
- return result;
41972
+ return result.data;
41908
41973
  }
41909
41974
  catch (error) {
41910
41975
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.grantExpression" });
@@ -41954,7 +42019,7 @@ class Visitor extends User {
41954
42019
  if (!particleId)
41955
42020
  return "No particleId found.";
41956
42021
  const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/particles`, { particleId, position: { x: 1, y: 1 }, duration, followPlayerId: this.id }, this.requestOptions);
41957
- return result;
42022
+ return result.data;
41958
42023
  }
41959
42024
  catch (error) {
41960
42025
  throw this.errorHandler({ error, params: { id, name }, sdkMethod: "Visitor.triggerParticle" });
package/package.json CHANGED
@@ -60,5 +60,5 @@
60
60
  "yalc-push": "yarn build && yalc publish --push --dev --no-scripts"
61
61
  },
62
62
  "type": "module",
63
- "version": "0.13.00"
63
+ "version": "0.14.00"
64
64
  }