Skip to content

[Feature] CldUploadWidget Helper Functions #226

Closed

Description

@colbyfayock

Feature Request

Is your feature request related to a problem? Please describe.

Adopt new upload widget helper functions along with other front end frameworks that consume the URL Loader API.

Via cloudinary-community/cloudinary-util#166

Example implementation: cloudinary-community/next-cloudinary#492

Describe the solution you'd like

Usage:

import { generateSignatureCallback, generateUploadWidgetResultCallback, getUploadWidgetOptions, UPLOAD_WIDGET_EVENTS } from '@cloudinary-util/url-loader'

const signatureCallback = generateSignatureCallback({
  signatureEndpoint: '/asdf',
  fetch
})

const uploadOptions = getUploadWidgetOptions({
  signatureCallback
}, {
  cloud: {
    cloudName: 'testcloud',
    apiKey: 'abcd1234'
  }
});

const resultsCallback = generateUploadWidgetResultCallback({
  onError: (uploadError) => {
    // Example on storing error
    // setError(uploadError);
  },
  onResult: (uploadResult) => {
    // Example of storing results on any event
    // setResults(uploadResult);
  },
  onSuccess: (uploadResult) => {
    // Tapping into individual events
  }
});

cloudinary.createUploadWidget(uploadOptions, resultsCallback);

// UPLOAD_WIDGET_EVENTS can replace WIDGET_EVENTS manually managed in front end code

Activity

  1. added
    enhancement
    on Aug 7, 2024
  2. added a commit that references this issue on Aug 8, 2024
  3. linked a pull request that will close this issueChore/3.1.0 #228on Aug 8, 2024
  4. Baroshem commented on Aug 8, 2024

    @Baroshem
    Collaborator

    Hey, I have added this feature in #228 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions