@shopify/shop-minis-platform 0.15.1 → 0.17.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 +1 -1
- package/src/actions/actions.ts +8 -0
- package/src/actions/params.ts +48 -24
- package/src/types/product.ts +7 -0
package/package.json
CHANGED
package/src/actions/actions.ts
CHANGED
|
@@ -96,6 +96,9 @@ import {
|
|
|
96
96
|
RequestPermissionResponse,
|
|
97
97
|
CheckPermissionParams,
|
|
98
98
|
CheckPermissionResponse,
|
|
99
|
+
CheckScopesConsentParams,
|
|
100
|
+
CheckScopesConsentResponse,
|
|
101
|
+
RequestScopesConsentResponse,
|
|
99
102
|
ReportErrorParams,
|
|
100
103
|
ReportFetchParams,
|
|
101
104
|
} from './params'
|
|
@@ -239,6 +242,11 @@ export interface ShopActionEvents {
|
|
|
239
242
|
RequestPermissionResponse
|
|
240
243
|
>
|
|
241
244
|
CHECK_PERMISSION: ShopAction<CheckPermissionParams, CheckPermissionResponse>
|
|
245
|
+
CHECK_SCOPES_CONSENT: ShopAction<
|
|
246
|
+
CheckScopesConsentParams,
|
|
247
|
+
{data: CheckScopesConsentResponse}
|
|
248
|
+
>
|
|
249
|
+
REQUEST_SCOPES_CONSENT: ShopAction<void, RequestScopesConsentResponse>
|
|
242
250
|
REPORT_ERROR: ShopAction<ReportErrorParams, void>
|
|
243
251
|
REPORT_FETCH: ShopAction<ReportFetchParams, void>
|
|
244
252
|
INVOKE_INTENT: ShopAction<InvokeIntentParams, InvokeIntentResponse>
|
package/src/actions/params.ts
CHANGED
|
@@ -61,6 +61,20 @@ export interface CheckPermissionResponse {
|
|
|
61
61
|
errorMessage?: string
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
export interface CheckScopesConsentParams {
|
|
65
|
+
fetchPolicy?: DataHookFetchPolicy
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CheckScopesConsentResponse {
|
|
69
|
+
requiredScopes: string[]
|
|
70
|
+
grantedScopes: string[]
|
|
71
|
+
status: 'granted' | 'partially_granted' | 'not_granted'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface RequestScopesConsentResponse {
|
|
75
|
+
granted: boolean
|
|
76
|
+
}
|
|
77
|
+
|
|
64
78
|
export interface FavoriteParams {
|
|
65
79
|
shopId: string
|
|
66
80
|
productId: string
|
|
@@ -304,19 +318,22 @@ export interface PaginatedResponse<T> {
|
|
|
304
318
|
pageInfo: PaginationInfo
|
|
305
319
|
}
|
|
306
320
|
|
|
307
|
-
export interface GetProductListsResponse
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
321
|
+
export interface GetProductListsResponse extends PaginatedResponse<
|
|
322
|
+
ProductList[]
|
|
323
|
+
> {}
|
|
324
|
+
export interface GetProductListResponse extends PaginatedResponse<ProductList | null> {}
|
|
311
325
|
|
|
312
|
-
export interface GetRecommendedProductsResponse
|
|
313
|
-
|
|
326
|
+
export interface GetRecommendedProductsResponse extends PaginatedResponse<
|
|
327
|
+
Product[]
|
|
328
|
+
> {}
|
|
314
329
|
|
|
315
|
-
export interface GetRecommendedShopsResponse
|
|
316
|
-
|
|
330
|
+
export interface GetRecommendedShopsResponse extends PaginatedResponse<
|
|
331
|
+
Shop[]
|
|
332
|
+
> {}
|
|
317
333
|
|
|
318
|
-
export interface SearchProductsByShopResponse
|
|
319
|
-
|
|
334
|
+
export interface SearchProductsByShopResponse extends PaginatedResponse<
|
|
335
|
+
Product[]
|
|
336
|
+
> {}
|
|
320
337
|
|
|
321
338
|
export interface GetBuyerAttributesResponse {
|
|
322
339
|
data: {
|
|
@@ -546,8 +563,9 @@ export interface GetPopularProductsParams {
|
|
|
546
563
|
fetchPolicy?: DataHookFetchPolicy
|
|
547
564
|
}
|
|
548
565
|
|
|
549
|
-
export interface GetPopularProductsResponse
|
|
550
|
-
|
|
566
|
+
export interface GetPopularProductsResponse extends PaginatedResponse<
|
|
567
|
+
Product[]
|
|
568
|
+
> {}
|
|
551
569
|
|
|
552
570
|
export interface PreviewProductInARParams {
|
|
553
571
|
id: string
|
|
@@ -561,8 +579,9 @@ export interface GetProductMediaParams {
|
|
|
561
579
|
fetchPolicy?: DataHookFetchPolicy
|
|
562
580
|
}
|
|
563
581
|
|
|
564
|
-
export interface GetProductMediaResponse
|
|
565
|
-
|
|
582
|
+
export interface GetProductMediaResponse extends PaginatedResponse<
|
|
583
|
+
ProductMedia[]
|
|
584
|
+
> {}
|
|
566
585
|
|
|
567
586
|
export interface GetProductReviewsParams {
|
|
568
587
|
id: string
|
|
@@ -571,8 +590,9 @@ export interface GetProductReviewsParams {
|
|
|
571
590
|
fetchPolicy?: DataHookFetchPolicy
|
|
572
591
|
}
|
|
573
592
|
|
|
574
|
-
export interface GetProductReviewsResponse
|
|
575
|
-
|
|
593
|
+
export interface GetProductReviewsResponse extends PaginatedResponse<
|
|
594
|
+
ProductReview[]
|
|
595
|
+
> {}
|
|
576
596
|
|
|
577
597
|
export interface GetShopParams {
|
|
578
598
|
id: string
|
|
@@ -646,8 +666,9 @@ export interface GetSavedProductsParams {
|
|
|
646
666
|
fetchPolicy?: DataHookFetchPolicy
|
|
647
667
|
}
|
|
648
668
|
|
|
649
|
-
export interface GetSavedProductsResponse
|
|
650
|
-
|
|
669
|
+
export interface GetSavedProductsResponse extends PaginatedResponse<
|
|
670
|
+
Product[]
|
|
671
|
+
> {}
|
|
651
672
|
|
|
652
673
|
export interface GetRecentProductsParams {
|
|
653
674
|
includeSensitive?: boolean
|
|
@@ -656,8 +677,9 @@ export interface GetRecentProductsParams {
|
|
|
656
677
|
fetchPolicy?: DataHookFetchPolicy
|
|
657
678
|
}
|
|
658
679
|
|
|
659
|
-
export interface GetRecentProductsResponse
|
|
660
|
-
|
|
680
|
+
export interface GetRecentProductsResponse extends PaginatedResponse<
|
|
681
|
+
Product[]
|
|
682
|
+
> {}
|
|
661
683
|
|
|
662
684
|
export interface GetProductSearchParams {
|
|
663
685
|
query: string
|
|
@@ -669,8 +691,9 @@ export interface GetProductSearchParams {
|
|
|
669
691
|
fetchPolicy?: DataHookFetchPolicy
|
|
670
692
|
}
|
|
671
693
|
|
|
672
|
-
export interface GetProductSearchResponse
|
|
673
|
-
|
|
694
|
+
export interface GetProductSearchResponse extends PaginatedResponse<
|
|
695
|
+
Product[]
|
|
696
|
+
> {}
|
|
674
697
|
|
|
675
698
|
export interface GetProductVariantsParams {
|
|
676
699
|
id: string
|
|
@@ -679,8 +702,9 @@ export interface GetProductVariantsParams {
|
|
|
679
702
|
fetchPolicy?: DataHookFetchPolicy
|
|
680
703
|
}
|
|
681
704
|
|
|
682
|
-
export interface GetProductVariantsResponse
|
|
683
|
-
|
|
705
|
+
export interface GetProductVariantsResponse extends PaginatedResponse<
|
|
706
|
+
ProductVariant[]
|
|
707
|
+
> {}
|
|
684
708
|
|
|
685
709
|
export interface CreateContentParams {
|
|
686
710
|
title: string
|
package/src/types/product.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface ProductVariant {
|
|
|
17
17
|
id: string
|
|
18
18
|
title: string
|
|
19
19
|
isFavorited: boolean
|
|
20
|
+
/**
|
|
21
|
+
* Whether the variant can be purchased. When `false`, calls to add the variant
|
|
22
|
+
* to cart or buy it through the SDK will fail. UI should be gated on this flag.
|
|
23
|
+
* May be `undefined` if the variant was sourced from an API that does not
|
|
24
|
+
* expose stock state.
|
|
25
|
+
*/
|
|
26
|
+
availableForSale: boolean
|
|
20
27
|
image?: ProductImage | null
|
|
21
28
|
price: Money
|
|
22
29
|
compareAtPrice?: Money | null
|