@rtsdk/topia 0.1.0 → 0.2.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 +168 -25
- package/dist/index.js +169 -26
- package/dist/types/example.d.ts +6 -0
- package/dist/types/src/__mocks__/assets.d.ts +99 -0
- package/dist/{src/__mocks__/index.js → types/src/__mocks__/index.d.ts} +4 -4
- package/dist/types/src/__mocks__/scenes.d.ts +79 -0
- package/dist/types/src/__mocks__/visitors.d.ts +83 -0
- package/dist/types/src/__mocks__/worlds.d.ts +73 -0
- package/dist/types/src/controllers/Asset.d.ts +20 -0
- package/dist/types/src/controllers/DroppedAsset.d.ts +285 -0
- package/dist/types/src/controllers/SDKController.d.ts +48 -0
- package/dist/types/src/controllers/Scene.d.ts +19 -0
- package/dist/types/src/controllers/Topia.d.ts +33 -0
- package/dist/types/src/controllers/User.d.ts +112 -0
- package/dist/types/src/controllers/Visitor.d.ts +101 -0
- package/dist/types/src/controllers/World.d.ts +143 -0
- package/dist/types/src/controllers/WorldActivity.d.ts +83 -0
- package/dist/{src/interfaces/AssetInterfaces.js → types/src/controllers/__tests__/asset.test.d.ts} +1 -1
- package/dist/{src/interfaces/DroppedAssetInterfaces.js → types/src/controllers/__tests__/droppedAsset.test.d.ts} +1 -1
- package/dist/{src/interfaces/SDKInterfaces.js → types/src/controllers/__tests__/scene.test.d.ts} +1 -1
- package/dist/{src/interfaces/SceneInterfaces.js → types/src/controllers/__tests__/user.test.d.ts} +1 -1
- package/dist/types/src/controllers/__tests__/visitor.test.d.ts +1 -0
- package/dist/types/src/controllers/__tests__/world.test.d.ts +1 -0
- package/dist/types/src/controllers/__tests__/worldActivity.test.d.ts +1 -0
- package/dist/{src/controllers/index.js → types/src/controllers/index.d.ts} +9 -9
- package/dist/types/src/factories/AssetFactory.d.ts +8 -0
- package/dist/types/src/factories/DroppedAssetFactory.d.ts +16 -0
- package/dist/types/src/factories/SceneFactory.d.ts +9 -0
- package/dist/types/src/factories/UserFactory.d.ts +8 -0
- package/dist/types/src/factories/VisitorFactory.d.ts +9 -0
- package/dist/types/src/factories/WorldActivityFactory.d.ts +8 -0
- package/dist/types/src/factories/WorldFactory.d.ts +8 -0
- package/dist/{src/factories/index.js → types/src/factories/index.d.ts} +7 -7
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/interfaces/AssetInterfaces.d.ts +26 -0
- package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +104 -0
- package/dist/types/src/interfaces/SDKInterfaces.d.ts +8 -0
- package/dist/types/src/interfaces/SceneInterfaces.d.ts +27 -0
- package/dist/types/src/interfaces/TopiaInterfaces.d.ts +10 -0
- package/dist/types/src/interfaces/UserInterfaces.d.ts +7 -0
- package/dist/types/src/interfaces/VisitorInterfaces.d.ts +37 -0
- package/dist/types/src/interfaces/WorldActivityInterfaces.d.ts +11 -0
- package/dist/types/src/interfaces/WorldInterfaces.d.ts +32 -0
- package/dist/{src/interfaces/index.js → types/src/interfaces/index.d.ts} +9 -9
- package/dist/types/src/types/DroppedAssetTypes.d.ts +10 -0
- package/dist/types/src/types/InteractiveCredentialsTypes.d.ts +8 -0
- package/dist/types/src/types/OptionsTypes.d.ts +21 -0
- package/dist/types/src/types/ResponseTypes.d.ts +4 -0
- package/dist/types/src/types/VisitorTypes.d.ts +33 -0
- package/dist/{src/types/index.js → types/src/types/index.d.ts} +5 -4
- package/dist/types/src/utils/__tests__/removeUndefined.test.d.ts +1 -0
- package/dist/types/src/utils/__tests__/scatterVisitors.test.d.ts +1 -0
- package/dist/types/src/utils/getBrowserWarning.d.ts +1 -0
- package/dist/{src/utils/index.js → types/src/utils/index.d.ts} +3 -3
- package/dist/types/src/utils/removeUndefined.d.ts +8 -0
- package/dist/types/src/utils/scatterVisitors.d.ts +4 -0
- package/package.json +2 -2
- package/dist/example.js +0 -32
- package/dist/src/__mocks__/assets.js +0 -249
- package/dist/src/__mocks__/scenes.js +0 -104
- package/dist/src/__mocks__/visitors.js +0 -83
- package/dist/src/__mocks__/worlds.js +0 -52
- package/dist/src/controllers/Asset.js +0 -39
- package/dist/src/controllers/DroppedAsset.js +0 -461
- package/dist/src/controllers/SDKController.js +0 -85
- package/dist/src/controllers/Scene.js +0 -39
- package/dist/src/controllers/Topia.js +0 -39
- package/dist/src/controllers/User.js +0 -139
- package/dist/src/controllers/Visitor.js +0 -92
- package/dist/src/controllers/World.js +0 -256
- package/dist/src/controllers/WorldActivity.js +0 -162
- package/dist/src/controllers/__tests__/asset.test.js +0 -37
- package/dist/src/controllers/__tests__/droppedAsset.test.js +0 -98
- package/dist/src/controllers/__tests__/scene.test.js +0 -38
- package/dist/src/controllers/__tests__/user.test.js +0 -49
- package/dist/src/controllers/__tests__/visitor.test.js +0 -47
- package/dist/src/controllers/__tests__/world.test.js +0 -51
- package/dist/src/controllers/__tests__/worldActivity.test.js +0 -63
- package/dist/src/factories/AssetFactory.js +0 -11
- package/dist/src/factories/DroppedAssetFactory.js +0 -42
- package/dist/src/factories/SceneFactory.js +0 -27
- package/dist/src/factories/UserFactory.js +0 -10
- package/dist/src/factories/VisitorFactory.js +0 -26
- package/dist/src/factories/WorldActivityFactory.js +0 -10
- package/dist/src/factories/WorldFactory.js +0 -10
- package/dist/src/index.js +0 -28
- package/dist/src/interfaces/TopiaInterfaces.js +0 -1
- package/dist/src/interfaces/UserInterfaces.js +0 -1
- package/dist/src/interfaces/VisitorInterfaces.js +0 -1
- package/dist/src/interfaces/WorldActivityInterfaces.js +0 -1
- package/dist/src/interfaces/WorldInterfaces.js +0 -1
- package/dist/src/types/DroppedAssetTypes.js +0 -12
- package/dist/src/types/InteractiveCredentialsTypes.js +0 -1
- package/dist/src/types/OptionsTypes.js +0 -1
- package/dist/src/types/ResponseTypes.js +0 -1
- package/dist/src/types/VisitorTypes.js +0 -1
- package/dist/src/utils/__tests__/removeUndefined.test.js +0 -10
- package/dist/src/utils/__tests__/scatterVisitors.test.js +0 -11
- package/dist/src/utils/getBrowserWarning.js +0 -5
- package/dist/src/utils/removeUndefined.js +0 -11
- package/dist/src/utils/scatterVisitors.js +0 -8
package/dist/index.cjs
CHANGED
|
@@ -39751,21 +39751,20 @@ const {
|
|
|
39751
39751
|
*/
|
|
39752
39752
|
class SDKController {
|
|
39753
39753
|
constructor(topia, credentials = {}) {
|
|
39754
|
-
const { assetId, interactiveNonce, visitorId, apiKey } = credentials;
|
|
39754
|
+
const { assetId = null, interactiveNonce = null, visitorId = null, apiKey = null } = credentials;
|
|
39755
39755
|
this.topia = topia;
|
|
39756
39756
|
this.credentials = credentials;
|
|
39757
39757
|
this.requestOptions = {};
|
|
39758
39758
|
let payload = {};
|
|
39759
39759
|
const headers = {};
|
|
39760
|
-
|
|
39761
|
-
|
|
39762
|
-
|
|
39763
|
-
|
|
39764
|
-
|
|
39765
|
-
|
|
39766
|
-
|
|
39767
|
-
|
|
39768
|
-
}
|
|
39760
|
+
payload = {
|
|
39761
|
+
interactiveNonce,
|
|
39762
|
+
visitorId,
|
|
39763
|
+
assetId,
|
|
39764
|
+
date: new Date(),
|
|
39765
|
+
};
|
|
39766
|
+
this.jwt = jwt.sign(payload, topia.interactiveSecret);
|
|
39767
|
+
headers.InteractiveJWT = this.jwt;
|
|
39769
39768
|
if (apiKey) {
|
|
39770
39769
|
headers.Authorization = apiKey;
|
|
39771
39770
|
}
|
|
@@ -40022,7 +40021,7 @@ class DroppedAsset extends Asset {
|
|
|
40022
40021
|
* });
|
|
40023
40022
|
* ```
|
|
40024
40023
|
*/
|
|
40025
|
-
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }) {
|
|
40024
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40026
40025
|
try {
|
|
40027
40026
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {
|
|
40028
40027
|
clickType,
|
|
@@ -40030,6 +40029,8 @@ class DroppedAsset extends Asset {
|
|
|
40030
40029
|
clickableLinkTitle,
|
|
40031
40030
|
clickableDisplayTextDescription,
|
|
40032
40031
|
clickableDisplayTextHeadline,
|
|
40032
|
+
isForceLinkInIframe,
|
|
40033
|
+
isOpenLinkInDrawer,
|
|
40033
40034
|
portalName,
|
|
40034
40035
|
position,
|
|
40035
40036
|
}, "change-click-type");
|
|
@@ -40579,7 +40580,7 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40579
40580
|
* ```
|
|
40580
40581
|
*/
|
|
40581
40582
|
class User extends SDKController {
|
|
40582
|
-
constructor(topia, options = { credentials: {} }) {
|
|
40583
|
+
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40583
40584
|
super(topia, options.credentials);
|
|
40584
40585
|
_User_assetsMap.set(this, void 0);
|
|
40585
40586
|
_User_scenesMap.set(this, void 0);
|
|
@@ -40587,6 +40588,9 @@ class User extends SDKController {
|
|
|
40587
40588
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40588
40589
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40589
40590
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40591
|
+
this.profileId = options.profileId;
|
|
40592
|
+
this.dataObject = {};
|
|
40593
|
+
this.profile = {};
|
|
40590
40594
|
}
|
|
40591
40595
|
get assets() {
|
|
40592
40596
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
@@ -40679,6 +40683,85 @@ class User extends SDKController {
|
|
|
40679
40683
|
}
|
|
40680
40684
|
});
|
|
40681
40685
|
}
|
|
40686
|
+
/**
|
|
40687
|
+
* @summary
|
|
40688
|
+
* Retrieves the data object for a visitor.
|
|
40689
|
+
*
|
|
40690
|
+
* @usage
|
|
40691
|
+
* ```ts
|
|
40692
|
+
* await droppedAsset.fetchUserDataObject();
|
|
40693
|
+
* const { dataObject } = droppedAsset;
|
|
40694
|
+
* ```
|
|
40695
|
+
*/
|
|
40696
|
+
fetchUserDataObject() {
|
|
40697
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40698
|
+
try {
|
|
40699
|
+
if (!this.profileId)
|
|
40700
|
+
throw "This method requires the use of a profileId";
|
|
40701
|
+
const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
|
|
40702
|
+
this.dataObject = response.data;
|
|
40703
|
+
}
|
|
40704
|
+
catch (error) {
|
|
40705
|
+
throw this.errorHandler({ error });
|
|
40706
|
+
}
|
|
40707
|
+
});
|
|
40708
|
+
}
|
|
40709
|
+
/**
|
|
40710
|
+
* @summary
|
|
40711
|
+
* Sets the data object for a visitor.
|
|
40712
|
+
*
|
|
40713
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40714
|
+
*
|
|
40715
|
+
* @usage
|
|
40716
|
+
* ```ts
|
|
40717
|
+
* await droppedAsset.setUserDataObject({
|
|
40718
|
+
* "exampleKey": "exampleValue",
|
|
40719
|
+
* });
|
|
40720
|
+
* const { dataObject } = droppedAsset;
|
|
40721
|
+
* ```
|
|
40722
|
+
*/
|
|
40723
|
+
setUserDataObject(dataObject, options = {}) {
|
|
40724
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40725
|
+
try {
|
|
40726
|
+
if (!this.profileId)
|
|
40727
|
+
throw "This method requires the use of a profileId";
|
|
40728
|
+
const { lock = {} } = options;
|
|
40729
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40730
|
+
this.dataObject = dataObject;
|
|
40731
|
+
}
|
|
40732
|
+
catch (error) {
|
|
40733
|
+
throw this.errorHandler({ error });
|
|
40734
|
+
}
|
|
40735
|
+
});
|
|
40736
|
+
}
|
|
40737
|
+
/**
|
|
40738
|
+
* @summary
|
|
40739
|
+
* Updates the data object for a visitor.
|
|
40740
|
+
*
|
|
40741
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40742
|
+
*
|
|
40743
|
+
* @usage
|
|
40744
|
+
* ```ts
|
|
40745
|
+
* await droppedAsset.updateUserDataObject({
|
|
40746
|
+
* "exampleKey": "exampleValue",
|
|
40747
|
+
* });
|
|
40748
|
+
* const { dataObject } = droppedAsset;
|
|
40749
|
+
* ```
|
|
40750
|
+
*/
|
|
40751
|
+
updateUserDataObject(dataObject, options = {}) {
|
|
40752
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40753
|
+
try {
|
|
40754
|
+
if (!this.profileId)
|
|
40755
|
+
throw "This method requires the use of a profileId";
|
|
40756
|
+
const { lock = {} } = options;
|
|
40757
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40758
|
+
this.dataObject = dataObject;
|
|
40759
|
+
}
|
|
40760
|
+
catch (error) {
|
|
40761
|
+
throw this.errorHandler({ error });
|
|
40762
|
+
}
|
|
40763
|
+
});
|
|
40764
|
+
}
|
|
40682
40765
|
}
|
|
40683
40766
|
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40684
40767
|
|
|
@@ -40762,6 +40845,79 @@ class Visitor extends User {
|
|
|
40762
40845
|
}
|
|
40763
40846
|
});
|
|
40764
40847
|
}
|
|
40848
|
+
/**
|
|
40849
|
+
* @summary
|
|
40850
|
+
* Retrieves the data object for a visitor.
|
|
40851
|
+
*
|
|
40852
|
+
* @usage
|
|
40853
|
+
* ```ts
|
|
40854
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
40855
|
+
* const { dataObject } = droppedAsset;
|
|
40856
|
+
* ```
|
|
40857
|
+
*/
|
|
40858
|
+
fetchVisitorDataObject() {
|
|
40859
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40860
|
+
try {
|
|
40861
|
+
const response = yield this.topiaPublicApi().get(`/visitor/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
|
|
40862
|
+
this.dataObject = response.data;
|
|
40863
|
+
}
|
|
40864
|
+
catch (error) {
|
|
40865
|
+
throw this.errorHandler({ error });
|
|
40866
|
+
}
|
|
40867
|
+
});
|
|
40868
|
+
}
|
|
40869
|
+
/**
|
|
40870
|
+
* @summary
|
|
40871
|
+
* Sets the data object for a visitor.
|
|
40872
|
+
*
|
|
40873
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40874
|
+
*
|
|
40875
|
+
* @usage
|
|
40876
|
+
* ```ts
|
|
40877
|
+
* await droppedAsset.setVisitorDataObject({
|
|
40878
|
+
* "exampleKey": "exampleValue",
|
|
40879
|
+
* });
|
|
40880
|
+
* const { dataObject } = droppedAsset;
|
|
40881
|
+
* ```
|
|
40882
|
+
*/
|
|
40883
|
+
setVisitorDataObject(dataObject, options = {}) {
|
|
40884
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40885
|
+
try {
|
|
40886
|
+
const { lock = {} } = options;
|
|
40887
|
+
yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40888
|
+
this.dataObject = dataObject;
|
|
40889
|
+
}
|
|
40890
|
+
catch (error) {
|
|
40891
|
+
throw this.errorHandler({ error });
|
|
40892
|
+
}
|
|
40893
|
+
});
|
|
40894
|
+
}
|
|
40895
|
+
/**
|
|
40896
|
+
* @summary
|
|
40897
|
+
* Updates the data object for a visitor.
|
|
40898
|
+
*
|
|
40899
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40900
|
+
*
|
|
40901
|
+
* @usage
|
|
40902
|
+
* ```ts
|
|
40903
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
40904
|
+
* "exampleKey": "exampleValue",
|
|
40905
|
+
* });
|
|
40906
|
+
* const { dataObject } = droppedAsset;
|
|
40907
|
+
* ```
|
|
40908
|
+
*/
|
|
40909
|
+
updateVisitorDataObject(dataObject, options = {}) {
|
|
40910
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40911
|
+
try {
|
|
40912
|
+
const { lock = {} } = options;
|
|
40913
|
+
yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40914
|
+
this.dataObject = dataObject;
|
|
40915
|
+
}
|
|
40916
|
+
catch (error) {
|
|
40917
|
+
throw this.errorHandler({ error });
|
|
40918
|
+
}
|
|
40919
|
+
});
|
|
40920
|
+
}
|
|
40765
40921
|
}
|
|
40766
40922
|
|
|
40767
40923
|
var _WorldActivity_visitorsMap;
|
|
@@ -41039,19 +41195,6 @@ class WorldFactory {
|
|
|
41039
41195
|
}
|
|
41040
41196
|
}
|
|
41041
41197
|
|
|
41042
|
-
exports.DroppedAssetClickType = void 0;
|
|
41043
|
-
(function (DroppedAssetClickType) {
|
|
41044
|
-
DroppedAssetClickType["NONE"] = "none";
|
|
41045
|
-
DroppedAssetClickType["LINK"] = "link";
|
|
41046
|
-
DroppedAssetClickType["PORTAL"] = "portal";
|
|
41047
|
-
DroppedAssetClickType["TELEPORT"] = "teleport";
|
|
41048
|
-
})(exports.DroppedAssetClickType || (exports.DroppedAssetClickType = {}));
|
|
41049
|
-
exports.DroppedAssetMediaType = void 0;
|
|
41050
|
-
(function (DroppedAssetMediaType) {
|
|
41051
|
-
DroppedAssetMediaType["NONE"] = "none";
|
|
41052
|
-
DroppedAssetMediaType["LINK"] = "link";
|
|
41053
|
-
})(exports.DroppedAssetMediaType || (exports.DroppedAssetMediaType = {}));
|
|
41054
|
-
|
|
41055
41198
|
Error.stackTraceLimit = 20;
|
|
41056
41199
|
process.on("unhandledRejection", (reason) => {
|
|
41057
41200
|
if (reason && reason.data) {
|
package/dist/index.js
CHANGED
|
@@ -39749,21 +39749,20 @@ const {
|
|
|
39749
39749
|
*/
|
|
39750
39750
|
class SDKController {
|
|
39751
39751
|
constructor(topia, credentials = {}) {
|
|
39752
|
-
const { assetId, interactiveNonce, visitorId, apiKey } = credentials;
|
|
39752
|
+
const { assetId = null, interactiveNonce = null, visitorId = null, apiKey = null } = credentials;
|
|
39753
39753
|
this.topia = topia;
|
|
39754
39754
|
this.credentials = credentials;
|
|
39755
39755
|
this.requestOptions = {};
|
|
39756
39756
|
let payload = {};
|
|
39757
39757
|
const headers = {};
|
|
39758
|
-
|
|
39759
|
-
|
|
39760
|
-
|
|
39761
|
-
|
|
39762
|
-
|
|
39763
|
-
|
|
39764
|
-
|
|
39765
|
-
|
|
39766
|
-
}
|
|
39758
|
+
payload = {
|
|
39759
|
+
interactiveNonce,
|
|
39760
|
+
visitorId,
|
|
39761
|
+
assetId,
|
|
39762
|
+
date: new Date(),
|
|
39763
|
+
};
|
|
39764
|
+
this.jwt = jwt.sign(payload, topia.interactiveSecret);
|
|
39765
|
+
headers.InteractiveJWT = this.jwt;
|
|
39767
39766
|
if (apiKey) {
|
|
39768
39767
|
headers.Authorization = apiKey;
|
|
39769
39768
|
}
|
|
@@ -40020,7 +40019,7 @@ class DroppedAsset extends Asset {
|
|
|
40020
40019
|
* });
|
|
40021
40020
|
* ```
|
|
40022
40021
|
*/
|
|
40023
|
-
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }) {
|
|
40022
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40024
40023
|
try {
|
|
40025
40024
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {
|
|
40026
40025
|
clickType,
|
|
@@ -40028,6 +40027,8 @@ class DroppedAsset extends Asset {
|
|
|
40028
40027
|
clickableLinkTitle,
|
|
40029
40028
|
clickableDisplayTextDescription,
|
|
40030
40029
|
clickableDisplayTextHeadline,
|
|
40030
|
+
isForceLinkInIframe,
|
|
40031
|
+
isOpenLinkInDrawer,
|
|
40031
40032
|
portalName,
|
|
40032
40033
|
position,
|
|
40033
40034
|
}, "change-click-type");
|
|
@@ -40577,7 +40578,7 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40577
40578
|
* ```
|
|
40578
40579
|
*/
|
|
40579
40580
|
class User extends SDKController {
|
|
40580
|
-
constructor(topia, options = { credentials: {} }) {
|
|
40581
|
+
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40581
40582
|
super(topia, options.credentials);
|
|
40582
40583
|
_User_assetsMap.set(this, void 0);
|
|
40583
40584
|
_User_scenesMap.set(this, void 0);
|
|
@@ -40585,6 +40586,9 @@ class User extends SDKController {
|
|
|
40585
40586
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40586
40587
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40587
40588
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40589
|
+
this.profileId = options.profileId;
|
|
40590
|
+
this.dataObject = {};
|
|
40591
|
+
this.profile = {};
|
|
40588
40592
|
}
|
|
40589
40593
|
get assets() {
|
|
40590
40594
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
@@ -40677,6 +40681,85 @@ class User extends SDKController {
|
|
|
40677
40681
|
}
|
|
40678
40682
|
});
|
|
40679
40683
|
}
|
|
40684
|
+
/**
|
|
40685
|
+
* @summary
|
|
40686
|
+
* Retrieves the data object for a visitor.
|
|
40687
|
+
*
|
|
40688
|
+
* @usage
|
|
40689
|
+
* ```ts
|
|
40690
|
+
* await droppedAsset.fetchUserDataObject();
|
|
40691
|
+
* const { dataObject } = droppedAsset;
|
|
40692
|
+
* ```
|
|
40693
|
+
*/
|
|
40694
|
+
fetchUserDataObject() {
|
|
40695
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40696
|
+
try {
|
|
40697
|
+
if (!this.profileId)
|
|
40698
|
+
throw "This method requires the use of a profileId";
|
|
40699
|
+
const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
|
|
40700
|
+
this.dataObject = response.data;
|
|
40701
|
+
}
|
|
40702
|
+
catch (error) {
|
|
40703
|
+
throw this.errorHandler({ error });
|
|
40704
|
+
}
|
|
40705
|
+
});
|
|
40706
|
+
}
|
|
40707
|
+
/**
|
|
40708
|
+
* @summary
|
|
40709
|
+
* Sets the data object for a visitor.
|
|
40710
|
+
*
|
|
40711
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40712
|
+
*
|
|
40713
|
+
* @usage
|
|
40714
|
+
* ```ts
|
|
40715
|
+
* await droppedAsset.setUserDataObject({
|
|
40716
|
+
* "exampleKey": "exampleValue",
|
|
40717
|
+
* });
|
|
40718
|
+
* const { dataObject } = droppedAsset;
|
|
40719
|
+
* ```
|
|
40720
|
+
*/
|
|
40721
|
+
setUserDataObject(dataObject, options = {}) {
|
|
40722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40723
|
+
try {
|
|
40724
|
+
if (!this.profileId)
|
|
40725
|
+
throw "This method requires the use of a profileId";
|
|
40726
|
+
const { lock = {} } = options;
|
|
40727
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40728
|
+
this.dataObject = dataObject;
|
|
40729
|
+
}
|
|
40730
|
+
catch (error) {
|
|
40731
|
+
throw this.errorHandler({ error });
|
|
40732
|
+
}
|
|
40733
|
+
});
|
|
40734
|
+
}
|
|
40735
|
+
/**
|
|
40736
|
+
* @summary
|
|
40737
|
+
* Updates the data object for a visitor.
|
|
40738
|
+
*
|
|
40739
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40740
|
+
*
|
|
40741
|
+
* @usage
|
|
40742
|
+
* ```ts
|
|
40743
|
+
* await droppedAsset.updateUserDataObject({
|
|
40744
|
+
* "exampleKey": "exampleValue",
|
|
40745
|
+
* });
|
|
40746
|
+
* const { dataObject } = droppedAsset;
|
|
40747
|
+
* ```
|
|
40748
|
+
*/
|
|
40749
|
+
updateUserDataObject(dataObject, options = {}) {
|
|
40750
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40751
|
+
try {
|
|
40752
|
+
if (!this.profileId)
|
|
40753
|
+
throw "This method requires the use of a profileId";
|
|
40754
|
+
const { lock = {} } = options;
|
|
40755
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40756
|
+
this.dataObject = dataObject;
|
|
40757
|
+
}
|
|
40758
|
+
catch (error) {
|
|
40759
|
+
throw this.errorHandler({ error });
|
|
40760
|
+
}
|
|
40761
|
+
});
|
|
40762
|
+
}
|
|
40680
40763
|
}
|
|
40681
40764
|
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40682
40765
|
|
|
@@ -40760,6 +40843,79 @@ class Visitor extends User {
|
|
|
40760
40843
|
}
|
|
40761
40844
|
});
|
|
40762
40845
|
}
|
|
40846
|
+
/**
|
|
40847
|
+
* @summary
|
|
40848
|
+
* Retrieves the data object for a visitor.
|
|
40849
|
+
*
|
|
40850
|
+
* @usage
|
|
40851
|
+
* ```ts
|
|
40852
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
40853
|
+
* const { dataObject } = droppedAsset;
|
|
40854
|
+
* ```
|
|
40855
|
+
*/
|
|
40856
|
+
fetchVisitorDataObject() {
|
|
40857
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40858
|
+
try {
|
|
40859
|
+
const response = yield this.topiaPublicApi().get(`/visitor/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
|
|
40860
|
+
this.dataObject = response.data;
|
|
40861
|
+
}
|
|
40862
|
+
catch (error) {
|
|
40863
|
+
throw this.errorHandler({ error });
|
|
40864
|
+
}
|
|
40865
|
+
});
|
|
40866
|
+
}
|
|
40867
|
+
/**
|
|
40868
|
+
* @summary
|
|
40869
|
+
* Sets the data object for a visitor.
|
|
40870
|
+
*
|
|
40871
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40872
|
+
*
|
|
40873
|
+
* @usage
|
|
40874
|
+
* ```ts
|
|
40875
|
+
* await droppedAsset.setVisitorDataObject({
|
|
40876
|
+
* "exampleKey": "exampleValue",
|
|
40877
|
+
* });
|
|
40878
|
+
* const { dataObject } = droppedAsset;
|
|
40879
|
+
* ```
|
|
40880
|
+
*/
|
|
40881
|
+
setVisitorDataObject(dataObject, options = {}) {
|
|
40882
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40883
|
+
try {
|
|
40884
|
+
const { lock = {} } = options;
|
|
40885
|
+
yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40886
|
+
this.dataObject = dataObject;
|
|
40887
|
+
}
|
|
40888
|
+
catch (error) {
|
|
40889
|
+
throw this.errorHandler({ error });
|
|
40890
|
+
}
|
|
40891
|
+
});
|
|
40892
|
+
}
|
|
40893
|
+
/**
|
|
40894
|
+
* @summary
|
|
40895
|
+
* Updates the data object for a visitor.
|
|
40896
|
+
*
|
|
40897
|
+
* Optionally, a lock can be provided with this request to ensure only one update happens at a time between all updates that share the same lock id
|
|
40898
|
+
*
|
|
40899
|
+
* @usage
|
|
40900
|
+
* ```ts
|
|
40901
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
40902
|
+
* "exampleKey": "exampleValue",
|
|
40903
|
+
* });
|
|
40904
|
+
* const { dataObject } = droppedAsset;
|
|
40905
|
+
* ```
|
|
40906
|
+
*/
|
|
40907
|
+
updateVisitorDataObject(dataObject, options = {}) {
|
|
40908
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40909
|
+
try {
|
|
40910
|
+
const { lock = {} } = options;
|
|
40911
|
+
yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40912
|
+
this.dataObject = dataObject;
|
|
40913
|
+
}
|
|
40914
|
+
catch (error) {
|
|
40915
|
+
throw this.errorHandler({ error });
|
|
40916
|
+
}
|
|
40917
|
+
});
|
|
40918
|
+
}
|
|
40763
40919
|
}
|
|
40764
40920
|
|
|
40765
40921
|
var _WorldActivity_visitorsMap;
|
|
@@ -41037,19 +41193,6 @@ class WorldFactory {
|
|
|
41037
41193
|
}
|
|
41038
41194
|
}
|
|
41039
41195
|
|
|
41040
|
-
var DroppedAssetClickType;
|
|
41041
|
-
(function (DroppedAssetClickType) {
|
|
41042
|
-
DroppedAssetClickType["NONE"] = "none";
|
|
41043
|
-
DroppedAssetClickType["LINK"] = "link";
|
|
41044
|
-
DroppedAssetClickType["PORTAL"] = "portal";
|
|
41045
|
-
DroppedAssetClickType["TELEPORT"] = "teleport";
|
|
41046
|
-
})(DroppedAssetClickType || (DroppedAssetClickType = {}));
|
|
41047
|
-
var DroppedAssetMediaType;
|
|
41048
|
-
(function (DroppedAssetMediaType) {
|
|
41049
|
-
DroppedAssetMediaType["NONE"] = "none";
|
|
41050
|
-
DroppedAssetMediaType["LINK"] = "link";
|
|
41051
|
-
})(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
|
|
41052
|
-
|
|
41053
41196
|
Error.stackTraceLimit = 20;
|
|
41054
41197
|
process.on("unhandledRejection", (reason) => {
|
|
41055
41198
|
if (reason && reason.data) {
|
|
@@ -41076,4 +41219,4 @@ process.on("uncaughtException", function (err) {
|
|
|
41076
41219
|
process.exit(1);
|
|
41077
41220
|
});
|
|
41078
41221
|
|
|
41079
|
-
export { AssetFactory,
|
|
41222
|
+
export { AssetFactory, DroppedAssetFactory, SceneFactory, Topia, UserFactory, VisitorFactory, WorldActivityFactory, WorldFactory };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export declare const assets: ({
|
|
2
|
+
id: string;
|
|
3
|
+
addedOn: string;
|
|
4
|
+
assetName: string;
|
|
5
|
+
specialType: null;
|
|
6
|
+
topLayerURL: string;
|
|
7
|
+
bottomLayerURL: string;
|
|
8
|
+
creatorTags?: undefined;
|
|
9
|
+
isPublic?: undefined;
|
|
10
|
+
kitId?: undefined;
|
|
11
|
+
layer0?: undefined;
|
|
12
|
+
layer1?: undefined;
|
|
13
|
+
library?: undefined;
|
|
14
|
+
originalAssetId?: undefined;
|
|
15
|
+
originalKit?: undefined;
|
|
16
|
+
ownerId?: undefined;
|
|
17
|
+
ownerName?: undefined;
|
|
18
|
+
purchased?: undefined;
|
|
19
|
+
purchasedDate?: undefined;
|
|
20
|
+
purchasedFrom?: undefined;
|
|
21
|
+
tagJson?: undefined;
|
|
22
|
+
transactionId?: undefined;
|
|
23
|
+
type?: undefined;
|
|
24
|
+
urlSlug?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
addedOn: string;
|
|
27
|
+
assetName: string;
|
|
28
|
+
creatorTags: {};
|
|
29
|
+
isPublic: boolean;
|
|
30
|
+
kitId: string;
|
|
31
|
+
layer0: null;
|
|
32
|
+
layer1: string;
|
|
33
|
+
library: string;
|
|
34
|
+
originalAssetId: string;
|
|
35
|
+
originalKit: string;
|
|
36
|
+
ownerId: string;
|
|
37
|
+
ownerName: string;
|
|
38
|
+
purchased: boolean;
|
|
39
|
+
purchasedDate: string;
|
|
40
|
+
purchasedFrom: string;
|
|
41
|
+
tagJson: string;
|
|
42
|
+
transactionId: string;
|
|
43
|
+
type: string;
|
|
44
|
+
urlSlug: string;
|
|
45
|
+
id?: undefined;
|
|
46
|
+
specialType?: undefined;
|
|
47
|
+
topLayerURL?: undefined;
|
|
48
|
+
bottomLayerURL?: undefined;
|
|
49
|
+
})[];
|
|
50
|
+
export declare const droppedAssets: {
|
|
51
|
+
id: string;
|
|
52
|
+
assetId: string;
|
|
53
|
+
assetName: string;
|
|
54
|
+
assetScale: number;
|
|
55
|
+
assetBroadcastAll: boolean;
|
|
56
|
+
assetBroadcast: boolean;
|
|
57
|
+
audioRadius: null;
|
|
58
|
+
audioSliderVolume: null;
|
|
59
|
+
isPrivateZone: boolean;
|
|
60
|
+
isPrivateZoneChatDisabled: boolean;
|
|
61
|
+
privateZoneUserCap: null;
|
|
62
|
+
broadcasterEmail: null;
|
|
63
|
+
clickType: null;
|
|
64
|
+
clickableLink: null;
|
|
65
|
+
clickableLinkTitle: null;
|
|
66
|
+
clickablePortal: null;
|
|
67
|
+
creationDatetime: number;
|
|
68
|
+
clickableDisplayTextDescription: null;
|
|
69
|
+
clickableDisplayTextHeadline: null;
|
|
70
|
+
position: {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
};
|
|
74
|
+
portalCoordsX: null;
|
|
75
|
+
portalCoordsY: null;
|
|
76
|
+
specialType: null;
|
|
77
|
+
topLayerURL: string;
|
|
78
|
+
bottomLayerURL: string;
|
|
79
|
+
text: null;
|
|
80
|
+
textStyle: {
|
|
81
|
+
textColor: string;
|
|
82
|
+
textSize: number;
|
|
83
|
+
textWidth: number;
|
|
84
|
+
textWeight: string;
|
|
85
|
+
textFont: string;
|
|
86
|
+
textFontFamily: string;
|
|
87
|
+
};
|
|
88
|
+
teleportX: null;
|
|
89
|
+
teleportY: null;
|
|
90
|
+
syncUserMedia: null;
|
|
91
|
+
mediaLink: null;
|
|
92
|
+
mediaType: null;
|
|
93
|
+
mediaUploadedId: null;
|
|
94
|
+
mediaName: null;
|
|
95
|
+
isMutezone: null;
|
|
96
|
+
isVideo: null;
|
|
97
|
+
isVideoPlayer: null;
|
|
98
|
+
uniqueName: null;
|
|
99
|
+
}[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./assets";
|
|
2
|
-
export * from "./scenes";
|
|
3
|
-
export * from "./visitors";
|
|
4
|
-
export * from "./worlds";
|
|
1
|
+
export * from "./assets";
|
|
2
|
+
export * from "./scenes";
|
|
3
|
+
export * from "./visitors";
|
|
4
|
+
export * from "./worlds";
|