@quintype/components 3.5.1-test.1 → 3.5.1-upgrade-downgrade.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 +169 -134
- package/dist/es/components/access-type.js +169 -134
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -5030,7 +5030,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5030
5030
|
var environment = isStaging ? "&env=sandbox" : "";
|
|
5031
5031
|
var accessTypeHost = "".concat(HOST, "/frontend/v2/accesstype.js?key=").concat(accessTypeKey).concat(environment);
|
|
5032
5032
|
var isATScriptAlreadyPresent = document.querySelector("script[src=\"".concat(accessTypeHost, "\"]"));
|
|
5033
|
-
console.log("");
|
|
5034
5033
|
|
|
5035
5034
|
if (accessTypeKey && !isATScriptAlreadyPresent && !global.AccessType && global.document) {
|
|
5036
5035
|
var accessTypeScript = document.createElement("script");
|
|
@@ -5223,19 +5222,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5223
5222
|
subscriptions = _yield$awaitHelper3.data;
|
|
5224
5223
|
|
|
5225
5224
|
if (!error) {
|
|
5226
|
-
_context4.next =
|
|
5225
|
+
_context4.next = 15;
|
|
5227
5226
|
break;
|
|
5228
5227
|
}
|
|
5229
5228
|
|
|
5230
|
-
console.log("getSubscription---------", error);
|
|
5231
5229
|
return _context4.abrupt("return", {
|
|
5232
5230
|
error: "subscriptions fetch failed"
|
|
5233
5231
|
});
|
|
5234
5232
|
|
|
5235
|
-
case
|
|
5233
|
+
case 15:
|
|
5236
5234
|
return _context4.abrupt("return", subscriptions["subscription_groups"] || []);
|
|
5237
5235
|
|
|
5238
|
-
case
|
|
5236
|
+
case 16:
|
|
5239
5237
|
case "end":
|
|
5240
5238
|
return _context4.stop();
|
|
5241
5239
|
}
|
|
@@ -5267,19 +5265,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5267
5265
|
paymentOptions = _yield$awaitHelper4.data;
|
|
5268
5266
|
|
|
5269
5267
|
if (!error) {
|
|
5270
|
-
_context5.next =
|
|
5268
|
+
_context5.next = 9;
|
|
5271
5269
|
break;
|
|
5272
5270
|
}
|
|
5273
5271
|
|
|
5274
|
-
console.log("error---------------getPaymentOptions", error);
|
|
5275
5272
|
return _context5.abrupt("return", {
|
|
5276
5273
|
error: "payment options fetch failed"
|
|
5277
5274
|
});
|
|
5278
5275
|
|
|
5279
|
-
case
|
|
5276
|
+
case 9:
|
|
5280
5277
|
return _context5.abrupt("return", paymentOptions);
|
|
5281
5278
|
|
|
5282
|
-
case
|
|
5279
|
+
case 10:
|
|
5283
5280
|
case "end":
|
|
5284
5281
|
return _context5.stop();
|
|
5285
5282
|
}
|
|
@@ -5322,19 +5319,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5322
5319
|
assetPlans = _yield$awaitHelper5$d === void 0 ? {} : _yield$awaitHelper5$d;
|
|
5323
5320
|
|
|
5324
5321
|
if (!error) {
|
|
5325
|
-
_context6.next =
|
|
5322
|
+
_context6.next = 11;
|
|
5326
5323
|
break;
|
|
5327
5324
|
}
|
|
5328
5325
|
|
|
5329
|
-
console.log("error---------------getAssetPlans", error);
|
|
5330
5326
|
return _context6.abrupt("return", {
|
|
5331
5327
|
error: "asset plan fetch failed"
|
|
5332
5328
|
});
|
|
5333
5329
|
|
|
5334
|
-
case
|
|
5330
|
+
case 11:
|
|
5335
5331
|
return _context6.abrupt("return", assetPlans);
|
|
5336
5332
|
|
|
5337
|
-
case
|
|
5333
|
+
case 12:
|
|
5338
5334
|
case "end":
|
|
5339
5335
|
return _context6.stop();
|
|
5340
5336
|
}
|
|
@@ -5352,7 +5348,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5352
5348
|
isAccessTypeCampaignEnabled = get__default["default"](_this.props, ["isAccessTypeCampaignEnabled"], false);
|
|
5353
5349
|
|
|
5354
5350
|
if (!isAccessTypeCampaignEnabled) {
|
|
5355
|
-
_context7.next =
|
|
5351
|
+
_context7.next = 18;
|
|
5356
5352
|
break;
|
|
5357
5353
|
}
|
|
5358
5354
|
|
|
@@ -5375,22 +5371,21 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5375
5371
|
campaignSubscriptions = _yield$awaitHelper6.data;
|
|
5376
5372
|
|
|
5377
5373
|
if (!error) {
|
|
5378
|
-
_context7.next =
|
|
5374
|
+
_context7.next = 17;
|
|
5379
5375
|
break;
|
|
5380
5376
|
}
|
|
5381
5377
|
|
|
5382
|
-
console.log("error---------------getCampaignSubscription", error);
|
|
5383
5378
|
return _context7.abrupt("return", {
|
|
5384
5379
|
error: "subscriptions fetch failed"
|
|
5385
5380
|
});
|
|
5386
5381
|
|
|
5387
|
-
case
|
|
5382
|
+
case 17:
|
|
5388
5383
|
return _context7.abrupt("return", campaignSubscriptions["subscription_groups"] || []);
|
|
5389
5384
|
|
|
5390
|
-
case
|
|
5385
|
+
case 18:
|
|
5391
5386
|
return _context7.abrupt("return", []);
|
|
5392
5387
|
|
|
5393
|
-
case
|
|
5388
|
+
case 19:
|
|
5394
5389
|
case "end":
|
|
5395
5390
|
return _context7.stop();
|
|
5396
5391
|
}
|
|
@@ -5423,7 +5418,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5423
5418
|
case 6:
|
|
5424
5419
|
_yield$awaitHelper7 = _context8.sent;
|
|
5425
5420
|
error = _yield$awaitHelper7.error;
|
|
5426
|
-
console.log("error---------", error);
|
|
5427
5421
|
|
|
5428
5422
|
if (!error) {
|
|
5429
5423
|
try {
|
|
@@ -5435,11 +5429,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5435
5429
|
campaignSubscriptionGroups = _ref10[3];
|
|
5436
5430
|
|
|
5437
5431
|
reactRedux.batch(function () {
|
|
5438
|
-
console.log("subscriptionGroups----------", subscriptionGroups);
|
|
5439
|
-
console.log("paymentOptions----------", paymentOptions);
|
|
5440
|
-
console.log("assetPlans----------", assetPlans);
|
|
5441
|
-
console.log("campaignSubscriptionGroups----------", campaignSubscriptionGroups);
|
|
5442
|
-
|
|
5443
5432
|
_this.props.subscriptionGroupLoaded(subscriptionGroups);
|
|
5444
5433
|
|
|
5445
5434
|
_this.props.paymentOptionsLoaded(paymentOptions);
|
|
@@ -5455,7 +5444,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5455
5444
|
}
|
|
5456
5445
|
}
|
|
5457
5446
|
|
|
5458
|
-
case
|
|
5447
|
+
case 9:
|
|
5459
5448
|
case "end":
|
|
5460
5449
|
return _context8.stop();
|
|
5461
5450
|
}
|
|
@@ -5505,6 +5494,62 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5505
5494
|
}, _callee9);
|
|
5506
5495
|
})));
|
|
5507
5496
|
|
|
5497
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscriptionsWithSwitchablePlans", /*#__PURE__*/function () {
|
|
5498
|
+
var _ref12 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(planId) {
|
|
5499
|
+
var _yield$awaitHelper9, error, _yield$awaitHelper9$d, subscription;
|
|
5500
|
+
|
|
5501
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
|
|
5502
|
+
while (1) {
|
|
5503
|
+
switch (_context10.prev = _context10.next) {
|
|
5504
|
+
case 0:
|
|
5505
|
+
if (global.AccessType) {
|
|
5506
|
+
_context10.next = 2;
|
|
5507
|
+
break;
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5510
|
+
return _context10.abrupt("return", {});
|
|
5511
|
+
|
|
5512
|
+
case 2:
|
|
5513
|
+
if (planId) {
|
|
5514
|
+
_context10.next = 4;
|
|
5515
|
+
break;
|
|
5516
|
+
}
|
|
5517
|
+
|
|
5518
|
+
throw new Error("planId is mandatory");
|
|
5519
|
+
|
|
5520
|
+
case 4:
|
|
5521
|
+
_context10.next = 6;
|
|
5522
|
+
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId, "switch"));
|
|
5523
|
+
|
|
5524
|
+
case 6:
|
|
5525
|
+
_yield$awaitHelper9 = _context10.sent;
|
|
5526
|
+
error = _yield$awaitHelper9.error;
|
|
5527
|
+
_yield$awaitHelper9$d = _yield$awaitHelper9.data;
|
|
5528
|
+
subscription = _yield$awaitHelper9$d === void 0 ? {} : _yield$awaitHelper9$d;
|
|
5529
|
+
|
|
5530
|
+
if (!error) {
|
|
5531
|
+
_context10.next = 12;
|
|
5532
|
+
break;
|
|
5533
|
+
}
|
|
5534
|
+
|
|
5535
|
+
return _context10.abrupt("return", error);
|
|
5536
|
+
|
|
5537
|
+
case 12:
|
|
5538
|
+
return _context10.abrupt("return", subscription);
|
|
5539
|
+
|
|
5540
|
+
case 13:
|
|
5541
|
+
case "end":
|
|
5542
|
+
return _context10.stop();
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
}, _callee10);
|
|
5546
|
+
}));
|
|
5547
|
+
|
|
5548
|
+
return function (_x6) {
|
|
5549
|
+
return _ref12.apply(this, arguments);
|
|
5550
|
+
};
|
|
5551
|
+
}());
|
|
5552
|
+
|
|
5508
5553
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initAccessType", function (callback) {
|
|
5509
5554
|
var accessTypeBkIntegrationId = _this.props.accessTypeBkIntegrationId;
|
|
5510
5555
|
|
|
@@ -5523,7 +5568,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5523
5568
|
}
|
|
5524
5569
|
});
|
|
5525
5570
|
|
|
5526
|
-
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initRazorPayPayment", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
5571
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initRazorPayPayment", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11() {
|
|
5527
5572
|
var selectedPlanObj,
|
|
5528
5573
|
planType,
|
|
5529
5574
|
storyId,
|
|
@@ -5535,29 +5580,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5535
5580
|
_planObject$selectedP,
|
|
5536
5581
|
discounted_price_cents,
|
|
5537
5582
|
price_cents,
|
|
5538
|
-
_yield$
|
|
5583
|
+
_yield$awaitHelper10,
|
|
5539
5584
|
data,
|
|
5540
5585
|
paymentObject,
|
|
5541
|
-
|
|
5586
|
+
_args11 = arguments;
|
|
5542
5587
|
|
|
5543
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
5588
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context11) {
|
|
5544
5589
|
while (1) {
|
|
5545
|
-
switch (
|
|
5590
|
+
switch (_context11.prev = _context11.next) {
|
|
5546
5591
|
case 0:
|
|
5547
|
-
selectedPlanObj =
|
|
5548
|
-
planType =
|
|
5549
|
-
storyId =
|
|
5550
|
-
storyHeadline =
|
|
5551
|
-
storySlug =
|
|
5552
|
-
paymentType =
|
|
5592
|
+
selectedPlanObj = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
5593
|
+
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "";
|
|
5594
|
+
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : "";
|
|
5595
|
+
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : "";
|
|
5596
|
+
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : "";
|
|
5597
|
+
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] : "";
|
|
5553
5598
|
|
|
5554
5599
|
if (selectedPlanObj) {
|
|
5555
|
-
|
|
5600
|
+
_context11.next = 9;
|
|
5556
5601
|
break;
|
|
5557
5602
|
}
|
|
5558
5603
|
|
|
5559
5604
|
console.warn("Razor pay needs a plan");
|
|
5560
|
-
return
|
|
5605
|
+
return _context11.abrupt("return", false);
|
|
5561
5606
|
|
|
5562
5607
|
case 9:
|
|
5563
5608
|
planObject = _this.makePlanObject(selectedPlanObj, planType, storyId, storyHeadline, storySlug); //we are doing this to sake of backward compatibility and will be refactored later.
|
|
@@ -5566,16 +5611,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5566
5611
|
_planObject$selectedP = planObject.selectedPlan, discounted_price_cents = _planObject$selectedP.discounted_price_cents, price_cents = _planObject$selectedP.price_cents;
|
|
5567
5612
|
|
|
5568
5613
|
if (!(discounted_price_cents === 0 || price_cents === 0)) {
|
|
5569
|
-
|
|
5614
|
+
_context11.next = 18;
|
|
5570
5615
|
break;
|
|
5571
5616
|
}
|
|
5572
5617
|
|
|
5573
|
-
|
|
5618
|
+
_context11.next = 15;
|
|
5574
5619
|
return awaitHelper(global.AccessType.getPaymentOptions(0));
|
|
5575
5620
|
|
|
5576
5621
|
case 15:
|
|
5577
|
-
_yield$
|
|
5578
|
-
data = _yield$
|
|
5622
|
+
_yield$awaitHelper10 = _context11.sent;
|
|
5623
|
+
data = _yield$awaitHelper10.data;
|
|
5579
5624
|
paymentOptions = data;
|
|
5580
5625
|
|
|
5581
5626
|
case 18:
|
|
@@ -5585,23 +5630,23 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5585
5630
|
}));
|
|
5586
5631
|
|
|
5587
5632
|
if (!(paymentObject.payment.amount_cents === 0)) {
|
|
5588
|
-
|
|
5633
|
+
_context11.next = 22;
|
|
5589
5634
|
break;
|
|
5590
5635
|
}
|
|
5591
5636
|
|
|
5592
|
-
return
|
|
5637
|
+
return _context11.abrupt("return", global.AccessType.getPaymentOptions(0).then(function (provider) {
|
|
5593
5638
|
return provider.razorpay.proceed(paymentObject);
|
|
5594
5639
|
}));
|
|
5595
5640
|
|
|
5596
5641
|
case 22:
|
|
5597
|
-
return
|
|
5642
|
+
return _context11.abrupt("return", paymentOptions.razorpay.proceed(paymentObject));
|
|
5598
5643
|
|
|
5599
5644
|
case 23:
|
|
5600
5645
|
case "end":
|
|
5601
|
-
return
|
|
5646
|
+
return _context11.stop();
|
|
5602
5647
|
}
|
|
5603
5648
|
}
|
|
5604
|
-
},
|
|
5649
|
+
}, _callee11);
|
|
5605
5650
|
})));
|
|
5606
5651
|
|
|
5607
5652
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initStripePayment", function () {
|
|
@@ -5744,10 +5789,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5744
5789
|
});
|
|
5745
5790
|
|
|
5746
5791
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "pingBackMeteredStory", /*#__PURE__*/function () {
|
|
5747
|
-
var
|
|
5748
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
5792
|
+
var _ref14 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee12(asset, accessData) {
|
|
5793
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee12$(_context12) {
|
|
5749
5794
|
while (1) {
|
|
5750
|
-
switch (
|
|
5795
|
+
switch (_context12.prev = _context12.next) {
|
|
5751
5796
|
case 0:
|
|
5752
5797
|
try {
|
|
5753
5798
|
global.AccessType.pingbackAssetAccess(asset, accessData);
|
|
@@ -5755,161 +5800,150 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5755
5800
|
console.log("error in pingbackAssetAccess", e);
|
|
5756
5801
|
}
|
|
5757
5802
|
|
|
5758
|
-
return
|
|
5803
|
+
return _context12.abrupt("return", true);
|
|
5759
5804
|
|
|
5760
5805
|
case 2:
|
|
5761
5806
|
case "end":
|
|
5762
|
-
return
|
|
5807
|
+
return _context12.stop();
|
|
5763
5808
|
}
|
|
5764
5809
|
}
|
|
5765
|
-
},
|
|
5810
|
+
}, _callee12);
|
|
5766
5811
|
}));
|
|
5767
5812
|
|
|
5768
|
-
return function (
|
|
5769
|
-
return
|
|
5813
|
+
return function (_x7, _x8) {
|
|
5814
|
+
return _ref14.apply(this, arguments);
|
|
5770
5815
|
};
|
|
5771
5816
|
}());
|
|
5772
5817
|
|
|
5773
5818
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "checkAccess", /*#__PURE__*/function () {
|
|
5774
|
-
var
|
|
5775
|
-
var asset, _yield$
|
|
5819
|
+
var _ref15 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee13(assetId) {
|
|
5820
|
+
var asset, _yield$awaitHelper11, error, accessData, accessById, _ref16, granted, grantReason, _ref16$data, data;
|
|
5776
5821
|
|
|
5777
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
5822
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee13$(_context13) {
|
|
5778
5823
|
while (1) {
|
|
5779
|
-
switch (
|
|
5824
|
+
switch (_context13.prev = _context13.next) {
|
|
5780
5825
|
case 0:
|
|
5781
|
-
console.log("check access--------");
|
|
5782
|
-
|
|
5783
5826
|
if (assetId) {
|
|
5784
|
-
|
|
5827
|
+
_context13.next = 3;
|
|
5785
5828
|
break;
|
|
5786
5829
|
}
|
|
5787
5830
|
|
|
5788
5831
|
console.warn("AssetId is required");
|
|
5789
|
-
return
|
|
5790
|
-
|
|
5791
|
-
case 4:
|
|
5792
|
-
console.log("check access--------", assetId);
|
|
5832
|
+
return _context13.abrupt("return", false);
|
|
5793
5833
|
|
|
5834
|
+
case 3:
|
|
5794
5835
|
_this.props.accessIsLoading(true);
|
|
5795
5836
|
|
|
5796
5837
|
asset = {
|
|
5797
5838
|
id: assetId,
|
|
5798
5839
|
type: "story"
|
|
5799
5840
|
};
|
|
5800
|
-
|
|
5841
|
+
_context13.next = 7;
|
|
5801
5842
|
return awaitHelper(global.AccessType.isAssetAccessible(asset, _this.props.disableMetering));
|
|
5802
5843
|
|
|
5803
|
-
case
|
|
5804
|
-
_yield$
|
|
5805
|
-
error = _yield$
|
|
5806
|
-
accessData = _yield$
|
|
5807
|
-
console.log("error-----------", error);
|
|
5844
|
+
case 7:
|
|
5845
|
+
_yield$awaitHelper11 = _context13.sent;
|
|
5846
|
+
error = _yield$awaitHelper11.error;
|
|
5847
|
+
accessData = _yield$awaitHelper11.data;
|
|
5808
5848
|
|
|
5809
5849
|
if (!error) {
|
|
5810
|
-
|
|
5850
|
+
_context13.next = 12;
|
|
5811
5851
|
break;
|
|
5812
5852
|
}
|
|
5813
5853
|
|
|
5814
|
-
return
|
|
5854
|
+
return _context13.abrupt("return", error);
|
|
5815
5855
|
|
|
5816
|
-
case
|
|
5817
|
-
console.log("accessData-----------", accessData);
|
|
5856
|
+
case 12:
|
|
5818
5857
|
accessById = _defineProperty__default["default"]({}, assetId, accessData);
|
|
5819
|
-
console.log("accessbyid------------", accessById);
|
|
5820
5858
|
|
|
5821
5859
|
_this.props.accessUpdated(accessById);
|
|
5822
5860
|
|
|
5823
5861
|
_this.props.accessIsLoading(false);
|
|
5824
5862
|
|
|
5825
|
-
|
|
5826
|
-
_ref15 = accessData || {}, granted = _ref15.granted, grantReason = _ref15.grantReason, _ref15$data = _ref15.data, data = _ref15$data === void 0 ? {} : _ref15$data;
|
|
5863
|
+
_ref16 = accessData || {}, granted = _ref16.granted, grantReason = _ref16.grantReason, _ref16$data = _ref16.data, data = _ref16$data === void 0 ? {} : _ref16$data;
|
|
5827
5864
|
|
|
5828
5865
|
if (!_this.props.disableMetering && granted && grantReason === "METERING") {
|
|
5829
|
-
console.log("granted condition----------");
|
|
5830
|
-
|
|
5831
5866
|
_this.pingBackMeteredStory(asset, accessData);
|
|
5832
5867
|
|
|
5833
5868
|
_this.props.meterUpdated(data.numberRemaining || -1);
|
|
5834
5869
|
}
|
|
5835
5870
|
|
|
5836
|
-
|
|
5837
|
-
return _context12.abrupt("return", accessById);
|
|
5871
|
+
return _context13.abrupt("return", accessById);
|
|
5838
5872
|
|
|
5839
|
-
case
|
|
5873
|
+
case 18:
|
|
5840
5874
|
case "end":
|
|
5841
|
-
return
|
|
5875
|
+
return _context13.stop();
|
|
5842
5876
|
}
|
|
5843
5877
|
}
|
|
5844
|
-
},
|
|
5878
|
+
}, _callee13);
|
|
5845
5879
|
}));
|
|
5846
5880
|
|
|
5847
|
-
return function (
|
|
5848
|
-
return
|
|
5881
|
+
return function (_x9) {
|
|
5882
|
+
return _ref15.apply(this, arguments);
|
|
5849
5883
|
};
|
|
5850
5884
|
}());
|
|
5851
5885
|
|
|
5852
|
-
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscriberMetadata", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
5886
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscriberMetadata", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee14() {
|
|
5853
5887
|
var metadata;
|
|
5854
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
5888
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee14$(_context14) {
|
|
5855
5889
|
while (1) {
|
|
5856
|
-
switch (
|
|
5890
|
+
switch (_context14.prev = _context14.next) {
|
|
5857
5891
|
case 0:
|
|
5858
5892
|
if (global.AccessType) {
|
|
5859
|
-
|
|
5893
|
+
_context14.next = 2;
|
|
5860
5894
|
break;
|
|
5861
5895
|
}
|
|
5862
5896
|
|
|
5863
|
-
return
|
|
5897
|
+
return _context14.abrupt("return", {});
|
|
5864
5898
|
|
|
5865
5899
|
case 2:
|
|
5866
|
-
|
|
5900
|
+
_context14.next = 4;
|
|
5867
5901
|
return awaitHelper(global.AccessType.getSubscriberMetadata());
|
|
5868
5902
|
|
|
5869
5903
|
case 4:
|
|
5870
|
-
metadata =
|
|
5871
|
-
return
|
|
5904
|
+
metadata = _context14.sent;
|
|
5905
|
+
return _context14.abrupt("return", metadata);
|
|
5872
5906
|
|
|
5873
5907
|
case 6:
|
|
5874
5908
|
case "end":
|
|
5875
|
-
return
|
|
5909
|
+
return _context14.stop();
|
|
5876
5910
|
}
|
|
5877
5911
|
}
|
|
5878
|
-
},
|
|
5912
|
+
}, _callee14);
|
|
5879
5913
|
})));
|
|
5880
5914
|
|
|
5881
5915
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "setSubscriberMetadata", /*#__PURE__*/function () {
|
|
5882
|
-
var
|
|
5916
|
+
var _ref18 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee15(subscriberMetadata) {
|
|
5883
5917
|
var response;
|
|
5884
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
5918
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee15$(_context15) {
|
|
5885
5919
|
while (1) {
|
|
5886
|
-
switch (
|
|
5920
|
+
switch (_context15.prev = _context15.next) {
|
|
5887
5921
|
case 0:
|
|
5888
5922
|
if (!(!global.AccessType || !subscriberMetadata)) {
|
|
5889
|
-
|
|
5923
|
+
_context15.next = 2;
|
|
5890
5924
|
break;
|
|
5891
5925
|
}
|
|
5892
5926
|
|
|
5893
|
-
return
|
|
5927
|
+
return _context15.abrupt("return", {});
|
|
5894
5928
|
|
|
5895
5929
|
case 2:
|
|
5896
|
-
|
|
5930
|
+
_context15.next = 4;
|
|
5897
5931
|
return awaitHelper(global.AccessType.setSubscriberMetadata(subscriberMetadata));
|
|
5898
5932
|
|
|
5899
5933
|
case 4:
|
|
5900
|
-
response =
|
|
5901
|
-
return
|
|
5934
|
+
response = _context15.sent;
|
|
5935
|
+
return _context15.abrupt("return", response);
|
|
5902
5936
|
|
|
5903
5937
|
case 6:
|
|
5904
5938
|
case "end":
|
|
5905
|
-
return
|
|
5939
|
+
return _context15.stop();
|
|
5906
5940
|
}
|
|
5907
5941
|
}
|
|
5908
|
-
},
|
|
5942
|
+
}, _callee15);
|
|
5909
5943
|
}));
|
|
5910
5944
|
|
|
5911
|
-
return function (
|
|
5912
|
-
return
|
|
5945
|
+
return function (_x10) {
|
|
5946
|
+
return _ref18.apply(this, arguments);
|
|
5913
5947
|
};
|
|
5914
5948
|
}());
|
|
5915
5949
|
|
|
@@ -5925,29 +5959,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5925
5959
|
}
|
|
5926
5960
|
}, {
|
|
5927
5961
|
key: "makePaymentObject",
|
|
5928
|
-
value: function makePaymentObject(
|
|
5929
|
-
var
|
|
5930
|
-
selectedPlan =
|
|
5931
|
-
|
|
5932
|
-
couponCode =
|
|
5933
|
-
|
|
5934
|
-
recipientSubscriber =
|
|
5935
|
-
|
|
5936
|
-
planType =
|
|
5937
|
-
|
|
5938
|
-
storyId =
|
|
5939
|
-
|
|
5940
|
-
storyHeadline =
|
|
5941
|
-
|
|
5942
|
-
storySlug =
|
|
5943
|
-
|
|
5944
|
-
paymentType =
|
|
5945
|
-
|
|
5946
|
-
successUrl =
|
|
5947
|
-
|
|
5948
|
-
returnUrl =
|
|
5949
|
-
|
|
5950
|
-
cancelUrl =
|
|
5962
|
+
value: function makePaymentObject(_ref19) {
|
|
5963
|
+
var _ref19$selectedPlan = _ref19.selectedPlan,
|
|
5964
|
+
selectedPlan = _ref19$selectedPlan === void 0 ? {} : _ref19$selectedPlan,
|
|
5965
|
+
_ref19$couponCode = _ref19.couponCode,
|
|
5966
|
+
couponCode = _ref19$couponCode === void 0 ? "" : _ref19$couponCode,
|
|
5967
|
+
_ref19$recipientSubsc = _ref19.recipientSubscriber,
|
|
5968
|
+
recipientSubscriber = _ref19$recipientSubsc === void 0 ? {} : _ref19$recipientSubsc,
|
|
5969
|
+
_ref19$planType = _ref19.planType,
|
|
5970
|
+
planType = _ref19$planType === void 0 ? "" : _ref19$planType,
|
|
5971
|
+
_ref19$storyId = _ref19.storyId,
|
|
5972
|
+
storyId = _ref19$storyId === void 0 ? "" : _ref19$storyId,
|
|
5973
|
+
_ref19$storyHeadline = _ref19.storyHeadline,
|
|
5974
|
+
storyHeadline = _ref19$storyHeadline === void 0 ? "" : _ref19$storyHeadline,
|
|
5975
|
+
_ref19$storySlug = _ref19.storySlug,
|
|
5976
|
+
storySlug = _ref19$storySlug === void 0 ? "" : _ref19$storySlug,
|
|
5977
|
+
_ref19$paymentType = _ref19.paymentType,
|
|
5978
|
+
paymentType = _ref19$paymentType === void 0 ? "" : _ref19$paymentType,
|
|
5979
|
+
_ref19$successUrl = _ref19.successUrl,
|
|
5980
|
+
successUrl = _ref19$successUrl === void 0 ? "" : _ref19$successUrl,
|
|
5981
|
+
_ref19$returnUrl = _ref19.returnUrl,
|
|
5982
|
+
returnUrl = _ref19$returnUrl === void 0 ? "" : _ref19$returnUrl,
|
|
5983
|
+
_ref19$cancelUrl = _ref19.cancelUrl,
|
|
5984
|
+
cancelUrl = _ref19$cancelUrl === void 0 ? "" : _ref19$cancelUrl;
|
|
5951
5985
|
var id = selectedPlan.id,
|
|
5952
5986
|
title = selectedPlan.title,
|
|
5953
5987
|
description = selectedPlan.description,
|
|
@@ -6039,6 +6073,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
6039
6073
|
initPaytrailPayment: this.initPaytrailPayment,
|
|
6040
6074
|
checkAccess: this.checkAccess,
|
|
6041
6075
|
getSubscription: this.getSubscription,
|
|
6076
|
+
getSubscriptionsWithSwitchablePlans: this.getSubscriptionsWithSwitchablePlans,
|
|
6042
6077
|
getSubscriptionForUser: this.getSubscriptionForUser,
|
|
6043
6078
|
accessUpdated: this.props.accessUpdated,
|
|
6044
6079
|
accessIsLoading: this.props.accessIsLoading,
|
|
@@ -51,7 +51,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
51
51
|
var environment = isStaging ? "&env=sandbox" : "";
|
|
52
52
|
var accessTypeHost = "".concat(HOST, "/frontend/v2/accesstype.js?key=").concat(accessTypeKey).concat(environment);
|
|
53
53
|
var isATScriptAlreadyPresent = document.querySelector("script[src=\"".concat(accessTypeHost, "\"]"));
|
|
54
|
-
console.log("");
|
|
55
54
|
|
|
56
55
|
if (accessTypeKey && !isATScriptAlreadyPresent && !global.AccessType && global.document) {
|
|
57
56
|
var accessTypeScript = document.createElement("script");
|
|
@@ -244,19 +243,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
244
243
|
subscriptions = _yield$awaitHelper3.data;
|
|
245
244
|
|
|
246
245
|
if (!error) {
|
|
247
|
-
_context4.next =
|
|
246
|
+
_context4.next = 15;
|
|
248
247
|
break;
|
|
249
248
|
}
|
|
250
249
|
|
|
251
|
-
console.log("getSubscription---------", error);
|
|
252
250
|
return _context4.abrupt("return", {
|
|
253
251
|
error: "subscriptions fetch failed"
|
|
254
252
|
});
|
|
255
253
|
|
|
256
|
-
case
|
|
254
|
+
case 15:
|
|
257
255
|
return _context4.abrupt("return", subscriptions["subscription_groups"] || []);
|
|
258
256
|
|
|
259
|
-
case
|
|
257
|
+
case 16:
|
|
260
258
|
case "end":
|
|
261
259
|
return _context4.stop();
|
|
262
260
|
}
|
|
@@ -288,19 +286,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
288
286
|
paymentOptions = _yield$awaitHelper4.data;
|
|
289
287
|
|
|
290
288
|
if (!error) {
|
|
291
|
-
_context5.next =
|
|
289
|
+
_context5.next = 9;
|
|
292
290
|
break;
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
console.log("error---------------getPaymentOptions", error);
|
|
296
293
|
return _context5.abrupt("return", {
|
|
297
294
|
error: "payment options fetch failed"
|
|
298
295
|
});
|
|
299
296
|
|
|
300
|
-
case
|
|
297
|
+
case 9:
|
|
301
298
|
return _context5.abrupt("return", paymentOptions);
|
|
302
299
|
|
|
303
|
-
case
|
|
300
|
+
case 10:
|
|
304
301
|
case "end":
|
|
305
302
|
return _context5.stop();
|
|
306
303
|
}
|
|
@@ -343,19 +340,18 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
343
340
|
assetPlans = _yield$awaitHelper5$d === void 0 ? {} : _yield$awaitHelper5$d;
|
|
344
341
|
|
|
345
342
|
if (!error) {
|
|
346
|
-
_context6.next =
|
|
343
|
+
_context6.next = 11;
|
|
347
344
|
break;
|
|
348
345
|
}
|
|
349
346
|
|
|
350
|
-
console.log("error---------------getAssetPlans", error);
|
|
351
347
|
return _context6.abrupt("return", {
|
|
352
348
|
error: "asset plan fetch failed"
|
|
353
349
|
});
|
|
354
350
|
|
|
355
|
-
case
|
|
351
|
+
case 11:
|
|
356
352
|
return _context6.abrupt("return", assetPlans);
|
|
357
353
|
|
|
358
|
-
case
|
|
354
|
+
case 12:
|
|
359
355
|
case "end":
|
|
360
356
|
return _context6.stop();
|
|
361
357
|
}
|
|
@@ -373,7 +369,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
373
369
|
isAccessTypeCampaignEnabled = get(_this.props, ["isAccessTypeCampaignEnabled"], false);
|
|
374
370
|
|
|
375
371
|
if (!isAccessTypeCampaignEnabled) {
|
|
376
|
-
_context7.next =
|
|
372
|
+
_context7.next = 18;
|
|
377
373
|
break;
|
|
378
374
|
}
|
|
379
375
|
|
|
@@ -396,22 +392,21 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
396
392
|
campaignSubscriptions = _yield$awaitHelper6.data;
|
|
397
393
|
|
|
398
394
|
if (!error) {
|
|
399
|
-
_context7.next =
|
|
395
|
+
_context7.next = 17;
|
|
400
396
|
break;
|
|
401
397
|
}
|
|
402
398
|
|
|
403
|
-
console.log("error---------------getCampaignSubscription", error);
|
|
404
399
|
return _context7.abrupt("return", {
|
|
405
400
|
error: "subscriptions fetch failed"
|
|
406
401
|
});
|
|
407
402
|
|
|
408
|
-
case
|
|
403
|
+
case 17:
|
|
409
404
|
return _context7.abrupt("return", campaignSubscriptions["subscription_groups"] || []);
|
|
410
405
|
|
|
411
|
-
case
|
|
406
|
+
case 18:
|
|
412
407
|
return _context7.abrupt("return", []);
|
|
413
408
|
|
|
414
|
-
case
|
|
409
|
+
case 19:
|
|
415
410
|
case "end":
|
|
416
411
|
return _context7.stop();
|
|
417
412
|
}
|
|
@@ -444,7 +439,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
444
439
|
case 6:
|
|
445
440
|
_yield$awaitHelper7 = _context8.sent;
|
|
446
441
|
error = _yield$awaitHelper7.error;
|
|
447
|
-
console.log("error---------", error);
|
|
448
442
|
|
|
449
443
|
if (!error) {
|
|
450
444
|
try {
|
|
@@ -456,11 +450,6 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
456
450
|
campaignSubscriptionGroups = _ref10[3];
|
|
457
451
|
|
|
458
452
|
batch(function () {
|
|
459
|
-
console.log("subscriptionGroups----------", subscriptionGroups);
|
|
460
|
-
console.log("paymentOptions----------", paymentOptions);
|
|
461
|
-
console.log("assetPlans----------", assetPlans);
|
|
462
|
-
console.log("campaignSubscriptionGroups----------", campaignSubscriptionGroups);
|
|
463
|
-
|
|
464
453
|
_this.props.subscriptionGroupLoaded(subscriptionGroups);
|
|
465
454
|
|
|
466
455
|
_this.props.paymentOptionsLoaded(paymentOptions);
|
|
@@ -476,7 +465,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
476
465
|
}
|
|
477
466
|
}
|
|
478
467
|
|
|
479
|
-
case
|
|
468
|
+
case 9:
|
|
480
469
|
case "end":
|
|
481
470
|
return _context8.stop();
|
|
482
471
|
}
|
|
@@ -526,6 +515,62 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
526
515
|
}, _callee9);
|
|
527
516
|
})));
|
|
528
517
|
|
|
518
|
+
_defineProperty(_assertThisInitialized(_this), "getSubscriptionsWithSwitchablePlans", /*#__PURE__*/function () {
|
|
519
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(planId) {
|
|
520
|
+
var _yield$awaitHelper9, error, _yield$awaitHelper9$d, subscription;
|
|
521
|
+
|
|
522
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
523
|
+
while (1) {
|
|
524
|
+
switch (_context10.prev = _context10.next) {
|
|
525
|
+
case 0:
|
|
526
|
+
if (global.AccessType) {
|
|
527
|
+
_context10.next = 2;
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
return _context10.abrupt("return", {});
|
|
532
|
+
|
|
533
|
+
case 2:
|
|
534
|
+
if (planId) {
|
|
535
|
+
_context10.next = 4;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
throw new Error("planId is mandatory");
|
|
540
|
+
|
|
541
|
+
case 4:
|
|
542
|
+
_context10.next = 6;
|
|
543
|
+
return awaitHelper(global.AccessType.getSubscriptionWithSwitchablePlans(planId, "switch"));
|
|
544
|
+
|
|
545
|
+
case 6:
|
|
546
|
+
_yield$awaitHelper9 = _context10.sent;
|
|
547
|
+
error = _yield$awaitHelper9.error;
|
|
548
|
+
_yield$awaitHelper9$d = _yield$awaitHelper9.data;
|
|
549
|
+
subscription = _yield$awaitHelper9$d === void 0 ? {} : _yield$awaitHelper9$d;
|
|
550
|
+
|
|
551
|
+
if (!error) {
|
|
552
|
+
_context10.next = 12;
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return _context10.abrupt("return", error);
|
|
557
|
+
|
|
558
|
+
case 12:
|
|
559
|
+
return _context10.abrupt("return", subscription);
|
|
560
|
+
|
|
561
|
+
case 13:
|
|
562
|
+
case "end":
|
|
563
|
+
return _context10.stop();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}, _callee10);
|
|
567
|
+
}));
|
|
568
|
+
|
|
569
|
+
return function (_x6) {
|
|
570
|
+
return _ref12.apply(this, arguments);
|
|
571
|
+
};
|
|
572
|
+
}());
|
|
573
|
+
|
|
529
574
|
_defineProperty(_assertThisInitialized(_this), "initAccessType", function (callback) {
|
|
530
575
|
var accessTypeBkIntegrationId = _this.props.accessTypeBkIntegrationId;
|
|
531
576
|
|
|
@@ -544,7 +589,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
544
589
|
}
|
|
545
590
|
});
|
|
546
591
|
|
|
547
|
-
_defineProperty(_assertThisInitialized(_this), "initRazorPayPayment", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
592
|
+
_defineProperty(_assertThisInitialized(_this), "initRazorPayPayment", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
548
593
|
var selectedPlanObj,
|
|
549
594
|
planType,
|
|
550
595
|
storyId,
|
|
@@ -556,29 +601,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
556
601
|
_planObject$selectedP,
|
|
557
602
|
discounted_price_cents,
|
|
558
603
|
price_cents,
|
|
559
|
-
_yield$
|
|
604
|
+
_yield$awaitHelper10,
|
|
560
605
|
data,
|
|
561
606
|
paymentObject,
|
|
562
|
-
|
|
607
|
+
_args11 = arguments;
|
|
563
608
|
|
|
564
|
-
return _regeneratorRuntime.wrap(function
|
|
609
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
565
610
|
while (1) {
|
|
566
|
-
switch (
|
|
611
|
+
switch (_context11.prev = _context11.next) {
|
|
567
612
|
case 0:
|
|
568
|
-
selectedPlanObj =
|
|
569
|
-
planType =
|
|
570
|
-
storyId =
|
|
571
|
-
storyHeadline =
|
|
572
|
-
storySlug =
|
|
573
|
-
paymentType =
|
|
613
|
+
selectedPlanObj = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
614
|
+
planType = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : "";
|
|
615
|
+
storyId = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : "";
|
|
616
|
+
storyHeadline = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : "";
|
|
617
|
+
storySlug = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : "";
|
|
618
|
+
paymentType = _args11.length > 5 && _args11[5] !== undefined ? _args11[5] : "";
|
|
574
619
|
|
|
575
620
|
if (selectedPlanObj) {
|
|
576
|
-
|
|
621
|
+
_context11.next = 9;
|
|
577
622
|
break;
|
|
578
623
|
}
|
|
579
624
|
|
|
580
625
|
console.warn("Razor pay needs a plan");
|
|
581
|
-
return
|
|
626
|
+
return _context11.abrupt("return", false);
|
|
582
627
|
|
|
583
628
|
case 9:
|
|
584
629
|
planObject = _this.makePlanObject(selectedPlanObj, planType, storyId, storyHeadline, storySlug); //we are doing this to sake of backward compatibility and will be refactored later.
|
|
@@ -587,16 +632,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
587
632
|
_planObject$selectedP = planObject.selectedPlan, discounted_price_cents = _planObject$selectedP.discounted_price_cents, price_cents = _planObject$selectedP.price_cents;
|
|
588
633
|
|
|
589
634
|
if (!(discounted_price_cents === 0 || price_cents === 0)) {
|
|
590
|
-
|
|
635
|
+
_context11.next = 18;
|
|
591
636
|
break;
|
|
592
637
|
}
|
|
593
638
|
|
|
594
|
-
|
|
639
|
+
_context11.next = 15;
|
|
595
640
|
return awaitHelper(global.AccessType.getPaymentOptions(0));
|
|
596
641
|
|
|
597
642
|
case 15:
|
|
598
|
-
_yield$
|
|
599
|
-
data = _yield$
|
|
643
|
+
_yield$awaitHelper10 = _context11.sent;
|
|
644
|
+
data = _yield$awaitHelper10.data;
|
|
600
645
|
paymentOptions = data;
|
|
601
646
|
|
|
602
647
|
case 18:
|
|
@@ -606,23 +651,23 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
606
651
|
}));
|
|
607
652
|
|
|
608
653
|
if (!(paymentObject.payment.amount_cents === 0)) {
|
|
609
|
-
|
|
654
|
+
_context11.next = 22;
|
|
610
655
|
break;
|
|
611
656
|
}
|
|
612
657
|
|
|
613
|
-
return
|
|
658
|
+
return _context11.abrupt("return", global.AccessType.getPaymentOptions(0).then(function (provider) {
|
|
614
659
|
return provider.razorpay.proceed(paymentObject);
|
|
615
660
|
}));
|
|
616
661
|
|
|
617
662
|
case 22:
|
|
618
|
-
return
|
|
663
|
+
return _context11.abrupt("return", paymentOptions.razorpay.proceed(paymentObject));
|
|
619
664
|
|
|
620
665
|
case 23:
|
|
621
666
|
case "end":
|
|
622
|
-
return
|
|
667
|
+
return _context11.stop();
|
|
623
668
|
}
|
|
624
669
|
}
|
|
625
|
-
},
|
|
670
|
+
}, _callee11);
|
|
626
671
|
})));
|
|
627
672
|
|
|
628
673
|
_defineProperty(_assertThisInitialized(_this), "initStripePayment", function () {
|
|
@@ -765,10 +810,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
765
810
|
});
|
|
766
811
|
|
|
767
812
|
_defineProperty(_assertThisInitialized(_this), "pingBackMeteredStory", /*#__PURE__*/function () {
|
|
768
|
-
var
|
|
769
|
-
return _regeneratorRuntime.wrap(function
|
|
813
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(asset, accessData) {
|
|
814
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
770
815
|
while (1) {
|
|
771
|
-
switch (
|
|
816
|
+
switch (_context12.prev = _context12.next) {
|
|
772
817
|
case 0:
|
|
773
818
|
try {
|
|
774
819
|
global.AccessType.pingbackAssetAccess(asset, accessData);
|
|
@@ -776,161 +821,150 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
776
821
|
console.log("error in pingbackAssetAccess", e);
|
|
777
822
|
}
|
|
778
823
|
|
|
779
|
-
return
|
|
824
|
+
return _context12.abrupt("return", true);
|
|
780
825
|
|
|
781
826
|
case 2:
|
|
782
827
|
case "end":
|
|
783
|
-
return
|
|
828
|
+
return _context12.stop();
|
|
784
829
|
}
|
|
785
830
|
}
|
|
786
|
-
},
|
|
831
|
+
}, _callee12);
|
|
787
832
|
}));
|
|
788
833
|
|
|
789
|
-
return function (
|
|
790
|
-
return
|
|
834
|
+
return function (_x7, _x8) {
|
|
835
|
+
return _ref14.apply(this, arguments);
|
|
791
836
|
};
|
|
792
837
|
}());
|
|
793
838
|
|
|
794
839
|
_defineProperty(_assertThisInitialized(_this), "checkAccess", /*#__PURE__*/function () {
|
|
795
|
-
var
|
|
796
|
-
var asset, _yield$
|
|
840
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(assetId) {
|
|
841
|
+
var asset, _yield$awaitHelper11, error, accessData, accessById, _ref16, granted, grantReason, _ref16$data, data;
|
|
797
842
|
|
|
798
|
-
return _regeneratorRuntime.wrap(function
|
|
843
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
799
844
|
while (1) {
|
|
800
|
-
switch (
|
|
845
|
+
switch (_context13.prev = _context13.next) {
|
|
801
846
|
case 0:
|
|
802
|
-
console.log("check access--------");
|
|
803
|
-
|
|
804
847
|
if (assetId) {
|
|
805
|
-
|
|
848
|
+
_context13.next = 3;
|
|
806
849
|
break;
|
|
807
850
|
}
|
|
808
851
|
|
|
809
852
|
console.warn("AssetId is required");
|
|
810
|
-
return
|
|
811
|
-
|
|
812
|
-
case 4:
|
|
813
|
-
console.log("check access--------", assetId);
|
|
853
|
+
return _context13.abrupt("return", false);
|
|
814
854
|
|
|
855
|
+
case 3:
|
|
815
856
|
_this.props.accessIsLoading(true);
|
|
816
857
|
|
|
817
858
|
asset = {
|
|
818
859
|
id: assetId,
|
|
819
860
|
type: "story"
|
|
820
861
|
};
|
|
821
|
-
|
|
862
|
+
_context13.next = 7;
|
|
822
863
|
return awaitHelper(global.AccessType.isAssetAccessible(asset, _this.props.disableMetering));
|
|
823
864
|
|
|
824
|
-
case
|
|
825
|
-
_yield$
|
|
826
|
-
error = _yield$
|
|
827
|
-
accessData = _yield$
|
|
828
|
-
console.log("error-----------", error);
|
|
865
|
+
case 7:
|
|
866
|
+
_yield$awaitHelper11 = _context13.sent;
|
|
867
|
+
error = _yield$awaitHelper11.error;
|
|
868
|
+
accessData = _yield$awaitHelper11.data;
|
|
829
869
|
|
|
830
870
|
if (!error) {
|
|
831
|
-
|
|
871
|
+
_context13.next = 12;
|
|
832
872
|
break;
|
|
833
873
|
}
|
|
834
874
|
|
|
835
|
-
return
|
|
875
|
+
return _context13.abrupt("return", error);
|
|
836
876
|
|
|
837
|
-
case
|
|
838
|
-
console.log("accessData-----------", accessData);
|
|
877
|
+
case 12:
|
|
839
878
|
accessById = _defineProperty({}, assetId, accessData);
|
|
840
|
-
console.log("accessbyid------------", accessById);
|
|
841
879
|
|
|
842
880
|
_this.props.accessUpdated(accessById);
|
|
843
881
|
|
|
844
882
|
_this.props.accessIsLoading(false);
|
|
845
883
|
|
|
846
|
-
|
|
847
|
-
_ref15 = accessData || {}, granted = _ref15.granted, grantReason = _ref15.grantReason, _ref15$data = _ref15.data, data = _ref15$data === void 0 ? {} : _ref15$data;
|
|
884
|
+
_ref16 = accessData || {}, granted = _ref16.granted, grantReason = _ref16.grantReason, _ref16$data = _ref16.data, data = _ref16$data === void 0 ? {} : _ref16$data;
|
|
848
885
|
|
|
849
886
|
if (!_this.props.disableMetering && granted && grantReason === "METERING") {
|
|
850
|
-
console.log("granted condition----------");
|
|
851
|
-
|
|
852
887
|
_this.pingBackMeteredStory(asset, accessData);
|
|
853
888
|
|
|
854
889
|
_this.props.meterUpdated(data.numberRemaining || -1);
|
|
855
890
|
}
|
|
856
891
|
|
|
857
|
-
|
|
858
|
-
return _context12.abrupt("return", accessById);
|
|
892
|
+
return _context13.abrupt("return", accessById);
|
|
859
893
|
|
|
860
|
-
case
|
|
894
|
+
case 18:
|
|
861
895
|
case "end":
|
|
862
|
-
return
|
|
896
|
+
return _context13.stop();
|
|
863
897
|
}
|
|
864
898
|
}
|
|
865
|
-
},
|
|
899
|
+
}, _callee13);
|
|
866
900
|
}));
|
|
867
901
|
|
|
868
|
-
return function (
|
|
869
|
-
return
|
|
902
|
+
return function (_x9) {
|
|
903
|
+
return _ref15.apply(this, arguments);
|
|
870
904
|
};
|
|
871
905
|
}());
|
|
872
906
|
|
|
873
|
-
_defineProperty(_assertThisInitialized(_this), "getSubscriberMetadata", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
907
|
+
_defineProperty(_assertThisInitialized(_this), "getSubscriberMetadata", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
874
908
|
var metadata;
|
|
875
|
-
return _regeneratorRuntime.wrap(function
|
|
909
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
876
910
|
while (1) {
|
|
877
|
-
switch (
|
|
911
|
+
switch (_context14.prev = _context14.next) {
|
|
878
912
|
case 0:
|
|
879
913
|
if (global.AccessType) {
|
|
880
|
-
|
|
914
|
+
_context14.next = 2;
|
|
881
915
|
break;
|
|
882
916
|
}
|
|
883
917
|
|
|
884
|
-
return
|
|
918
|
+
return _context14.abrupt("return", {});
|
|
885
919
|
|
|
886
920
|
case 2:
|
|
887
|
-
|
|
921
|
+
_context14.next = 4;
|
|
888
922
|
return awaitHelper(global.AccessType.getSubscriberMetadata());
|
|
889
923
|
|
|
890
924
|
case 4:
|
|
891
|
-
metadata =
|
|
892
|
-
return
|
|
925
|
+
metadata = _context14.sent;
|
|
926
|
+
return _context14.abrupt("return", metadata);
|
|
893
927
|
|
|
894
928
|
case 6:
|
|
895
929
|
case "end":
|
|
896
|
-
return
|
|
930
|
+
return _context14.stop();
|
|
897
931
|
}
|
|
898
932
|
}
|
|
899
|
-
},
|
|
933
|
+
}, _callee14);
|
|
900
934
|
})));
|
|
901
935
|
|
|
902
936
|
_defineProperty(_assertThisInitialized(_this), "setSubscriberMetadata", /*#__PURE__*/function () {
|
|
903
|
-
var
|
|
937
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(subscriberMetadata) {
|
|
904
938
|
var response;
|
|
905
|
-
return _regeneratorRuntime.wrap(function
|
|
939
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
906
940
|
while (1) {
|
|
907
|
-
switch (
|
|
941
|
+
switch (_context15.prev = _context15.next) {
|
|
908
942
|
case 0:
|
|
909
943
|
if (!(!global.AccessType || !subscriberMetadata)) {
|
|
910
|
-
|
|
944
|
+
_context15.next = 2;
|
|
911
945
|
break;
|
|
912
946
|
}
|
|
913
947
|
|
|
914
|
-
return
|
|
948
|
+
return _context15.abrupt("return", {});
|
|
915
949
|
|
|
916
950
|
case 2:
|
|
917
|
-
|
|
951
|
+
_context15.next = 4;
|
|
918
952
|
return awaitHelper(global.AccessType.setSubscriberMetadata(subscriberMetadata));
|
|
919
953
|
|
|
920
954
|
case 4:
|
|
921
|
-
response =
|
|
922
|
-
return
|
|
955
|
+
response = _context15.sent;
|
|
956
|
+
return _context15.abrupt("return", response);
|
|
923
957
|
|
|
924
958
|
case 6:
|
|
925
959
|
case "end":
|
|
926
|
-
return
|
|
960
|
+
return _context15.stop();
|
|
927
961
|
}
|
|
928
962
|
}
|
|
929
|
-
},
|
|
963
|
+
}, _callee15);
|
|
930
964
|
}));
|
|
931
965
|
|
|
932
|
-
return function (
|
|
933
|
-
return
|
|
966
|
+
return function (_x10) {
|
|
967
|
+
return _ref18.apply(this, arguments);
|
|
934
968
|
};
|
|
935
969
|
}());
|
|
936
970
|
|
|
@@ -946,29 +980,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
946
980
|
}
|
|
947
981
|
}, {
|
|
948
982
|
key: "makePaymentObject",
|
|
949
|
-
value: function makePaymentObject(
|
|
950
|
-
var
|
|
951
|
-
selectedPlan =
|
|
952
|
-
|
|
953
|
-
couponCode =
|
|
954
|
-
|
|
955
|
-
recipientSubscriber =
|
|
956
|
-
|
|
957
|
-
planType =
|
|
958
|
-
|
|
959
|
-
storyId =
|
|
960
|
-
|
|
961
|
-
storyHeadline =
|
|
962
|
-
|
|
963
|
-
storySlug =
|
|
964
|
-
|
|
965
|
-
paymentType =
|
|
966
|
-
|
|
967
|
-
successUrl =
|
|
968
|
-
|
|
969
|
-
returnUrl =
|
|
970
|
-
|
|
971
|
-
cancelUrl =
|
|
983
|
+
value: function makePaymentObject(_ref19) {
|
|
984
|
+
var _ref19$selectedPlan = _ref19.selectedPlan,
|
|
985
|
+
selectedPlan = _ref19$selectedPlan === void 0 ? {} : _ref19$selectedPlan,
|
|
986
|
+
_ref19$couponCode = _ref19.couponCode,
|
|
987
|
+
couponCode = _ref19$couponCode === void 0 ? "" : _ref19$couponCode,
|
|
988
|
+
_ref19$recipientSubsc = _ref19.recipientSubscriber,
|
|
989
|
+
recipientSubscriber = _ref19$recipientSubsc === void 0 ? {} : _ref19$recipientSubsc,
|
|
990
|
+
_ref19$planType = _ref19.planType,
|
|
991
|
+
planType = _ref19$planType === void 0 ? "" : _ref19$planType,
|
|
992
|
+
_ref19$storyId = _ref19.storyId,
|
|
993
|
+
storyId = _ref19$storyId === void 0 ? "" : _ref19$storyId,
|
|
994
|
+
_ref19$storyHeadline = _ref19.storyHeadline,
|
|
995
|
+
storyHeadline = _ref19$storyHeadline === void 0 ? "" : _ref19$storyHeadline,
|
|
996
|
+
_ref19$storySlug = _ref19.storySlug,
|
|
997
|
+
storySlug = _ref19$storySlug === void 0 ? "" : _ref19$storySlug,
|
|
998
|
+
_ref19$paymentType = _ref19.paymentType,
|
|
999
|
+
paymentType = _ref19$paymentType === void 0 ? "" : _ref19$paymentType,
|
|
1000
|
+
_ref19$successUrl = _ref19.successUrl,
|
|
1001
|
+
successUrl = _ref19$successUrl === void 0 ? "" : _ref19$successUrl,
|
|
1002
|
+
_ref19$returnUrl = _ref19.returnUrl,
|
|
1003
|
+
returnUrl = _ref19$returnUrl === void 0 ? "" : _ref19$returnUrl,
|
|
1004
|
+
_ref19$cancelUrl = _ref19.cancelUrl,
|
|
1005
|
+
cancelUrl = _ref19$cancelUrl === void 0 ? "" : _ref19$cancelUrl;
|
|
972
1006
|
var id = selectedPlan.id,
|
|
973
1007
|
title = selectedPlan.title,
|
|
974
1008
|
description = selectedPlan.description,
|
|
@@ -1060,6 +1094,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
1060
1094
|
initPaytrailPayment: this.initPaytrailPayment,
|
|
1061
1095
|
checkAccess: this.checkAccess,
|
|
1062
1096
|
getSubscription: this.getSubscription,
|
|
1097
|
+
getSubscriptionsWithSwitchablePlans: this.getSubscriptionsWithSwitchablePlans,
|
|
1063
1098
|
getSubscriptionForUser: this.getSubscriptionForUser,
|
|
1064
1099
|
accessUpdated: this.props.accessUpdated,
|
|
1065
1100
|
accessIsLoading: this.props.accessIsLoading,
|