Skip to content

Conversation

@fatbattk
Copy link
Contributor

@fatbattk fatbattk commented Nov 25, 2025

Closes #21032

Background

Add type definitions for Camera API

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@fatbattk
Copy link
Contributor Author

/snapit

@andy-chhuon
Copy link
Contributor

andy-chhuon commented Nov 26, 2025

Test the snapshot by updating your package.json with the newly published version:

"@shopify/ui-extensions": "0.0.0-snapshot-20251125223311"

@andy-chhuon andy-chhuon changed the title WIP Add Camera API new spec Nov 28, 2025
@andy-chhuon andy-chhuon changed the title Add Camera API new spec Add Camera API type definitions Nov 28, 2025
@andy-chhuon andy-chhuon marked this pull request as ready for review November 28, 2025 15:43
@vctrchu vctrchu requested a review from a team November 28, 2025 21:15
Copy link
Contributor

@vctrchu vctrchu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just the one comment about removing the POS GO reference

@fatbattk fatbattk force-pushed the 20644-pos-camera-api branch from d971e35 to 94bf96c Compare December 2, 2025 00:14
@andy-chhuon andy-chhuon marked this pull request as draft December 2, 2025 15:45
@fatbattk fatbattk force-pushed the 20644-pos-camera-api branch from 94bf96c to 4cf982d Compare December 2, 2025 23:36
*/
maxHeight?: number;
/**
* The quality of the image returned. Percentile value between 0 and 1.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the 0-1 based on some standards or is it made up for this?
Piggybacking off what Victor was asking I think we need to give some more context of that 0 and what 1 gives.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0-1 range (percentile/percentage) is common way to represent compression quality levels. we can add (0 = lowest quality, 1 = highest quality) here so it's clearer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the standard for image compression APIs on Native surfaces like IOS (see here)

/** The height of the image in pixels. */
height: number;
/** The file size of the image in bytes. */
fileSize: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this fileSize would change depending on the quality number correct?

Copy link
Contributor Author

@fatbattk fatbattk Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, as well as image dimensions.

/** The file size of the image in bytes. */
fileSize: number;
/** The MIME type of the image. */
type: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have this be an enum if it is MIME type?
And what is the value of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Value for type here would be, image/jpeg, image/png, etc.
Using string is preferable to a hardcoded enum since MIME types can evolve and the OS/libraries may support additional types without us needing to update an enum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless we are testing all use cases I think this is not a great idea.
It is easier to add types than to try to remove cases that don't work later.
We have a similar MIME type on embed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the MIME type value for the response and since the device took the photo, it'll always be the correct MIME value. maintaining enum would be toil here.

@andy-chhuon andy-chhuon marked this pull request as ready for review December 12, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants