@quintype/components 3.6.1-sub-dir-paywall.0 → 3.6.1-sub-dir-paywall.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/cjs/index.js CHANGED
@@ -5192,6 +5192,22 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5192
5192
  }, _callee3);
5193
5193
  })));
5194
5194
 
5195
+ _defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getPath", function (sketchesHost, relativePath) {
5196
+ try {
5197
+ var _URL = new URL(sketchesHost),
5198
+ pathname = _URL.pathname;
5199
+
5200
+ if (pathname && pathname !== '/') {
5201
+ return "".concat(sketchesHost).concat(relativePath);
5202
+ }
5203
+
5204
+ return relativePath;
5205
+ } catch (err) {
5206
+ console.log('Sketches host path error ---> ', err);
5207
+ return relativePath;
5208
+ }
5209
+ });
5210
+
5195
5211
  _defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscription", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4() {
5196
5212
  var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
5197
5213
 
@@ -5391,7 +5407,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5391
5407
  })));
5392
5408
 
5393
5409
  _defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8() {
5410
+ var _this$props;
5411
+
5394
5412
  var callback,
5413
+ url,
5395
5414
  jwtResponse,
5396
5415
  _yield$awaitHelper7,
5397
5416
  error,
@@ -5404,15 +5423,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5404
5423
  callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
5405
5424
  return null;
5406
5425
  };
5407
- _context8.next = 3;
5408
- return fetch("/anything/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
5426
+ url = _this.getPath((_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.sketchesHost, "/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
5427
+ _context8.next = 4;
5428
+ return fetch(url);
5409
5429
 
5410
- case 3:
5430
+ case 4:
5411
5431
  jwtResponse = _context8.sent;
5412
- _context8.next = 6;
5432
+ _context8.next = 7;
5413
5433
  return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
5414
5434
 
5415
- case 6:
5435
+ case 7:
5416
5436
  _yield$awaitHelper7 = _context8.sent;
5417
5437
  error = _yield$awaitHelper7.error;
5418
5438
 
@@ -5441,7 +5461,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5441
5461
  }
5442
5462
  }
5443
5463
 
5444
- case 9:
5464
+ case 10:
5445
5465
  case "end":
5446
5466
  return _context8.stop();
5447
5467
  }
@@ -216,6 +216,22 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
216
216
  }, _callee3);
217
217
  })));
218
218
 
219
+ _defineProperty(_assertThisInitialized(_this), "getPath", function (sketchesHost, relativePath) {
220
+ try {
221
+ var _URL = new URL(sketchesHost),
222
+ pathname = _URL.pathname;
223
+
224
+ if (pathname && pathname !== '/') {
225
+ return "".concat(sketchesHost).concat(relativePath);
226
+ }
227
+
228
+ return relativePath;
229
+ } catch (err) {
230
+ console.log('Sketches host path error ---> ', err);
231
+ return relativePath;
232
+ }
233
+ });
234
+
219
235
  _defineProperty(_assertThisInitialized(_this), "getSubscription", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
220
236
  var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
221
237
 
@@ -415,7 +431,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
415
431
  })));
416
432
 
417
433
  _defineProperty(_assertThisInitialized(_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
434
+ var _this$props;
435
+
418
436
  var callback,
437
+ url,
419
438
  jwtResponse,
420
439
  _yield$awaitHelper7,
421
440
  error,
@@ -428,15 +447,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
428
447
  callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
429
448
  return null;
430
449
  };
431
- _context8.next = 3;
432
- return fetch("/anything/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
450
+ url = _this.getPath((_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.sketchesHost, "/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
451
+ _context8.next = 4;
452
+ return fetch(url);
433
453
 
434
- case 3:
454
+ case 4:
435
455
  jwtResponse = _context8.sent;
436
- _context8.next = 6;
456
+ _context8.next = 7;
437
457
  return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
438
458
 
439
- case 6:
459
+ case 7:
440
460
  _yield$awaitHelper7 = _context8.sent;
441
461
  error = _yield$awaitHelper7.error;
442
462
 
@@ -465,7 +485,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
465
485
  }
466
486
  }
467
487
 
468
- case 9:
488
+ case 10:
469
489
  case "end":
470
490
  return _context8.stop();
471
491
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/components",
3
- "version": "3.6.1-sub-dir-paywall.0",
3
+ "version": "3.6.1-sub-dir-paywall.1",
4
4
  "description": "Components to help build Quintype Node.js apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",