@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 +4 -4
- package/dist/index.cjs +205 -85
- package/dist/index.d.ts +53 -1
- package/dist/index.js +205 -85
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39664,7 +39664,7 @@ class SDKController {
|
|
|
39664
39664
|
topiaPublicApi() {
|
|
39665
39665
|
return this.topia.axios;
|
|
39666
39666
|
}
|
|
39667
|
-
errorHandler({ error, message = "Something went wrong. Please try again or contact support.", }) {
|
|
39667
|
+
errorHandler({ error, message = "Something went wrong. Please try again or contact support.", params, }) {
|
|
39668
39668
|
var _a, _b;
|
|
39669
39669
|
const stackTrace = new Error("Thrown here:");
|
|
39670
39670
|
let data = {}, errorMessage = message, method = "unknown", stack = "empty", status = 500, url = "unknown";
|
|
@@ -39690,6 +39690,7 @@ class SDKController {
|
|
|
39690
39690
|
data,
|
|
39691
39691
|
message: errorMessage,
|
|
39692
39692
|
method,
|
|
39693
|
+
params,
|
|
39693
39694
|
stack,
|
|
39694
39695
|
stackTrace,
|
|
39695
39696
|
status,
|
|
@@ -39740,14 +39741,14 @@ var _DroppedAsset_updateDroppedAsset;
|
|
|
39740
39741
|
class DroppedAsset extends Asset {
|
|
39741
39742
|
constructor(topia, id, urlSlug, options = { attributes: { text: "" }, credentials: {} }) {
|
|
39742
39743
|
var _a;
|
|
39743
|
-
super(topia, id, options);
|
|
39744
|
+
super(topia, id, { attributes: options.attributes, credentials: Object.assign(Object.assign({}, options.credentials), { urlSlug }) });
|
|
39744
39745
|
// private methods
|
|
39745
39746
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39746
39747
|
try {
|
|
39747
39748
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/${updateType}`, Object.assign({}, payload), this.requestOptions);
|
|
39748
39749
|
}
|
|
39749
39750
|
catch (error) {
|
|
39750
|
-
throw this.errorHandler({ error });
|
|
39751
|
+
throw this.errorHandler({ error, params: { payload, updateType } });
|
|
39751
39752
|
}
|
|
39752
39753
|
}));
|
|
39753
39754
|
Object.assign(this, options.attributes);
|
|
@@ -39839,7 +39840,7 @@ class DroppedAsset extends Asset {
|
|
|
39839
39840
|
this.dataObject = dataObject || this.dataObject;
|
|
39840
39841
|
}
|
|
39841
39842
|
catch (error) {
|
|
39842
|
-
throw this.errorHandler({ error });
|
|
39843
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
39843
39844
|
}
|
|
39844
39845
|
});
|
|
39845
39846
|
}
|
|
@@ -39865,7 +39866,7 @@ class DroppedAsset extends Asset {
|
|
|
39865
39866
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
39866
39867
|
}
|
|
39867
39868
|
catch (error) {
|
|
39868
|
-
throw this.errorHandler({ error });
|
|
39869
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
39869
39870
|
}
|
|
39870
39871
|
});
|
|
39871
39872
|
}
|
|
@@ -39890,7 +39891,7 @@ class DroppedAsset extends Asset {
|
|
|
39890
39891
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
|
|
39891
39892
|
}
|
|
39892
39893
|
catch (error) {
|
|
39893
|
-
throw this.errorHandler({ error });
|
|
39894
|
+
throw this.errorHandler({ error, params: { path, amount, options } });
|
|
39894
39895
|
}
|
|
39895
39896
|
});
|
|
39896
39897
|
}
|
|
@@ -39909,11 +39910,12 @@ class DroppedAsset extends Asset {
|
|
|
39909
39910
|
* ```
|
|
39910
39911
|
*/
|
|
39911
39912
|
updateBroadcast({ assetBroadcast, assetBroadcastAll, broadcasterEmail, }) {
|
|
39913
|
+
const params = { assetBroadcast, assetBroadcastAll, broadcasterEmail };
|
|
39912
39914
|
try {
|
|
39913
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
39915
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-asset-broadcast");
|
|
39914
39916
|
}
|
|
39915
39917
|
catch (error) {
|
|
39916
|
-
throw this.errorHandler({ error });
|
|
39918
|
+
throw this.errorHandler({ error, params });
|
|
39917
39919
|
}
|
|
39918
39920
|
}
|
|
39919
39921
|
/**
|
|
@@ -39937,21 +39939,22 @@ class DroppedAsset extends Asset {
|
|
|
39937
39939
|
* ```
|
|
39938
39940
|
*/
|
|
39939
39941
|
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
39942
|
+
const params = {
|
|
39943
|
+
clickType,
|
|
39944
|
+
clickableLink,
|
|
39945
|
+
clickableLinkTitle,
|
|
39946
|
+
clickableDisplayTextDescription,
|
|
39947
|
+
clickableDisplayTextHeadline,
|
|
39948
|
+
isForceLinkInIframe,
|
|
39949
|
+
isOpenLinkInDrawer,
|
|
39950
|
+
portalName,
|
|
39951
|
+
position,
|
|
39952
|
+
};
|
|
39940
39953
|
try {
|
|
39941
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
39942
|
-
clickType,
|
|
39943
|
-
clickableLink,
|
|
39944
|
-
clickableLinkTitle,
|
|
39945
|
-
clickableDisplayTextDescription,
|
|
39946
|
-
clickableDisplayTextHeadline,
|
|
39947
|
-
isForceLinkInIframe,
|
|
39948
|
-
isOpenLinkInDrawer,
|
|
39949
|
-
portalName,
|
|
39950
|
-
position,
|
|
39951
|
-
}, "change-click-type");
|
|
39954
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "change-click-type");
|
|
39952
39955
|
}
|
|
39953
39956
|
catch (error) {
|
|
39954
|
-
throw this.errorHandler({ error });
|
|
39957
|
+
throw this.errorHandler({ error, params });
|
|
39955
39958
|
}
|
|
39956
39959
|
}
|
|
39957
39960
|
/**
|
|
@@ -39971,11 +39974,12 @@ class DroppedAsset extends Asset {
|
|
|
39971
39974
|
* ```
|
|
39972
39975
|
*/
|
|
39973
39976
|
updateCustomTextAsset(style, text) {
|
|
39977
|
+
const params = { style, text };
|
|
39974
39978
|
try {
|
|
39975
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
39979
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-custom-text");
|
|
39976
39980
|
}
|
|
39977
39981
|
catch (error) {
|
|
39978
|
-
throw this.errorHandler({ error });
|
|
39982
|
+
throw this.errorHandler({ error, params });
|
|
39979
39983
|
}
|
|
39980
39984
|
}
|
|
39981
39985
|
/**
|
|
@@ -39997,11 +40001,21 @@ class DroppedAsset extends Asset {
|
|
|
39997
40001
|
* ```
|
|
39998
40002
|
*/
|
|
39999
40003
|
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }) {
|
|
40004
|
+
const params = {
|
|
40005
|
+
audioRadius,
|
|
40006
|
+
audioSliderVolume,
|
|
40007
|
+
isVideo,
|
|
40008
|
+
mediaLink,
|
|
40009
|
+
mediaName,
|
|
40010
|
+
mediaType,
|
|
40011
|
+
portalName,
|
|
40012
|
+
syncUserMedia,
|
|
40013
|
+
};
|
|
40000
40014
|
try {
|
|
40001
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
40015
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "change-media-type");
|
|
40002
40016
|
}
|
|
40003
40017
|
catch (error) {
|
|
40004
|
-
throw this.errorHandler({ error });
|
|
40018
|
+
throw this.errorHandler({ error, params });
|
|
40005
40019
|
}
|
|
40006
40020
|
}
|
|
40007
40021
|
/**
|
|
@@ -40018,7 +40032,7 @@ class DroppedAsset extends Asset {
|
|
|
40018
40032
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { isMutezone }, "set-mute-zone");
|
|
40019
40033
|
}
|
|
40020
40034
|
catch (error) {
|
|
40021
|
-
throw this.errorHandler({ error });
|
|
40035
|
+
throw this.errorHandler({ error, params: { isMutezone } });
|
|
40022
40036
|
}
|
|
40023
40037
|
}
|
|
40024
40038
|
/**
|
|
@@ -40035,7 +40049,7 @@ class DroppedAsset extends Asset {
|
|
|
40035
40049
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { isWebhookZoneEnabled }, "set-webhook-zone");
|
|
40036
40050
|
}
|
|
40037
40051
|
catch (error) {
|
|
40038
|
-
throw this.errorHandler({ error });
|
|
40052
|
+
throw this.errorHandler({ error, params: { isWebhookZoneEnabled } });
|
|
40039
40053
|
}
|
|
40040
40054
|
}
|
|
40041
40055
|
/**
|
|
@@ -40048,11 +40062,12 @@ class DroppedAsset extends Asset {
|
|
|
40048
40062
|
* ```
|
|
40049
40063
|
*/
|
|
40050
40064
|
updatePosition(x, y, yOrderAdjust) {
|
|
40065
|
+
const params = { x, y, yOrderAdjust };
|
|
40051
40066
|
try {
|
|
40052
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
40067
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-position");
|
|
40053
40068
|
}
|
|
40054
40069
|
catch (error) {
|
|
40055
|
-
throw this.errorHandler({ error });
|
|
40070
|
+
throw this.errorHandler({ error, params });
|
|
40056
40071
|
}
|
|
40057
40072
|
}
|
|
40058
40073
|
/**
|
|
@@ -40069,11 +40084,12 @@ class DroppedAsset extends Asset {
|
|
|
40069
40084
|
* ```
|
|
40070
40085
|
*/
|
|
40071
40086
|
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }) {
|
|
40087
|
+
const params = { isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap };
|
|
40072
40088
|
try {
|
|
40073
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
40089
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-private-zone");
|
|
40074
40090
|
}
|
|
40075
40091
|
catch (error) {
|
|
40076
|
-
throw this.errorHandler({ error });
|
|
40092
|
+
throw this.errorHandler({ error, params });
|
|
40077
40093
|
}
|
|
40078
40094
|
}
|
|
40079
40095
|
/**
|
|
@@ -40090,7 +40106,7 @@ class DroppedAsset extends Asset {
|
|
|
40090
40106
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { assetScale }, "change-scale");
|
|
40091
40107
|
}
|
|
40092
40108
|
catch (error) {
|
|
40093
|
-
throw this.errorHandler({ error });
|
|
40109
|
+
throw this.errorHandler({ error, params: { assetScale } });
|
|
40094
40110
|
}
|
|
40095
40111
|
}
|
|
40096
40112
|
/**
|
|
@@ -40107,7 +40123,7 @@ class DroppedAsset extends Asset {
|
|
|
40107
40123
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { mediaId }, "change-uploaded-media-selected");
|
|
40108
40124
|
}
|
|
40109
40125
|
catch (error) {
|
|
40110
|
-
throw this.errorHandler({ error });
|
|
40126
|
+
throw this.errorHandler({ error, params: { mediaId } });
|
|
40111
40127
|
}
|
|
40112
40128
|
}
|
|
40113
40129
|
/**
|
|
@@ -40120,11 +40136,12 @@ class DroppedAsset extends Asset {
|
|
|
40120
40136
|
* ```
|
|
40121
40137
|
*/
|
|
40122
40138
|
updateWebImageLayers(bottom, top) {
|
|
40139
|
+
const params = { bottom, top };
|
|
40123
40140
|
try {
|
|
40124
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this,
|
|
40141
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, params, "set-webimage-layers");
|
|
40125
40142
|
}
|
|
40126
40143
|
catch (error) {
|
|
40127
|
-
throw this.errorHandler({ error });
|
|
40144
|
+
throw this.errorHandler({ error, params });
|
|
40128
40145
|
}
|
|
40129
40146
|
}
|
|
40130
40147
|
/**
|
|
@@ -40148,23 +40165,13 @@ class DroppedAsset extends Asset {
|
|
|
40148
40165
|
*/
|
|
40149
40166
|
addWebhook({ dataObject, description, isUniqueOnly, title, type, url, }) {
|
|
40150
40167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40168
|
+
const params = { dataObject, description, isUniqueOnly, title, type, url };
|
|
40151
40169
|
try {
|
|
40152
|
-
const response = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/webhooks`, {
|
|
40153
|
-
active: true,
|
|
40154
|
-
assetId: this.id,
|
|
40155
|
-
dataObject,
|
|
40156
|
-
description,
|
|
40157
|
-
enteredBy: "",
|
|
40158
|
-
isUniqueOnly,
|
|
40159
|
-
title,
|
|
40160
|
-
type,
|
|
40161
|
-
url,
|
|
40162
|
-
urlSlug: this.urlSlug,
|
|
40163
|
-
}, this.requestOptions);
|
|
40170
|
+
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);
|
|
40164
40171
|
return response.data.webhookId;
|
|
40165
40172
|
}
|
|
40166
40173
|
catch (error) {
|
|
40167
|
-
throw this.errorHandler({ error });
|
|
40174
|
+
throw this.errorHandler({ error, params });
|
|
40168
40175
|
}
|
|
40169
40176
|
});
|
|
40170
40177
|
}
|
|
@@ -40182,16 +40189,51 @@ class DroppedAsset extends Asset {
|
|
|
40182
40189
|
*/
|
|
40183
40190
|
setInteractiveSettings({ isInteractive = false, interactivePublicKey = "", }) {
|
|
40184
40191
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40192
|
+
const params = {
|
|
40193
|
+
interactivePublicKey,
|
|
40194
|
+
isInteractive,
|
|
40195
|
+
};
|
|
40185
40196
|
try {
|
|
40186
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-asset-interactive-settings`,
|
|
40187
|
-
interactivePublicKey,
|
|
40188
|
-
isInteractive,
|
|
40189
|
-
}, this.requestOptions);
|
|
40197
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-asset-interactive-settings`, params, this.requestOptions);
|
|
40190
40198
|
this.isInteractive = isInteractive;
|
|
40191
40199
|
this.interactivePublicKey = interactivePublicKey;
|
|
40192
40200
|
}
|
|
40193
40201
|
catch (error) {
|
|
40194
|
-
throw this.errorHandler({ error });
|
|
40202
|
+
throw this.errorHandler({ error, params });
|
|
40203
|
+
}
|
|
40204
|
+
});
|
|
40205
|
+
}
|
|
40206
|
+
////////// analytics
|
|
40207
|
+
/**
|
|
40208
|
+
* @summary
|
|
40209
|
+
* Retrieve analytics for a dropped asset by day, week, month, quarter, or year
|
|
40210
|
+
*
|
|
40211
|
+
* @usage
|
|
40212
|
+
* ```ts
|
|
40213
|
+
* const analytics = await droppedAsset.fetchDroppedAssetAnalytics({
|
|
40214
|
+
* periodType: "quarter",
|
|
40215
|
+
* dateValue: 3,
|
|
40216
|
+
* year: 2023,
|
|
40217
|
+
* });
|
|
40218
|
+
* ```
|
|
40219
|
+
*/
|
|
40220
|
+
fetchDroppedAssetAnalytics({ periodType, dateValue, year, }) {
|
|
40221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40222
|
+
try {
|
|
40223
|
+
let query = "";
|
|
40224
|
+
switch (periodType) {
|
|
40225
|
+
case "week":
|
|
40226
|
+
query = `&week=W${dateValue}`;
|
|
40227
|
+
case "month":
|
|
40228
|
+
query = `&month=${dateValue}`;
|
|
40229
|
+
case "quarter":
|
|
40230
|
+
query = `&quarter=Q${dateValue}`;
|
|
40231
|
+
}
|
|
40232
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/dropped-asset-analytics/${this.id}?year=${year}${query}`, this.requestOptions);
|
|
40233
|
+
return response.data;
|
|
40234
|
+
}
|
|
40235
|
+
catch (error) {
|
|
40236
|
+
throw this.errorHandler({ error, params: { periodType, dateValue, year } });
|
|
40195
40237
|
}
|
|
40196
40238
|
});
|
|
40197
40239
|
}
|
|
@@ -40309,7 +40351,7 @@ class World extends SDKController {
|
|
|
40309
40351
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
40310
40352
|
}
|
|
40311
40353
|
catch (error) {
|
|
40312
|
-
throw this.errorHandler({ error });
|
|
40354
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
40313
40355
|
}
|
|
40314
40356
|
});
|
|
40315
40357
|
/**
|
|
@@ -40333,7 +40375,7 @@ class World extends SDKController {
|
|
|
40333
40375
|
this.dataObject = dataObject || this.dataObject;
|
|
40334
40376
|
}
|
|
40335
40377
|
catch (error) {
|
|
40336
|
-
throw this.errorHandler({ error });
|
|
40378
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
40337
40379
|
}
|
|
40338
40380
|
});
|
|
40339
40381
|
Object.assign(this, options.attributes);
|
|
@@ -40389,7 +40431,7 @@ class World extends SDKController {
|
|
|
40389
40431
|
*/
|
|
40390
40432
|
updateDetails({ controls, description, forceAuthOnLogin, height, name, spawnPosition, width, }) {
|
|
40391
40433
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40392
|
-
const
|
|
40434
|
+
const params = {
|
|
40393
40435
|
controls,
|
|
40394
40436
|
description,
|
|
40395
40437
|
forceAuthOnLogin,
|
|
@@ -40399,12 +40441,12 @@ class World extends SDKController {
|
|
|
40399
40441
|
width,
|
|
40400
40442
|
};
|
|
40401
40443
|
try {
|
|
40402
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/world-details`,
|
|
40403
|
-
const cleanPayload = removeUndefined(
|
|
40444
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/world-details`, params, this.requestOptions);
|
|
40445
|
+
const cleanPayload = removeUndefined(params);
|
|
40404
40446
|
Object.assign(this, cleanPayload);
|
|
40405
40447
|
}
|
|
40406
40448
|
catch (error) {
|
|
40407
|
-
throw this.errorHandler({ error });
|
|
40449
|
+
throw this.errorHandler({ error, params });
|
|
40408
40450
|
}
|
|
40409
40451
|
});
|
|
40410
40452
|
}
|
|
@@ -40463,7 +40505,7 @@ class World extends SDKController {
|
|
|
40463
40505
|
return droppedAssets;
|
|
40464
40506
|
}
|
|
40465
40507
|
catch (error) {
|
|
40466
|
-
throw this.errorHandler({ error });
|
|
40508
|
+
throw this.errorHandler({ error, params: { uniqueName, isPartial, isReversed } });
|
|
40467
40509
|
}
|
|
40468
40510
|
});
|
|
40469
40511
|
}
|
|
@@ -40497,7 +40539,7 @@ class World extends SDKController {
|
|
|
40497
40539
|
return droppedAssets;
|
|
40498
40540
|
}
|
|
40499
40541
|
catch (error) {
|
|
40500
|
-
throw this.errorHandler({ error });
|
|
40542
|
+
throw this.errorHandler({ error, params: { sceneDropId, uniqueName } });
|
|
40501
40543
|
}
|
|
40502
40544
|
});
|
|
40503
40545
|
}
|
|
@@ -40622,12 +40664,13 @@ class World extends SDKController {
|
|
|
40622
40664
|
*/
|
|
40623
40665
|
dropScene({ assetSuffix, position, sceneId, }) {
|
|
40624
40666
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40667
|
+
const params = { assetSuffix, position, sceneId };
|
|
40625
40668
|
try {
|
|
40626
|
-
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`,
|
|
40669
|
+
const result = yield this.topiaPublicApi().post(`/world/${this.urlSlug}/drop-scene`, params, this.requestOptions);
|
|
40627
40670
|
return result;
|
|
40628
40671
|
}
|
|
40629
40672
|
catch (error) {
|
|
40630
|
-
throw this.errorHandler({ error });
|
|
40673
|
+
throw this.errorHandler({ error, params });
|
|
40631
40674
|
}
|
|
40632
40675
|
});
|
|
40633
40676
|
}
|
|
@@ -40654,7 +40697,7 @@ class World extends SDKController {
|
|
|
40654
40697
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/change-scene`, { sceneId }, this.requestOptions);
|
|
40655
40698
|
}
|
|
40656
40699
|
catch (error) {
|
|
40657
|
-
throw this.errorHandler({ error });
|
|
40700
|
+
throw this.errorHandler({ error, params: { sceneId } });
|
|
40658
40701
|
}
|
|
40659
40702
|
});
|
|
40660
40703
|
}
|
|
@@ -40679,7 +40722,7 @@ class World extends SDKController {
|
|
|
40679
40722
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
|
|
40680
40723
|
}
|
|
40681
40724
|
catch (error) {
|
|
40682
|
-
throw this.errorHandler({ error });
|
|
40725
|
+
throw this.errorHandler({ error, params: { path, amount, options } });
|
|
40683
40726
|
}
|
|
40684
40727
|
});
|
|
40685
40728
|
}
|
|
@@ -40705,6 +40748,40 @@ class World extends SDKController {
|
|
|
40705
40748
|
}
|
|
40706
40749
|
});
|
|
40707
40750
|
}
|
|
40751
|
+
////////// analytics
|
|
40752
|
+
/**
|
|
40753
|
+
* @summary
|
|
40754
|
+
* Retrieve world analytics by day, week, month, quarter, or year
|
|
40755
|
+
*
|
|
40756
|
+
* @usage
|
|
40757
|
+
* ```ts
|
|
40758
|
+
* const analytics = await world.fetchWorldAnalytics({
|
|
40759
|
+
* periodType: "week",
|
|
40760
|
+
* dateValue: 40,
|
|
40761
|
+
* year: 2023,
|
|
40762
|
+
* });
|
|
40763
|
+
* ```
|
|
40764
|
+
*/
|
|
40765
|
+
fetchWorldAnalytics({ periodType, dateValue, year, }) {
|
|
40766
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40767
|
+
try {
|
|
40768
|
+
let query = "";
|
|
40769
|
+
switch (periodType) {
|
|
40770
|
+
case "week":
|
|
40771
|
+
query = `&week=W${dateValue}`;
|
|
40772
|
+
case "month":
|
|
40773
|
+
query = `&month=${dateValue}`;
|
|
40774
|
+
case "quarter":
|
|
40775
|
+
query = `&quarter=Q${dateValue}`;
|
|
40776
|
+
}
|
|
40777
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/world-analytics?year=${year}${query}`, this.requestOptions);
|
|
40778
|
+
return response.data;
|
|
40779
|
+
}
|
|
40780
|
+
catch (error) {
|
|
40781
|
+
throw this.errorHandler({ error, params: { periodType, dateValue, year } });
|
|
40782
|
+
}
|
|
40783
|
+
});
|
|
40784
|
+
}
|
|
40708
40785
|
}
|
|
40709
40786
|
_World_droppedAssetsMap = new WeakMap();
|
|
40710
40787
|
|
|
@@ -40924,7 +41001,7 @@ class User extends SDKController {
|
|
|
40924
41001
|
this.dataObject = dataObject || this.dataObject;
|
|
40925
41002
|
}
|
|
40926
41003
|
catch (error) {
|
|
40927
|
-
throw this.errorHandler({ error });
|
|
41004
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
40928
41005
|
}
|
|
40929
41006
|
});
|
|
40930
41007
|
}
|
|
@@ -40951,7 +41028,7 @@ class User extends SDKController {
|
|
|
40951
41028
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
40952
41029
|
}
|
|
40953
41030
|
catch (error) {
|
|
40954
|
-
throw this.errorHandler({ error });
|
|
41031
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
40955
41032
|
}
|
|
40956
41033
|
});
|
|
40957
41034
|
}
|
|
@@ -40976,7 +41053,7 @@ class User extends SDKController {
|
|
|
40976
41053
|
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
|
|
40977
41054
|
}
|
|
40978
41055
|
catch (error) {
|
|
40979
|
-
throw this.errorHandler({ error });
|
|
41056
|
+
throw this.errorHandler({ error, params: { path, amount, options } });
|
|
40980
41057
|
}
|
|
40981
41058
|
});
|
|
40982
41059
|
}
|
|
@@ -40994,7 +41071,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
|
|
|
40994
41071
|
*/
|
|
40995
41072
|
class Visitor extends User {
|
|
40996
41073
|
constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40997
|
-
super(topia, { credentials: options.credentials });
|
|
41074
|
+
super(topia, { credentials: Object.assign(Object.assign({}, options.credentials), { urlSlug }) });
|
|
40998
41075
|
Object.assign(this, options.attributes);
|
|
40999
41076
|
this.id = id;
|
|
41000
41077
|
this.urlSlug = urlSlug;
|
|
@@ -41061,7 +41138,7 @@ class Visitor extends User {
|
|
|
41061
41138
|
}, this.requestOptions);
|
|
41062
41139
|
}
|
|
41063
41140
|
catch (error) {
|
|
41064
|
-
throw this.errorHandler({ error });
|
|
41141
|
+
throw this.errorHandler({ error, params: { shouldTeleportVisitor, x, y } });
|
|
41065
41142
|
}
|
|
41066
41143
|
});
|
|
41067
41144
|
}
|
|
@@ -41080,15 +41157,16 @@ class Visitor extends User {
|
|
|
41080
41157
|
*/
|
|
41081
41158
|
fireToast({ groupId, title, text }) {
|
|
41082
41159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41160
|
+
const params = {
|
|
41161
|
+
groupId,
|
|
41162
|
+
title,
|
|
41163
|
+
text,
|
|
41164
|
+
};
|
|
41083
41165
|
try {
|
|
41084
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`,
|
|
41085
|
-
groupId,
|
|
41086
|
-
title,
|
|
41087
|
-
text,
|
|
41088
|
-
}, this.requestOptions);
|
|
41166
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, params, this.requestOptions);
|
|
41089
41167
|
}
|
|
41090
41168
|
catch (error) {
|
|
41091
|
-
throw this.errorHandler({ error });
|
|
41169
|
+
throw this.errorHandler({ error, params });
|
|
41092
41170
|
}
|
|
41093
41171
|
});
|
|
41094
41172
|
}
|
|
@@ -41107,15 +41185,16 @@ class Visitor extends User {
|
|
|
41107
41185
|
*/
|
|
41108
41186
|
openIframe({ link, shouldOpenInDrawer, title }) {
|
|
41109
41187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41188
|
+
const params = {
|
|
41189
|
+
link,
|
|
41190
|
+
shouldOpenInDrawer,
|
|
41191
|
+
title,
|
|
41192
|
+
};
|
|
41110
41193
|
try {
|
|
41111
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`,
|
|
41112
|
-
link,
|
|
41113
|
-
shouldOpenInDrawer,
|
|
41114
|
-
title,
|
|
41115
|
-
}, this.requestOptions);
|
|
41194
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, params, this.requestOptions);
|
|
41116
41195
|
}
|
|
41117
41196
|
catch (error) {
|
|
41118
|
-
throw this.errorHandler({ error });
|
|
41197
|
+
throw this.errorHandler({ error, params });
|
|
41119
41198
|
}
|
|
41120
41199
|
});
|
|
41121
41200
|
}
|
|
@@ -41138,6 +41217,32 @@ class Visitor extends User {
|
|
|
41138
41217
|
}
|
|
41139
41218
|
});
|
|
41140
41219
|
}
|
|
41220
|
+
/**
|
|
41221
|
+
* @summary
|
|
41222
|
+
* Grant expression to a visitor by id or name.
|
|
41223
|
+
*
|
|
41224
|
+
* @usage
|
|
41225
|
+
* ```ts
|
|
41226
|
+
* await visitor.grantExpression({ name: "Eyes" });
|
|
41227
|
+
* ```
|
|
41228
|
+
*/
|
|
41229
|
+
grantExpression({ id, name }) {
|
|
41230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41231
|
+
if (!id && !name)
|
|
41232
|
+
throw "An expression id or name is required.";
|
|
41233
|
+
try {
|
|
41234
|
+
let expressionId = id;
|
|
41235
|
+
if (name) {
|
|
41236
|
+
expressionId = yield this.topiaPublicApi().get(`/expressions?name=${name}`, this.requestOptions);
|
|
41237
|
+
}
|
|
41238
|
+
const result = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/grant-expression/${expressionId}`, {}, this.requestOptions);
|
|
41239
|
+
return result;
|
|
41240
|
+
}
|
|
41241
|
+
catch (error) {
|
|
41242
|
+
throw this.errorHandler({ error, params: { id, name } });
|
|
41243
|
+
}
|
|
41244
|
+
});
|
|
41245
|
+
}
|
|
41141
41246
|
/**
|
|
41142
41247
|
* @summary
|
|
41143
41248
|
* Retrieves the data object for a visitor.
|
|
@@ -41180,7 +41285,7 @@ class Visitor extends User {
|
|
|
41180
41285
|
this.dataObject = Object.assign(Object.assign({}, (this.dataObject || {})), (dataObject || {}));
|
|
41181
41286
|
}
|
|
41182
41287
|
catch (error) {
|
|
41183
|
-
throw this.errorHandler({ error });
|
|
41288
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
41184
41289
|
}
|
|
41185
41290
|
});
|
|
41186
41291
|
}
|
|
@@ -41205,7 +41310,7 @@ class Visitor extends User {
|
|
|
41205
41310
|
this.dataObject = dataObject || this.dataObject;
|
|
41206
41311
|
}
|
|
41207
41312
|
catch (error) {
|
|
41208
|
-
throw this.errorHandler({ error });
|
|
41313
|
+
throw this.errorHandler({ error, params: { dataObject, options } });
|
|
41209
41314
|
}
|
|
41210
41315
|
});
|
|
41211
41316
|
}
|
|
@@ -41230,7 +41335,7 @@ class Visitor extends User {
|
|
|
41230
41335
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/increment-data-object-value`, { path, amount, lock }, this.requestOptions);
|
|
41231
41336
|
}
|
|
41232
41337
|
catch (error) {
|
|
41233
|
-
throw this.errorHandler({ error });
|
|
41338
|
+
throw this.errorHandler({ error, params: { path, amount, options } });
|
|
41234
41339
|
}
|
|
41235
41340
|
});
|
|
41236
41341
|
}
|
|
@@ -41433,8 +41538,23 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41433
41538
|
return droppedAsset;
|
|
41434
41539
|
});
|
|
41435
41540
|
}
|
|
41541
|
+
getWithUniqueName(uniqueName, urlSlug, interactivePublicKey, interactiveSecret) {
|
|
41542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41543
|
+
const params = { uniqueName, urlSlug, interactivePublicKey, interactiveSecret };
|
|
41544
|
+
const interactiveJWT = jwt.sign(interactivePublicKey, interactiveSecret);
|
|
41545
|
+
try {
|
|
41546
|
+
const response = yield this.topiaPublicApi().get(`/world/${urlSlug}/asset-by-unique-name/${uniqueName}`, { headers: { interactiveJWT, publickey: interactivePublicKey } });
|
|
41547
|
+
const { id } = response.data;
|
|
41548
|
+
return new DroppedAsset(this.topia, id, urlSlug, { attributes: response.data });
|
|
41549
|
+
}
|
|
41550
|
+
catch (error) {
|
|
41551
|
+
throw this.errorHandler({ error, params });
|
|
41552
|
+
}
|
|
41553
|
+
});
|
|
41554
|
+
}
|
|
41436
41555
|
drop(asset, { interactivePublicKey, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41437
41556
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41557
|
+
const params = { interactivePublicKey, sceneDropId, uniqueName, urlSlug, yOrderAdjust };
|
|
41438
41558
|
try {
|
|
41439
41559
|
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41440
41560
|
assetId: asset.id,
|
|
@@ -41448,7 +41568,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41448
41568
|
return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
|
|
41449
41569
|
}
|
|
41450
41570
|
catch (error) {
|
|
41451
|
-
throw this.errorHandler({ error });
|
|
41571
|
+
throw this.errorHandler({ error, params });
|
|
41452
41572
|
}
|
|
41453
41573
|
});
|
|
41454
41574
|
}
|
package/package.json
CHANGED