@rtsdk/topia 0.0.18 → 0.0.19
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/package.json +2 -2
- package/dist/__mocks__/assets.js +0 -241
- package/dist/__mocks__/index.js +0 -4
- package/dist/__mocks__/scenes.js +0 -104
- package/dist/__mocks__/visitors.js +0 -83
- package/dist/__mocks__/worlds.js +0 -52
- package/dist/controllers/Asset.js +0 -31
- package/dist/controllers/DroppedAsset.js +0 -335
- package/dist/controllers/SDKController.js +0 -36
- package/dist/controllers/Topia.js +0 -32
- package/dist/controllers/User.js +0 -106
- package/dist/controllers/Visitor.js +0 -55
- package/dist/controllers/World.js +0 -328
- package/dist/controllers/__tests__/asset.test.js +0 -37
- package/dist/controllers/__tests__/droppedAsset.test.js +0 -98
- package/dist/controllers/__tests__/user.test.js +0 -50
- package/dist/controllers/__tests__/visitor.test.js +0 -41
- package/dist/controllers/__tests__/world.test.js +0 -77
- package/dist/controllers/index.js +0 -7
- package/dist/factories/AssetFactory.js +0 -11
- package/dist/factories/DroppedAssetFactory.js +0 -26
- package/dist/factories/UserFactory.js +0 -10
- package/dist/factories/VisitorFactory.js +0 -10
- package/dist/factories/WorldFactory.js +0 -10
- package/dist/factories/index.js +0 -5
- package/dist/interfaces/AssetInterfaces.js +0 -1
- package/dist/interfaces/DroppedAssetInterfaces.js +0 -1
- package/dist/interfaces/SDKInterfaces.js +0 -1
- package/dist/interfaces/TopiaInterfaces.js +0 -1
- package/dist/interfaces/UserInterfaces.js +0 -1
- package/dist/interfaces/VisitorInterfaces.js +0 -1
- package/dist/interfaces/WorldInterfaces.js +0 -1
- package/dist/interfaces/index.js +0 -7
- package/dist/src/utils/getErrorMessage.js +0 -5
- package/dist/src/utils/getSuccessResponse.js +0 -3
- package/dist/types/DroppedAssetTypes.js +0 -12
- package/dist/types/InteractiveCredentialsTypes.js +0 -1
- package/dist/types/OptionsTypes.js +0 -1
- package/dist/types/VisitorTypes.js +0 -1
- package/dist/types/index.js +0 -3
- package/dist/utils/__tests__/removeUndefined.test.js +0 -10
- package/dist/utils/__tests__/scatterVisitors.test.js +0 -11
- package/dist/utils/getErrorMessage.js +0 -7
- package/dist/utils/index.js +0 -4
- package/dist/utils/publicAPI.js +0 -13
- package/dist/utils/removeUndefined.js +0 -11
- package/dist/utils/scatterVisitors.js +0 -8
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { DroppedAsset } from "controllers";
|
|
11
|
-
export class DroppedAssetFactory {
|
|
12
|
-
constructor(topia) {
|
|
13
|
-
this.topia = topia;
|
|
14
|
-
}
|
|
15
|
-
create(id, urlSlug, options) {
|
|
16
|
-
return new DroppedAsset(this.topia, id, urlSlug, options);
|
|
17
|
-
}
|
|
18
|
-
get(id, urlSlug, options) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const droppedAsset = new DroppedAsset(this.topia, id, urlSlug, options);
|
|
21
|
-
yield droppedAsset.fetchDroppedAssetById();
|
|
22
|
-
return droppedAsset;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export default DroppedAssetFactory;
|
package/dist/factories/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/interfaces/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const getErrorMessage = (error) => {
|
|
2
|
-
var _a, _b, _c;
|
|
3
|
-
const errorMessage = (_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errors[0]) === null || _c === void 0 ? void 0 : _c.message;
|
|
4
|
-
return errorMessage || "Something went wrong. Please try again or contact support.";
|
|
5
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var DroppedAssetClickType;
|
|
2
|
-
(function (DroppedAssetClickType) {
|
|
3
|
-
DroppedAssetClickType["NONE"] = "none";
|
|
4
|
-
DroppedAssetClickType["LINK"] = "link";
|
|
5
|
-
DroppedAssetClickType["PORTAL"] = "portal";
|
|
6
|
-
DroppedAssetClickType["TELEPORT"] = "teleport";
|
|
7
|
-
})(DroppedAssetClickType || (DroppedAssetClickType = {}));
|
|
8
|
-
export var DroppedAssetMediaType;
|
|
9
|
-
(function (DroppedAssetMediaType) {
|
|
10
|
-
DroppedAssetMediaType["NONE"] = "none";
|
|
11
|
-
DroppedAssetMediaType["LINK"] = "link";
|
|
12
|
-
})(DroppedAssetMediaType || (DroppedAssetMediaType = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { removeUndefined } from "../removeUndefined";
|
|
2
|
-
afterEach(() => {
|
|
3
|
-
jest.resetAllMocks();
|
|
4
|
-
});
|
|
5
|
-
describe("remove undefined values util", () => {
|
|
6
|
-
it("should return an object without overriding with undefined values", () => {
|
|
7
|
-
const testRemoveUndefined = removeUndefined({ a: "abc", b: undefined, c: "123", d: null });
|
|
8
|
-
expect(testRemoveUndefined).toEqual({ a: "abc", c: "123", d: null });
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { scatterVisitors } from "../scatterVisitors";
|
|
2
|
-
afterEach(() => {
|
|
3
|
-
jest.resetAllMocks();
|
|
4
|
-
});
|
|
5
|
-
describe("scatter visitors util", () => {
|
|
6
|
-
it("should scatter visitors by 50", () => {
|
|
7
|
-
const testScatter = scatterVisitors(10, 50);
|
|
8
|
-
expect(testScatter).toBeGreaterThanOrEqual(-40);
|
|
9
|
-
expect(testScatter).toBeLessThanOrEqual(60);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// type errorMessage = { message: string };
|
|
2
|
-
export const getErrorMessage = (error) => {
|
|
3
|
-
var _a, _b, _c;
|
|
4
|
-
const errorMessage = (_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.errors[0]) === null || _c === void 0 ? void 0 : _c.message;
|
|
5
|
-
console.log(errorMessage);
|
|
6
|
-
return errorMessage || JSON.stringify(error) || "Something went wrong. Please try again or contact support.";
|
|
7
|
-
};
|
package/dist/utils/index.js
DELETED
package/dist/utils/publicAPI.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
export const publicAPI = (apiKey) => {
|
|
3
|
-
if (window && typeof window !== "undefined") {
|
|
4
|
-
console.warn("Please use extreme caution when passing sensitive information such as API keys from a client side application.");
|
|
5
|
-
}
|
|
6
|
-
return axios.create({
|
|
7
|
-
baseURL: "https://api.topia.io/api",
|
|
8
|
-
headers: {
|
|
9
|
-
"Authorization": apiKey,
|
|
10
|
-
"Content-Type": "application/json",
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
|
|
3
|
-
*/
|
|
4
|
-
export const scatterVisitors = (original, scatterBy) => {
|
|
5
|
-
const min = original - scatterBy;
|
|
6
|
-
const max = original + scatterBy;
|
|
7
|
-
return Math.floor(Math.random() * (max - min) + min);
|
|
8
|
-
};
|