@shopify/shop-minis-cli 0.0.82 → 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 (95) 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 +2 -12
  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/build/utils/package-manager.d.ts +1 -1
  14. package/package.json +2 -2
  15. package/templates/__template_common/.eslintrc.js +1 -1
  16. package/templates/__template_hello_world/src/assets/Modal-component-thumbnail.png +0 -0
  17. package/templates/__template_hello_world/src/assets/ProductCard-component-thumbnail.png +0 -0
  18. package/templates/__template_hello_world/src/assets/ProductLink-component-thumbnail.png +0 -0
  19. package/templates/__template_hello_world/src/assets/assets.d.ts +0 -4
  20. package/templates/__template_hello_world/src/assets/figma-logo.svg +0 -14
  21. package/templates/__template_hello_world/src/assets/shop-minis-logo.svg +0 -7
  22. package/templates/__template_hello_world/src/components/ButtonCTA.tsx +0 -31
  23. package/templates/__template_hello_world/src/components/ComponentLink.ts +0 -94
  24. package/templates/__template_hello_world/src/components/ComponentListItem.tsx +0 -39
  25. package/templates/__template_hello_world/src/components/FeaturedComponents.tsx +0 -110
  26. package/templates/__template_hello_world/src/components/Header.tsx +0 -40
  27. package/templates/__template_hello_world/src/components/quiz/ImageCarouselSlide.tsx +0 -54
  28. package/templates/__template_hello_world/src/components/quiz/MultipleChoiceSlide.tsx +0 -77
  29. package/templates/__template_hello_world/src/components/quiz/QuizProvider.tsx +0 -64
  30. package/templates/__template_hello_world/src/components/quiz/QuizSlide.tsx +0 -79
  31. package/templates/__template_hello_world/src/components/quiz/QuizSlideCommander.tsx +0 -35
  32. package/templates/__template_hello_world/src/components/quiz/TextFieldSlide.tsx +0 -84
  33. package/templates/__template_hello_world/src/components/quiz/TextSlide.tsx +0 -6
  34. package/templates/__template_hello_world/src/components/quiz/types.ts +0 -72
  35. package/templates/__template_hello_world/src/data/Test.graphql +0 -33
  36. package/templates/__template_hello_world/src/data/Test.graphql.d.ts +0 -107
  37. package/templates/__template_hello_world/src/data/TestProducts.graphql +0 -64
  38. package/templates/__template_hello_world/src/data/TestProducts.graphql.d.ts +0 -197
  39. package/templates/__template_hello_world/src/fixtures/mocked-products-with-variants.ts +0 -274
  40. package/templates/__template_hello_world/src/hooks/useQuizData.ts +0 -26
  41. package/templates/__template_hello_world/src/hooks/useQuizState.ts +0 -27
  42. package/templates/__template_hello_world/src/index.tsx +0 -10
  43. package/templates/__template_hello_world/src/routes.tsx +0 -149
  44. package/templates/__template_hello_world/src/screens/AccordionScreen.tsx +0 -73
  45. package/templates/__template_hello_world/src/screens/AvatarScreen.tsx +0 -95
  46. package/templates/__template_hello_world/src/screens/BottomSheetScreen.tsx +0 -712
  47. package/templates/__template_hello_world/src/screens/ButtonsScreen.tsx +0 -90
  48. package/templates/__template_hello_world/src/screens/GridScreen.tsx +0 -74
  49. package/templates/__template_hello_world/src/screens/HomeScreen.tsx +0 -81
  50. package/templates/__template_hello_world/src/screens/IconsScreen.tsx +0 -181
  51. package/templates/__template_hello_world/src/screens/ImageMultipleChoiceScreen.tsx +0 -145
  52. package/templates/__template_hello_world/src/screens/InputScreen.tsx +0 -149
  53. package/templates/__template_hello_world/src/screens/MediaScreen.tsx +0 -130
  54. package/templates/__template_hello_world/src/screens/ModalScreen.tsx +0 -379
  55. package/templates/__template_hello_world/src/screens/MultipleChoiceScreen.tsx +0 -75
  56. package/templates/__template_hello_world/src/screens/ProductCardGridScreen.tsx +0 -68
  57. package/templates/__template_hello_world/src/screens/ProductCardScreen.tsx +0 -62
  58. package/templates/__template_hello_world/src/screens/ProductLinkScreen.tsx +0 -215
  59. package/templates/__template_hello_world/src/screens/ProgressIndicatorScreen.tsx +0 -77
  60. package/templates/__template_hello_world/src/screens/QuantityPickerScreen.tsx +0 -76
  61. package/templates/__template_hello_world/src/screens/QuizResultScreen.tsx +0 -82
  62. package/templates/__template_hello_world/src/screens/QuizScreen.tsx +0 -40
  63. package/templates/__template_hello_world/src/screens/QuizSlideScreen.tsx +0 -150
  64. package/templates/__template_hello_world/src/screens/ShopActionsScreen.tsx +0 -48
  65. package/templates/__template_hello_world/src/screens/SpinnerScreen.tsx +0 -63
  66. package/templates/__template_hello_world/src/screens/TypographyScreen.tsx +0 -274
  67. package/templates/__template_hello_world/src/screens/VariantPickerScreen.tsx +0 -120
  68. package/templates/__template_hello_world/src/screens/WebViewScreen.tsx +0 -42
  69. package/templates/__template_hello_world/src/types.ts +0 -31
  70. package/templates/__template_hello_world/src/utils/getFlagEmoji.ts +0 -7
  71. package/templates/__template_hello_world/src/utils/mockQuizData.ts +0 -330
  72. package/templates/__template_hello_world/src/utils/quizUtils.ts +0 -75
  73. package/templates/__template_snowboardz/src/assets/assets.d.ts +0 -4
  74. package/templates/__template_snowboardz/src/assets/circle-blue.svg +0 -9
  75. package/templates/__template_snowboardz/src/assets/circle-green.svg +0 -9
  76. package/templates/__template_snowboardz/src/assets/circle-purple.svg +0 -9
  77. package/templates/__template_snowboardz/src/assets/circle-rainbow.svg +0 -34
  78. package/templates/__template_snowboardz/src/assets/circle-red.svg +0 -9
  79. package/templates/__template_snowboardz/src/assets/circle-yellow.svg +0 -9
  80. package/templates/__template_snowboardz/src/assets/skill-level-icon-advanced.svg +0 -3
  81. package/templates/__template_snowboardz/src/assets/skill-level-icon-beginner.svg +0 -3
  82. package/templates/__template_snowboardz/src/assets/skill-level-icon-intermediate.svg +0 -3
  83. package/templates/__template_snowboardz/src/components/ColorButton.tsx +0 -79
  84. package/templates/__template_snowboardz/src/components/ColorPicker.tsx +0 -40
  85. package/templates/__template_snowboardz/src/components/EmptyResult.tsx +0 -52
  86. package/templates/__template_snowboardz/src/components/SkillLevelIcon.tsx +0 -41
  87. package/templates/__template_snowboardz/src/components/SkillLevelPicker.tsx +0 -92
  88. package/templates/__template_snowboardz/src/data/TestProducts.graphql +0 -34
  89. package/templates/__template_snowboardz/src/data/TestProducts.graphql.d.ts +0 -118
  90. package/templates/__template_snowboardz/src/hooks/useSnowboardData.tsx +0 -37
  91. package/templates/__template_snowboardz/src/index.tsx +0 -10
  92. package/templates/__template_snowboardz/src/routes.tsx +0 -17
  93. package/templates/__template_snowboardz/src/screens/HomeScreen.tsx +0 -126
  94. package/templates/__template_snowboardz/src/types.ts +0 -12
  95. package/templates/__template_snowboardz/src/utils.ts +0 -17
