@rtsdk/topia 0.3.8 → 0.4.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/README.md +16 -2
- package/dist/index.cjs +50 -6
- package/dist/index.d.ts +37 -3
- package/dist/index.js +50 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,8 +10,22 @@ A Topia provided API Key can be included with every object initialization as a p
|
|
|
10
10
|
|
|
11
11
|
### Want to build interactive assets? This is how you can get started:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Getting a Key Pair:
|
|
14
|
+
|
|
15
|
+
- Navigate directly to your [integrations page](https://topia.io/t/dashboard/integrations) or follow the steps below from within a world.
|
|
16
|
+
- Click on your image (or circle) at the top left of the left hand navbar.
|
|
17
|
+
- Click Edit Profile. This will bring you to a separate dashboard.
|
|
18
|
+
- Click Integrations on the left nav
|
|
19
|
+
- Click the “Add Key Pair” button. This is going to be your public / private key pair for your app.
|
|
20
|
+
|
|
21
|
+
Adding a Key Pair to an asset:
|
|
22
|
+
|
|
23
|
+
Make an asset “interactive” by adding your PUBLIC key to the integrations page of the asset editor.
|
|
24
|
+
|
|
25
|
+
- Go back to your world. Make sure you are in “Edit Mode” by toggling on Edit on the left nav bar
|
|
26
|
+
- Hover over any asset. Click the pencil icon that should show up on hover and select “Edit”
|
|
27
|
+
- Go to the Integrations tab
|
|
28
|
+
- At the bottom, you'll see a section that says “Add player session credentials to asset interactions”. Toggle that on. Now webhooks that fire from this asset and iframes that open from this asset will include the following values:
|
|
15
29
|
- assetId
|
|
16
30
|
- interactivePublicKey
|
|
17
31
|
- interactiveNonce
|
package/dist/index.cjs
CHANGED
|
@@ -39637,14 +39637,14 @@ const {
|
|
|
39637
39637
|
*/
|
|
39638
39638
|
class SDKController {
|
|
39639
39639
|
constructor(topia, credentials = {}) {
|
|
39640
|
-
const { apiKey = null, assetId = null, interactiveNonce = null, profileId = null, visitorId = null } = credentials;
|
|
39640
|
+
const { apiKey = null, assetId = null, interactiveNonce = null, profileId = null, urlSlug = null, visitorId = null, } = credentials;
|
|
39641
39641
|
this.topia = topia;
|
|
39642
39642
|
this.credentials = credentials;
|
|
39643
39643
|
this.requestOptions = {};
|
|
39644
39644
|
let payload = {};
|
|
39645
39645
|
const headers = {};
|
|
39646
39646
|
try {
|
|
39647
|
-
if (topia.interactiveSecret && (profileId || assetId)) {
|
|
39647
|
+
if (topia.interactiveSecret && (profileId || assetId || urlSlug)) {
|
|
39648
39648
|
payload = {
|
|
39649
39649
|
interactiveNonce,
|
|
39650
39650
|
visitorId,
|
|
@@ -40049,9 +40049,9 @@ class DroppedAsset extends Asset {
|
|
|
40049
40049
|
* await droppedAsset.updatePosition(100,200);
|
|
40050
40050
|
* ```
|
|
40051
40051
|
*/
|
|
40052
|
-
updatePosition(x, y) {
|
|
40052
|
+
updatePosition(x, y, yOrderAdjust) {
|
|
40053
40053
|
try {
|
|
40054
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { x, y }, "set-position");
|
|
40054
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { x, y, yOrderAdjust }, "set-position");
|
|
40055
40055
|
}
|
|
40056
40056
|
catch (error) {
|
|
40057
40057
|
throw this.errorHandler({ error });
|
|
@@ -40267,7 +40267,7 @@ var _World_droppedAssetsMap;
|
|
|
40267
40267
|
*/
|
|
40268
40268
|
class World extends SDKController {
|
|
40269
40269
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40270
|
-
super(topia, options.credentials);
|
|
40270
|
+
super(topia, Object.assign({ urlSlug }, options.credentials));
|
|
40271
40271
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40272
40272
|
////////// data objects
|
|
40273
40273
|
/**
|
|
@@ -40534,6 +40534,8 @@ class World extends SDKController {
|
|
|
40534
40534
|
});
|
|
40535
40535
|
}
|
|
40536
40536
|
/**
|
|
40537
|
+
* @deprecated Use {@link fetchScenes} instead.
|
|
40538
|
+
*
|
|
40537
40539
|
* @summary
|
|
40538
40540
|
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
40539
40541
|
*
|
|
@@ -40559,6 +40561,46 @@ class World extends SDKController {
|
|
|
40559
40561
|
}
|
|
40560
40562
|
});
|
|
40561
40563
|
}
|
|
40564
|
+
/**
|
|
40565
|
+
* @summary
|
|
40566
|
+
* Fetch a list of all scene drop ids and dropped assets in a world
|
|
40567
|
+
*
|
|
40568
|
+
* @usage
|
|
40569
|
+
* ```ts
|
|
40570
|
+
* await world.fetchScenes();
|
|
40571
|
+
* ```
|
|
40572
|
+
*
|
|
40573
|
+
* @result
|
|
40574
|
+
* ```ts
|
|
40575
|
+
* { "scenes": {
|
|
40576
|
+
* "sceneDropId_1": {
|
|
40577
|
+
* "droppedAssets": {
|
|
40578
|
+
* "droppedAssetId_1": {
|
|
40579
|
+
* "metaName": "hello"
|
|
40580
|
+
* "metaNameReversed": "olleh"
|
|
40581
|
+
* },
|
|
40582
|
+
* "droppedAssetId_2": {
|
|
40583
|
+
* "metaName": "world"
|
|
40584
|
+
* "metaNameReversed": "dlorw"
|
|
40585
|
+
* }
|
|
40586
|
+
* }
|
|
40587
|
+
* },
|
|
40588
|
+
* }
|
|
40589
|
+
* }
|
|
40590
|
+
* ```
|
|
40591
|
+
*/
|
|
40592
|
+
fetchScenes() {
|
|
40593
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40594
|
+
try {
|
|
40595
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/scenes-with-dropped-assets`, this.requestOptions);
|
|
40596
|
+
this.scenes = response.data;
|
|
40597
|
+
return response.data;
|
|
40598
|
+
}
|
|
40599
|
+
catch (error) {
|
|
40600
|
+
throw this.errorHandler({ error });
|
|
40601
|
+
}
|
|
40602
|
+
});
|
|
40603
|
+
}
|
|
40562
40604
|
/**
|
|
40563
40605
|
* @summary
|
|
40564
40606
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -41393,14 +41435,16 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41393
41435
|
return droppedAsset;
|
|
41394
41436
|
});
|
|
41395
41437
|
}
|
|
41396
|
-
drop(asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }) {
|
|
41438
|
+
drop(asset, { interactivePublicKey, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41397
41439
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41398
41440
|
try {
|
|
41399
41441
|
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41400
41442
|
assetId: asset.id,
|
|
41401
41443
|
interactivePublicKey,
|
|
41402
41444
|
position: { x, y },
|
|
41445
|
+
sceneDropId,
|
|
41403
41446
|
uniqueName,
|
|
41447
|
+
yOrderAdjust,
|
|
41404
41448
|
}, asset.requestOptions);
|
|
41405
41449
|
const { id } = response.data;
|
|
41406
41450
|
return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
|
package/dist/index.d.ts
CHANGED
|
@@ -270,7 +270,7 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
|
270
270
|
* await droppedAsset.updatePosition(100,200);
|
|
271
271
|
* ```
|
|
272
272
|
*/
|
|
273
|
-
updatePosition(x: number, y: number): Promise<void | ResponseType>;
|
|
273
|
+
updatePosition(x: number, y: number, yOrderAdjust?: number): Promise<void | ResponseType>;
|
|
274
274
|
/**
|
|
275
275
|
* @summary
|
|
276
276
|
* Updates private zone options for a dropped asset.
|
|
@@ -374,6 +374,7 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
374
374
|
urlSlug: string;
|
|
375
375
|
dataObject?: object | null | undefined;
|
|
376
376
|
sceneDropIds?: [string] | null | undefined;
|
|
377
|
+
scenes?: [string] | null | undefined;
|
|
377
378
|
webhooks?: WorldWebhooksInterface | null | undefined;
|
|
378
379
|
constructor(topia: Topia, urlSlug: string, options?: WorldOptionalInterface);
|
|
379
380
|
get droppedAssets(): {
|
|
@@ -478,6 +479,8 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
478
479
|
*/
|
|
479
480
|
updateCustomTextDroppedAssets(droppedAssetsToUpdate: Array<DroppedAsset>, style: object): Promise<object>;
|
|
480
481
|
/**
|
|
482
|
+
* @deprecated Use {@link fetchScenes} instead.
|
|
483
|
+
*
|
|
481
484
|
* @summary
|
|
482
485
|
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
483
486
|
*
|
|
@@ -492,6 +495,35 @@ declare class World extends SDKController implements WorldInterface {
|
|
|
492
495
|
* ```
|
|
493
496
|
*/
|
|
494
497
|
fetchSceneDropIds(): Promise<object | ResponseType>;
|
|
498
|
+
/**
|
|
499
|
+
* @summary
|
|
500
|
+
* Fetch a list of all scene drop ids and dropped assets in a world
|
|
501
|
+
*
|
|
502
|
+
* @usage
|
|
503
|
+
* ```ts
|
|
504
|
+
* await world.fetchScenes();
|
|
505
|
+
* ```
|
|
506
|
+
*
|
|
507
|
+
* @result
|
|
508
|
+
* ```ts
|
|
509
|
+
* { "scenes": {
|
|
510
|
+
* "sceneDropId_1": {
|
|
511
|
+
* "droppedAssets": {
|
|
512
|
+
* "droppedAssetId_1": {
|
|
513
|
+
* "metaName": "hello"
|
|
514
|
+
* "metaNameReversed": "olleh"
|
|
515
|
+
* },
|
|
516
|
+
* "droppedAssetId_2": {
|
|
517
|
+
* "metaName": "world"
|
|
518
|
+
* "metaNameReversed": "dlorw"
|
|
519
|
+
* }
|
|
520
|
+
* }
|
|
521
|
+
* },
|
|
522
|
+
* }
|
|
523
|
+
* }
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
fetchScenes(): Promise<object | ResponseType>;
|
|
495
527
|
/**
|
|
496
528
|
* @summary
|
|
497
529
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -999,7 +1031,7 @@ interface DroppedAssetInterface extends AssetInterface {
|
|
|
999
1031
|
updateMediaType({ audioRadius, audioSliderVolume, isVideo, mediaLink, mediaName, mediaType, portalName, syncUserMedia, }: UpdateMediaTypeInterface): Promise<void | ResponseType>;
|
|
1000
1032
|
updateMuteZone(isMutezone: boolean): Promise<void | ResponseType>;
|
|
1001
1033
|
updateWebhookZone(isWebhookZoneEnabled: boolean): Promise<void | ResponseType>;
|
|
1002
|
-
updatePosition(x: number, y: number): Promise<void | ResponseType>;
|
|
1034
|
+
updatePosition(x: number, y: number, yOrderAdjust: number): Promise<void | ResponseType>;
|
|
1003
1035
|
updatePrivateZone({ isPrivateZone, isPrivateZoneChatDisabled, privateZoneUserCap, }: UpdatePrivateZoneInterface): Promise<void | ResponseType>;
|
|
1004
1036
|
updateScale(assetScale: number): Promise<void | ResponseType>;
|
|
1005
1037
|
updateUploadedMediaSelected(mediaId: string): Promise<void | ResponseType>;
|
|
@@ -1485,14 +1517,16 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
1485
1517
|
constructor(topia: Topia);
|
|
1486
1518
|
create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
|
|
1487
1519
|
get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
|
|
1488
|
-
drop(asset: Asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }: {
|
|
1520
|
+
drop(asset: Asset, { interactivePublicKey, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }: {
|
|
1489
1521
|
interactivePublicKey?: string;
|
|
1490
1522
|
position: {
|
|
1491
1523
|
x: number;
|
|
1492
1524
|
y: number;
|
|
1493
1525
|
};
|
|
1526
|
+
sceneDropId?: string;
|
|
1494
1527
|
uniqueName?: string;
|
|
1495
1528
|
urlSlug: string;
|
|
1529
|
+
yOrderAdjust?: number;
|
|
1496
1530
|
}): Promise<DroppedAsset>;
|
|
1497
1531
|
}
|
|
1498
1532
|
|
package/dist/index.js
CHANGED
|
@@ -39635,14 +39635,14 @@ const {
|
|
|
39635
39635
|
*/
|
|
39636
39636
|
class SDKController {
|
|
39637
39637
|
constructor(topia, credentials = {}) {
|
|
39638
|
-
const { apiKey = null, assetId = null, interactiveNonce = null, profileId = null, visitorId = null } = credentials;
|
|
39638
|
+
const { apiKey = null, assetId = null, interactiveNonce = null, profileId = null, urlSlug = null, visitorId = null, } = credentials;
|
|
39639
39639
|
this.topia = topia;
|
|
39640
39640
|
this.credentials = credentials;
|
|
39641
39641
|
this.requestOptions = {};
|
|
39642
39642
|
let payload = {};
|
|
39643
39643
|
const headers = {};
|
|
39644
39644
|
try {
|
|
39645
|
-
if (topia.interactiveSecret && (profileId || assetId)) {
|
|
39645
|
+
if (topia.interactiveSecret && (profileId || assetId || urlSlug)) {
|
|
39646
39646
|
payload = {
|
|
39647
39647
|
interactiveNonce,
|
|
39648
39648
|
visitorId,
|
|
@@ -40047,9 +40047,9 @@ class DroppedAsset extends Asset {
|
|
|
40047
40047
|
* await droppedAsset.updatePosition(100,200);
|
|
40048
40048
|
* ```
|
|
40049
40049
|
*/
|
|
40050
|
-
updatePosition(x, y) {
|
|
40050
|
+
updatePosition(x, y, yOrderAdjust) {
|
|
40051
40051
|
try {
|
|
40052
|
-
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { x, y }, "set-position");
|
|
40052
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, { x, y, yOrderAdjust }, "set-position");
|
|
40053
40053
|
}
|
|
40054
40054
|
catch (error) {
|
|
40055
40055
|
throw this.errorHandler({ error });
|
|
@@ -40265,7 +40265,7 @@ var _World_droppedAssetsMap;
|
|
|
40265
40265
|
*/
|
|
40266
40266
|
class World extends SDKController {
|
|
40267
40267
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40268
|
-
super(topia, options.credentials);
|
|
40268
|
+
super(topia, Object.assign({ urlSlug }, options.credentials));
|
|
40269
40269
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40270
40270
|
////////// data objects
|
|
40271
40271
|
/**
|
|
@@ -40532,6 +40532,8 @@ class World extends SDKController {
|
|
|
40532
40532
|
});
|
|
40533
40533
|
}
|
|
40534
40534
|
/**
|
|
40535
|
+
* @deprecated Use {@link fetchScenes} instead.
|
|
40536
|
+
*
|
|
40535
40537
|
* @summary
|
|
40536
40538
|
* Fetch a list of all scene drop ids in a world that include at least one asset with an interactivePublicKey
|
|
40537
40539
|
*
|
|
@@ -40557,6 +40559,46 @@ class World extends SDKController {
|
|
|
40557
40559
|
}
|
|
40558
40560
|
});
|
|
40559
40561
|
}
|
|
40562
|
+
/**
|
|
40563
|
+
* @summary
|
|
40564
|
+
* Fetch a list of all scene drop ids and dropped assets in a world
|
|
40565
|
+
*
|
|
40566
|
+
* @usage
|
|
40567
|
+
* ```ts
|
|
40568
|
+
* await world.fetchScenes();
|
|
40569
|
+
* ```
|
|
40570
|
+
*
|
|
40571
|
+
* @result
|
|
40572
|
+
* ```ts
|
|
40573
|
+
* { "scenes": {
|
|
40574
|
+
* "sceneDropId_1": {
|
|
40575
|
+
* "droppedAssets": {
|
|
40576
|
+
* "droppedAssetId_1": {
|
|
40577
|
+
* "metaName": "hello"
|
|
40578
|
+
* "metaNameReversed": "olleh"
|
|
40579
|
+
* },
|
|
40580
|
+
* "droppedAssetId_2": {
|
|
40581
|
+
* "metaName": "world"
|
|
40582
|
+
* "metaNameReversed": "dlorw"
|
|
40583
|
+
* }
|
|
40584
|
+
* }
|
|
40585
|
+
* },
|
|
40586
|
+
* }
|
|
40587
|
+
* }
|
|
40588
|
+
* ```
|
|
40589
|
+
*/
|
|
40590
|
+
fetchScenes() {
|
|
40591
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40592
|
+
try {
|
|
40593
|
+
const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/scenes-with-dropped-assets`, this.requestOptions);
|
|
40594
|
+
this.scenes = response.data;
|
|
40595
|
+
return response.data;
|
|
40596
|
+
}
|
|
40597
|
+
catch (error) {
|
|
40598
|
+
throw this.errorHandler({ error });
|
|
40599
|
+
}
|
|
40600
|
+
});
|
|
40601
|
+
}
|
|
40560
40602
|
/**
|
|
40561
40603
|
* @summary
|
|
40562
40604
|
* Drops a scene in a world and returns sceneDropId.
|
|
@@ -41391,14 +41433,16 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41391
41433
|
return droppedAsset;
|
|
41392
41434
|
});
|
|
41393
41435
|
}
|
|
41394
|
-
drop(asset, { interactivePublicKey, position: { x, y }, uniqueName, urlSlug, }) {
|
|
41436
|
+
drop(asset, { interactivePublicKey, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41395
41437
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41396
41438
|
try {
|
|
41397
41439
|
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41398
41440
|
assetId: asset.id,
|
|
41399
41441
|
interactivePublicKey,
|
|
41400
41442
|
position: { x, y },
|
|
41443
|
+
sceneDropId,
|
|
41401
41444
|
uniqueName,
|
|
41445
|
+
yOrderAdjust,
|
|
41402
41446
|
}, asset.requestOptions);
|
|
41403
41447
|
const { id } = response.data;
|
|
41404
41448
|
return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
|
package/package.json
CHANGED