@shopify/shop-minis-cli 0.0.41 → 0.0.43

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 (58) hide show
  1. package/build/commands/cancel-submission/cancel-submission.js +3 -2
  2. package/build/commands/cancel-submission/cancel-submission.js.map +1 -1
  3. package/build/commands/check-submission/index.js +39 -6
  4. package/build/commands/check-submission/index.js.map +1 -1
  5. package/build/commands/check-submission/types.d.ts +1 -1
  6. package/build/commands/config.d.ts +1 -0
  7. package/build/commands/config.js +1 -0
  8. package/build/commands/config.js.map +1 -1
  9. package/build/commands/data/cancel-submission.d.ts +22 -0
  10. package/build/commands/data/cancel-submission.js +26 -0
  11. package/build/commands/data/cancel-submission.js.map +1 -0
  12. package/build/commands/data/client.d.ts +7 -0
  13. package/build/commands/data/client.js +8 -0
  14. package/build/commands/data/client.js.map +1 -0
  15. package/build/commands/data/create-submission.d.ts +20 -0
  16. package/build/commands/data/create-submission.js +27 -0
  17. package/build/commands/data/create-submission.js.map +1 -0
  18. package/build/commands/data/create-upload.d.ts +21 -0
  19. package/build/commands/data/create-upload.js +40 -0
  20. package/build/commands/data/create-upload.js.map +1 -0
  21. package/build/commands/data/get-submissions.d.ts +27 -0
  22. package/build/commands/data/get-submissions.js +33 -0
  23. package/build/commands/data/get-submissions.js.map +1 -0
  24. package/build/commands/submit/errors.d.ts +1 -1
  25. package/build/commands/submit/errors.js +1 -1
  26. package/build/commands/submit/errors.js.map +1 -1
  27. package/build/commands/submit/submit.js +2 -1
  28. package/build/commands/submit/submit.js.map +1 -1
  29. package/build/commands/submit/tasks.d.ts +0 -1
  30. package/build/commands/submit/tasks.js +4 -48
  31. package/build/commands/submit/tasks.js.map +1 -1
  32. package/build/commands/types/autogenerated/shop-minis-admin-api/gql.d.ts +9 -9
  33. package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js +2 -2
  34. package/build/commands/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -1
  35. package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.d.ts +35 -35
  36. package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js +87 -87
  37. package/build/commands/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
  38. package/build/commands/upgrade/utils/package-manager.d.ts +1 -1
  39. package/build/commands/upgrade/utils/package-manager.js +4 -1
  40. package/build/commands/upgrade/utils/package-manager.js.map +1 -1
  41. package/build/commands/utils/common-tasks.d.ts +1 -0
  42. package/build/commands/utils/common-tasks.js +49 -0
  43. package/build/commands/utils/common-tasks.js.map +1 -0
  44. package/package.json +1 -1
  45. package/templates/__template_common/package.json +3 -1
  46. package/templates/__template_hello_world/src/components/ComponentLink.ts +4 -0
  47. package/templates/__template_hello_world/src/components/ComponentListItem.tsx +1 -0
  48. package/templates/__template_hello_world/src/components/FeaturedComponents.tsx +2 -0
  49. package/templates/__template_hello_world/src/components/quiz/QuizSlide.tsx +6 -3
  50. package/templates/__template_hello_world/src/components/quiz/TextFieldSlide.tsx +88 -7
  51. package/templates/__template_hello_world/src/routes.tsx +6 -0
  52. package/templates/__template_hello_world/src/screens/AccordionScreen.tsx +73 -0
  53. package/templates/__template_hello_world/src/screens/InputScreen.tsx +4 -10
  54. package/templates/__template_hello_world/src/types.ts +1 -0
  55. package/templates/__template_hello_world/src/utils/mockQuizData.ts +19 -0
  56. package/build/commands/utils/graphql.d.ts +0 -92
  57. package/build/commands/utils/graphql.js +0 -123
  58. package/build/commands/utils/graphql.js.map +0 -1
