next-cloudinary 7.0.0-beta.15 → 7.0.0-beta.17

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.
@@ -7,9 +7,9 @@ var React = require('react');
7
7
  var Image = require('next/image');
8
8
  var util = require('@cloudinary-util/util');
9
9
  var urlLoader = require('@cloudinary-util/url-loader');
10
- var cloudinaryLoader = require('./cloudinary-loader-570d5c51.cjs.js');
10
+ var cloudinaryLoader = require('./cloudinary-loader-687ca5ce.cjs.js');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
- require('./cloudinary-fa1452e5.cjs.js');
12
+ require('./cloudinary-9ac4fc0b.cjs.js');
13
13
  require('next/package.json');
14
14
 
15
15
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -3,9 +3,9 @@ import { forwardRef, useState, useCallback } from 'react';
3
3
  import Image from 'next/image';
4
4
  import { pollForProcessingImage } from '@cloudinary-util/util';
5
5
  import { cloudinaryPluginKeys } from '@cloudinary-util/url-loader';
6
- import { g as getCldImageUrl, c as cloudinaryLoader } from './cloudinary-loader-35ab85b4.esm.js';
6
+ import { g as getCldImageUrl, c as cloudinaryLoader } from './cloudinary-loader-44025348.esm.js';
7
7
  import { jsx } from 'react/jsx-runtime';
8
- import './cloudinary-6504bfbb.esm.js';
8
+ import './cloudinary-f67b50bc.esm.js';
9
9
  import 'next/package.json';
10
10
 
