imposium-js-sdk 3.1.0 → 3.2.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/lib/imposium.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! IMPOSIUM-JS-SDK | Version 3.1.0 */
1
+ /*! IMPOSIUM-JS-SDK | Version 3.2.0 */
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
  */
@@ -16435,9 +16450,10 @@ var DirectDeliveryPipe = /** @class */ (function () {
16435
16450
  /*
16436
16451
  POST data to Imposium server, create experience record, defer and or poll on success
16437
16452
  */
16438
- this.fetchExperience = function (inventory, uploadProgress, retries) {
16453
+ this.fetchExperience = function (inventory, uploadProgress, retries, experienceId) {
16439
16454
  if (retries === void 0) { retries = 1; }
16440
- var uuid = (0, Helpers_1.generateUUID)();
16455
+ if (experienceId === void 0) { experienceId = null; }
16456
+ var uuid = (experienceId) ? experienceId : (0, Helpers_1.generateUUID)();
16441
16457
  _this.api.fetch(inventory, uuid, uploadProgress)
16442
16458
  .then(function (res) {
16443
16459
  if (res.error) {
@@ -16464,7 +16480,7 @@ var DirectDeliveryPipe = /** @class */ (function () {
16464
16480
  }
16465
16481
  else if (e.response && e.response.status >= 500 && retries < MAX_RETRIES) {
16466
16482
  retries = retries + 1;
16467
- _this.fetchExperience(inventory, uploadProgress, retries);
16483
+ _this.fetchExperience(inventory, uploadProgress, retries, experienceId);
16468
16484
  }
16469
16485
  else {
16470
16486
  var httpError = new Exceptions_1.HTTPError('httpFailure', uuid, e);
@@ -16626,8 +16642,9 @@ var API = /** @class */ (function () {
16626
16642
  /*
16627
16643
  create a new experience record and resolve fresh experience data
16628
16644
  */
16629
- this.fetch = function (inventory, uuid, progress) {
16645
+ this.fetch = function (inventory, uuid, progress, experienceId) {
16630
16646
  if (progress === void 0) { progress = null; }
16647
+ if (experienceId === void 0) { experienceId = null; }
16631
16648
  var route = '/experience/fetch';
16632
16649
  var formData = (0, Helpers_1.inventoryToFormData)(_this.storyId, inventory, _this.compositionId);
16633
16650
  var config = { onUploadProgress: function (e) { return _this.uploadProgress(e, progress); } };
@@ -17241,9 +17258,9 @@ exports.inventoryToFormData = inventoryToFormData;
17241
17258
 
17242
17259
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17243
17260
  exports.printVersion = exports.version = void 0;
17244
- exports.version = "3.1.0";
17261
+ exports.version = "3.2.0";
17245
17262
  var printVersion = function () {
17246
- console.log("%cPowered By%c Imposium%c v".concat("3.1.0", "%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;');
17263
+ console.log("%cPowered By%c Imposium%c v".concat("3.2.0", "%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
17264
  };
17248
17265
  exports.printVersion = printVersion;
17249
17266