@shopify/shop-minis-cli 0.0.121 → 0.0.122
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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
dependencies:
|
|
2
|
+
override:
|
|
3
|
+
- yarn install --no-progress --ignore-engines --frozen-lockfile
|
|
4
|
+
|
|
5
|
+
deploy:
|
|
6
|
+
override:
|
|
7
|
+
- yarn build
|
|
8
|
+
- generate-local-npmrc "@shopify:registry=https://registry.npmjs.org/"
|
|
9
|
+
- npm publish --tag snapshot --new-version 0.0.0-snapshot.$(date +%Y%m%d%H%M%S) --no-git-tag-version --access public --verbose
|
|
@@ -1,52 +1,37 @@
|
|
|
1
1
|
import {useMemo} from 'react'
|
|
2
2
|
import {StatusBar} from 'react-native'
|
|
3
3
|
import {
|
|
4
|
-
ImageCollectionV2EntryPointItem,
|
|
5
4
|
ShoppablePosts,
|
|
6
5
|
useMinisParams,
|
|
7
|
-
imageCollectionV2EntrypointFixture,
|
|
8
6
|
MINIS_SANDBOX_SHOP_GID,
|
|
9
7
|
SafeAreaView,
|
|
10
8
|
Box,
|
|
9
|
+
shoppablePostsFixture,
|
|
11
10
|
} from '@shopify/shop-minis-platform-sdk'
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* A stub type to get you started. Remove this in favor of the type of your extension input query data moving forward.
|
|
14
|
+
*/
|
|
15
|
+
interface MyExtensionDataType {
|
|
16
|
+
shopId: string
|
|
17
|
+
}
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
19
|
+
export function App() {
|
|
20
|
+
const {extensionData} = useMinisParams<MyExtensionDataType>()
|
|
21
|
+
const shopId = extensionData?.shopId || MINIS_SANDBOX_SHOP_GID
|
|
20
22
|
|
|
21
23
|
const shoppablePosts = useMemo(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)
|
|
27
|
-
}, [entryPoint])
|
|
24
|
+
// Format your data in to the shape expected by `<ShoppablePosts />`
|
|
25
|
+
// return getShoppablePostsFromExtensionData(extensionData)
|
|
26
|
+
return shoppablePostsFixture
|
|
27
|
+
}, [])
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
|
-
<Box backgroundColor="
|
|
31
|
-
<StatusBar barStyle="
|
|
30
|
+
<Box backgroundColor="foregrounds-contrasting-inverted" flex={1}>
|
|
31
|
+
<StatusBar barStyle="light-content" />
|
|
32
32
|
<SafeAreaView style={{flex: 1}}>
|
|
33
|
-
<ShoppablePosts initialItems={shoppablePosts} shopId={
|
|
33
|
+
<ShoppablePosts initialItems={shoppablePosts} shopId={shopId} />
|
|
34
34
|
</SafeAreaView>
|
|
35
35
|
</Box>
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
function mapEntryPointCollectionItemsToShoppablePosts(
|
|
40
|
-
collectionItems: ImageCollectionV2EntryPointItem[]
|
|
41
|
-
) {
|
|
42
|
-
return collectionItems.map(item => {
|
|
43
|
-
const {relatedProducts: _relatedProducts, ...rest} = item
|
|
44
|
-
return {
|
|
45
|
-
...rest,
|
|
46
|
-
image: {url: item.image.url},
|
|
47
|
-
relatedProductsIds: item.relatedProducts.map(
|
|
48
|
-
relatedProduct => relatedProduct.productId
|
|
49
|
-
),
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
}
|
|
@@ -2,46 +2,33 @@ import {useMemo} from 'react'
|
|
|
2
2
|
import {StatusBar} from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
ShoppableVideos,
|
|
5
|
-
VideoCollectionV2EntryPointItem,
|
|
6
5
|
useMinisParams,
|
|
7
|
-
videoCollectionV2EntrypointFixture,
|
|
8
6
|
MINIS_SANDBOX_SHOP_GID,
|
|
9
7
|
Box,
|
|
8
|
+
shoppableVideosFixture,
|
|
10
9
|
} from '@shopify/shop-minis-platform-sdk'
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A stub type to get you started. Remove this in favor of the type of your extension input query data moving forward.
|
|
13
|
+
*/
|
|
14
|
+
interface MyExtensionDataType {
|
|
15
|
+
shopId: string
|
|
16
|
+
}
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
18
|
+
export function App() {
|
|
19
|
+
const {extensionData} = useMinisParams<MyExtensionDataType>()
|
|
20
|
+
const shopId = extensionData?.shopId || MINIS_SANDBOX_SHOP_GID
|
|
19
21
|
|
|
20
22
|
const shoppableVideos = useMemo(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)
|
|
26
|
-
}, [entryPoint])
|
|
23
|
+
// Format your data in to the shape expected by `<ShoppableVideos />`
|
|
24
|
+
// return getShoppableVideosFromExtensionData(extensionData)
|
|
25
|
+
return shoppableVideosFixture
|
|
26
|
+
}, [])
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<Box backgroundColor="foregrounds-contrasting-inverted" flex={1}>
|
|
30
30
|
<StatusBar barStyle="light-content" />
|
|
31
|
-
<ShoppableVideos items={shoppableVideos} shopId={
|
|
31
|
+
<ShoppableVideos items={shoppableVideos} shopId={shopId} />
|
|
32
32
|
</Box>
|
|
33
33
|
)
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
function mapEntryPointCollectionItemsToShoppableVideos(
|
|
37
|
-
collectionItems: VideoCollectionV2EntryPointItem[]
|
|
38
|
-
) {
|
|
39
|
-
return collectionItems.map(item => ({
|
|
40
|
-
externalId: item.externalId,
|
|
41
|
-
videoUrl: item.video.embeddedUrl,
|
|
42
|
-
fallbackImageUrl: item.fallbackImage.url,
|
|
43
|
-
relatedProductsIds: item.relatedProducts.map(
|
|
44
|
-
relatedProduct => relatedProduct.productId
|
|
45
|
-
),
|
|
46
|
-
}))
|
|
47
|
-
}
|