@quintype/components 3.8.1 → 3.8.2-logs.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/dist/cjs/index.js +117 -117
- package/dist/es/components/access-type.js +124 -124
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -5050,30 +5050,32 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5050
5050
|
_this = _super.call(this, props);
|
|
5051
5051
|
|
|
5052
5052
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "loadScript", function (callback) {
|
|
5053
|
-
var accessTypeKey = get__default["default"](_this.props, [
|
|
5054
|
-
var isStaging = get__default["default"](_this.props, [
|
|
5055
|
-
var enableAccesstype = get__default["default"](_this.props, [
|
|
5053
|
+
var accessTypeKey = get__default["default"](_this.props, ["accessTypeKey"]);
|
|
5054
|
+
var isStaging = get__default["default"](_this.props, ["isStaging"]);
|
|
5055
|
+
var enableAccesstype = get__default["default"](_this.props, ["enableAccesstype"]);
|
|
5056
|
+
console.log("loadscript===============", _this.props);
|
|
5056
5057
|
|
|
5057
5058
|
if (!enableAccesstype) {
|
|
5058
5059
|
return false;
|
|
5059
5060
|
}
|
|
5060
5061
|
|
|
5061
5062
|
var HOST = isStaging ? _this.stagingHost : _this.prodHost;
|
|
5062
|
-
var environment = isStaging ?
|
|
5063
|
+
var environment = isStaging ? "&env=sandbox" : "";
|
|
5063
5064
|
var accessTypeHost = "".concat(HOST, "/frontend/v2/accesstype.js?key=").concat(accessTypeKey).concat(environment);
|
|
5064
5065
|
var isATScriptAlreadyPresent = document.querySelector("script[src=\"".concat(accessTypeHost, "\"]"));
|
|
5065
5066
|
|
|
5066
5067
|
if (accessTypeKey && !isATScriptAlreadyPresent && !global.AccessType && global.document) {
|
|
5067
|
-
|
|
5068
|
+
console.log("coming in creating the script---------");
|
|
5069
|
+
var accessTypeScript = document.createElement("script");
|
|
5068
5070
|
|
|
5069
5071
|
accessTypeScript.onload = function () {
|
|
5070
5072
|
_this.props.onATGlobalSet && _this.props.onATGlobalSet();
|
|
5071
5073
|
callback();
|
|
5072
5074
|
};
|
|
5073
5075
|
|
|
5074
|
-
accessTypeScript.setAttribute(
|
|
5075
|
-
accessTypeScript.setAttribute(
|
|
5076
|
-
accessTypeScript.setAttribute(
|
|
5076
|
+
accessTypeScript.setAttribute("src", accessTypeHost);
|
|
5077
|
+
accessTypeScript.setAttribute("id", "AccessTypeScript");
|
|
5078
|
+
accessTypeScript.setAttribute("data-accessType-script", "1");
|
|
5077
5079
|
accessTypeScript.async = 1;
|
|
5078
5080
|
document.body.appendChild(accessTypeScript);
|
|
5079
5081
|
return true;
|
|
@@ -5214,7 +5216,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5214
5216
|
break;
|
|
5215
5217
|
}
|
|
5216
5218
|
|
|
5217
|
-
return _context3.abrupt("return", Promise.reject(
|
|
5219
|
+
return _context3.abrupt("return", Promise.reject("Subscription id is not defined"));
|
|
5218
5220
|
|
|
5219
5221
|
case 3:
|
|
5220
5222
|
return _context3.abrupt("return", global.AccessType.cancelSubscription(subscriptionId));
|
|
@@ -5227,22 +5229,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5227
5229
|
}, _callee3);
|
|
5228
5230
|
})));
|
|
5229
5231
|
|
|
5230
|
-
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getPath", function (sketchesHost, relativePath) {
|
|
5231
|
-
try {
|
|
5232
|
-
var _URL = new URL(sketchesHost),
|
|
5233
|
-
pathname = _URL.pathname;
|
|
5234
|
-
|
|
5235
|
-
if (pathname && pathname !== '/') {
|
|
5236
|
-
return "".concat(sketchesHost).concat(relativePath);
|
|
5237
|
-
}
|
|
5238
|
-
|
|
5239
|
-
return relativePath;
|
|
5240
|
-
} catch (err) {
|
|
5241
|
-
console.log('Sketches host path error ---> ', err);
|
|
5242
|
-
return relativePath;
|
|
5243
|
-
}
|
|
5244
|
-
});
|
|
5245
|
-
|
|
5246
5232
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscription", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4() {
|
|
5247
5233
|
var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
|
|
5248
5234
|
|
|
@@ -5250,8 +5236,8 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5250
5236
|
while (1) {
|
|
5251
5237
|
switch (_context4.prev = _context4.next) {
|
|
5252
5238
|
case 0:
|
|
5253
|
-
accessTypeKey = get__default["default"](_this.props, [
|
|
5254
|
-
isStaging = get__default["default"](_this.props, [
|
|
5239
|
+
accessTypeKey = get__default["default"](_this.props, ["accessTypeKey"]);
|
|
5240
|
+
isStaging = get__default["default"](_this.props, ["isStaging"]);
|
|
5255
5241
|
HOST = isStaging ? _this.stagingHost : _this.prodHost; // TODO: use AccesstypeJS method insead of direct api call
|
|
5256
5242
|
|
|
5257
5243
|
accessTypeHost = "".concat(HOST, "/api/v1/subscription_groups.json?key=").concat(accessTypeKey);
|
|
@@ -5275,11 +5261,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5275
5261
|
}
|
|
5276
5262
|
|
|
5277
5263
|
return _context4.abrupt("return", {
|
|
5278
|
-
error:
|
|
5264
|
+
error: "subscriptions fetch failed"
|
|
5279
5265
|
});
|
|
5280
5266
|
|
|
5281
5267
|
case 15:
|
|
5282
|
-
return _context4.abrupt("return", subscriptions[
|
|
5268
|
+
return _context4.abrupt("return", subscriptions["subscription_groups"] || []);
|
|
5283
5269
|
|
|
5284
5270
|
case 16:
|
|
5285
5271
|
case "end":
|
|
@@ -5318,7 +5304,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5318
5304
|
}
|
|
5319
5305
|
|
|
5320
5306
|
return _context5.abrupt("return", {
|
|
5321
|
-
error:
|
|
5307
|
+
error: "payment options fetch failed"
|
|
5322
5308
|
});
|
|
5323
5309
|
|
|
5324
5310
|
case 9:
|
|
@@ -5344,7 +5330,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5344
5330
|
while (1) {
|
|
5345
5331
|
switch (_context6.prev = _context6.next) {
|
|
5346
5332
|
case 0:
|
|
5347
|
-
storyId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] :
|
|
5333
|
+
storyId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : "";
|
|
5348
5334
|
|
|
5349
5335
|
if (global.AccessType) {
|
|
5350
5336
|
_context6.next = 3;
|
|
@@ -5357,7 +5343,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5357
5343
|
_context6.next = 5;
|
|
5358
5344
|
return awaitHelper(global.AccessType.getAssetPlans({
|
|
5359
5345
|
id: storyId,
|
|
5360
|
-
type:
|
|
5346
|
+
type: "story"
|
|
5361
5347
|
}));
|
|
5362
5348
|
|
|
5363
5349
|
case 5:
|
|
@@ -5372,7 +5358,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5372
5358
|
}
|
|
5373
5359
|
|
|
5374
5360
|
return _context6.abrupt("return", {
|
|
5375
|
-
error:
|
|
5361
|
+
error: "asset plan fetch failed"
|
|
5376
5362
|
});
|
|
5377
5363
|
|
|
5378
5364
|
case 11:
|
|
@@ -5393,15 +5379,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5393
5379
|
while (1) {
|
|
5394
5380
|
switch (_context7.prev = _context7.next) {
|
|
5395
5381
|
case 0:
|
|
5396
|
-
isAccessTypeCampaignEnabled = get__default["default"](_this.props, [
|
|
5382
|
+
isAccessTypeCampaignEnabled = get__default["default"](_this.props, ["isAccessTypeCampaignEnabled"], false);
|
|
5397
5383
|
|
|
5398
5384
|
if (!isAccessTypeCampaignEnabled) {
|
|
5399
5385
|
_context7.next = 18;
|
|
5400
5386
|
break;
|
|
5401
5387
|
}
|
|
5402
5388
|
|
|
5403
|
-
accessTypeKey = get__default["default"](_this.props, [
|
|
5404
|
-
isStaging = get__default["default"](_this.props, [
|
|
5389
|
+
accessTypeKey = get__default["default"](_this.props, ["accessTypeKey"]);
|
|
5390
|
+
isStaging = get__default["default"](_this.props, ["isStaging"]);
|
|
5405
5391
|
HOST = isStaging ? _this.stagingHost : _this.prodHost;
|
|
5406
5392
|
accessTypeHost = "".concat(HOST, "/api/v1/campaigns.json?key=").concat(accessTypeKey);
|
|
5407
5393
|
_context7.t0 = awaitHelper;
|
|
@@ -5424,11 +5410,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5424
5410
|
}
|
|
5425
5411
|
|
|
5426
5412
|
return _context7.abrupt("return", {
|
|
5427
|
-
error:
|
|
5413
|
+
error: "subscriptions fetch failed"
|
|
5428
5414
|
});
|
|
5429
5415
|
|
|
5430
5416
|
case 17:
|
|
5431
|
-
return _context7.abrupt("return", campaignSubscriptions[
|
|
5417
|
+
return _context7.abrupt("return", campaignSubscriptions["subscription_groups"] || []);
|
|
5432
5418
|
|
|
5433
5419
|
case 18:
|
|
5434
5420
|
return _context7.abrupt("return", []);
|
|
@@ -5442,10 +5428,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5442
5428
|
})));
|
|
5443
5429
|
|
|
5444
5430
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8() {
|
|
5445
|
-
var _this$props;
|
|
5446
|
-
|
|
5447
5431
|
var callback,
|
|
5448
|
-
url,
|
|
5449
5432
|
jwtResponse,
|
|
5450
5433
|
_yield$awaitHelper7,
|
|
5451
5434
|
error,
|
|
@@ -5458,16 +5441,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5458
5441
|
callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
|
|
5459
5442
|
return null;
|
|
5460
5443
|
};
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
return fetch(url);
|
|
5444
|
+
_context8.next = 3;
|
|
5445
|
+
return fetch("/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
|
|
5464
5446
|
|
|
5465
|
-
case
|
|
5447
|
+
case 3:
|
|
5466
5448
|
jwtResponse = _context8.sent;
|
|
5467
|
-
_context8.next =
|
|
5468
|
-
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get(
|
|
5449
|
+
_context8.next = 6;
|
|
5450
|
+
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
|
|
5469
5451
|
|
|
5470
|
-
case
|
|
5452
|
+
case 6:
|
|
5471
5453
|
_yield$awaitHelper7 = _context8.sent;
|
|
5472
5454
|
error = _yield$awaitHelper7.error;
|
|
5473
5455
|
|
|
@@ -5496,7 +5478,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5496
5478
|
}
|
|
5497
5479
|
}
|
|
5498
5480
|
|
|
5499
|
-
case
|
|
5481
|
+
case 9:
|
|
5500
5482
|
case "end":
|
|
5501
5483
|
return _context8.stop();
|
|
5502
5484
|
}
|
|
@@ -5505,40 +5487,57 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5505
5487
|
})));
|
|
5506
5488
|
|
|
5507
5489
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscriptionForUser", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9() {
|
|
5490
|
+
var _global, _window, _global2, _global2$get;
|
|
5491
|
+
|
|
5508
5492
|
var _yield$awaitHelper8, error, _yield$awaitHelper8$d, subscriptions;
|
|
5509
5493
|
|
|
5510
5494
|
return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context9) {
|
|
5511
5495
|
while (1) {
|
|
5512
5496
|
switch (_context9.prev = _context9.next) {
|
|
5513
5497
|
case 0:
|
|
5498
|
+
console.log(typeof global !== 'undefined' ? 'Node.js' : 'Browser');
|
|
5499
|
+
console.log("global.Accesstype---------", (_global = global) === null || _global === void 0 ? void 0 : _global.AccessType);
|
|
5500
|
+
console.log("window.Accesstype---------", (_window = window) === null || _window === void 0 ? void 0 : _window.AccessType);
|
|
5501
|
+
console.log("global---------", global);
|
|
5502
|
+
console.log("object keys----", Object.keys(global));
|
|
5503
|
+
console.log("object keys global.window----", Object.keys(global.window));
|
|
5504
|
+
console.log("global window enumerable", Object.getOwnPropertyDescriptor(global.window, 'Accesstype'));
|
|
5505
|
+
console.log("window----------", window);
|
|
5506
|
+
console.log("global?.get?.('Accesstype')----", (_global2 = global) === null || _global2 === void 0 ? void 0 : (_global2$get = _global2.get) === null || _global2$get === void 0 ? void 0 : _global2$get.call(_global2, 'Accesstype'));
|
|
5507
|
+
setTimeout(function () {
|
|
5508
|
+
console.log("settimeout---------", global.Accesstype); // Check if it exists after some time
|
|
5509
|
+
}, 1000);
|
|
5510
|
+
|
|
5514
5511
|
if (global.AccessType) {
|
|
5515
|
-
_context9.next =
|
|
5512
|
+
_context9.next = 12;
|
|
5516
5513
|
break;
|
|
5517
5514
|
}
|
|
5518
5515
|
|
|
5519
5516
|
return _context9.abrupt("return", {});
|
|
5520
5517
|
|
|
5521
|
-
case
|
|
5522
|
-
_context9.next =
|
|
5518
|
+
case 12:
|
|
5519
|
+
_context9.next = 14;
|
|
5523
5520
|
return awaitHelper(global.AccessType.getSubscriptions());
|
|
5524
5521
|
|
|
5525
|
-
case
|
|
5522
|
+
case 14:
|
|
5526
5523
|
_yield$awaitHelper8 = _context9.sent;
|
|
5527
5524
|
error = _yield$awaitHelper8.error;
|
|
5528
5525
|
_yield$awaitHelper8$d = _yield$awaitHelper8.data;
|
|
5529
5526
|
subscriptions = _yield$awaitHelper8$d === void 0 ? [] : _yield$awaitHelper8$d;
|
|
5530
5527
|
|
|
5531
5528
|
if (!error) {
|
|
5532
|
-
_context9.next =
|
|
5529
|
+
_context9.next = 21;
|
|
5533
5530
|
break;
|
|
5534
5531
|
}
|
|
5535
5532
|
|
|
5533
|
+
console.log("user subscription error-------", error);
|
|
5536
5534
|
return _context9.abrupt("return", error);
|
|
5537
5535
|
|
|
5538
|
-
case
|
|
5536
|
+
case 21:
|
|
5537
|
+
console.log("subscription----------", subscriptions);
|
|
5539
5538
|
return _context9.abrupt("return", subscriptions);
|
|
5540
5539
|
|
|
5541
|
-
case
|
|
5540
|
+
case 23:
|
|
5542
5541
|
case "end":
|
|
5543
5542
|
return _context9.stop();
|
|
5544
5543
|
}
|
|
@@ -5567,11 +5566,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5567
5566
|
break;
|
|
5568
5567
|
}
|
|
5569
5568
|
|
|
5570
|
-
throw new Error(
|
|
5569
|
+
throw new Error("planId is mandatory");
|
|
5571
5570
|
|
|
5572
5571
|
case 4:
|
|
5573
5572
|
_context10.next = 6;
|
|
5574
|
-
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId,
|
|
5573
|
+
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId, "switch"));
|
|
5575
5574
|
|
|
5576
5575
|
case 6:
|
|
5577
5576
|
_yield$awaitHelper9 = _context10.sent;
|
|
@@ -5604,12 +5603,13 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5604
5603
|
|
|
5605
5604
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initAccessType", function (callback) {
|
|
5606
5605
|
var accessTypeBkIntegrationId = _this.props.accessTypeBkIntegrationId;
|
|
5606
|
+
console.log("init accesstype-----");
|
|
5607
5607
|
|
|
5608
5608
|
try {
|
|
5609
5609
|
_this.loadScript(function () {
|
|
5610
5610
|
// dont try to initialize accessType if integration id is not available
|
|
5611
5611
|
if (accessTypeBkIntegrationId === undefined) {
|
|
5612
|
-
console.warn(
|
|
5612
|
+
console.warn("AccessType: Integration Id is undefined");
|
|
5613
5613
|
return false;
|
|
5614
5614
|
}
|
|
5615
5615
|
|
|
@@ -5648,11 +5648,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5648
5648
|
switch (_context11.prev = _context11.next) {
|
|
5649
5649
|
case 0:
|
|
5650
5650
|
selectedPlanObj = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
5651
|
-
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] :
|
|
5652
|
-
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] :
|
|
5653
|
-
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] :
|
|
5654
|
-
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] :
|
|
5655
|
-
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] :
|
|
5651
|
+
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "";
|
|
5652
|
+
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : "";
|
|
5653
|
+
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : "";
|
|
5654
|
+
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : "";
|
|
5655
|
+
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] : "";
|
|
5656
5656
|
opts = _args11.length > 6 ? _args11[6] : undefined;
|
|
5657
5657
|
|
|
5658
5658
|
if (selectedPlanObj) {
|
|
@@ -5660,15 +5660,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5660
5660
|
break;
|
|
5661
5661
|
}
|
|
5662
5662
|
|
|
5663
|
-
console.warn(
|
|
5663
|
+
console.warn("Razor pay needs a plan");
|
|
5664
5664
|
return _context11.abrupt("return", false);
|
|
5665
5665
|
|
|
5666
5666
|
case 10:
|
|
5667
|
-
intent = get__default["default"](opts, [
|
|
5668
|
-
switchType = get__default["default"](opts, [
|
|
5667
|
+
intent = get__default["default"](opts, ["intent"], "default");
|
|
5668
|
+
switchType = get__default["default"](opts, ["switchType"]);
|
|
5669
5669
|
planObject = _this.makePlanObject(selectedPlanObj, planType, storyId, storyHeadline, storySlug); //we are doing this to sake of backward compatibility and will be refactored later.
|
|
5670
5670
|
|
|
5671
|
-
planObject[
|
|
5671
|
+
planObject["paymentType"] = paymentType || (get__default["default"](planObject, ["selectedPlan", "recurring"]) ? "razorpay_recurring" : "razorpay");
|
|
5672
5672
|
paymentOptions = _this.props.paymentOptions;
|
|
5673
5673
|
_planObject$selectedP = planObject.selectedPlan, discounted_price_cents = _planObject$selectedP.discounted_price_cents, price_cents = _planObject$selectedP.price_cents;
|
|
5674
5674
|
paymentObject = _this.makePaymentObject(_objectSpread(_objectSpread({}, planObject), {}, {
|
|
@@ -5699,13 +5699,13 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5699
5699
|
}));
|
|
5700
5700
|
|
|
5701
5701
|
case 25:
|
|
5702
|
-
if (!(intent ===
|
|
5702
|
+
if (!(intent === "switch")) {
|
|
5703
5703
|
_context11.next = 34;
|
|
5704
5704
|
break;
|
|
5705
5705
|
}
|
|
5706
5706
|
|
|
5707
5707
|
_context11.next = 28;
|
|
5708
|
-
return awaitHelper(global.AccessType.getPaymentOptions(null, null,
|
|
5708
|
+
return awaitHelper(global.AccessType.getPaymentOptions(null, null, "switch"));
|
|
5709
5709
|
|
|
5710
5710
|
case 28:
|
|
5711
5711
|
_yield$awaitHelper11 = _context11.sent;
|
|
@@ -5717,7 +5717,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5717
5717
|
break;
|
|
5718
5718
|
}
|
|
5719
5719
|
|
|
5720
|
-
throw new Error(
|
|
5720
|
+
throw new Error("payment options fetch failed");
|
|
5721
5721
|
|
|
5722
5722
|
case 33:
|
|
5723
5723
|
return _context11.abrupt("return", switchPaymentOptions.razorpay.proceed(_objectSpread(_objectSpread({}, paymentObject), {}, {
|
|
@@ -5741,19 +5741,19 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5741
5741
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5742
5742
|
|
|
5743
5743
|
if (!options.selectedPlan) {
|
|
5744
|
-
console.warn(
|
|
5744
|
+
console.warn("Stripe pay needs a plan");
|
|
5745
5745
|
return false;
|
|
5746
5746
|
}
|
|
5747
5747
|
|
|
5748
5748
|
var paymentOptions = _this.props.paymentOptions;
|
|
5749
|
-
var paymentType = get__default["default"](options.selectedPlan, [
|
|
5749
|
+
var paymentType = get__default["default"](options.selectedPlan, ["recurring"]) ? "stripe_recurring" : "stripe";
|
|
5750
5750
|
|
|
5751
5751
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
5752
5752
|
paymentType: paymentType
|
|
5753
5753
|
}, options));
|
|
5754
5754
|
|
|
5755
5755
|
return paymentOptions.stripe ? paymentOptions.stripe.proceed(paymentObject) : Promise.reject({
|
|
5756
|
-
message:
|
|
5756
|
+
message: "Payment option is loading..."
|
|
5757
5757
|
});
|
|
5758
5758
|
});
|
|
5759
5759
|
|
|
@@ -5761,12 +5761,12 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5761
5761
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5762
5762
|
|
|
5763
5763
|
if (!options.selectedPlan) {
|
|
5764
|
-
console.warn(
|
|
5764
|
+
console.warn("Paypal pay needs a plan");
|
|
5765
5765
|
return false;
|
|
5766
5766
|
}
|
|
5767
5767
|
|
|
5768
5768
|
var paymentOptions = _this.props.paymentOptions;
|
|
5769
|
-
var paymentType = get__default["default"](options.selectedPlan, [
|
|
5769
|
+
var paymentType = get__default["default"](options.selectedPlan, ["recurring"]) ? "paypal_recurring" : "paypal";
|
|
5770
5770
|
|
|
5771
5771
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
5772
5772
|
paymentType: paymentType
|
|
@@ -5775,30 +5775,30 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5775
5775
|
return paymentOptions.paypal ? paymentOptions.paypal.proceed(paymentObject).then(function (response) {
|
|
5776
5776
|
return response.proceed(paymentObject);
|
|
5777
5777
|
}) : Promise.reject({
|
|
5778
|
-
message:
|
|
5778
|
+
message: "Payment option is loading..."
|
|
5779
5779
|
});
|
|
5780
5780
|
});
|
|
5781
5781
|
|
|
5782
5782
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initOmisePayment", function () {
|
|
5783
5783
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5784
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
5784
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
5785
5785
|
|
|
5786
5786
|
if (!selectedPlanObj) {
|
|
5787
|
-
console.warn(
|
|
5787
|
+
console.warn("Omise pay needs a plan");
|
|
5788
5788
|
return false;
|
|
5789
5789
|
}
|
|
5790
5790
|
|
|
5791
5791
|
var planObject = _this.makePlanObject(selectedPlanObj, planType);
|
|
5792
5792
|
|
|
5793
|
-
planObject[
|
|
5793
|
+
planObject["paymentType"] = get__default["default"](planObject, ["selectedPlan", "recurring"]) ? "omise_recurring" : "omise";
|
|
5794
5794
|
|
|
5795
5795
|
var paymentObject = _this.makePaymentObject(planObject);
|
|
5796
5796
|
|
|
5797
|
-
var omise = get__default["default"](_this.props, [
|
|
5797
|
+
var omise = get__default["default"](_this.props, ["paymentOptions", "omise"]);
|
|
5798
5798
|
|
|
5799
5799
|
if (!omise) {
|
|
5800
5800
|
return Promise.reject({
|
|
5801
|
-
message:
|
|
5801
|
+
message: "Payment option is loading..."
|
|
5802
5802
|
});
|
|
5803
5803
|
}
|
|
5804
5804
|
|
|
@@ -5809,31 +5809,31 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5809
5809
|
|
|
5810
5810
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initAdyenPayment", function () {
|
|
5811
5811
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5812
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
5812
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
5813
5813
|
var AdyenModal = arguments.length > 2 ? arguments[2] : undefined;
|
|
5814
5814
|
var locale = arguments.length > 3 ? arguments[3] : undefined;
|
|
5815
5815
|
|
|
5816
5816
|
var adyenExecutor = function adyenExecutor(resolve, reject) {
|
|
5817
|
-
if (!document.getElementById(
|
|
5818
|
-
var modalElement = document.createElement(
|
|
5819
|
-
modalElement.setAttribute(
|
|
5817
|
+
if (!document.getElementById("adyen-modal")) {
|
|
5818
|
+
var modalElement = document.createElement("div");
|
|
5819
|
+
modalElement.setAttribute("id", "adyen-modal");
|
|
5820
5820
|
document.body.appendChild(modalElement);
|
|
5821
5821
|
}
|
|
5822
5822
|
|
|
5823
5823
|
var afterOpen = function afterOpen() {
|
|
5824
5824
|
var planObject = _this.makePlanObject(selectedPlanObj, planType);
|
|
5825
5825
|
|
|
5826
|
-
var isRecurring = get__default["default"](planObject, [
|
|
5827
|
-
var paymentType = isRecurring ?
|
|
5826
|
+
var isRecurring = get__default["default"](planObject, ["selectedPlan", "recurring"]);
|
|
5827
|
+
var paymentType = isRecurring ? "adyen_recurring" : "adyen";
|
|
5828
5828
|
|
|
5829
5829
|
var paymentObject = _this.makePaymentObject(_objectSpread(_objectSpread({}, planObject), {}, {
|
|
5830
5830
|
paymentType: paymentType
|
|
5831
5831
|
}));
|
|
5832
5832
|
|
|
5833
|
-
var adyen = get__default["default"](_this.props, [
|
|
5833
|
+
var adyen = get__default["default"](_this.props, ["paymentOptions", "adyen"]);
|
|
5834
5834
|
paymentObject = _objectSpread(_objectSpread({}, paymentObject), {}, {
|
|
5835
|
-
options: _objectSpread(_objectSpread({}, paymentObject[
|
|
5836
|
-
dropin_container_id:
|
|
5835
|
+
options: _objectSpread(_objectSpread({}, paymentObject["options"]), {}, {
|
|
5836
|
+
dropin_container_id: "dropin-adyen",
|
|
5837
5837
|
locale: locale
|
|
5838
5838
|
}),
|
|
5839
5839
|
additional_data: {
|
|
@@ -5848,7 +5848,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5848
5848
|
ReactDOM__default["default"].render( /*#__PURE__*/React__default["default"].createElement(AdyenModal, {
|
|
5849
5849
|
afterOpen: afterOpen,
|
|
5850
5850
|
afterClose: reject
|
|
5851
|
-
}), document.getElementById(
|
|
5851
|
+
}), document.getElementById("adyen-modal"));
|
|
5852
5852
|
};
|
|
5853
5853
|
|
|
5854
5854
|
return new Promise(adyenExecutor);
|
|
@@ -5858,12 +5858,12 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5858
5858
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5859
5859
|
|
|
5860
5860
|
if (!options.selectedPlan) {
|
|
5861
|
-
console.warn(
|
|
5861
|
+
console.warn("Paytrail needs a plan");
|
|
5862
5862
|
return false;
|
|
5863
5863
|
}
|
|
5864
5864
|
|
|
5865
5865
|
var paymentOptions = _this.props.paymentOptions;
|
|
5866
|
-
var paymentType = get__default["default"](options.selectedPlan, [
|
|
5866
|
+
var paymentType = get__default["default"](options.selectedPlan, ["recurring"]) ? "paytrail_recurring" : "paytrail";
|
|
5867
5867
|
|
|
5868
5868
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
5869
5869
|
paymentType: paymentType
|
|
@@ -5872,7 +5872,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5872
5872
|
return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
|
|
5873
5873
|
return response.proceed(paymentObject);
|
|
5874
5874
|
}) : Promise.reject({
|
|
5875
|
-
message:
|
|
5875
|
+
message: "Payment option is loading..."
|
|
5876
5876
|
});
|
|
5877
5877
|
});
|
|
5878
5878
|
|
|
@@ -5885,7 +5885,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5885
5885
|
try {
|
|
5886
5886
|
global.AccessType.pingbackAssetAccess(asset, accessData);
|
|
5887
5887
|
} catch (e) {
|
|
5888
|
-
console.log(
|
|
5888
|
+
console.log("error in pingbackAssetAccess", e);
|
|
5889
5889
|
}
|
|
5890
5890
|
|
|
5891
5891
|
return _context12.abrupt("return", true);
|
|
@@ -5916,7 +5916,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5916
5916
|
break;
|
|
5917
5917
|
}
|
|
5918
5918
|
|
|
5919
|
-
console.warn(
|
|
5919
|
+
console.warn("AssetId is required");
|
|
5920
5920
|
return _context13.abrupt("return", false);
|
|
5921
5921
|
|
|
5922
5922
|
case 3:
|
|
@@ -5924,7 +5924,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5924
5924
|
|
|
5925
5925
|
asset = {
|
|
5926
5926
|
id: assetId,
|
|
5927
|
-
type:
|
|
5927
|
+
type: "story"
|
|
5928
5928
|
};
|
|
5929
5929
|
_context13.next = 7;
|
|
5930
5930
|
return awaitHelper(global.AccessType.isAssetAccessible(asset, _this.props.disableMetering));
|
|
@@ -5950,7 +5950,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5950
5950
|
|
|
5951
5951
|
_ref16 = accessData || {}, granted = _ref16.granted, grantReason = _ref16.grantReason, _ref16$data = _ref16.data, data = _ref16$data === void 0 ? {} : _ref16$data;
|
|
5952
5952
|
|
|
5953
|
-
if (!_this.props.disableMetering && granted && grantReason ===
|
|
5953
|
+
if (!_this.props.disableMetering && granted && grantReason === "METERING") {
|
|
5954
5954
|
_this.pingBackMeteredStory(asset, accessData);
|
|
5955
5955
|
|
|
5956
5956
|
_this.props.meterUpdated(data.numberRemaining || -1);
|
|
@@ -6035,8 +6035,8 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
6035
6035
|
};
|
|
6036
6036
|
}());
|
|
6037
6037
|
|
|
6038
|
-
_this.prodHost = props.prodHost ||
|
|
6039
|
-
_this.stagingHost = props.stagingHost ||
|
|
6038
|
+
_this.prodHost = props.prodHost || "https://www.accesstype.com";
|
|
6039
|
+
_this.stagingHost = props.stagingHost || "https://staging.accesstype.com";
|
|
6040
6040
|
return _this;
|
|
6041
6041
|
}
|
|
6042
6042
|
|
|
@@ -6051,25 +6051,25 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
6051
6051
|
var _ref19$selectedPlan = _ref19.selectedPlan,
|
|
6052
6052
|
selectedPlan = _ref19$selectedPlan === void 0 ? {} : _ref19$selectedPlan,
|
|
6053
6053
|
_ref19$couponCode = _ref19.couponCode,
|
|
6054
|
-
couponCode = _ref19$couponCode === void 0 ?
|
|
6054
|
+
couponCode = _ref19$couponCode === void 0 ? "" : _ref19$couponCode,
|
|
6055
6055
|
_ref19$recipientSubsc = _ref19.recipientSubscriber,
|
|
6056
6056
|
recipientSubscriber = _ref19$recipientSubsc === void 0 ? {} : _ref19$recipientSubsc,
|
|
6057
6057
|
_ref19$planType = _ref19.planType,
|
|
6058
|
-
planType = _ref19$planType === void 0 ?
|
|
6058
|
+
planType = _ref19$planType === void 0 ? "" : _ref19$planType,
|
|
6059
6059
|
_ref19$storyId = _ref19.storyId,
|
|
6060
|
-
storyId = _ref19$storyId === void 0 ?
|
|
6060
|
+
storyId = _ref19$storyId === void 0 ? "" : _ref19$storyId,
|
|
6061
6061
|
_ref19$storyHeadline = _ref19.storyHeadline,
|
|
6062
|
-
storyHeadline = _ref19$storyHeadline === void 0 ?
|
|
6062
|
+
storyHeadline = _ref19$storyHeadline === void 0 ? "" : _ref19$storyHeadline,
|
|
6063
6063
|
_ref19$storySlug = _ref19.storySlug,
|
|
6064
|
-
storySlug = _ref19$storySlug === void 0 ?
|
|
6064
|
+
storySlug = _ref19$storySlug === void 0 ? "" : _ref19$storySlug,
|
|
6065
6065
|
_ref19$paymentType = _ref19.paymentType,
|
|
6066
|
-
paymentType = _ref19$paymentType === void 0 ?
|
|
6066
|
+
paymentType = _ref19$paymentType === void 0 ? "" : _ref19$paymentType,
|
|
6067
6067
|
_ref19$successUrl = _ref19.successUrl,
|
|
6068
|
-
successUrl = _ref19$successUrl === void 0 ?
|
|
6068
|
+
successUrl = _ref19$successUrl === void 0 ? "" : _ref19$successUrl,
|
|
6069
6069
|
_ref19$returnUrl = _ref19.returnUrl,
|
|
6070
|
-
returnUrl = _ref19$returnUrl === void 0 ?
|
|
6070
|
+
returnUrl = _ref19$returnUrl === void 0 ? "" : _ref19$returnUrl,
|
|
6071
6071
|
_ref19$cancelUrl = _ref19.cancelUrl,
|
|
6072
|
-
cancelUrl = _ref19$cancelUrl === void 0 ?
|
|
6072
|
+
cancelUrl = _ref19$cancelUrl === void 0 ? "" : _ref19$cancelUrl;
|
|
6073
6073
|
var id = selectedPlan.id,
|
|
6074
6074
|
title = selectedPlan.title,
|
|
6075
6075
|
description = selectedPlan.description,
|
|
@@ -6114,9 +6114,9 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
6114
6114
|
};
|
|
6115
6115
|
|
|
6116
6116
|
if (returnUrl) {
|
|
6117
|
-
paymentObject.options.urls[
|
|
6117
|
+
paymentObject.options.urls["return_url"] = returnUrl;
|
|
6118
6118
|
} else {
|
|
6119
|
-
paymentObject.options.urls[
|
|
6119
|
+
paymentObject.options.urls["success_url"] = successUrl;
|
|
6120
6120
|
}
|
|
6121
6121
|
}
|
|
6122
6122
|
|
|
@@ -6126,11 +6126,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
6126
6126
|
key: "makePlanObject",
|
|
6127
6127
|
value: function makePlanObject() {
|
|
6128
6128
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6129
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
6130
|
-
var storyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
6131
|
-
var storyHeadline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
6132
|
-
var storySlug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] :
|
|
6133
|
-
return selectedPlanObj.argType && selectedPlanObj.argType ===
|
|
6129
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
6130
|
+
var storyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
6131
|
+
var storyHeadline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
|
6132
|
+
var storySlug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
6133
|
+
return selectedPlanObj.argType && selectedPlanObj.argType === "options" ? {
|
|
6134
6134
|
selectedPlan: selectedPlanObj.selectedPlan,
|
|
6135
6135
|
planType: selectedPlanObj.planType,
|
|
6136
6136
|
storyId: selectedPlanObj.storyId,
|
|
@@ -18,13 +18,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
18
18
|
|
|
19
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
20
|
|
|
21
|
-
import get from
|
|
22
|
-
import { bool, func, number, string } from
|
|
23
|
-
import React from
|
|
24
|
-
import ReactDOM from
|
|
25
|
-
import { batch, connect } from
|
|
26
|
-
import { ACCESS_BEING_LOADED, ACCESS_UPDATED, ASSET_PLANS, CAMPAIGN_SUBSCRIPTION_GROUP_UPDATED, METER_UPDATED, PAYMENT_OPTIONS_UPDATED, SUBSCRIPTION_GROUP_UPDATED } from
|
|
27
|
-
import { awaitHelper } from
|
|
21
|
+
import get from "lodash/get";
|
|
22
|
+
import { bool, func, number, string } from "prop-types";
|
|
23
|
+
import React from "react";
|
|
24
|
+
import ReactDOM from "react-dom";
|
|
25
|
+
import { batch, connect } from "react-redux";
|
|
26
|
+
import { ACCESS_BEING_LOADED, ACCESS_UPDATED, ASSET_PLANS, CAMPAIGN_SUBSCRIPTION_GROUP_UPDATED, METER_UPDATED, PAYMENT_OPTIONS_UPDATED, SUBSCRIPTION_GROUP_UPDATED } from "../store/actions";
|
|
27
|
+
import { awaitHelper } from "../utils";
|
|
28
28
|
|
|
29
29
|
var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
30
30
|
_inherits(AccessTypeBase, _React$Component);
|
|
@@ -39,30 +39,32 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
39
39
|
_this = _super.call(this, props);
|
|
40
40
|
|
|
41
41
|
_defineProperty(_assertThisInitialized(_this), "loadScript", function (callback) {
|
|
42
|
-
var accessTypeKey = get(_this.props, [
|
|
43
|
-
var isStaging = get(_this.props, [
|
|
44
|
-
var enableAccesstype = get(_this.props, [
|
|
42
|
+
var accessTypeKey = get(_this.props, ["accessTypeKey"]);
|
|
43
|
+
var isStaging = get(_this.props, ["isStaging"]);
|
|
44
|
+
var enableAccesstype = get(_this.props, ["enableAccesstype"]);
|
|
45
|
+
console.log("loadscript===============", _this.props);
|
|
45
46
|
|
|
46
47
|
if (!enableAccesstype) {
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
var HOST = isStaging ? _this.stagingHost : _this.prodHost;
|
|
51
|
-
var environment = isStaging ?
|
|
52
|
+
var environment = isStaging ? "&env=sandbox" : "";
|
|
52
53
|
var accessTypeHost = "".concat(HOST, "/frontend/v2/accesstype.js?key=").concat(accessTypeKey).concat(environment);
|
|
53
54
|
var isATScriptAlreadyPresent = document.querySelector("script[src=\"".concat(accessTypeHost, "\"]"));
|
|
54
55
|
|
|
55
56
|
if (accessTypeKey && !isATScriptAlreadyPresent && !global.AccessType && global.document) {
|
|
56
|
-
|
|
57
|
+
console.log("coming in creating the script---------");
|
|
58
|
+
var accessTypeScript = document.createElement("script");
|
|
57
59
|
|
|
58
60
|
accessTypeScript.onload = function () {
|
|
59
61
|
_this.props.onATGlobalSet && _this.props.onATGlobalSet();
|
|
60
62
|
callback();
|
|
61
63
|
};
|
|
62
64
|
|
|
63
|
-
accessTypeScript.setAttribute(
|
|
64
|
-
accessTypeScript.setAttribute(
|
|
65
|
-
accessTypeScript.setAttribute(
|
|
65
|
+
accessTypeScript.setAttribute("src", accessTypeHost);
|
|
66
|
+
accessTypeScript.setAttribute("id", "AccessTypeScript");
|
|
67
|
+
accessTypeScript.setAttribute("data-accessType-script", "1");
|
|
66
68
|
accessTypeScript.async = 1;
|
|
67
69
|
document.body.appendChild(accessTypeScript);
|
|
68
70
|
return true;
|
|
@@ -203,7 +205,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
203
205
|
break;
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
return _context3.abrupt("return", Promise.reject(
|
|
208
|
+
return _context3.abrupt("return", Promise.reject("Subscription id is not defined"));
|
|
207
209
|
|
|
208
210
|
case 3:
|
|
209
211
|
return _context3.abrupt("return", global.AccessType.cancelSubscription(subscriptionId));
|
|
@@ -216,22 +218,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
216
218
|
}, _callee3);
|
|
217
219
|
})));
|
|
218
220
|
|
|
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
|
-
|
|
235
221
|
_defineProperty(_assertThisInitialized(_this), "getSubscription", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
236
222
|
var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
|
|
237
223
|
|
|
@@ -239,8 +225,8 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
239
225
|
while (1) {
|
|
240
226
|
switch (_context4.prev = _context4.next) {
|
|
241
227
|
case 0:
|
|
242
|
-
accessTypeKey = get(_this.props, [
|
|
243
|
-
isStaging = get(_this.props, [
|
|
228
|
+
accessTypeKey = get(_this.props, ["accessTypeKey"]);
|
|
229
|
+
isStaging = get(_this.props, ["isStaging"]);
|
|
244
230
|
HOST = isStaging ? _this.stagingHost : _this.prodHost; // TODO: use AccesstypeJS method insead of direct api call
|
|
245
231
|
|
|
246
232
|
accessTypeHost = "".concat(HOST, "/api/v1/subscription_groups.json?key=").concat(accessTypeKey);
|
|
@@ -264,11 +250,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
264
250
|
}
|
|
265
251
|
|
|
266
252
|
return _context4.abrupt("return", {
|
|
267
|
-
error:
|
|
253
|
+
error: "subscriptions fetch failed"
|
|
268
254
|
});
|
|
269
255
|
|
|
270
256
|
case 15:
|
|
271
|
-
return _context4.abrupt("return", subscriptions[
|
|
257
|
+
return _context4.abrupt("return", subscriptions["subscription_groups"] || []);
|
|
272
258
|
|
|
273
259
|
case 16:
|
|
274
260
|
case "end":
|
|
@@ -307,7 +293,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
307
293
|
}
|
|
308
294
|
|
|
309
295
|
return _context5.abrupt("return", {
|
|
310
|
-
error:
|
|
296
|
+
error: "payment options fetch failed"
|
|
311
297
|
});
|
|
312
298
|
|
|
313
299
|
case 9:
|
|
@@ -333,7 +319,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
333
319
|
while (1) {
|
|
334
320
|
switch (_context6.prev = _context6.next) {
|
|
335
321
|
case 0:
|
|
336
|
-
storyId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] :
|
|
322
|
+
storyId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : "";
|
|
337
323
|
|
|
338
324
|
if (global.AccessType) {
|
|
339
325
|
_context6.next = 3;
|
|
@@ -346,7 +332,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
346
332
|
_context6.next = 5;
|
|
347
333
|
return awaitHelper(global.AccessType.getAssetPlans({
|
|
348
334
|
id: storyId,
|
|
349
|
-
type:
|
|
335
|
+
type: "story"
|
|
350
336
|
}));
|
|
351
337
|
|
|
352
338
|
case 5:
|
|
@@ -361,7 +347,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
361
347
|
}
|
|
362
348
|
|
|
363
349
|
return _context6.abrupt("return", {
|
|
364
|
-
error:
|
|
350
|
+
error: "asset plan fetch failed"
|
|
365
351
|
});
|
|
366
352
|
|
|
367
353
|
case 11:
|
|
@@ -382,15 +368,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
382
368
|
while (1) {
|
|
383
369
|
switch (_context7.prev = _context7.next) {
|
|
384
370
|
case 0:
|
|
385
|
-
isAccessTypeCampaignEnabled = get(_this.props, [
|
|
371
|
+
isAccessTypeCampaignEnabled = get(_this.props, ["isAccessTypeCampaignEnabled"], false);
|
|
386
372
|
|
|
387
373
|
if (!isAccessTypeCampaignEnabled) {
|
|
388
374
|
_context7.next = 18;
|
|
389
375
|
break;
|
|
390
376
|
}
|
|
391
377
|
|
|
392
|
-
accessTypeKey = get(_this.props, [
|
|
393
|
-
isStaging = get(_this.props, [
|
|
378
|
+
accessTypeKey = get(_this.props, ["accessTypeKey"]);
|
|
379
|
+
isStaging = get(_this.props, ["isStaging"]);
|
|
394
380
|
HOST = isStaging ? _this.stagingHost : _this.prodHost;
|
|
395
381
|
accessTypeHost = "".concat(HOST, "/api/v1/campaigns.json?key=").concat(accessTypeKey);
|
|
396
382
|
_context7.t0 = awaitHelper;
|
|
@@ -413,11 +399,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
413
399
|
}
|
|
414
400
|
|
|
415
401
|
return _context7.abrupt("return", {
|
|
416
|
-
error:
|
|
402
|
+
error: "subscriptions fetch failed"
|
|
417
403
|
});
|
|
418
404
|
|
|
419
405
|
case 17:
|
|
420
|
-
return _context7.abrupt("return", campaignSubscriptions[
|
|
406
|
+
return _context7.abrupt("return", campaignSubscriptions["subscription_groups"] || []);
|
|
421
407
|
|
|
422
408
|
case 18:
|
|
423
409
|
return _context7.abrupt("return", []);
|
|
@@ -431,10 +417,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
431
417
|
})));
|
|
432
418
|
|
|
433
419
|
_defineProperty(_assertThisInitialized(_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
434
|
-
var _this$props;
|
|
435
|
-
|
|
436
420
|
var callback,
|
|
437
|
-
url,
|
|
438
421
|
jwtResponse,
|
|
439
422
|
_yield$awaitHelper7,
|
|
440
423
|
error,
|
|
@@ -447,16 +430,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
447
430
|
callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
|
|
448
431
|
return null;
|
|
449
432
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
return fetch(url);
|
|
433
|
+
_context8.next = 3;
|
|
434
|
+
return fetch("/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
|
|
453
435
|
|
|
454
|
-
case
|
|
436
|
+
case 3:
|
|
455
437
|
jwtResponse = _context8.sent;
|
|
456
|
-
_context8.next =
|
|
457
|
-
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get(
|
|
438
|
+
_context8.next = 6;
|
|
439
|
+
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
|
|
458
440
|
|
|
459
|
-
case
|
|
441
|
+
case 6:
|
|
460
442
|
_yield$awaitHelper7 = _context8.sent;
|
|
461
443
|
error = _yield$awaitHelper7.error;
|
|
462
444
|
|
|
@@ -485,7 +467,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
485
467
|
}
|
|
486
468
|
}
|
|
487
469
|
|
|
488
|
-
case
|
|
470
|
+
case 9:
|
|
489
471
|
case "end":
|
|
490
472
|
return _context8.stop();
|
|
491
473
|
}
|
|
@@ -494,40 +476,57 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
494
476
|
})));
|
|
495
477
|
|
|
496
478
|
_defineProperty(_assertThisInitialized(_this), "getSubscriptionForUser", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
479
|
+
var _global, _window, _global2, _global2$get;
|
|
480
|
+
|
|
497
481
|
var _yield$awaitHelper8, error, _yield$awaitHelper8$d, subscriptions;
|
|
498
482
|
|
|
499
483
|
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
500
484
|
while (1) {
|
|
501
485
|
switch (_context9.prev = _context9.next) {
|
|
502
486
|
case 0:
|
|
487
|
+
console.log(typeof global !== 'undefined' ? 'Node.js' : 'Browser');
|
|
488
|
+
console.log("global.Accesstype---------", (_global = global) === null || _global === void 0 ? void 0 : _global.AccessType);
|
|
489
|
+
console.log("window.Accesstype---------", (_window = window) === null || _window === void 0 ? void 0 : _window.AccessType);
|
|
490
|
+
console.log("global---------", global);
|
|
491
|
+
console.log("object keys----", Object.keys(global));
|
|
492
|
+
console.log("object keys global.window----", Object.keys(global.window));
|
|
493
|
+
console.log("global window enumerable", Object.getOwnPropertyDescriptor(global.window, 'Accesstype'));
|
|
494
|
+
console.log("window----------", window);
|
|
495
|
+
console.log("global?.get?.('Accesstype')----", (_global2 = global) === null || _global2 === void 0 ? void 0 : (_global2$get = _global2.get) === null || _global2$get === void 0 ? void 0 : _global2$get.call(_global2, 'Accesstype'));
|
|
496
|
+
setTimeout(function () {
|
|
497
|
+
console.log("settimeout---------", global.Accesstype); // Check if it exists after some time
|
|
498
|
+
}, 1000);
|
|
499
|
+
|
|
503
500
|
if (global.AccessType) {
|
|
504
|
-
_context9.next =
|
|
501
|
+
_context9.next = 12;
|
|
505
502
|
break;
|
|
506
503
|
}
|
|
507
504
|
|
|
508
505
|
return _context9.abrupt("return", {});
|
|
509
506
|
|
|
510
|
-
case
|
|
511
|
-
_context9.next =
|
|
507
|
+
case 12:
|
|
508
|
+
_context9.next = 14;
|
|
512
509
|
return awaitHelper(global.AccessType.getSubscriptions());
|
|
513
510
|
|
|
514
|
-
case
|
|
511
|
+
case 14:
|
|
515
512
|
_yield$awaitHelper8 = _context9.sent;
|
|
516
513
|
error = _yield$awaitHelper8.error;
|
|
517
514
|
_yield$awaitHelper8$d = _yield$awaitHelper8.data;
|
|
518
515
|
subscriptions = _yield$awaitHelper8$d === void 0 ? [] : _yield$awaitHelper8$d;
|
|
519
516
|
|
|
520
517
|
if (!error) {
|
|
521
|
-
_context9.next =
|
|
518
|
+
_context9.next = 21;
|
|
522
519
|
break;
|
|
523
520
|
}
|
|
524
521
|
|
|
522
|
+
console.log("user subscription error-------", error);
|
|
525
523
|
return _context9.abrupt("return", error);
|
|
526
524
|
|
|
527
|
-
case
|
|
525
|
+
case 21:
|
|
526
|
+
console.log("subscription----------", subscriptions);
|
|
528
527
|
return _context9.abrupt("return", subscriptions);
|
|
529
528
|
|
|
530
|
-
case
|
|
529
|
+
case 23:
|
|
531
530
|
case "end":
|
|
532
531
|
return _context9.stop();
|
|
533
532
|
}
|
|
@@ -556,11 +555,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
556
555
|
break;
|
|
557
556
|
}
|
|
558
557
|
|
|
559
|
-
throw new Error(
|
|
558
|
+
throw new Error("planId is mandatory");
|
|
560
559
|
|
|
561
560
|
case 4:
|
|
562
561
|
_context10.next = 6;
|
|
563
|
-
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId,
|
|
562
|
+
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId, "switch"));
|
|
564
563
|
|
|
565
564
|
case 6:
|
|
566
565
|
_yield$awaitHelper9 = _context10.sent;
|
|
@@ -593,12 +592,13 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
593
592
|
|
|
594
593
|
_defineProperty(_assertThisInitialized(_this), "initAccessType", function (callback) {
|
|
595
594
|
var accessTypeBkIntegrationId = _this.props.accessTypeBkIntegrationId;
|
|
595
|
+
console.log("init accesstype-----");
|
|
596
596
|
|
|
597
597
|
try {
|
|
598
598
|
_this.loadScript(function () {
|
|
599
599
|
// dont try to initialize accessType if integration id is not available
|
|
600
600
|
if (accessTypeBkIntegrationId === undefined) {
|
|
601
|
-
console.warn(
|
|
601
|
+
console.warn("AccessType: Integration Id is undefined");
|
|
602
602
|
return false;
|
|
603
603
|
}
|
|
604
604
|
|
|
@@ -637,11 +637,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
637
637
|
switch (_context11.prev = _context11.next) {
|
|
638
638
|
case 0:
|
|
639
639
|
selectedPlanObj = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
640
|
-
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] :
|
|
641
|
-
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] :
|
|
642
|
-
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] :
|
|
643
|
-
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] :
|
|
644
|
-
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] :
|
|
640
|
+
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "";
|
|
641
|
+
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : "";
|
|
642
|
+
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : "";
|
|
643
|
+
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : "";
|
|
644
|
+
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] : "";
|
|
645
645
|
opts = _args11.length > 6 ? _args11[6] : undefined;
|
|
646
646
|
|
|
647
647
|
if (selectedPlanObj) {
|
|
@@ -649,15 +649,15 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
649
649
|
break;
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
-
console.warn(
|
|
652
|
+
console.warn("Razor pay needs a plan");
|
|
653
653
|
return _context11.abrupt("return", false);
|
|
654
654
|
|
|
655
655
|
case 10:
|
|
656
|
-
intent = get(opts, [
|
|
657
|
-
switchType = get(opts, [
|
|
656
|
+
intent = get(opts, ["intent"], "default");
|
|
657
|
+
switchType = get(opts, ["switchType"]);
|
|
658
658
|
planObject = _this.makePlanObject(selectedPlanObj, planType, storyId, storyHeadline, storySlug); //we are doing this to sake of backward compatibility and will be refactored later.
|
|
659
659
|
|
|
660
|
-
planObject[
|
|
660
|
+
planObject["paymentType"] = paymentType || (get(planObject, ["selectedPlan", "recurring"]) ? "razorpay_recurring" : "razorpay");
|
|
661
661
|
paymentOptions = _this.props.paymentOptions;
|
|
662
662
|
_planObject$selectedP = planObject.selectedPlan, discounted_price_cents = _planObject$selectedP.discounted_price_cents, price_cents = _planObject$selectedP.price_cents;
|
|
663
663
|
paymentObject = _this.makePaymentObject(_objectSpread(_objectSpread({}, planObject), {}, {
|
|
@@ -688,13 +688,13 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
688
688
|
}));
|
|
689
689
|
|
|
690
690
|
case 25:
|
|
691
|
-
if (!(intent ===
|
|
691
|
+
if (!(intent === "switch")) {
|
|
692
692
|
_context11.next = 34;
|
|
693
693
|
break;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
_context11.next = 28;
|
|
697
|
-
return awaitHelper(global.AccessType.getPaymentOptions(null, null,
|
|
697
|
+
return awaitHelper(global.AccessType.getPaymentOptions(null, null, "switch"));
|
|
698
698
|
|
|
699
699
|
case 28:
|
|
700
700
|
_yield$awaitHelper11 = _context11.sent;
|
|
@@ -706,7 +706,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
706
706
|
break;
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
throw new Error(
|
|
709
|
+
throw new Error("payment options fetch failed");
|
|
710
710
|
|
|
711
711
|
case 33:
|
|
712
712
|
return _context11.abrupt("return", switchPaymentOptions.razorpay.proceed(_objectSpread(_objectSpread({}, paymentObject), {}, {
|
|
@@ -730,19 +730,19 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
730
730
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
731
731
|
|
|
732
732
|
if (!options.selectedPlan) {
|
|
733
|
-
console.warn(
|
|
733
|
+
console.warn("Stripe pay needs a plan");
|
|
734
734
|
return false;
|
|
735
735
|
}
|
|
736
736
|
|
|
737
737
|
var paymentOptions = _this.props.paymentOptions;
|
|
738
|
-
var paymentType = get(options.selectedPlan, [
|
|
738
|
+
var paymentType = get(options.selectedPlan, ["recurring"]) ? "stripe_recurring" : "stripe";
|
|
739
739
|
|
|
740
740
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
741
741
|
paymentType: paymentType
|
|
742
742
|
}, options));
|
|
743
743
|
|
|
744
744
|
return paymentOptions.stripe ? paymentOptions.stripe.proceed(paymentObject) : Promise.reject({
|
|
745
|
-
message:
|
|
745
|
+
message: "Payment option is loading..."
|
|
746
746
|
});
|
|
747
747
|
});
|
|
748
748
|
|
|
@@ -750,12 +750,12 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
750
750
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
751
751
|
|
|
752
752
|
if (!options.selectedPlan) {
|
|
753
|
-
console.warn(
|
|
753
|
+
console.warn("Paypal pay needs a plan");
|
|
754
754
|
return false;
|
|
755
755
|
}
|
|
756
756
|
|
|
757
757
|
var paymentOptions = _this.props.paymentOptions;
|
|
758
|
-
var paymentType = get(options.selectedPlan, [
|
|
758
|
+
var paymentType = get(options.selectedPlan, ["recurring"]) ? "paypal_recurring" : "paypal";
|
|
759
759
|
|
|
760
760
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
761
761
|
paymentType: paymentType
|
|
@@ -764,30 +764,30 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
764
764
|
return paymentOptions.paypal ? paymentOptions.paypal.proceed(paymentObject).then(function (response) {
|
|
765
765
|
return response.proceed(paymentObject);
|
|
766
766
|
}) : Promise.reject({
|
|
767
|
-
message:
|
|
767
|
+
message: "Payment option is loading..."
|
|
768
768
|
});
|
|
769
769
|
});
|
|
770
770
|
|
|
771
771
|
_defineProperty(_assertThisInitialized(_this), "initOmisePayment", function () {
|
|
772
772
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
773
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
773
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
774
774
|
|
|
775
775
|
if (!selectedPlanObj) {
|
|
776
|
-
console.warn(
|
|
776
|
+
console.warn("Omise pay needs a plan");
|
|
777
777
|
return false;
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
var planObject = _this.makePlanObject(selectedPlanObj, planType);
|
|
781
781
|
|
|
782
|
-
planObject[
|
|
782
|
+
planObject["paymentType"] = get(planObject, ["selectedPlan", "recurring"]) ? "omise_recurring" : "omise";
|
|
783
783
|
|
|
784
784
|
var paymentObject = _this.makePaymentObject(planObject);
|
|
785
785
|
|
|
786
|
-
var omise = get(_this.props, [
|
|
786
|
+
var omise = get(_this.props, ["paymentOptions", "omise"]);
|
|
787
787
|
|
|
788
788
|
if (!omise) {
|
|
789
789
|
return Promise.reject({
|
|
790
|
-
message:
|
|
790
|
+
message: "Payment option is loading..."
|
|
791
791
|
});
|
|
792
792
|
}
|
|
793
793
|
|
|
@@ -798,31 +798,31 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
798
798
|
|
|
799
799
|
_defineProperty(_assertThisInitialized(_this), "initAdyenPayment", function () {
|
|
800
800
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
801
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
801
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
802
802
|
var AdyenModal = arguments.length > 2 ? arguments[2] : undefined;
|
|
803
803
|
var locale = arguments.length > 3 ? arguments[3] : undefined;
|
|
804
804
|
|
|
805
805
|
var adyenExecutor = function adyenExecutor(resolve, reject) {
|
|
806
|
-
if (!document.getElementById(
|
|
807
|
-
var modalElement = document.createElement(
|
|
808
|
-
modalElement.setAttribute(
|
|
806
|
+
if (!document.getElementById("adyen-modal")) {
|
|
807
|
+
var modalElement = document.createElement("div");
|
|
808
|
+
modalElement.setAttribute("id", "adyen-modal");
|
|
809
809
|
document.body.appendChild(modalElement);
|
|
810
810
|
}
|
|
811
811
|
|
|
812
812
|
var afterOpen = function afterOpen() {
|
|
813
813
|
var planObject = _this.makePlanObject(selectedPlanObj, planType);
|
|
814
814
|
|
|
815
|
-
var isRecurring = get(planObject, [
|
|
816
|
-
var paymentType = isRecurring ?
|
|
815
|
+
var isRecurring = get(planObject, ["selectedPlan", "recurring"]);
|
|
816
|
+
var paymentType = isRecurring ? "adyen_recurring" : "adyen";
|
|
817
817
|
|
|
818
818
|
var paymentObject = _this.makePaymentObject(_objectSpread(_objectSpread({}, planObject), {}, {
|
|
819
819
|
paymentType: paymentType
|
|
820
820
|
}));
|
|
821
821
|
|
|
822
|
-
var adyen = get(_this.props, [
|
|
822
|
+
var adyen = get(_this.props, ["paymentOptions", "adyen"]);
|
|
823
823
|
paymentObject = _objectSpread(_objectSpread({}, paymentObject), {}, {
|
|
824
|
-
options: _objectSpread(_objectSpread({}, paymentObject[
|
|
825
|
-
dropin_container_id:
|
|
824
|
+
options: _objectSpread(_objectSpread({}, paymentObject["options"]), {}, {
|
|
825
|
+
dropin_container_id: "dropin-adyen",
|
|
826
826
|
locale: locale
|
|
827
827
|
}),
|
|
828
828
|
additional_data: {
|
|
@@ -837,7 +837,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
837
837
|
ReactDOM.render( /*#__PURE__*/React.createElement(AdyenModal, {
|
|
838
838
|
afterOpen: afterOpen,
|
|
839
839
|
afterClose: reject
|
|
840
|
-
}), document.getElementById(
|
|
840
|
+
}), document.getElementById("adyen-modal"));
|
|
841
841
|
};
|
|
842
842
|
|
|
843
843
|
return new Promise(adyenExecutor);
|
|
@@ -847,12 +847,12 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
847
847
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
848
848
|
|
|
849
849
|
if (!options.selectedPlan) {
|
|
850
|
-
console.warn(
|
|
850
|
+
console.warn("Paytrail needs a plan");
|
|
851
851
|
return false;
|
|
852
852
|
}
|
|
853
853
|
|
|
854
854
|
var paymentOptions = _this.props.paymentOptions;
|
|
855
|
-
var paymentType = get(options.selectedPlan, [
|
|
855
|
+
var paymentType = get(options.selectedPlan, ["recurring"]) ? "paytrail_recurring" : "paytrail";
|
|
856
856
|
|
|
857
857
|
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
858
858
|
paymentType: paymentType
|
|
@@ -861,7 +861,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
861
861
|
return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
|
|
862
862
|
return response.proceed(paymentObject);
|
|
863
863
|
}) : Promise.reject({
|
|
864
|
-
message:
|
|
864
|
+
message: "Payment option is loading..."
|
|
865
865
|
});
|
|
866
866
|
});
|
|
867
867
|
|
|
@@ -874,7 +874,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
874
874
|
try {
|
|
875
875
|
global.AccessType.pingbackAssetAccess(asset, accessData);
|
|
876
876
|
} catch (e) {
|
|
877
|
-
console.log(
|
|
877
|
+
console.log("error in pingbackAssetAccess", e);
|
|
878
878
|
}
|
|
879
879
|
|
|
880
880
|
return _context12.abrupt("return", true);
|
|
@@ -905,7 +905,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
905
905
|
break;
|
|
906
906
|
}
|
|
907
907
|
|
|
908
|
-
console.warn(
|
|
908
|
+
console.warn("AssetId is required");
|
|
909
909
|
return _context13.abrupt("return", false);
|
|
910
910
|
|
|
911
911
|
case 3:
|
|
@@ -913,7 +913,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
913
913
|
|
|
914
914
|
asset = {
|
|
915
915
|
id: assetId,
|
|
916
|
-
type:
|
|
916
|
+
type: "story"
|
|
917
917
|
};
|
|
918
918
|
_context13.next = 7;
|
|
919
919
|
return awaitHelper(global.AccessType.isAssetAccessible(asset, _this.props.disableMetering));
|
|
@@ -939,7 +939,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
939
939
|
|
|
940
940
|
_ref16 = accessData || {}, granted = _ref16.granted, grantReason = _ref16.grantReason, _ref16$data = _ref16.data, data = _ref16$data === void 0 ? {} : _ref16$data;
|
|
941
941
|
|
|
942
|
-
if (!_this.props.disableMetering && granted && grantReason ===
|
|
942
|
+
if (!_this.props.disableMetering && granted && grantReason === "METERING") {
|
|
943
943
|
_this.pingBackMeteredStory(asset, accessData);
|
|
944
944
|
|
|
945
945
|
_this.props.meterUpdated(data.numberRemaining || -1);
|
|
@@ -1024,8 +1024,8 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
}());
|
|
1026
1026
|
|
|
1027
|
-
_this.prodHost = props.prodHost ||
|
|
1028
|
-
_this.stagingHost = props.stagingHost ||
|
|
1027
|
+
_this.prodHost = props.prodHost || "https://www.accesstype.com";
|
|
1028
|
+
_this.stagingHost = props.stagingHost || "https://staging.accesstype.com";
|
|
1029
1029
|
return _this;
|
|
1030
1030
|
}
|
|
1031
1031
|
|
|
@@ -1040,25 +1040,25 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1040
1040
|
var _ref19$selectedPlan = _ref19.selectedPlan,
|
|
1041
1041
|
selectedPlan = _ref19$selectedPlan === void 0 ? {} : _ref19$selectedPlan,
|
|
1042
1042
|
_ref19$couponCode = _ref19.couponCode,
|
|
1043
|
-
couponCode = _ref19$couponCode === void 0 ?
|
|
1043
|
+
couponCode = _ref19$couponCode === void 0 ? "" : _ref19$couponCode,
|
|
1044
1044
|
_ref19$recipientSubsc = _ref19.recipientSubscriber,
|
|
1045
1045
|
recipientSubscriber = _ref19$recipientSubsc === void 0 ? {} : _ref19$recipientSubsc,
|
|
1046
1046
|
_ref19$planType = _ref19.planType,
|
|
1047
|
-
planType = _ref19$planType === void 0 ?
|
|
1047
|
+
planType = _ref19$planType === void 0 ? "" : _ref19$planType,
|
|
1048
1048
|
_ref19$storyId = _ref19.storyId,
|
|
1049
|
-
storyId = _ref19$storyId === void 0 ?
|
|
1049
|
+
storyId = _ref19$storyId === void 0 ? "" : _ref19$storyId,
|
|
1050
1050
|
_ref19$storyHeadline = _ref19.storyHeadline,
|
|
1051
|
-
storyHeadline = _ref19$storyHeadline === void 0 ?
|
|
1051
|
+
storyHeadline = _ref19$storyHeadline === void 0 ? "" : _ref19$storyHeadline,
|
|
1052
1052
|
_ref19$storySlug = _ref19.storySlug,
|
|
1053
|
-
storySlug = _ref19$storySlug === void 0 ?
|
|
1053
|
+
storySlug = _ref19$storySlug === void 0 ? "" : _ref19$storySlug,
|
|
1054
1054
|
_ref19$paymentType = _ref19.paymentType,
|
|
1055
|
-
paymentType = _ref19$paymentType === void 0 ?
|
|
1055
|
+
paymentType = _ref19$paymentType === void 0 ? "" : _ref19$paymentType,
|
|
1056
1056
|
_ref19$successUrl = _ref19.successUrl,
|
|
1057
|
-
successUrl = _ref19$successUrl === void 0 ?
|
|
1057
|
+
successUrl = _ref19$successUrl === void 0 ? "" : _ref19$successUrl,
|
|
1058
1058
|
_ref19$returnUrl = _ref19.returnUrl,
|
|
1059
|
-
returnUrl = _ref19$returnUrl === void 0 ?
|
|
1059
|
+
returnUrl = _ref19$returnUrl === void 0 ? "" : _ref19$returnUrl,
|
|
1060
1060
|
_ref19$cancelUrl = _ref19.cancelUrl,
|
|
1061
|
-
cancelUrl = _ref19$cancelUrl === void 0 ?
|
|
1061
|
+
cancelUrl = _ref19$cancelUrl === void 0 ? "" : _ref19$cancelUrl;
|
|
1062
1062
|
var id = selectedPlan.id,
|
|
1063
1063
|
title = selectedPlan.title,
|
|
1064
1064
|
description = selectedPlan.description,
|
|
@@ -1103,9 +1103,9 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1103
1103
|
};
|
|
1104
1104
|
|
|
1105
1105
|
if (returnUrl) {
|
|
1106
|
-
paymentObject.options.urls[
|
|
1106
|
+
paymentObject.options.urls["return_url"] = returnUrl;
|
|
1107
1107
|
} else {
|
|
1108
|
-
paymentObject.options.urls[
|
|
1108
|
+
paymentObject.options.urls["success_url"] = successUrl;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
@@ -1115,11 +1115,11 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1115
1115
|
key: "makePlanObject",
|
|
1116
1116
|
value: function makePlanObject() {
|
|
1117
1117
|
var selectedPlanObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1118
|
-
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
1119
|
-
var storyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
1120
|
-
var storyHeadline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] :
|
|
1121
|
-
var storySlug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] :
|
|
1122
|
-
return selectedPlanObj.argType && selectedPlanObj.argType ===
|
|
1118
|
+
var planType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
1119
|
+
var storyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
1120
|
+
var storyHeadline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
|
1121
|
+
var storySlug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
1122
|
+
return selectedPlanObj.argType && selectedPlanObj.argType === "options" ? {
|
|
1123
1123
|
selectedPlan: selectedPlanObj.selectedPlan,
|
|
1124
1124
|
planType: selectedPlanObj.planType,
|
|
1125
1125
|
storyId: selectedPlanObj.storyId,
|