@quintype/components 3.0.3-nl-fb-share-bug.0 → 3.0.3-paytrail.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 CHANGED
@@ -3309,10 +3309,9 @@ var SocialShareBase = /*#__PURE__*/function (_React$Component) {
3309
3309
  key: "render",
3310
3310
  value: function render() {
3311
3311
  var fullUrl = this.props.fullUrl || "".concat(this.props.publisherUrl, "/").concat(this.props.url);
3312
- var hashtags = this.props.hashtags ? this.props.hashtags : "";
3313
- console.log("Full Url is --->", this.props.app_id, "props --->", this.props);
3312
+ var hashtags = this.props.hashtags ? this.props.hashtags : '';
3314
3313
  return /*#__PURE__*/React__default["default"].createElement(this.props.template, Object.assign({
3315
- fbUrl: "https://www.facebook.com/dialog/share?app_id=".concat(this.props.app_id, "&href=").concat(encodeURIComponent(fullUrl), "redirect_uri=").concat(encodeURIComponent(fullUrl)),
3314
+ fbUrl: "https://www.facebook.com/sharer.php?u=".concat(encodeURIComponent(fullUrl)),
3316
3315
  twitterUrl: "https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(fullUrl), "&text=").concat(encodeURIComponent(this.props.title), "&hashtags=").concat(hashtags),
3317
3316
  gplusUrl: "https://plus.google.com/share?url=".concat(encodeURIComponent(fullUrl)),
3318
3317
  linkedinUrl: "https://www.linkedin.com/shareArticle?url=".concat(encodeURIComponent(fullUrl), "&title=").concat(encodeURIComponent(this.props.title)),
@@ -3341,17 +3340,17 @@ function mapStateToProps$3(state) {
3341
3340
  * class CustomComponent extends React.Component {
3342
3341
  * getSocialCardsTemplate({fbUrl, twitterUrl, gplusUrl, linkedinUrl, handleNativeShare}) {
3343
3342
  * return <ul className="social-share-icons">
3344
- * <li className="social-share-icon">
3345
- * <a href={fbUrl} target="_blank">
3346
- * <img src={fbIcon} alt="fb icon"/>
3347
- * </a>
3348
- * </li>
3349
- * {handleNativeShare && <li className="social-share-icon">
3350
- * <button onClick={handleNativeShare}>
3351
- * <img src={fbIcon} alt="share icon"/>
3352
- * </button>
3353
- * </li>}
3354
- * </ul>
3343
+ * <li className="social-share-icon">
3344
+ * <a href={fbUrl} target="_blank">
3345
+ * <img src={fbIcon} alt="fb icon"/>
3346
+ * </a>
3347
+ * </li>
3348
+ * {handleNativeShare && <li className="social-share-icon">
3349
+ * <button onClick={handleNativeShare}>
3350
+ * <img src={fbIcon} alt="share icon"/>
3351
+ * </button>
3352
+ * </li>}
3353
+ * </ul>
3355
3354
  * }
3356
3355
  *
3357
3356
  * render() {
@@ -5143,6 +5142,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5143
5142
  return new Promise(adyenExecutor);
5144
5143
  });
5145
5144
 
5145
+ _defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initPaytrailPayment", function () {
5146
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5147
+
5148
+ if (!options.selectedPlan) {
5149
+ console.warn("Paytrail needs a plan");
5150
+ return false;
5151
+ }
5152
+
5153
+ var paymentOptions = _this.props.paymentOptions;
5154
+ var paymentType = get__default["default"](options.selectedPlan, ["recurring"]) ? "paypal_recurring" : "paypal";
5155
+
5156
+ var paymentObject = _this.makePaymentObject(_objectSpread({
5157
+ paymentType: paymentType
5158
+ }, options));
5159
+
5160
+ console.log("paymentObject------------", paymentObject);
5161
+ return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
5162
+ return response.proceed(paymentObject);
5163
+ }) : Promise.reject({
5164
+ message: "Payment option is loading..."
5165
+ });
5166
+ });
5167
+
5146
5168
  _defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "pingBackMeteredStory", /*#__PURE__*/function () {
5147
5169
  var _ref12 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(asset, accessData) {
5148
5170
  return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
@@ -5420,6 +5442,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
5420
5442
  initPaypalPayment: this.initPaypalPayment,
5421
5443
  initOmisePayment: this.initOmisePayment,
5422
5444
  initAdyenPayment: this.initAdyenPayment,
5445
+ initPaytrailPayment: this.initPaytrailPayment,
5423
5446
  checkAccess: this.checkAccess,
5424
5447
  getSubscriptionForUser: this.getSubscriptionForUser,
5425
5448
  accessUpdated: this.props.accessUpdated,
@@ -668,6 +668,29 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
668
668
  return new Promise(adyenExecutor);
669
669
  });
670
670
 
671
+ _defineProperty(_assertThisInitialized(_this), "initPaytrailPayment", function () {
672
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
673
+
674
+ if (!options.selectedPlan) {
675
+ console.warn("Paytrail needs a plan");
676
+ return false;
677
+ }
678
+
679
+ var paymentOptions = _this.props.paymentOptions;
680
+ var paymentType = get(options.selectedPlan, ["recurring"]) ? "paypal_recurring" : "paypal";
681
+
682
+ var paymentObject = _this.makePaymentObject(_objectSpread({
683
+ paymentType: paymentType
684
+ }, options));
685
+
686
+ console.log("paymentObject------------", paymentObject);
687
+ return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
688
+ return response.proceed(paymentObject);
689
+ }) : Promise.reject({
690
+ message: "Payment option is loading..."
691
+ });
692
+ });
693
+
671
694
  _defineProperty(_assertThisInitialized(_this), "pingBackMeteredStory", /*#__PURE__*/function () {
672
695
  var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(asset, accessData) {
673
696
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
@@ -945,6 +968,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
945
968
  initPaypalPayment: this.initPaypalPayment,
946
969
  initOmisePayment: this.initOmisePayment,
947
970
  initAdyenPayment: this.initAdyenPayment,
971
+ initPaytrailPayment: this.initPaytrailPayment,
948
972
  checkAccess: this.checkAccess,
949
973
  getSubscriptionForUser: this.getSubscriptionForUser,
950
974
  accessUpdated: this.props.accessUpdated,
@@ -10,7 +10,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
 
11
11
  import React from "react";
12
12
  import { connect } from "react-redux";
13
- import { withError } from "./with-error";
13
+ import { withError } from './with-error';
14
14
 
15
15
  function getNativeShareHandler(canNativeShare, title, fullUrl) {
16
16
  if (!canNativeShare) {
@@ -53,10 +53,9 @@ var SocialShareBase = /*#__PURE__*/function (_React$Component) {
53
53
  key: "render",
54
54
  value: function render() {
55
55
  var fullUrl = this.props.fullUrl || "".concat(this.props.publisherUrl, "/").concat(this.props.url);
56
- var hashtags = this.props.hashtags ? this.props.hashtags : "";
57
- console.log("Full Url is --->", this.props.app_id, "props --->", this.props);
56
+ var hashtags = this.props.hashtags ? this.props.hashtags : '';
58
57
  return /*#__PURE__*/React.createElement(this.props.template, Object.assign({
59
- fbUrl: "https://www.facebook.com/dialog/share?app_id=".concat(this.props.app_id, "&href=").concat(encodeURIComponent(fullUrl), "redirect_uri=").concat(encodeURIComponent(fullUrl)),
58
+ fbUrl: "https://www.facebook.com/sharer.php?u=".concat(encodeURIComponent(fullUrl)),
60
59
  twitterUrl: "https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(fullUrl), "&text=").concat(encodeURIComponent(this.props.title), "&hashtags=").concat(hashtags),
61
60
  gplusUrl: "https://plus.google.com/share?url=".concat(encodeURIComponent(fullUrl)),
62
61
  linkedinUrl: "https://www.linkedin.com/shareArticle?url=".concat(encodeURIComponent(fullUrl), "&title=").concat(encodeURIComponent(this.props.title)),
@@ -85,17 +84,17 @@ function mapStateToProps(state) {
85
84
  * class CustomComponent extends React.Component {
86
85
  * getSocialCardsTemplate({fbUrl, twitterUrl, gplusUrl, linkedinUrl, handleNativeShare}) {
87
86
  * return <ul className="social-share-icons">
88
- * <li className="social-share-icon">
89
- * <a href={fbUrl} target="_blank">
90
- * <img src={fbIcon} alt="fb icon"/>
91
- * </a>
92
- * </li>
93
- * {handleNativeShare && <li className="social-share-icon">
94
- * <button onClick={handleNativeShare}>
95
- * <img src={fbIcon} alt="share icon"/>
96
- * </button>
97
- * </li>}
98
- * </ul>
87
+ * <li className="social-share-icon">
88
+ * <a href={fbUrl} target="_blank">
89
+ * <img src={fbIcon} alt="fb icon"/>
90
+ * </a>
91
+ * </li>
92
+ * {handleNativeShare && <li className="social-share-icon">
93
+ * <button onClick={handleNativeShare}>
94
+ * <img src={fbIcon} alt="share icon"/>
95
+ * </button>
96
+ * </li>}
97
+ * </ul>
99
98
  * }
100
99
  *
101
100
  * render() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/components",
3
- "version": "3.0.3-nl-fb-share-bug.0",
3
+ "version": "3.0.3-paytrail.0",
4
4
  "description": "Components to help build Quintype Node.js apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -103,7 +103,7 @@
103
103
  "docs": "rimraf docs && jsdoc -c jsdoc.json",
104
104
  "prepack": "npm run build",
105
105
  "prepublishOnly": "./bin-dev-scripts/standard-version-release.sh",
106
- "sync-files-to": "npx onchange --verbose --await-write-finish=2000 'src/**/*' -- ./bin-dev-scripts/sync-to.sh",
106
+ "sync-files-to": "npx onchange --verbose --wait --await-write-finish 'src/**/*' -- ./bin-dev-scripts/sync-to.sh",
107
107
  "test": "jest --config jest.config.js",
108
108
  "test:cover": "jest --coverage --watchAll; open coverage/index.html"
109
109
  }