@quintype/components 3.6.1-image-sizes.1 → 3.6.1-sub-dir-paywall.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js
CHANGED
|
@@ -17,9 +17,9 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
17
17
|
var reactDfp = require('react-dfp');
|
|
18
18
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
19
19
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
20
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
21
20
|
var emptyWebGif = require('empty-web-gif');
|
|
22
21
|
var quintypeJs = require('quintype-js');
|
|
22
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
23
23
|
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
24
24
|
var classNames = require('classnames');
|
|
25
25
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
@@ -60,8 +60,8 @@ var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
|
60
60
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
61
61
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
62
62
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
63
|
-
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
64
63
|
var emptyWebGif__default = /*#__PURE__*/_interopDefaultLegacy(emptyWebGif);
|
|
64
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
65
65
|
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
66
66
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
67
67
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
@@ -1844,59 +1844,6 @@ function hashString(string) {
|
|
|
1844
1844
|
return hash;
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
-
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1848
|
-
|
|
1849
|
-
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1850
|
-
var forceLoadingGumlet = false;
|
|
1851
|
-
|
|
1852
|
-
function loadGumlet() {
|
|
1853
|
-
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1854
|
-
return;
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
if (process.env.NODE_ENV == "development") {
|
|
1858
|
-
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
forceLoadingGumlet = true;
|
|
1862
|
-
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1863
|
-
hosts: []
|
|
1864
|
-
};
|
|
1865
|
-
var script = document.createElement("script");
|
|
1866
|
-
script.type = "text/javascript";
|
|
1867
|
-
script.src = "https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js";
|
|
1868
|
-
document.body.appendChild(script);
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
function GumletImage(props) {
|
|
1872
|
-
var slug = props.slug,
|
|
1873
|
-
metadata = props.metadata,
|
|
1874
|
-
aspectRatio = props.aspectRatio,
|
|
1875
|
-
imageCDN = props.imageCDN,
|
|
1876
|
-
imgParams = props.imgParams,
|
|
1877
|
-
reactTag = props.reactTag,
|
|
1878
|
-
className = props.className,
|
|
1879
|
-
sizes = props.sizes;
|
|
1880
|
-
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1881
|
-
console.log("aa--sizes", sizes);
|
|
1882
|
-
var imageProps = {
|
|
1883
|
-
src: emptyWebGif__default["default"],
|
|
1884
|
-
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1885
|
-
key: hashString(slug),
|
|
1886
|
-
sizes: sizes
|
|
1887
|
-
};
|
|
1888
|
-
var Tag = reactTag || "img";
|
|
1889
|
-
React.useEffect(loadGumlet);
|
|
1890
|
-
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), {
|
|
1891
|
-
className: className ? "qt-image ".concat(className) : "qt-image"
|
|
1892
|
-
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1893
|
-
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1894
|
-
w: 1200
|
|
1895
|
-
}))),
|
|
1896
|
-
alt: props.alt || ""
|
|
1897
|
-
})));
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
1847
|
function _createSuper$g(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$g(); return function _createSuperInternal() { var Super = _getPrototypeOf__default["default"](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default["default"](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default["default"](this, result); }; }
|
|
1901
1848
|
|
|
1902
1849
|
function _isNativeReflectConstruct$g() { 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; } }
|
|
@@ -1909,14 +1856,12 @@ function responsiveProps(props) {
|
|
|
1909
1856
|
}, props.imgParams));
|
|
1910
1857
|
}
|
|
1911
1858
|
|
|
1912
|
-
console.log("aa--sizes", props === null || props === void 0 ? void 0 : props.sizes);
|
|
1913
1859
|
return {
|
|
1914
1860
|
src: generatePath(props.defaultWidth),
|
|
1915
1861
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
1916
1862
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
1917
1863
|
}).join(",") : undefined,
|
|
1918
|
-
key: hashString(props.slug)
|
|
1919
|
-
sizes: props === null || props === void 0 ? void 0 : props.sizes
|
|
1864
|
+
key: hashString(props.slug)
|
|
1920
1865
|
};
|
|
1921
1866
|
}
|
|
1922
1867
|
var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
@@ -1965,7 +1910,7 @@ var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
1965
1910
|
ref: function ref(dom) {
|
|
1966
1911
|
return _this2.dom = dom;
|
|
1967
1912
|
},
|
|
1968
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
1913
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : 'qt-image'
|
|
1969
1914
|
}));
|
|
1970
1915
|
}
|
|
1971
1916
|
}, {
|
|
@@ -1995,6 +1940,56 @@ ThumborImage.contextTypes = {
|
|
|
1995
1940
|
lazyLoadEagerPredicate: propTypes.func
|
|
1996
1941
|
};
|
|
1997
1942
|
|
|
1943
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1944
|
+
|
|
1945
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1946
|
+
var forceLoadingGumlet = false;
|
|
1947
|
+
|
|
1948
|
+
function loadGumlet() {
|
|
1949
|
+
if (window.GUMLET_CONFIG || window.gumlet || forceLoadingGumlet === true) {
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
if (process.env.NODE_ENV == 'development') {
|
|
1954
|
+
console.warn("Loading Gumlet Dynamically! This is really bad for page speed. Please see https://developers.quintype.com/malibu/tutorial/gumlet-integration");
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
forceLoadingGumlet = true;
|
|
1958
|
+
window.GUMLET_CONFIG = window.GUMLET_CONFIG || {
|
|
1959
|
+
hosts: []
|
|
1960
|
+
};
|
|
1961
|
+
var script = document.createElement('script');
|
|
1962
|
+
script.type = 'text/javascript';
|
|
1963
|
+
script.src = 'https://cdn.gumlet.com/gumlet.js/2.0/gumlet.min.js';
|
|
1964
|
+
document.body.appendChild(script);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
function GumletImage(props) {
|
|
1968
|
+
var slug = props.slug,
|
|
1969
|
+
metadata = props.metadata,
|
|
1970
|
+
aspectRatio = props.aspectRatio,
|
|
1971
|
+
imageCDN = props.imageCDN,
|
|
1972
|
+
imgParams = props.imgParams,
|
|
1973
|
+
reactTag = props.reactTag,
|
|
1974
|
+
className = props.className;
|
|
1975
|
+
var image = new quintypeJs.FocusedImage(slug, metadata);
|
|
1976
|
+
var imageProps = {
|
|
1977
|
+
src: emptyWebGif__default["default"],
|
|
1978
|
+
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
1979
|
+
key: hashString(slug)
|
|
1980
|
+
};
|
|
1981
|
+
var Tag = reactTag || "img";
|
|
1982
|
+
React.useEffect(loadGumlet);
|
|
1983
|
+
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), {
|
|
1984
|
+
className: className ? "qt-image ".concat(className) : 'qt-image'
|
|
1985
|
+
})), /*#__PURE__*/React__default["default"].createElement("noscript", null, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1986
|
+
src: "https://".concat(imageCDN, "/").concat(image.path(aspectRatio, _objectSpread$4(_objectSpread$4({}, imgParams), {}, {
|
|
1987
|
+
w: 1200
|
|
1988
|
+
}))),
|
|
1989
|
+
alt: props.alt || ""
|
|
1990
|
+
})));
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1998
1993
|
function mapStateToProps$6(state) {
|
|
1999
1994
|
return {
|
|
2000
1995
|
imageCDN: state.qt.config["cdn-image"],
|
|
@@ -2003,12 +1998,10 @@ function mapStateToProps$6(state) {
|
|
|
2003
1998
|
}
|
|
2004
1999
|
|
|
2005
2000
|
function ResponsiveImageBase(props) {
|
|
2006
|
-
if (process.env.NODE_ENV ==
|
|
2001
|
+
if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
|
|
2007
2002
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
2008
2003
|
}
|
|
2009
2004
|
|
|
2010
|
-
console.log("aa--imageCdnFormat", props.imageCDNFormat);
|
|
2011
|
-
|
|
2012
2005
|
if (props.imageCDNFormat === "gumlet") {
|
|
2013
2006
|
return /*#__PURE__*/React__default["default"].createElement(GumletImage, props);
|
|
2014
2007
|
}
|
|
@@ -5199,6 +5192,22 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5199
5192
|
}, _callee3);
|
|
5200
5193
|
})));
|
|
5201
5194
|
|
|
5195
|
+
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getPath", function (sketchesHost, relativePath) {
|
|
5196
|
+
try {
|
|
5197
|
+
var _URL = new URL(sketchesHost),
|
|
5198
|
+
pathname = _URL.pathname;
|
|
5199
|
+
|
|
5200
|
+
if (pathname && pathname !== '/') {
|
|
5201
|
+
return "".concat(sketchesHost).concat(relativePath);
|
|
5202
|
+
}
|
|
5203
|
+
|
|
5204
|
+
return relativePath;
|
|
5205
|
+
} catch (err) {
|
|
5206
|
+
console.log('Sketches host path error ---> ', err);
|
|
5207
|
+
return relativePath;
|
|
5208
|
+
}
|
|
5209
|
+
});
|
|
5210
|
+
|
|
5202
5211
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "getSubscription", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4() {
|
|
5203
5212
|
var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
|
|
5204
5213
|
|
|
@@ -5398,7 +5407,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5398
5407
|
})));
|
|
5399
5408
|
|
|
5400
5409
|
_defineProperty__default["default"](_assertThisInitialized__default["default"](_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8() {
|
|
5410
|
+
var _this$props;
|
|
5411
|
+
|
|
5401
5412
|
var callback,
|
|
5413
|
+
url,
|
|
5402
5414
|
jwtResponse,
|
|
5403
5415
|
_yield$awaitHelper7,
|
|
5404
5416
|
error,
|
|
@@ -5411,15 +5423,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5411
5423
|
callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
|
|
5412
5424
|
return null;
|
|
5413
5425
|
};
|
|
5414
|
-
|
|
5415
|
-
|
|
5426
|
+
url = _this.getPath((_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.sketchesHost, "/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
|
|
5427
|
+
_context8.next = 4;
|
|
5428
|
+
return fetch(url);
|
|
5416
5429
|
|
|
5417
|
-
case
|
|
5430
|
+
case 4:
|
|
5418
5431
|
jwtResponse = _context8.sent;
|
|
5419
|
-
_context8.next =
|
|
5432
|
+
_context8.next = 7;
|
|
5420
5433
|
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
|
|
5421
5434
|
|
|
5422
|
-
case
|
|
5435
|
+
case 7:
|
|
5423
5436
|
_yield$awaitHelper7 = _context8.sent;
|
|
5424
5437
|
error = _yield$awaitHelper7.error;
|
|
5425
5438
|
|
|
@@ -5448,7 +5461,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
5448
5461
|
}
|
|
5449
5462
|
}
|
|
5450
5463
|
|
|
5451
|
-
case
|
|
5464
|
+
case 10:
|
|
5452
5465
|
case "end":
|
|
5453
5466
|
return _context8.stop();
|
|
5454
5467
|
}
|
|
@@ -216,6 +216,22 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
216
216
|
}, _callee3);
|
|
217
217
|
})));
|
|
218
218
|
|
|
219
|
+
_defineProperty(_assertThisInitialized(_this), "getPath", function (sketchesHost, relativePath) {
|
|
220
|
+
try {
|
|
221
|
+
var _URL = new URL(sketchesHost),
|
|
222
|
+
pathname = _URL.pathname;
|
|
223
|
+
|
|
224
|
+
if (pathname && pathname !== '/') {
|
|
225
|
+
return "".concat(sketchesHost).concat(relativePath);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return relativePath;
|
|
229
|
+
} catch (err) {
|
|
230
|
+
console.log('Sketches host path error ---> ', err);
|
|
231
|
+
return relativePath;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
219
235
|
_defineProperty(_assertThisInitialized(_this), "getSubscription", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
220
236
|
var accessTypeKey, isStaging, HOST, accessTypeHost, _yield$awaitHelper3, error, subscriptions;
|
|
221
237
|
|
|
@@ -415,7 +431,10 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
415
431
|
})));
|
|
416
432
|
|
|
417
433
|
_defineProperty(_assertThisInitialized(_this), "runSequentialCalls", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
434
|
+
var _this$props;
|
|
435
|
+
|
|
418
436
|
var callback,
|
|
437
|
+
url,
|
|
419
438
|
jwtResponse,
|
|
420
439
|
_yield$awaitHelper7,
|
|
421
440
|
error,
|
|
@@ -428,15 +447,16 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
428
447
|
callback = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : function () {
|
|
429
448
|
return null;
|
|
430
449
|
};
|
|
431
|
-
|
|
432
|
-
|
|
450
|
+
url = _this.getPath((_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.sketchesHost, "/api/auth/v1/access-token/integrations/".concat(_this.props.accessTypeBkIntegrationId));
|
|
451
|
+
_context8.next = 4;
|
|
452
|
+
return fetch(url);
|
|
433
453
|
|
|
434
|
-
case
|
|
454
|
+
case 4:
|
|
435
455
|
jwtResponse = _context8.sent;
|
|
436
|
-
_context8.next =
|
|
456
|
+
_context8.next = 7;
|
|
437
457
|
return awaitHelper(_this.setUser(_this.props.email, _this.props.phone, jwtResponse.headers.get("x-integration-token"), !!jwtResponse.headers.get("x-integration-token")));
|
|
438
458
|
|
|
439
|
-
case
|
|
459
|
+
case 7:
|
|
440
460
|
_yield$awaitHelper7 = _context8.sent;
|
|
441
461
|
error = _yield$awaitHelper7.error;
|
|
442
462
|
|
|
@@ -465,7 +485,7 @@ var AccessTypeBase = /*#__PURE__*/function (_React$Component) {
|
|
|
465
485
|
}
|
|
466
486
|
}
|
|
467
487
|
|
|
468
|
-
case
|
|
488
|
+
case 10:
|
|
469
489
|
case "end":
|
|
470
490
|
return _context8.stop();
|
|
471
491
|
}
|
|
@@ -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
|
-
sizes = props.sizes;
|
|
41
|
+
className = props.className;
|
|
43
42
|
var image = new FocusedImage(slug, metadata);
|
|
44
|
-
console.log("aa--sizes", sizes);
|
|
45
43
|
var imageProps = {
|
|
46
44
|
src: emptyWebGif,
|
|
47
45
|
"data-src": "https://" + imageCDN + "/" + image.path(aspectRatio, imgParams),
|
|
48
|
-
key: hashString(slug)
|
|
49
|
-
sizes: sizes
|
|
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
|
|
@@ -8,12 +8,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
8
8
|
|
|
9
9
|
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; } }
|
|
10
10
|
|
|
11
|
-
import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
12
|
-
import emptyWebGif from "empty-web-gif";
|
|
13
|
-
import { func } from "prop-types";
|
|
14
|
-
import { FocusedImage } from "quintype-js";
|
|
15
11
|
import React from "react";
|
|
16
|
-
import
|
|
12
|
+
import emptyWebGif from 'empty-web-gif';
|
|
13
|
+
import omit from '@babel/runtime/helpers/objectWithoutProperties';
|
|
14
|
+
import { func } from 'prop-types';
|
|
15
|
+
import { FocusedImage } from "quintype-js";
|
|
16
|
+
import { USED_PARAMS, hashString } from './image-utils';
|
|
17
17
|
export function responsiveProps(props) {
|
|
18
18
|
var image = new FocusedImage(props.slug, props.metadata);
|
|
19
19
|
|
|
@@ -23,14 +23,12 @@ export function responsiveProps(props) {
|
|
|
23
23
|
}, props.imgParams));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
console.log("aa--sizes", props === null || props === void 0 ? void 0 : props.sizes);
|
|
27
26
|
return {
|
|
28
27
|
src: generatePath(props.defaultWidth),
|
|
29
28
|
srcSet: props.widths ? props.widths.map(function (size) {
|
|
30
29
|
return "".concat(generatePath(size), " ").concat(size, "w");
|
|
31
30
|
}).join(",") : undefined,
|
|
32
|
-
key: hashString(props.slug)
|
|
33
|
-
sizes: props === null || props === void 0 ? void 0 : props.sizes
|
|
31
|
+
key: hashString(props.slug)
|
|
34
32
|
};
|
|
35
33
|
}
|
|
36
34
|
export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
@@ -79,7 +77,7 @@ export var ThumborImage = /*#__PURE__*/function (_React$Component) {
|
|
|
79
77
|
ref: function ref(dom) {
|
|
80
78
|
return _this2.dom = dom;
|
|
81
79
|
},
|
|
82
|
-
className: this.props.className ? "qt-image ".concat(this.props.className) :
|
|
80
|
+
className: this.props.className ? "qt-image ".concat(this.props.className) : 'qt-image'
|
|
83
81
|
}));
|
|
84
82
|
}
|
|
85
83
|
}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { arrayOf, number, object, string } from "prop-types";
|
|
2
|
-
import React from "react";
|
|
3
1
|
import { connect } from "react-redux";
|
|
4
|
-
import
|
|
2
|
+
import React from "react";
|
|
5
3
|
import { ThumborImage } from "./impl/thumbor-image";
|
|
4
|
+
import { string, arrayOf, number, object } from 'prop-types';
|
|
5
|
+
import { GumletImage } from "./impl/gumlet-image";
|
|
6
6
|
|
|
7
7
|
function mapStateToProps(state) {
|
|
8
8
|
return {
|
|
@@ -12,12 +12,10 @@ function mapStateToProps(state) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function ResponsiveImageBase(props) {
|
|
15
|
-
if (process.env.NODE_ENV ==
|
|
15
|
+
if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
|
|
16
16
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
console.log("aa--imageCdnFormat", props.imageCDNFormat);
|
|
20
|
-
|
|
21
19
|
if (props.imageCDNFormat === "gumlet") {
|
|
22
20
|
return /*#__PURE__*/React.createElement(GumletImage, props);
|
|
23
21
|
}
|
package/package.json
CHANGED