next-cloudinary 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,7 +106,6 @@ To work on the project, you need to have an active Cloudinary account. With the
106
106
  NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="<Your Cloudinary Cloud Name>"
107
107
  NEXT_PUBLIC_CLOUDINARY_API_KEY="<Your Cloudinary API Key>"
108
108
  CLOUDINARY_API_SECRET="<Your Cloudinary API Secret>"
109
- NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET="<Your Cloudinary Upload Preset>"
110
109
  ```
111
110
 
112
111
  > Note: The Cloudinary account can be free, but some features may not work beyond free tier like Background Removal
@@ -770,10 +770,11 @@ var CldUploadWidget = function CldUploadWidget(_ref) {
770
770
  var children = _ref.children,
771
771
  onUpload = _ref.onUpload,
772
772
  options = _ref.options,
773
- signed = _ref.signed,
774
- signatureEndpoint = _ref.signatureEndpoint;
773
+ signatureEndpoint = _ref.signatureEndpoint,
774
+ uploadPreset = _ref.uploadPreset;
775
775
  var cloudinary = react.useRef();
776
776
  var widget = react.useRef();
777
+ var signed = !!signatureEndpoint;
777
778
 
778
779
  /**
779
780
  * generateSignature
@@ -806,15 +807,21 @@ var CldUploadWidget = function CldUploadWidget(_ref) {
806
807
  // either on page load or during the upload process. Read more about signed uploads at:
807
808
  // https://cloudinary.com/documentation/upload_widget#signed_uploads
808
809
 
809
- var totalOptions = _extends({}, options, !!signed && {
810
- uploadSignature: generateSignature
811
- });
810
+ var uploadOptions = _extends({
811
+ cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
812
+ uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,
813
+ apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY
814
+ }, options);
815
+ if (signed) {
816
+ uploadOptions.uploadSignature = generateSignature;
817
+
818
+ // No need for apiSecret here because of api/sign-cloudinary-params
812
819
 
813
- // no need for apiSecret because of api/sign-cloudinary-params
814
- if (signed && !totalOptions.apiKey) {
815
- return new Error("Signed Upload needs apiKey!");
820
+ if (!uploadOptions.apiKey) {
821
+ return new Error("Signed Upload needs apiKey!");
822
+ }
816
823
  }
817
- return (_cloudinary$current = cloudinary.current) == null ? void 0 : _cloudinary$current.createUploadWidget(totalOptions, function (error, result) {
824
+ return (_cloudinary$current = cloudinary.current) == null ? void 0 : _cloudinary$current.createUploadWidget(uploadOptions, function (error, result) {
818
825
  // The callback is a bit more chatty than failed or success so
819
826
  // only trigger when one of those are the case. You can additionally
820
827
  // create a separate handler such as onEvent and trigger it on
@@ -855,35 +862,39 @@ var CldUploadWidget = function CldUploadWidget(_ref) {
855
862
  src: "https://widget.cloudinary.com/v2.0/global/all.js",
856
863
  onLoad: handleOnLoad,
857
864
  onError: function onError(e) {
858
- console.error("Script failed to load", e);
865
+ return console.error("Failed to load Cloudinary: " + e.message);
859
866
  }
860
867
  })]
861
868
  });
862
869
  };
863
870
 
864
- var _excluded = ["onUpload", "options", "signed", "label", "children"];
871
+ var _excluded = ["children", "onClick", "onUpload", "options", "signatureEndpoint", "uploadPreset"];
865
872
  var CldUploadButton = function CldUploadButton(_ref) {
866
- var onUpload = _ref.onUpload,
873
+ var _children = _ref.children,
874
+ onClick = _ref.onClick,
875
+ onUpload = _ref.onUpload,
867
876
  options = _ref.options,
868
- signed = _ref.signed,
869
- _children = _ref.children,
877
+ signatureEndpoint = _ref.signatureEndpoint,
878
+ uploadPreset = _ref.uploadPreset,
870
879
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
871
880
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
872
881
  children: /*#__PURE__*/jsxRuntime.jsx(CldUploadWidget, {
873
- signed: signed,
874
- options: options,
875
882
  onUpload: onUpload,
876
- signatureEndpoint: signed != null ? signed : props.signatureEndpoint,
883
+ options: options,
884
+ signatureEndpoint: signatureEndpoint,
885
+ uploadPreset: uploadPreset,
877
886
  children: function children(_ref2) {
878
887
  var open = _ref2.open;
879
888
  function handleOnClick(e) {
880
889
  e.preventDefault();
881
890
  open();
891
+ if (typeof onClick === 'function') {
892
+ onClick(e);
893
+ }
882
894
  }
883
- return /*#__PURE__*/jsxRuntime.jsx("button", _extends({
884
- onClick: handleOnClick
885
- }, props, {
886
- children: _children
895
+ return /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, props, {
896
+ onClick: handleOnClick,
897
+ children: _children || 'Upload'
887
898
  }));
888
899
  }
889
900
  })
@@ -1 +1 @@
1
- {"version":3,"file":"next-cloudinary.js","sources":["../src/plugins/cropping.js","../src/plugins/effects.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/raw-transformations.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/plugins/zoompan.js","../src/lib/cloudinary.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js","../src/components/CldOgImage/CldOgImage.js","../src/components/CldUploadWidget/CldUploadWidget.js","../src/components/CldUploadButton/CldUploadButton.js"],"sourcesContent":["const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport const props = ['crop', 'gravity'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { width, height, crop = 'limit' } = options;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !options.gravity && cropsGravityAuto.includes(crop) ) {\n options.gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( options.gravity ) {\n if ( options.gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${options.gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}\n","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n];\n\nexport const props = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, options } = {}) {\n params.forEach(key => {\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( options[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof options[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${options[prop]}`);\n }\n });\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n alignment: {\n qualifier: 'alignment'\n },\n border: {\n qualifier: 'bo',\n location: 'primary'\n },\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n lineSpacing: {\n qualifier: 'line_spacing'\n },\n stroke: {\n qualifier: 'self'\n },\n textDecoration: {\n qualifier: false\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['text', 'overlays'];\n\nexport const DEFAULT_TEXT_OPTIONS = {\n color: 'black',\n fontFamily: 'Arial',\n fontSize: 200,\n fontWeight: 'bold',\n};\n\nexport function plugin({ cldImage, options } = {}) {\n const { text, overlays = [] } = options;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n if ( Array.isArray(overlays) ) {\n overlays.forEach(applyOverlay);\n }\n\n if ( typeof text === 'string' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n })\n } else if ( typeof text === 'object' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n ...text\n }\n })\n }\n\n\n\n /**\n * applyOverlay\n */\n\n function applyOverlay({ publicId, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object' || typeof text === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n if ( typeof text === 'string' ) {\n text = {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n }\n\n\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else if ( qualifier === 'self' ) {\n textTransformations.push(key);\n } else if ( qualifier ) {\n textTransformations.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['rawTransformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { rawTransformations = [] } = options;\n\n rawTransformations.forEach(transformation => {\n cldImage.addTransformation(transformation);\n });\n}","export const props = ['removeBackground'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { removeBackground = false } = options;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['underlay', 'underlays'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { underlay, underlays = [] } = options;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n if ( Array.isArray(underlays) ) {\n underlays.forEach(applyUnderlay);\n }\n\n if ( typeof underlay === 'string' ) {\n\n const underlayOptions = {\n publicId: underlay,\n crop: 'fill'\n }\n\n if ( options.width ) {\n underlayOptions.width = options.width;\n }\n\n if ( options.height ) {\n underlayOptions.height = options.height;\n }\n\n applyUnderlay(underlayOptions);\n }\n\n /**\n * applyUnderlay\n */\n\n function applyUnderlay({ publicId, type, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['zoompan'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { zoompan = false } = options;\n const overrides = {};\n\n if ( zoompan === true ) {\n cldImage.effect('e_zoompan');\n } else if ( typeof zoompan === 'string' ) {\n if ( zoompan === 'loop' ) {\n cldImage.effect('e_zoompan');\n cldImage.effect('e_loop');\n } else {\n cldImage.effect(`e_zoompan:${zoompan}`);\n }\n } else if ( typeof zoompan === 'object' ) {\n let zoompanEffect = 'e_zoompan';\n\n if ( typeof zoompan.options === 'string' ) {\n zoompanEffect = `${zoompanEffect}${zoompan.options}`;\n }\n\n cldImage.effect(zoompanEffect);\n\n let loopEffect;\n\n if ( zoompan.loop === true ) {\n loopEffect = 'e_loop';\n } else if ( typeof zoompan.loop === 'string' ) {\n loopEffect = `e_loop${zoompan.loop}`;\n }\n\n if ( loopEffect ) {\n cldImage.effect(loopEffect);\n }\n }\n\n if ( zoompan !== false ) {\n overrides.format = 'gif';\n }\n\n return {\n options: overrides\n }\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as rawTransformationsPlugin from '../plugins/raw-transformations';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as underlaysPlugin from '../plugins/underlays';\nimport * as zoompanPlugin from '../plugins/zoompan';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n underlaysPlugin,\n zoompanPlugin,\n\n // Raw transformations needs to be last simply to make sure\n // it's always expected to applied the same way\n\n rawTransformationsPlugin\n];\n\nlet cld;\n\n/**\n * constructCloudinaryUrl\n */\n\nexport function constructCloudinaryUrl({ options, config }) {\n if ( !cld ) {\n cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n },\n ...config\n });\n }\n\n const publicId = getPublicId(options.src);\n\n const cldImage = cld.image(publicId);\n\n transformationPlugins.forEach(({ plugin }) => {\n const { options: pluginOptions } = plugin({\n cldImage,\n options\n }) || {};\n\n if ( pluginOptions?.format ) {\n options.format = pluginOptions.format;\n }\n });\n\n return cldImage\n .setDeliveryType(options.deliveryType || 'upload')\n .format(options.format || 'auto')\n .delivery(`q_${options.quality || 'auto'}`)\n .toURL();\n}\n\n/**\n * Retrieves the public id of a cloudiary image url. If no url is recognized it returns the parameter it self.\n * If it's recognized that is a url and it's not possible to get the public id, it warns the user.\n *\n * @param {string} src The cloudiary url or public id.\n *\n * @return {string} The images public id\n */\n\nexport function getPublicId(src) {\n if ( typeof src !== 'string' ) {\n throw new Error(`Invalid src of type ${typeof src}`);\n }\n\n if ( src.includes('res.cloudinary.com') ) {\n const regexWithTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(.*)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n const regexWithoutTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n\n const withTransformations = src.match(regexWithTransformations)\n const withoutTransformations = src.match(regexWithoutTransformations)\n\n if ( withTransformations ) {\n return withTransformations[withTransformations.length - 1]\n } else if ( withoutTransformations ) {\n return withoutTransformations[withoutTransformations.length - 1]\n } else {\n console.warn(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)\n }\n }\n\n return src;\n}\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true, config }) {\n const rawTransformations = [];\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 });;\n}\n","import { constructCloudinaryUrl } from '../lib/cloudinary';\n\nexport function cloudinaryLoader(defaultOptions, cldOptions, cldConfig = {}) {\n return constructCloudinaryUrl({\n options: {\n ...defaultOptions,\n ...cldOptions\n },\n config: cldConfig\n });\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl, getPublicId, transformationPlugins } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [];\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 const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\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 const publicId = getPublicId(props.src);\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 return (\n <Image\n {...imageProps}\n loader={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;","import Head from 'next/head';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nimport { constructCloudinaryUrl } from '../../lib/cloudinary';\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [], twitterTitle, ...props }) => {\n const options = {\n ...props,\n width: props.width || IMAGE_WIDTH,\n height: props.height || IMAGE_HEIGHT,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center'\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options\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 <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 signed,\n signatureEndpoint,\n}) => {\n const cloudinary = useRef();\n const widget = useRef();\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 totalOptions = {\n ...options,\n ...(!!signed && {\n uploadSignature: generateSignature,\n }),\n };\n\n // no need for apiSecret because of api/sign-cloudinary-params\n if (signed && !totalOptions.apiKey) {\n return new Error(\"Signed Upload needs apiKey!\");\n }\n\n return cloudinary.current?.createUploadWidget(\n totalOptions,\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 occurance\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 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 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 src=\"https://widget.cloudinary.com/v2.0/global/all.js\"\n onLoad={handleOnLoad}\n onError={(e) => {\n console.error(\"Script failed to load\", e);\n }}\n />\n </>\n );\n};\n\nexport default CldUploadWidget;\n","import CldUploadWidget from '../CldUploadWidget';\n\nconst CldUploadButton = ({\n onUpload,\n options,\n signed,\n label,\n children,\n ...props\n}) => {\n return (\n <>\n <CldUploadWidget\n signed={signed}\n options={options}\n onUpload={onUpload}\n signatureEndpoint={signed ?? props.signatureEndpoint}\n >\n {({ open }) => {\n function handleOnClick(e) {\n e.preventDefault();\n open();\n }\n return (\n <button onClick={handleOnClick} {...props}>\n {children}\n </button>\n );\n }}\n </CldUploadWidget>\n </>\n );\n};\n\nexport default CldUploadButton;\n"],"names":["cropsGravityAuto","props","plugin","cldImage","options","width","height","crop","transformationString","gravity","includes","console","warn","resize","params","prop","effect","map","param","forEach","key","primary","aspectRatio","qualifier","position","angle","x","y","text","alignment","border","location","color","fontFamily","fontSize","fontWeight","letterSpacing","lineSpacing","stroke","textDecoration","DEFAULT_TEXT_OPTIONS","overlays","type","typeQualifier","Array","isArray","applyOverlay","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","qualifiersPrimary","push","textTransformations","qualifiersText","join","qualifiersPosition","length","addTransformation","rawTransformations","transformation","removeBackground","underlay","underlays","applyUnderlay","underlayOptions","zoompan","overrides","zoompanEffect","loopEffect","loop","format","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","underlaysPlugin","zoompanPlugin","rawTransformationsPlugin","cld","constructCloudinaryUrl","config","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","getPublicId","src","image","pluginOptions","setDeliveryType","deliveryType","delivery","quality","toURL","Error","regexWithTransformations","regexWithoutTransformations","withTransformations","match","withoutTransformations","createPlaceholderUrl","placeholder","split","splice","cloudinaryLoader","defaultOptions","cldOptions","cldConfig","CldImage","CLD_OPTIONS","imageProps","filter","blurDataURL","_jsx","Image","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","ogImageUrl","_jsxs","Head","alt","CldUploadWidget","children","onUpload","signed","signatureEndpoint","cloudinary","useRef","widget","generateSignature","callback","paramsToSign","fetch","method","body","JSON","stringify","then","r","json","signature","createWidget","totalOptions","uploadSignature","apiKey","current","createUploadWidget","error","result","event","open","handleOnLoad","window","_Fragment","Script","Math","floor","random","e","CldUploadButton","label","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE,CAAA;AAElE,IAAMC,OAAK,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEjC,SAASC,QAAM,CAA6B,KAAA,EAAA;AAAA,EAAA,IAAA,IAAA,GAAA,KAAA,KAAA,KAAA,CAAA,GAAJ,EAAE,GAAA,KAAA;AAAxBC,IAAAA,QAAQ,QAARA,QAAQ;AAAEC,IAAAA,OAAO,QAAPA,OAAO,CAAA;AACxC,EAAA,IAAQC,KAAK,GAA6BD,OAAO,CAAzCC,KAAK;IAAEC,MAAM,GAAqBF,OAAO,CAAlCE,MAAM;IAAA,aAAqBF,GAAAA,OAAO,CAA1BG,IAAI;AAAJA,IAAAA,IAAI,8BAAG,OAAO,GAAA,aAAA,CAAA;AAErC,EAAA,IAAIC,oBAAoB,GAAA,IAAA,GAAQD,IAAI,GAAA,KAAA,GAAMF,KAAO,CAAA;EAEjD,IAAK,CAACD,OAAO,CAACK,OAAO,IAAIT,gBAAgB,CAACU,QAAQ,CAACH,IAAI,CAAC,EAAG;IACzDH,OAAO,CAACK,OAAO,GAAG,MAAM,CAAA;AAC1B,GAAA;EAEA,IAAK,CAAC,CAAC,OAAO,CAAC,CAACC,QAAQ,CAACH,IAAI,CAAC,EAAG;IAC/BC,oBAAoB,GAAMA,oBAAoB,GAAA,KAAA,GAAMF,MAAQ,CAAA;AAC9D,GAAA;EAEA,IAAKF,OAAO,CAACK,OAAO,EAAG;AACrB,IAAA,IAAKL,OAAO,CAACK,OAAO,KAAK,MAAM,IAAI,CAACT,gBAAgB,CAACU,QAAQ,CAACH,IAAI,CAAC,EAAG;AACpEI,MAAAA,OAAO,CAACC,IAAI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,6BAAA,CAAA,IAAA,EAAA,SAAA,EAAA;EAER,oBACE8H,cAAA,CAAA4C,mBAAA,EAAA;AAAA,IAAA,QAAA,eACE5C,eAAC,eAAe,EAAA;AACd,MAAA,MAAM,EAAEe,MAAO;AACf,MAAA,OAAO,EAAE1I,OAAQ;AACjB,MAAA,QAAQ,EAAEyI,QAAS;AACnB,MAAA,iBAAiB,EAAEC,MAAM,IAAA,IAAA,GAANA,MAAM,GAAI7I,KAAK,CAAC8I,iBAAkB;AAAA,MAAA,QAAA,EAEpD,SAAc,QAAA,CAAA,KAAA,EAAA;QAAA,IAAXyB,IAAI,SAAJA,IAAI,CAAA;QACN,SAASW,aAAa,CAACH,CAAC,EAAE;UACxBA,CAAC,CAACI,cAAc,EAAE,CAAA;AAClBZ,UAAAA,IAAI,EAAE,CAAA;AACR,SAAA;QACA,oBACEzC,cAAA,CAAA,QAAA,EAAA,QAAA,CAAA;AAAQ,UAAA,OAAO,EAAEoD,aAAAA;AAAc,SAAA,EAAKlL,KAAK,EAAA;UAAA,QACtC2I,EAAAA,SAAAA;SACM,CAAA,CAAA,CAAA;AAEb,OAAA;AAAC,KAAA,CAAA;GAEF,CAAA,CAAA;AAEP;;;;;;;;;;;"}
1
+ {"version":3,"file":"next-cloudinary.js","sources":["../src/plugins/cropping.js","../src/plugins/effects.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/raw-transformations.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/plugins/zoompan.js","../src/lib/cloudinary.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js","../src/components/CldOgImage/CldOgImage.js","../src/components/CldUploadWidget/CldUploadWidget.js","../src/components/CldUploadButton/CldUploadButton.js"],"sourcesContent":["const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport const props = ['crop', 'gravity'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { width, height, crop = 'limit' } = options;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !options.gravity && cropsGravityAuto.includes(crop) ) {\n options.gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( options.gravity ) {\n if ( options.gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${options.gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}\n","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n];\n\nexport const props = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, options } = {}) {\n params.forEach(key => {\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( options[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof options[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${options[prop]}`);\n }\n });\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n alignment: {\n qualifier: 'alignment'\n },\n border: {\n qualifier: 'bo',\n location: 'primary'\n },\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n lineSpacing: {\n qualifier: 'line_spacing'\n },\n stroke: {\n qualifier: 'self'\n },\n textDecoration: {\n qualifier: false\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['text', 'overlays'];\n\nexport const DEFAULT_TEXT_OPTIONS = {\n color: 'black',\n fontFamily: 'Arial',\n fontSize: 200,\n fontWeight: 'bold',\n};\n\nexport function plugin({ cldImage, options } = {}) {\n const { text, overlays = [] } = options;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n if ( Array.isArray(overlays) ) {\n overlays.forEach(applyOverlay);\n }\n\n if ( typeof text === 'string' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n })\n } else if ( typeof text === 'object' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n ...text\n }\n })\n }\n\n\n\n /**\n * applyOverlay\n */\n\n function applyOverlay({ publicId, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object' || typeof text === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n if ( typeof text === 'string' ) {\n text = {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n }\n\n\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else if ( qualifier === 'self' ) {\n textTransformations.push(key);\n } else if ( qualifier ) {\n textTransformations.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['rawTransformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { rawTransformations = [] } = options;\n\n rawTransformations.forEach(transformation => {\n cldImage.addTransformation(transformation);\n });\n}","export const props = ['removeBackground'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { removeBackground = false } = options;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['underlay', 'underlays'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { underlay, underlays = [] } = options;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n if ( Array.isArray(underlays) ) {\n underlays.forEach(applyUnderlay);\n }\n\n if ( typeof underlay === 'string' ) {\n\n const underlayOptions = {\n publicId: underlay,\n crop: 'fill'\n }\n\n if ( options.width ) {\n underlayOptions.width = options.width;\n }\n\n if ( options.height ) {\n underlayOptions.height = options.height;\n }\n\n applyUnderlay(underlayOptions);\n }\n\n /**\n * applyUnderlay\n */\n\n function applyUnderlay({ publicId, type, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['zoompan'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { zoompan = false } = options;\n const overrides = {};\n\n if ( zoompan === true ) {\n cldImage.effect('e_zoompan');\n } else if ( typeof zoompan === 'string' ) {\n if ( zoompan === 'loop' ) {\n cldImage.effect('e_zoompan');\n cldImage.effect('e_loop');\n } else {\n cldImage.effect(`e_zoompan:${zoompan}`);\n }\n } else if ( typeof zoompan === 'object' ) {\n let zoompanEffect = 'e_zoompan';\n\n if ( typeof zoompan.options === 'string' ) {\n zoompanEffect = `${zoompanEffect}${zoompan.options}`;\n }\n\n cldImage.effect(zoompanEffect);\n\n let loopEffect;\n\n if ( zoompan.loop === true ) {\n loopEffect = 'e_loop';\n } else if ( typeof zoompan.loop === 'string' ) {\n loopEffect = `e_loop${zoompan.loop}`;\n }\n\n if ( loopEffect ) {\n cldImage.effect(loopEffect);\n }\n }\n\n if ( zoompan !== false ) {\n overrides.format = 'gif';\n }\n\n return {\n options: overrides\n }\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as rawTransformationsPlugin from '../plugins/raw-transformations';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as underlaysPlugin from '../plugins/underlays';\nimport * as zoompanPlugin from '../plugins/zoompan';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n underlaysPlugin,\n zoompanPlugin,\n\n // Raw transformations needs to be last simply to make sure\n // it's always expected to applied the same way\n\n rawTransformationsPlugin\n];\n\nlet cld;\n\n/**\n * constructCloudinaryUrl\n */\n\nexport function constructCloudinaryUrl({ options, config }) {\n if ( !cld ) {\n cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n },\n ...config\n });\n }\n\n const publicId = getPublicId(options.src);\n\n const cldImage = cld.image(publicId);\n\n transformationPlugins.forEach(({ plugin }) => {\n const { options: pluginOptions } = plugin({\n cldImage,\n options\n }) || {};\n\n if ( pluginOptions?.format ) {\n options.format = pluginOptions.format;\n }\n });\n\n return cldImage\n .setDeliveryType(options.deliveryType || 'upload')\n .format(options.format || 'auto')\n .delivery(`q_${options.quality || 'auto'}`)\n .toURL();\n}\n\n/**\n * Retrieves the public id of a cloudiary image url. If no url is recognized it returns the parameter it self.\n * If it's recognized that is a url and it's not possible to get the public id, it warns the user.\n *\n * @param {string} src The cloudiary url or public id.\n *\n * @return {string} The images public id\n */\n\nexport function getPublicId(src) {\n if ( typeof src !== 'string' ) {\n throw new Error(`Invalid src of type ${typeof src}`);\n }\n\n if ( src.includes('res.cloudinary.com') ) {\n const regexWithTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(.*)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n const regexWithoutTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n\n const withTransformations = src.match(regexWithTransformations)\n const withoutTransformations = src.match(regexWithoutTransformations)\n\n if ( withTransformations ) {\n return withTransformations[withTransformations.length - 1]\n } else if ( withoutTransformations ) {\n return withoutTransformations[withoutTransformations.length - 1]\n } else {\n console.warn(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)\n }\n }\n\n return src;\n}\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true, config }) {\n const rawTransformations = [];\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 });;\n}\n","import { constructCloudinaryUrl } from '../lib/cloudinary';\n\nexport function cloudinaryLoader(defaultOptions, cldOptions, cldConfig = {}) {\n return constructCloudinaryUrl({\n options: {\n ...defaultOptions,\n ...cldOptions\n },\n config: cldConfig\n });\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl, getPublicId, transformationPlugins } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [];\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 const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\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 const publicId = getPublicId(props.src);\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 return (\n <Image\n {...imageProps}\n loader={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;","import Head from 'next/head';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nimport { constructCloudinaryUrl } from '../../lib/cloudinary';\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [], twitterTitle, ...props }) => {\n const options = {\n ...props,\n width: props.width || IMAGE_WIDTH,\n height: props.height || IMAGE_HEIGHT,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center'\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options\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 <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();\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 occurance\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 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 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 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 <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":["cropsGravityAuto","props","plugin","cldImage","options","width","height","crop","transformationString","gravity","includes","console","warn","resize","params","prop","effect","map","param","forEach","key","primary","aspectRatio","qualifier","position","angle","x","y","text","alignment","border","location","color","fontFamily","fontSize","fontWeight","letterSpacing","lineSpacing","stroke","textDecoration","DEFAULT_TEXT_OPTIONS","overlays","type","typeQualifier","Array","isArray","applyOverlay","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","qualifiersPrimary","push","textTransformations","qualifiersText","join","qualifiersPosition","length","addTransformation","rawTransformations","transformation","removeBackground","underlay","underlays","applyUnderlay","underlayOptions","zoompan","overrides","zoompanEffect","loopEffect","loop","format","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","underlaysPlugin","zoompanPlugin","rawTransformationsPlugin","cld","constructCloudinaryUrl","config","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","getPublicId","src","image","pluginOptions","setDeliveryType","deliveryType","delivery","quality","toURL","Error","regexWithTransformations","regexWithoutTransformations","withTransformations","match","withoutTransformations","createPlaceholderUrl","placeholder","split","splice","cloudinaryLoader","defaultOptions","cldOptions","cldConfig","CldImage","CLD_OPTIONS","imageProps","filter","blurDataURL","_jsx","Image","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","ogImageUrl","_jsxs","Head","alt","CldUploadWidget","children","onUpload","signatureEndpoint","uploadPreset","cloudinary","useRef","widget","signed","generateSignature","callback","paramsToSign","fetch","method","body","JSON","stringify","then","r","json","signature","createWidget","uploadOptions","NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET","apiKey","NEXT_PUBLIC_CLOUDINARY_API_KEY","uploadSignature","current","createUploadWidget","error","result","event","open","handleOnLoad","window","_Fragment","Script","Math","floor","random","e","message","CldUploadButton","onClick","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE,CAAA;AAElE,IAAMC,OAAK,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEjC,SAASC,QAAM,CAA6B,KAAA,EAAA;AAAA,EAAA,IAAA,IAAA,GAAA,KAAA,KAAA,KAAA,CAAA,GAAJ,EAAE,GAAA,KAAA;AAAxBC,IAAAA,QAAQ,QAARA,QAAQ;AAAEC,IAAAA,OAAO,QAAPA,OAAO,C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AO,EAAEzI,OAAQ;AACjB,MAAA,iBAAiB,EAAE0I,iBAAkB;AACrC,MAAA,YAAY,EAAEC,YAAa;AAAA,MAAA,QAAA,EAE1B,SAAc,QAAA,CAAA,KAAA,EAAA;QAAA,IAAX4B,IAAI,SAAJA,IAAI,CAAA;QACN,SAASY,aAAa,CAACJ,CAAC,EAAE;UACxBA,CAAC,CAACK,cAAc,EAAE,CAAA;AAElBb,UAAAA,IAAI,EAAE,CAAA;AAEN,UAAA,IAAK,OAAOW,OAAO,KAAK,UAAU,EAAG;YACnCA,OAAO,CAACH,CAAC,CAAC,CAAA;AACZ,WAAA;AACF,SAAA;AACA,QAAA,oBACEpD,sCAAY9H,KAAK,EAAA;AAAE,UAAA,OAAO,EAAEsL,aAAc;AAAA,UAAA,QAAA,EACvC3C,SAAQ,IAAI,QAAA;SACN,CAAA,CAAA,CAAA;AAEb,OAAA;AAAC,KAAA,CAAA;GAEF,CAAA,CAAA;AAEP;;;;;;;;;;;"}
@@ -778,11 +778,12 @@ const CldUploadWidget = ({
778
778
  children,
779
779
  onUpload,
780
780
  options,
781
- signed,
782
- signatureEndpoint
781
+ signatureEndpoint,
782
+ uploadPreset
783
783
  }) => {
784
784
  const cloudinary = useRef();
785
785
  const widget = useRef();
786
+ const signed = !!signatureEndpoint;
786
787
 
787
788
  /**
788
789
  * generateSignature
@@ -814,15 +815,21 @@ const CldUploadWidget = ({
814
815
  // either on page load or during the upload process. Read more about signed uploads at:
815
816
  // https://cloudinary.com/documentation/upload_widget#signed_uploads
816
817
 
817
- const totalOptions = _extends({}, options, !!signed && {
818
- uploadSignature: generateSignature
819
- });
818
+ const uploadOptions = _extends({
819
+ cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME,
820
+ uploadPreset: uploadPreset || process.env.NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET,
821
+ apiKey: process.env.NEXT_PUBLIC_CLOUDINARY_API_KEY
822
+ }, options);
823
+ if (signed) {
824
+ uploadOptions.uploadSignature = generateSignature;
825
+
826
+ // No need for apiSecret here because of api/sign-cloudinary-params
820
827
 
821
- // no need for apiSecret because of api/sign-cloudinary-params
822
- if (signed && !totalOptions.apiKey) {
823
- return new Error("Signed Upload needs apiKey!");
828
+ if (!uploadOptions.apiKey) {
829
+ return new Error("Signed Upload needs apiKey!");
830
+ }
824
831
  }
825
- return (_cloudinary$current = cloudinary.current) == null ? void 0 : _cloudinary$current.createUploadWidget(totalOptions, function (error, result) {
832
+ return (_cloudinary$current = cloudinary.current) == null ? void 0 : _cloudinary$current.createUploadWidget(uploadOptions, function (error, result) {
826
833
  // The callback is a bit more chatty than failed or success so
827
834
  // only trigger when one of those are the case. You can additionally
828
835
  // create a separate handler such as onEvent and trigger it on
@@ -862,39 +869,41 @@ const CldUploadWidget = ({
862
869
  id: `cloudinary-${Math.floor(Math.random() * 100)}`,
863
870
  src: "https://widget.cloudinary.com/v2.0/global/all.js",
864
871
  onLoad: handleOnLoad,
865
- onError: e => {
866
- console.error("Script failed to load", e);
867
- }
872
+ onError: e => console.error(`Failed to load Cloudinary: ${e.message}`)
868
873
  })]
869
874
  });
870
875
  };
871
876
 
872
- const _excluded = ["onUpload", "options", "signed", "label", "children"];
877
+ const _excluded = ["children", "onClick", "onUpload", "options", "signatureEndpoint", "uploadPreset"];
873
878
  const CldUploadButton = _ref => {
874
879
  let {
880
+ children,
881
+ onClick,
875
882
  onUpload,
876
883
  options,
877
- signed,
878
- children
884
+ signatureEndpoint,
885
+ uploadPreset
879
886
  } = _ref,
880
887
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
881
888
  return /*#__PURE__*/jsx(Fragment, {
882
889
  children: /*#__PURE__*/jsx(CldUploadWidget, {
883
- signed: signed,
884
- options: options,
885
890
  onUpload: onUpload,
886
- signatureEndpoint: signed != null ? signed : props.signatureEndpoint,
891
+ options: options,
892
+ signatureEndpoint: signatureEndpoint,
893
+ uploadPreset: uploadPreset,
887
894
  children: ({
888
895
  open
889
896
  }) => {
890
897
  function handleOnClick(e) {
891
898
  e.preventDefault();
892
899
  open();
900
+ if (typeof onClick === 'function') {
901
+ onClick(e);
902
+ }
893
903
  }
894
- return /*#__PURE__*/jsx("button", _extends({
895
- onClick: handleOnClick
896
- }, props, {
897
- children: children
904
+ return /*#__PURE__*/jsx("button", _extends({}, props, {
905
+ onClick: handleOnClick,
906
+ children: children || 'Upload'
898
907
  }));
899
908
  }
900
909
  })