Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/pages/clduploadbutton/basic-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const UnsignedUpload = () => {
<>
<CldUploadButton
className={styles.button}
onUpload={(result, widget) => {
onSuccess={(result, { widget }) => {
setResource(result?.info);
widget.close();
}}
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/clduploadbutton/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const UnsignedUpload = () => {
<p>
<CldUploadButton
className={styles.button}
onUpload={(result, widget) => {
onSuccess={(result, { widget }) => {
setResource(result?.info);
widget.close();
}}
Expand Down Expand Up @@ -71,7 +71,7 @@ export const SignedUpload = () => {
<p>
<CldUploadButton
className={styles.button}
onUpload={(result, widget) => {
onSuccess={(result, { widget }) => {
setResource(result?.info);
widget.close();
}}
Expand Down
5 changes: 0 additions & 5 deletions docs/pages/clduploadwidget/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,6 @@ Server Actions workflow.
example: () => (<code>{`(results, options) => { }`}</code>),
more: () => (<a className="whitespace-nowrap" href="https://cloudinary.com/documentation/upload_widget_reference#tags">More Info</a>)
},
{
prop: 'onUpload (Deprecated)',
type: 'function',
example: () => (<code>{`(results, widget) => { }`}</code>),
},
{
prop: 'onUploadAdded',
type: 'function',
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/guides/uploading-images-and-videos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const SignedUpload = () => {
<>
<CldUploadButton
className={styles.button}
onUpload={(error, result, widget) => {
onSuccess={(result, { widget }) => {
setResource(result?.info);
widget.close();
}}
Expand Down Expand Up @@ -64,7 +64,7 @@ const [resource, setResource] = useState();

<CldUploadButton
className={styles.button}
onUpload={(error, result, widget) => {
onSuccess={(result, { widget }) => {
setResource(result?.info); // { public_id, secure_url, etc }
widget.close();
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const CldUploadButton = ({
onClick,
onError,
onOpen,
onUpload,
onAbort,
onBatchCancelled,
onClose,
Expand Down Expand Up @@ -52,7 +51,6 @@ const CldUploadButton = ({
<CldUploadWidget
onError={onError}
onOpen={onOpen}
onUpload={onUpload}
onAbort={onAbort}
onBatchCancelled={onBatchCancelled}
onClose={onClose}
Expand Down
17 changes: 0 additions & 17 deletions next-cloudinary/src/components/CldUploadWidget/CldUploadWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const CldUploadWidget = ({
config,
onError,
onOpen,
onUpload,
options,
signatureEndpoint,
uploadPreset,
Expand Down Expand Up @@ -110,22 +109,6 @@ const CldUploadWidget = ({
},
});


// Handle result states and callbacks

useEffect(() => {
if ( typeof results === 'undefined' ) return;

const isSuccess = results.event === 'success';

if ( isSuccess && typeof onUpload === 'function' ) {
if ( process.env.NODE_ENV === 'development' ) {
console.warn('The onUpload callback is deprecated. Please use onSuccess instead.');
}
onUpload(results, widget.current);
}
}, [results])

/**
* handleOnLoad
* @description Stores the Cloudinary window instance to a ref when the widget script loads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export interface CldUploadWidgetProps {
config?: ConfigOptions;
onError?: CldUploadEventCallbackError;
onOpen?: CldUploadEventCallbackWidgetOnly;
/**
* @deprecated use onSuccess instead
*/
onUpload?: CldUploadEventCallbackNoOptions;
onAbort?: CldUploadEventCallback;
onBatchCancelled?: CldUploadEventCallback;
onClose?: CldUploadEventCallback;
Expand Down Expand Up @@ -60,7 +56,6 @@ export type CldUploadWidgetPropsChildren = {

export type CldUploadEventCallback = (results: CloudinaryUploadWidgetResults, widget: CldUploadEventCallbackWidget) => void;
export type CldUploadEventAction = (results: CloudinaryUploadWidgetResults) => void;
export type CldUploadEventCallbackNoOptions = (results: CloudinaryUploadWidgetResults, widget: CldUploadWidgetWidgetInstance) => void;
export type CldUploadEventCallbackWidgetOnly = (widget: CldUploadWidgetWidgetInstance) => void;
export type CldUploadEventCallbackError = (error: CloudinaryUploadWidgetError, widget: CldUploadEventCallbackWidget) => void;

Expand Down
Loading