@rtsdk/topia 0.13.1 → 0.15.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 +144 -28
- package/dist/index.d.ts +91 -6
- package/dist/index.js +144 -28
- package/package.json +1 -1
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
|
|
@@ -41039,6 +41104,34 @@ class World extends SDKController {
|
|
|
41039
41104
|
}
|
|
41040
41105
|
});
|
|
41041
41106
|
}
|
|
41107
|
+
/**
|
|
41108
|
+
* @summary
|
|
41109
|
+
* Display a message via a toast to all visitors currently in a world.
|
|
41110
|
+
*
|
|
41111
|
+
* @usage
|
|
41112
|
+
* ```ts
|
|
41113
|
+
* await world.fireToast({
|
|
41114
|
+
* groupId: "custom-message",
|
|
41115
|
+
* title: "Hello World",
|
|
41116
|
+
* text: "Thank you for participating!",
|
|
41117
|
+
* });
|
|
41118
|
+
* ```
|
|
41119
|
+
*/
|
|
41120
|
+
fireToast({ groupId, title, text }) {
|
|
41121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41122
|
+
const params = {
|
|
41123
|
+
groupId,
|
|
41124
|
+
title,
|
|
41125
|
+
text,
|
|
41126
|
+
};
|
|
41127
|
+
try {
|
|
41128
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/fire-toast`, params, this.requestOptions);
|
|
41129
|
+
}
|
|
41130
|
+
catch (error) {
|
|
41131
|
+
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
41132
|
+
}
|
|
41133
|
+
});
|
|
41134
|
+
}
|
|
41042
41135
|
/**
|
|
41043
41136
|
* @summary
|
|
41044
41137
|
* Increments a specific value in the data object for a world by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -41590,6 +41683,29 @@ class User extends SDKController {
|
|
|
41590
41683
|
}
|
|
41591
41684
|
});
|
|
41592
41685
|
}
|
|
41686
|
+
/**
|
|
41687
|
+
* @summary
|
|
41688
|
+
* Get expressions
|
|
41689
|
+
*
|
|
41690
|
+
* @usage
|
|
41691
|
+
* ```ts
|
|
41692
|
+
* await user.getExpressions({ getUnlockablesOnly: true, });
|
|
41693
|
+
* ```
|
|
41694
|
+
*/
|
|
41695
|
+
getExpressions({ name, getUnlockablesOnly, }) {
|
|
41696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41697
|
+
try {
|
|
41698
|
+
let query = `?getUnlockablesOnly=${getUnlockablesOnly}`;
|
|
41699
|
+
if (name)
|
|
41700
|
+
query += `&name=${name}`;
|
|
41701
|
+
const result = yield this.topiaPublicApi().get(`/expressions?getUnlockablesOnly=${getUnlockablesOnly}`, this.requestOptions);
|
|
41702
|
+
return result.data;
|
|
41703
|
+
}
|
|
41704
|
+
catch (error) {
|
|
41705
|
+
throw this.errorHandler({ error, params: { name, getUnlockablesOnly }, sdkMethod: "User.getExpressions" });
|
|
41706
|
+
}
|
|
41707
|
+
});
|
|
41708
|
+
}
|
|
41593
41709
|
/**
|
|
41594
41710
|
* @summary
|
|
41595
41711
|
* Retrieves the data object for a user.
|
|
@@ -42473,7 +42589,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42473
42589
|
});
|
|
42474
42590
|
* ```
|
|
42475
42591
|
*/
|
|
42476
|
-
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0
|
|
42592
|
+
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
42477
42593
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42478
42594
|
let specialType = null;
|
|
42479
42595
|
if (layer0 || layer1)
|
package/dist/index.d.ts
CHANGED
|
@@ -135,6 +135,38 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
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>;
|
|
138
170
|
/**
|
|
139
171
|
* @summary
|
|
140
172
|
* Delete dropped asset.
|
|
@@ -723,6 +755,20 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
723
755
|
duration?: number;
|
|
724
756
|
position?: object;
|
|
725
757
|
}): Promise<ResponseType$1 | string>;
|
|
758
|
+
/**
|
|
759
|
+
* @summary
|
|
760
|
+
* Display a message via a toast to all visitors currently in a world.
|
|
761
|
+
*
|
|
762
|
+
* @usage
|
|
763
|
+
* ```ts
|
|
764
|
+
* await world.fireToast({
|
|
765
|
+
* groupId: "custom-message",
|
|
766
|
+
* title: "Hello World",
|
|
767
|
+
* text: "Thank you for participating!",
|
|
768
|
+
* });
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType$1>;
|
|
726
772
|
/**
|
|
727
773
|
* @summary
|
|
728
774
|
* Retrieves the data object for a world. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -1116,6 +1162,19 @@ declare class User extends SDKController implements UserInterface {
|
|
|
1116
1162
|
subject: string;
|
|
1117
1163
|
to: string;
|
|
1118
1164
|
}): Promise<object | ResponseType$1>;
|
|
1165
|
+
/**
|
|
1166
|
+
* @summary
|
|
1167
|
+
* Get expressions
|
|
1168
|
+
*
|
|
1169
|
+
* @usage
|
|
1170
|
+
* ```ts
|
|
1171
|
+
* await user.getExpressions({ getUnlockablesOnly: true, });
|
|
1172
|
+
* ```
|
|
1173
|
+
*/
|
|
1174
|
+
getExpressions({ name, getUnlockablesOnly, }: {
|
|
1175
|
+
name?: string;
|
|
1176
|
+
getUnlockablesOnly?: boolean;
|
|
1177
|
+
}): Promise<ResponseType$1>;
|
|
1119
1178
|
/**
|
|
1120
1179
|
* @summary
|
|
1121
1180
|
* Retrieves the data object for a user.
|
|
@@ -1592,6 +1651,30 @@ interface UpdateBroadcastInterface {
|
|
|
1592
1651
|
assetBroadcastAll?: boolean;
|
|
1593
1652
|
broadcasterEmail?: string;
|
|
1594
1653
|
}
|
|
1654
|
+
interface UpdateDroppedAssetInterface {
|
|
1655
|
+
assetScale?: number;
|
|
1656
|
+
clickType?: DroppedAssetClickType;
|
|
1657
|
+
clickableLink?: string;
|
|
1658
|
+
clickableLinkTitle?: string;
|
|
1659
|
+
clickableDisplayTextDescription?: string;
|
|
1660
|
+
clickableDisplayTextHeadline?: string;
|
|
1661
|
+
flipped?: boolean;
|
|
1662
|
+
isTextTopLayer?: boolean;
|
|
1663
|
+
layer0?: string;
|
|
1664
|
+
layer1?: string;
|
|
1665
|
+
position?: {
|
|
1666
|
+
x: number;
|
|
1667
|
+
y: number;
|
|
1668
|
+
};
|
|
1669
|
+
specialType?: string;
|
|
1670
|
+
text?: string | null;
|
|
1671
|
+
textColor?: string | null;
|
|
1672
|
+
textSize?: number | null;
|
|
1673
|
+
textWidth?: number | null;
|
|
1674
|
+
textWeight?: string | null;
|
|
1675
|
+
uniqueName?: string;
|
|
1676
|
+
yOrderAdjust?: number;
|
|
1677
|
+
}
|
|
1595
1678
|
interface UpdateClickTypeInterface {
|
|
1596
1679
|
clickType?: DroppedAssetClickType;
|
|
1597
1680
|
clickableLink?: string;
|
|
@@ -1650,6 +1733,12 @@ type SceneOptionalInterface = {
|
|
|
1650
1733
|
credentials?: InteractiveCredentials;
|
|
1651
1734
|
};
|
|
1652
1735
|
|
|
1736
|
+
interface FireToastInterface {
|
|
1737
|
+
groupId?: string;
|
|
1738
|
+
title: string;
|
|
1739
|
+
text?: string;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1653
1742
|
interface TopiaInterface {
|
|
1654
1743
|
apiDomain?: string;
|
|
1655
1744
|
apiKey?: string;
|
|
@@ -1720,11 +1809,6 @@ interface MoveVisitorInterface {
|
|
|
1720
1809
|
x: number;
|
|
1721
1810
|
y: number;
|
|
1722
1811
|
}
|
|
1723
|
-
interface FireToastInterface {
|
|
1724
|
-
groupId?: string;
|
|
1725
|
-
title: string;
|
|
1726
|
-
text?: string;
|
|
1727
|
-
}
|
|
1728
1812
|
interface OpenIframeInterface {
|
|
1729
1813
|
droppedAssetId: string;
|
|
1730
1814
|
link: string;
|
|
@@ -1809,6 +1893,7 @@ interface WorldInterface extends SDKInterface, WorldDetailsInterface {
|
|
|
1809
1893
|
}): Promise<object | ResponseType$1>;
|
|
1810
1894
|
replaceScene(sceneId: string): Promise<void | ResponseType$1>;
|
|
1811
1895
|
fetchDataObject(): Promise<void | ResponseType$1>;
|
|
1896
|
+
fireToast({ groupId, title, text }: FireToastInterface): Promise<void | ResponseType$1>;
|
|
1812
1897
|
setDataObject(dataObject: object | null | undefined, options: object): Promise<void | ResponseType$1>;
|
|
1813
1898
|
updateDataObject(dataObject: object, options: object): Promise<void | ResponseType$1>;
|
|
1814
1899
|
incrementDataObjectValue(path: string, amount: number, options: object): Promise<void | ResponseType$1>;
|
|
@@ -2376,4 +2461,4 @@ declare class WorldFactory extends SDKController {
|
|
|
2376
2461
|
}>;
|
|
2377
2462
|
}
|
|
2378
2463
|
|
|
2379
|
-
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 };
|
|
2464
|
+
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
|
|
@@ -41037,6 +41102,34 @@ class World extends SDKController {
|
|
|
41037
41102
|
}
|
|
41038
41103
|
});
|
|
41039
41104
|
}
|
|
41105
|
+
/**
|
|
41106
|
+
* @summary
|
|
41107
|
+
* Display a message via a toast to all visitors currently in a world.
|
|
41108
|
+
*
|
|
41109
|
+
* @usage
|
|
41110
|
+
* ```ts
|
|
41111
|
+
* await world.fireToast({
|
|
41112
|
+
* groupId: "custom-message",
|
|
41113
|
+
* title: "Hello World",
|
|
41114
|
+
* text: "Thank you for participating!",
|
|
41115
|
+
* });
|
|
41116
|
+
* ```
|
|
41117
|
+
*/
|
|
41118
|
+
fireToast({ groupId, title, text }) {
|
|
41119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41120
|
+
const params = {
|
|
41121
|
+
groupId,
|
|
41122
|
+
title,
|
|
41123
|
+
text,
|
|
41124
|
+
};
|
|
41125
|
+
try {
|
|
41126
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/fire-toast`, params, this.requestOptions);
|
|
41127
|
+
}
|
|
41128
|
+
catch (error) {
|
|
41129
|
+
throw this.errorHandler({ error, params, sdkMethod: "Visitor.fireToast" });
|
|
41130
|
+
}
|
|
41131
|
+
});
|
|
41132
|
+
}
|
|
41040
41133
|
/**
|
|
41041
41134
|
* @summary
|
|
41042
41135
|
* Increments a specific value in the data object for a world by the amount specified. Must have valid interactive credentials from a visitor in the world.
|
|
@@ -41588,6 +41681,29 @@ class User extends SDKController {
|
|
|
41588
41681
|
}
|
|
41589
41682
|
});
|
|
41590
41683
|
}
|
|
41684
|
+
/**
|
|
41685
|
+
* @summary
|
|
41686
|
+
* Get expressions
|
|
41687
|
+
*
|
|
41688
|
+
* @usage
|
|
41689
|
+
* ```ts
|
|
41690
|
+
* await user.getExpressions({ getUnlockablesOnly: true, });
|
|
41691
|
+
* ```
|
|
41692
|
+
*/
|
|
41693
|
+
getExpressions({ name, getUnlockablesOnly, }) {
|
|
41694
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41695
|
+
try {
|
|
41696
|
+
let query = `?getUnlockablesOnly=${getUnlockablesOnly}`;
|
|
41697
|
+
if (name)
|
|
41698
|
+
query += `&name=${name}`;
|
|
41699
|
+
const result = yield this.topiaPublicApi().get(`/expressions?getUnlockablesOnly=${getUnlockablesOnly}`, this.requestOptions);
|
|
41700
|
+
return result.data;
|
|
41701
|
+
}
|
|
41702
|
+
catch (error) {
|
|
41703
|
+
throw this.errorHandler({ error, params: { name, getUnlockablesOnly }, sdkMethod: "User.getExpressions" });
|
|
41704
|
+
}
|
|
41705
|
+
});
|
|
41706
|
+
}
|
|
41591
41707
|
/**
|
|
41592
41708
|
* @summary
|
|
41593
41709
|
* Retrieves the data object for a user.
|
|
@@ -42471,7 +42587,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
42471
42587
|
});
|
|
42472
42588
|
* ```
|
|
42473
42589
|
*/
|
|
42474
|
-
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0
|
|
42590
|
+
drop(asset, { assetScale = 1, clickType, clickableDisplayTextDescription, clickableDisplayTextHeadline, clickableLink, clickableLinkTitle, flipped, interactivePublicKey, isInteractive, isForceLinkInIframe, isOpenLinkInDrawer, isTextTopLayer = false, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
42475
42591
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42476
42592
|
let specialType = null;
|
|
42477
42593
|
if (layer0 || layer1)
|
package/package.json
CHANGED