@quintype/components 3.1.5-img-lazy.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -1803,7 +1803,7 @@ function getMenuItemBody(item, className, url, currentUrl) {
|
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
1805
|
|
|
1806
|
-
var USED_PARAMS = ["imageCDN", "defaultWidth", "widths", "imgParams", "slug", "metadata", "aspectRatio", "reactTag", "eager", "imageCDNFormat"
|
|
1806
|
+
var USED_PARAMS = ["imageCDN", "defaultWidth", "widths", "imgParams", "slug", "metadata", "aspectRatio", "reactTag", "eager", "imageCDNFormat"]; // Add the following CSS somewhere: img.qt-image { width: 100%; object-fit: cover; }
|
|
1807
1807
|
|
|
1808
1808
|
function hashString(string) {
|
|
1809
1809
|
if (!string) return 0;
|
|
@@ -1924,7 +1924,7 @@ function loadGumlet() {
|
|
|
1924
1924
|
return;
|
|
1925
1925
|
}
|
|
1926
1926
|
|
|
1927
|
-
if (process.env.NODE_ENV ==
|
|
1927
|
+
if (process.env.NODE_ENV == 'development') {
|
|
1928
1928
|
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
@@ -1932,9 +1932,9 @@ function loadGumlet() {
|
|
|
1932
1932
|
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1933
1933
|
hosts: []
|
|
1934
1934
|
};
|
|
1935
|
-
var script = document.createElement(
|
|
1936
|
-
script.type =
|
|
1937
|
-
script.src =
|
|
1935
|
+
var script = document.createElement('script');
|
|
1936
|
+
script.type = 'text/javascript';
|
|
1937
|
+
script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
|
|
1938
1938
|
document.body.appendChild(script);
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
@@ -1945,20 +1945,17 @@ function GumletImage(props) {
|
|
|
1945
1945
|
imageCDN = props.imageCDN,
|
|
1946
1946
|
imgParams = props.imgParams,
|
|
1947
1947
|
reactTag = props.reactTag,
|
|
1948
|
-
className = props.className
|
|
1949
|
-
_props$imgLazy = props.imgLazy,
|
|
1950
|
-
imgLazy = _props$imgLazy === void 0 ? "true" : _props$imgLazy;
|
|
1948
|
+
className = props.className;
|
|
1951
1949
|
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1952
1950
|
var imageProps = {
|
|
1953
1951
|
src: emptyWebGif__default["default"],
|
|
1954
1952
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1955
|
-
key: hashString(slug)
|
|
1956
|
-
"data-gmlazy": imgLazy
|
|
1953
|
+
key: hashString(slug)
|
|
1957
1954
|
};
|
|
1958
1955
|
var Tag = reactTag || "img";
|
|
1959
1956
|
React.useEffect(loadGumlet);
|
|
1960
1957
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tag, _extends__default["default"]({}, imageProps, omit__default["default"](props, USED_PARAMS), {
|
|
1961
|
-
className: className ? "qt-image ".concat(className) :
|
|
1958
|
+
className: className ? "qt-image ".concat(className) : 'qt-image'
|
|
1962
1959
|
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1963
1960
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1964
1961
|
w: 1200
|
|
@@ -5241,6 +5238,28 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5241
5238
|
return new Promise(adyenExecutor);
|
|
5242
5239
|
});
|
|
5243
5240
|
|
|
5241
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "initPaytrailPayment", function () {
|
|
5242
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5243
|
+
|
|
5244
|
+
if (!options.selectedPlan) {
|
|
5245
|
+
console.warn("Paytrail needs a plan");
|
|
5246
|
+
return false;
|
|
5247
|
+
}
|
|
5248
|
+
|
|
5249
|
+
var paymentOptions = _this.props.paymentOptions;
|
|
5250
|
+
var paymentType = get__default["default"](options.selectedPlan, ["recurring"]) ? "paytrail_recurring" : "paytrail";
|
|
5251
|
+
|
|
5252
|
+
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
5253
|
+
paymentType: paymentType
|
|
5254
|
+
}, options));
|
|
5255
|
+
|
|
5256
|
+
return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
|
|
5257
|
+
return response.proceed(paymentObject);
|
|
5258
|
+
}) : Promise.reject({
|
|
5259
|
+
message: "Payment option is loading..."
|
|
5260
|
+
});
|
|
5261
|
+
});
|
|
5262
|
+
|
|
5244
5263
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "pingBackMeteredStory", /*#__PURE__*/function () {
|
|
5245
5264
|
var _ref12 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(asset, accessData) {
|
|
5246
5265
|
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
|
|
@@ -5518,6 +5537,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5518
5537
|
initPaypalPayment: this.initPaypalPayment,
|
|
5519
5538
|
initOmisePayment: this.initOmisePayment,
|
|
5520
5539
|
initAdyenPayment: this.initAdyenPayment,
|
|
5540
|
+
initPaytrailPayment: this.initPaytrailPayment,
|
|
5521
5541
|
checkAccess: this.checkAccess,
|
|
5522
5542
|
getSubscriptionForUser: this.getSubscriptionForUser,
|
|
5523
5543
|
accessUpdated: this.props.accessUpdated,
|
|
@@ -5600,6 +5620,7 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
5600
5620
|
* initPaypalPayment| options(object), options={argType: "options",selectedPlan: selectedPlanObj,planType: planType,couponCode: "", recipientSubscriber: {}, returnUrl: "",cancelUrl:""} | Initialize the PayPal payment
|
|
5601
5621
|
* initOmisePayment| selectedPlan(object), planType(string) | Initialize the Omise payment
|
|
5602
5622
|
* initAdyenPayment| selectedPlan(object), planType(string), AdyenModal(React Component), locale(string) | Initialize Adyen Payment
|
|
5623
|
+
* initPaytrailPayment| selectedPlan(object), ptions={selectedPlan: selectedPlanObj,planType: planType,couponCode: "", recipientSubscriber: {}, returnUrl: "",cancelUrl:""} | Initialize the Paytrail payment
|
|
5603
5624
|
* getAssetPlans| storyId(string) | Get Asset Subscription Plans
|
|
5604
5625
|
* getSubscriberMetadata| Get the Subscriber Metadata
|
|
5605
5626
|
* setSubscriberMetadata| subscriberMetadata(object), subscriberMetadata={"address": {
|
|
@@ -5656,7 +5677,7 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
5656
5677
|
* stagingHost="https://staging.accesstype.com"
|
|
5657
5678
|
* accessTypeBkIntegrationId={accessTypeBkIntegrationId}
|
|
5658
5679
|
* >
|
|
5659
|
-
* {({ initAccessType, checkAccess, accessUpdated, accessIsLoading, validateCoupon, initRazorPayPayment, initStripePayment, initPaypalPayment, getSubscriptionForUser, getSubscriberMetadata, setSubscriberMetadata }) => (
|
|
5680
|
+
* {({ initAccessType, checkAccess, accessUpdated, accessIsLoading, validateCoupon, initRazorPayPayment, initStripePayment, initPaypalPayment, initPaytrailPayment, getSubscriptionForUser, getSubscriberMetadata, setSubscriberMetadata }) => (
|
|
5660
5681
|
* <div>
|
|
5661
5682
|
* <PaymentCheckoutLayout
|
|
5662
5683
|
* accessIsLoading={accessIsLoading}
|
|
@@ -5666,6 +5687,7 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
5666
5687
|
* initRazorPayPayment={initRazorPayPayment}
|
|
5667
5688
|
* initStripePayment={initStripePayment}
|
|
5668
5689
|
* initPaypalPayment={initPaypalPayment}
|
|
5690
|
+
* initPaytrailPayment={initPaytrailPayment}
|
|
5669
5691
|
* getSubscriptionForUser={getSubscriptionForUser}
|
|
5670
5692
|
* getgetSubscriberMetadata={getgetSubscriberMetadata}
|
|
5671
5693
|
* setSubscriberMetadata={setSubscriberMetadata}
|
|
@@ -5705,6 +5727,16 @@ var mapDispatchToProps$1 = function mapDispatchToProps(dispatch) {
|
|
|
5705
5727
|
* return props.initPaypalPayment(options);
|
|
5706
5728
|
* }
|
|
5707
5729
|
*
|
|
5730
|
+
* if (paymentGateway === "paytrail") {
|
|
5731
|
+
* const options = {
|
|
5732
|
+
* selectedPlan: plan,
|
|
5733
|
+
* planType: "standard",
|
|
5734
|
+
* returnUrl: `${document.location.origin}/paytrail-success.html`,
|
|
5735
|
+
* cancelUrl: `${document.location.origin}/paytrail-cancel.html`
|
|
5736
|
+
* };
|
|
5737
|
+
* return props.initPaytrailPayment(options);
|
|
5738
|
+
* }
|
|
5739
|
+
*
|
|
5708
5740
|
* if (paymentGateway === "omise") {
|
|
5709
5741
|
* return props.initOmisePayment(plan, "standard");
|
|
5710
5742
|
* }
|
|
@@ -668,6 +668,28 @@ 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"]) ? "paytrail_recurring" : "paytrail";
|
|
681
|
+
|
|
682
|
+
var paymentObject = _this.makePaymentObject(_objectSpread({
|
|
683
|
+
paymentType: paymentType
|
|
684
|
+
}, options));
|
|
685
|
+
|
|
686
|
+
return paymentOptions.paytrail ? paymentOptions.paytrail.proceed(paymentObject).then(function (response) {
|
|
687
|
+
return response.proceed(paymentObject);
|
|
688
|
+
}) : Promise.reject({
|
|
689
|
+
message: "Payment option is loading..."
|
|
690
|
+
});
|
|
691
|
+
});
|
|
692
|
+
|
|
671
693
|
_defineProperty(_assertThisInitialized(_this), "pingBackMeteredStory", /*#__PURE__*/function () {
|
|
672
694
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(asset, accessData) {
|
|
673
695
|
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
@@ -945,6 +967,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
945
967
|
initPaypalPayment: this.initPaypalPayment,
|
|
946
968
|
initOmisePayment: this.initOmisePayment,
|
|
947
969
|
initAdyenPayment: this.initAdyenPayment,
|
|
970
|
+
initPaytrailPayment: this.initPaytrailPayment,
|
|
948
971
|
checkAccess: this.checkAccess,
|
|
949
972
|
getSubscriptionForUser: this.getSubscriptionForUser,
|
|
950
973
|
accessUpdated: this.props.accessUpdated,
|
|
@@ -1027,6 +1050,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
1027
1050
|
* initPaypalPayment| options(object), options={argType: "options",selectedPlan: selectedPlanObj,planType: planType,couponCode: "", recipientSubscriber: {}, returnUrl: "",cancelUrl:""} | Initialize the PayPal payment
|
|
1028
1051
|
* initOmisePayment| selectedPlan(object), planType(string) | Initialize the Omise payment
|
|
1029
1052
|
* initAdyenPayment| selectedPlan(object), planType(string), AdyenModal(React Component), locale(string) | Initialize Adyen Payment
|
|
1053
|
+
* initPaytrailPayment| selectedPlan(object), ptions={selectedPlan: selectedPlanObj,planType: planType,couponCode: "", recipientSubscriber: {}, returnUrl: "",cancelUrl:""} | Initialize the Paytrail payment
|
|
1030
1054
|
* getAssetPlans| storyId(string) | Get Asset Subscription Plans
|
|
1031
1055
|
* getSubscriberMetadata| Get the Subscriber Metadata
|
|
1032
1056
|
* setSubscriberMetadata| subscriberMetadata(object), subscriberMetadata={"address": {
|
|
@@ -1083,7 +1107,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
1083
1107
|
* stagingHost="https://staging.accesstype.com"
|
|
1084
1108
|
* accessTypeBkIntegrationId={accessTypeBkIntegrationId}
|
|
1085
1109
|
* >
|
|
1086
|
-
* {({ initAccessType, checkAccess, accessUpdated, accessIsLoading, validateCoupon, initRazorPayPayment, initStripePayment, initPaypalPayment, getSubscriptionForUser, getSubscriberMetadata, setSubscriberMetadata }) => (
|
|
1110
|
+
* {({ initAccessType, checkAccess, accessUpdated, accessIsLoading, validateCoupon, initRazorPayPayment, initStripePayment, initPaypalPayment, initPaytrailPayment, getSubscriptionForUser, getSubscriberMetadata, setSubscriberMetadata }) => (
|
|
1087
1111
|
* <div>
|
|
1088
1112
|
* <PaymentCheckoutLayout
|
|
1089
1113
|
* accessIsLoading={accessIsLoading}
|
|
@@ -1093,6 +1117,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
1093
1117
|
* initRazorPayPayment={initRazorPayPayment}
|
|
1094
1118
|
* initStripePayment={initStripePayment}
|
|
1095
1119
|
* initPaypalPayment={initPaypalPayment}
|
|
1120
|
+
* initPaytrailPayment={initPaytrailPayment}
|
|
1096
1121
|
* getSubscriptionForUser={getSubscriptionForUser}
|
|
1097
1122
|
* getgetSubscriberMetadata={getgetSubscriberMetadata}
|
|
1098
1123
|
* setSubscriberMetadata={setSubscriberMetadata}
|
|
@@ -1132,6 +1157,16 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
1132
1157
|
* return props.initPaypalPayment(options);
|
|
1133
1158
|
* }
|
|
1134
1159
|
*
|
|
1160
|
+
* if (paymentGateway === "paytrail") {
|
|
1161
|
+
* const options = {
|
|
1162
|
+
* selectedPlan: plan,
|
|
1163
|
+
* planType: "standard",
|
|
1164
|
+
* returnUrl: `${document.location.origin}/paytrail-success.html`,
|
|
1165
|
+
* cancelUrl: `${document.location.origin}/paytrail-cancel.html`
|
|
1166
|
+
* };
|
|
1167
|
+
* return props.initPaytrailPayment(options);
|
|
1168
|
+
* }
|
|
1169
|
+
*
|
|
1135
1170
|
* if (paymentGateway === "omise") {
|
|
1136
1171
|
* return props.initOmisePayment(plan, "standard");
|
|
1137
1172
|
* }
|
|
@@ -5,11 +5,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
7
|
|
|
8
|
-
import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
9
|
-
import emptyWebGif from "empty-web-gif";
|
|
10
|
-
import { FocusedImage } from "quintype-js";
|
|
11
8
|
import React, { useEffect } from "react";
|
|
9
|
+
import emptyWebGif from 'empty-web-gif';
|
|
10
|
+
import { FocusedImage } from "quintype-js";
|
|
12
11
|
import { hashString, USED_PARAMS } from "./image-utils";
|
|
12
|
+
import omit from '@babel/runtime/helpers/objectWithoutProperties';
|
|
13
13
|
var forceLoadingGumlet = false;
|
|
14
14
|
|
|
15
15
|
function loadGumlet() {
|
|
@@ -17,7 +17,7 @@ function loadGumlet() {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (process.env.NODE_ENV ==
|
|
20
|
+
if (process.env.NODE_ENV == 'development') {
|
|
21
21
|
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -25,9 +25,9 @@ function loadGumlet() {
|
|
|
25
25
|
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
26
26
|
hosts: []
|
|
27
27
|
};
|
|
28
|
-
var script = document.createElement(
|
|
29
|
-
script.type =
|
|
30
|
-
script.src =
|
|
28
|
+
var script = document.createElement('script');
|
|
29
|
+
script.type = 'text/javascript';
|
|
30
|
+
script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
|
|
31
31
|
document.body.appendChild(script);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -38,20 +38,17 @@ export function GumletImage(props) {
|
|
|
38
38
|
imageCDN = props.imageCDN,
|
|
39
39
|
imgParams = props.imgParams,
|
|
40
40
|
reactTag = props.reactTag,
|
|
41
|
-
className = props.className
|
|
42
|
-
_props$imgLazy = props.imgLazy,
|
|
43
|
-
imgLazy = _props$imgLazy === void 0 ? "true" : _props$imgLazy;
|
|
41
|
+
className = props.className;
|
|
44
42
|
var image = new FocusedImage(slug, metadata);
|
|
45
43
|
var imageProps = {
|
|
46
44
|
src: emptyWebGif,
|
|
47
45
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
48
|
-
key: hashString(slug)
|
|
49
|
-
"data-gmlazy": imgLazy
|
|
46
|
+
key: hashString(slug)
|
|
50
47
|
};
|
|
51
48
|
var Tag = reactTag || "img";
|
|
52
49
|
useEffect(loadGumlet);
|
|
53
50
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _extends({}, imageProps, omit(props, USED_PARAMS), {
|
|
54
|
-
className: className ? "qt-image ".concat(className) :
|
|
51
|
+
className: className ? "qt-image ".concat(className) : 'qt-image'
|
|
55
52
|
})), /*#__PURE__*/React.createElement("noscript", null, /*#__PURE__*/React.createElement("img", {
|
|
56
53
|
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread(_objectSpread({}, imgParams), {}, {
|
|
57
54
|
w: 1200
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export var USED_PARAMS = ["imageCDN", "defaultWidth", "widths", "imgParams", "slug", "metadata", "aspectRatio", "reactTag", "eager", "imageCDNFormat"
|
|
1
|
+
export var USED_PARAMS = ["imageCDN", "defaultWidth", "widths", "imgParams", "slug", "metadata", "aspectRatio", "reactTag", "eager", "imageCDNFormat"]; // Add the following CSS somewhere: img.qt-image { width: 100%; object-fit: cover; }
|
|
2
2
|
|
|
3
3
|
export function hashString(string) {
|
|
4
4
|
if (!string) return 0;
|