@rtsdk/topia 0.2.2 → 0.2.4
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 +1179 -41168
- package/dist/index.d.ts +1251 -0
- package/dist/index.js +194 -101
- package/package.json +5 -2
- package/dist/types/example.d.ts +0 -6
- package/dist/types/src/__mocks__/assets.d.ts +0 -99
- package/dist/types/src/__mocks__/index.d.ts +0 -4
- package/dist/types/src/__mocks__/scenes.d.ts +0 -79
- package/dist/types/src/__mocks__/visitors.d.ts +0 -83
- package/dist/types/src/__mocks__/worlds.d.ts +0 -73
- package/dist/types/src/controllers/Asset.d.ts +0 -20
- package/dist/types/src/controllers/DroppedAsset.d.ts +0 -285
- package/dist/types/src/controllers/SDKController.d.ts +0 -48
- package/dist/types/src/controllers/Scene.d.ts +0 -19
- package/dist/types/src/controllers/Topia.d.ts +0 -33
- package/dist/types/src/controllers/User.d.ts +0 -112
- package/dist/types/src/controllers/Visitor.d.ts +0 -102
- package/dist/types/src/controllers/World.d.ts +0 -143
- package/dist/types/src/controllers/WorldActivity.d.ts +0 -83
- package/dist/types/src/controllers/__tests__/asset.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/droppedAsset.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/scene.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/user.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/visitor.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/world.test.d.ts +0 -1
- package/dist/types/src/controllers/__tests__/worldActivity.test.d.ts +0 -1
- package/dist/types/src/controllers/index.d.ts +0 -9
- package/dist/types/src/factories/AssetFactory.d.ts +0 -8
- package/dist/types/src/factories/DroppedAssetFactory.d.ts +0 -16
- package/dist/types/src/factories/SceneFactory.d.ts +0 -9
- package/dist/types/src/factories/UserFactory.d.ts +0 -8
- package/dist/types/src/factories/VisitorFactory.d.ts +0 -9
- package/dist/types/src/factories/WorldActivityFactory.d.ts +0 -8
- package/dist/types/src/factories/WorldFactory.d.ts +0 -8
- package/dist/types/src/factories/index.d.ts +0 -7
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/interfaces/AssetInterfaces.d.ts +0 -26
- package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +0 -104
- package/dist/types/src/interfaces/SDKInterfaces.d.ts +0 -8
- package/dist/types/src/interfaces/SceneInterfaces.d.ts +0 -27
- package/dist/types/src/interfaces/TopiaInterfaces.d.ts +0 -10
- package/dist/types/src/interfaces/UserInterfaces.d.ts +0 -7
- package/dist/types/src/interfaces/VisitorInterfaces.d.ts +0 -37
- package/dist/types/src/interfaces/WorldActivityInterfaces.d.ts +0 -11
- package/dist/types/src/interfaces/WorldInterfaces.d.ts +0 -32
- package/dist/types/src/interfaces/index.d.ts +0 -9
- package/dist/types/src/types/DroppedAssetTypes.d.ts +0 -10
- package/dist/types/src/types/InteractiveCredentialsTypes.d.ts +0 -9
- package/dist/types/src/types/OptionsTypes.d.ts +0 -21
- package/dist/types/src/types/ResponseTypes.d.ts +0 -4
- package/dist/types/src/types/VisitorTypes.d.ts +0 -33
- package/dist/types/src/types/index.d.ts +0 -5
- package/dist/types/src/utils/__tests__/removeUndefined.test.d.ts +0 -1
- package/dist/types/src/utils/__tests__/scatterVisitors.test.d.ts +0 -1
- package/dist/types/src/utils/getBrowserWarning.d.ts +0 -1
- package/dist/types/src/utils/index.d.ts +0 -3
- package/dist/types/src/utils/removeUndefined.d.ts +0 -8
- package/dist/types/src/utils/scatterVisitors.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -39841,7 +39841,7 @@ class Asset extends SDKController {
|
|
|
39841
39841
|
}
|
|
39842
39842
|
}
|
|
39843
39843
|
|
|
39844
|
-
var _DroppedAsset_updateDroppedAsset;
|
|
39844
|
+
var _DroppedAsset_fetchDroppedAssetDataObject, _DroppedAsset_setDroppedAssetDataObject, _DroppedAsset_updateDroppedAssetDataObject, _DroppedAsset_updateDroppedAsset;
|
|
39845
39845
|
/**
|
|
39846
39846
|
* @summary
|
|
39847
39847
|
* Create an instance of Dropped Asset class with a given dropped asset id, url slug, and optional attributes and session credentials.
|
|
@@ -39855,7 +39855,39 @@ class DroppedAsset extends Asset {
|
|
|
39855
39855
|
constructor(topia, id, urlSlug, options = { attributes: { text: "" }, credentials: {} }) {
|
|
39856
39856
|
var _a;
|
|
39857
39857
|
super(topia, id, options);
|
|
39858
|
-
//
|
|
39858
|
+
// private methods
|
|
39859
|
+
_DroppedAsset_fetchDroppedAssetDataObject.set(this, () => __awaiter(this, void 0, void 0, function* () {
|
|
39860
|
+
try {
|
|
39861
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object`, this.requestOptions);
|
|
39862
|
+
this.dataObject = response.data;
|
|
39863
|
+
return response.data;
|
|
39864
|
+
}
|
|
39865
|
+
catch (error) {
|
|
39866
|
+
throw this.errorHandler({ error });
|
|
39867
|
+
}
|
|
39868
|
+
}));
|
|
39869
|
+
_DroppedAsset_setDroppedAssetDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
39870
|
+
try {
|
|
39871
|
+
const { lock = {} } = options;
|
|
39872
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
39873
|
+
this.dataObject = dataObject;
|
|
39874
|
+
return response.data;
|
|
39875
|
+
}
|
|
39876
|
+
catch (error) {
|
|
39877
|
+
throw this.errorHandler({ error });
|
|
39878
|
+
}
|
|
39879
|
+
}));
|
|
39880
|
+
_DroppedAsset_updateDroppedAssetDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
39881
|
+
try {
|
|
39882
|
+
const { lock = {} } = options;
|
|
39883
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
39884
|
+
this.dataObject = response.data;
|
|
39885
|
+
return response.data;
|
|
39886
|
+
}
|
|
39887
|
+
catch (error) {
|
|
39888
|
+
throw this.errorHandler({ error });
|
|
39889
|
+
}
|
|
39890
|
+
}));
|
|
39859
39891
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39860
39892
|
try {
|
|
39861
39893
|
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/${updateType}`, Object.assign({}, payload), this.requestOptions);
|
|
@@ -39917,19 +39949,13 @@ class DroppedAsset extends Asset {
|
|
|
39917
39949
|
*
|
|
39918
39950
|
* @usage
|
|
39919
39951
|
* ```ts
|
|
39920
|
-
* await droppedAsset.
|
|
39952
|
+
* await droppedAsset.fetchDataObject();
|
|
39921
39953
|
* const { dataObject } = droppedAsset;
|
|
39922
39954
|
* ```
|
|
39923
39955
|
*/
|
|
39924
|
-
|
|
39956
|
+
fetchDataObject() {
|
|
39925
39957
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39926
|
-
|
|
39927
|
-
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/assets/${this.id}/data-object`, this.requestOptions);
|
|
39928
|
-
this.dataObject = response.data;
|
|
39929
|
-
}
|
|
39930
|
-
catch (error) {
|
|
39931
|
-
throw this.errorHandler({ error });
|
|
39932
|
-
}
|
|
39958
|
+
return __classPrivateFieldGet(this, _DroppedAsset_fetchDroppedAssetDataObject, "f").call(this);
|
|
39933
39959
|
});
|
|
39934
39960
|
}
|
|
39935
39961
|
/**
|
|
@@ -39940,22 +39966,15 @@ class DroppedAsset extends Asset {
|
|
|
39940
39966
|
*
|
|
39941
39967
|
* @usage
|
|
39942
39968
|
* ```ts
|
|
39943
|
-
* await droppedAsset.
|
|
39969
|
+
* await droppedAsset.setDataObject({
|
|
39944
39970
|
* "exampleKey": "exampleValue",
|
|
39945
39971
|
* });
|
|
39946
39972
|
* const { dataObject } = droppedAsset;
|
|
39947
39973
|
* ```
|
|
39948
39974
|
*/
|
|
39949
|
-
|
|
39975
|
+
setDataObject(dataObject, options = {}) {
|
|
39950
39976
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39951
|
-
|
|
39952
|
-
const { lock = {} } = options;
|
|
39953
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
39954
|
-
this.dataObject = dataObject;
|
|
39955
|
-
}
|
|
39956
|
-
catch (error) {
|
|
39957
|
-
throw this.errorHandler({ error });
|
|
39958
|
-
}
|
|
39977
|
+
return __classPrivateFieldGet(this, _DroppedAsset_setDroppedAssetDataObject, "f").call(this, dataObject, options);
|
|
39959
39978
|
});
|
|
39960
39979
|
}
|
|
39961
39980
|
/**
|
|
@@ -39966,7 +39985,7 @@ class DroppedAsset extends Asset {
|
|
|
39966
39985
|
*
|
|
39967
39986
|
* @usage
|
|
39968
39987
|
* ```ts
|
|
39969
|
-
* await droppedAsset.
|
|
39988
|
+
* await droppedAsset.updateDataObject({
|
|
39970
39989
|
* "exampleKey": "exampleValue",
|
|
39971
39990
|
* });
|
|
39972
39991
|
* const { dataObject } = droppedAsset;
|
|
@@ -39975,16 +39994,10 @@ class DroppedAsset extends Asset {
|
|
|
39975
39994
|
// get dropped asset
|
|
39976
39995
|
updateDroppedAssetDataObject(dataObject, options = {}) {
|
|
39977
39996
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39978
|
-
|
|
39979
|
-
const { lock = {} } = options;
|
|
39980
|
-
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/assets/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
39981
|
-
this.dataObject = dataObject;
|
|
39982
|
-
}
|
|
39983
|
-
catch (error) {
|
|
39984
|
-
throw this.errorHandler({ error });
|
|
39985
|
-
}
|
|
39997
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAssetDataObject, "f").call(this, dataObject, options);
|
|
39986
39998
|
});
|
|
39987
39999
|
}
|
|
40000
|
+
// update dropped assets
|
|
39988
40001
|
/**
|
|
39989
40002
|
* @summary
|
|
39990
40003
|
* Updates broadcast options for a dropped asset.
|
|
@@ -40286,7 +40299,7 @@ class DroppedAsset extends Asset {
|
|
|
40286
40299
|
});
|
|
40287
40300
|
}
|
|
40288
40301
|
}
|
|
40289
|
-
_DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
40302
|
+
_DroppedAsset_fetchDroppedAssetDataObject = new WeakMap(), _DroppedAsset_setDroppedAssetDataObject = new WeakMap(), _DroppedAsset_updateDroppedAssetDataObject = new WeakMap(), _DroppedAsset_updateDroppedAsset = new WeakMap();
|
|
40290
40303
|
|
|
40291
40304
|
/**
|
|
40292
40305
|
* @summary
|
|
@@ -40358,8 +40371,8 @@ class World extends SDKController {
|
|
|
40358
40371
|
super(topia, options.credentials);
|
|
40359
40372
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40360
40373
|
Object.assign(this, options.attributes);
|
|
40361
|
-
__classPrivateFieldSet(this, _World_droppedAssetsMap, {}, "f");
|
|
40362
40374
|
this.urlSlug = urlSlug;
|
|
40375
|
+
__classPrivateFieldSet(this, _World_droppedAssetsMap, {}, "f");
|
|
40363
40376
|
}
|
|
40364
40377
|
get droppedAssets() {
|
|
40365
40378
|
return __classPrivateFieldGet(this, _World_droppedAssetsMap, "f");
|
|
@@ -40574,7 +40587,7 @@ class World extends SDKController {
|
|
|
40574
40587
|
}
|
|
40575
40588
|
_World_droppedAssetsMap = new WeakMap();
|
|
40576
40589
|
|
|
40577
|
-
var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
40590
|
+
var _User_assetsMap, _User_scenesMap, _User_worldsMap, _User_fetchUserDataObject, _User_setUserDataObject, _User_updateUserDataObject;
|
|
40578
40591
|
/**
|
|
40579
40592
|
* @summary
|
|
40580
40593
|
* Create an instance of User class with optional session credentials.
|
|
@@ -40586,16 +40599,54 @@ var _User_assetsMap, _User_scenesMap, _User_worldsMap;
|
|
|
40586
40599
|
*/
|
|
40587
40600
|
class User extends SDKController {
|
|
40588
40601
|
constructor(topia, options = { profileId: null, credentials: {} }) {
|
|
40589
|
-
super(topia,
|
|
40602
|
+
super(topia, options.credentials);
|
|
40590
40603
|
_User_assetsMap.set(this, void 0);
|
|
40591
40604
|
_User_scenesMap.set(this, void 0);
|
|
40592
40605
|
_User_worldsMap.set(this, void 0);
|
|
40593
|
-
|
|
40594
|
-
|
|
40595
|
-
|
|
40606
|
+
_User_fetchUserDataObject.set(this, () => __awaiter(this, void 0, void 0, function* () {
|
|
40607
|
+
try {
|
|
40608
|
+
if (!this.profileId)
|
|
40609
|
+
throw "This method requires the use of a profileId";
|
|
40610
|
+
const response = yield this.topiaPublicApi().get(`/user/dataObjects/${this.profileId}/get-data-object`, this.requestOptions);
|
|
40611
|
+
this.dataObject = response.data;
|
|
40612
|
+
return response.data;
|
|
40613
|
+
}
|
|
40614
|
+
catch (error) {
|
|
40615
|
+
throw this.errorHandler({ error });
|
|
40616
|
+
}
|
|
40617
|
+
}));
|
|
40618
|
+
_User_setUserDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
40619
|
+
try {
|
|
40620
|
+
if (!this.profileId)
|
|
40621
|
+
throw "This method requires the use of a profileId";
|
|
40622
|
+
const { lock = {} } = options;
|
|
40623
|
+
const response = yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/set-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40624
|
+
this.dataObject = response.data;
|
|
40625
|
+
return response.data;
|
|
40626
|
+
}
|
|
40627
|
+
catch (error) {
|
|
40628
|
+
throw this.errorHandler({ error });
|
|
40629
|
+
}
|
|
40630
|
+
}));
|
|
40631
|
+
_User_updateUserDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
40632
|
+
try {
|
|
40633
|
+
if (!this.profileId)
|
|
40634
|
+
throw "This method requires the use of a profileId";
|
|
40635
|
+
const { lock = {} } = options;
|
|
40636
|
+
const response = yield this.topiaPublicApi().put(`/user/dataObjects/${this.profileId}/update-data-object`, { dataObject, lock }, this.requestOptions);
|
|
40637
|
+
this.dataObject = response.data;
|
|
40638
|
+
return response.data;
|
|
40639
|
+
}
|
|
40640
|
+
catch (error) {
|
|
40641
|
+
throw this.errorHandler({ error });
|
|
40642
|
+
}
|
|
40643
|
+
}));
|
|
40596
40644
|
this.profileId = options.profileId;
|
|
40597
40645
|
this.dataObject = {};
|
|
40598
40646
|
this.profile = {};
|
|
40647
|
+
__classPrivateFieldSet(this, _User_assetsMap, {}, "f");
|
|
40648
|
+
__classPrivateFieldSet(this, _User_scenesMap, {}, "f");
|
|
40649
|
+
__classPrivateFieldSet(this, _User_worldsMap, {}, "f");
|
|
40599
40650
|
}
|
|
40600
40651
|
get assets() {
|
|
40601
40652
|
return __classPrivateFieldGet(this, _User_assetsMap, "f");
|
|
@@ -40690,58 +40741,41 @@ class User extends SDKController {
|
|
|
40690
40741
|
}
|
|
40691
40742
|
/**
|
|
40692
40743
|
* @summary
|
|
40693
|
-
* Retrieves the data object for a
|
|
40744
|
+
* Retrieves the data object for a user.
|
|
40694
40745
|
*
|
|
40695
40746
|
* @usage
|
|
40696
40747
|
* ```ts
|
|
40697
|
-
* await droppedAsset.
|
|
40748
|
+
* await droppedAsset.fetchDataObject();
|
|
40698
40749
|
* const { dataObject } = droppedAsset;
|
|
40699
40750
|
* ```
|
|
40700
40751
|
*/
|
|
40701
|
-
|
|
40752
|
+
fetchDataObject() {
|
|
40702
40753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40703
|
-
|
|
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
|
-
}
|
|
40754
|
+
return __classPrivateFieldGet(this, _User_fetchUserDataObject, "f").call(this);
|
|
40712
40755
|
});
|
|
40713
40756
|
}
|
|
40714
40757
|
/**
|
|
40715
40758
|
* @summary
|
|
40716
|
-
* Sets the data object for a
|
|
40759
|
+
* Sets the data object for a user.
|
|
40717
40760
|
*
|
|
40718
40761
|
* 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
40762
|
*
|
|
40720
40763
|
* @usage
|
|
40721
40764
|
* ```ts
|
|
40722
|
-
* await droppedAsset.
|
|
40765
|
+
* await droppedAsset.setDataObject({
|
|
40723
40766
|
* "exampleKey": "exampleValue",
|
|
40724
40767
|
* });
|
|
40725
40768
|
* const { dataObject } = droppedAsset;
|
|
40726
40769
|
* ```
|
|
40727
40770
|
*/
|
|
40728
|
-
|
|
40771
|
+
setDataObject(dataObject, options = {}) {
|
|
40729
40772
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40730
|
-
|
|
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
|
-
}
|
|
40773
|
+
return __classPrivateFieldGet(this, _User_setUserDataObject, "f").call(this, dataObject, options);
|
|
40740
40774
|
});
|
|
40741
40775
|
}
|
|
40742
40776
|
/**
|
|
40743
40777
|
* @summary
|
|
40744
|
-
* Updates the data object for a
|
|
40778
|
+
* Updates the data object for a user.
|
|
40745
40779
|
*
|
|
40746
40780
|
* 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
40781
|
*
|
|
@@ -40753,23 +40787,15 @@ class User extends SDKController {
|
|
|
40753
40787
|
* const { dataObject } = droppedAsset;
|
|
40754
40788
|
* ```
|
|
40755
40789
|
*/
|
|
40756
|
-
|
|
40790
|
+
updateDataObject(dataObject, options = {}) {
|
|
40757
40791
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40758
|
-
|
|
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
|
-
}
|
|
40792
|
+
return __classPrivateFieldGet(this, _User_updateUserDataObject, "f").call(this, dataObject, options);
|
|
40768
40793
|
});
|
|
40769
40794
|
}
|
|
40770
40795
|
}
|
|
40771
|
-
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap();
|
|
40796
|
+
_User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMap = new WeakMap(), _User_fetchUserDataObject = new WeakMap(), _User_setUserDataObject = new WeakMap(), _User_updateUserDataObject = new WeakMap();
|
|
40772
40797
|
|
|
40798
|
+
var _Visitor_fetchVisitorDataObject, _Visitor_setVisitorDataObject, _Visitor_updateVisitorDataObject;
|
|
40773
40799
|
/**
|
|
40774
40800
|
* @summary
|
|
40775
40801
|
* Create an instance of Visitor class with a given id and optional attributes and session credentials.
|
|
@@ -40782,6 +40808,38 @@ _User_assetsMap = new WeakMap(), _User_scenesMap = new WeakMap(), _User_worldsMa
|
|
|
40782
40808
|
class Visitor extends User {
|
|
40783
40809
|
constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40784
40810
|
super(topia, { credentials: options.credentials });
|
|
40811
|
+
_Visitor_fetchVisitorDataObject.set(this, () => __awaiter(this, void 0, void 0, function* () {
|
|
40812
|
+
try {
|
|
40813
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
|
|
40814
|
+
this.dataObject = response.data;
|
|
40815
|
+
return response.data;
|
|
40816
|
+
}
|
|
40817
|
+
catch (error) {
|
|
40818
|
+
throw this.errorHandler({ error });
|
|
40819
|
+
}
|
|
40820
|
+
}));
|
|
40821
|
+
_Visitor_setVisitorDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
40822
|
+
try {
|
|
40823
|
+
const { lock = {} } = options;
|
|
40824
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
|
|
40825
|
+
this.dataObject = response.data;
|
|
40826
|
+
return response.data;
|
|
40827
|
+
}
|
|
40828
|
+
catch (error) {
|
|
40829
|
+
throw this.errorHandler({ error });
|
|
40830
|
+
}
|
|
40831
|
+
}));
|
|
40832
|
+
_Visitor_updateVisitorDataObject.set(this, (dataObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
40833
|
+
try {
|
|
40834
|
+
const { lock = {} } = options;
|
|
40835
|
+
const response = yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject: dataObject || this.dataObject, lock }, this.requestOptions);
|
|
40836
|
+
this.dataObject = response.data;
|
|
40837
|
+
return response.data;
|
|
40838
|
+
}
|
|
40839
|
+
catch (error) {
|
|
40840
|
+
throw this.errorHandler({ error });
|
|
40841
|
+
}
|
|
40842
|
+
}));
|
|
40785
40843
|
Object.assign(this, options.attributes);
|
|
40786
40844
|
this.id = id;
|
|
40787
40845
|
this.urlSlug = urlSlug;
|
|
@@ -40854,25 +40912,73 @@ class Visitor extends User {
|
|
|
40854
40912
|
}
|
|
40855
40913
|
/**
|
|
40856
40914
|
* @summary
|
|
40857
|
-
*
|
|
40915
|
+
* Display a message via a toast to a visitor currently in a world.
|
|
40858
40916
|
*
|
|
40859
40917
|
* @usage
|
|
40860
40918
|
* ```ts
|
|
40861
|
-
* await
|
|
40862
|
-
*
|
|
40919
|
+
* await visitor.fireToast({
|
|
40920
|
+
* groupId: "custom-message",
|
|
40921
|
+
* title: "Hello World",
|
|
40922
|
+
* text: "Thank you for participating!",
|
|
40923
|
+
* });
|
|
40863
40924
|
* ```
|
|
40864
40925
|
*/
|
|
40865
|
-
|
|
40926
|
+
fireToast({ groupId, title, text }) {
|
|
40866
40927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40867
40928
|
try {
|
|
40868
|
-
|
|
40869
|
-
|
|
40929
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/fire-toast`, {
|
|
40930
|
+
groupId,
|
|
40931
|
+
title,
|
|
40932
|
+
text,
|
|
40933
|
+
}, this.requestOptions);
|
|
40934
|
+
}
|
|
40935
|
+
catch (error) {
|
|
40936
|
+
throw this.errorHandler({ error });
|
|
40937
|
+
}
|
|
40938
|
+
});
|
|
40939
|
+
}
|
|
40940
|
+
/**
|
|
40941
|
+
* @summary
|
|
40942
|
+
* Open an iframe in a drawer or modal for a visitor currently in a world.
|
|
40943
|
+
*
|
|
40944
|
+
* @usage
|
|
40945
|
+
* ```ts
|
|
40946
|
+
* await visitor.openIframe({
|
|
40947
|
+
* link: "https://topia.io",
|
|
40948
|
+
* shouldOpenInDrawer: true,
|
|
40949
|
+
* title: "Hello World",
|
|
40950
|
+
* });
|
|
40951
|
+
* ```
|
|
40952
|
+
*/
|
|
40953
|
+
openIframe({ link, shouldOpenInDrawer, title }) {
|
|
40954
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40955
|
+
try {
|
|
40956
|
+
yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/open-iframe`, {
|
|
40957
|
+
link,
|
|
40958
|
+
shouldOpenInDrawer,
|
|
40959
|
+
title,
|
|
40960
|
+
}, this.requestOptions);
|
|
40870
40961
|
}
|
|
40871
40962
|
catch (error) {
|
|
40872
40963
|
throw this.errorHandler({ error });
|
|
40873
40964
|
}
|
|
40874
40965
|
});
|
|
40875
40966
|
}
|
|
40967
|
+
/**
|
|
40968
|
+
* @summary
|
|
40969
|
+
* Retrieves the data object for a visitor.
|
|
40970
|
+
*
|
|
40971
|
+
* @usage
|
|
40972
|
+
* ```ts
|
|
40973
|
+
* await droppedAsset.fetchVisitorDataObject();
|
|
40974
|
+
* const { dataObject } = droppedAsset;
|
|
40975
|
+
* ```
|
|
40976
|
+
*/
|
|
40977
|
+
fetchDataObject() {
|
|
40978
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40979
|
+
return __classPrivateFieldGet(this, _Visitor_fetchVisitorDataObject, "f").call(this);
|
|
40980
|
+
});
|
|
40981
|
+
}
|
|
40876
40982
|
/**
|
|
40877
40983
|
* @summary
|
|
40878
40984
|
* Sets the data object for a visitor.
|
|
@@ -40887,16 +40993,9 @@ class Visitor extends User {
|
|
|
40887
40993
|
* const { dataObject } = droppedAsset;
|
|
40888
40994
|
* ```
|
|
40889
40995
|
*/
|
|
40890
|
-
|
|
40996
|
+
setDataObject(dataObject, options = {}) {
|
|
40891
40997
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40892
|
-
|
|
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
|
-
}
|
|
40998
|
+
return __classPrivateFieldGet(this, _Visitor_setVisitorDataObject, "f").call(this, dataObject, options);
|
|
40900
40999
|
});
|
|
40901
41000
|
}
|
|
40902
41001
|
/**
|
|
@@ -40913,19 +41012,13 @@ class Visitor extends User {
|
|
|
40913
41012
|
* const { dataObject } = droppedAsset;
|
|
40914
41013
|
* ```
|
|
40915
41014
|
*/
|
|
40916
|
-
|
|
41015
|
+
updateDataObject(dataObject, options = {}) {
|
|
40917
41016
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40918
|
-
|
|
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
|
-
}
|
|
41017
|
+
return __classPrivateFieldGet(this, _Visitor_updateVisitorDataObject, "f").call(this, dataObject, options);
|
|
40926
41018
|
});
|
|
40927
41019
|
}
|
|
40928
|
-
}
|
|
41020
|
+
}
|
|
41021
|
+
_Visitor_fetchVisitorDataObject = new WeakMap(), _Visitor_setVisitorDataObject = new WeakMap(), _Visitor_updateVisitorDataObject = new WeakMap();
|
|
40929
41022
|
|
|
40930
41023
|
var _WorldActivity_visitorsMap;
|
|
40931
41024
|
/**
|
|
@@ -40943,8 +41036,8 @@ class WorldActivity extends SDKController {
|
|
|
40943
41036
|
constructor(topia, urlSlug, options = { credentials: {} }) {
|
|
40944
41037
|
super(topia, options.credentials);
|
|
40945
41038
|
_WorldActivity_visitorsMap.set(this, void 0);
|
|
40946
|
-
__classPrivateFieldSet(this, _WorldActivity_visitorsMap, {}, "f");
|
|
40947
41039
|
this.urlSlug = urlSlug;
|
|
41040
|
+
__classPrivateFieldSet(this, _WorldActivity_visitorsMap, {}, "f");
|
|
40948
41041
|
}
|
|
40949
41042
|
get visitors() {
|
|
40950
41043
|
return __classPrivateFieldGet(this, _WorldActivity_visitorsMap, "f");
|
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"jsonwebtoken": "^9.0.0",
|
|
23
23
|
"prettier": "^2.7.1",
|
|
24
24
|
"rollup": "^3.4.0",
|
|
25
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
25
26
|
"rollup-plugin-license": "^3.0.1",
|
|
26
27
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
27
28
|
"ts-jest": "^29.0.3",
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
"yalc": "^1.0.0-pre.53"
|
|
31
32
|
},
|
|
32
33
|
"files": [
|
|
33
|
-
"dist
|
|
34
|
+
"dist/index.cjs",
|
|
35
|
+
"dist/index.d.ts"
|
|
34
36
|
],
|
|
35
37
|
"gitHead": "7eef1f7fd9b3b0af395f95cb908add3011abf808",
|
|
36
38
|
"homepage": "https://github.com/metaversecloud-com/mc-sdk-js/tree/main/clients/client-topia",
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
"keywords": [],
|
|
39
41
|
"name": "@rtsdk/topia",
|
|
40
42
|
"main": "dist/index.js",
|
|
43
|
+
"types": "dist/index.d.ts",
|
|
41
44
|
"publishConfig": {
|
|
42
45
|
"access": "public",
|
|
43
46
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -56,5 +59,5 @@
|
|
|
56
59
|
"local-publish": "yarn build && yalc publish --push --no-scripts"
|
|
57
60
|
},
|
|
58
61
|
"type": "module",
|
|
59
|
-
"version": "0.2.
|
|
62
|
+
"version": "0.2.4"
|
|
60
63
|
}
|
package/dist/types/example.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
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
|
-
}[];
|