@shopify/shop-minis-platform 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/actions/actions.ts +6 -0
- package/src/actions/params.ts +56 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/shop-minis-platform",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"description": "Shared type definitions for Shop Minis Platform",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"exports": {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"test": "TZ=UTC jest",
|
|
24
|
-
"type-check": "
|
|
24
|
+
"type-check": "tsgo --noEmit",
|
|
25
25
|
"typecheck": "pnpm run type-check"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {},
|
|
28
28
|
"peerDependencies": {},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"typescript": "^
|
|
30
|
+
"typescript": "^6.0.3"
|
|
31
31
|
},
|
|
32
32
|
"author": "Shopify",
|
|
33
33
|
"repository": {
|
package/src/actions/actions.ts
CHANGED
|
@@ -71,6 +71,8 @@ import {
|
|
|
71
71
|
GetRecentProductsResponse,
|
|
72
72
|
GetProductSearchParams,
|
|
73
73
|
GetProductSearchResponse,
|
|
74
|
+
GetSimilarProductsParams,
|
|
75
|
+
GetSimilarProductsResponse,
|
|
74
76
|
GetProductsParams,
|
|
75
77
|
GetProductsResponse,
|
|
76
78
|
GetProductParams,
|
|
@@ -218,6 +220,10 @@ export interface ShopActionEvents {
|
|
|
218
220
|
GetProductSearchParams,
|
|
219
221
|
GetProductSearchResponse
|
|
220
222
|
>
|
|
223
|
+
GET_SIMILAR_PRODUCTS: ShopAction<
|
|
224
|
+
GetSimilarProductsParams,
|
|
225
|
+
GetSimilarProductsResponse
|
|
226
|
+
>
|
|
221
227
|
GET_PRODUCTS: ShopAction<GetProductsParams, GetProductsResponse>
|
|
222
228
|
GET_PRODUCT: ShopAction<GetProductParams, GetProductResponse>
|
|
223
229
|
GET_PRODUCT_VARIANTS: ShopAction<
|
package/src/actions/params.ts
CHANGED
|
@@ -695,6 +695,62 @@ export interface GetProductSearchResponse extends PaginatedResponse<
|
|
|
695
695
|
Product[]
|
|
696
696
|
> {}
|
|
697
697
|
|
|
698
|
+
/**
|
|
699
|
+
* Image media used as the source for similar product search.
|
|
700
|
+
* The hook handles base64 encoding from a File — partners pass a File directly,
|
|
701
|
+
* not the encoded payload.
|
|
702
|
+
*/
|
|
703
|
+
export interface GetSimilarProductsMediaInput {
|
|
704
|
+
/**
|
|
705
|
+
* The image MIME type. Currently only `image/jpeg` is supported.
|
|
706
|
+
*/
|
|
707
|
+
contentType: string
|
|
708
|
+
/**
|
|
709
|
+
* The base64-encoded image content (without `data:` prefix). Must be <= 4 MiB.
|
|
710
|
+
*/
|
|
711
|
+
base64: string
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* The source for similar product search. Exactly one of `productId`,
|
|
716
|
+
* `productVariantId`, or `media` must be provided.
|
|
717
|
+
*/
|
|
718
|
+
export interface GetSimilarProductsSourceInput {
|
|
719
|
+
/**
|
|
720
|
+
* Shopify Product GID, e.g. `gid://shopify/Product/123`.
|
|
721
|
+
*/
|
|
722
|
+
productId?: string
|
|
723
|
+
/**
|
|
724
|
+
* Shopify ProductVariant GID, e.g. `gid://shopify/ProductVariant/456`.
|
|
725
|
+
*/
|
|
726
|
+
productVariantId?: string
|
|
727
|
+
/**
|
|
728
|
+
* JPEG image media to find similar products for.
|
|
729
|
+
*/
|
|
730
|
+
media?: GetSimilarProductsMediaInput
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
export interface GetSimilarProductsParams {
|
|
734
|
+
/**
|
|
735
|
+
* Source for similar product search. Exactly one of `productId`,
|
|
736
|
+
* `productVariantId`, or `media` must be set.
|
|
737
|
+
*/
|
|
738
|
+
similarTo: GetSimilarProductsSourceInput
|
|
739
|
+
/**
|
|
740
|
+
* Number of products to return. Must be 1..10.
|
|
741
|
+
*/
|
|
742
|
+
first?: number
|
|
743
|
+
/**
|
|
744
|
+
* Cursor for pagination. Currently the backend returns only a first page,
|
|
745
|
+
* so this is effectively unused.
|
|
746
|
+
*/
|
|
747
|
+
after?: string
|
|
748
|
+
fetchPolicy?: DataHookFetchPolicy
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export interface GetSimilarProductsResponse
|
|
752
|
+
extends PaginatedResponse<Product[]> {}
|
|
753
|
+
|
|
698
754
|
export interface GetProductVariantsParams {
|
|
699
755
|
id: string
|
|
700
756
|
first?: number
|