@rtsdk/topia 0.7.1 → 0.8.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 +1 -1
- package/dist/index.cjs +57 -26
- package/dist/index.d.ts +27 -8
- package/dist/index.js +57 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Javascript RTSDK - Topia Client Library
|
|
2
2
|
|
|
3
|
-
The Topia Client Library leverages the Topia Public API and allows users to interact with the topia systems and modify their world programmatically. With the SDK you can now build new features to be used in Topia! Check out a list of examples [here](https://github.com/metaversecloud-com/sdk-examples).
|
|
3
|
+
The Topia Client Library leverages the Topia Public API and allows users to interact with the topia systems and modify their world programmatically. With the SDK you can now build new features to be used in Topia! Check out a list of examples [here](https://github.com/metaversecloud-com/sdk-examples). Questions, comments, or have something exciting to share with the Topia team? Reach out to [developers@topia.io](mailto:developers@topia.io)!
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -39758,7 +39758,7 @@ var _DroppedAsset_updateDroppedAsset;
|
|
|
39758
39758
|
class DroppedAsset extends Asset {
|
|
39759
39759
|
constructor(topia, id, urlSlug, options = { attributes: { text: "" }, credentials: {} }) {
|
|
39760
39760
|
var _a;
|
|
39761
|
-
super(topia, id, { attributes: options.attributes, credentials: Object.assign(
|
|
39761
|
+
super(topia, id, { attributes: options.attributes, credentials: Object.assign({ assetId: id, urlSlug }, options.credentials) });
|
|
39762
39762
|
// private methods
|
|
39763
39763
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39764
39764
|
try {
|
|
@@ -40130,6 +40130,23 @@ class DroppedAsset extends Asset {
|
|
|
40130
40130
|
throw this.errorHandler({ error, params: { assetScale }, sdkMethod: "DroppedAsset.updateScale" });
|
|
40131
40131
|
}
|
|
40132
40132
|
}
|
|
40133
|
+
/**
|
|
40134
|
+
* @summary
|
|
40135
|
+
* Flip an dropped asset.
|
|
40136
|
+
*
|
|
40137
|
+
* @usage
|
|
40138
|
+
* ```ts
|
|
40139
|
+
* await droppedAsset.flip(.5);
|
|
40140
|
+
* ```
|
|
40141
|
+
*/
|
|
40142
|
+
flip() {
|
|
40143
|
+
try {
|
|
40144
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {}, "flip");
|
|
40145
|
+
}
|
|
40146
|
+
catch (error) {
|
|
40147
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "DroppedAsset.flip" });
|
|
40148
|
+
}
|
|
40149
|
+
}
|
|
40133
40150
|
/**
|
|
40134
40151
|
* @summary
|
|
40135
40152
|
* Change or remove media embedded in a dropped asset.
|
|
@@ -40353,12 +40370,12 @@ var _World_droppedAssetsMap;
|
|
|
40353
40370
|
*/
|
|
40354
40371
|
class World extends SDKController {
|
|
40355
40372
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40356
|
-
var _a, _b, _c;
|
|
40373
|
+
var _a, _b, _c, _d;
|
|
40357
40374
|
super(topia, {
|
|
40358
40375
|
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40359
40376
|
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40360
|
-
urlSlug,
|
|
40361
|
-
visitorId: (
|
|
40377
|
+
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
40378
|
+
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40362
40379
|
});
|
|
40363
40380
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40364
40381
|
////////// data objects
|
|
@@ -41149,7 +41166,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
|
|
|
41149
41166
|
*/
|
|
41150
41167
|
class Visitor extends User {
|
|
41151
41168
|
constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
41152
|
-
super(topia, { credentials: Object.assign(
|
|
41169
|
+
super(topia, { credentials: Object.assign({ urlSlug }, options.credentials) });
|
|
41153
41170
|
Object.assign(this, options.attributes);
|
|
41154
41171
|
this.id = id;
|
|
41155
41172
|
this.urlSlug = urlSlug;
|
|
@@ -41480,12 +41497,12 @@ var _WorldActivity_visitorsMap;
|
|
|
41480
41497
|
*/
|
|
41481
41498
|
class WorldActivity extends SDKController {
|
|
41482
41499
|
constructor(topia, urlSlug, options = { credentials: {} }) {
|
|
41483
|
-
var _a, _b, _c;
|
|
41500
|
+
var _a, _b, _c, _d;
|
|
41484
41501
|
super(topia, {
|
|
41485
41502
|
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
41486
41503
|
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
41487
|
-
urlSlug,
|
|
41488
|
-
visitorId: (
|
|
41504
|
+
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
41505
|
+
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
41489
41506
|
});
|
|
41490
41507
|
_WorldActivity_visitorsMap.set(this, void 0);
|
|
41491
41508
|
this.urlSlug = urlSlug;
|
|
@@ -41520,7 +41537,7 @@ class WorldActivity extends SDKController {
|
|
|
41520
41537
|
*
|
|
41521
41538
|
* @usage
|
|
41522
41539
|
* ```ts
|
|
41523
|
-
* const visitors = await
|
|
41540
|
+
* const visitors = await worldActivity.currentVisitors();
|
|
41524
41541
|
* ```
|
|
41525
41542
|
*/
|
|
41526
41543
|
currentVisitors() {
|
|
@@ -41542,7 +41559,7 @@ class WorldActivity extends SDKController {
|
|
|
41542
41559
|
*
|
|
41543
41560
|
* @usage
|
|
41544
41561
|
* ```ts
|
|
41545
|
-
* await
|
|
41562
|
+
* await worldActivity.moveAllVisitors({
|
|
41546
41563
|
* shouldFetchVisitors: true,
|
|
41547
41564
|
* shouldTeleportVisitors: true,
|
|
41548
41565
|
* scatterVisitorsBy: 40,
|
|
@@ -41552,7 +41569,7 @@ class WorldActivity extends SDKController {
|
|
|
41552
41569
|
* ```
|
|
41553
41570
|
*
|
|
41554
41571
|
* @result
|
|
41555
|
-
* Updates each Visitor instance and
|
|
41572
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
41556
41573
|
*/
|
|
41557
41574
|
moveAllVisitors({ shouldFetchVisitors = true, shouldTeleportVisitors = true, scatterVisitorsBy = 0, x, y, }) {
|
|
41558
41575
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41579,22 +41596,22 @@ class WorldActivity extends SDKController {
|
|
|
41579
41596
|
* ```ts
|
|
41580
41597
|
* const visitorsToMove = [
|
|
41581
41598
|
* {
|
|
41582
|
-
* visitorObj:
|
|
41599
|
+
* visitorObj: worldActivity.visitors["1"],
|
|
41583
41600
|
* shouldTeleportVisitor: true,
|
|
41584
41601
|
* x: 100,
|
|
41585
41602
|
* y: 100
|
|
41586
41603
|
* }, {
|
|
41587
|
-
* visitorObj:
|
|
41604
|
+
* visitorObj: worldActivity.visitors["2"],
|
|
41588
41605
|
* shouldTeleportVisitor: false,
|
|
41589
41606
|
* x: 100,
|
|
41590
41607
|
* y: 100
|
|
41591
41608
|
* }
|
|
41592
41609
|
* ];
|
|
41593
|
-
* await
|
|
41610
|
+
* await worldActivity.moveVisitors(visitorsToMove);
|
|
41594
41611
|
* ```
|
|
41595
41612
|
*
|
|
41596
41613
|
* @result
|
|
41597
|
-
* Updates each Visitor instance and
|
|
41614
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
41598
41615
|
*/
|
|
41599
41616
|
moveVisitors(visitorsToMove) {
|
|
41600
41617
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41683,9 +41700,31 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41683
41700
|
}
|
|
41684
41701
|
});
|
|
41685
41702
|
}
|
|
41686
|
-
drop(asset, { interactivePublicKey, isInteractive, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41703
|
+
drop(asset, { assetScale, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41687
41704
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41688
|
-
|
|
41705
|
+
let specialType;
|
|
41706
|
+
if (layer0 || layer1)
|
|
41707
|
+
specialType = "webImage";
|
|
41708
|
+
else if (text)
|
|
41709
|
+
specialType = "text";
|
|
41710
|
+
const params = {
|
|
41711
|
+
assetScale,
|
|
41712
|
+
flipped,
|
|
41713
|
+
layer0,
|
|
41714
|
+
layer1,
|
|
41715
|
+
interactivePublicKey,
|
|
41716
|
+
isInteractive,
|
|
41717
|
+
sceneDropId,
|
|
41718
|
+
specialType,
|
|
41719
|
+
text,
|
|
41720
|
+
textColor,
|
|
41721
|
+
textSize,
|
|
41722
|
+
textWeight,
|
|
41723
|
+
textWidth,
|
|
41724
|
+
uniqueName,
|
|
41725
|
+
urlSlug,
|
|
41726
|
+
yOrderAdjust,
|
|
41727
|
+
};
|
|
41689
41728
|
if (isInteractive && !interactivePublicKey) {
|
|
41690
41729
|
throw this.errorHandler({
|
|
41691
41730
|
message: "interactivePublicKey is required",
|
|
@@ -41694,15 +41733,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41694
41733
|
});
|
|
41695
41734
|
}
|
|
41696
41735
|
try {
|
|
41697
|
-
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41698
|
-
assetId: asset.id,
|
|
41699
|
-
interactivePublicKey,
|
|
41700
|
-
isInteractive,
|
|
41701
|
-
position: { x, y },
|
|
41702
|
-
sceneDropId,
|
|
41703
|
-
uniqueName,
|
|
41704
|
-
yOrderAdjust,
|
|
41705
|
-
}, asset.requestOptions);
|
|
41736
|
+
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, Object.assign(Object.assign({}, params), { assetId: asset.id, position: { x, y } }), asset.requestOptions);
|
|
41706
41737
|
const { id } = response.data;
|
|
41707
41738
|
return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
|
|
41708
41739
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -302,6 +302,16 @@ declare class DroppedAsset extends Asset implements DroppedAssetInterface {
|
|
|
302
302
|
* ```
|
|
303
303
|
*/
|
|
304
304
|
updateScale(assetScale: number): Promise<void | ResponseType>;
|
|
305
|
+
/**
|
|
306
|
+
* @summary
|
|
307
|
+
* Flip an dropped asset.
|
|
308
|
+
*
|
|
309
|
+
* @usage
|
|
310
|
+
* ```ts
|
|
311
|
+
* await droppedAsset.flip(.5);
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
flip(): Promise<void | ResponseType>;
|
|
305
315
|
/**
|
|
306
316
|
* @summary
|
|
307
317
|
* Change or remove media embedded in a dropped asset.
|
|
@@ -1551,7 +1561,7 @@ declare class WorldActivity extends SDKController {
|
|
|
1551
1561
|
*
|
|
1552
1562
|
* @usage
|
|
1553
1563
|
* ```ts
|
|
1554
|
-
* const visitors = await
|
|
1564
|
+
* const visitors = await worldActivity.currentVisitors();
|
|
1555
1565
|
* ```
|
|
1556
1566
|
*/
|
|
1557
1567
|
currentVisitors(): Promise<{
|
|
@@ -1565,7 +1575,7 @@ declare class WorldActivity extends SDKController {
|
|
|
1565
1575
|
*
|
|
1566
1576
|
* @usage
|
|
1567
1577
|
* ```ts
|
|
1568
|
-
* await
|
|
1578
|
+
* await worldActivity.moveAllVisitors({
|
|
1569
1579
|
* shouldFetchVisitors: true,
|
|
1570
1580
|
* shouldTeleportVisitors: true,
|
|
1571
1581
|
* scatterVisitorsBy: 40,
|
|
@@ -1575,7 +1585,7 @@ declare class WorldActivity extends SDKController {
|
|
|
1575
1585
|
* ```
|
|
1576
1586
|
*
|
|
1577
1587
|
* @result
|
|
1578
|
-
* Updates each Visitor instance and
|
|
1588
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
1579
1589
|
*/
|
|
1580
1590
|
moveAllVisitors({ shouldFetchVisitors, shouldTeleportVisitors, scatterVisitorsBy, x, y, }: MoveAllVisitorsInterface): Promise<(void | ResponseType)[] | undefined>;
|
|
1581
1591
|
/**
|
|
@@ -1586,22 +1596,22 @@ declare class WorldActivity extends SDKController {
|
|
|
1586
1596
|
* ```ts
|
|
1587
1597
|
* const visitorsToMove = [
|
|
1588
1598
|
* {
|
|
1589
|
-
* visitorObj:
|
|
1599
|
+
* visitorObj: worldActivity.visitors["1"],
|
|
1590
1600
|
* shouldTeleportVisitor: true,
|
|
1591
1601
|
* x: 100,
|
|
1592
1602
|
* y: 100
|
|
1593
1603
|
* }, {
|
|
1594
|
-
* visitorObj:
|
|
1604
|
+
* visitorObj: worldActivity.visitors["2"],
|
|
1595
1605
|
* shouldTeleportVisitor: false,
|
|
1596
1606
|
* x: 100,
|
|
1597
1607
|
* y: 100
|
|
1598
1608
|
* }
|
|
1599
1609
|
* ];
|
|
1600
|
-
* await
|
|
1610
|
+
* await worldActivity.moveVisitors(visitorsToMove);
|
|
1601
1611
|
* ```
|
|
1602
1612
|
*
|
|
1603
1613
|
* @result
|
|
1604
|
-
* Updates each Visitor instance and
|
|
1614
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
1605
1615
|
*/
|
|
1606
1616
|
moveVisitors(visitorsToMove: VisitorsToMoveArrayType): Promise<(void | ResponseType)[]>;
|
|
1607
1617
|
}
|
|
@@ -1617,14 +1627,23 @@ declare class DroppedAssetFactory extends SDKController {
|
|
|
1617
1627
|
create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
|
|
1618
1628
|
get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
|
|
1619
1629
|
getWithUniqueName(uniqueName: string, urlSlug: string, interactivePublicKey: string, interactiveSecret: string): Promise<DroppedAsset>;
|
|
1620
|
-
drop(asset: Asset, { interactivePublicKey, isInteractive, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }: {
|
|
1630
|
+
drop(asset: Asset, { assetScale, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }: {
|
|
1631
|
+
assetScale?: number;
|
|
1632
|
+
flipped?: boolean;
|
|
1621
1633
|
interactivePublicKey?: string;
|
|
1622
1634
|
isInteractive?: boolean;
|
|
1635
|
+
layer0?: string;
|
|
1636
|
+
layer1?: string;
|
|
1623
1637
|
position: {
|
|
1624
1638
|
x: number;
|
|
1625
1639
|
y: number;
|
|
1626
1640
|
};
|
|
1627
1641
|
sceneDropId?: string;
|
|
1642
|
+
text?: string;
|
|
1643
|
+
textColor?: string;
|
|
1644
|
+
textSize?: number;
|
|
1645
|
+
textWeight?: string;
|
|
1646
|
+
textWidth?: number;
|
|
1628
1647
|
uniqueName?: string;
|
|
1629
1648
|
urlSlug: string;
|
|
1630
1649
|
yOrderAdjust?: number;
|
package/dist/index.js
CHANGED
|
@@ -39756,7 +39756,7 @@ var _DroppedAsset_updateDroppedAsset;
|
|
|
39756
39756
|
class DroppedAsset extends Asset {
|
|
39757
39757
|
constructor(topia, id, urlSlug, options = { attributes: { text: "" }, credentials: {} }) {
|
|
39758
39758
|
var _a;
|
|
39759
|
-
super(topia, id, { attributes: options.attributes, credentials: Object.assign(
|
|
39759
|
+
super(topia, id, { attributes: options.attributes, credentials: Object.assign({ assetId: id, urlSlug }, options.credentials) });
|
|
39760
39760
|
// private methods
|
|
39761
39761
|
_DroppedAsset_updateDroppedAsset.set(this, (payload, updateType) => __awaiter(this, void 0, void 0, function* () {
|
|
39762
39762
|
try {
|
|
@@ -40128,6 +40128,23 @@ class DroppedAsset extends Asset {
|
|
|
40128
40128
|
throw this.errorHandler({ error, params: { assetScale }, sdkMethod: "DroppedAsset.updateScale" });
|
|
40129
40129
|
}
|
|
40130
40130
|
}
|
|
40131
|
+
/**
|
|
40132
|
+
* @summary
|
|
40133
|
+
* Flip an dropped asset.
|
|
40134
|
+
*
|
|
40135
|
+
* @usage
|
|
40136
|
+
* ```ts
|
|
40137
|
+
* await droppedAsset.flip(.5);
|
|
40138
|
+
* ```
|
|
40139
|
+
*/
|
|
40140
|
+
flip() {
|
|
40141
|
+
try {
|
|
40142
|
+
return __classPrivateFieldGet(this, _DroppedAsset_updateDroppedAsset, "f").call(this, {}, "flip");
|
|
40143
|
+
}
|
|
40144
|
+
catch (error) {
|
|
40145
|
+
throw this.errorHandler({ error, params: {}, sdkMethod: "DroppedAsset.flip" });
|
|
40146
|
+
}
|
|
40147
|
+
}
|
|
40131
40148
|
/**
|
|
40132
40149
|
* @summary
|
|
40133
40150
|
* Change or remove media embedded in a dropped asset.
|
|
@@ -40351,12 +40368,12 @@ var _World_droppedAssetsMap;
|
|
|
40351
40368
|
*/
|
|
40352
40369
|
class World extends SDKController {
|
|
40353
40370
|
constructor(topia, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
40354
|
-
var _a, _b, _c;
|
|
40371
|
+
var _a, _b, _c, _d;
|
|
40355
40372
|
super(topia, {
|
|
40356
40373
|
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
40357
40374
|
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
40358
|
-
urlSlug,
|
|
40359
|
-
visitorId: (
|
|
40375
|
+
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
40376
|
+
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
40360
40377
|
});
|
|
40361
40378
|
_World_droppedAssetsMap.set(this, void 0);
|
|
40362
40379
|
////////// data objects
|
|
@@ -41147,7 +41164,7 @@ _User_adminWorldsMap = new WeakMap(), _User_assetsMap = new WeakMap(), _User_sce
|
|
|
41147
41164
|
*/
|
|
41148
41165
|
class Visitor extends User {
|
|
41149
41166
|
constructor(topia, id, urlSlug, options = { attributes: {}, credentials: {} }) {
|
|
41150
|
-
super(topia, { credentials: Object.assign(
|
|
41167
|
+
super(topia, { credentials: Object.assign({ urlSlug }, options.credentials) });
|
|
41151
41168
|
Object.assign(this, options.attributes);
|
|
41152
41169
|
this.id = id;
|
|
41153
41170
|
this.urlSlug = urlSlug;
|
|
@@ -41478,12 +41495,12 @@ var _WorldActivity_visitorsMap;
|
|
|
41478
41495
|
*/
|
|
41479
41496
|
class WorldActivity extends SDKController {
|
|
41480
41497
|
constructor(topia, urlSlug, options = { credentials: {} }) {
|
|
41481
|
-
var _a, _b, _c;
|
|
41498
|
+
var _a, _b, _c, _d;
|
|
41482
41499
|
super(topia, {
|
|
41483
41500
|
apiKey: (_a = options === null || options === void 0 ? void 0 : options.credentials) === null || _a === void 0 ? void 0 : _a.apiKey,
|
|
41484
41501
|
interactiveNonce: (_b = options === null || options === void 0 ? void 0 : options.credentials) === null || _b === void 0 ? void 0 : _b.interactiveNonce,
|
|
41485
|
-
urlSlug,
|
|
41486
|
-
visitorId: (
|
|
41502
|
+
urlSlug: ((_c = options === null || options === void 0 ? void 0 : options.credentials) === null || _c === void 0 ? void 0 : _c.urlSlug) || urlSlug,
|
|
41503
|
+
visitorId: (_d = options === null || options === void 0 ? void 0 : options.credentials) === null || _d === void 0 ? void 0 : _d.visitorId,
|
|
41487
41504
|
});
|
|
41488
41505
|
_WorldActivity_visitorsMap.set(this, void 0);
|
|
41489
41506
|
this.urlSlug = urlSlug;
|
|
@@ -41518,7 +41535,7 @@ class WorldActivity extends SDKController {
|
|
|
41518
41535
|
*
|
|
41519
41536
|
* @usage
|
|
41520
41537
|
* ```ts
|
|
41521
|
-
* const visitors = await
|
|
41538
|
+
* const visitors = await worldActivity.currentVisitors();
|
|
41522
41539
|
* ```
|
|
41523
41540
|
*/
|
|
41524
41541
|
currentVisitors() {
|
|
@@ -41540,7 +41557,7 @@ class WorldActivity extends SDKController {
|
|
|
41540
41557
|
*
|
|
41541
41558
|
* @usage
|
|
41542
41559
|
* ```ts
|
|
41543
|
-
* await
|
|
41560
|
+
* await worldActivity.moveAllVisitors({
|
|
41544
41561
|
* shouldFetchVisitors: true,
|
|
41545
41562
|
* shouldTeleportVisitors: true,
|
|
41546
41563
|
* scatterVisitorsBy: 40,
|
|
@@ -41550,7 +41567,7 @@ class WorldActivity extends SDKController {
|
|
|
41550
41567
|
* ```
|
|
41551
41568
|
*
|
|
41552
41569
|
* @result
|
|
41553
|
-
* Updates each Visitor instance and
|
|
41570
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
41554
41571
|
*/
|
|
41555
41572
|
moveAllVisitors({ shouldFetchVisitors = true, shouldTeleportVisitors = true, scatterVisitorsBy = 0, x, y, }) {
|
|
41556
41573
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41577,22 +41594,22 @@ class WorldActivity extends SDKController {
|
|
|
41577
41594
|
* ```ts
|
|
41578
41595
|
* const visitorsToMove = [
|
|
41579
41596
|
* {
|
|
41580
|
-
* visitorObj:
|
|
41597
|
+
* visitorObj: worldActivity.visitors["1"],
|
|
41581
41598
|
* shouldTeleportVisitor: true,
|
|
41582
41599
|
* x: 100,
|
|
41583
41600
|
* y: 100
|
|
41584
41601
|
* }, {
|
|
41585
|
-
* visitorObj:
|
|
41602
|
+
* visitorObj: worldActivity.visitors["2"],
|
|
41586
41603
|
* shouldTeleportVisitor: false,
|
|
41587
41604
|
* x: 100,
|
|
41588
41605
|
* y: 100
|
|
41589
41606
|
* }
|
|
41590
41607
|
* ];
|
|
41591
|
-
* await
|
|
41608
|
+
* await worldActivity.moveVisitors(visitorsToMove);
|
|
41592
41609
|
* ```
|
|
41593
41610
|
*
|
|
41594
41611
|
* @result
|
|
41595
|
-
* Updates each Visitor instance and
|
|
41612
|
+
* Updates each Visitor instance and worldActivity.visitors map.
|
|
41596
41613
|
*/
|
|
41597
41614
|
moveVisitors(visitorsToMove) {
|
|
41598
41615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -41681,9 +41698,31 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41681
41698
|
}
|
|
41682
41699
|
});
|
|
41683
41700
|
}
|
|
41684
|
-
drop(asset, { interactivePublicKey, isInteractive, position: { x, y }, sceneDropId, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41701
|
+
drop(asset, { assetScale, flipped, interactivePublicKey, isInteractive, layer0, layer1, position: { x, y }, sceneDropId, text, textColor, textSize, textWeight, textWidth, uniqueName, urlSlug, yOrderAdjust, }) {
|
|
41685
41702
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41686
|
-
|
|
41703
|
+
let specialType;
|
|
41704
|
+
if (layer0 || layer1)
|
|
41705
|
+
specialType = "webImage";
|
|
41706
|
+
else if (text)
|
|
41707
|
+
specialType = "text";
|
|
41708
|
+
const params = {
|
|
41709
|
+
assetScale,
|
|
41710
|
+
flipped,
|
|
41711
|
+
layer0,
|
|
41712
|
+
layer1,
|
|
41713
|
+
interactivePublicKey,
|
|
41714
|
+
isInteractive,
|
|
41715
|
+
sceneDropId,
|
|
41716
|
+
specialType,
|
|
41717
|
+
text,
|
|
41718
|
+
textColor,
|
|
41719
|
+
textSize,
|
|
41720
|
+
textWeight,
|
|
41721
|
+
textWidth,
|
|
41722
|
+
uniqueName,
|
|
41723
|
+
urlSlug,
|
|
41724
|
+
yOrderAdjust,
|
|
41725
|
+
};
|
|
41687
41726
|
if (isInteractive && !interactivePublicKey) {
|
|
41688
41727
|
throw this.errorHandler({
|
|
41689
41728
|
message: "interactivePublicKey is required",
|
|
@@ -41692,15 +41731,7 @@ class DroppedAssetFactory extends SDKController {
|
|
|
41692
41731
|
});
|
|
41693
41732
|
}
|
|
41694
41733
|
try {
|
|
41695
|
-
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, {
|
|
41696
|
-
assetId: asset.id,
|
|
41697
|
-
interactivePublicKey,
|
|
41698
|
-
isInteractive,
|
|
41699
|
-
position: { x, y },
|
|
41700
|
-
sceneDropId,
|
|
41701
|
-
uniqueName,
|
|
41702
|
-
yOrderAdjust,
|
|
41703
|
-
}, asset.requestOptions);
|
|
41734
|
+
const response = yield this.topiaPublicApi().post(`/world/${urlSlug}/assets`, Object.assign(Object.assign({}, params), { assetId: asset.id, position: { x, y } }), asset.requestOptions);
|
|
41704
41735
|
const { id } = response.data;
|
|
41705
41736
|
return new DroppedAsset(this.topia, id, urlSlug, { credentials: asset.credentials });
|
|
41706
41737
|
}
|
package/package.json
CHANGED