@shopify/shop-minis-cli 0.0.83 → 0.0.84

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.
Files changed (94) hide show
  1. package/build/commands/codemod/releases/index.js +2 -0
  2. package/build/commands/codemod/releases/index.js.map +1 -1
  3. package/build/commands/codemod/releases/v0-0-84.d.ts +3 -0
  4. package/build/commands/codemod/releases/v0-0-84.js +41 -0
  5. package/build/commands/codemod/releases/v0-0-84.js.map +1 -0
  6. package/build/commands/create-mini/index.js +0 -10
  7. package/build/commands/create-mini/index.js.map +1 -1
  8. package/build/commands/generate-graphql-types/index.js +1 -1
  9. package/build/commands/generate-graphql-types/index.js.map +1 -1
  10. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.d.ts +151 -1
  11. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js +4 -0
  12. package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
  13. package/package.json +1 -1
  14. package/templates/__template_common/.eslintrc.js +1 -1
  15. package/templates/__template_hello_world/src/assets/Modal-component-thumbnail.png +0 -0
  16. package/templates/__template_hello_world/src/assets/ProductCard-component-thumbnail.png +0 -0
  17. package/templates/__template_hello_world/src/assets/ProductLink-component-thumbnail.png +0 -0
  18. package/templates/__template_hello_world/src/assets/assets.d.ts +0 -4
  19. package/templates/__template_hello_world/src/assets/figma-logo.svg +0 -14
  20. package/templates/__template_hello_world/src/assets/shop-minis-logo.svg +0 -7
  21. package/templates/__template_hello_world/src/components/ButtonCTA.tsx +0 -31
  22. package/templates/__template_hello_world/src/components/ComponentLink.ts +0 -94
  23. package/templates/__template_hello_world/src/components/ComponentListItem.tsx +0 -39
  24. package/templates/__template_hello_world/src/components/FeaturedComponents.tsx +0 -110
  25. package/templates/__template_hello_world/src/components/Header.tsx +0 -40
  26. package/templates/__template_hello_world/src/components/quiz/ImageCarouselSlide.tsx +0 -54
  27. package/templates/__template_hello_world/src/components/quiz/MultipleChoiceSlide.tsx +0 -77
  28. package/templates/__template_hello_world/src/components/quiz/QuizProvider.tsx +0 -64
  29. package/templates/__template_hello_world/src/components/quiz/QuizSlide.tsx +0 -79
  30. package/templates/__template_hello_world/src/components/quiz/QuizSlideCommander.tsx +0 -35
  31. package/templates/__template_hello_world/src/components/quiz/TextFieldSlide.tsx +0 -84
  32. package/templates/__template_hello_world/src/components/quiz/TextSlide.tsx +0 -6
  33. package/templates/__template_hello_world/src/components/quiz/types.ts +0 -72
  34. package/templates/__template_hello_world/src/data/Test.graphql +0 -33
  35. package/templates/__template_hello_world/src/data/Test.graphql.d.ts +0 -107
  36. package/templates/__template_hello_world/src/data/TestProducts.graphql +0 -64
  37. package/templates/__template_hello_world/src/data/TestProducts.graphql.d.ts +0 -197
  38. package/templates/__template_hello_world/src/fixtures/mocked-products-with-variants.ts +0 -274
  39. package/templates/__template_hello_world/src/hooks/useQuizData.ts +0 -26
  40. package/templates/__template_hello_world/src/hooks/useQuizState.ts +0 -27
  41. package/templates/__template_hello_world/src/index.tsx +0 -10
  42. package/templates/__template_hello_world/src/routes.tsx +0 -149
  43. package/templates/__template_hello_world/src/screens/AccordionScreen.tsx +0 -73
  44. package/templates/__template_hello_world/src/screens/AvatarScreen.tsx +0 -95
  45. package/templates/__template_hello_world/src/screens/BottomSheetScreen.tsx +0 -712
  46. package/templates/__template_hello_world/src/screens/ButtonsScreen.tsx +0 -90
  47. package/templates/__template_hello_world/src/screens/GridScreen.tsx +0 -74
  48. package/templates/__template_hello_world/src/screens/HomeScreen.tsx +0 -81
  49. package/templates/__template_hello_world/src/screens/IconsScreen.tsx +0 -181
  50. package/templates/__template_hello_world/src/screens/ImageMultipleChoiceScreen.tsx +0 -145
  51. package/templates/__template_hello_world/src/screens/InputScreen.tsx +0 -149
  52. package/templates/__template_hello_world/src/screens/MediaScreen.tsx +0 -130
  53. package/templates/__template_hello_world/src/screens/ModalScreen.tsx +0 -379
  54. package/templates/__template_hello_world/src/screens/MultipleChoiceScreen.tsx +0 -75
  55. package/templates/__template_hello_world/src/screens/ProductCardGridScreen.tsx +0 -68
  56. package/templates/__template_hello_world/src/screens/ProductCardScreen.tsx +0 -62
  57. package/templates/__template_hello_world/src/screens/ProductLinkScreen.tsx +0 -215
  58. package/templates/__template_hello_world/src/screens/ProgressIndicatorScreen.tsx +0 -77
  59. package/templates/__template_hello_world/src/screens/QuantityPickerScreen.tsx +0 -76
  60. package/templates/__template_hello_world/src/screens/QuizResultScreen.tsx +0 -82
  61. package/templates/__template_hello_world/src/screens/QuizScreen.tsx +0 -40
  62. package/templates/__template_hello_world/src/screens/QuizSlideScreen.tsx +0 -150
  63. package/templates/__template_hello_world/src/screens/ShopActionsScreen.tsx +0 -48
  64. package/templates/__template_hello_world/src/screens/SpinnerScreen.tsx +0 -63
  65. package/templates/__template_hello_world/src/screens/TypographyScreen.tsx +0 -274
  66. package/templates/__template_hello_world/src/screens/VariantPickerScreen.tsx +0 -120
  67. package/templates/__template_hello_world/src/screens/WebViewScreen.tsx +0 -42
  68. package/templates/__template_hello_world/src/types.ts +0 -31
  69. package/templates/__template_hello_world/src/utils/getFlagEmoji.ts +0 -7
  70. package/templates/__template_hello_world/src/utils/mockQuizData.ts +0 -330
  71. package/templates/__template_hello_world/src/utils/quizUtils.ts +0 -75
  72. package/templates/__template_snowboardz/src/assets/assets.d.ts +0 -4
  73. package/templates/__template_snowboardz/src/assets/circle-blue.svg +0 -9
  74. package/templates/__template_snowboardz/src/assets/circle-green.svg +0 -9
  75. package/templates/__template_snowboardz/src/assets/circle-purple.svg +0 -9
  76. package/templates/__template_snowboardz/src/assets/circle-rainbow.svg +0 -34
  77. package/templates/__template_snowboardz/src/assets/circle-red.svg +0 -9
  78. package/templates/__template_snowboardz/src/assets/circle-yellow.svg +0 -9
  79. package/templates/__template_snowboardz/src/assets/skill-level-icon-advanced.svg +0 -3
  80. package/templates/__template_snowboardz/src/assets/skill-level-icon-beginner.svg +0 -3
  81. package/templates/__template_snowboardz/src/assets/skill-level-icon-intermediate.svg +0 -3
  82. package/templates/__template_snowboardz/src/components/ColorButton.tsx +0 -79
  83. package/templates/__template_snowboardz/src/components/ColorPicker.tsx +0 -40
  84. package/templates/__template_snowboardz/src/components/EmptyResult.tsx +0 -52
  85. package/templates/__template_snowboardz/src/components/SkillLevelIcon.tsx +0 -41
  86. package/templates/__template_snowboardz/src/components/SkillLevelPicker.tsx +0 -92
  87. package/templates/__template_snowboardz/src/data/TestProducts.graphql +0 -34
  88. package/templates/__template_snowboardz/src/data/TestProducts.graphql.d.ts +0 -118
  89. package/templates/__template_snowboardz/src/hooks/useSnowboardData.tsx +0 -37
  90. package/templates/__template_snowboardz/src/index.tsx +0 -10
  91. package/templates/__template_snowboardz/src/routes.tsx +0 -17
  92. package/templates/__template_snowboardz/src/screens/HomeScreen.tsx +0 -126
  93. package/templates/__template_snowboardz/src/types.ts +0 -12
  94. package/templates/__template_snowboardz/src/utils.ts +0 -17
