woocommerce/plugins/woocommerce-admin/client/marketing/overview-multichannel/Channels/useRegisteredChannels.ts

92 lines
3.0 KiB
TypeScript
Raw Normal View History

2022-12-23 13:21:52 +00:00
/**
* Internal dependencies
*/
import { InstalledChannel } from '~/marketing/types';
type UseRegisteredChannels = {
loading: boolean;
data: Array< InstalledChannel >;
};
2022-12-14 12:11:40 +00:00
// // TODO: To be removed. This is for testing loading state.
// export const useRegisteredChannels = () => {
// // TODO: call API here to get data.
// // The following are just dummy data for testing now.
// return {
// loading: true,
// data: [],
// };
// };
// // TODO: To be removed. This is for testing isSetupCompleted = false.
// export const useRegisteredChannels = () => {
// // TODO: call API here to get data.
// // The following are just dummy data for testing now.
// return {
// loading: false,
// data: [
// {
// slug: 'google-listings-and-ads',
// title: 'Google Listings and Ads',
// description:
// 'Get in front of shoppers and drive traffic so you can grow your business with Smart Shopping Campaigns and free listings.',
// icon: 'https://woocommerce.com/wp-content/plugins/wccom-plugins/marketing-tab-rest-api/icons/google.svg',
// isSetupCompleted: false,
// setupUrl: 'https://www.example.com/setup',
// manageUrl: 'https://www.example.com/manage',
// syncStatus: 'synced' as const,
// issueType: 'none' as const,
// issueText: 'No issues to resolve',
// },
// ],
// };
// };
// // TODO: To be removed. This is for testing error state.
// export const useRegisteredChannels = () => {
// // TODO: call API here to get data.
// // The following are just dummy data for testing now.
// return {
// loading: false,
// data: [
// {
// slug: 'google-listings-and-ads',
// title: 'Google Listings and Ads',
// description:
// 'Get in front of shoppers and drive traffic so you can grow your business with Smart Shopping Campaigns and free listings.',
// icon: 'https://woocommerce.com/wp-content/plugins/wccom-plugins/marketing-tab-rest-api/icons/google.svg',
// isSetupCompleted: true,
// setupUrl: 'https://www.example.com/setup',
// manageUrl: 'https://www.example.com/manage',
// syncStatus: 'failed' as const,
// issueType: 'error' as const,
// issueText: '3 issues to resolve',
// },
// ],
// };
// };
// TODO: To be removed. This is for testing everything works okay.
2022-12-23 13:21:52 +00:00
export const useRegisteredChannels = (): UseRegisteredChannels => {
2022-12-08 15:53:36 +00:00
// TODO: call API here to get data.
// The following are just dummy data for testing now.
return {
loading: false,
data: [
{
2022-12-09 18:28:13 +00:00
slug: 'google-listings-and-ads',
title: 'Google Listings and Ads',
2022-12-08 15:53:36 +00:00
description:
'Get in front of shoppers and drive traffic so you can grow your business with Smart Shopping Campaigns and free listings.',
icon: 'https://woocommerce.com/wp-content/plugins/wccom-plugins/marketing-tab-rest-api/icons/google.svg',
isSetupCompleted: true,
2022-12-14 12:11:40 +00:00
setupUrl: 'https://www.example.com/setup',
manageUrl: 'https://www.example.com/manage',
2022-12-09 18:28:13 +00:00
syncStatus: 'synced' as const,
issueType: 'none' as const,
2022-12-14 12:11:40 +00:00
issueText: 'No issues to resolve',
2022-12-08 15:53:36 +00:00
},
],
};
};