@rtsdk/topia 0.1.1 → 0.2.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/dist/index.cjs +180 -15
- package/dist/index.js +180 -15
- package/dist/types/src/controllers/DroppedAsset.d.ts +1 -1
- package/dist/types/src/controllers/User.d.ts +54 -0
- package/dist/types/src/controllers/Visitor.d.ts +52 -0
- package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +2 -0
- package/dist/types/src/interfaces/UserInterfaces.d.ts +1 -0
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -39751,25 +39751,31 @@ 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
|
-
|
|
39760
|
+
try {
|
|
39761
|
+
if (topia.interactiveSecret) {
|
|
39762
|
+
payload = {
|
|
39763
|
+
interactiveNonce,
|
|
39764
|
+
visitorId,
|
|
39765
|
+
assetId,
|
|
39766
|
+
date: new Date(),
|
|
39767
|
+
};
|
|
39768
|
+
this.jwt = jwt.sign(payload, topia.interactiveSecret);
|
|
39769
|
+
headers.InteractiveJWT = this.jwt;
|
|
39770
|
+
}
|
|
39771
|
+
if (apiKey) {
|
|
39772
|
+
headers.Authorization = apiKey;
|
|
39773
|
+
}
|
|
39774
|
+
this.requestOptions = { headers };
|
|
39768
39775
|
}
|
|
39769
|
-
|
|
39770
|
-
|
|
39776
|
+
catch (error) {
|
|
39777
|
+
this.errorHandler({ error });
|
|
39771
39778
|
}
|
|
39772
|
-
this.requestOptions = { headers };
|
|
39773
39779
|
}
|
|
39774
39780
|
topiaPublicApi() {
|
|
39775
39781
|
return this.topia.axios;
|
|
@@ -40022,7 +40028,7 @@ class DroppedAsset extends Asset {
|
|
|
40022
40028
|
* });
|
|
40023
40029
|
* ```
|
|
40024
40030
|
*/
|
|
40025
|
-
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }) {
|
|
40031
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40026
40032
|
try {
|
|
40027
40033
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {
|
|
40028
40034
|
clickType,
|
|
@@ -40030,6 +40036,8 @@ class DroppedAsset extends Asset {
|
|
|
40030
40036
|
clickableLinkTitle,
|
|
40031
40037
|
clickableDisplayTextDescription,
|
|
40032
40038
|
clickableDisplayTextHeadline,
|
|
40039
|
+
isForceLinkInIframe,
|
|
40040
|
+
isOpenLinkInDrawer,
|
|
40033
40041
|
portalName,
|
|
40034
40042
|
position,
|
|
40035
40043
|
}, "change-click-type");
|
|
@@ -40579,7 +40587,7 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40579
40587
|
* ```
|
|
40580
40588
|
*/
|
|
40581
40589
|
class User extends SDKController {
|
|
40582
|
-
constructor(topia, options = { credentials: {} }) {
|
|
40590
|
+
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40583
40591
|
super(topia, options.credentials);
|
|
40584
40592
|
_User_assetsMap.set(this, void 0);
|
|
40585
40593
|
_User_scenesMap.set(this, void 0);
|
|
@@ -40587,6 +40595,9 @@ class User extends SDKController {
|
|
|
40587
40595
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40588
40596
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40589
40597
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40598
|
+
this.profileId = options.profileId;
|
|
40599
|
+
this.dataObject = {};
|
|
40600
|
+
this.profile = {};
|
|
40590
40601
|
}
|
|
40591
40602
|
get assets() {
|
|
40592
40603
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
@@ -40679,6 +40690,85 @@ class User extends SDKController {
|
|
|
40679
40690
|
}
|
|
40680
40691
|
});
|
|
40681
40692
|
}
|
|
40693
|
+
/**
|
|
40694
|
+
* @summary
|
|
40695
|
+
* Retrieves the data object for a visitor.
|
|
40696
|
+
*
|
|
40697
|
+
* @usage
|
|
40698
|
+
* ```ts
|
|
40699
|
+
* await droppedAsset.fetchUserDataObject();
|
|
40700
|
+
* const { dataObject } = droppedAsset;
|
|
40701
|
+
* ```
|
|
40702
|
+
*/
|
|
40703
|
+
fetchUserDataObject() {
|
|
40704
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40705
|
+
try {
|
|
40706
|
+
if (!this.profileId)
|
|
40707
|
+
throw "This method requires the use of a profileId";
|
|
40708
|
+
const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
|
|
40709
|
+
this.dataObject = response.data;
|
|
40710
|
+
}
|
|
40711
|
+
catch (error) {
|
|
40712
|
+
throw this.errorHandler({ error });
|
|
40713
|
+
}
|
|
40714
|
+
});
|
|
40715
|
+
}
|
|
40716
|
+
/**
|
|
40717
|
+
* @summary
|
|
40718
|
+
* Sets the data object for a visitor.
|
|
40719
|
+
*
|
|
40720
|
+
* 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
|
|
40721
|
+
*
|
|
40722
|
+
* @usage
|
|
40723
|
+
* ```ts
|
|
40724
|
+
* await droppedAsset.setUserDataObject({
|
|
40725
|
+
* "exampleKey": "exampleValue",
|
|
40726
|
+
* });
|
|
40727
|
+
* const { dataObject } = droppedAsset;
|
|
40728
|
+
* ```
|
|
40729
|
+
*/
|
|
40730
|
+
setUserDataObject(dataObject, options = {}) {
|
|
40731
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40732
|
+
try {
|
|
40733
|
+
if (!this.profileId)
|
|
40734
|
+
throw "This method requires the use of a profileId";
|
|
40735
|
+
const { lock = {} } = options;
|
|
40736
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40737
|
+
this.dataObject = dataObject;
|
|
40738
|
+
}
|
|
40739
|
+
catch (error) {
|
|
40740
|
+
throw this.errorHandler({ error });
|
|
40741
|
+
}
|
|
40742
|
+
});
|
|
40743
|
+
}
|
|
40744
|
+
/**
|
|
40745
|
+
* @summary
|
|
40746
|
+
* Updates the data object for a visitor.
|
|
40747
|
+
*
|
|
40748
|
+
* 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
|
|
40749
|
+
*
|
|
40750
|
+
* @usage
|
|
40751
|
+
* ```ts
|
|
40752
|
+
* await droppedAsset.updateUserDataObject({
|
|
40753
|
+
* "exampleKey": "exampleValue",
|
|
40754
|
+
* });
|
|
40755
|
+
* const { dataObject } = droppedAsset;
|
|
40756
|
+
* ```
|
|
40757
|
+
*/
|
|
40758
|
+
updateUserDataObject(dataObject, options = {}) {
|
|
40759
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40760
|
+
try {
|
|
40761
|
+
if (!this.profileId)
|
|
40762
|
+
throw "This method requires the use of a profileId";
|
|
40763
|
+
const { lock = {} } = options;
|
|
40764
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40765
|
+
this.dataObject = dataObject;
|
|
40766
|
+
}
|
|
40767
|
+
catch (error) {
|
|
40768
|
+
throw this.errorHandler({ error });
|
|
40769
|
+
}
|
|
40770
|
+
});
|
|
40771
|
+
}
|
|
40682
40772
|
}
|
|
40683
40773
|
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40684
40774
|
|
|
@@ -40711,7 +40801,7 @@ class Visitor extends User {
|
|
|
40711
40801
|
* Returns details for a visitor in a world by id and urlSlug
|
|
40712
40802
|
*/
|
|
40713
40803
|
fetchVisitor() {
|
|
40714
|
-
var _a;
|
|
40804
|
+
var _a, _b;
|
|
40715
40805
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40716
40806
|
try {
|
|
40717
40807
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}`, this.requestOptions);
|
|
@@ -40724,6 +40814,8 @@ class Visitor extends User {
|
|
|
40724
40814
|
else {
|
|
40725
40815
|
throw "This visitor is not active";
|
|
40726
40816
|
}
|
|
40817
|
+
if ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.profileId)
|
|
40818
|
+
this.profileId = this.profile.profileId;
|
|
40727
40819
|
}
|
|
40728
40820
|
catch (error) {
|
|
40729
40821
|
throw this.errorHandler({ error });
|
|
@@ -40762,6 +40854,79 @@ class Visitor extends User {
|
|
|
40762
40854
|
}
|
|
40763
40855
|
});
|
|
40764
40856
|
}
|
|
40857
|
+
/**
|
|
40858
|
+
* @summary
|
|
40859
|
+
* Retrieves the data object for a visitor.
|
|
40860
|
+
*
|
|
40861
|
+
* @usage
|
|
40862
|
+
* ```ts
|
|
40863
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
40864
|
+
* const { dataObject } = droppedAsset;
|
|
40865
|
+
* ```
|
|
40866
|
+
*/
|
|
40867
|
+
fetchVisitorDataObject() {
|
|
40868
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40869
|
+
try {
|
|
40870
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
|
|
40871
|
+
this.dataObject = response.data;
|
|
40872
|
+
}
|
|
40873
|
+
catch (error) {
|
|
40874
|
+
throw this.errorHandler({ error });
|
|
40875
|
+
}
|
|
40876
|
+
});
|
|
40877
|
+
}
|
|
40878
|
+
/**
|
|
40879
|
+
* @summary
|
|
40880
|
+
* Sets the data object for a visitor.
|
|
40881
|
+
*
|
|
40882
|
+
* 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
|
|
40883
|
+
*
|
|
40884
|
+
* @usage
|
|
40885
|
+
* ```ts
|
|
40886
|
+
* await droppedAsset.setVisitorDataObject({
|
|
40887
|
+
* "exampleKey": "exampleValue",
|
|
40888
|
+
* });
|
|
40889
|
+
* const { dataObject } = droppedAsset;
|
|
40890
|
+
* ```
|
|
40891
|
+
*/
|
|
40892
|
+
setVisitorDataObject(dataObject, options = {}) {
|
|
40893
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40894
|
+
try {
|
|
40895
|
+
const { lock = {} } = options;
|
|
40896
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40897
|
+
this.dataObject = dataObject;
|
|
40898
|
+
}
|
|
40899
|
+
catch (error) {
|
|
40900
|
+
throw this.errorHandler({ error });
|
|
40901
|
+
}
|
|
40902
|
+
});
|
|
40903
|
+
}
|
|
40904
|
+
/**
|
|
40905
|
+
* @summary
|
|
40906
|
+
* Updates the data object for a visitor.
|
|
40907
|
+
*
|
|
40908
|
+
* 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
|
|
40909
|
+
*
|
|
40910
|
+
* @usage
|
|
40911
|
+
* ```ts
|
|
40912
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
40913
|
+
* "exampleKey": "exampleValue",
|
|
40914
|
+
* });
|
|
40915
|
+
* const { dataObject } = droppedAsset;
|
|
40916
|
+
* ```
|
|
40917
|
+
*/
|
|
40918
|
+
updateVisitorDataObject(dataObject, options = {}) {
|
|
40919
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40920
|
+
try {
|
|
40921
|
+
const { lock = {} } = options;
|
|
40922
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40923
|
+
this.dataObject = dataObject;
|
|
40924
|
+
}
|
|
40925
|
+
catch (error) {
|
|
40926
|
+
throw this.errorHandler({ error });
|
|
40927
|
+
}
|
|
40928
|
+
});
|
|
40929
|
+
}
|
|
40765
40930
|
}
|
|
40766
40931
|
|
|
40767
40932
|
var _WorldActivity_visitorsMap;
|
package/dist/index.js
CHANGED
|
@@ -39749,25 +39749,31 @@ 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
|
-
|
|
39758
|
+
try {
|
|
39759
|
+
if (topia.interactiveSecret) {
|
|
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;
|
|
39768
|
+
}
|
|
39769
|
+
if (apiKey) {
|
|
39770
|
+
headers.Authorization = apiKey;
|
|
39771
|
+
}
|
|
39772
|
+
this.requestOptions = { headers };
|
|
39766
39773
|
}
|
|
39767
|
-
|
|
39768
|
-
|
|
39774
|
+
catch (error) {
|
|
39775
|
+
this.errorHandler({ error });
|
|
39769
39776
|
}
|
|
39770
|
-
this.requestOptions = { headers };
|
|
39771
39777
|
}
|
|
39772
39778
|
topiaPublicApi() {
|
|
39773
39779
|
return this.topia.axios;
|
|
@@ -40020,7 +40026,7 @@ class DroppedAsset extends Asset {
|
|
|
40020
40026
|
* });
|
|
40021
40027
|
* ```
|
|
40022
40028
|
*/
|
|
40023
|
-
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }) {
|
|
40029
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }) {
|
|
40024
40030
|
try {
|
|
40025
40031
|
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {
|
|
40026
40032
|
clickType,
|
|
@@ -40028,6 +40034,8 @@ class DroppedAsset extends Asset {
|
|
|
40028
40034
|
clickableLinkTitle,
|
|
40029
40035
|
clickableDisplayTextDescription,
|
|
40030
40036
|
clickableDisplayTextHeadline,
|
|
40037
|
+
isForceLinkInIframe,
|
|
40038
|
+
isOpenLinkInDrawer,
|
|
40031
40039
|
portalName,
|
|
40032
40040
|
position,
|
|
40033
40041
|
}, "change-click-type");
|
|
@@ -40577,7 +40585,7 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40577
40585
|
* ```
|
|
40578
40586
|
*/
|
|
40579
40587
|
class User extends SDKController {
|
|
40580
|
-
constructor(topia, options = { credentials: {} }) {
|
|
40588
|
+
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40581
40589
|
super(topia, options.credentials);
|
|
40582
40590
|
_User_assetsMap.set(this, void 0);
|
|
40583
40591
|
_User_scenesMap.set(this, void 0);
|
|
@@ -40585,6 +40593,9 @@ class User extends SDKController {
|
|
|
40585
40593
|
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40586
40594
|
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40587
40595
|
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40596
|
+
this.profileId = options.profileId;
|
|
40597
|
+
this.dataObject = {};
|
|
40598
|
+
this.profile = {};
|
|
40588
40599
|
}
|
|
40589
40600
|
get assets() {
|
|
40590
40601
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
@@ -40677,6 +40688,85 @@ class User extends SDKController {
|
|
|
40677
40688
|
}
|
|
40678
40689
|
});
|
|
40679
40690
|
}
|
|
40691
|
+
/**
|
|
40692
|
+
* @summary
|
|
40693
|
+
* Retrieves the data object for a visitor.
|
|
40694
|
+
*
|
|
40695
|
+
* @usage
|
|
40696
|
+
* ```ts
|
|
40697
|
+
* await droppedAsset.fetchUserDataObject();
|
|
40698
|
+
* const { dataObject } = droppedAsset;
|
|
40699
|
+
* ```
|
|
40700
|
+
*/
|
|
40701
|
+
fetchUserDataObject() {
|
|
40702
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40703
|
+
try {
|
|
40704
|
+
if (!this.profileId)
|
|
40705
|
+
throw "This method requires the use of a profileId";
|
|
40706
|
+
const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
|
|
40707
|
+
this.dataObject = response.data;
|
|
40708
|
+
}
|
|
40709
|
+
catch (error) {
|
|
40710
|
+
throw this.errorHandler({ error });
|
|
40711
|
+
}
|
|
40712
|
+
});
|
|
40713
|
+
}
|
|
40714
|
+
/**
|
|
40715
|
+
* @summary
|
|
40716
|
+
* Sets the data object for a visitor.
|
|
40717
|
+
*
|
|
40718
|
+
* 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
|
|
40719
|
+
*
|
|
40720
|
+
* @usage
|
|
40721
|
+
* ```ts
|
|
40722
|
+
* await droppedAsset.setUserDataObject({
|
|
40723
|
+
* "exampleKey": "exampleValue",
|
|
40724
|
+
* });
|
|
40725
|
+
* const { dataObject } = droppedAsset;
|
|
40726
|
+
* ```
|
|
40727
|
+
*/
|
|
40728
|
+
setUserDataObject(dataObject, options = {}) {
|
|
40729
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40730
|
+
try {
|
|
40731
|
+
if (!this.profileId)
|
|
40732
|
+
throw "This method requires the use of a profileId";
|
|
40733
|
+
const { lock = {} } = options;
|
|
40734
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40735
|
+
this.dataObject = dataObject;
|
|
40736
|
+
}
|
|
40737
|
+
catch (error) {
|
|
40738
|
+
throw this.errorHandler({ error });
|
|
40739
|
+
}
|
|
40740
|
+
});
|
|
40741
|
+
}
|
|
40742
|
+
/**
|
|
40743
|
+
* @summary
|
|
40744
|
+
* Updates the data object for a visitor.
|
|
40745
|
+
*
|
|
40746
|
+
* 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
|
|
40747
|
+
*
|
|
40748
|
+
* @usage
|
|
40749
|
+
* ```ts
|
|
40750
|
+
* await droppedAsset.updateUserDataObject({
|
|
40751
|
+
* "exampleKey": "exampleValue",
|
|
40752
|
+
* });
|
|
40753
|
+
* const { dataObject } = droppedAsset;
|
|
40754
|
+
* ```
|
|
40755
|
+
*/
|
|
40756
|
+
updateUserDataObject(dataObject, options = {}) {
|
|
40757
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40758
|
+
try {
|
|
40759
|
+
if (!this.profileId)
|
|
40760
|
+
throw "This method requires the use of a profileId";
|
|
40761
|
+
const { lock = {} } = options;
|
|
40762
|
+
yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40763
|
+
this.dataObject = dataObject;
|
|
40764
|
+
}
|
|
40765
|
+
catch (error) {
|
|
40766
|
+
throw this.errorHandler({ error });
|
|
40767
|
+
}
|
|
40768
|
+
});
|
|
40769
|
+
}
|
|
40680
40770
|
}
|
|
40681
40771
|
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40682
40772
|
|
|
@@ -40709,7 +40799,7 @@ class Visitor extends User {
|
|
|
40709
40799
|
* Returns details for a visitor in a world by id and urlSlug
|
|
40710
40800
|
*/
|
|
40711
40801
|
fetchVisitor() {
|
|
40712
|
-
var _a;
|
|
40802
|
+
var _a, _b;
|
|
40713
40803
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40714
40804
|
try {
|
|
40715
40805
|
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}`, this.requestOptions);
|
|
@@ -40722,6 +40812,8 @@ class Visitor extends User {
|
|
|
40722
40812
|
else {
|
|
40723
40813
|
throw "This visitor is not active";
|
|
40724
40814
|
}
|
|
40815
|
+
if ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.profileId)
|
|
40816
|
+
this.profileId = this.profile.profileId;
|
|
40725
40817
|
}
|
|
40726
40818
|
catch (error) {
|
|
40727
40819
|
throw this.errorHandler({ error });
|
|
@@ -40760,6 +40852,79 @@ class Visitor extends User {
|
|
|
40760
40852
|
}
|
|
40761
40853
|
});
|
|
40762
40854
|
}
|
|
40855
|
+
/**
|
|
40856
|
+
* @summary
|
|
40857
|
+
* Retrieves the data object for a visitor.
|
|
40858
|
+
*
|
|
40859
|
+
* @usage
|
|
40860
|
+
* ```ts
|
|
40861
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
40862
|
+
* const { dataObject } = droppedAsset;
|
|
40863
|
+
* ```
|
|
40864
|
+
*/
|
|
40865
|
+
fetchVisitorDataObject() {
|
|
40866
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40867
|
+
try {
|
|
40868
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
|
|
40869
|
+
this.dataObject = response.data;
|
|
40870
|
+
}
|
|
40871
|
+
catch (error) {
|
|
40872
|
+
throw this.errorHandler({ error });
|
|
40873
|
+
}
|
|
40874
|
+
});
|
|
40875
|
+
}
|
|
40876
|
+
/**
|
|
40877
|
+
* @summary
|
|
40878
|
+
* Sets the data object for a visitor.
|
|
40879
|
+
*
|
|
40880
|
+
* 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
|
|
40881
|
+
*
|
|
40882
|
+
* @usage
|
|
40883
|
+
* ```ts
|
|
40884
|
+
* await droppedAsset.setVisitorDataObject({
|
|
40885
|
+
* "exampleKey": "exampleValue",
|
|
40886
|
+
* });
|
|
40887
|
+
* const { dataObject } = droppedAsset;
|
|
40888
|
+
* ```
|
|
40889
|
+
*/
|
|
40890
|
+
setVisitorDataObject(dataObject, options = {}) {
|
|
40891
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40892
|
+
try {
|
|
40893
|
+
const { lock = {} } = options;
|
|
40894
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40895
|
+
this.dataObject = dataObject;
|
|
40896
|
+
}
|
|
40897
|
+
catch (error) {
|
|
40898
|
+
throw this.errorHandler({ error });
|
|
40899
|
+
}
|
|
40900
|
+
});
|
|
40901
|
+
}
|
|
40902
|
+
/**
|
|
40903
|
+
* @summary
|
|
40904
|
+
* Updates the data object for a visitor.
|
|
40905
|
+
*
|
|
40906
|
+
* 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
|
|
40907
|
+
*
|
|
40908
|
+
* @usage
|
|
40909
|
+
* ```ts
|
|
40910
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
40911
|
+
* "exampleKey": "exampleValue",
|
|
40912
|
+
* });
|
|
40913
|
+
* const { dataObject } = droppedAsset;
|
|
40914
|
+
* ```
|
|
40915
|
+
*/
|
|
40916
|
+
updateVisitorDataObject(dataObject, options = {}) {
|
|
40917
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40918
|
+
try {
|
|
40919
|
+
const { lock = {} } = options;
|
|
40920
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40921
|
+
this.dataObject = dataObject;
|
|
40922
|
+
}
|
|
40923
|
+
catch (error) {
|
|
40924
|
+
throw this.errorHandler({ error });
|
|
40925
|
+
}
|
|
40926
|
+
});
|
|
40927
|
+
}
|
|
40763
40928
|
}
|
|
40764
40929
|
|
|
40765
40930
|
var _WorldActivity_visitorsMap;
|
|
@@ -127,7 +127,7 @@ export declare class DroppedAsset extends Asset implements DroppedAssetInterface
|
|
|
127
127
|
* });
|
|
128
128
|
* ```
|
|
129
129
|
*/
|
|
130
|
-
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
|
|
130
|
+
updateClickType({ clickType, clickableLink, clickableLinkTitle, clickableDisplayTextDescription, clickableDisplayTextHeadline, isForceLinkInIframe, isOpenLinkInDrawer, portalName, position, }: UpdateClickTypeInterface): Promise<void | ResponseType>;
|
|
131
131
|
/**
|
|
132
132
|
* @summary
|
|
133
133
|
* Updates text and style of a dropped asset.
|
|
@@ -16,6 +16,9 @@ import { ResponseType } from "types";
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class User extends SDKController {
|
|
18
18
|
#private;
|
|
19
|
+
profileId?: string | null;
|
|
20
|
+
dataObject?: object;
|
|
21
|
+
profile?: object;
|
|
19
22
|
constructor(topia: Topia, options?: UserOptionalInterface);
|
|
20
23
|
get assets(): {
|
|
21
24
|
[key: string]: Asset;
|
|
@@ -54,5 +57,56 @@ export declare class User extends SDKController {
|
|
|
54
57
|
* ```
|
|
55
58
|
*/
|
|
56
59
|
fetchWorldsByKey(): Promise<void | ResponseType>;
|
|
60
|
+
/**
|
|
61
|
+
* @summary
|
|
62
|
+
* Retrieves the data object for a visitor.
|
|
63
|
+
*
|
|
64
|
+
* @usage
|
|
65
|
+
* ```ts
|
|
66
|
+
* await droppedAsset.fetchUserDataObject();
|
|
67
|
+
* const { dataObject } = droppedAsset;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
fetchUserDataObject(): Promise<void | ResponseType>;
|
|
71
|
+
/**
|
|
72
|
+
* @summary
|
|
73
|
+
* Sets the data object for a visitor.
|
|
74
|
+
*
|
|
75
|
+
* 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
|
|
76
|
+
*
|
|
77
|
+
* @usage
|
|
78
|
+
* ```ts
|
|
79
|
+
* await droppedAsset.setUserDataObject({
|
|
80
|
+
* "exampleKey": "exampleValue",
|
|
81
|
+
* });
|
|
82
|
+
* const { dataObject } = droppedAsset;
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
setUserDataObject(dataObject: object, options?: {
|
|
86
|
+
lock?: {
|
|
87
|
+
lockId: string;
|
|
88
|
+
releaseLock?: boolean;
|
|
89
|
+
};
|
|
90
|
+
}): Promise<void | ResponseType>;
|
|
91
|
+
/**
|
|
92
|
+
* @summary
|
|
93
|
+
* Updates the data object for a visitor.
|
|
94
|
+
*
|
|
95
|
+
* 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
|
|
96
|
+
*
|
|
97
|
+
* @usage
|
|
98
|
+
* ```ts
|
|
99
|
+
* await droppedAsset.updateUserDataObject({
|
|
100
|
+
* "exampleKey": "exampleValue",
|
|
101
|
+
* });
|
|
102
|
+
* const { dataObject } = droppedAsset;
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
updateUserDataObject(dataObject: object, options?: {
|
|
106
|
+
lock?: {
|
|
107
|
+
lockId: string;
|
|
108
|
+
releaseLock?: boolean;
|
|
109
|
+
};
|
|
110
|
+
}): Promise<void | ResponseType>;
|
|
57
111
|
}
|
|
58
112
|
export default User;
|
|
@@ -15,6 +15,7 @@ export declare class Visitor extends User implements VisitorInterface {
|
|
|
15
15
|
readonly id: number;
|
|
16
16
|
urlSlug: string;
|
|
17
17
|
user?: User;
|
|
18
|
+
profile?: any;
|
|
18
19
|
constructor(topia: Topia, id: number, urlSlug: string, options?: VisitorOptionalInterface);
|
|
19
20
|
/**
|
|
20
21
|
* @summary
|
|
@@ -46,5 +47,56 @@ export declare class Visitor extends User implements VisitorInterface {
|
|
|
46
47
|
* Updates each Visitor instance and world.visitors map.
|
|
47
48
|
*/
|
|
48
49
|
moveVisitor({ shouldTeleportVisitor, x, y }: MoveVisitorInterface): Promise<void | ResponseType>;
|
|
50
|
+
/**
|
|
51
|
+
* @summary
|
|
52
|
+
* Retrieves the data object for a visitor.
|
|
53
|
+
*
|
|
54
|
+
* @usage
|
|
55
|
+
* ```ts
|
|
56
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
57
|
+
* const { dataObject } = droppedAsset;
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
fetchVisitorDataObject(): Promise<void | ResponseType>;
|
|
61
|
+
/**
|
|
62
|
+
* @summary
|
|
63
|
+
* Sets the data object for a visitor.
|
|
64
|
+
*
|
|
65
|
+
* 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
|
|
66
|
+
*
|
|
67
|
+
* @usage
|
|
68
|
+
* ```ts
|
|
69
|
+
* await droppedAsset.setVisitorDataObject({
|
|
70
|
+
* "exampleKey": "exampleValue",
|
|
71
|
+
* });
|
|
72
|
+
* const { dataObject } = droppedAsset;
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
setVisitorDataObject(dataObject: object, options?: {
|
|
76
|
+
lock?: {
|
|
77
|
+
lockId: string;
|
|
78
|
+
releaseLock?: boolean;
|
|
79
|
+
};
|
|
80
|
+
}): Promise<void | ResponseType>;
|
|
81
|
+
/**
|
|
82
|
+
* @summary
|
|
83
|
+
* Updates the data object for a visitor.
|
|
84
|
+
*
|
|
85
|
+
* 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
|
|
86
|
+
*
|
|
87
|
+
* @usage
|
|
88
|
+
* ```ts
|
|
89
|
+
* await droppedAsset.updateVisitorDataObject({
|
|
90
|
+
* "exampleKey": "exampleValue",
|
|
91
|
+
* });
|
|
92
|
+
* const { dataObject } = droppedAsset;
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
updateVisitorDataObject(dataObject: object, options?: {
|
|
96
|
+
lock?: {
|
|
97
|
+
lockId: string;
|
|
98
|
+
releaseLock?: boolean;
|
|
99
|
+
};
|
|
100
|
+
}): Promise<void | ResponseType>;
|
|
49
101
|
}
|
|
50
102
|
export default Visitor;
|
|
@@ -79,6 +79,8 @@ export interface UpdateClickTypeInterface {
|
|
|
79
79
|
clickableLinkTitle: string;
|
|
80
80
|
clickableDisplayTextDescription: string;
|
|
81
81
|
clickableDisplayTextHeadline: string;
|
|
82
|
+
isForceLinkInIframe?: boolean;
|
|
83
|
+
isOpenLinkInDrawer?: boolean;
|
|
82
84
|
portalName: string;
|
|
83
85
|
position: {
|
|
84
86
|
x: number;
|