@bigcommerce/stencil-cli 7.4.1 → 7.4.2
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/lib/theme-api-client.js +14 -2
- package/package.json +1 -1
package/lib/theme-api-client.js
CHANGED
|
@@ -208,11 +208,23 @@ async function getChannelActiveTheme({ accessToken, apiHost, storeHash, channelI
|
|
|
208
208
|
*/
|
|
209
209
|
async function getStoreChannels({ accessToken, apiHost, storeHash }) {
|
|
210
210
|
try {
|
|
211
|
-
const
|
|
211
|
+
const sitesResponse = await networkUtils.sendApiRequest({
|
|
212
212
|
url: `${apiHost}/stores/${storeHash}/v3/sites`,
|
|
213
213
|
accessToken,
|
|
214
214
|
});
|
|
215
|
-
|
|
215
|
+
const channelsResponse = await networkUtils.sendApiRequest({
|
|
216
|
+
url: `${apiHost}/stores/${storeHash}/v3/channels`,
|
|
217
|
+
accessToken,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const storefrontChannels = channelsResponse.data.data.filter(
|
|
221
|
+
(channel) => channel.type === 'storefront',
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return sitesResponse.data.data.filter(
|
|
225
|
+
(site) =>
|
|
226
|
+
storefrontChannels.filter((channel) => channel.id === site.channel_id).length > 0,
|
|
227
|
+
);
|
|
216
228
|
} catch (err) {
|
|
217
229
|
throw new Error(`Could not fetch a list of the store channels: ${err.message}`);
|
|
218
230
|
}
|