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 fatbattk force-pushed the 20644-pos-camera-api branch from 4798f27 to 808eb9f Compare November 25, 2025 23:59
@fatbattk
Copy link
Contributor Author

/snapit

@andy-chhuon
Copy link
Contributor

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

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

@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
import {StandardApi} from '../standard/standard-api';
import {CameraApi} from '../camera-api/camera-api';

export type ActionTargetApi<T> = {[key: string]: any} & {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I missed it but we only want to allow the camera to be triggered from action targets? Is there a reason why we don't want the api accessible from tiles or blocks?

*/
facingMode?: 'user' | 'environment';
/**
* The maximum width (0 to 1080) of the image in pixels. Resizes the image to this width if it is larger.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be (1 to 1080)

What happens when users put a value of 0?

*/
maxWidth?: number;
/**
* The maximum height (0 to 1080) of the image in pixels. Resizes the image to this height if it is larger.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

*/
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.

Same here, whats 0 quality do?

*
* @param options the options for the camera media.
* @returns Promise<CameraMediaResponse> that resolves when the POS has necessary permissions to access the camera and the media is captured.
*/
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 be clear on the promise reject reasons? Maybe something like:

 * @throws {Error} when camera permission is denied by the user
 * @throws {Error} when the user cancels the photo capture
 * @throws {Error} when the device has no available camera

@vctrchu vctrchu requested a review from a team November 28, 2025 21:15
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.

3 participants