@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.
Files changed (47) hide show
  1. package/package.json +2 -2
  2. package/dist/__mocks__/assets.js +0 -241
  3. package/dist/__mocks__/index.js +0 -4
  4. package/dist/__mocks__/scenes.js +0 -104
  5. package/dist/__mocks__/visitors.js +0 -83
  6. package/dist/__mocks__/worlds.js +0 -52
  7. package/dist/controllers/Asset.js +0 -31
  8. package/dist/controllers/DroppedAsset.js +0 -335
  9. package/dist/controllers/SDKController.js +0 -36
  10. package/dist/controllers/Topia.js +0 -32
  11. package/dist/controllers/User.js +0 -106
  12. package/dist/controllers/Visitor.js +0 -55
  13. package/dist/controllers/World.js +0 -328
  14. package/dist/controllers/__tests__/asset.test.js +0 -37
  15. package/dist/controllers/__tests__/droppedAsset.test.js +0 -98
  16. package/dist/controllers/__tests__/user.test.js +0 -50
  17. package/dist/controllers/__tests__/visitor.test.js +0 -41
  18. package/dist/controllers/__tests__/world.test.js +0 -77
  19. package/dist/controllers/index.js +0 -7
  20. package/dist/factories/AssetFactory.js +0 -11
  21. package/dist/factories/DroppedAssetFactory.js +0 -26
  22. package/dist/factories/UserFactory.js +0 -10
  23. package/dist/factories/VisitorFactory.js +0 -10
  24. package/dist/factories/WorldFactory.js +0 -10
  25. package/dist/factories/index.js +0 -5
  26. package/dist/interfaces/AssetInterfaces.js +0 -1
  27. package/dist/interfaces/DroppedAssetInterfaces.js +0 -1
  28. package/dist/interfaces/SDKInterfaces.js +0 -1
  29. package/dist/interfaces/TopiaInterfaces.js +0 -1
  30. package/dist/interfaces/UserInterfaces.js +0 -1
  31. package/dist/interfaces/VisitorInterfaces.js +0 -1
  32. package/dist/interfaces/WorldInterfaces.js +0 -1
  33. package/dist/interfaces/index.js +0 -7
  34. package/dist/src/utils/getErrorMessage.js +0 -5
  35. package/dist/src/utils/getSuccessResponse.js +0 -3
  36. package/dist/types/DroppedAssetTypes.js +0 -12
  37. package/dist/types/InteractiveCredentialsTypes.js +0 -1
  38. package/dist/types/OptionsTypes.js +0 -1
  39. package/dist/types/VisitorTypes.js +0 -1
  40. package/dist/types/index.js +0 -3
  41. package/dist/utils/__tests__/removeUndefined.test.js +0 -10
  42. package/dist/utils/__tests__/scatterVisitors.test.js +0 -11
  43. package/dist/utils/getErrorMessage.js +0 -7
  44. package/dist/utils/index.js +0 -4
  45. package/dist/utils/publicAPI.js +0 -13
  46. package/dist/utils/removeUndefined.js +0 -11
  47. 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;
@@ -1,10 +0,0 @@
1
- import { User } from "controllers";
2
- export class UserFactory {
3
- constructor(topia) {
4
- this.topia = topia;
5
- }
6
- create(email, options) {
7
- return new User(this.topia, email, options);
8
- }
9
- }
10
- export default UserFactory;
@@ -1,10 +0,0 @@
1
- import { Visitor } from "controllers";
2
- export class VisitorFactory {
3
- constructor(topia) {
4
- this.topia = topia;
5
- }
6
- create(id, urlSlug, options) {
7
- return new Visitor(this.topia, id, urlSlug, options);
8
- }
9
- }
10
- export default VisitorFactory;
@@ -1,10 +0,0 @@
1
- import { World } from "controllers";
2
- export class WorldFactory {
3
- constructor(topia) {
4
- this.topia = topia;
5
- }
6
- create(urlSlug, options) {
7
- return new World(this.topia, urlSlug, options);
8
- }
9
- }
10
- export default WorldFactory;
@@ -1,5 +0,0 @@
1
- export { AssetFactory } from "./AssetFactory";
2
- export { DroppedAssetFactory } from "./DroppedAssetFactory";
3
- export { UserFactory } from "./UserFactory";
4
- export { VisitorFactory } from "./VisitorFactory";
5
- export { WorldFactory } from "./WorldFactory";
@@ -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 {};
@@ -1,7 +0,0 @@
1
- export * from "./AssetInterfaces";
2
- export * from "./DroppedAssetInterfaces";
3
- export * from "./SDKInterfaces";
4
- export * from "./TopiaInterfaces";
5
- export * from "./UserInterfaces";
6
- export * from "./VisitorInterfaces";
7
- export * from "./WorldInterfaces";
@@ -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,3 +0,0 @@
1
- export const getSuccessResponse = (message = "Success!") => {
2
- return { success: true, message };
3
- };
@@ -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 {};
@@ -1,3 +0,0 @@
1
- export * from "./DroppedAssetTypes";
2
- export * from "./VisitorTypes";
3
- export * from "./InteractiveCredentialsTypes";
@@ -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
- };
@@ -1,4 +0,0 @@
1
- export { getErrorMessage } from "./getErrorMessage";
2
- export { publicAPI } from "./publicAPI";
3
- export { removeUndefined } from "./removeUndefined";
4
- export { scatterVisitors } from "./scatterVisitors";
@@ -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,11 +0,0 @@
1
- /**
2
- * Parses object, removes keys with undefined value, and returns clean object.
3
- */
4
- export const removeUndefined = (obj) => {
5
- Object.keys(obj).forEach((key) => {
6
- if (obj[key] === undefined) {
7
- delete obj[key];
8
- }
9
- });
10
- return obj;
11
- };
@@ -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
- };