@shopify/shop-minis-platform 0.10.0 → 0.12.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 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.10.0",
4
+ "version": "0.12.0",
5
5
  "description": "Shared type definitions for Shop Minis Platform",
6
6
  "main": "src/index.ts",
7
7
  "exports": {
@@ -33,8 +33,6 @@ export enum Scope {
33
33
  export const ActionToScopesMapping: {
34
34
  [key in keyof ShopActionEvents]?: Scope
35
35
  } = {
36
- // User
37
- GENERATE_USER_TOKEN: Scope.OPENID,
38
36
  GET_ACCOUNT_INFORMATION: Scope.PROFILE,
39
37
  GET_BUYER_ATTRIBUTES: Scope.PROFILE,
40
38
  GET_CURRENT_USER: Scope.USER_SETTINGS_READ,
@@ -65,3 +63,9 @@ export const ActionToScopesMapping: {
65
63
  GET_PRODUCT_LIST: Scope.PRODUCT_LIST_READ,
66
64
  GET_PRODUCT_LISTS: Scope.PRODUCT_LIST_READ,
67
65
  } as const
66
+
67
+ export const ActionToOptionalScopesMapping: {
68
+ [key in keyof ShopActionEvents]?: Scope
69
+ } = {
70
+ GENERATE_USER_TOKEN: Scope.OPENID,
71
+ } as const
@@ -1,8 +1,20 @@
1
+ // Helper type to capitalize a segment, with special handling for AR
2
+ // This matches the runtime behavior in actionTypeToMethodName
3
+ type CapitalizeSegment<S extends string> =
4
+ Uppercase<S> extends 'AR' ? 'AR' : Capitalize<Lowercase<S>>
5
+
6
+ // Helper type for tail segments (non-first words get capitalized)
7
+ type SnakeToCamelCaseTail<S extends string> =
8
+ S extends `${infer Head}_${infer Tail}`
9
+ ? `${CapitalizeSegment<Head>}${SnakeToCamelCaseTail<Tail>}`
10
+ : CapitalizeSegment<S>
11
+
1
12
  // Utility type to convert SNAKE_CASE to camelCase
2
13
  // Example: 'FOLLOW_SHOP' -> 'followShop'
14
+ // Example: 'PREVIEW_PRODUCT_IN_AR' -> 'previewProductInAR' (AR preserved)
3
15
  export type SnakeToCamelCase<S extends string> =
4
16
  S extends `${infer Head}_${infer Tail}`
5
- ? `${Lowercase<Head>}${Capitalize<SnakeToCamelCase<Tail>>}`
17
+ ? `${Lowercase<Head>}${SnakeToCamelCaseTail<Tail>}`
6
18
  : Lowercase<S>
7
19
 
8
20
  export interface ShopActionOk<T> {