@shopify/shop-minis-cli 0.0.140 → 0.0.142
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/build/commands/app/link.js +3 -1
- package/build/commands/app/link.js.map +1 -1
- package/build/commands/create-mini/index.js +49 -22
- package/build/commands/create-mini/index.js.map +1 -1
- package/build/commands/dev/utils/app-screens.d.ts +8 -0
- package/build/commands/dev/utils/app-screens.js +156 -0
- package/build/commands/dev/utils/app-screens.js.map +1 -0
- package/build/commands/dev/utils/deeplink.d.ts +2 -1
- package/build/commands/dev/utils/deeplink.js +9 -2
- package/build/commands/dev/utils/deeplink.js.map +1 -1
- package/build/commands/dev/utils/env-config.d.ts +2 -0
- package/build/commands/dev/utils/env-config.js +47 -0
- package/build/commands/dev/utils/env-config.js.map +1 -0
- package/build/commands/dev/utils/interactive-terminal.d.ts +5 -1
- package/build/commands/dev/utils/interactive-terminal.js +70 -17
- package/build/commands/dev/utils/interactive-terminal.js.map +1 -1
- package/build/commands/dev/utils/metro/metro-reporter.js +0 -1
- package/build/commands/dev/utils/metro/metro-reporter.js.map +1 -1
- package/build/commands/setup/create.d.ts +1 -0
- package/build/commands/setup/create.js +51 -28
- package/build/commands/setup/create.js.map +1 -1
- package/build/commands/setup/index.js +9 -4
- package/build/commands/setup/index.js.map +1 -1
- package/build/data/get-linked-apps.d.ts +2 -2
- package/build/data/mini-create.d.ts +2 -5
- package/build/data/mini-create.js +4 -9
- package/build/data/mini-create.js.map +1 -1
- package/build/data/mini-link-app.d.ts +3 -2
- package/build/data/mini-link-app.js +8 -2
- package/build/data/mini-link-app.js.map +1 -1
- package/build/data/mini-unlink-app.d.ts +1 -1
- package/build/data/mini.d.ts +1 -1
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.d.ts +6 -6
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js +2 -2
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -1
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.d.ts +25 -18
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js +25 -30
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/schemas/manifest.schema.json +3 -8
- package/build/templates-index.js +5 -0
- package/build/templates-index.js.map +1 -1
- package/build/utils/sync-manifest.d.ts +2 -2
- package/build/utils/sync-manifest.js +9 -6
- package/build/utils/sync-manifest.js.map +1 -1
- package/package.json +3 -5
- package/templates/__template_getting_started/src/App.tsx +29 -0
- package/templates/__template_getting_started/src/index.tsx +9 -0
- package/templates/__template_getting_started/src/manifest.json +7 -0
- package/templates/__template_getting_started/src/screens/ExtensionsScreen.tsx +60 -0
- package/templates/__template_getting_started/src/screens/HomeScreen.tsx +127 -0
- package/templates/__template_getting_started/src/screens/NativeFeaturesScreen.tsx +103 -0
- package/templates/__template_getting_started/src/types/screens.ts +5 -0
- package/build/commands/dev/utils/qr-code.d.ts +0 -1
- package/build/commands/dev/utils/qr-code.js +0 -5
- package/build/commands/dev/utils/qr-code.js.map +0 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {useState} from 'react'
|
|
2
|
+
import {ScrollView} from 'react-native'
|
|
3
|
+
import {useNavigation} from '@react-navigation/native'
|
|
4
|
+
import {NativeStackNavigationProp} from '@react-navigation/native-stack'
|
|
5
|
+
import {
|
|
6
|
+
Box,
|
|
7
|
+
SafeAreaView,
|
|
8
|
+
Text,
|
|
9
|
+
TouchableProduct,
|
|
10
|
+
ProductCard,
|
|
11
|
+
useProducts,
|
|
12
|
+
useTheme,
|
|
13
|
+
Button,
|
|
14
|
+
TextField,
|
|
15
|
+
Picker,
|
|
16
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
17
|
+
|
|
18
|
+
import {RootStackParamList} from '../types/screens'
|
|
19
|
+
|
|
20
|
+
export function HomeScreen() {
|
|
21
|
+
const theme = useTheme()
|
|
22
|
+
const navigation =
|
|
23
|
+
useNavigation<NativeStackNavigationProp<RootStackParamList>>()
|
|
24
|
+
|
|
25
|
+
const {products} = useProducts(
|
|
26
|
+
[
|
|
27
|
+
'gid://shopify/Product/7632803594495',
|
|
28
|
+
'gid://shopify/Product/7541927510271',
|
|
29
|
+
'gid://shopify/Product/7541908734207',
|
|
30
|
+
'gid://shopify/Product/7541924987135',
|
|
31
|
+
],
|
|
32
|
+
'gid://shopify/Shop/62104633599'
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
const [pickerVisible, setPickerVisible] = useState(false)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<SafeAreaView
|
|
39
|
+
style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
|
|
40
|
+
>
|
|
41
|
+
<ScrollView>
|
|
42
|
+
<Box
|
|
43
|
+
flex={1}
|
|
44
|
+
paddingHorizontal="gutter"
|
|
45
|
+
backgroundColor="backgrounds-regular"
|
|
46
|
+
>
|
|
47
|
+
<Text variant="heroBold" marginBottom="s" marginTop="xs">
|
|
48
|
+
Hello, World!
|
|
49
|
+
</Text>
|
|
50
|
+
<Text variant="subtitle" marginBottom="s">
|
|
51
|
+
You just created a Shop Mini! Nice.
|
|
52
|
+
</Text>
|
|
53
|
+
<Text variant="subtitle" marginBottom="s">
|
|
54
|
+
Let's explore what a Mini can do.
|
|
55
|
+
</Text>
|
|
56
|
+
{products ? (
|
|
57
|
+
<>
|
|
58
|
+
<Text marginBottom="s">
|
|
59
|
+
First up: Product Cards (Since we're all about shopping,
|
|
60
|
+
right?)
|
|
61
|
+
</Text>
|
|
62
|
+
<Box flexDirection="row" paddingHorizontal="gutter">
|
|
63
|
+
{products.slice(0, 2).map(product => (
|
|
64
|
+
<Box key={product.id} flex={1} padding="xs">
|
|
65
|
+
<TouchableProduct product={product}>
|
|
66
|
+
<ProductCard
|
|
67
|
+
shopId="gid://shopify/Shop/62104633599"
|
|
68
|
+
product={product}
|
|
69
|
+
/>
|
|
70
|
+
</TouchableProduct>
|
|
71
|
+
</Box>
|
|
72
|
+
))}
|
|
73
|
+
</Box>
|
|
74
|
+
<Box flexDirection="row" paddingHorizontal="gutter">
|
|
75
|
+
{products.slice(2, 4).map(product => (
|
|
76
|
+
<Box key={product.id} flex={1} padding="xs">
|
|
77
|
+
<TouchableProduct product={product}>
|
|
78
|
+
<ProductCard
|
|
79
|
+
shopId="gid://shopify/Shop/62104633599"
|
|
80
|
+
product={product}
|
|
81
|
+
/>
|
|
82
|
+
</TouchableProduct>
|
|
83
|
+
</Box>
|
|
84
|
+
))}
|
|
85
|
+
</Box>
|
|
86
|
+
</>
|
|
87
|
+
) : null}
|
|
88
|
+
<Text marginBottom="s">
|
|
89
|
+
You can add interactions to your Mini with inputs.
|
|
90
|
+
</Text>
|
|
91
|
+
<Box marginBottom="s">
|
|
92
|
+
<TextField placeholder="Text input" />
|
|
93
|
+
</Box>
|
|
94
|
+
<Box marginBottom="s">
|
|
95
|
+
<Button
|
|
96
|
+
text="Open picker"
|
|
97
|
+
onPress={() => {
|
|
98
|
+
setPickerVisible(true)
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</Box>
|
|
102
|
+
{pickerVisible ? (
|
|
103
|
+
<Picker
|
|
104
|
+
items={[
|
|
105
|
+
{label: 'Red', value: 'Red'},
|
|
106
|
+
{label: 'Green', value: 'Green'},
|
|
107
|
+
{label: 'Blue', value: 'Blue'},
|
|
108
|
+
]}
|
|
109
|
+
handleDismiss={() => setPickerVisible(false)}
|
|
110
|
+
headerText="Select a color"
|
|
111
|
+
/>
|
|
112
|
+
) : null}
|
|
113
|
+
<Text marginBottom="s">
|
|
114
|
+
Ready for more? Let's explore native capabilities in the
|
|
115
|
+
screen.
|
|
116
|
+
</Text>
|
|
117
|
+
<Button
|
|
118
|
+
text="Next"
|
|
119
|
+
onPress={() => {
|
|
120
|
+
navigation.navigate('GettingStarted.NativeFeatures')
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</Box>
|
|
124
|
+
</ScrollView>
|
|
125
|
+
</SafeAreaView>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {ScrollView, TouchableOpacity} from 'react-native'
|
|
2
|
+
import {useNavigation} from '@react-navigation/native'
|
|
3
|
+
import {NativeStackNavigationProp} from '@react-navigation/native-stack'
|
|
4
|
+
import ImagePicker from 'react-native-image-crop-picker'
|
|
5
|
+
import Share from 'react-native-share'
|
|
6
|
+
import {
|
|
7
|
+
Box,
|
|
8
|
+
SafeAreaView,
|
|
9
|
+
Text,
|
|
10
|
+
useTheme,
|
|
11
|
+
Button,
|
|
12
|
+
Icon,
|
|
13
|
+
useMinisDimensions,
|
|
14
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
15
|
+
|
|
16
|
+
import {RootStackParamList} from '../types/screens'
|
|
17
|
+
|
|
18
|
+
export function NativeFeaturesScreen() {
|
|
19
|
+
const theme = useTheme()
|
|
20
|
+
const navigation =
|
|
21
|
+
useNavigation<NativeStackNavigationProp<RootStackParamList>>()
|
|
22
|
+
const {height, width} = useMinisDimensions()
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<SafeAreaView
|
|
26
|
+
style={{flex: 1, backgroundColor: theme.colors['backgrounds-regular']}}
|
|
27
|
+
>
|
|
28
|
+
<ScrollView>
|
|
29
|
+
<Box
|
|
30
|
+
flex={1}
|
|
31
|
+
paddingHorizontal="gutter"
|
|
32
|
+
backgroundColor="backgrounds-regular"
|
|
33
|
+
>
|
|
34
|
+
<Box>
|
|
35
|
+
<TouchableOpacity
|
|
36
|
+
onPress={() => navigation.goBack()}
|
|
37
|
+
accessibilityLabel="Navigate back"
|
|
38
|
+
>
|
|
39
|
+
<Box marginTop="xs">
|
|
40
|
+
<Icon name="arrow-left" />
|
|
41
|
+
</Box>
|
|
42
|
+
</TouchableOpacity>
|
|
43
|
+
</Box>
|
|
44
|
+
<Text variant="heroBold" marginBottom="s" marginTop="xs">
|
|
45
|
+
Unlock Native Capabilities
|
|
46
|
+
</Text>
|
|
47
|
+
<Text variant="subtitle" marginBottom="s">
|
|
48
|
+
Let's explore the native capabilities your Shop Mini can
|
|
49
|
+
access.
|
|
50
|
+
</Text>
|
|
51
|
+
<Box marginBottom="s">
|
|
52
|
+
<Button
|
|
53
|
+
text="Camera access"
|
|
54
|
+
onPress={async () => {
|
|
55
|
+
await ImagePicker.openCamera({}).then(image => {
|
|
56
|
+
console.log(image)
|
|
57
|
+
})
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
<Text variant="bodySmall" marginTop="xs">
|
|
61
|
+
Run this Mini on a real device to access the camera.
|
|
62
|
+
</Text>
|
|
63
|
+
</Box>
|
|
64
|
+
<Box marginBottom="s">
|
|
65
|
+
<Button
|
|
66
|
+
text="Gallery access"
|
|
67
|
+
onPress={async () => {
|
|
68
|
+
await ImagePicker.openPicker({}).then(image => {
|
|
69
|
+
console.log(image)
|
|
70
|
+
})
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
</Box>
|
|
74
|
+
<Box marginBottom="s">
|
|
75
|
+
<Button
|
|
76
|
+
text="Share sheet"
|
|
77
|
+
onPress={async () => {
|
|
78
|
+
await Share.open({
|
|
79
|
+
url: 'https://shop.app/minis',
|
|
80
|
+
title: 'title',
|
|
81
|
+
})
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</Box>
|
|
85
|
+
<Box marginBottom="s">
|
|
86
|
+
<Text>Screen height: {height}</Text>
|
|
87
|
+
<Text>Screen width: {width}</Text>
|
|
88
|
+
</Box>
|
|
89
|
+
<Text marginBottom="s">
|
|
90
|
+
But how do people find your Mini? Let's talk about that in the
|
|
91
|
+
next screen.
|
|
92
|
+
</Text>
|
|
93
|
+
<Button
|
|
94
|
+
text="Next"
|
|
95
|
+
onPress={() => {
|
|
96
|
+
navigation.navigate('GettingStarted.Extensions')
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
</Box>
|
|
100
|
+
</ScrollView>
|
|
101
|
+
</SafeAreaView>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function printQRCode(content: string): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"qr-code.js","sourceRoot":"","sources":["../../../../src/commands/dev/utils/qr-code.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe;IAC/C,cAAc,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,EAAE,CAAC,IAAY,EAAE,EAAE,CAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC"}
|