11
11
  const CldImage = /*#__PURE__*/forwardRef(function CldImage(props, ref) {
@@ -4,7 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  require('react');
7
- var CldUploadWidget = require('./CldUploadWidget-85bcec94.cjs.js');
7
+ var CldUploadWidget = require('./CldUploadWidget-88b4b470.cjs.js');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import 'react';
3
- import CldUploadWidget from './CldUploadWidget-8f734071.esm.js';
3
+ import CldUploadWidget from './CldUploadWidget-8c702880.esm.js';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
6
6
  const CldUploadButton = ({
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var React = require('react');
7
7
  var Script = require('next/script');
8
8
  var urlLoader = require('@cloudinary-util/url-loader');
9
- var cloudinary = require('./cloudinary-fa1452e5.cjs.js');
9
+ var cloudinary = require('./cloudinary-9ac4fc0b.cjs.js');
10
10
  var jsxRuntime = require('react/jsx-runtime');
11
11
  require('next/package.json');
12
12
 
@@ -2,7 +2,7 @@
2
2
  import React, { useRef, useState, useEffect } from 'react';
3
3
  import Script from 'next/script';
4
4
  import { generateSignatureCallback, getUploadWidgetOptions, generateUploadWidgetResultCallback, UPLOAD_WIDGET_EVENTS } from '@cloudinary-util/url-loader';
5
- import { g as getCloudinaryConfig } from './cloudinary-6504bfbb.esm.js';
5
+ import { g as getCloudinaryConfig } from './cloudinary-f67b50bc.esm.js';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
7
  import 'next/package.json';
8
8
 
@@ -7,7 +7,7 @@ var React = require('react');
7
7
  var Script = require('next/script');
8
8
  var Head = require('next/head');
9
9
  var urlLoader = require('@cloudinary-util/url-loader');
10
- var cloudinary = require('./cloudinary-fa1452e5.cjs.js');
10
+ var cloudinary = require('./cloudinary-9ac4fc0b.cjs.js');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  require('next/package.json');
13
13
 
@@ -53,6 +53,8 @@ const CldVideoPlayer = props => {
53
53
  const videoRef = props.videoRef || defaultVideoRef;
54
54
  const defaultPlayerRef = React.useRef(null);
55
55
  const playerRef = props.playerRef || defaultPlayerRef;
56
+ // The <video> element the player was created on (video.js keeps using it inside the player)
57
+ const playerVideoElementRef = React.useRef(null);
56
58
  const playerId = id || `player-${uniqueId.replace(/:/g, '')}`;
57
59
  let playerClassName = 'cld-video-player cld-fluid';
58
60
  if (className) {
@@ -85,8 +87,14 @@ const CldVideoPlayer = props => {
85
87
  */
86
88
 
87
89
  const disposePlayer = () => {
88
- if (playerRef.current?.videojs?.cloudinary) {
89
- playerRef.current.videojs.cloudinary.dispose();
90
+ // React Strict Mode runs effect cleanups without removing the DOM, then reuses the same
91
+ // <video> element. Keep the player in that case; dispose() would remove the element.
92
+ if (playerVideoElementRef.current?.isConnected) return;
93
+
94
+ // dispose() on the player instance also removes it from the video.js registry,
95
+ // so a remount with the same id creates a new player instead of reusing a stale one
96
+ if (typeof playerRef.current?.dispose === 'function') {
97
+ playerRef.current.dispose();
90
98
  }
91
99
  // remove from global instances array
92
100
  playerInstances = playerInstances.filter(instanceId => instanceId !== playerId);
@@ -100,13 +108,11 @@ const CldVideoPlayer = props => {
100
108
  */
101
109
 
102
110
  const initializePlayer = () => {
103
- if (typeof window !== 'undefined' && 'cloudinary' in window && videoRef.current && !playerInitialized) {
111
+ // Check the ref, not the playerInitialized state: onLoad and onReady can both call this
112
+ // during the same render, and the state value seen there may be stale
113
+ if (typeof window !== 'undefined' && 'cloudinary' in window && videoRef.current && !playerRef.current) {
104
114
  cloudinaryRef.current = window.cloudinary;
105
-
106
- // dispose any existing player instance first to prevent conflicts
107
- if (playerRef.current) {
108
- disposePlayer();
109
- }
115
+ playerVideoElementRef.current = videoRef.current;
110
116
  playerRef.current = cloudinaryRef.current.videoPlayer(videoRef.current, playerOptions);
111
117
  setPlayerInitialized(true);
112
118
  Object.keys(events).forEach(key => {
@@ -177,7 +183,10 @@ const CldVideoPlayer = props => {
177
183
  }), /*#__PURE__*/jsxRuntime.jsx(Script__default["default"], {
178
184
  id: `cloudinary-videoplayer-${playerId}`,
179
185
  src: `https://unpkg.com/cloudinary-video-player@${PLAYER_VERSION}/dist/cld-video-player.min.js`,
180
- onLoad: handleOnLoad,
186
+ onLoad: handleOnLoad
187
+ // onReady also runs on later mounts with the same script id, where onLoad doesn't fire again
188
+ ,
189
+ onReady: handleOnLoad,
181
190
  onError: e => console.error(`Failed to load Cloudinary Video Player: ${e.message}`)
182
191
  })]
183
192
  })]
@@ -3,7 +3,7 @@ import { useId, useState, useRef, useEffect } from 'react';
3
3
  import Script from 'next/script';
4
4
  import Head from 'next/head';
5
5
  import { getVideoPlayerOptions } from '@cloudinary-util/url-loader';
6
- import { g as getCloudinaryConfig } from './cloudinary-6504bfbb.esm.js';
6
+ import { g as getCloudinaryConfig } from './cloudinary-f67b50bc.esm.js';
7
7
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
8
8
  import 'next/package.json';
9
9
 
@@ -44,6 +44,8 @@ const CldVideoPlayer = props => {
44
44
  const videoRef = props.videoRef || defaultVideoRef;
45
45
  const defaultPlayerRef = useRef(null);
46
46
  const playerRef = props.playerRef || defaultPlayerRef;
47
+ // The <video> element the player was created on (video.js keeps using it inside the player)
48
+ const playerVideoElementRef = useRef(null);
47
49
  const playerId = id || `player-${uniqueId.replace(/:/g, '')}`;
48
50
  let playerClassName = 'cld-video-player cld-fluid';
49
51
  if (className) {
@@ -76,8 +78,14 @@ const CldVideoPlayer = props => {
76
78
  */
77
79
 
78
80
  const disposePlayer = () => {
79
- if (playerRef.current?.videojs?.cloudinary) {
80
- playerRef.current.videojs.cloudinary.dispose();
81
+ // React Strict Mode runs effect cleanups without removing the DOM, then reuses the same
82
+ // <video> element. Keep the player in that case; dispose() would remove the element.
83
+ if (playerVideoElementRef.current?.isConnected) return;
84
+
85
+ // dispose() on the player instance also removes it from the video.js registry,
86
+ // so a remount with the same id creates a new player instead of reusing a stale one
87
+ if (typeof playerRef.current?.dispose === 'function') {
88
+ playerRef.current.dispose();
81
89
  }
82
90
  // remove from global instances array
83
91
  playerInstances = playerInstances.filter(instanceId => instanceId !== playerId);
@@ -91,13 +99,11 @@ const CldVideoPlayer = props => {
91
99
  */
92
100
 
93
101
  const initializePlayer = () => {
94
- if (typeof window !== 'undefined' && 'cloudinary' in window && videoRef.current && !playerInitialized) {
102
+ // Check the ref, not the playerInitialized state: onLoad and onReady can both call this
103
+ // during the same render, and the state value seen there may be stale
104
+ if (typeof window !== 'undefined' && 'cloudinary' in window && videoRef.current && !playerRef.current) {
95
105
  cloudinaryRef.current = window.cloudinary;
96
-
97
- // dispose any existing player instance first to prevent conflicts
98
- if (playerRef.current) {
99
- disposePlayer();
100
- }
106
+ playerVideoElementRef.current = videoRef.current;
101
107
  playerRef.current = cloudinaryRef.current.videoPlayer(videoRef.current, playerOptions);
102
108
  setPlayerInitialized(true);
103
109
  Object.keys(events).forEach(key => {
@@ -168,7 +174,10 @@ const CldVideoPlayer = props => {
168
174
  }), /*#__PURE__*/jsx(Script, {
169
175
  id: `cloudinary-videoplayer-${playerId}`,
170
176
  src: `https://unpkg.com/cloudinary-video-player@${PLAYER_VERSION}/dist/cld-video-player.min.js`,
171
- onLoad: handleOnLoad,
177
+ onLoad: handleOnLoad
178
+ // onReady also runs on later mounts with the same script id, where onLoad doesn't fire again
179
+ ,
180
+ onReady: handleOnLoad,
172
181
  onError: e => console.error(`Failed to load Cloudinary Video Player: ${e.message}`)
173
182
  })]
174
183
  })]
@@ -8,7 +8,7 @@ var nextPkg__default = /*#__PURE__*/_interopDefault(nextPkg);
8
8
 
9
9
  var pkg = {
10
10
  name: "next-cloudinary",
11
- version: "7.0.0-beta.15",
11
+ version: "7.0.0-beta.17",
12
12
  license: "MIT",
13
13
  repository: {
14
14
  type: "git",
@@ -66,8 +66,11 @@ var pkg = {
66
66
  vitest: "^2.0.5"
67
67
  },
68
68
  peerDependencies: {
69
- next: "^12 || ^13 || ^14 || >=15.0.0-rc || ^15 || ^16",
70
- react: "^17 || ^18 || >=19.0.0-beta || ^19"
69
+ next: "^16",
70
+ react: "^18.2.0 || ^19"
71
+ },
72
+ engines: {
73
+ node: ">=22"
71
74
  },
72
75
  preconstruct: {
73
76
  exports: {
@@ -2,7 +2,7 @@ import nextPkg from 'next/package.json';
2
2
 
3
3
  var pkg = {
4
4
  name: "next-cloudinary",
5
- version: "7.0.0-beta.15",
5
+ version: "7.0.0-beta.17",
6
6
  license: "MIT",
7
7
  repository: {
8
8
  type: "git",
@@ -60,8 +60,11 @@ var pkg = {
60
60
  vitest: "^2.0.5"
61
61
  },
62
62
  peerDependencies: {
63
- next: "^12 || ^13 || ^14 || >=15.0.0-rc || ^15 || ^16",
64
- react: "^17 || ^18 || >=19.0.0-beta || ^19"
63
+ next: "^16",
64
+ react: "^18.2.0 || ^19"
65
+ },
66
+ engines: {
67
+ node: ">=22"
65
68
  },
66
69
  preconstruct: {
67
70
  exports: {
@@ -1,5 +1,5 @@
1
1
  import { constructCloudinaryUrl } from '@cloudinary-util/url-loader';
2
- import { g as getCloudinaryConfig, a as getCloudinaryAnalytics } from './cloudinary-6504bfbb.esm.js';
2
+ import { g as getCloudinaryConfig, a as getCloudinaryAnalytics } from './cloudinary-f67b50bc.esm.js';
3
3
 
4
4
  /**
5
5
  * getCldImageUrl
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var urlLoader = require('@cloudinary-util/url-loader');
4
- var cloudinary = require('./cloudinary-fa1452e5.cjs.js');
4
+ var cloudinary = require('./cloudinary-9ac4fc0b.cjs.js');
5
5
 
6
6
  /**
7
7
  * getCldImageUrl
@@ -1 +1 @@
1
- {"version":3,"file":"CldVideoPlayer.d.ts","sourceRoot":"../../../../../src/components/CldVideoPlayer","sources":["CldVideoPlayer.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,kCAA+B;AAQ7D,QAAA,MAAM,cAAc,UAAW,mBAAmB,gCA4KjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CldVideoPlayer.d.ts","sourceRoot":"../../../../../src/components/CldVideoPlayer","sources":["CldVideoPlayer.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,kCAA+B;AAQ7D,QAAA,MAAM,cAAc,UAAW,mBAAmB,gCAoLjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -2,15 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var CldImage = require('./CldImage-3b9e9abc.cjs.js');
5
+ var CldImage = require('./CldImage-60a7d0db.cjs.js');
6
6
  var Head = require('next/head');
7
- var cloudinaryLoader = require('./cloudinary-loader-570d5c51.cjs.js');
7
+ var cloudinaryLoader = require('./cloudinary-loader-687ca5ce.cjs.js');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var CldUploadButton = require('./CldUploadButton-7867eb66.cjs.js');
10
- var CldUploadWidget = require('./CldUploadWidget-85bcec94.cjs.js');
11
- var CldVideoPlayer = require('./CldVideoPlayer-dcc1bf3e.cjs.js');
10
+ var CldUploadWidget = require('./CldUploadWidget-88b4b470.cjs.js');
11
+ var CldVideoPlayer = require('./CldVideoPlayer-076b4ecf.cjs.js');
12
12
  var urlLoader = require('@cloudinary-util/url-loader');
13
- var cloudinary = require('./cloudinary-fa1452e5.cjs.js');
13
+ var cloudinary = require('./cloudinary-9ac4fc0b.cjs.js');
14
14
  require('next/package.json');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -1,13 +1,13 @@
1
- export { default as CldImage } from './CldImage-92d58661.esm.js';
1
+ export { default as CldImage } from './CldImage-8a87ef4c.esm.js';
2
2
  import Head from 'next/head';
3
- import { g as getCldImageUrl } from './cloudinary-loader-35ab85b4.esm.js';
4
- export { c as cloudinaryLoader, g as getCldImageUrl } from './cloudinary-loader-35ab85b4.esm.js';
3
+ import { g as getCldImageUrl } from './cloudinary-loader-44025348.esm.js';
4
+ export { c as cloudinaryLoader, g as getCldImageUrl } from './cloudinary-loader-44025348.esm.js';
5
5
  import { jsxs, jsx } from 'react/jsx-runtime';
6
6
  export { default as CldUploadButton } from './CldUploadButton-8cb106b1.esm.js';
7
- export { default as CldUploadWidget } from './CldUploadWidget-8f734071.esm.js';
8
- export { default as CldVideoPlayer } from './CldVideoPlayer-3af97076.esm.js';
7
+ export { default as CldUploadWidget } from './CldUploadWidget-8c702880.esm.js';
8
+ export { default as CldVideoPlayer } from './CldVideoPlayer-77904544.esm.js';
9
9
  import { constructCloudinaryUrl } from '@cloudinary-util/url-loader';
10
- import { g as getCloudinaryConfig, a as getCloudinaryAnalytics } from './cloudinary-6504bfbb.esm.js';
10
+ import { g as getCloudinaryConfig, a as getCloudinaryAnalytics } from './cloudinary-f67b50bc.esm.js';
11
11
  import 'next/package.json';
12
12
 
13
13
  const OG_IMAGE_WIDTH = 1200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-cloudinary",
3
- "version": "7.0.0-beta.15",
3
+ "version": "7.0.0-beta.17",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,8 +58,11 @@
58
58
  "vitest": "^2.0.5"
59
59
  },
60
60
  "peerDependencies": {
61
- "next": "^12 || ^13 || ^14 || >=15.0.0-rc || ^15 || ^16",
62
- "react": "^17 || ^18 || >=19.0.0-beta || ^19"
61
+ "next": "^16",
62
+ "react": "^18.2.0 || ^19"
63
+ },
64
+ "engines": {
65
+ "node": ">=22"
63
66
  },
64
67
  "preconstruct": {
65
68
  "exports": {