imposium-js-sdk 3.1.6 → 3.2.2

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/lib/imposium.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! IMPOSIUM-JS-SDK | Version 3.1.6 */
1
+ /*! IMPOSIUM-JS-SDK | Version 3.2.2 */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -16340,6 +16340,21 @@ var Client = /** @class */ (function () {
16340
16340
  }
16341
16341
  }
16342
16342
  };
16343
+ this.renderExperienceFromId = function (experienceId) {
16344
+ if (_this.clientConfig) {
16345
+ var _a = _this, player = _a.player, playerIsFallback = _a.playerIsFallback, storyId = _a.clientConfig.storyId, _b = _a.eventDelegateRefs, GOT_EXPERIENCE = _b.GOT_EXPERIENCE, UPLOAD_PROGRESS = _b.UPLOAD_PROGRESS, ERROR = _b.ERROR;
16346
+ try {
16347
+ // Ensures config error throws if not using our player / GOT_EXPERIENCE isn't set or set correctly
16348
+ if (((player === null || playerIsFallback) && !(0, Helpers_1.isFunc)(GOT_EXPERIENCE))) {
16349
+ throw new Exceptions_1.ClientConfigurationError('bagConfigOnPostRender', Client.eventNames.GOT_EXPERIENCE);
16350
+ }
16351
+ _this.directDeliveryPipe.fetchExperience(null, UPLOAD_PROGRESS, 1, experienceId);
16352
+ }
16353
+ catch (e) {
16354
+ ExceptionPipe_1.default.trapError(e, storyId, ERROR);
16355
+ }
16356
+ }
16357
+ };
16343
16358
  /*
16344
16359
  Update render history state, prevents storing duplicates
16345
16360
  */
@@ -16426,8 +16441,10 @@ var DirectDeliveryPipe = /** @class */ (function () {
16426
16441
  clearTimeout(_this.killPollTimeout);
16427
16442
  _this.killPollTimeout = setTimeout(function () { return _this.killPoll(experienceId); }, KILL_POLL_AFTER);
16428
16443
  _this.pollForExperience(experienceId, function (experience) {
16444
+ clearTimeout(_this.killPollTimeout);
16429
16445
  _this.clientDelegates.get('gotExperience')(experience);
16430
16446
  }, function (e) {
16447
+ clearTimeout(_this.killPollTimeout);
16431
16448
  var httpError = new Exceptions_1.HTTPError('httpFailure', experienceId, e);
16432
16449
  _this.clientDelegates.get('internalError')(httpError);
16433
16450
  });
@@ -16435,9 +16452,10 @@ var DirectDeliveryPipe = /** @class */ (function () {
16435
16452
  /*
16436
16453
  POST data to Imposium server, create experience record, defer and or poll on success
16437
16454
  */
16438
- this.fetchExperience = function (inventory, uploadProgress, retries) {
16455
+ this.fetchExperience = function (inventory, uploadProgress, retries, experienceId) {
16439
16456
  if (retries === void 0) { retries = 1; }
16440
- var uuid = (0, Helpers_1.generateUUID)();
16457
+ if (experienceId === void 0) { experienceId = null; }
16458
+ var uuid = (experienceId) ? experienceId : (0, Helpers_1.generateUUID)();
16441
16459
  _this.api.fetch(inventory, uuid, uploadProgress)
16442
16460
  .then(function (res) {
16443
16461
  if (res.error) {
@@ -16464,7 +16482,7 @@ var DirectDeliveryPipe = /** @class */ (function () {
16464
16482
  }
16465
16483
  else if (e.response && e.response.status >= 500 && retries < MAX_RETRIES) {
16466
16484
  retries = retries + 1;
16467
- _this.fetchExperience(inventory, uploadProgress, retries);
16485
+ _this.fetchExperience(inventory, uploadProgress, retries, experienceId);
16468
16486
  }
16469
16487
  else {
16470
16488
  var httpError = new Exceptions_1.HTTPError('httpFailure', uuid, e);
@@ -16626,8 +16644,9 @@ var API = /** @class */ (function () {
16626
16644
  /*
16627
16645
  create a new experience record and resolve fresh experience data
16628
16646
  */
16629
- this.fetch = function (inventory, uuid, progress) {
16647
+ this.fetch = function (inventory, uuid, progress, experienceId) {
16630
16648
  if (progress === void 0) { progress = null; }
16649
+ if (experienceId === void 0) { experienceId = null; }
16631
16650
  var route = '/experience/fetch';
16632
16651
  var formData = (0, Helpers_1.inventoryToFormData)(_this.storyId, inventory, _this.compositionId);
16633
16652
  var config = { onUploadProgress: function (e) { return _this.uploadProgress(e, progress); } };
@@ -17241,9 +17260,9 @@ exports.inventoryToFormData = inventoryToFormData;
17241
17260
 
17242
17261
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17243
17262
  exports.printVersion = exports.version = void 0;
17244
- exports.version = "3.1.6";
17263
+ exports.version = "3.2.2";
17245
17264
  var printVersion = function () {
17246
- console.log("%cPowered By%c Imposium%c v".concat("3.1.6", "%c https://imposium.com"), 'text-transform: uppercase; padding: 5px 0px 5px 5px; background-color: black; color: white;', 'text-transform: uppercase; padding: 5px 0px 5px 0px; background-color: black; color: #a1b83a;', 'padding: 5px 5px 5px 0px; background-color: black; color: white;', 'padding: 5px 5px 5px 0px;');
17265
+ console.log("%cPowered By%c Imposium%c v".concat("3.2.2", "%c https://imposium.com"), 'text-transform: uppercase; padding: 5px 0px 5px 5px; background-color: black; color: white;', 'text-transform: uppercase; padding: 5px 0px 5px 0px; background-color: black; color: #a1b83a;', 'padding: 5px 5px 5px 0px; background-color: black; color: white;', 'padding: 5px 5px 5px 0px;');
17247
17266
  };
17248
17267
  exports.printVersion = printVersion;
17249
17268