@@ -1,31 +0,0 @@
1
- // @react-navigation/native-stack requires a `type` instead of an `interface`
2
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
3
- export type StackParamList = {
4
- '__MINI_APP_NAME_PASCAL_CASE__.Home': undefined
5
- '__MINI_APP_NAME_PASCAL_CASE__.Modal': undefined
6
- '__MINI_APP_NAME_PASCAL_CASE__.ProductCard': undefined
7
- '__MINI_APP_NAME_PASCAL_CASE__.ProductCardGrid': undefined
8
- '__MINI_APP_NAME_PASCAL_CASE__.ProductLink': undefined
9
- '__MINI_APP_NAME_PASCAL_CASE__.Typography': undefined
10
- '__MINI_APP_NAME_PASCAL_CASE__.BottomSheet': undefined
11
- '__MINI_APP_NAME_PASCAL_CASE__.Buttons': undefined
12
- '__MINI_APP_NAME_PASCAL_CASE__.Icons': undefined
13
- '__MINI_APP_NAME_PASCAL_CASE__.ImageMultipleChoice': undefined
14
- '__MINI_APP_NAME_PASCAL_CASE__.Inputs': undefined
15
- '__MINI_APP_NAME_PASCAL_CASE__.Media': undefined
16
- '__MINI_APP_NAME_PASCAL_CASE__.MultipleChoice': undefined
17
- '__MINI_APP_NAME_PASCAL_CASE__.QuantityPicker': undefined
18
- '__MINI_APP_NAME_PASCAL_CASE__.VariantPicker': undefined
19
- '__MINI_APP_NAME_PASCAL_CASE__.WebView': undefined
20
- '__MINI_APP_NAME_PASCAL_CASE__.Query': undefined
21
- '__MINI_APP_NAME_PASCAL_CASE__.ShopActions': undefined
22
- '__MINI_APP_NAME_PASCAL_CASE__.Html': undefined
23
- '__MINI_APP_NAME_PASCAL_CASE__.Params': undefined
24
- '__MINI_APP_NAME_PASCAL_CASE__.ProgressIndicator': undefined
25
- '__MINI_APP_NAME_PASCAL_CASE__.Spinner': undefined
26
- '__MINI_APP_NAME_PASCAL_CASE__.Grid': undefined
27
- '__MINI_APP_NAME_PASCAL_CASE__.Avatar': undefined
28
- '__MINI_APP_NAME_PASCAL_CASE__.KeyboardAvoidingView': undefined
29
- '__MINI_APP_NAME_PASCAL_CASE__.Quiz': undefined
30
- '__MINI_APP_NAME_PASCAL_CASE__.Accordion': undefined
31
- }
@@ -1,7 +0,0 @@
1
- export function getFlagEmoji(countryCode: string) {
2
- const codePoints = countryCode
3
- .toUpperCase()
4
- .split('')
5
- .map(char => 127397 + char.charCodeAt(0))
6
- return String.fromCodePoint(...codePoints)
7
- }
@@ -1,330 +0,0 @@
1
- import {ImageCarouselSlideProps} from '../components/quiz/ImageCarouselSlide'
2
- import {MultipleChoiceSlideProps} from '../components/quiz/MultipleChoiceSlide'
3
- import {TextFieldSlideProps} from '../components/quiz/TextFieldSlide'
4
- import {
5
- QuizAnswerType,
6
- QuizData,
7
- SlideInformation,
8
- TextSlideProps,
9
- } from '../components/quiz/types'
10
-
11
- const createChoices = (numberOfChoices: number) => {
12
- return Array(numberOfChoices)
13
- .fill(undefined)
14
- .map((_, index) => ({
15
- label: `Option ${index + 1}`,
16
- value: `Value ${index + 1}`,
17
- }))
18
- }
19
-
20
- const textWelcomeSlideProps: TextSlideProps = {
21
- quizSlideProps: {
22
- mainText: 'Welcome!',
23
- subText:
24
- 'This is a Text Slide which demonstrates some text. Often used as a welcome of thankyou page',
25
- ctaText: "Let's get started!",
26
- },
27
- }
28
-
29
- const textThankYouSlideProps: TextSlideProps = {
30
- quizSlideProps: {
31
- mainText: 'Ready for your results?',
32
- subText: 'Click below for product recommendations',
33
- ctaText: 'Show Me Results',
34
- },
35
- }
36
-
37
- const multipleChoiceHairTypeSlideProps: MultipleChoiceSlideProps = {
38
- quizSlideProps: {
39
- mainText:
40
- 'So nice to meet you, {{userName}}. What is your current hair color?',
41
- ctaText: 'Next Question',
42
- ctaDisabled: true,
43
- },
44
- multipleChoiceProps: {
45
- choices: [
46
- {
47
- label: 'Grey',
48
- value: 'Grey',
49
- },
50
- {
51
- label: 'Blonde',
52
- value: 'Blonde',
53
- },
54
- {
55
- label: 'Light/Med Brown',
56
- value: 'Light/Med Brown',
57
- },
58
- {
59
- label: 'Brunette/Dark Brown',
60
- value: 'Brunette/Dark Brown',
61
- },
62
- {
63
- label: 'Nearly Black/Jet Black',
64
- value: 'Nearly Black/Jet Black',
65
- },
66
- {
67
- label: 'Red',
68
- value: 'Red',
69
- },
70
- ],
71
- onChoiceSelected: () => null,
72
- selectedIndexes: [],
73
- },
74
- determineCtaDisabled: (answer: QuizAnswerType) =>
75
- (answer as [number]).length < 1,
76
- }
77
-
78
- const multipleChoiceYesNoSlideProps: MultipleChoiceSlideProps = {
79
- quizSlideProps: {
80
- mainText: 'Are you Canadian?',
81
- ctaText: 'Next Question',
82
- ctaDisabled: true,
83
- },
84
- multipleChoiceProps: {
85
- choices: [
86
- {
87
- label: 'Yes',
88
- value: 'Yes',
89
- },
90
- {
91
- label: 'No',
92
- value: 'No',
93
- },
94
- ],
95
- onChoiceSelected: () => null,
96
- selectedIndexes: [],
97
- },
98
- determineNextSlide: answer => {
99
- return answer[0] === 0 ? 'canada' : 'choose-age'
100
- },
101
- determineCtaDisabled: (answer: QuizAnswerType) =>
102
- (answer as [number]).length < 1,
103
- }
104
-
105
- const textCanadianSlideProps: TextSlideProps = {
106
- quizSlideProps: {
107
- mainText: 'You are Canadian!',
108
- ctaText: 'Ja, eh',
109
- },
110
- }
111
-
112
- const ageChoices = [
113
- {
114
- label: '<18',
115
- value: '<18',
116
- },
117
- {
118
- label: '19-25',
119
- value: '19-25',
120
- },
121
- {
122
- label: '26-35',
123
- value: '26-35',
124
- },
125
- {
126
- label: '36+',
127
- value: '36+',
128
- },
129
- ]
130
-
131
- const textFieldPhoneSlideProps: TextFieldSlideProps = {
132
- quizSlideProps: {
133
- mainText: 'Can we get your phone number, please?',
134
- ctaDisabled: true,
135
- },
136
- textFieldProps: {
137
- placeholder: 'gemme dem digits',
138
- },
139
- determineCtaDisabled: (answer: QuizAnswerType) =>
140
- (answer as string).length < 1,
141
- }
142
-
143
- const textFieldSlideProps: TextFieldSlideProps = {
144
- quizSlideProps: {
145
- mainText: 'Well that was rude of us...we never got your name.',
146
- ctaDisabled: true,
147
- },
148
- textFieldProps: {
149
- placeholder: 'Enter your name',
150
- },
151
- determineCtaDisabled: (answer: QuizAnswerType) =>
152
- (answer as string).length < 1,
153
- }
154
-
155
- const textFieldMutliLineSlideProps: TextFieldSlideProps = {
156
- quizSlideProps: {
157
- mainText: 'Leave your comments!',
158
- subText: 'Are there some other products you would like to see?',
159
- ctaText: 'Submit',
160
- ctaDisabled: true,
161
- },
162
- textFieldProps: {
163
- multiline: true,
164
- numberOfLines: 4,
165
- helper: 'Must be at least 10 characters',
166
- placeholder: 'It would be great if you Would....',
167
- },
168
- determineCtaDisabled: (answer: QuizAnswerType) =>
169
- (answer as string).length < 10,
170
- }
171
-
172
- const multipleChoiceSingleSelctionShortSlideProps: MultipleChoiceSlideProps = {
173
- quizSlideProps: {
174
- mainText: 'How old are you?',
175
- ctaText: 'Next Question',
176
- ctaDisabled: true,
177
- },
178
- multipleChoiceProps: {
179
- choices: ageChoices,
180
- onChoiceSelected: () => null,
181
- selectedIndexes: [],
182
- },
183
- determineNextSlide: answer => `age-${ageChoices[answer[0]].value}`,
184
- determineCtaDisabled: (answer: QuizAnswerType) =>
185
- (answer as [number]).length < 1,
186
- }
187
-
188
- const multipleChoiceMustAcceptSlideProps: MultipleChoiceSlideProps = {
189
- quizSlideProps: {
190
- mainText: 'Do You Agree To Share Your Information?',
191
- subText: 'We will only use it to generate recommendations',
192
- ctaText: 'On to the questions!',
193
- ctaDisabled: true,
194
- },
195
- multipleChoiceProps: {
196
- choices: [
197
- {label: 'No I do not', value: 'no'},
198
- {label: 'Yes I consent', value: 'yes'},
199
- ],
200
- onChoiceSelected: () => null,
201
- selectedIndexes: [],
202
- },
203
- determineCtaDisabled: (answer: QuizAnswerType) =>
204
- (answer as [number])[0] !== 1,
205
- }
206
-
207
- const generateAgeTextSlide = (age: string): SlideInformation => ({
208
- id: `age-${age}`,
209
- type: 'TextSlide',
210
- props: {
211
- quizSlideProps: {
212
- mainText: `Screen just for being ${age}`,
213
- subText: `The quiz jumped to this screen because you chose ${age} on the last slide`,
214
- },
215
- nextSlideId: 'lots-of-options',
216
- },
217
- })
218
-
219
- const multipleChoiceSingleSelctionLongSlideProps: MultipleChoiceSlideProps = {
220
- quizSlideProps: {
221
- isTallSlide: true,
222
- mainText: 'What are your favorite numbers under 30',
223
- subText: 'Choose at least 3 numbers',
224
- },
225
- multipleChoiceProps: {
226
- choices: createChoices(30),
227
- onChoiceSelected: () => null,
228
- selectedIndexes: [],
229
- },
230
- isMultiSelect: true,
231
- determineCtaDisabled: (answer: QuizAnswerType) =>
232
- (answer as [number]).length < 3,
233
- }
234
-
235
- // This ensures that random images are selected each time the app is generated
236
- const LOREM_PIXUM_OFFSET = Math.ceil(Math.random() * 100)
237
- const multipleChoiceImageSingleSelctionProps: ImageCarouselSlideProps = {
238
- quizSlideProps: {
239
- mainText: 'Select an Image that you like',
240
- },
241
- imageCarouselProps: {
242
- choices: createChoices(30).map((choice, i) => ({
243
- ...choice,
244
- imageUrl: `https://picsum.photos/id/${LOREM_PIXUM_OFFSET + i}/160`,
245
- })),
246
- onChoiceSelected: () => null,
247
- selectedIndexes: [],
248
- imageSize: 160,
249
- },
250
- determineCtaDisabled: (answer: QuizAnswerType) =>
251
- (answer as [number]).length < 1,
252
- }
253
-
254
- export const mockQuizData: QuizData = {
255
- slides: [
256
- {
257
- id: 'welcome',
258
- type: 'TextSlide',
259
- props: textWelcomeSlideProps,
260
- },
261
- {
262
- id: 'consent',
263
- type: 'MultipleChoiceSlide',
264
- props: multipleChoiceMustAcceptSlideProps,
265
- },
266
- {
267
- id: 'enter-phone',
268
- type: 'TextFieldSlide',
269
- props: textFieldPhoneSlideProps,
270
- },
271
- {
272
- id: 'enter-name',
273
- type: 'TextFieldSlide',
274
- props: textFieldSlideProps,
275
- },
276
- {
277
- id: 'hair-type-personalized',
278
- type: 'MultipleChoiceSlide',
279
- props: multipleChoiceHairTypeSlideProps,
280
- },
281
- {
282
- id: 'choose-canada',
283
- type: 'MultipleChoiceSlide',
284
- props: multipleChoiceYesNoSlideProps,
285
- },
286
-
287
- {
288
- id: 'missing-products',
289
- type: 'TextFieldSlide',
290
- props: textFieldMutliLineSlideProps,
291
- },
292
- {
293
- id: 'choose-canada',
294
- type: 'MultipleChoiceSlide',
295
- props: multipleChoiceYesNoSlideProps,
296
- },
297
- {
298
- id: 'canada',
299
- type: 'TextSlide',
300
- props: textCanadianSlideProps,
301
- },
302
- {
303
- id: 'choose-age',
304
- type: 'MultipleChoiceSlide',
305
- props: multipleChoiceSingleSelctionShortSlideProps,
306
- },
307
- generateAgeTextSlide('<18'),
308
- generateAgeTextSlide('19-25'),
309
- generateAgeTextSlide('26-35'),
310
- generateAgeTextSlide('36+'),
311
- {
312
- id: 'lots-of-options',
313
- type: 'MultipleChoiceSlide',
314
- props: multipleChoiceSingleSelctionLongSlideProps,
315
- },
316
- {
317
- id: 'pick an image',
318
- type: 'ImageCarouselSlide',
319
- props: multipleChoiceImageSingleSelctionProps,
320
- },
321
- {
322
- id: 'thank-you',
323
- type: 'TextSlide',
324
- props: {
325
- ...textThankYouSlideProps,
326
- nextSlideId: 'results',
327
- },
328
- },
329
- ],
330
- }
@@ -1,75 +0,0 @@
1
- import {ImageCarouselSlideProps} from '../components/quiz/ImageCarouselSlide'
2
- import {MultipleChoiceSlideProps} from '../components/quiz/MultipleChoiceSlide'
3
- import {QuizData} from '../components/quiz/types'
4
-
5
- export const getQuizSlideDataByIndex = (
6
- quizData: QuizData,
7
- slideIndex: number
8
- ) => quizData.slides[slideIndex] ?? undefined
9
-
10
- export const getQuizSlideDataById = (quizData: QuizData, id: string) =>
11
- quizData.slides.find(slide => slide.id === id)
12
-
13
- export const getQuizSlideIndexById = (quizData: QuizData, id: string) =>
14
- quizData.slides.findIndex(slide => slide.id === id)
15
-
16
- export const getQuestionById = (quizData: QuizData, questionId: string) => {
17
- const slideWithQuestion = quizData.slides.find(
18
- slide => slide.id === questionId
19
- )
20
- if (!slideWithQuestion) {
21
- console.error('slide not founod')
22
- return `text question not found for slide with id ${questionId}`
23
- }
24
-
25
- return slideWithQuestion.props.quizSlideProps.mainText
26
- }
27
-
28
- export const getMultilpleChoiceAnswerLabels = (
29
- quizData: QuizData,
30
- questionId: string,
31
- selectedIndexes: number[]
32
- ) => {
33
- const multipleChoiceSlide = quizData.slides.find(
34
- slide => slide.id === questionId
35
- )
36
- if (
37
- !multipleChoiceSlide ||
38
- multipleChoiceSlide.type !== 'MultipleChoiceSlide'
39
- ) {
40
- console.error('only works for multiple choice slides')
41
- return []
42
- }
43
-
44
- const answers = (
45
- multipleChoiceSlide.props as MultipleChoiceSlideProps
46
- ).multipleChoiceProps.choices.map(({label}) => label)
47
-
48
- return answers.filter((_, index) => selectedIndexes.includes(index))
49
- }
50
-
51
- export const getImageCarouselAnswerUrls = (
52
- quizData: QuizData,
53
- questionId: string,
54
- selectedIndexes: number[]
55
- ) => {
56
- const imageCarouselSlide = quizData.slides.find(
57
- slide => slide.id === questionId
58
- )
59
- if (!imageCarouselSlide || imageCarouselSlide.type !== 'ImageCarouselSlide') {
60
- console.error('only works for ImageCarouselSlide')
61
- return []
62
- }
63
-
64
- const imageAnswers = (
65
- imageCarouselSlide.props as ImageCarouselSlideProps
66
- ).imageCarouselProps.choices.map(({imageUrl}) => imageUrl)
67
-
68
- return imageAnswers.filter((_, index) => selectedIndexes.includes(index))
69
- }
70
-
71
- export const addNameToText = (text: string, name?: string) => {
72
- const regex = new RegExp('{{userName}}', 'g')
73
-
74
- return text.replace(regex, name ? name : 'Anonymous')
75
- }
@@ -1,4 +0,0 @@
1
- declare module '*.svg' {
2
- const content: any
3
- export default content
4
- }
@@ -1,9 +0,0 @@
1
- <svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.199997" width="40" height="40" rx="20" fill="url(#paint0_linear_277_3614)"/>
3
- <defs>
4
- <linearGradient id="paint0_linear_277_3614" x1="20.2" y1="0" x2="20.2" y2="40" gradientUnits="userSpaceOnUse">
5
- <stop stop-color="#8ACDFD"/>
6
- <stop offset="1" stop-color="#3D5EEA"/>
7
- </linearGradient>
8
- </defs>
9
- </svg>
@@ -1,9 +0,0 @@
1
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="40" height="40" rx="20" fill="url(#paint0_linear_277_3611)"/>
3
- <defs>
4
- <linearGradient id="paint0_linear_277_3611" x1="20" y1="0" x2="20" y2="40" gradientUnits="userSpaceOnUse">
5
- <stop stop-color="#2CCB29"/>
6
- <stop offset="1" stop-color="#23B7AE"/>
7
- </linearGradient>
8
- </defs>
9
- </svg>
@@ -1,9 +0,0 @@
1
- <svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.399994" width="40" height="40" rx="20" fill="url(#paint0_linear_277_3612)"/>
3
- <defs>
4
- <linearGradient id="paint0_linear_277_3612" x1="20.4" y1="0" x2="20.4" y2="40" gradientUnits="userSpaceOnUse">
5
- <stop stop-color="#CE9CE4"/>
6
- <stop offset="1" stop-color="#6D41CB"/>
7
- </linearGradient>
8
- </defs>
9
- </svg>
@@ -1,34 +0,0 @@
1
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_277_3873)">
3
- <circle cx="20" cy="20" r="20" transform="rotate(-180 20 20)" fill="#FFB7D8"/>
4
- <circle cx="20" cy="20" r="17" transform="rotate(-180 20 20)" fill="#750CD6"/>
5
- <circle cx="20" cy="20" r="14" transform="rotate(-180 20 20)" fill="#0098DB"/>
6
- <circle cx="20" cy="20" r="11" transform="rotate(-180 20 20)" fill="#78C301"/>
7
- <circle cx="20" cy="20" r="8" transform="rotate(-180 20 20)" fill="#F5CF3E"/>
8
- <circle cx="20" cy="20" r="5" transform="rotate(-180 20 20)" fill="#FE6C37"/>
9
- <circle cx="20" cy="20" r="2" transform="rotate(-180 20 20)" fill="#DE2826"/>
10
- <rect x="40" y="20" width="3" height="21" transform="rotate(-180 40 20)" fill="#FFB7D8"/>
11
- <rect x="3" y="20" width="3" height="21" transform="rotate(-180 3 20)" fill="#FFB7D8"/>
12
- <rect x="37" y="20" width="3" height="21" transform="rotate(-180 37 20)" fill="#750CD6"/>
13
- <rect x="6" y="20" width="3" height="21" transform="rotate(-180 6 20)" fill="#750CD6"/>
14
- <rect x="34" y="20" width="3" height="21" transform="rotate(-180 34 20)" fill="#0098DB"/>
15
- <rect x="9" y="20" width="3" height="21" transform="rotate(-180 9 20)" fill="#0098DB"/>
16
- <rect x="31" y="20" width="3" height="21" transform="rotate(-180 31 20)" fill="#78C301"/>
17
- <rect x="12" y="20" width="3" height="21" transform="rotate(-180 12 20)" fill="#78C301"/>
18
- <rect x="28" y="20" width="3" height="21" transform="rotate(-180 28 20)" fill="#F5CF3E"/>
19
- <rect x="15" y="20" width="3" height="21" transform="rotate(-180 15 20)" fill="#F5CF3E"/>
20
- <rect x="25" y="20" width="3" height="21" transform="rotate(-180 25 20)" fill="#FE6C37"/>
21
- <rect x="18" y="20" width="3" height="21" transform="rotate(-180 18 20)" fill="#FE6C37"/>
22
- <rect x="22" y="20" width="4" height="21" transform="rotate(-180 22 20)" fill="#DE2826"/>
23
- <rect width="40" height="40" fill="url(#paint0_linear_277_3873)"/>
24
- </g>
25
- <defs>
26
- <linearGradient id="paint0_linear_277_3873" x1="20" y1="0" x2="20" y2="40" gradientUnits="userSpaceOnUse">
27
- <stop stop-opacity="0"/>
28
- <stop offset="1" stop-opacity="0.2"/>
29
- </linearGradient>
30
- <clipPath id="clip0_277_3873">
31
- <rect x="40" y="40" width="40" height="40" rx="20" transform="rotate(-180 40 40)" fill="white"/>
32
- </clipPath>
33
- </defs>
34
- </svg>
@@ -1,9 +0,0 @@
1
- <svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.599991" width="40" height="40" rx="20" fill="url(#paint0_linear_277_3615)"/>
3
- <defs>
4
- <linearGradient id="paint0_linear_277_3615" x1="20.6" y1="0" x2="20.6" y2="40" gradientUnits="userSpaceOnUse">
5
- <stop stop-color="#EF6767"/>
6
- <stop offset="1" stop-color="#731D4B"/>
7
- </linearGradient>
8
- </defs>
9
- </svg>
@@ -1,9 +0,0 @@
1
- <svg width="41" height="40" viewBox="0 0 41 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.800003" width="40" height="40" rx="20" fill="url(#paint0_linear_277_3613)"/>
3
- <defs>
4
- <linearGradient id="paint0_linear_277_3613" x1="20.8" y1="0" x2="20.8" y2="40" gradientUnits="userSpaceOnUse">
5
- <stop stop-color="#E8D846"/>
6
- <stop offset="1" stop-color="#968C34"/>
7
- </linearGradient>
8
- </defs>
9
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect y="8" width="11" height="11" transform="rotate(-45 0 8)" fill="black"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <circle cx="8" cy="8" r="8" fill="#008552"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect width="14" height="14" fill="#33A9EB"/>
3
- </svg>
@@ -1,79 +0,0 @@
1
- import {Box, Text} from '@shopify/shop-minis-platform-sdk'
2
- import {StyleSheet, TouchableOpacity} from 'react-native'
3
-
4
- import CircleGreen from '../assets/circle-green.svg'
5
- import CirclePurple from '../assets/circle-purple.svg'
6
- import CircleYellow from '../assets/circle-yellow.svg'
7
- import CircleBlue from '../assets/circle-blue.svg'
8
- import CircleRed from '../assets/circle-red.svg'
9
- import CircleRainbow from '../assets/circle-rainbow.svg'
10
-
11
- const colorMap = {
12
- green: CircleGreen,
13
- purple: CirclePurple,
14
- yellow: CircleYellow,
15
- blue: CircleBlue,
16
- red: CircleRed,
17
- }
18
-
19
- interface Props {
20
- onPress: () => void
21
- color: string
22
- selected?: boolean
23
- isResetButton?: boolean
24
- }
25
- export const ColorButton = ({
26
- onPress,
27
- color,
28
- selected,
29
- isResetButton,
30
- }: Props) => {
31
- const ColoredCircle = colorMap[color as keyof typeof colorMap]
32
-
33
- if (isResetButton) {
34
- return (
35
- <TouchableOpacity onPress={onPress}>
36
- <Box style={[styles.circleContainer]}>
37
- {selected ? null : (
38
- <Text
39
- variant="bodySmall"
40
- color="foregrounds-primary"
41
- style={styles.resetText}
42
- >
43
- Reset
44
- </Text>
45
- )}
46
- <CircleRainbow />
47
- </Box>
48
- </TouchableOpacity>
49
- )
50
- }
51
-
52
- if (!ColoredCircle) return null
53
-
54
- return (
55
- <>
56
- <TouchableOpacity onPress={onPress}>
57
- <Box style={[styles.circleContainer, selected && styles.selected]}>
58
- <ColoredCircle />
59
- </Box>
60
- </TouchableOpacity>
61
- </>
62
- )
63
- }
64
-
65
- const styles = StyleSheet.create({
66
- circleContainer: {
67
- padding: 2,
68
- borderWidth: 2,
69
- borderRadius: 100,
70
- borderColor: 'transparent',
71
- },
72
- selected: {
73
- borderColor: 'black',
74
- },
75
- resetText: {
76
- position: 'absolute',
77
- top: -24,
78
- },
79
- })
@@ -1,40 +0,0 @@
1
- import {Box, Text} from '@shopify/shop-minis-platform-sdk'
2
-
3
- import {ColorButton} from './ColorButton'
4
-
5
- interface ColorPickerProps {
6
- handleSelectedColor: (handleSelectedColor: string | null) => void
7
- selectedColor: string | null
8
- snowboardColors: string[]
9
- }
10
- export const ColorPicker = ({
11
- handleSelectedColor,
12
- selectedColor,
13
- snowboardColors,
14
- }: ColorPickerProps) => {
15
- if (!snowboardColors || snowboardColors.length < 1) {
16
- return null
17
- }
18
-
19
- return (
20
- <>
21
- <Text marginBottom="xs">Select color</Text>
22
- <Box justifyContent="space-between" flexDirection="row">
23
- {snowboardColors.map(color => (
24
- <ColorButton
25
- selected={selectedColor === color}
26
- key={color}
27
- color={color}
28
- onPress={() => handleSelectedColor(color)}
29
- />
30
- ))}
31
- <ColorButton
32
- selected={!selectedColor}
33
- color="Reset"
34
- isResetButton
35
- onPress={() => handleSelectedColor(null)}
36
- />
37
- </Box>
38
- </>
39
- )
40
- }