@rtsdk/topia 0.2.0 → 0.2.1

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 CHANGED
@@ -39757,18 +39757,25 @@ class SDKController {
39757
39757
  this.requestOptions = {};
39758
39758
  let payload = {};
39759
39759
  const headers = {};
39760
- payload = {
39761
- interactiveNonce,
39762
- visitorId,
39763
- assetId,
39764
- date: new Date(),
39765
- };
39766
- this.jwt = jwt.sign(payload, topia.interactiveSecret);
39767
- headers.InteractiveJWT = this.jwt;
39768
- if (apiKey) {
39769
- headers.Authorization = apiKey;
39760
+ try {
39761
+ if (topia.interactiveSecret) {
39762
+ payload = {
39763
+ interactiveNonce,
39764
+ visitorId,
39765
+ assetId,
39766
+ date: new Date(),
39767
+ };
39768
+ this.jwt = jwt.sign(payload, topia.interactiveSecret);
39769
+ headers.InteractiveJWT = this.jwt;
39770
+ }
39771
+ if (apiKey) {
39772
+ headers.Authorization = apiKey;
39773
+ }
39774
+ this.requestOptions = { headers };
39775
+ }
39776
+ catch (error) {
39777
+ this.errorHandler({ error });
39770
39778
  }
39771
- this.requestOptions = { headers };
39772
39779
  }
39773
39780
  topiaPublicApi() {
39774
39781
  return this.topia.axios;
@@ -40794,7 +40801,7 @@ class Visitor extends User {
40794
40801
  * Returns details for a visitor in a world by id and urlSlug
40795
40802
  */
40796
40803
  fetchVisitor() {
40797
- var _a;
40804
+ var _a, _b;
40798
40805
  return __awaiter(this, void 0, void 0, function* () {
40799
40806
  try {
40800
40807
  const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}`, this.requestOptions);
@@ -40807,6 +40814,8 @@ class Visitor extends User {
40807
40814
  else {
40808
40815
  throw "This visitor is not active";
40809
40816
  }
40817
+ if ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.profileId)
40818
+ this.profileId = this.profile.profileId;
40810
40819
  }
40811
40820
  catch (error) {
40812
40821
  throw this.errorHandler({ error });
@@ -40858,7 +40867,7 @@ class Visitor extends User {
40858
40867
  fetchVisitorDataObject() {
40859
40868
  return __awaiter(this, void 0, void 0, function* () {
40860
40869
  try {
40861
- const response = yield this.topiaPublicApi().get(`/visitor/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
40870
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
40862
40871
  this.dataObject = response.data;
40863
40872
  }
40864
40873
  catch (error) {
@@ -40884,7 +40893,7 @@ class Visitor extends User {
40884
40893
  return __awaiter(this, void 0, void 0, function* () {
40885
40894
  try {
40886
40895
  const { lock = {} } = options;
40887
- yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
40896
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
40888
40897
  this.dataObject = dataObject;
40889
40898
  }
40890
40899
  catch (error) {
@@ -40910,7 +40919,7 @@ class Visitor extends User {
40910
40919
  return __awaiter(this, void 0, void 0, function* () {
40911
40920
  try {
40912
40921
  const { lock = {} } = options;
40913
- yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
40922
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
40914
40923
  this.dataObject = dataObject;
40915
40924
  }
40916
40925
  catch (error) {
package/dist/index.js CHANGED
@@ -39755,18 +39755,25 @@ class SDKController {
39755
39755
  this.requestOptions = {};
39756
39756
  let payload = {};
39757
39757
  const headers = {};
39758
- payload = {
39759
- interactiveNonce,
39760
- visitorId,
39761
- assetId,
39762
- date: new Date(),
39763
- };
39764
- this.jwt = jwt.sign(payload, topia.interactiveSecret);
39765
- headers.InteractiveJWT = this.jwt;
39766
- if (apiKey) {
39767
- headers.Authorization = apiKey;
39758
+ try {
39759
+ if (topia.interactiveSecret) {
39760
+ payload = {
39761
+ interactiveNonce,
39762
+ visitorId,
39763
+ assetId,
39764
+ date: new Date(),
39765
+ };
39766
+ this.jwt = jwt.sign(payload, topia.interactiveSecret);
39767
+ headers.InteractiveJWT = this.jwt;
39768
+ }
39769
+ if (apiKey) {
39770
+ headers.Authorization = apiKey;
39771
+ }
39772
+ this.requestOptions = { headers };
39773
+ }
39774
+ catch (error) {
39775
+ this.errorHandler({ error });
39768
39776
  }
39769
- this.requestOptions = { headers };
39770
39777
  }
39771
39778
  topiaPublicApi() {
39772
39779
  return this.topia.axios;
@@ -40792,7 +40799,7 @@ class Visitor extends User {
40792
40799
  * Returns details for a visitor in a world by id and urlSlug
40793
40800
  */
40794
40801
  fetchVisitor() {
40795
- var _a;
40802
+ var _a, _b;
40796
40803
  return __awaiter(this, void 0, void 0, function* () {
40797
40804
  try {
40798
40805
  const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}`, this.requestOptions);
@@ -40805,6 +40812,8 @@ class Visitor extends User {
40805
40812
  else {
40806
40813
  throw "This visitor is not active";
40807
40814
  }
40815
+ if ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.profileId)
40816
+ this.profileId = this.profile.profileId;
40808
40817
  }
40809
40818
  catch (error) {
40810
40819
  throw this.errorHandler({ error });
@@ -40856,7 +40865,7 @@ class Visitor extends User {
40856
40865
  fetchVisitorDataObject() {
40857
40866
  return __awaiter(this, void 0, void 0, function* () {
40858
40867
  try {
40859
- const response = yield this.topiaPublicApi().get(`/visitor/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
40868
+ const response = yield this.topiaPublicApi().get(`/world/${this.urlSlug}/visitors/${this.id}/get-data-object`, this.requestOptions);
40860
40869
  this.dataObject = response.data;
40861
40870
  }
40862
40871
  catch (error) {
@@ -40882,7 +40891,7 @@ class Visitor extends User {
40882
40891
  return __awaiter(this, void 0, void 0, function* () {
40883
40892
  try {
40884
40893
  const { lock = {} } = options;
40885
- yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
40894
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/set-data-object`, { dataObject, lock }, this.requestOptions);
40886
40895
  this.dataObject = dataObject;
40887
40896
  }
40888
40897
  catch (error) {
@@ -40908,7 +40917,7 @@ class Visitor extends User {
40908
40917
  return __awaiter(this, void 0, void 0, function* () {
40909
40918
  try {
40910
40919
  const { lock = {} } = options;
40911
- yield this.topiaPublicApi().put(`/visitor/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
40920
+ yield this.topiaPublicApi().put(`/world/${this.urlSlug}/visitors/${this.id}/update-data-object`, { dataObject, lock }, this.requestOptions);
40912
40921
  this.dataObject = dataObject;
40913
40922
  }
40914
40923
  catch (error) {
@@ -15,6 +15,7 @@ export declare class Visitor extends User implements VisitorInterface {
15
15
  readonly id: number;
16
16
  urlSlug: string;
17
17
  user?: User;
18
+ profile?: any;
18
19
  constructor(topia: Topia, id: number, urlSlug: string, options?: VisitorOptionalInterface);
19
20
  /**
20
21
  * @summary
package/package.json CHANGED
@@ -56,5 +56,5 @@
56
56
  "local-publish": "yarn build && yalc publish --push --no-scripts"
57
57
  },
58
58
  "type": "module",
59
- "version": "0.2.0"
59
+ "version": "0.2.1"
60
60
  }