@shopify/shop-minis-cli 0.0.92 → 0.0.93
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/codemod/releases/index.js +2 -0
- package/build/commands/codemod/releases/index.js.map +1 -1
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.js +15 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.js +13 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/index.d.ts +6 -0
- package/build/commands/codemod/releases/v0-0-93/index.js +7 -0
- package/build/commands/codemod/releases/v0-0-93/index.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.js +53 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.js +43 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.js +49 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.js +42 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-93.js +48 -0
- package/build/commands/codemod/releases/v0-0-93.js.map +1 -0
- package/package.json +1 -1
- package/templates/__template_blank/src/App.tsx +6 -4
- package/templates/__template_shoppable_posts/src/App.tsx +12 -2
- package/templates/__template_shoppable_videos/src/App.tsx +9 -2
|
@@ -22,6 +22,7 @@ import v0x0x85Upgrade from './v0-0-85.js';
|
|
|
22
22
|
import v0x0x89Upgrade from './v0-0-89.js';
|
|
23
23
|
import v0x0x91Upgrade from './v0-0-91/index.js';
|
|
24
24
|
import v0x0x92Upgrade from './v0-0-92.js';
|
|
25
|
+
import v0x0x93Upgrade from './v0-0-93.js';
|
|
25
26
|
const upgrades = [
|
|
26
27
|
v0x0x42Upgrade,
|
|
27
28
|
v0x0x43Upgrade,
|
|
@@ -44,6 +45,7 @@ const upgrades = [
|
|
|
44
45
|
v0x0x89Upgrade,
|
|
45
46
|
v0x0x91Upgrade,
|
|
46
47
|
v0x0x92Upgrade,
|
|
48
|
+
v0x0x93Upgrade,
|
|
47
49
|
];
|
|
48
50
|
// the list of upgrades must be sorted by version. just making sure of it
|
|
49
51
|
upgrades.sort(({ version: upgradeVersion1 }, { version: upgradeVersion2 }) => semverGreaterThan(upgradeVersion1, upgradeVersion2) ? 1 : -1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/codemod/releases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,IAAI,iBAAiB,EACvB,GAAG,IAAI,kBAAkB,GAC1B,MAAM,QAAQ,CAAA;AACf,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,MAAM,oBAAoB,CAAA;AAC/C,OAAO,cAAc,MAAM,cAAc,CAAA;AACzC,OAAO,cAAc,MAAM,cAAc,CAAA;AACzC,OAAO,cAAc,MAAM,cAAc,CAAA;AACzC,OAAO,cAAc,MAAM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;IACC,WAAW,CACT,kCAAkC,WAAW,eAAe,SAAS,EAAE,CACxE,CAAA;IACD,KAAK,MAAM,EAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAC,IAAI,QAAQ,EAAE;QAC5D,IACE,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC;YACvC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,EACtC;YACA,WAAW,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAA;YACtD,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;YACvC,wBAAwB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;SAChD;KACF;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA,CAAC,gDAAgD;AAClE,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAe,EAAE,YAAsB;IACvE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACxB,OAAM;KACP;IACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,OAAO,iBAAiB,CAAC,CAAC,CAAA;IAC9E,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;QACtC,OAAO,CAAC,GAAG,CAAC,KAAK,gBAAgB,EAAE,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const blankAppTsxAfter = "import {StatusBar} from 'react-native'\nimport {Box, Text, SafeAreaView} from '@shopify/shop-minis-platform-sdk'\n\nexport function App() {\n return (\n <Box flex={1} backgroundColor=\"backgrounds-regular\">\n <StatusBar barStyle=\"dark-content\" />\n <SafeAreaView style={{flex: 1, justifyContent: 'center'}}>\n <Text textAlign=\"center\">Fill in the blank</Text>\n </SafeAreaView>\n </Box>\n )\n}\n";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const blankAppTsxAfter = `import {StatusBar} from 'react-native'
|
|
2
|
+
import {Box, Text, SafeAreaView} from '@shopify/shop-minis-platform-sdk'
|
|
3
|
+
|
|
4
|
+
export function App() {
|
|
5
|
+
return (
|
|
6
|
+
<Box flex={1} backgroundColor="backgrounds-regular">
|
|
7
|
+
<StatusBar barStyle="dark-content" />
|
|
8
|
+
<SafeAreaView style={{flex: 1, justifyContent: 'center'}}>
|
|
9
|
+
<Text textAlign="center">Fill in the blank</Text>
|
|
10
|
+
</SafeAreaView>
|
|
11
|
+
</Box>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
//# sourceMappingURL=App-after.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-after.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/blank/App-after.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;CAa/B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const blankAppTsxBefore = "import {Box, Text, SafeAreaView} from '@shopify/shop-minis-platform-sdk'\n\nexport function App() {\n return (\n <SafeAreaView style={{flex: 1}}>\n <Box flex={1} padding=\"m\" backgroundColor=\"backgrounds-regular\">\n <Text textAlign=\"center\">Fill in the blank</Text>\n </Box>\n </SafeAreaView>\n )\n}\n";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const blankAppTsxBefore = `import {Box, Text, SafeAreaView} from '@shopify/shop-minis-platform-sdk'
|
|
2
|
+
|
|
3
|
+
export function App() {
|
|
4
|
+
return (
|
|
5
|
+
<SafeAreaView style={{flex: 1}}>
|
|
6
|
+
<Box flex={1} padding="m" backgroundColor="backgrounds-regular">
|
|
7
|
+
<Text textAlign="center">Fill in the blank</Text>
|
|
8
|
+
</Box>
|
|
9
|
+
</SafeAreaView>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
//# sourceMappingURL=App-before.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-before.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/blank/App-before.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;CAWhC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './blank/App-before.js';
|
|
2
|
+
export * from './blank/App-after.js';
|
|
3
|
+
export * from './shoppable-posts/App-before.js';
|
|
4
|
+
export * from './shoppable-posts/App-after.js';
|
|
5
|
+
export * from './shoppable-videos/App-before.js';
|
|
6
|
+
export * from './shoppable-videos/App-after.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './blank/App-before.js';
|
|
2
|
+
export * from './blank/App-after.js';
|
|
3
|
+
export * from './shoppable-posts/App-before.js';
|
|
4
|
+
export * from './shoppable-posts/App-after.js';
|
|
5
|
+
export * from './shoppable-videos/App-before.js';
|
|
6
|
+
export * from './shoppable-videos/App-after.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/codemod/releases/v0-0-93/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shoppablePostsAppTsxAfter = "import {useMemo} from 'react'\nimport {StatusBar} from 'react-native'\nimport {\n ImageCollectionV2EntryPointItem,\n ShoppablePosts,\n useMinisParams,\n imageCollectionV2EntrypointFixture,\n MINIS_SANDBOX_SHOP_GID,\n SafeAreaView,\n Box,\n} from '@shopify/shop-minis-platform-sdk'\n\nexport function App() {\n const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()\n\n // Fixtures provided in the SDK will get you started without entrypoints.\n // Remove them once you have you have your test store setup with your own entrypoints.\n const entryPoint = _entryPoint || imageCollectionV2EntrypointFixture\n const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID\n\n const shoppablePosts = useMemo(() => {\n const collectionItems =\n entryPoint?.type === 'IMAGE_COLLECTION_V2'\n ? entryPoint.collectionItems\n : []\n return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)\n }, [entryPoint])\n\n return (\n <Box backgroundColor=\"backgrounds-regular\" flex={1}>\n <StatusBar barStyle=\"dark-content\" />\n <SafeAreaView style={{flex: 1}}>\n <ShoppablePosts items={shoppablePosts} shopId={shopGID} />\n </SafeAreaView>\n </Box>\n )\n}\n\nfunction mapEntryPointCollectionItemsToShoppablePosts(\n collectionItems: ImageCollectionV2EntryPointItem[]\n) {\n return collectionItems.map(item => ({\n externalId: item.externalId,\n image: {url: item.image.url},\n description: item.description,\n postedAt: item.displayDate,\n relatedProductsIds: item.relatedProducts.map(\n relatedProduct => relatedProduct.productId\n ),\n }))\n}\n";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const shoppablePostsAppTsxAfter = `import {useMemo} from 'react'
|
|
2
|
+
import {StatusBar} from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
ImageCollectionV2EntryPointItem,
|
|
5
|
+
ShoppablePosts,
|
|
6
|
+
useMinisParams,
|
|
7
|
+
imageCollectionV2EntrypointFixture,
|
|
8
|
+
MINIS_SANDBOX_SHOP_GID,
|
|
9
|
+
SafeAreaView,
|
|
10
|
+
Box,
|
|
11
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
12
|
+
|
|
13
|
+
export function App() {
|
|
14
|
+
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
15
|
+
|
|
16
|
+
// Fixtures provided in the SDK will get you started without entrypoints.
|
|
17
|
+
// Remove them once you have you have your test store setup with your own entrypoints.
|
|
18
|
+
const entryPoint = _entryPoint || imageCollectionV2EntrypointFixture
|
|
19
|
+
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
20
|
+
|
|
21
|
+
const shoppablePosts = useMemo(() => {
|
|
22
|
+
const collectionItems =
|
|
23
|
+
entryPoint?.type === 'IMAGE_COLLECTION_V2'
|
|
24
|
+
? entryPoint.collectionItems
|
|
25
|
+
: []
|
|
26
|
+
return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)
|
|
27
|
+
}, [entryPoint])
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box backgroundColor="backgrounds-regular" flex={1}>
|
|
31
|
+
<StatusBar barStyle="dark-content" />
|
|
32
|
+
<SafeAreaView style={{flex: 1}}>
|
|
33
|
+
<ShoppablePosts items={shoppablePosts} shopId={shopGID} />
|
|
34
|
+
</SafeAreaView>
|
|
35
|
+
</Box>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function mapEntryPointCollectionItemsToShoppablePosts(
|
|
40
|
+
collectionItems: ImageCollectionV2EntryPointItem[]
|
|
41
|
+
) {
|
|
42
|
+
return collectionItems.map(item => ({
|
|
43
|
+
externalId: item.externalId,
|
|
44
|
+
image: {url: item.image.url},
|
|
45
|
+
description: item.description,
|
|
46
|
+
postedAt: item.displayDate,
|
|
47
|
+
relatedProductsIds: item.relatedProducts.map(
|
|
48
|
+
relatedProduct => relatedProduct.productId
|
|
49
|
+
),
|
|
50
|
+
}))
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
//# sourceMappingURL=App-after.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-after.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shoppablePostsAppTsxBefore = "import {\n ImageCollectionV2EntryPointItem,\n ShoppablePosts,\n useMinisParams,\n imageCollectionV2EntrypointFixture,\n MINIS_SANDBOX_SHOP_GID,\n} from '@shopify/shop-minis-platform-sdk'\nimport {useMemo} from 'react'\n\nexport function App() {\n const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()\n\n // Fixtures provided in the SDK will get you started without entrypoints.\n // Remove them once you have you have your test store setup with your own entrypoints.\n const entryPoint = _entryPoint || imageCollectionV2EntrypointFixture\n const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID\n\n const shoppablePosts = useMemo(() => {\n const collectionItems =\n entryPoint?.type === 'IMAGE_COLLECTION_V2'\n ? entryPoint.collectionItems\n : []\n return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)\n }, [entryPoint])\n\n return <ShoppablePosts items={shoppablePosts} shopId={shopGID} />\n}\n\nfunction mapEntryPointCollectionItemsToShoppablePosts(\n collectionItems: ImageCollectionV2EntryPointItem[]\n) {\n return collectionItems.map(item => ({\n externalId: item.externalId,\n image: {url: item.image.url},\n description: item.description,\n postedAt: item.displayDate,\n relatedProductsIds: item.relatedProducts.map(\n relatedProduct => relatedProduct.productId\n ),\n }))\n}\n";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const shoppablePostsAppTsxBefore = `import {
|
|
2
|
+
ImageCollectionV2EntryPointItem,
|
|
3
|
+
ShoppablePosts,
|
|
4
|
+
useMinisParams,
|
|
5
|
+
imageCollectionV2EntrypointFixture,
|
|
6
|
+
MINIS_SANDBOX_SHOP_GID,
|
|
7
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
8
|
+
import {useMemo} from 'react'
|
|
9
|
+
|
|
10
|
+
export function App() {
|
|
11
|
+
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
12
|
+
|
|
13
|
+
// Fixtures provided in the SDK will get you started without entrypoints.
|
|
14
|
+
// Remove them once you have you have your test store setup with your own entrypoints.
|
|
15
|
+
const entryPoint = _entryPoint || imageCollectionV2EntrypointFixture
|
|
16
|
+
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
17
|
+
|
|
18
|
+
const shoppablePosts = useMemo(() => {
|
|
19
|
+
const collectionItems =
|
|
20
|
+
entryPoint?.type === 'IMAGE_COLLECTION_V2'
|
|
21
|
+
? entryPoint.collectionItems
|
|
22
|
+
: []
|
|
23
|
+
return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)
|
|
24
|
+
}, [entryPoint])
|
|
25
|
+
|
|
26
|
+
return <ShoppablePosts items={shoppablePosts} shopId={shopGID} />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mapEntryPointCollectionItemsToShoppablePosts(
|
|
30
|
+
collectionItems: ImageCollectionV2EntryPointItem[]
|
|
31
|
+
) {
|
|
32
|
+
return collectionItems.map(item => ({
|
|
33
|
+
externalId: item.externalId,
|
|
34
|
+
image: {url: item.image.url},
|
|
35
|
+
description: item.description,
|
|
36
|
+
postedAt: item.displayDate,
|
|
37
|
+
relatedProductsIds: item.relatedProducts.map(
|
|
38
|
+
relatedProduct => relatedProduct.productId
|
|
39
|
+
),
|
|
40
|
+
}))
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=App-before.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-before.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shoppableVideosAppTsxAfter = "import {useMemo} from 'react'\nimport {StatusBar} from 'react-native'\nimport {\n ShoppableVideos,\n VideoCollectionV2EntryPointItem,\n useMinisParams,\n videoCollectionV2EntrypointFixture,\n MINIS_SANDBOX_SHOP_GID,\n Box,\n} from '@shopify/shop-minis-platform-sdk'\n\nexport function App() {\n const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()\n\n // Fixtures provided in the SDK will get you started without entrypoints.\n // Remove them once you have you have your test store setup with your own entrypoints.\n const entryPoint = _entryPoint || videoCollectionV2EntrypointFixture\n const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID\n\n const shoppableVideos = useMemo(() => {\n const collectionItems =\n entryPoint?.type === 'VIDEO_COLLECTION_V2'\n ? entryPoint.collectionItems\n : []\n return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)\n }, [entryPoint])\n\n return (\n <Box backgroundColor=\"foregrounds-contrasting-inverted\" flex={1}>\n <StatusBar barStyle=\"light-content\" />\n <ShoppableVideos items={shoppableVideos} shopId={shopGID} />\n </Box>\n )\n}\n\nfunction mapEntryPointCollectionItemsToShoppableVideos(\n collectionItems: VideoCollectionV2EntryPointItem[]\n) {\n return collectionItems.map(item => ({\n externalId: item.externalId,\n videoUrl: item.video.embeddedUrl,\n fallbackImageUrl: item.fallbackImage.url,\n relatedProductsIds: item.relatedProducts.map(\n relatedProduct => relatedProduct.productId\n ),\n }))\n}\n";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export const shoppableVideosAppTsxAfter = `import {useMemo} from 'react'
|
|
2
|
+
import {StatusBar} from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
ShoppableVideos,
|
|
5
|
+
VideoCollectionV2EntryPointItem,
|
|
6
|
+
useMinisParams,
|
|
7
|
+
videoCollectionV2EntrypointFixture,
|
|
8
|
+
MINIS_SANDBOX_SHOP_GID,
|
|
9
|
+
Box,
|
|
10
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
11
|
+
|
|
12
|
+
export function App() {
|
|
13
|
+
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
14
|
+
|
|
15
|
+
// Fixtures provided in the SDK will get you started without entrypoints.
|
|
16
|
+
// Remove them once you have you have your test store setup with your own entrypoints.
|
|
17
|
+
const entryPoint = _entryPoint || videoCollectionV2EntrypointFixture
|
|
18
|
+
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
19
|
+
|
|
20
|
+
const shoppableVideos = useMemo(() => {
|
|
21
|
+
const collectionItems =
|
|
22
|
+
entryPoint?.type === 'VIDEO_COLLECTION_V2'
|
|
23
|
+
? entryPoint.collectionItems
|
|
24
|
+
: []
|
|
25
|
+
return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)
|
|
26
|
+
}, [entryPoint])
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Box backgroundColor="foregrounds-contrasting-inverted" flex={1}>
|
|
30
|
+
<StatusBar barStyle="light-content" />
|
|
31
|
+
<ShoppableVideos items={shoppableVideos} shopId={shopGID} />
|
|
32
|
+
</Box>
|
|
33
|
+
)
|
|
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
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
//# sourceMappingURL=App-after.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-after.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shoppableVideosAppTsxBefore = "import {\n ShoppableVideos,\n VideoCollectionV2EntryPointItem,\n useMinisParams,\n videoCollectionV2EntrypointFixture,\n MINIS_SANDBOX_SHOP_GID,\n} from '@shopify/shop-minis-platform-sdk'\nimport {useMemo} from 'react'\n\nexport function App() {\n const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()\n\n // Fixtures provided in the SDK will get you started without entrypoints.\n // Remove them once you have you have your test store setup with your own entrypoints.\n const entryPoint = _entryPoint || videoCollectionV2EntrypointFixture\n const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID\n\n const shoppableVideos = useMemo(() => {\n const collectionItems =\n entryPoint?.type === 'VIDEO_COLLECTION_V2'\n ? entryPoint.collectionItems\n : []\n return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)\n }, [entryPoint])\n\n return <ShoppableVideos items={shoppableVideos} shopId={shopGID} />\n}\n\nfunction mapEntryPointCollectionItemsToShoppableVideos(\n collectionItems: VideoCollectionV2EntryPointItem[]\n) {\n return collectionItems.map(item => ({\n externalId: item.externalId,\n videoUrl: item.video.embeddedUrl,\n fallbackImageUrl: item.fallbackImage.url,\n relatedProductsIds: item.relatedProducts.map(\n relatedProduct => relatedProduct.productId\n ),\n }))\n}\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const shoppableVideosAppTsxBefore = `import {
|
|
2
|
+
ShoppableVideos,
|
|
3
|
+
VideoCollectionV2EntryPointItem,
|
|
4
|
+
useMinisParams,
|
|
5
|
+
videoCollectionV2EntrypointFixture,
|
|
6
|
+
MINIS_SANDBOX_SHOP_GID,
|
|
7
|
+
} from '@shopify/shop-minis-platform-sdk'
|
|
8
|
+
import {useMemo} from 'react'
|
|
9
|
+
|
|
10
|
+
export function App() {
|
|
11
|
+
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
12
|
+
|
|
13
|
+
// Fixtures provided in the SDK will get you started without entrypoints.
|
|
14
|
+
// Remove them once you have you have your test store setup with your own entrypoints.
|
|
15
|
+
const entryPoint = _entryPoint || videoCollectionV2EntrypointFixture
|
|
16
|
+
const shopGID = entryPointParams?.shopGID || MINIS_SANDBOX_SHOP_GID
|
|
17
|
+
|
|
18
|
+
const shoppableVideos = useMemo(() => {
|
|
19
|
+
const collectionItems =
|
|
20
|
+
entryPoint?.type === 'VIDEO_COLLECTION_V2'
|
|
21
|
+
? entryPoint.collectionItems
|
|
22
|
+
: []
|
|
23
|
+
return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)
|
|
24
|
+
}, [entryPoint])
|
|
25
|
+
|
|
26
|
+
return <ShoppableVideos items={shoppableVideos} shopId={shopGID} />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mapEntryPointCollectionItemsToShoppableVideos(
|
|
30
|
+
collectionItems: VideoCollectionV2EntryPointItem[]
|
|
31
|
+
) {
|
|
32
|
+
return collectionItems.map(item => ({
|
|
33
|
+
externalId: item.externalId,
|
|
34
|
+
videoUrl: item.video.embeddedUrl,
|
|
35
|
+
fallbackImageUrl: item.fallbackImage.url,
|
|
36
|
+
relatedProductsIds: item.relatedProducts.map(
|
|
37
|
+
relatedProduct => relatedProduct.productId
|
|
38
|
+
),
|
|
39
|
+
}))
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
//# sourceMappingURL=App-before.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-before.js","sourceRoot":"","sources":["../../../../../../src/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC1C,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { SemVer } from 'semver';
|
|
4
|
+
import { blankAppTsxBefore, blankAppTsxAfter, shoppablePostsAppTsxBefore, shoppablePostsAppTsxAfter, shoppableVideosAppTsxBefore, shoppableVideosAppTsxAfter, } from './v0-0-93/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Update the templates to use SafeAreaView correctly
|
|
7
|
+
*
|
|
8
|
+
* Diff: https://github.com/Shopify/shop-minis-cli/compare/v0.0.92...v0.0.93
|
|
9
|
+
*/
|
|
10
|
+
async function applyUpgrade() {
|
|
11
|
+
const existingAppTsxPath = path.join(process.cwd(), 'src', 'App.tsx');
|
|
12
|
+
let existingAppTsxContent = null;
|
|
13
|
+
let newAppTsxContent = null;
|
|
14
|
+
try {
|
|
15
|
+
existingAppTsxContent = await readFile(existingAppTsxPath, {
|
|
16
|
+
encoding: 'utf-8',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
// If the App.tsx file doesn't exist or is unreadable for some reason, we don't need to do anything
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Only apply the upgrade if the App.tsx file is still one of the old templates
|
|
24
|
+
if (existingAppTsxContent === blankAppTsxBefore) {
|
|
25
|
+
newAppTsxContent = blankAppTsxAfter;
|
|
26
|
+
}
|
|
27
|
+
else if (existingAppTsxContent === shoppablePostsAppTsxBefore) {
|
|
28
|
+
newAppTsxContent = shoppablePostsAppTsxAfter;
|
|
29
|
+
}
|
|
30
|
+
else if (existingAppTsxContent === shoppableVideosAppTsxBefore) {
|
|
31
|
+
newAppTsxContent = shoppableVideosAppTsxAfter;
|
|
32
|
+
}
|
|
33
|
+
if (newAppTsxContent) {
|
|
34
|
+
await writeFile(existingAppTsxPath, newAppTsxContent, {
|
|
35
|
+
encoding: 'utf-8',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const releaseNotes = [
|
|
40
|
+
'Ensure the templates use SafeAreaView correctly',
|
|
41
|
+
];
|
|
42
|
+
const exports = {
|
|
43
|
+
releaseNotes,
|
|
44
|
+
applyUpgrade,
|
|
45
|
+
version: new SemVer('0.0.93'),
|
|
46
|
+
};
|
|
47
|
+
export default exports;
|
|
48
|
+
//# sourceMappingURL=v0-0-93.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v0-0-93.js","sourceRoot":"","sources":["../../../../src/commands/codemod/releases/v0-0-93.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AACpD,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAA;AAG7B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,oBAAoB,CAAA;AAE3B;;;;GAIG;AACH,KAAK,UAAU,YAAY;IACzB,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACrE,IAAI,qBAAqB,GAAG,IAAI,CAAA;IAChC,IAAI,gBAAgB,GAAG,IAAI,CAAA;IAE3B,IAAI;QACF,qBAAqB,GAAG,MAAM,QAAQ,CAAC,kBAAkB,EAAE;YACzD,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,mGAAmG;QACnG,OAAM;KACP;IAED,+EAA+E;IAC/E,IAAI,qBAAqB,KAAK,iBAAiB,EAAE;QAC/C,gBAAgB,GAAG,gBAAgB,CAAA;KACpC;SAAM,IAAI,qBAAqB,KAAK,0BAA0B,EAAE;QAC/D,gBAAgB,GAAG,yBAAyB,CAAA;KAC7C;SAAM,IAAI,qBAAqB,KAAK,2BAA2B,EAAE;QAChE,gBAAgB,GAAG,0BAA0B,CAAA;KAC9C;IAED,IAAI,gBAAgB,EAAE;QACpB,MAAM,SAAS,CAAC,kBAAkB,EAAE,gBAAgB,EAAE;YACpD,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAA;KACH;AACH,CAAC;AAED,MAAM,YAAY,GAAa;IAC7B,iDAAiD;CAClD,CAAA;AAED,MAAM,OAAO,GAA8B;IACzC,YAAY;IACZ,YAAY;IACZ,OAAO,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC;CAC9B,CAAA;AAED,eAAe,OAAO,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import {StatusBar} from 'react-native'
|
|
1
2
|
import {Box, Text, SafeAreaView} from '@shopify/shop-minis-platform-sdk'
|
|
2
3
|
|
|
3
4
|
export function App() {
|
|
4
5
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
6
|
+
<Box flex={1} backgroundColor="backgrounds-regular">
|
|
7
|
+
<StatusBar barStyle="dark-content" />
|
|
8
|
+
<SafeAreaView style={{flex: 1, justifyContent: 'center'}}>
|
|
7
9
|
<Text textAlign="center">Fill in the blank</Text>
|
|
8
|
-
</
|
|
9
|
-
</
|
|
10
|
+
</SafeAreaView>
|
|
11
|
+
</Box>
|
|
10
12
|
)
|
|
11
13
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import {useMemo} from 'react'
|
|
2
|
+
import {StatusBar} from 'react-native'
|
|
1
3
|
import {
|
|
2
4
|
ImageCollectionV2EntryPointItem,
|
|
3
5
|
ShoppablePosts,
|
|
4
6
|
useMinisParams,
|
|
5
7
|
imageCollectionV2EntrypointFixture,
|
|
6
8
|
MINIS_SANDBOX_SHOP_GID,
|
|
9
|
+
SafeAreaView,
|
|
10
|
+
Box,
|
|
7
11
|
} from '@shopify/shop-minis-platform-sdk'
|
|
8
|
-
import {useMemo} from 'react'
|
|
9
12
|
|
|
10
13
|
export function App() {
|
|
11
14
|
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
@@ -23,7 +26,14 @@ export function App() {
|
|
|
23
26
|
return mapEntryPointCollectionItemsToShoppablePosts(collectionItems)
|
|
24
27
|
}, [entryPoint])
|
|
25
28
|
|
|
26
|
-
return
|
|
29
|
+
return (
|
|
30
|
+
<Box backgroundColor="backgrounds-regular" flex={1}>
|
|
31
|
+
<StatusBar barStyle="dark-content" />
|
|
32
|
+
<SafeAreaView style={{flex: 1}}>
|
|
33
|
+
<ShoppablePosts items={shoppablePosts} shopId={shopGID} />
|
|
34
|
+
</SafeAreaView>
|
|
35
|
+
</Box>
|
|
36
|
+
)
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
function mapEntryPointCollectionItemsToShoppablePosts(
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import {useMemo} from 'react'
|
|
2
|
+
import {StatusBar} from 'react-native'
|
|
1
3
|
import {
|
|
2
4
|
ShoppableVideos,
|
|
3
5
|
VideoCollectionV2EntryPointItem,
|
|
4
6
|
useMinisParams,
|
|
5
7
|
videoCollectionV2EntrypointFixture,
|
|
6
8
|
MINIS_SANDBOX_SHOP_GID,
|
|
9
|
+
Box,
|
|
7
10
|
} from '@shopify/shop-minis-platform-sdk'
|
|
8
|
-
import {useMemo} from 'react'
|
|
9
11
|
|
|
10
12
|
export function App() {
|
|
11
13
|
const {entryPointParams, entryPoint: _entryPoint} = useMinisParams()
|
|
@@ -23,7 +25,12 @@ export function App() {
|
|
|
23
25
|
return mapEntryPointCollectionItemsToShoppableVideos(collectionItems)
|
|
24
26
|
}, [entryPoint])
|
|
25
27
|
|
|
26
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
<Box backgroundColor="foregrounds-contrasting-inverted" flex={1}>
|
|
30
|
+
<StatusBar barStyle="light-content" />
|
|
31
|
+
<ShoppableVideos items={shoppableVideos} shopId={shopGID} />
|
|
32
|
+
</Box>
|
|
33
|
+
)
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
function mapEntryPointCollectionItemsToShoppableVideos(
|