next-cloudinary 2.0.1 → 2.1.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/next-cloudinary.js +91 -136
- package/dist/next-cloudinary.js.map +1 -1
- package/dist/next-cloudinary.modern.mjs +68 -114
- package/dist/next-cloudinary.modern.mjs.map +1 -1
- package/dist/next-cloudinary.module.js +93 -138
- package/dist/next-cloudinary.module.js.map +1 -1
- package/dist/next-cloudinary.umd.js +91 -136
- package/dist/next-cloudinary.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useState
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import Image from 'next/image';
|
|
3
|
-
import {
|
|
3
|
+
import { getTransformations } from '@cloudinary-util/util';
|
|
4
4
|
import { constructCloudinaryUrl, transformationPlugins } from '@cloudinary-util/url-loader';
|
|
5
5
|
import nextPkg from 'next/package.json';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -34,8 +34,34 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
34
34
|
return target;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* pollForProcessingImage
|
|
39
|
+
*/
|
|
40
|
+
async function pollForProcessingImage(options) {
|
|
41
|
+
const {
|
|
42
|
+
src
|
|
43
|
+
} = options;
|
|
44
|
+
try {
|
|
45
|
+
await new Promise((resolve, reject) => {
|
|
46
|
+
fetch(src).then(res => {
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
reject(res);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
resolve(res);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
} catch (e) {
|
|
55
|
+
if (e.status === 423) {
|
|
56
|
+
return await pollForProcessingImage(options);
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
37
63
|
var name = "next-cloudinary";
|
|
38
|
-
var version = "2.
|
|
64
|
+
var version = "2.1.1";
|
|
39
65
|
var main = "dist/next-cloudinary.umd.js";
|
|
40
66
|
var module = "dist/next-cloudinary.module.js";
|
|
41
67
|
var source = "src/index.ts";
|
|
@@ -84,68 +110,6 @@ const NEXT_CLOUDINARY_ANALYTICS_ID = 'V';
|
|
|
84
110
|
const NEXT_CLOUDINARY_VERSION = pkg.version;
|
|
85
111
|
const NEXT_VERSION = nextPkg.version;
|
|
86
112
|
|
|
87
|
-
/**
|
|
88
|
-
* createPlaceholderUrl
|
|
89
|
-
*/
|
|
90
|
-
function createPlaceholderUrl({
|
|
91
|
-
src,
|
|
92
|
-
placeholder = true
|
|
93
|
-
}) {
|
|
94
|
-
const rawTransformations = [];
|
|
95
|
-
if (placeholder === 'grayscale') {
|
|
96
|
-
rawTransformations.push('e_grayscale');
|
|
97
|
-
}
|
|
98
|
-
if (typeof placeholder === 'string' && placeholder.includes('color:')) {
|
|
99
|
-
const color = placeholder.split(':').splice(1).join(':');
|
|
100
|
-
rawTransformations.push('e_grayscale');
|
|
101
|
-
rawTransformations.push(`e_colorize:60,co_${color}`);
|
|
102
|
-
}
|
|
103
|
-
return constructCloudinaryUrl({
|
|
104
|
-
options: {
|
|
105
|
-
src,
|
|
106
|
-
width: 100,
|
|
107
|
-
quality: 1,
|
|
108
|
-
rawTransformations
|
|
109
|
-
},
|
|
110
|
-
config: {
|
|
111
|
-
cloud: {
|
|
112
|
-
cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
analytics: {
|
|
116
|
-
sdkCode: NEXT_CLOUDINARY_ANALYTICS_ID,
|
|
117
|
-
sdkSemver: NEXT_CLOUDINARY_VERSION,
|
|
118
|
-
techVersion: NEXT_VERSION,
|
|
119
|
-
feature: ''
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* pollForProcessingImage
|
|
125
|
-
*/
|
|
126
|
-
async function pollForProcessingImage(options) {
|
|
127
|
-
const {
|
|
128
|
-
src
|
|
129
|
-
} = options;
|
|
130
|
-
try {
|
|
131
|
-
await new Promise((resolve, reject) => {
|
|
132
|
-
fetch(src).then(res => {
|
|
133
|
-
if (!res.ok) {
|
|
134
|
-
reject(res);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
resolve(res);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
} catch (e) {
|
|
141
|
-
if (e.status === 423) {
|
|
142
|
-
return await pollForProcessingImage(options);
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
113
|
function cloudinaryLoader({
|
|
150
114
|
loaderOptions,
|
|
151
115
|
imageProps,
|
|
@@ -207,32 +171,6 @@ const CldImage = props => {
|
|
|
207
171
|
cldOptions[key] = props[key] || undefined;
|
|
208
172
|
}
|
|
209
173
|
});
|
|
210
|
-
// If we see a placeholder option, configure a Cloudinary-based URL.
|
|
211
|
-
// The resulting image will always be blurred per Next.js, so we're
|
|
212
|
-
// limited on options for placeholders.
|
|
213
|
-
//
|
|
214
|
-
// We need to do this logic here as we potentially need to mutate
|
|
215
|
-
// an Image component prop as opposed to simply the URL
|
|
216
|
-
//
|
|
217
|
-
// https://nextjs.org/docs/api-reference/next/image#blurdataurl
|
|
218
|
-
if (imageProps.placeholder) {
|
|
219
|
-
let publicId;
|
|
220
|
-
if (props.src.startsWith('https://')) {
|
|
221
|
-
try {
|
|
222
|
-
publicId = getPublicId(props.src);
|
|
223
|
-
} catch (e) {}
|
|
224
|
-
}
|
|
225
|
-
if (!publicId) {
|
|
226
|
-
publicId = props.src;
|
|
227
|
-
}
|
|
228
|
-
imageProps.blurDataURL = createPlaceholderUrl({
|
|
229
|
-
src: publicId,
|
|
230
|
-
placeholder: props.placeholder
|
|
231
|
-
});
|
|
232
|
-
if (imageProps.placeholder !== 'blur') {
|
|
233
|
-
imageProps.placeholder = 'blur';
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
174
|
// Try to preserve the original transformations from the Cloudinary URL passed in
|
|
237
175
|
// to the component. This only works if the URL has a version number on it and otherwise
|
|
238
176
|
// will fail to load
|
|
@@ -332,6 +270,19 @@ const CldOgImage = _ref => {
|
|
|
332
270
|
);
|
|
333
271
|
};
|
|
334
272
|
|
|
273
|
+
/**
|
|
274
|
+
* triggerOnIdle
|
|
275
|
+
* @see MDN Polyfill https://github.com/behnammodi/polyfill/blob/master/window.polyfill.js#L7-L24
|
|
276
|
+
*/
|
|
277
|
+
function triggerOnIdle(callback) {
|
|
278
|
+
if (window && 'requestIdleCallback' in window) {
|
|
279
|
+
return requestIdleCallback(callback);
|
|
280
|
+
}
|
|
281
|
+
return setTimeout(() => callback(), 1);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
let cloudinary;
|
|
285
|
+
let widget;
|
|
335
286
|
const CldUploadWidget = ({
|
|
336
287
|
children,
|
|
337
288
|
onUpload,
|
|
@@ -339,16 +290,30 @@ const CldUploadWidget = ({
|
|
|
339
290
|
signatureEndpoint,
|
|
340
291
|
uploadPreset
|
|
341
292
|
}) => {
|
|
342
|
-
const cloudinary = useRef();
|
|
343
|
-
const widget = useRef();
|
|
344
293
|
const signed = !!signatureEndpoint;
|
|
294
|
+
/**
|
|
295
|
+
* handleOnLoad
|
|
296
|
+
* @description Stores the Cloudinary window instance to a ref when the widget script loads
|
|
297
|
+
*/
|
|
298
|
+
function handleOnLoad() {
|
|
299
|
+
if (!cloudinary) {
|
|
300
|
+
cloudinary = window.cloudinary;
|
|
301
|
+
}
|
|
302
|
+
// To help improve load time of the widget on first instance, use requestIdleCallback
|
|
303
|
+
// to trigger widget creation. Optional.
|
|
304
|
+
triggerOnIdle(() => {
|
|
305
|
+
if (!widget) {
|
|
306
|
+
widget = createWidget();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
345
310
|
/**
|
|
346
311
|
* generateSignature
|
|
347
312
|
* @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation
|
|
348
313
|
*/
|
|
349
314
|
function generateSignature(callback, paramsToSign) {
|
|
350
315
|
fetch(signatureEndpoint, {
|
|
351
|
-
method:
|
|
316
|
+
method: 'POST',
|
|
352
317
|
body: JSON.stringify({
|
|
353
318
|
paramsToSign
|
|
354
319
|
})
|
|
@@ -363,7 +328,7 @@ const CldUploadWidget = ({
|
|
|
363
328
|
* @description Creates a new instance of the Cloudinary widget and stores in a ref
|
|
364
329
|
*/
|
|
365
330
|
function createWidget() {
|
|
366
|
-
var _cloudinary
|
|
331
|
+
var _cloudinary;
|
|
367
332
|
// When creating a signed upload, you need to provide both your Cloudinary API Key
|
|
368
333
|
// as well as a signature generator function that will sign any paramters
|
|
369
334
|
// either on page load or during the upload process. Read more about signed uploads at:
|
|
@@ -380,13 +345,13 @@ const CldUploadWidget = ({
|
|
|
380
345
|
return new Error("Signed Upload needs apiKey!");
|
|
381
346
|
}
|
|
382
347
|
}
|
|
383
|
-
return (_cloudinary
|
|
348
|
+
return (_cloudinary = cloudinary) == null ? void 0 : _cloudinary.createUploadWidget(uploadOptions, function (error, result) {
|
|
384
349
|
// The callback is a bit more chatty than failed or success so
|
|
385
350
|
// only trigger when one of those are the case. You can additionally
|
|
386
351
|
// create a separate handler such as onEvent and trigger it on
|
|
387
352
|
// ever occurrence
|
|
388
353
|
if (error || result.event === "success") {
|
|
389
|
-
onUpload(error, result, widget
|
|
354
|
+
onUpload(error, result, widget);
|
|
390
355
|
}
|
|
391
356
|
});
|
|
392
357
|
}
|
|
@@ -395,29 +360,18 @@ const CldUploadWidget = ({
|
|
|
395
360
|
* @description When triggered, uses the current widget instance to open the upload modal
|
|
396
361
|
*/
|
|
397
362
|
function open() {
|
|
398
|
-
if (!
|
|
399
|
-
widget
|
|
363
|
+
if (!widget) {
|
|
364
|
+
widget = createWidget();
|
|
400
365
|
}
|
|
401
|
-
|
|
402
|
-
(widget == null ? void 0 : widget.current) && widget.current.open();
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* handleOnLoad
|
|
406
|
-
* @description Stores the Cloudinary window instance to a ref when the widget script loads
|
|
407
|
-
*/
|
|
408
|
-
function handleOnLoad() {
|
|
409
|
-
// @ts-ignore
|
|
410
|
-
cloudinary.current = window.cloudinary;
|
|
366
|
+
widget && widget.open();
|
|
411
367
|
}
|
|
412
368
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
413
369
|
children: [children({
|
|
414
|
-
cloudinary
|
|
415
|
-
widget
|
|
370
|
+
cloudinary,
|
|
371
|
+
widget,
|
|
416
372
|
open
|
|
417
373
|
}), /*#__PURE__*/jsx(Script, {
|
|
418
|
-
id: `cloudinary-${Math.floor(Math.random() * 100)}
|
|
419
|
-
// @ts-ignore
|
|
420
|
-
,
|
|
374
|
+
id: `cloudinary-${Math.floor(Math.random() * 100)}`,
|
|
421
375
|
src: "https://widget.cloudinary.com/v2.0/global/all.js",
|
|
422
376
|
onLoad: handleOnLoad,
|
|
423
377
|
onError: e => console.error(`Failed to load Cloudinary: ${e.message}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-cloudinary.modern.mjs","sources":["../src/constants/analytics.js","../src/lib/cloudinary.ts","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.tsx","../src/components/CldOgImage/CldOgImage.tsx","../src/components/CldUploadWidget/CldUploadWidget.tsx","../src/components/CldUploadButton/CldUploadButton.tsx"],"sourcesContent":["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\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true }: { src?: any, placeholder?: boolean | string, config?: any }) {\n const rawTransformations: string[] = [];\n\n if ( placeholder === 'grayscale' ) {\n rawTransformations.push('e_grayscale');\n }\n\n if ( typeof placeholder === 'string' && placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n rawTransformations.push('e_grayscale');\n rawTransformations.push(`e_colorize:60,co_${color}`);\n }\n\n return constructCloudinaryUrl({\n options: {\n src,\n width: 100,\n quality: 1,\n rawTransformations,\n },\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\n/**\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 { 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, getPublicId } from '@cloudinary-util/util';\nimport { transformationPlugins } from '@cloudinary-util/url-loader';\n\nimport { createPlaceholderUrl, 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 placeholder?: 'blur' | 'empty'; // this is from next/image, but isn't exported\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 // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n let publicId;\n\n if ( props.src.startsWith('https://') ) {\n try {\n publicId = getPublicId(props.src);\n } catch(e) {}\n }\n\n if ( !publicId ) {\n publicId = props.src;\n }\n\n imageProps.blurDataURL = createPlaceholderUrl({\n src: publicId,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\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;","import { useRef } from 'react';\nimport Script from 'next/script';\n\nconst CldUploadWidget = ({\n children,\n onUpload,\n options,\n signatureEndpoint,\n uploadPreset,\n}) => {\n const cloudinary = useRef<any>();\n const widget = useRef();\n\n const signed = !!signatureEndpoint;\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.current?.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?.current);\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?.current) {\n widget.current = createWidget();\n }\n\n // @ts-ignore\n widget?.current && widget.current.open();\n }\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 // @ts-ignore\n cloudinary.current = window.cloudinary;\n }\n\n return (\n <>\n {children({\n cloudinary: cloudinary.current,\n widget: widget.current,\n open,\n })}\n <Script\n id={`cloudinary-${Math.floor(Math.random() * 100)}`}\n // @ts-ignore\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":["NEXT_CLOUDINARY_ANALYTICS_ID","NEXT_CLOUDINARY_VERSION","pkg","version","NEXT_VERSION","nextPkg","createPlaceholderUrl","src","placeholder","rawTransformations","push","includes","color","split","splice","join","constructCloudinaryUrl","options","width","quality","config","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","analytics","sdkCode","sdkSemver","techVersion","feature","pollForProcessingImage","Promise","resolve","reject","fetch","then","res","ok","e","status","cloudinaryLoader","loaderOptions","imageProps","cldOptions","cldConfig","parseInt","height","multiplier","widthResize","heightResize","Math","round","CldImage","props","CLD_OPTIONS","transformationPlugins","forEach","prop","Error","alt","Object","keys","filter","key","defaultImgKey","map","imgKey","setImgKey","useState","undefined","publicId","startsWith","getPublicId","blurDataURL","preserveTransformations","transformations","getTransformations","flat","console","warn","message","handleOnError","result","target","Date","now","_jsx","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","_excluded","crop","gravity","ogImageUrl","_jsxs","CldUploadWidget","children","onUpload","signatureEndpoint","uploadPreset","cloudinary","useRef","widget","signed","generateSignature","callback","paramsToSign","method","body","JSON","stringify","r","json","signature","createWidget","uploadOptions","NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET","apiKey","NEXT_PUBLIC_CLOUDINARY_API_KEY","uploadSignature","current","createUploadWidget","error","event","open","handleOnLoad","window","_Fragment","floor","random","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Q,IAAI,QAAA;SACN,CAAA,CAAA,CAAA;AAEb,OAAA;AAAC,KAAA,CAAA;GAEF,CAAA,CAAA;AAEP;;;;"}
|
|
1
|
+
{"version":3,"file":"next-cloudinary.modern.mjs","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","CLD_OPTIONS","transformationPlugins","forEach","prop","includes","Error","push","alt","Object","keys","filter","key","defaultImgKey","map","join","imgKey","setImgKey","useState","undefined","preserveTransformations","transformations","getTransformations","rawTransformations","flat","console","warn","message","handleOnError","result","target","Date","now","_jsx","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","_excluded","crop","gravity","ogImageUrl","_jsxs","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","floor","random","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEG;AAEI,eAAeA,sBAAsB,CAACC,OAAO,EAAA;EAClD,MAAM;AAAEC,IAAAA,GAAAA;AAAK,GAAA,GAAGD,OAAO,CAAA;EACvB,IAAI;AACF,IAAA,MAAM,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAI;AACpCC,MAAAA,KAAK,CAACJ,GAAG,CAAC,CAACK,IAAI,CAACC,GAAG,IAAG;AACpB,QAAA,IAAK,CAACA,GAAG,CAACC,EAAE,EAAG;UACbJ,MAAM,CAACG,GAAG,CAAC,CAAA;AACX,UAAA,OAAA;AACD,SAAA;QACDJ,OAAO,CAACI,GAAG,CAAC,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