-
Notifications
You must be signed in to change notification settings - Fork 52
Add Camera API type definitions #3597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2026-01-rc
Are you sure you want to change the base?
Conversation
Co-authored-by: Han T. <[email protected]>
4798f27 to
808eb9f
Compare
|
/snapit |
|
Test the snapshot by updating your "@shopify/ui-extensions": "0.0.0-snapshot-20251126141902" |
| import {StandardApi} from '../standard/standard-api'; | ||
| import {CameraApi} from '../camera-api/camera-api'; | ||
|
|
||
| export type ActionTargetApi<T> = {[key: string]: any} & { |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. | ||
| */ |
There was a problem hiding this comment.
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
Closes #21032
Background
Add type definitions for Camera API
Checklist