@mjhls/mjh-framework 1.0.1066 → 1.0.1067-featureUpdate

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.
@@ -2,6 +2,8 @@
2
2
 
3
3
  var slicedToArray$1 = require('./slicedToArray-067dd3bc.js');
4
4
  var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
5
+ var _typeof = require('./typeof-1358762e.js');
6
+ var defineProperty = require('./defineProperty-e0fb52c5.js');
5
7
  var React = require('react');
6
8
  var reactBootstrap = require('react-bootstrap');
7
9
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
@@ -19,27 +21,12 @@ function _interopRequireDefault(obj) {
19
21
  };
20
22
  }
21
23
 
22
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
24
+ module.exports = _interopRequireDefault;
25
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
23
26
  });
24
27
 
25
28
  _commonjsHelpers.unwrapExports(interopRequireDefault);
26
29
 
27
- var _typeof_1 = _commonjsHelpers.createCommonjsModule(function (module) {
28
- function _typeof(obj) {
29
- "@babel/helpers - typeof";
30
-
31
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
32
- return typeof obj;
33
- } : function (obj) {
34
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
35
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
36
- }
37
-
38
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
39
- });
40
-
41
- _commonjsHelpers.unwrapExports(_typeof_1);
42
-
43
30
  var runtime_1 = _commonjsHelpers.createCommonjsModule(function (module) {
44
31
  /**
45
32
  * Copyright (c) 2014-present, Facebook, Inc.
@@ -798,75 +785,13 @@ try {
798
785
 
799
786
  var regenerator = runtime_1;
800
787
 
801
- var defineProperty = _commonjsHelpers.createCommonjsModule(function (module) {
802
- function _defineProperty(obj, key, value) {
803
- if (key in obj) {
804
- Object.defineProperty(obj, key, {
805
- value: value,
806
- enumerable: true,
807
- configurable: true,
808
- writable: true
809
- });
810
- } else {
811
- obj[key] = value;
812
- }
813
-
814
- return obj;
815
- }
816
-
817
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
818
- });
819
-
820
- _commonjsHelpers.unwrapExports(defineProperty);
821
-
822
- var asyncToGenerator = _commonjsHelpers.createCommonjsModule(function (module) {
823
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
824
- try {
825
- var info = gen[key](arg);
826
- var value = info.value;
827
- } catch (error) {
828
- reject(error);
829
- return;
830
- }
831
-
832
- if (info.done) {
833
- resolve(value);
834
- } else {
835
- Promise.resolve(value).then(_next, _throw);
836
- }
837
- }
838
-
839
- function _asyncToGenerator(fn) {
840
- return function () {
841
- var self = this,
842
- args = arguments;
843
- return new Promise(function (resolve, reject) {
844
- var gen = fn.apply(self, args);
845
-
846
- function _next(value) {
847
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
848
- }
849
-
850
- function _throw(err) {
851
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
852
- }
853
-
854
- _next(undefined);
855
- });
856
- };
857
- }
858
-
859
- module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
860
- });
861
-
862
- _commonjsHelpers.unwrapExports(asyncToGenerator);
863
-
864
788
  var arrayWithHoles = _commonjsHelpers.createCommonjsModule(function (module) {
865
789
  function _arrayWithHoles(arr) {
866
790
  if (Array.isArray(arr)) return arr;
867
791
  }
868
792
 
869
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
793
+ module.exports = _arrayWithHoles;
794
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
870
795
  });
871
796
 
872
797
  _commonjsHelpers.unwrapExports(arrayWithHoles);
@@ -902,7 +827,8 @@ function _iterableToArrayLimit(arr, i) {
902
827
  return _arr;
903
828
  }
904
829
 
905
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
830
+ module.exports = _iterableToArrayLimit;
831
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
906
832
  });
907
833
 
908
834
  _commonjsHelpers.unwrapExports(iterableToArrayLimit);
@@ -918,7 +844,8 @@ function _arrayLikeToArray(arr, len) {
918
844
  return arr2;
919
845
  }
920
846
 
921
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
847
+ module.exports = _arrayLikeToArray;
848
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
922
849
  });
923
850
 
924
851
  _commonjsHelpers.unwrapExports(arrayLikeToArray);
@@ -933,7 +860,8 @@ function _unsupportedIterableToArray(o, minLen) {
933
860
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
934
861
  }
935
862
 
936
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
863
+ module.exports = _unsupportedIterableToArray;
864
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
937
865
  });
938
866
 
939
867
  _commonjsHelpers.unwrapExports(unsupportedIterableToArray);
@@ -943,7 +871,8 @@ function _nonIterableRest() {
943
871
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
944
872
  }
945
873
 
946
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
874
+ module.exports = _nonIterableRest;
875
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
947
876
  });
948
877
 
949
878
  _commonjsHelpers.unwrapExports(nonIterableRest);
@@ -953,7 +882,8 @@ function _slicedToArray(arr, i) {
953
882
  return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
954
883
  }
955
884
 
956
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
885
+ module.exports = _slicedToArray;
886
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
957
887
  });
958
888
 
959
889
  _commonjsHelpers.unwrapExports(slicedToArray);
@@ -1097,9 +1027,9 @@ exports.default = void 0;
1097
1027
 
1098
1028
  var _regenerator = interopRequireDefault(regenerator);
1099
1029
 
1100
- var _defineProperty2 = interopRequireDefault(defineProperty);
1030
+ var _defineProperty2 = interopRequireDefault(defineProperty.defineProperty);
1101
1031
 
1102
- var _asyncToGenerator2 = interopRequireDefault(asyncToGenerator);
1032
+ var _asyncToGenerator2 = interopRequireDefault(defineProperty.asyncToGenerator);
1103
1033
 
1104
1034
  var _slicedToArray2 = interopRequireDefault(slicedToArray);
1105
1035
 
@@ -1111,7 +1041,7 @@ var _parseUrl = interopRequireDefault(parseUrl_1);
1111
1041
 
1112
1042
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
1113
1043
 
1114
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof_1(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1044
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof._typeof_1(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1115
1045
 
1116
1046
  function ownKeys(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; }
1117
1047
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  var React = require('react');
4
4
  var urlFor = require('./urlFor.js');
5
- var main = require('./main-ae8472f3.js');
6
5
  var Carousel = require('react-bootstrap/Carousel');
7
6
  require('./slicedToArray-067dd3bc.js');
8
7
  require('./_commonjsHelpers-06173234.js');
@@ -16,6 +15,408 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
16
15
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
16
  var Carousel__default = /*#__PURE__*/_interopDefaultLegacy(Carousel);
18
17
 
18
+ function _inheritsLoose(subClass, superClass) {
19
+ subClass.prototype = Object.create(superClass.prototype);
20
+ subClass.prototype.constructor = subClass;
21
+ subClass.__proto__ = superClass;
22
+ }
23
+
24
+ function _getPrototypeOf(o) {
25
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
26
+ return o.__proto__ || Object.getPrototypeOf(o);
27
+ };
28
+ return _getPrototypeOf(o);
29
+ }
30
+
31
+ function _setPrototypeOf(o, p) {
32
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
33
+ o.__proto__ = p;
34
+ return o;
35
+ };
36
+
37
+ return _setPrototypeOf(o, p);
38
+ }
39
+
40
+ function _isNativeReflectConstruct() {
41
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
42
+ if (Reflect.construct.sham) return false;
43
+ if (typeof Proxy === "function") return true;
44
+
45
+ try {
46
+ Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
47
+ return true;
48
+ } catch (e) {
49
+ return false;
50
+ }
51
+ }
52
+
53
+ function _construct(Parent, args, Class) {
54
+ if (_isNativeReflectConstruct()) {
55
+ _construct = Reflect.construct;
56
+ } else {
57
+ _construct = function _construct(Parent, args, Class) {
58
+ var a = [null];
59
+ a.push.apply(a, args);
60
+ var Constructor = Function.bind.apply(Parent, a);
61
+ var instance = new Constructor();
62
+ if (Class) _setPrototypeOf(instance, Class.prototype);
63
+ return instance;
64
+ };
65
+ }
66
+
67
+ return _construct.apply(null, arguments);
68
+ }
69
+
70
+ function _isNativeFunction(fn) {
71
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
72
+ }
73
+
74
+ function _wrapNativeSuper(Class) {
75
+ var _cache = typeof Map === "function" ? new Map() : undefined;
76
+
77
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
78
+ if (Class === null || !_isNativeFunction(Class)) return Class;
79
+
80
+ if (typeof Class !== "function") {
81
+ throw new TypeError("Super expression must either be null or a function");
82
+ }
83
+
84
+ if (typeof _cache !== "undefined") {
85
+ if (_cache.has(Class)) return _cache.get(Class);
86
+
87
+ _cache.set(Class, Wrapper);
88
+ }
89
+
90
+ function Wrapper() {
91
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
92
+ }
93
+
94
+ Wrapper.prototype = Object.create(Class.prototype, {
95
+ constructor: {
96
+ value: Wrapper,
97
+ enumerable: false,
98
+ writable: true,
99
+ configurable: true
100
+ }
101
+ });
102
+ return _setPrototypeOf(Wrapper, Class);
103
+ };
104
+
105
+ return _wrapNativeSuper(Class);
106
+ }
107
+
108
+ /**
109
+ * Error type thrown when the library fails to resolve a value, such as an asset ID,
110
+ * filename or project ID/dataset information.
111
+ *
112
+ * The `input` property holds the value passed as the input, which failed to be
113
+ * resolved to something meaningful.
114
+ */
115
+ var UnresolvableError = /*#__PURE__*/function (_Error) {
116
+ _inheritsLoose(UnresolvableError, _Error);
117
+
118
+ function UnresolvableError(inputSource, message) {
119
+ var _this;
120
+
121
+ if (message === void 0) {
122
+ message = 'Failed to resolve asset ID from source';
123
+ }
124
+
125
+ _this = _Error.call(this, message) || this;
126
+ _this.unresolvable = true;
127
+ _this.input = inputSource;
128
+ return _this;
129
+ }
130
+
131
+ return UnresolvableError;
132
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
133
+
134
+ /**
135
+ * @internal
136
+ */
137
+ var cdnUrl = 'https://cdn.sanity.io';
138
+ /**
139
+ * @internal
140
+ */
141
+
142
+ var fileAssetFilenamePattern = /^([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+\.[a-z0-9]+$/;
143
+ /**
144
+ * @internal
145
+ */
146
+
147
+ var imageAssetFilenamePattern = /^([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})-\d+x\d+\.[a-z0-9]+$/;
148
+ /**
149
+ * @internal
150
+ */
151
+
152
+ var pathPattern = /^(images|files)\/([a-z0-9]+)\/([a-z0-9][-\w]*)\//;
153
+ /**
154
+ * @internal
155
+ */
156
+
157
+ var idPattern = /^(?:image-[a-zA-Z0-9_]+-\d+x\d+-[a-z0-9]+|file-[a-zA-Z0-9_]+-[a-z0-9]+)$/;
158
+
159
+ /**
160
+ * Checks whether or not the given source is a Sanity reference
161
+ * (an object containing _ref string key)
162
+ *
163
+ * @param ref - Possible reference
164
+ * @returns Whether or not the passed object is a reference
165
+ */
166
+ function isReference(ref) {
167
+ return isObject(ref) && typeof ref._ref === 'string';
168
+ }
169
+ /**
170
+ * Checks whether or not the given source is an asset ID stub
171
+ * (an object containing an `_id` property)
172
+ *
173
+ * @param stub - Possible asset id stub
174
+ * @returns Whether or not the passed object is an object id stub
175
+ */
176
+
177
+ function isAssetIdStub(stub) {
178
+ return isObject(stub) && typeof stub._id === 'string';
179
+ }
180
+ /**
181
+ * Checks whether or not the given source is an asset path stub
182
+ * (an object containing a `path` property)
183
+ *
184
+ * @param stub - Possible asset path stub
185
+ * @returns Whether or not the passed object is an object path stub
186
+ */
187
+
188
+ function isAssetPathStub(stub) {
189
+ return isObject(stub) && typeof stub.path === 'string';
190
+ }
191
+ /**
192
+ * Checks whether or not the given source is an asset URL stub
193
+ * (an object containing a `url` property)
194
+ *
195
+ * @param stub - Possible asset url stub
196
+ * @returns Whether or not the passed object is an object url stub
197
+ */
198
+
199
+ function isAssetUrlStub(stub) {
200
+ return isObject(stub) && typeof stub.url === 'string';
201
+ }
202
+ /**
203
+ * Checks whether or not the given source is an asset object stub
204
+ *
205
+ * @param stub - Possible asset object stub
206
+ * @returns Whether or not the passed object is an object stub
207
+ */
208
+
209
+ function isAssetObjectStub(stub) {
210
+ var item = stub;
211
+ return isObject(item) && item.asset && typeof item.asset === 'object';
212
+ }
213
+ /**
214
+ * Checks whether or not the passed object is an object (and not `null`)
215
+ *
216
+ * @param obj Item to check whether or not is an object
217
+ * @returns Whether or not `obj` is an object
218
+ * @internal
219
+ */
220
+
221
+ function isObject(obj) {
222
+ return obj !== null && !Array.isArray(obj) && typeof obj === 'object';
223
+ }
224
+ /**
225
+ * Strips the CDN URL and query params from a URL, eg:
226
+ * `https://cdn.sanity.io/images/project/dataset/filename-200x200.jpg?foo=bar` =>
227
+ * `images/project/dataset/filename-200x200.jpg`
228
+ *
229
+ * @param url - URL to get path name from
230
+ * @returns The path of a CDN URL
231
+ * @throws If URL is not a valid Sanity asset URL
232
+ */
233
+
234
+ function getUrlPath(url) {
235
+ if (pathPattern.test(url)) {
236
+ // Already just a path
237
+ return url;
238
+ }
239
+
240
+ if (!url.startsWith(cdnUrl + "/")) {
241
+ throw new UnresolvableError("Failed to resolve path from URL \"" + url + "\"");
242
+ }
243
+
244
+ var qsPos = url.indexOf('?');
245
+ var toIndex = qsPos === -1 ? undefined : qsPos;
246
+ return url.slice(cdnUrl.length + 1, toIndex);
247
+ }
248
+ /**
249
+ * @internal
250
+ */
251
+
252
+ var exampleImageId = 'image-027401f31c3ac1e6d78c5d539ccd1beff72b9b11-2000x3000-jpg';
253
+ /**
254
+ * Parses a Sanity image asset document ID into individual parts (type, id, extension, width, height)
255
+ *
256
+ * @param documentId - Image asset document ID to parse into named parts
257
+ * @returns Object of named properties
258
+ * @throws If document ID invalid
259
+ */
260
+
261
+ function parseImageAssetId(documentId) {
262
+ var _documentId$split2 = documentId.split('-'),
263
+ assetId = _documentId$split2[1],
264
+ dimensionString = _documentId$split2[2],
265
+ extension = _documentId$split2[3];
266
+
267
+ var _split$map = (dimensionString || '').split('x').map(Number),
268
+ width = _split$map[0],
269
+ height = _split$map[1];
270
+
271
+ if (!assetId || !dimensionString || !extension || !(width > 0) || !(height > 0)) {
272
+ throw new Error("Malformed asset ID '" + documentId + "'. Expected an id like \"" + exampleImageId + "\".");
273
+ }
274
+
275
+ return {
276
+ type: 'image',
277
+ assetId: assetId,
278
+ width: width,
279
+ height: height,
280
+ extension: extension
281
+ };
282
+ }
283
+
284
+ /**
285
+ * Returns the width, height and aspect ratio of a passed image asset, from any
286
+ * inferrable structure (id, url, path, asset document, image object etc)
287
+ *
288
+ * @param src - Input source (image object, asset, reference, id, url, path)
289
+ * @returns Object with width, height and aspect ratio properties
290
+ *
291
+ * @throws {@link UnresolvableError}
292
+ * Throws if passed image source could not be resolved to an asset ID
293
+ */
294
+
295
+ function getImageDimensions(src) {
296
+ var imageId = getAssetDocumentId(src);
297
+
298
+ var _parseImageAssetId = parseImageAssetId(imageId),
299
+ width = _parseImageAssetId.width,
300
+ height = _parseImageAssetId.height;
301
+
302
+ var aspectRatio = width / height;
303
+ return {
304
+ width: width,
305
+ height: height,
306
+ aspectRatio: aspectRatio
307
+ };
308
+ }
309
+ /**
310
+ * Tries to resolve the asset document ID from any inferrable structure
311
+ *
312
+ * @param src - Input source (image/file object, asset, reference, id, url, path)
313
+ * @returns The asset document ID
314
+ *
315
+ * @throws {@link UnresolvableError}
316
+ * Throws if passed asset source could not be resolved to an asset document ID
317
+ */
318
+
319
+ function getAssetDocumentId(src) {
320
+ var source = isAssetObjectStub(src) ? src.asset : src;
321
+ var id = '';
322
+
323
+ if (typeof source === 'string') {
324
+ id = getIdFromString(source);
325
+ } else if (isReference(source)) {
326
+ id = source._ref;
327
+ } else if (isAssetIdStub(source)) {
328
+ id = source._id;
329
+ } else if (isAssetPathStub(source)) {
330
+ id = idFromUrl(cdnUrl + "/" + source.path);
331
+ } else if (isAssetUrlStub(source)) {
332
+ id = idFromUrl(source.url);
333
+ }
334
+
335
+ var hasId = id && idPattern.test(id);
336
+
337
+ if (!hasId) {
338
+ throw new UnresolvableError(src);
339
+ }
340
+
341
+ return id;
342
+ }
343
+ /**
344
+ * Tries to cooerce a string (ID, URL or path) to an image asset ID
345
+ *
346
+ * @param str - Input string (ID, URL or path)
347
+ * @returns string
348
+ *
349
+ *
350
+ * @throws {@link UnresolvableError}
351
+ * Throws if passed image source could not be resolved to an asset ID
352
+ */
353
+
354
+ function getIdFromString(str) {
355
+ if (idPattern.test(str)) {
356
+ // Already an ID
357
+ return str;
358
+ }
359
+
360
+ if (str.indexOf(cdnUrl + "/images") === 0 || str.indexOf(cdnUrl + "/files") === 0) {
361
+ // Full URL
362
+ return idFromUrl(str);
363
+ }
364
+
365
+ if (pathPattern.test(str)) {
366
+ // Path
367
+ return idFromUrl(cdnUrl + "/" + str);
368
+ }
369
+
370
+ if (isFileAssetFilename(str)) {
371
+ // Just a filename (projectId/dataset irrelevant: just need asset ID)
372
+ return idFromUrl(cdnUrl + "/files/a/b/" + str);
373
+ }
374
+
375
+ if (isImageAssetFilename(str)) {
376
+ // Just a filename (projectId/dataset irrelevant: just need asset ID)
377
+ return idFromUrl(cdnUrl + "/images/a/b/" + str);
378
+ }
379
+
380
+ throw new UnresolvableError(str);
381
+ }
382
+ /**
383
+ * Converts from a full asset URL to just the asset document ID
384
+ *
385
+ * @param url - A full asset URL to convert
386
+ * @returns string
387
+ */
388
+
389
+ function idFromUrl(url) {
390
+ var path = getUrlPath(url);
391
+
392
+ var _path$split = path.split('/'),
393
+ type = _path$split[0],
394
+ fileName = _path$split[3];
395
+
396
+ var prefix = type.replace(/s$/, '');
397
+ return prefix + "-" + fileName.replace(/\./g, '-');
398
+ }
399
+ /**
400
+ * Returns whether or not the passed filename is a valid image asset filename
401
+ *
402
+ * @param filename - Filename to validate
403
+ * @returns Whether or not the filename is an image asset filename
404
+ */
405
+
406
+ function isImageAssetFilename(filename) {
407
+ return imageAssetFilenamePattern.test(filename);
408
+ }
409
+ /**
410
+ * Returns whether or not the passed filename is a valid file asset filename
411
+ *
412
+ * @param filename - Filename to validate
413
+ * @returns Whether or not the filename is a file asset filename
414
+ */
415
+
416
+ function isFileAssetFilename(filename) {
417
+ return fileAssetFilenamePattern.test(filename);
418
+ }
419
+
19
420
  /* eslint-disable camelcase */
20
421
  // Feature query to be used
21
422
  // const featureQuery = `*[_type == 'feature' && is_active == true && feature_url == "/"] | order(_updatedAt asc)[0..5]{
@@ -40,11 +441,18 @@ var Feature = function Feature(props) {
40
441
  return false;
41
442
  };
42
443
 
444
+ var featureImgDimensions = function featureImgDimensions(image) {
445
+ if (image) {
446
+ var dims = getImageDimensions(image);
447
+ return { width: dims.width, height: dims.height };
448
+ }
449
+ };
450
+
43
451
  // image width updated.
44
- var imageWidth = 900;
45
- if (main.main_43) {
46
- imageWidth = 225;
47
- }
452
+ // let imageWidth = 900
453
+ // if (isMobileOnly) {
454
+ // imageWidth = 225
455
+ // }
48
456
 
49
457
  var renderUrl = function renderUrl(feature_link, feature_title, feature_body) {
50
458
  if (checkUrlIsExternal(feature_link)) {
@@ -104,7 +512,8 @@ var Feature = function Feature(props) {
104
512
  hide_title_body = feature.hide_title_body,
105
513
  feature_img = feature.feature_img,
106
514
  feature_alt = feature.feature_alt,
107
- feature_link = feature.feature_link;
515
+ feature_link = feature.feature_link,
516
+ feature_contain = feature.feature_contain;
108
517
 
109
518
  return React__default["default"].createElement(
110
519
  Carousel__default["default"].Item,
@@ -112,9 +521,11 @@ var Feature = function Feature(props) {
112
521
  return openLink(feature_link);
113
522
  } },
114
523
  React__default["default"].createElement('img', {
115
- style: { maxHeight: '375px', minHeight: '300px', objectFit: hide_title_body ? 'unset' : 'cover', cursor: 'pointer', paddingLeft: '50%' },
524
+ style: { maxHeight: '375px', objectFit: feature_contain ? 'contain' : 'cover', cursor: 'pointer' },
116
525
  className: 'd-block w-100',
117
- src: urlFor({ client: client, source: feature_img, imageWidth: imageWidth }),
526
+ src: urlFor({ client: client, source: feature_img, imageWidth: featureImgDimensions(feature_img).width }),
527
+ width: featureImgDimensions(feature_img).width,
528
+ height: featureImgDimensions(feature_img).height,
118
529
  alt: feature_alt
119
530
  }),
120
531
  !hide_title_body && React__default["default"].createElement(