next-cloudinary 2.2.0 → 2.3.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.
@@ -1,472 +0,0 @@
1
- var react = require('react');
2
- var Image = require('next/image');
3
- var util = require('@cloudinary-util/util');
4
- var urlLoader = require('@cloudinary-util/url-loader');
5
- var nextPkg = require('next/package.json');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var Head = require('next/head');
8
- var Script = require('next/script');
9
-
10
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
-
12
- var Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
13
- var nextPkg__default = /*#__PURE__*/_interopDefaultLegacy(nextPkg);
14
- var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
15
- var Script__default = /*#__PURE__*/_interopDefaultLegacy(Script);
16
-
17
- function _extends() {
18
- _extends = Object.assign ? Object.assign.bind() : function (target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = arguments[i];
21
- for (var key in source) {
22
- if (Object.prototype.hasOwnProperty.call(source, key)) {
23
- target[key] = source[key];
24
- }
25
- }
26
- }
27
- return target;
28
- };
29
- return _extends.apply(this, arguments);
30
- }
31
- function _objectWithoutPropertiesLoose(source, excluded) {
32
- if (source == null) return {};
33
- var target = {};
34
- var sourceKeys = Object.keys(source);
35
- var key, i;
36
- for (i = 0; i < sourceKeys.length; i++) {
37
- key = sourceKeys[i];
38
- if (excluded.indexOf(key) >= 0) continue;
39
- target[key] = source[key];
40
- }
41
- return target;
42
- }
43
-
44
- /**
45
- * pollForProcessingImage
46
- */
47
-
48
- function _catch(body, recover) {
49
- try {
50
- var result = body();
51
- } catch (e) {
52
- return recover(e);
53
- }
54
- if (result && result.then) {
55
- return result.then(void 0, recover);
56
- }
57
- return result;
58
- }
59
- var pollForProcessingImage = function pollForProcessingImage(options) {
60
- try {
61
- var _exit2;
62
- var src = options.src;
63
- var _temp4 = _catch(function () {
64
- return Promise.resolve(new Promise(function (resolve, reject) {
65
- fetch(src).then(function (res) {
66
- if (!res.ok) {
67
- reject(res);
68
- return;
69
- }
70
- resolve(res);
71
- });
72
- })).then(function () {});
73
- }, function (e) {
74
- function _temp2(_result2) {
75
- if (_exit2) return _result2;
76
- _exit2 = 1;
77
- return false;
78
- }
79
- var _temp = function () {
80
- if (e.status === 423) {
81
- return Promise.resolve(pollForProcessingImage(options)).then(function (_await$pollForProcess) {
82
- _exit2 = 1;
83
- return _await$pollForProcess;
84
- });
85
- }
86
- }();
87
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
88
- });
89
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function (_result) {
90
- return _exit2 ? _result : true;
91
- }) : _exit2 ? _temp4 : true);
92
- } catch (e) {
93
- return Promise.reject(e);
94
- }
95
- };
96
-
97
- var name = "next-cloudinary";
98
- var version = "2.2.0";
99
- var main = "dist/next-cloudinary.umd.js";
100
- var module$1 = "dist/next-cloudinary.module.js";
101
- var source = "src/index.ts";
102
- var scripts = {
103
- build: "microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
104
- dev: "microbundle watch --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
105
- prepublishOnly: "cp ../README.md . && yarn build",
106
- postpublish: "rm ./README.md",
107
- test: "jest"
108
- };
109
- var dependencies = {
110
- "@cloudinary-util/url-loader": "^1.3.0",
111
- "@cloudinary-util/util": "^1.2.0",
112
- "@cloudinary/url-gen": "^1.8.6"
113
- };
114
- var devDependencies = {
115
- "@babel/core": "^7.19.6",
116
- "@babel/preset-env": "^7.19.4",
117
- "@types/jest": "^29.2.0",
118
- "babel-jest": "^29.2.2",
119
- dotenv: "^16.0.3",
120
- jest: "^29.2.2",
121
- "jest-environment-jsdom": "^29.2.2",
122
- microbundle: "^0.15.1",
123
- "ts-jest": "^29.0.3",
124
- typescript: "^4.9.4"
125
- };
126
- var peerDependencies = {
127
- next: "^12 || ^13",
128
- react: "^17 || ^18"
129
- };
130
- var pkg = {
131
- name: name,
132
- version: version,
133
- main: main,
134
- module: module$1,
135
- "umd:main": "dist/next-cloudinary.umd.js",
136
- source: source,
137
- scripts: scripts,
138
- dependencies: dependencies,
139
- devDependencies: devDependencies,
140
- peerDependencies: peerDependencies
141
- };
142
-
143
- var NEXT_CLOUDINARY_ANALYTICS_ID = 'V';
144
- var NEXT_CLOUDINARY_VERSION = pkg.version;
145
- var NEXT_VERSION = nextPkg__default["default"].version;
146
-
147
- function cloudinaryLoader(_ref) {
148
- var loaderOptions = _ref.loaderOptions,
149
- imageProps = _ref.imageProps,
150
- cldOptions = _ref.cldOptions,
151
- _ref$cldConfig = _ref.cldConfig,
152
- cldConfig = _ref$cldConfig === void 0 ? {} : _ref$cldConfig;
153
- var options = _extends({}, imageProps, cldOptions);
154
- options.width = parseInt(options.width);
155
- options.height = parseInt(options.height);
156
-
157
- // The loader options are used to create dynamic sizing when working with responsive images
158
- // so these should override the default options collected from the props alone if
159
- // the results are different. While we don't always use the height in the loader logic,
160
- // we always pass it here, as the usage is determined later based on cropping.js
161
-
162
- if (loaderOptions != null && loaderOptions.width && loaderOptions.width !== options.width) {
163
- var multiplier = loaderOptions.width / options.width;
164
- options.widthResize = loaderOptions.width;
165
- options.heightResize = Math.round(options.height * multiplier);
166
- }
167
- return urlLoader.constructCloudinaryUrl({
168
- options: options,
169
- config: _extends({
170
- cloud: {
171
- cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
172
- }
173
- }, cldConfig),
174
- analytics: {
175
- sdkCode: NEXT_CLOUDINARY_ANALYTICS_ID,
176
- sdkSemver: NEXT_CLOUDINARY_VERSION,
177
- techVersion: NEXT_VERSION,
178
- feature: ''
179
- }
180
- });
181
- }
182
-
183
- var CldImage = function CldImage(props) {
184
- /**
185
- * handleOnError
186
- */
187
- var handleOnError = function handleOnError(options) {
188
- try {
189
- return Promise.resolve(pollForProcessingImage({
190
- src: options.target.src
191
- })).then(function (result) {
192
- if (result) {
193
- setImgKey(defaultImgKey + ";" + Date.now());
194
- }
195
- });
196
- } catch (e) {
197
- return Promise.reject(e);
198
- }
199
- };
200
- var CLD_OPTIONS = ['deliveryType', 'preserveTransformations'];
201
- urlLoader.transformationPlugins.forEach(function (_ref) {
202
- var _ref$props = _ref.props,
203
- props = _ref$props === void 0 ? [] : _ref$props;
204
- props.forEach(function (prop) {
205
- if (CLD_OPTIONS.includes(prop)) {
206
- throw new Error("Option " + prop + " already exists!");
207
- }
208
- CLD_OPTIONS.push(prop);
209
- });
210
- });
211
- var imageProps = {
212
- alt: props.alt,
213
- src: props.src
214
- };
215
- Object.keys(props).filter(function (key) {
216
- return !CLD_OPTIONS.includes(key);
217
- }).forEach(function (key) {
218
- return imageProps[key] = props[key];
219
- });
220
- var defaultImgKey = Object.keys(imageProps).map(function (key) {
221
- return key + ":" + imageProps[key];
222
- }).join(';');
223
- var _useState = react.useState(defaultImgKey),
224
- imgKey = _useState[0],
225
- setImgKey = _useState[1];
226
- var cldOptions = {};
227
- CLD_OPTIONS.forEach(function (key) {
228
- if (props[key]) {
229
- cldOptions[key] = props[key] || undefined;
230
- }
231
- });
232
- // Try to preserve the original transformations from the Cloudinary URL passed in
233
- // to the component. This only works if the URL has a version number on it and otherwise
234
- // will fail to load
235
- if (props.preserveTransformations) {
236
- try {
237
- var transformations = util.getTransformations(props.src);
238
- cldOptions.rawTransformations = [].concat(transformations.flat(), props.rawTransformations || []);
239
- } catch (e) {
240
- console.warn("Failed to preserve transformations: " + e.message);
241
- }
242
- }
243
- return /*#__PURE__*/jsxRuntime.jsx(Image__default["default"], _extends({}, imageProps, {
244
- loader: function loader(loaderOptions) {
245
- return cloudinaryLoader({
246
- loaderOptions: loaderOptions,
247
- imageProps: imageProps,
248
- cldOptions: cldOptions
249
- });
250
- },
251
- onError: handleOnError
252
- }), imgKey);
253
- };
254
-
255
- var _excluded$1 = ["excludeTags", "twitterTitle"];
256
- var IMAGE_WIDTH = 2400;
257
- var IMAGE_HEIGHT = 1200;
258
- var TWITTER_CARD = 'summary_large_image';
259
- var CldOgImage = function CldOgImage(_ref) {
260
- var _ref$excludeTags = _ref.excludeTags,
261
- excludeTags = _ref$excludeTags === void 0 ? [] : _ref$excludeTags,
262
- twitterTitle = _ref.twitterTitle,
263
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
264
- var options = _extends({}, props, {
265
- alt: props.alt,
266
- crop: props.crop || 'fill',
267
- gravity: props.gravity || 'center',
268
- height: props.height || IMAGE_HEIGHT,
269
- src: props.src,
270
- width: props.width || IMAGE_WIDTH
271
- });
272
- var ogImageUrl = urlLoader.constructCloudinaryUrl({
273
- options: options,
274
- config: {
275
- cloud: {
276
- cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
277
- }
278
- },
279
- analytics: {
280
- sdkCode: NEXT_CLOUDINARY_ANALYTICS_ID,
281
- sdkSemver: NEXT_CLOUDINARY_VERSION,
282
- techVersion: NEXT_VERSION,
283
- feature: ''
284
- }
285
- });
286
- // We need to include the tags within the Next.js Head component rather than
287
- // direcly adding them inside of the Head otherwise we get unexpected results
288
- return (
289
- /*#__PURE__*/
290
- // @ts-ignore
291
- jsxRuntime.jsxs(Head__default["default"], {
292
- children: [/*#__PURE__*/jsxRuntime.jsx("meta", {
293
- property: "og:image",
294
- content: ogImageUrl
295
- }), /*#__PURE__*/jsxRuntime.jsx("meta", {
296
- property: "og:image:secure_url",
297
- content: ogImageUrl
298
- }), /*#__PURE__*/jsxRuntime.jsx("meta", {
299
- property: "og:image:width",
300
- content: options.width
301
- }), /*#__PURE__*/jsxRuntime.jsx("meta", {
302
- property: "og:image:height",
303
- content: options.height
304
- }), options.alt && /*#__PURE__*/jsxRuntime.jsx("meta", {
305
- property: "og:image:alt",
306
- content: options.alt
307
- }), !excludeTags.includes('twitter:title') && /*#__PURE__*/jsxRuntime.jsx("meta", {
308
- property: "twitter:title",
309
- content: twitterTitle || ' '
310
- }), /*#__PURE__*/jsxRuntime.jsx("meta", {
311
- property: "twitter:card",
312
- content: TWITTER_CARD
313
- }), /*#__PURE__*/jsxRuntime.jsx("meta", {
314
- property: "twitter:image",
315
- content: ogImageUrl
316
- })]
317
- })
318
- );
319
- };
320
-
321
- /**
322
- * triggerOnIdle
323
- * @see MDN Polyfill https://github.com/behnammodi/polyfill/blob/master/window.polyfill.js#L7-L24
324
- */
325
- function triggerOnIdle(callback) {
326
- if (window && 'requestIdleCallback' in window) {
327
- return requestIdleCallback(callback);
328
- }
329
- return setTimeout(function () {
330
- return callback();
331
- }, 1);
332
- }
333
-
334
- var cloudinary;
335
- var widget;
336
- var CldUploadWidget = function CldUploadWidget(_ref) {
337
- var children = _ref.children,
338
- onUpload = _ref.onUpload,
339
- options = _ref.options,
340
- signatureEndpoint = _ref.signatureEndpoint,
341
- uploadPreset = _ref.uploadPreset;
342
- var signed = !!signatureEndpoint;
343
- /**
344
- * handleOnLoad
345
- * @description Stores the Cloudinary window instance to a ref when the widget script loads
346
- */
347
- function handleOnLoad() {
348
- if (!cloudinary) {
349
- cloudinary = window.cloudinary;
350
- }
351
- // To help improve load time of the widget on first instance, use requestIdleCallback
352
- // to trigger widget creation. Optional.
353
- triggerOnIdle(function () {
354
- if (!widget) {
355
- widget = createWidget();
356
- }
357
- });
358
- }
359
- /**
360
- * generateSignature
361
- * @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation
362
- */
363
- function generateSignature(callback, paramsToSign) {
364
- fetch(signatureEndpoint, {
365
- method: 'POST',
366
- body: JSON.stringify({
367
- paramsToSign: paramsToSign
368
- })
369
- }).then(function (r) {
370
- return r.json();
371
- }).then(function (_ref2) {
372
- var signature = _ref2.signature;
373
- callback(signature);
374
- });
375
- }
376
- /**
377
- * createWidget
378
- * @description Creates a new instance of the Cloudinary widget and stores in a ref
379
- */
380
- function createWidget() {
381
- var _cloudinary;
382
- // When creating a signed upload, you need to provide both your Cloudinary API Key
383
- // as well as a signature generator function that will sign any paramters
384
- // either on page load or during the upload process. Read more about signed uploads at:
385
- // https://cloudinary.com/documentation/upload_widget#signed_uploads
386
- var uploadOptions = _extends({
387
- cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
388
- uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,
389
- apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY
390
- }, options);
391
- if (signed) {
392
- uploadOptions.uploadSignature = generateSignature;
393
- // No need for apiSecret here because of api/sign-cloudinary-params
394
- if (!uploadOptions.apiKey) {
395
- return new Error("Signed Upload needs apiKey!");
396
- }
397
- }
398
- return (_cloudinary = cloudinary) == null ? void 0 : _cloudinary.createUploadWidget(uploadOptions, function (error, result) {
399
- // The callback is a bit more chatty than failed or success so
400
- // only trigger when one of those are the case. You can additionally
401
- // create a separate handler such as onEvent and trigger it on
402
- // ever occurrence
403
- if (error || result.event === "success") {
404
- onUpload(error, result, widget);
405
- }
406
- });
407
- }
408
- /**
409
- * open
410
- * @description When triggered, uses the current widget instance to open the upload modal
411
- */
412
- function open() {
413
- if (!widget) {
414
- widget = createWidget();
415
- }
416
- widget && widget.open();
417
- }
418
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
419
- children: [children({
420
- cloudinary: cloudinary,
421
- widget: widget,
422
- open: open
423
- }), /*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
424
- id: "cloudinary-" + Math.floor(Math.random() * 100),
425
- src: "https://widget.cloudinary.com/v2.0/global/all.js",
426
- onLoad: handleOnLoad,
427
- onError: function onError(e) {
428
- return console.error("Failed to load Cloudinary: " + e.message);
429
- }
430
- })]
431
- });
432
- };
433
-
434
- var _excluded = ["children", "onClick", "onUpload", "options", "signatureEndpoint", "uploadPreset"];
435
- var CldUploadButton = function CldUploadButton(_ref) {
436
- var _children = _ref.children,
437
- onClick = _ref.onClick,
438
- onUpload = _ref.onUpload,
439
- options = _ref.options,
440
- signatureEndpoint = _ref.signatureEndpoint,
441
- uploadPreset = _ref.uploadPreset,
442
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
443
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
444
- children: /*#__PURE__*/jsxRuntime.jsx(CldUploadWidget, {
445
- onUpload: onUpload,
446
- options: options,
447
- signatureEndpoint: signatureEndpoint,
448
- uploadPreset: uploadPreset,
449
- children: function children(_ref2) {
450
- var open = _ref2.open;
451
- function handleOnClick(e) {
452
- e.preventDefault();
453
- open();
454
- if (typeof onClick === 'function') {
455
- onClick(e);
456
- }
457
- }
458
- return /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, props, {
459
- onClick: handleOnClick,
460
- children: _children || 'Upload'
461
- }));
462
- }
463
- })
464
- });
465
- };
466
-
467
- exports.CldImage = CldImage;
468
- exports.CldOgImage = CldOgImage;
469
- exports.CldUploadButton = CldUploadButton;
470
- exports.CldUploadWidget = CldUploadWidget;
471
- exports.cloudinaryLoader = cloudinaryLoader;
472
- //# sourceMappingURL=next-cloudinary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-cloudinary.js","sources":["../src/lib/cloudinary.ts","../src/constants/analytics.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.tsx","../src/components/CldOgImage/CldOgImage.tsx","../src/lib/util.ts","../src/components/CldUploadWidget/CldUploadWidget.tsx","../src/components/CldUploadButton/CldUploadButton.tsx"],"sourcesContent":["/**\n * pollForProcessingImage\n */\n\nexport async function pollForProcessingImage(options): Promise<boolean> {\n const { src } = options;\n try {\n await new Promise((resolve, reject) => {\n fetch(src).then(res => {\n if ( !res.ok ) {\n reject(res);\n return;\n }\n resolve(res);\n });\n });\n } catch(e: any) {\n if ( e.status === 423 ) {\n return await pollForProcessingImage(options);\n }\n return false;\n }\n return true;\n}","import nextPkg from 'next/package.json';\nimport pkg from '../../package.json';\n\nexport const NEXT_CLOUDINARY_ANALYTICS_ID = 'V';\nexport const NEXT_CLOUDINARY_VERSION = pkg.version;\nexport const NEXT_VERSION = nextPkg.version;","import { constructCloudinaryUrl } from '@cloudinary-util/url-loader';\n\nimport { NEXT_CLOUDINARY_ANALYTICS_ID, NEXT_CLOUDINARY_VERSION, NEXT_VERSION } from '../constants/analytics';\n\nexport function cloudinaryLoader({ loaderOptions, imageProps, cldOptions, cldConfig = {} }) {\n const options = {\n ...imageProps,\n ...cldOptions\n }\n\n options.width = parseInt(options.width);\n options.height = parseInt(options.height);\n\n // The loader options are used to create dynamic sizing when working with responsive images\n // so these should override the default options collected from the props alone if\n // the results are different. While we don't always use the height in the loader logic,\n // we always pass it here, as the usage is determined later based on cropping.js\n\n if ( loaderOptions?.width && loaderOptions.width !== options.width ) {\n const multiplier = loaderOptions.width / options.width;\n options.widthResize = loaderOptions.width;\n options.heightResize = Math.round(options.height * multiplier);\n }\n\n return constructCloudinaryUrl({\n options,\n config: {\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n ...cldConfig\n },\n analytics: {\n sdkCode: NEXT_CLOUDINARY_ANALYTICS_ID,\n sdkSemver: NEXT_CLOUDINARY_VERSION,\n techVersion: NEXT_VERSION,\n feature: ''\n }\n });\n}","'use client';\n\nimport { useState } from 'react';\nimport Image from 'next/image';\nimport { getTransformations } from '@cloudinary-util/util';\nimport { transformationPlugins } from '@cloudinary-util/url-loader';\n\nimport { pollForProcessingImage } from '../../lib/cloudinary';\n\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n const CLD_OPTIONS = [\n 'deliveryType',\n 'preserveTransformations'\n ];\n\n transformationPlugins.forEach(({ props = [] }) => {\n props.forEach(prop => {\n if ( CLD_OPTIONS.includes(prop) ) {\n throw new Error(`Option ${prop} already exists!`);\n }\n CLD_OPTIONS.push(prop);\n });\n })\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n interface ImageProps {\n alt: string;\n blurDataURL?: string;\n src: string;\n }\n\n const imageProps: ImageProps = {\n alt: props.alt,\n src: props.src\n };\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n const defaultImgKey = Object.keys(imageProps).map(key => `${key}:${imageProps[key]}`).join(';');\n const [imgKey, setImgKey] = useState(defaultImgKey);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n interface CldOptions {\n rawTransformations?: string[];\n }\n\n const cldOptions: CldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key] || undefined;\n }\n });\n\n // Try to preserve the original transformations from the Cloudinary URL passed in\n // to the component. This only works if the URL has a version number on it and otherwise\n // will fail to load\n\n if (props.preserveTransformations) {\n try {\n const transformations = getTransformations(props.src);\n cldOptions.rawTransformations = [...transformations.flat(), ...(props.rawTransformations || [])];\n } catch(e) {\n console.warn(`Failed to preserve transformations: ${(e as Error).message}`)\n }\n }\n\n /**\n * handleOnError\n */\n\n async function handleOnError(options) {\n const result = await pollForProcessingImage({ src: options.target.src })\n if ( result ) {\n setImgKey(`${defaultImgKey};${Date.now()}`);\n }\n }\n\n return (\n <Image\n key={imgKey}\n {...imageProps}\n loader={(loaderOptions) => cloudinaryLoader({ loaderOptions, imageProps, cldOptions })}\n onError={handleOnError}\n />\n );\n}\n\nexport default CldImage;\n","import Head from 'next/head';\nimport { constructCloudinaryUrl } from '@cloudinary-util/url-loader';\n\nimport { NEXT_CLOUDINARY_ANALYTICS_ID, NEXT_CLOUDINARY_VERSION, NEXT_VERSION } from '../../constants/analytics';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [] as string[], twitterTitle, ...props }) => {\n const options = {\n ...props,\n alt: props.alt,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center',\n height: props.height || IMAGE_HEIGHT,\n src: props.src,\n width: props.width || IMAGE_WIDTH,\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options,\n config: {\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n }\n },\n analytics: {\n sdkCode: NEXT_CLOUDINARY_ANALYTICS_ID,\n sdkSemver: NEXT_CLOUDINARY_VERSION,\n techVersion: NEXT_VERSION,\n feature: ''\n }\n });\n\n // We need to include the tags within the Next.js Head component rather than\n // direcly adding them inside of the Head otherwise we get unexpected results\n\n return (\n // @ts-ignore\n <Head>\n <meta property=\"og:image\" content={ogImageUrl} />\n <meta property=\"og:image:secure_url\" content={ogImageUrl} />\n <meta property=\"og:image:width\" content={options.width} />\n <meta property=\"og:image:height\" content={options.height} />\n\n {options.alt && (\n <meta property=\"og:image:alt\" content={options.alt} />\n )}\n\n {/* Required for summary_large_image, exclude vai excludeTags */}\n {/* https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image */}\n\n {!excludeTags.includes('twitter:title') && (\n <meta property=\"twitter:title\" content={twitterTitle || ' '} />\n )}\n\n <meta property=\"twitter:card\" content={TWITTER_CARD} />\n <meta property=\"twitter:image\" content={ogImageUrl} />\n </Head>\n );\n}\n\nexport default CldOgImage;","/**\n * triggerOnIdle\n * @see MDN Polyfill https://github.com/behnammodi/polyfill/blob/master/window.polyfill.js#L7-L24\n */\n\nexport function triggerOnIdle(callback: any) {\n if ( window && 'requestIdleCallback' in window ) {\n return requestIdleCallback(callback);\n }\n return setTimeout(() => callback(), 1);\n}","import Script from 'next/script';\n\nimport { triggerOnIdle } from '../../lib/util';\n\nlet cloudinary;\nlet widget;\n\nconst CldUploadWidget = ({\n children,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n}) => {\n const signed = !!signatureEndpoint;\n\n /**\n * handleOnLoad\n * @description Stores the Cloudinary window instance to a ref when the widget script loads\n */\n\n function handleOnLoad() {\n if ( !cloudinary ) {\n cloudinary = (window as any).cloudinary;\n }\n\n // To help improve load time of the widget on first instance, use requestIdleCallback\n // to trigger widget creation. Optional.\n\n triggerOnIdle(() => {\n if ( !widget ) {\n widget = createWidget();\n }\n });\n }\n\n /**\n * generateSignature\n * @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation\n */\n\n function generateSignature(callback, paramsToSign) {\n fetch(signatureEndpoint, {\n method: 'POST',\n body: JSON.stringify({\n paramsToSign,\n }),\n })\n .then((r) => r.json())\n .then(({ signature }) => {\n callback(signature);\n });\n }\n\n /**\n * createWidget\n * @description Creates a new instance of the Cloudinary widget and stores in a ref\n */\n\n function createWidget() {\n // When creating a signed upload, you need to provide both your Cloudinary API Key\n // as well as a signature generator function that will sign any paramters\n // either on page load or during the upload process. Read more about signed uploads at:\n // https://cloudinary.com/documentation/upload_widget#signed_uploads\n\n const uploadOptions = {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,\n uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,\n apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY,\n ...options,\n };\n\n if ( signed ) {\n uploadOptions.uploadSignature = generateSignature;\n\n // No need for apiSecret here because of api/sign-cloudinary-params\n\n if (!uploadOptions.apiKey) {\n return new Error(\"Signed Upload needs apiKey!\");\n }\n }\n\n return cloudinary?.createUploadWidget(\n uploadOptions,\n function (error, result) {\n // The callback is a bit more chatty than failed or success so\n // only trigger when one of those are the case. You can additionally\n // create a separate handler such as onEvent and trigger it on\n // ever occurrence\n if (error || result.event === \"success\") {\n onUpload(error, result, widget);\n }\n }\n );\n }\n\n /**\n * open\n * @description When triggered, uses the current widget instance to open the upload modal\n */\n\n function open() {\n if (!widget) {\n widget = createWidget();\n }\n widget && widget.open();\n }\n\n return (\n <>\n {children({\n cloudinary,\n widget,\n open,\n })}\n <Script\n id={`cloudinary-${Math.floor(Math.random() * 100)}`}\n src=\"https://widget.cloudinary.com/v2.0/global/all.js\"\n onLoad={handleOnLoad}\n onError={(e) => console.error(`Failed to load Cloudinary: ${e.message}`)}\n />\n </>\n );\n};\n\nexport default CldUploadWidget;\n","import CldUploadWidget from '../CldUploadWidget';\n\nconst CldUploadButton = ({\n children,\n onClick,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n ...props\n}) => {\n return (\n <>\n {/* @ts-ignore */}\n <CldUploadWidget\n onUpload={onUpload}\n options={options}\n signatureEndpoint={signatureEndpoint}\n uploadPreset={uploadPreset}\n >\n {({ open }) => {\n function handleOnClick(e) {\n e.preventDefault();\n\n open();\n\n if ( typeof onClick === 'function' ) {\n onClick(e);\n }\n }\n return (\n <button {...props} onClick={handleOnClick} >\n {children || 'Upload'}\n </button>\n );\n }}\n </CldUploadWidget>\n </>\n );\n};\n\nexport default CldUploadButton;\n"],"names":["pollForProcessingImage","options","src","Promise","resolve","reject","fetch","then","res","ok","e","status","NEXT_CLOUDINARY_ANALYTICS_ID","NEXT_CLOUDINARY_VERSION","pkg","version","NEXT_VERSION","nextPkg","cloudinaryLoader","loaderOptions","imageProps","cldOptions","cldConfig","width","parseInt","height","multiplier","widthResize","heightResize","Math","round","constructCloudinaryUrl","config","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","analytics","sdkCode","sdkSemver","techVersion","feature","CldImage","props","handleOnError","target","result","setImgKey","defaultImgKey","Date","now","CLD_OPTIONS","transformationPlugins","forEach","prop","includes","Error","push","alt","Object","keys","filter","key","map","join","useState","imgKey","undefined","preserveTransformations","transformations","getTransformations","rawTransformations","flat","console","warn","message","_jsx","Image","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","_excluded","crop","gravity","ogImageUrl","_jsxs","Head","triggerOnIdle","callback","window","requestIdleCallback","setTimeout","cloudinary","widget","CldUploadWidget","children","onUpload","signatureEndpoint","uploadPreset","signed","handleOnLoad","createWidget","generateSignature","paramsToSign","method","body","JSON","stringify","r","json","signature","uploadOptions","NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET","apiKey","NEXT_PUBLIC_CLOUDINARY_API_KEY","uploadSignature","createUploadWidget","error","event","open","_Fragment","Script","floor","random","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEG;;;;;;;;;;;;;AAEH,IAAsBA,sBAAsB,GAAA,SAAtBA,sBAAsB,CAACC,OAAO,EAAA;EAAA,IAAA;AAAA,IAAA,IAAA,MAAA,CAAA;AAClD,IAAA,IAAQC,GAAG,GAAKD,OAAO,CAAfC,GAAG,CAAA;IAAa,IACpB,MAAA,GAAA,MAAA,CAAA,YAAA;AAAA,MAAA,OAAA,OAAA,CAAA,OAAA,CACI,IAAIC,OAAO,CAAC,UAACC,OAAO,EAAEC,MAAM,EAAI;QACpCC,KAAK,CAACJ,GAAG,CAAC,CAACK,IAAI,CAAC,UAAAC,GAAG,EAAG;AACpB,UAAA,IAAK,CAACA,GAAG,CAACC,EAAE,EAAG;YACbJ,MAAM,CAACG,GAAG,CAAC,CAAA;AACX,YAAA,OAAA;AACD,WAAA;UACDJ,OAAO,CAACI,GAAG,CAAC,CAAA;AACd,SAAC,CAAC,CAAA;AACJ,OAAC,CAAC,CAAA,CAAA,IAAA,CAAA,YAAA,EAAA,CAAA,CAAA;KACH,EAAA,UAAOE,CAAM,EAAE;AAAA,MAAA,SAAA,MAAA,CAAA,QAAA,EAAA;AAAA,QAAA,IAAA,MAAA,EAAA,OAAA,QAAA,CAAA;AAAA,QAAA,MAAA,GAAA,CAAA,CAAA;AAAA,QAAA,OAIP,KAAK,CAAA;AAAA,OAAA;AAAA,MAAA,IAAA,KAAA,GAAA,YAAA;AAAA,QAAA,IAHPA,CAAC,CAACC,MAAM,KAAK,GAAG,EAAA;UAAA,OACNX,OAAAA,CAAAA,OAAAA,CAAAA,sBAAsB,CAACC,OAAO,CAAC,CAAA,CAAA,IAAA,CAAA,UAAA,qBAAA,EAAA;AAAA,YAAA,MAAA,GAAA,CAAA,CAAA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