@@ -39,8 +39,10 @@ export const FeaturedComponents = ({
39
39
  componentLinks[
40
40
  Math.floor(Math.random() * componentLinks.length)
41
41
  ]
42
+ // @ts-expect-error - when the stack param list contains too many routes... typescript throws random errors
42
43
  navigation.navigate(randomComponentLink.screen)
43
44
  } else {
45
+ // @ts-expect-error - when the stack param list contains too many routes... typescript throws random errors
44
46
  navigation.navigate(item.screen)
45
47
  }
46
48
  }}
@@ -25,13 +25,12 @@ export const QuizSlide = (props: QuizSlideProps) => {
25
25
  const {height: windowHeight, width} = useWindowDimensions()
26
26
 
27
27
  const containerWidth = width - gutter * 2
28
- const containerHeight = windowHeight - 245
28
+ const containerHeight = windowHeight - 255
29
29
 
30
30
  return (
31
31
  <Box
32
32
  height={containerHeight}
33
33
  flex={1}
34
- paddingHorizontal="gutter"
35
34
  paddingTop={isTallSlide ? 'xxxl' : 'auto'}
36
35
  position="relative"
37
36
  justifyContent="center"
@@ -44,7 +43,11 @@ export const QuizSlide = (props: QuizSlideProps) => {
44
43
  </Text>
45
44
  ) : null}
46
45
  </Box>
47
- <Box marginBottom="xxxl" paddingBottom={isTallSlide ? 'l' : 'none'}>
46
+ <Box
47
+ marginBottom="xxxl"
48
+ paddingBottom={isTallSlide ? 'l' : 'none'}
49
+ paddingHorizontal="gutter"
50
+ >
48
51
  {children}
49
52
  </Box>
50
53
  <Box style={styles.ctaContainer} paddingBottom="s" width={containerWidth}>
@@ -1,20 +1,48 @@
1
- import {Box, TextField} from '@shopify/shop-minis-platform-sdk'
1
+ import {ItemValue} from '@react-native-community/picker/typings/Picker'
2
+ import {
3
+ Box,
4
+ countryCodesAndPhonePrefixes,
5
+ getFlagEmoji,
6
+ Picker,
7
+ TextField,
8
+ TextFieldAutofill,
9
+ TextFieldPhoneNumber,
10
+ } from '@shopify/shop-minis-platform-sdk'
2
11
  import {ComponentProps, useCallback, useEffect, useState} from 'react'
3
12
 
4
13
  import {QuizSlide, QuizSlideProps} from './QuizSlide'
5
14
  import {SlideLogic} from './types'
6
15
 
16
+ interface Item {
17
+ value: string
18
+ label: string
19
+ selected?: boolean
20
+ }
21
+
22
+ const countryData: Item[] = countryCodesAndPhonePrefixes.map(
23
+ ({code, name}) => ({
24
+ value: code,
25
+ label: `${name} ${getFlagEmoji(code)}`,
26
+ })
27
+ )
7
28
  export interface TextFieldSlideProps extends SlideLogic<string> {
8
29
  quizSlideProps: QuizSlideProps
9
- textFieldProps: ComponentProps<typeof TextField>
30
+ textFieldProps:
31
+ | ComponentProps<typeof TextField>
32
+ | ComponentProps<typeof TextFieldAutofill>
33
+ autoFillType?: ComponentProps<typeof TextFieldAutofill>['type'] | 'telephone'
10
34
  }
11
35
 
12
36
  export const TextFieldSlide = ({
13
37
  quizSlideProps,
14
38
  textFieldProps,
39
+ autoFillType,
15
40
  determineCtaDisabled,
16
41
  handleAnswerSelection,
17
42
  }: TextFieldSlideProps) => {
43
+ const [showCountryPicker, setShowCountryPicker] = useState(false)
44
+ const [selectedCountry, setSelectedCountry] = useState<string>()
45
+
18
46
  const [fieldValue, setFieldValue] = useState<string>()
19
47
 
20
48
  const [isCtaDisabled, setCtaDisabled] = useState(
@@ -37,11 +65,64 @@ export const TextFieldSlide = ({
37
65
  setCtaDisabled(determineCtaDisabled(fieldValue))
38
66
  }, [determineCtaDisabled, fieldValue])
39
67
 
40
- return (
41
- <QuizSlide {...quizSlideProps} ctaDisabled={isCtaDisabled}>
42
- <Box marginBottom="xl">
68
+ let textFieldComponent
69
+
70
+ switch (autoFillType) {
71
+ case 'email':
72
+ textFieldComponent = (
73
+ <TextFieldAutofill
74
+ {...textFieldProps}
75
+ type="email"
76
+ shopId="test"
77
+ onChangeText={handleChange}
78
+ />
79
+ )
80
+
81
+ break
82
+ case 'name':
83
+ textFieldComponent = (
84
+ <TextFieldAutofill
85
+ {...textFieldProps}
86
+ type="name"
87
+ shopId="test"
88
+ onChangeText={handleChange}
89
+ />
90
+ )
91
+ break
92
+ case 'telephone':
93
+ textFieldComponent = (
94
+ <TextFieldPhoneNumber
95
+ selectedCountry={selectedCountry}
96
+ onFlagPress={() => setShowCountryPicker(true)}
97
+ shopId="shop"
98
+ autofill
99
+ onPhoneInfoChange={info => handleChange(info.phoneNumber)}
100
+ />
101
+ )
102
+
103
+ break
104
+ default:
105
+ textFieldComponent = (
43
106
  <TextField {...textFieldProps} onChangeText={handleChange} />
44
- </Box>
45
- </QuizSlide>
107
+ )
108
+ }
109
+
110
+ return (
111
+ <>
112
+ <QuizSlide {...quizSlideProps} ctaDisabled={isCtaDisabled}>
113
+ <Box marginBottom="xl">{textFieldComponent}</Box>
114
+ </QuizSlide>
115
+ {showCountryPicker ? (
116
+ <Picker
117
+ headerText="Choose Your Country"
118
+ items={countryData}
119
+ handleDismiss={() => setShowCountryPicker(false)}
120
+ selectedValue={selectedCountry}
121
+ onValueChange={(value: ItemValue) => {
122
+ setSelectedCountry(value.toString())
123
+ }}
124
+ />
125
+ ) : null}
126
+ </>
46
127
  )
47
128
  }
@@ -20,6 +20,7 @@ import {InputScreen} from './screens/InputScreen'
20
20
  import {MultipleChoiceScreen} from './screens/MultipleChoiceScreen'
21
21
  import {QuizScreen} from './screens/QuizScreen'
22
22
  import {ImageMultipleChoiceScreen} from './screens/ImageMultipleChoiceScreen'
23
+ import {AccordionScreen} from './screens/AccordionScreen'
23
24
 
24
25
  const Stack = createNativeStackNavigator()
25
26
 
@@ -126,6 +127,11 @@ export const __MINI_APP_HANDLE_PASCAL_CASE__Navigator = () => {
126
127
  component={QuizScreen}
127
128
  options={{headerShown: false}}
128
129
  />
130
+ <Stack.Screen
131
+ name="__MINI_APP_HANDLE_PASCAL_CASE__.Accordion"
132
+ component={AccordionScreen}
133
+ options={{headerShown: false}}
134
+ />
129
135
  </Stack.Navigator>
130
136
  )
131
137
  }
@@ -0,0 +1,73 @@
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
+ }
@@ -36,7 +36,7 @@ const countryData: Item[] = countryCodesAndPhonePrefixes.map(
36
36
 
37
37
  export const InputScreen = () => {
38
38
  const [showCountryPicker, setShowCountryPicker] = useState(false)
39
- const [selectedCountry, setSelectedCountry] = useState<string>('US')
39
+ const [selectedCountry, setSelectedCountry] = useState<string>()
40
40
 
41
41
  const [showDatePicker, setShowDatePicker] = useState(false)
42
42
  const [date, setDate] = useState(new Date())
@@ -58,9 +58,9 @@ export const InputScreen = () => {
58
58
  }
59
59
  return (
60
60
  <SafeAreaView style={{flex: 1}}>
61
- <Header />
62
61
  <KeyboardAvoidingView>
63
62
  <ScrollView style={{flex: 1}}>
63
+ <Header />
64
64
  <Box padding="m">
65
65
  <Box marginBottom="m">
66
66
  <Text variant="headerBold">Inputs</Text>
@@ -70,10 +70,7 @@ export const InputScreen = () => {
70
70
  <Text variant="bodyLargeBold">Text</Text>
71
71
  </Box>
72
72
 
73
- <TextField
74
- placeholder="Enter a word"
75
- onChangeText={console.log}
76
- />
73
+ <TextField placeholder="Enter a word" />
77
74
  </Box>
78
75
  <Box marginBottom="s">
79
76
  <Box marginBottom="xs">
@@ -84,7 +81,6 @@ export const InputScreen = () => {
84
81
  type="email"
85
82
  shopId="shopify"
86
83
  placeholder="Enter your email"
87
- onChangeText={console.log}
88
84
  />
89
85
  </Box>
90
86
  <Box marginBottom="s">
@@ -96,7 +92,6 @@ export const InputScreen = () => {
96
92
  type="name"
97
93
  shopId="shopify"
98
94
  placeholder="Enter your name"
99
- onChangeText={console.log}
100
95
  />
101
96
  </Box>
102
97
  <Box marginBottom="s">
@@ -115,7 +110,7 @@ export const InputScreen = () => {
115
110
  <Box marginBottom="xs">
116
111
  <Text variant="bodyLargeBold">Multiline</Text>
117
112
  </Box>
118
- <TextField multiline onTextInput={console.log} />
113
+ <TextField multiline />
119
114
  </Box>
120
115
  <Box marginBottom="s">
121
116
  <Box marginBottom="xs">
@@ -126,7 +121,6 @@ export const InputScreen = () => {
126
121
  onFlagPress={() => setShowCountryPicker(true)}
127
122
  shopId="shop"
128
123
  autofill
129
- onPhoneInfoChange={console.log}
130
124
  />
131
125
  </Box>
132
126
  <Box marginBottom="s">
@@ -26,4 +26,5 @@ export type StackParamList = {
26
26
  '__MINI_APP_HANDLE_PASCAL_CASE__.Avatar': undefined
27
27
  '__MINI_APP_HANDLE_PASCAL_CASE__.KeyboardAvoidingView': undefined
28
28
  '__MINI_APP_HANDLE_PASCAL_CASE__.Quiz': undefined
29
+ '__MINI_APP_HANDLE_PASCAL_CASE__.Accordion': undefined
29
30
  }
@@ -128,6 +128,19 @@ const ageChoices = [
128
128
  },
129
129
  ]
130
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
+ autoFillType: 'telephone',
140
+ determineCtaDisabled: (answer: QuizAnswerType) =>
141
+ (answer as string).length < 1,
142
+ }
143
+
131
144
  const textFieldSlideProps: TextFieldSlideProps = {
132
145
  quizSlideProps: {
133
146
  mainText: 'Well that was rude of us...we never got your name.',
@@ -136,6 +149,7 @@ const textFieldSlideProps: TextFieldSlideProps = {
136
149
  textFieldProps: {
137
150
  placeholder: 'Enter your name',
138
151
  },
152
+ autoFillType: 'name',
139
153
  determineCtaDisabled: (answer: QuizAnswerType) =>
140
154
  (answer as string).length < 1,
141
155
  }
@@ -251,6 +265,11 @@ export const mockQuizData: QuizData = {
251
265
  type: 'MultipleChoiceSlide',
252
266
  props: multipleChoiceMustAcceptSlideProps,
253
267
  },
268
+ {
269
+ id: 'enter-phone',
270
+ type: 'TextFieldSlide',
271
+ props: textFieldPhoneSlideProps,
272
+ },
254
273
  {
255
274
  id: 'enter-name',
256
275
  type: 'TextFieldSlide',
@@ -1,92 +0,0 @@
1
- export interface QueryUserErrors {
2
- code: string;
3
- message: string;
4
- field: string[];
5
- }
6
- export interface CreateUploadParameters {
7
- filename: string;
8
- fileSize: number;
9
- checksum: string;
10
- mimeType: string;
11
- }
12
- export declare const createUpload: ({ filename, fileSize, checksum, mimeType, }: CreateUploadParameters) => Promise<{
13
- __typename?: "SubmissionUploadCreatePayload" | undefined;
14
- upload?: {
15
- __typename?: "StagedUpload" | undefined;
16
- url: any;
17
- headers: string;
18
- id: string;
19
- } | null | undefined;
20
- userErrors: {
21
- __typename?: "SubmissionUploadCreateUserError" | undefined;
22
- code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionUploadCreateUserErrorCode;
23
- message: string;
24
- field?: string[] | null | undefined;
25
- }[];
26
- }>;
27
- export interface CreateSubmissionParameters {
28
- description: string;
29
- uploadId: string;
30
- }
31
- export declare const createSubmission: ({ description, uploadId, }: CreateSubmissionParameters) => Promise<{
32
- __typename?: "SubmissionCreatePayload" | undefined;
33
- submission?: {
34
- __typename?: "Submission" | undefined;
35
- reference: string;
36
- description: string;
37
- status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
38
- submittedAt: any;
39
- } | null | undefined;
40
- userErrors: {
41
- __typename?: "SubmissionCreateUserError" | undefined;
42
- code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionCreateUserErrorCode;
43
- message: string;
44
- field?: string[] | null | undefined;
45
- }[];
46
- }>;
47
- export interface CancelSubmissionParameters {
48
- reference: string;
49
- }
50
- export declare const cancelSubmission: ({ reference, }: CancelSubmissionParameters) => Promise<{
51
- __typename?: "SubmissionCancelPayload" | undefined;
52
- submission?: {
53
- __typename?: "Submission" | undefined;
54
- reference: string;
55
- description: string;
56
- status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
57
- submittedAt: any;
58
- } | null | undefined;
59
- userErrors: {
60
- __typename?: "SubmissionCancelUserError" | undefined;
61
- code: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionCancelUserErrorCode;
62
- message: string;
63
- field?: string[] | null | undefined;
64
- }[];
65
- }>;
66
- export interface GetSubmissionsParameters {
67
- first?: number;
68
- }
69
- export declare const getSubmissions: ({ first, }?: GetSubmissionsParameters | undefined) => Promise<{
70
- __typename?: "SubmissionConnection" | undefined;
71
- nodes: {
72
- __typename?: "Submission" | undefined;
73
- reference: string;
74
- description: string;
75
- status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
76
- submittedAt: any;
77
- }[];
78
- pageInfo: {
79
- __typename?: "PageInfo" | undefined;
80
- hasNextPage: boolean;
81
- hasPreviousPage: boolean;
82
- startCursor?: string | null | undefined;
83
- endCursor?: string | null | undefined;
84
- };
85
- }>;
86
- export declare function getPendingSubmission(): Promise<{
87
- __typename?: "Submission" | undefined;
88
- reference: string;
89
- description: string;
90
- status: import("../types/autogenerated/shop-minis-admin-api/graphql.js").SubmissionStatus;
91
- submittedAt: any;
92
- } | null>;
@@ -1,123 +0,0 @@
1
- import { GraphQLClient } from 'graphql-request';
2
- import { graphql } from '../types/autogenerated/shop-minis-admin-api/gql.js';
3
- import { SHOP_MINIS_ADMIN_API, SHOP_MINIS_ADMIN_API_KEY } from '../config.js';
4
- const client = new GraphQLClient(SHOP_MINIS_ADMIN_API, {
5
- headers: {
6
- Authorization: `Bearer ${SHOP_MINIS_ADMIN_API_KEY}`,
7
- },
8
- });
9
- const createUploadQuery = graphql(/* GraphQL */ `
10
- mutation CreateUpload(
11
- $filename: String!
12
- $fileSize: Int!
13
- $checksum: String!
14
- $mimeType: String!
15
- ) {
16
- submissionUploadCreate(
17
- input: {
18
- filename: $filename
19
- fileSize: $fileSize
20
- checksum: $checksum
21
- mimeType: $mimeType
22
- }
23
- ) {
24
- upload {
25
- url
26
- headers
27
- id
28
- }
29
- userErrors {
30
- code
31
- message
32
- field
33
- }
34
- }
35
- }
36
- `);
37
- export const createUpload = async ({ filename, fileSize, checksum, mimeType, }) => {
38
- const data = await client.request(createUploadQuery, {
39
- filename,
40
- fileSize,
41
- checksum,
42
- mimeType,
43
- }, {});
44
- return data.submissionUploadCreate;
45
- };
46
- const createSubmissionQuery = graphql(/* GraphQL */ `
47
- mutation CreateSubmission($description: String!, $uploadId: ID!) {
48
- submissionCreate(description: $description, uploadId: $uploadId) {
49
- submission {
50
- reference
51
- description
52
- status
53
- submittedAt
54
- }
55
- userErrors {
56
- code
57
- message
58
- field
59
- }
60
- }
61
- }
62
- `);
63
- export const createSubmission = async ({ description, uploadId, }) => {
64
- const data = await client.request(createSubmissionQuery, {
65
- description,
66
- uploadId,
67
- }, {});
68
- return data.submissionCreate;
69
- };
70
- const cancelSubmissionQuery = graphql(/* GraphQL */ `
71
- mutation CancelSubmission($reference: String!) {
72
- submissionCancel(reference: $reference) {
73
- submission {
74
- reference
75
- description
76
- status
77
- submittedAt
78
- }
79
- userErrors {
80
- code
81
- message
82
- field
83
- }
84
- }
85
- }
86
- `);
87
- export const cancelSubmission = async ({ reference, }) => {
88
- const data = await client.request(cancelSubmissionQuery, {
89
- reference,
90
- }, {});
91
- return data.submissionCancel;
92
- };
93
- const getSubmissionQuery = graphql(/* GraphQL */ `
94
- query Submissions($first: Int) {
95
- submissions(first: $first) {
96
- nodes {
97
- reference
98
- description
99
- status
100
- submittedAt
101
- }
102
- pageInfo {
103
- hasNextPage
104
- hasPreviousPage
105
- startCursor
106
- endCursor
107
- }
108
- }
109
- }
110
- `);
111
- export const getSubmissions = async ({ first = 10, } = {}) => {
112
- const data = await client.request(getSubmissionQuery, { first }, {});
113
- return data.submissions;
114
- };
115
- export async function getPendingSubmission() {
116
- const submissions = await getSubmissions();
117
- const pendingSubmissions = submissions.nodes.filter(submission => submission.status === 'PENDING');
118
- // There should only ever be one
119
- if (pendingSubmissions.length)
120
- return pendingSubmissions[0];
121
- return null;
122
- }
123
- //# sourceMappingURL=graphql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/commands/utils/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAC,OAAO,EAAC,MAAM,oDAAoD,CAAA;AAC1E,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAE3E,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,oBAAoB,EAAE;IACrD,OAAO,EAAE;QACP,aAAa,EAAE,UAAU,wBAAwB,EAAE;KACpD;CACF,CAAC,CAAA;AAQF,MAAM,iBAAiB,GAAG,OA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