@@ -1,274 +0,0 @@
1
- const BASE_PRODUCT = {
2
- __typename: 'Product',
3
- id: 'gid://shopify/Product/7632803594495',
4
- title: 'Canvas Shoes',
5
- featuredImage: {
6
- __typename: 'Image',
7
- id: 'gid://shopify/ProductImage/37069008929023',
8
- altText: null,
9
- url: 'https://cdn.shopify.com/s/files/1/0621/0463/3599/products/mahabis-footwear-dv5AJQJ6ay8-unsplash.jpg?v=1651848310',
10
- },
11
- } as const
12
-
13
- const BASE_VARIANT = {
14
- __typename: 'ProductVariant',
15
- image: {
16
- __typename: 'Image',
17
- id: 'gid://shopify/ProductImage/39889211949311',
18
- altText: null,
19
- url: 'https://cdn.shopify.com/s/files/1/0621/0463/3599/files/518DoMlGnHL._AC_SY695._SX._UX._SY._UY.jpg?v=1687945939',
20
- },
21
- price: {
22
- __typename: 'Money',
23
- amount: '899.0',
24
- currencyCode: 'USD',
25
- },
26
- }
27
-
28
- function createVariantForOptions(
29
- optionEntries: [optionName: string, optionValue: string][],
30
- {currentlyNotInStock = false, availableForSale = true} = {}
31
- ) {
32
- return {
33
- ...BASE_VARIANT,
34
- id: `gid://shopify/ProductVariant/${optionEntries
35
- .map(([, value]) => value)
36
- .join('')}`,
37
- selectedOptions: optionEntries.map(([name, value]) => ({
38
- __typename: 'SelectedOption',
39
- name,
40
- value,
41
- })),
42
- title: optionEntries.map(([, value]) => value).join(' / '),
43
- currentlyNotInStock,
44
- availableForSale,
45
- }
46
- }
47
-
48
- const BASE_VARIANTS_CONFIG: [string, string][][] = [
49
- [
50
- ['Size', '43'],
51
- ['Color', 'Black'],
52
- ],
53
- [
54
- ['Size', '43'],
55
- ['Color', 'Red'],
56
- ],
57
- [
58
- ['Size', '43'],
59
- ['Color', 'White'],
60
- ],
61
- [
62
- ['Size', '44'],
63
- ['Color', 'Black'],
64
- ],
65
- [
66
- ['Size', '44'],
67
- ['Color', 'Red'],
68
- ],
69
- [
70
- ['Size', '44'],
71
- ['Color', 'White'],
72
- ],
73
- [
74
- ['Size', '45'],
75
- ['Color', 'Black'],
76
- ],
77
- [
78
- ['Size', '45'],
79
- ['Color', 'Red'],
80
- ],
81
- [
82
- ['Size', '45'],
83
- ['Color', 'White'],
84
- ],
85
- ]
86
-
87
- const MOCKED_PRODUCT_1_DISABLED_VARIANTS = [
88
- ['43', 'Black'],
89
- ['44', 'White'],
90
- ['44', 'Red'],
91
- ['45', 'Red'],
92
- ]
93
-
94
- /**
95
- * 2 options: size, color
96
- *
97
- * all variants available except:
98
- * variant with size 45 and color white is not available for sale
99
- */
100
- export const MOCKED_PRODUCT_1 = {
101
- ...BASE_PRODUCT,
102
- options: [
103
- {
104
- __typename: 'ProductOption',
105
- id: 'gid://shopify/ProductOption/9702957383935',
106
- name: 'Size',
107
- values: [
108
- '40',
109
- '43',
110
- '44',
111
- '45',
112
- '46',
113
- '47',
114
- '48',
115
- '49',
116
- '50',
117
- '51',
118
- '52',
119
- '53',
120
- '54',
121
- '55',
122
- ],
123
- },
124
- {
125
- __typename: 'ProductOption',
126
- id: 'gid://shopify/ProductOption/10355959628031',
127
- name: 'Color',
128
- values: ['Black', 'Red', 'White'],
129
- },
130
- ],
131
- variants: {
132
- __typename: 'ProductVariantConnection',
133
- nodes: [
134
- // Standard options
135
- ...BASE_VARIANTS_CONFIG.map(options => createVariantForOptions(options)),
136
- // Use many sizes for black
137
- createVariantForOptions([
138
- ['Size', '55'],
139
- ['Color', 'Black'],
140
- ]),
141
- createVariantForOptions([
142
- ['Size', '54'],
143
- ['Color', 'Black'],
144
- ]),
145
- createVariantForOptions([
146
- ['Size', '53'],
147
- ['Color', 'Black'],
148
- ]),
149
- createVariantForOptions([
150
- ['Size', '52'],
151
- ['Color', 'Black'],
152
- ]),
153
- createVariantForOptions([
154
- ['Size', '51'],
155
- ['Color', 'Black'],
156
- ]),
157
- createVariantForOptions([
158
- ['Size', '50'],
159
- ['Color', 'Black'],
160
- ]),
161
- createVariantForOptions([
162
- ['Size', '49'],
163
- ['Color', 'Black'],
164
- ]),
165
- createVariantForOptions([
166
- ['Size', '48'],
167
- ['Color', 'Black'],
168
- ]),
169
- createVariantForOptions([
170
- ['Size', '47'],
171
- ['Color', 'Black'],
172
- ]),
173
- createVariantForOptions([
174
- ['Size', '46'],
175
- ['Color', 'Black'],
176
- ]),
177
- ].map(variant => {
178
- MOCKED_PRODUCT_1_DISABLED_VARIANTS.forEach(variantOptions =>
179
- makeVariantNotAvailableForSale(variant, variantOptions)
180
- )
181
-
182
- return variant
183
- }),
184
- },
185
- defaultVariant: createVariantForOptions([
186
- ['Size', '43'],
187
- ['Color', 'White'],
188
- ]),
189
- }
190
-
191
- export const MOCKED_PRODUCT_1_DESCRIPTION = `Product with variants by size and color.\n* Sizes >45 only have Black color\n* Not available for sale: ${MOCKED_PRODUCT_1_DISABLED_VARIANTS.join(
192
- ' - '
193
- )}`
194
-
195
- const MOCKED_PRODUCT_2_DISABLED_VARIANTS = [
196
- ['45', 'Red', 'Warm'],
197
- ['44', 'White', 'Cool'],
198
- ['43', 'Black', 'Warm'],
199
- ['44', 'Red', 'Extra Warm'],
200
- ]
201
-
202
- /**
203
- * 3 options: size, color and warmth
204
- */
205
- export const MOCKED_PRODUCT_2 = {
206
- ...BASE_PRODUCT,
207
- options: [
208
- {
209
- __typename: 'ProductOption',
210
- id: 'gid://shopify/ProductOption/9702957383935',
211
- name: 'Size',
212
- values: ['43', '44', '45'],
213
- },
214
- {
215
- __typename: 'ProductOption',
216
- id: 'gid://shopify/ProductOption/10355959628031',
217
- name: 'Color',
218
- values: ['Black', 'Red', 'White'],
219
- },
220
- {
221
- __typename: 'ProductOption',
222
- id: 'gid://shopify/ProductOption/WARMTH',
223
- name: 'Warmth',
224
- values: ['Cool', 'Warm', 'Extra Warm'],
225
- },
226
- ],
227
- variants: {
228
- __typename: 'ProductVariantConnection',
229
- nodes: [
230
- // Add warmth variants
231
- ...BASE_VARIANTS_CONFIG.map(options => [
232
- ...options,
233
- ['Warmth', 'Cool'],
234
- ]).map(options => createVariantForOptions(options as [string, string][])),
235
- ...BASE_VARIANTS_CONFIG.map(options => [
236
- ...options,
237
- ['Warmth', 'Warm'],
238
- ]).map(options => createVariantForOptions(options as [string, string][])),
239
- ...BASE_VARIANTS_CONFIG.map(options => [
240
- ...options,
241
- ['Warmth', 'Extra Warm'],
242
- ]).map(options => createVariantForOptions(options as [string, string][])),
243
- ].map(variant => {
244
- // make some variants not available for sale
245
- MOCKED_PRODUCT_2_DISABLED_VARIANTS.forEach(variantOptions =>
246
- makeVariantNotAvailableForSale(variant, variantOptions)
247
- )
248
- return variant
249
- }),
250
- },
251
- defaultVariant: createVariantForOptions([
252
- ['Size', '43'],
253
- ['Color', 'White'],
254
- ['Warmth', 'Cool'],
255
- ]),
256
- }
257
-
258
- export const MOCKED_PRODUCT_2_DESCRIPTION = `Product with variants by size, color and warmth.\n* Not available for sale: ${MOCKED_PRODUCT_2_DISABLED_VARIANTS.join(
259
- ' - '
260
- )}`
261
-
262
- function makeVariantNotAvailableForSale(
263
- variant: ReturnType<typeof createVariantForOptions>,
264
- optionValues: string[]
265
- ) {
266
- if (
267
- optionValues.every(optionValue =>
268
- variant.selectedOptions.find((opt: any) => opt.value === optionValue)
269
- )
270
- ) {
271
- variant.availableForSale = false
272
- }
273
- return variant
274
- }
@@ -1,26 +0,0 @@
1
- import {useEffect, useState} from 'react'
2
-
3
- import {QuizData, QuizDataState} from '../components/quiz/types'
4
- import {mockQuizData} from '../utils/mockQuizData'
5
-
6
- const MOCK_FETCH_TIME = 2000
7
-
8
- export const useQuizData = () => {
9
- const [quizDataState, setQuizDataState] = useState<QuizDataState>('Loading')
10
- const [quizData, setQuizData] = useState<QuizData>()
11
-
12
- // Here is where you would fetch the quesitons from your server
13
- // and process them into the shape you need
14
- useEffect(() => {
15
- const timer = setTimeout(() => {
16
- setQuizData(mockQuizData)
17
- setQuizDataState('Ready')
18
- }, MOCK_FETCH_TIME)
19
- return () => clearTimeout(timer)
20
- }, [])
21
-
22
- return {
23
- quizDataState,
24
- quizData,
25
- }
26
- }
@@ -1,27 +0,0 @@
1
- import {useCallback, useState} from 'react'
2
-
3
- import {QuizResult, QuizResultEntry} from '../components/quiz/types'
4
-
5
- export const useQuizState = () => {
6
- const [userName, setUserName] = useState('you')
7
-
8
- const [quizResult, setQuizResult] = useState<QuizResult>()
9
-
10
- const recordQuestionResult = useCallback(
11
- (id: string, answer: QuizResultEntry) => {
12
- const newQuizResult = {
13
- ...quizResult,
14
- [id]: answer,
15
- }
16
- setQuizResult(newQuizResult)
17
- },
18
- [quizResult]
19
- )
20
-
21
- return {
22
- recordQuestionResult,
23
- quizResult,
24
- setUserName,
25
- userName,
26
- }
27
- }
@@ -1,10 +0,0 @@
1
- import {MiniAppConfig} from '@shopify/shop-minis-platform-sdk'
2
-
3
- import {__MINI_APP_NAME_PASCAL_CASE__Navigator} from './routes'
4
-
5
- const config: MiniAppConfig = {
6
- name: '__MINI_APP_NAME__',
7
- Root: __MINI_APP_NAME_PASCAL_CASE__Navigator,
8
- }
9
-
10
- export default config
@@ -1,149 +0,0 @@
1
- import {createNativeStackNavigator} from '@react-navigation/native-stack'
2
-
3
- import {HomeScreen} from './screens/HomeScreen'
4
- import {AvatarScreen} from './screens/AvatarScreen'
5
- import {BottomSheetScreen} from './screens/BottomSheetScreen'
6
- import {ButtonsScreen} from './screens/ButtonsScreen'
7
- import {GridScreen} from './screens/GridScreen'
8
- import {IconsScreen} from './screens/IconsScreen'
9
- import {MediaScreen} from './screens/MediaScreen'
10
- import {ProgressIndicatorScreen} from './screens/ProgressIndicatorScreen'
11
- import {SpinnerScreen} from './screens/SpinnerScreen'
12
- import {TypographyScreen} from './screens/TypographyScreen'
13
- import {QuantityPickerScreen} from './screens/QuantityPickerScreen'
14
- import {VariantPickerScreen} from './screens/VariantPickerScreen'
15
- import {WebViewScreen} from './screens/WebViewScreen'
16
- import {ModalScreen} from './screens/ModalScreen'
17
- import {ProductLinkScreen} from './screens/ProductLinkScreen'
18
- import {ProductCardScreen} from './screens/ProductCardScreen'
19
- import {ProductCardGridScreen} from './screens/ProductCardGridScreen'
20
- import {InputScreen} from './screens/InputScreen'
21
- import {MultipleChoiceScreen} from './screens/MultipleChoiceScreen'
22
- import {QuizScreen} from './screens/QuizScreen'
23
- import {ImageMultipleChoiceScreen} from './screens/ImageMultipleChoiceScreen'
24
- import {AccordionScreen} from './screens/AccordionScreen'
25
- import {ShopActionsScreen} from './screens/ShopActionsScreen'
26
-
27
- const Stack = createNativeStackNavigator()
28
-
29
- export const __MINI_APP_NAME_PASCAL_CASE__Navigator = () => {
30
- return (
31
- <Stack.Navigator>
32
- <Stack.Screen
33
- name="__MINI_APP_NAME_PASCAL_CASE__.Home"
34
- component={HomeScreen}
35
- options={{headerShown: false}}
36
- />
37
- <Stack.Screen
38
- name="__MINI_APP_NAME_PASCAL_CASE__.Avatar"
39
- component={AvatarScreen}
40
- options={{headerShown: false}}
41
- />
42
- <Stack.Screen
43
- name="__MINI_APP_NAME_PASCAL_CASE__.BottomSheet"
44
- component={BottomSheetScreen}
45
- options={{headerShown: false}}
46
- />
47
- <Stack.Screen
48
- name="__MINI_APP_NAME_PASCAL_CASE__.Buttons"
49
- component={ButtonsScreen}
50
- options={{headerShown: false}}
51
- />
52
- <Stack.Screen
53
- name="__MINI_APP_NAME_PASCAL_CASE__.Grid"
54
- component={GridScreen}
55
- options={{headerShown: false}}
56
- />
57
- <Stack.Screen
58
- name="__MINI_APP_NAME_PASCAL_CASE__.Icons"
59
- component={IconsScreen}
60
- options={{headerShown: false}}
61
- />
62
- <Stack.Screen
63
- name="__MINI_APP_NAME_PASCAL_CASE__.Media"
64
- component={MediaScreen}
65
- options={{headerShown: false}}
66
- />
67
- <Stack.Screen
68
- name="__MINI_APP_NAME_PASCAL_CASE__.ProgressIndicator"
69
- component={ProgressIndicatorScreen}
70
- options={{headerShown: false}}
71
- />
72
- <Stack.Screen
73
- name="__MINI_APP_NAME_PASCAL_CASE__.Spinner"
74
- component={SpinnerScreen}
75
- options={{headerShown: false}}
76
- />
77
- <Stack.Screen
78
- name="__MINI_APP_NAME_PASCAL_CASE__.Typography"
79
- component={TypographyScreen}
80
- options={{headerShown: false}}
81
- />
82
- <Stack.Screen
83
- name="__MINI_APP_NAME_PASCAL_CASE__.QuantityPicker"
84
- component={QuantityPickerScreen}
85
- options={{headerShown: false}}
86
- />
87
- <Stack.Screen
88
- name="__MINI_APP_NAME_PASCAL_CASE__.VariantPicker"
89
- component={VariantPickerScreen}
90
- options={{headerShown: false}}
91
- />
92
- <Stack.Screen
93
- name="__MINI_APP_NAME_PASCAL_CASE__.WebView"
94
- component={WebViewScreen}
95
- options={{headerShown: false}}
96
- />
97
- <Stack.Screen
98
- name="__MINI_APP_NAME_PASCAL_CASE__.Modal"
99
- component={ModalScreen}
100
- options={{headerShown: false}}
101
- />
102
- <Stack.Screen
103
- name="__MINI_APP_NAME_PASCAL_CASE__.ProductLink"
104
- component={ProductLinkScreen}
105
- options={{headerShown: false}}
106
- />
107
- <Stack.Screen
108
- name="__MINI_APP_NAME_PASCAL_CASE__.ProductCard"
109
- component={ProductCardScreen}
110
- options={{headerShown: false}}
111
- />
112
- <Stack.Screen
113
- name="__MINI_APP_NAME_PASCAL_CASE__.ProductCardGrid"
114
- component={ProductCardGridScreen}
115
- options={{headerShown: false}}
116
- />
117
- <Stack.Screen
118
- name="__MINI_APP_NAME_PASCAL_CASE__.Inputs"
119
- component={InputScreen}
120
- options={{headerShown: false}}
121
- />
122
- <Stack.Screen
123
- name="__MINI_APP_NAME_PASCAL_CASE__.MultipleChoice"
124
- component={MultipleChoiceScreen}
125
- options={{headerShown: false}}
126
- />
127
- <Stack.Screen
128
- name="__MINI_APP_NAME_PASCAL_CASE__.ImageMultipleChoice"
129
- component={ImageMultipleChoiceScreen}
130
- options={{headerShown: false}}
131
- />
132
- <Stack.Screen
133
- name="__MINI_APP_NAME_PASCAL_CASE__.Quiz"
134
- component={QuizScreen}
135
- options={{headerShown: false}}
136
- />
137
- <Stack.Screen
138
- name="__MINI_APP_NAME_PASCAL_CASE__.Accordion"
139
- component={AccordionScreen}
140
- options={{headerShown: false}}
141
- />
142
- <Stack.Screen
143
- name="__MINI_APP_NAME_PASCAL_CASE__.ShopActions"
144
- component={ShopActionsScreen}
145
- options={{headerShown: false}}
146
- />
147
- </Stack.Navigator>
148
- )
149
- }
@@ -1,73 +0,0 @@
1
- import {
2
- Box,
3
- Text,
4
- AccordionProps,
5
- Accordion,
6
- } from '@shopify/shop-minis-platform-sdk'
7
- import {SafeAreaView, ScrollView} from 'react-native'
8
-
9
- import {Header} from '../components/Header'
10
-
11
- const createAccordionEntries = (
12
- numberOfEntries: number,
13
- initiallyOpenIndexes?: number[]
14
- ): AccordionProps['items'] => {
15
- return Array(numberOfEntries)
16
- .fill(undefined)
17
- .map((_, index) => ({
18
- title: `Option ${
19
- index + 1
20
- } - Reiciendis repellendus blanditiis, nam soluta `,
21
- body: (
22
- <Text>
23
- Lorem ipsum dolor sit, amet consectetur adipisicing elit. Cum
24
- architecto, quibusdam incidunt error atque id voluptas sit dolores
25
- reprehenderit. Reiciendis repellendus blanditiis, nam soluta
26
- distinctio est nostrum reprehenderit veritatis id END?
27
- </Text>
28
- ),
29
- isInitiallyOpen: initiallyOpenIndexes?.includes(index),
30
- }))
31
- }
32
-
33
- const mockAccordionItems = createAccordionEntries(5)
34
- const mockAccordionItemsWithInitialOpen = createAccordionEntries(5, [1, 2])
35
-
36
- export const AccordionScreen = () => {
37
- return (
38
- <SafeAreaView style={{flex: 1}}>
39
- <ScrollView style={{flex: 1}}>
40
- <Header />
41
- <Box padding="m">
42
- <Box marginBottom="m">
43
- <Text variant="headerBold">Accordion</Text>
44
- </Box>
45
- <Box marginBottom="xxl">
46
- <Box marginBottom="s">
47
- <Text variant="subtitle">All Closed</Text>
48
- </Box>
49
- <Box>
50
- <Accordion items={mockAccordionItems} />
51
- </Box>
52
- </Box>
53
- <Box marginBottom="xxl">
54
- <Box marginBottom="s">
55
- <Text variant="subtitle">Initial Open (2 & 3)</Text>
56
- </Box>
57
- <Box>
58
- <Accordion items={mockAccordionItemsWithInitialOpen} />
59
- </Box>
60
- </Box>
61
- <Box marginBottom="xxl">
62
- <Box marginBottom="s">
63
- <Text variant="subtitle">Toggle (alwaysOpen=false)</Text>
64
- </Box>
65
- <Box>
66
- <Accordion items={mockAccordionItems} alwaysOpen={false} />
67
- </Box>
68
- </Box>
69
- </Box>
70
- </ScrollView>
71
- </SafeAreaView>
72
- )
73
- }
@@ -1,95 +0,0 @@
1
- import {Platform, SafeAreaView, ScrollView} from 'react-native'
2
- import {Avatar, Box, Text, useTheme} from '@shopify/shop-minis-platform-sdk'
3
-
4
- import {Header} from '../components/Header'
5
-
6
- const monospaceFontFamily = Platform.OS === 'ios' ? 'Menlo' : 'monospace'
7
-
8
- export const AvatarScreen = () => {
9
- const theme = useTheme()
10
- return (
11
- <SafeAreaView
12
- style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
13
- >
14
- <ScrollView
15
- style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
16
- >
17
- <Header />
18
- <Box px="gutter">
19
- <Box marginBottom="m">
20
- <Text variant="headerBold" mb="xs">
21
- Avatar
22
- </Text>
23
- <Text variant="bodyLarge">
24
- Avatars are used to show a thumbnail of a user or business.
25
- </Text>
26
- </Box>
27
-
28
- <Box flexDirection="row" alignItems="center">
29
- <Avatar
30
- color="foregrounds-regular"
31
- source={{uri: 'https://picsum.photos/id/1080/1000/1500'}}
32
- size="small"
33
- />
34
- <Avatar
35
- color="foregrounds-regular"
36
- source={{uri: 'https://picsum.photos/id/1080/1000/1500'}}
37
- size="medium"
38
- />
39
- <Avatar
40
- color="foregrounds-regular"
41
- source={{uri: 'https://picsum.photos/id/1080/1000/1500'}}
42
- size="large"
43
- />
44
- </Box>
45
-
46
- <Text mb="l" mt="s">
47
- Size&nbsp;
48
- <Text
49
- fontFamily={monospaceFontFamily}
50
- variant="bodyLargeBold"
51
- color="backgrounds-success"
52
- >
53
- `small`
54
- </Text>
55
- &nbsp; | &nbsp;
56
- <Text
57
- fontFamily={monospaceFontFamily}
58
- variant="bodyLargeBold"
59
- color="backgrounds-success"
60
- >
61
- `medium`
62
- </Text>
63
- &nbsp; | &nbsp;
64
- <Text
65
- fontFamily={monospaceFontFamily}
66
- variant="bodyLargeBold"
67
- color="backgrounds-success"
68
- >
69
- `large`
70
- </Text>
71
- </Text>
72
-
73
- <Box flexDirection="row" alignItems="center">
74
- <Avatar
75
- color="foregrounds-regular"
76
- source={{uri: 'https://picsum.photos/id/1080/1000/1500'}}
77
- title="Title"
78
- />
79
- </Box>
80
-
81
- <Text mb="l" mt="s">
82
- Title&nbsp;
83
- <Text
84
- fontFamily={monospaceFontFamily}
85
- variant="bodyLargeBold"
86
- color="backgrounds-dangerous"
87
- >
88
- string
89
- </Text>
90
- </Text>
91
- </Box>
92
- </ScrollView>
93
- </SafeAreaView>
94
- )
95
- }