Conversation
…adWidgetResultCallback (#165) # Description This creates a new set of helpers that will help framework libraries reduce the boilerplate needed to instantiate new instances of the upload widget. * getUploadWidgetOptions: this takes in a set of options that deal with the configuration of the upload widget, including account credentials and signature callback function * generateSignatureCallback: this generates a new callback function that given an endpoint and fetcher (like the fetch API), will make it easier to pass the resulting function to the widget options above * generateUploadWidgetResultCallback: when uploading with the widget, different events are produced depending on the state of the upload, this helps manage all of the different events via a single callback function with the ability to pass in and tap into the different events ## Issue Ticket Number Fixes #164 ## Usage ``` 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); ```
# [@cloudinary-util/url-loader-v5.4.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.3.1...@cloudinary-util/url-loader-v5.4.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/types-v1.2.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v1.1.0...@cloudinary-util/types-v1.2.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/url-loader-v5.5.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.4.0...@cloudinary-util/url-loader-v5.5.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/util-v3.2.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/util-v3.1.0...@cloudinary-util/util-v3.2.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/url-loader-v5.5.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.4.0...@cloudinary-util/url-loader-v5.5.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/util-v3.2.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/util-v3.1.0...@cloudinary-util/util-v3.2.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/types-v1.2.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v1.1.0...@cloudinary-util/types-v1.2.0-beta.1) (2024-08-02) ### Features * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
# [@cloudinary-util/url-loader-v5.5.0-beta.2](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.5.0-beta.1...@cloudinary-util/url-loader-v5.5.0-beta.2) (2024-08-02) ### Features * force version ([cb63bff](cb63bff))
# [@cloudinary-util/url-loader-v5.5.0-beta.3](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.5.0-beta.2...@cloudinary-util/url-loader-v5.5.0-beta.3) (2024-08-02) ### Features * Generative Replace Background ([#167](#167)) ([4129214](4129214))
# [@cloudinary-util/url-loader-v5.6.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.5.0...@cloudinary-util/url-loader-v5.6.0-beta.1) (2024-08-02) ### Features * force version ([cb63bff](cb63bff)) * getUploadWidgetOptions, generateSignatureCallback, generateUploadWidgetResultCallback ([#165](#165)) ([4e3adc4](4e3adc4)), closes [#164](#164)
|
I'm working on implementing these methods and thinking about the direction of In my example, Next.js, I'm using the callback methods in 2 ways, 1 as a direct callback ( here's an initial look at the implementation of this function along with the previous logic that split up these different callbacks this somewhat deters from the original simplicity goal where this requires still defining the callbacks and handling them all within a single the other point is each of the callbacks in the does this method even help? if only a little bit? it may provide a slightly cleaner interface and centralize some, but not all of the props would love your thoughts @Baroshem and @ghostdevv |
# [@cloudinary-util/url-loader-v5.6.0-beta.2](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.6.0-beta.1...@cloudinary-util/url-loader-v5.6.0-beta.2) (2024-08-06) ### Bug Fixes * updating enum value to allow for both the list of values and string ([1b4c403](1b4c403))
|
I think it's ok to have a |
|
🎉 This PR is included in version @cloudinary-util/util-v3.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [@cloudinary-util/url-loader-v5.6.0](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.5.0...@cloudinary-util/url-loader-v5.6.0) (2024-08-07) ### Bug Fixes * falsy check for replacebackground ([5574e39](5574e39)) ### Features * url-loader@5.6.0 ([#166](#166)) ([26736af](26736af)), closes [#164](#164)
|
🎉 This PR is included in version @cloudinary-util/url-loader-v5.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version @cloudinary-util/types-v1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This creates a new set of helpers that will help framework libraries reduce the boilerplate needed to instantiate new instances of the upload widget.
Issue Ticket Number
Fixes #164
Usage
Description
Issue Ticket Number
Fixes #<ISSUE_NUMBER>
Type of change
Checklist