Gan Eng Chin
38370cc544
Remove unneeded CSS.
2023-03-19 23:34:17 +08:00
Gan Eng Chin
ddd287cc4c
Show Campaigns card when banner is dismissed or campaigns total is truthy.
2023-03-19 23:30:21 +08:00
Gan Eng Chin
11683be1a8
Set default parameter values for useCampaigns.
2023-03-19 23:17:22 +08:00
Gan Eng Chin
458c16bad9
Move useCampaigns to shared hooks directory.
2023-03-19 22:54:55 +08:00
Gan Eng Chin
c6a95ae9bf
Rename callback props in IntroductionBanner to make them clearer.
2023-03-19 21:10:22 +08:00
Gan Eng Chin
6b75b5db38
Rename variables to make them clearer.
2023-03-19 20:58:54 +08:00
Gan Eng Chin
155211d77a
Remove unneeded Icon component.
2023-03-19 20:56:00 +08:00
Gan Eng Chin
65523e36dd
Fix spacing for close button in IntroductionBanner.
2023-03-19 20:54:34 +08:00
Gan Eng Chin
1b65be0a53
Fix useSelect dependency in useIntroductionBanner.
2023-03-19 20:50:37 +08:00
Gan Eng Chin
99c6ebff15
Remove the use of isOptionsUpdating in useIntroductionBanner.
...
isOptionsUpdating will return true for any option update, not just our option here. This causes issue as shown in demo video in https://github.com/woocommerce/woocommerce/pull/37110#discussion_r1130531104 .
We can just depend on getOption. When we update an option, it will be updated immediately in wp.data store before making API request to update the option in database (see c5564a15c1/packages/js/data/src/options/actions.ts (L44)
).
2023-03-19 20:38:20 +08:00
Gan Eng Chin
162d790a7a
Update option name and value to make it more indicative.
2023-03-19 20:16:04 +08:00
Gan Eng Chin
49253425b2
Specify dependency for useSelect in useIntroductionBanner.
...
Co-authored-by: Eason <eason.su.tw@gmail.com>
2023-03-19 20:12:09 +08:00
Gan Eng Chin
7cc8e065f9
Merge branch 'trunk' into feature/34904-marketing-introduction-banner
2023-03-19 20:09:23 +08:00
Gan Eng Chin
e20b9d1ac9
Filter out marketing channels in useRecommendedPlugins.
2023-03-19 18:06:39 +08:00
Gan Eng Chin
8c151984ad
Filter installed plugins against marketing channels in useInstalledPlugins.
2023-03-19 18:06:34 +08:00
Gan Eng Chin
555116f3df
Fix broken tests for CreateNewCampaignModal.
...
The tests had errors because useInstalledPlugins is added into the component and it is not mocked in the tests.
2023-03-19 17:59:35 +08:00
Gan Eng Chin
1aaa26e07d
Reload installed extensions data after installing recommended channels.
...
This is because the channel may not have registered itself as a marketing channel and it should show up in the Installed extensions card.
2023-03-18 00:47:54 +08:00
Gan Eng Chin
f769a8c6f5
Merge branch 'trunk' into feature/34904-marketing-introduction-banner
...
Conflicts:
plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
2023-03-17 01:21:13 +08:00
Gan Eng Chin
aef22190d2
Make sure expression before && is always boolean in React rendering in marketing page.
2023-03-15 08:24:00 +08:00
Gan Eng Chin
0316fbb265
Specify empty array as hasFinishedResolution args.
...
This is to make things consistent with invalidateResolution to make things work with WP 5.9.
2023-03-14 03:35:20 +08:00
Gan Eng Chin
5a58784a62
Specify empty array as invalidateResolution and hasFinishedResolution args.
...
This is to make things work with WP 5.9.
2023-03-14 03:32:54 +08:00
Gan Eng Chin
0cf56774f5
Merge branch 'trunk' into feature/34909-marketing-create-campaign-modal
2023-03-13 12:51:24 +08:00
Gan Eng Chin
baf9408f69
Merge branch 'feature/34909-marketing-create-campaign-modal' into feature/34904-marketing-introduction-banner
...
Conflicts:
plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.test.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
2023-03-13 01:02:12 +08:00
Gan Eng Chin
c6e6f8774d
Specify empty array dependency in useCampaignTypes.
...
This is to make it work with WP 5.9. See https://github.com/woocommerce/woocommerce/pull/37044#discussion_r1132062493 .
2023-03-11 00:42:09 +08:00
Gan Eng Chin
1fea0185fe
Don't throw error in getCampaignTypes.
...
In WP 5.9, if we throw error, there would be an uncaught promise, and it causes UI to break.
2023-03-11 00:31:23 +08:00
Matt Sherman
af24637439
Create @woocommerce/admin-layout package ( #37094 )
...
* Initial admin-layout package skeleton
* Changelog files
* Use createOrderedChildren and sortFillsByOrder from @woocommerce/components for WooFooterItem
* Move WooFooterItem to @woocommerce/admin-layout
* Use WooFooterItem from @woocommerce/admin-layout
* Suppress errant TS lint errors
* Exports for @woocommerce/admin-layout
* Fill updates and eslint suppression
* Changelogs
* Remove suppression of tslint errors
* Fix react and @types/react versions
* Load @woocommerce/admin-layout script and styles
* Move WooHeaderItem, WooHeaderNavigationItem, and WooHeaderPageTitle to @woocommerce/admin-layout
* Regenerate lock file post-rebase
* Remove duplicate import post-rebase
* Add wc-admin-layout to app style dependency
* Fix jest mock of @woocommerce/admin-layout
* Fix spacing.
* Export slot names
* Fix typo in .npmrc
* Update lock file
* Try updating lock file
* Update lock file
* Update lock file
* Update to latest lock file from trunk
* Update lock file
* Sync dependencies of @woocommerce/admin-layout
* Manually sync @wordpress dependencies
2023-03-10 09:58:02 -05:00
Gan Eng Chin
0a58ec19f8
Remove unneeded div in CreateNewCampaignModal.
2023-03-10 02:14:35 +08:00
Gan Eng Chin
e4da8cba09
Display info message when there are no campaign types.
2023-03-10 02:13:05 +08:00
Gan Eng Chin
6446053784
Load campaign types in overview and refetch after installeing a channel.
2023-03-09 23:46:54 +08:00
Gan Eng Chin
8b6aad4138
Refetch campaign types after installing a channel in CreateNewCampaignModal.
2023-03-09 22:51:12 +08:00
Gan Eng Chin
29d67a3a21
Refactor test data in CreateNewCampaignModal tests.
2023-03-09 22:31:51 +08:00
Gan Eng Chin
9f0326b398
Remove unneeded return in CreateNewCampaignModal.
...
This helps us save indentation and make the code few lines shorter.
2023-03-09 22:26:06 +08:00
Gan Eng Chin
e15305b7c3
Remove unneeded CardDivider in CreateNewCampaignModal.
...
The code is copied from the Channels component, but in CreateNewCampaignModal, we don't need to display the divider, so we can just remove the divider code.
2023-03-09 22:23:27 +08:00
Gan Eng Chin
c6dcee426b
Make it clear that title and classname cannot be overwritten by props.
2023-03-09 22:17:03 +08:00
Gan Eng Chin
f5bb8490ea
Rename open and setOpen to isModalOpen and setModalOpen in Campaigns.
2023-03-09 22:11:53 +08:00
Gan Eng Chin
e831e89997
Make the mocked modal clearer.
...
The previous text "Create a new campaign" can be a bit confusing with the other text "Create new campaign" in the test.
2023-03-09 22:09:24 +08:00
Gan Eng Chin
551db21e9b
Remove unneeded getByText in Campaigns test.
2023-03-09 22:05:17 +08:00
Gan Eng Chin
f19969dacb
Change NewCampaignTypes to CampaignTypes.
2023-03-09 21:52:11 +08:00
Gan Eng Chin
39ce470fe8
Specify dependency for useSelect in useNewCampaignTypes.
2023-03-09 21:43:54 +08:00
Gan Eng Chin
3ba492f32b
Move convert function out of useSelect in useNewCampaignTypes.
...
This is so that it doesn't become dependency in useSelect.
2023-03-09 21:42:59 +08:00
Gan Eng Chin
6d72c2bbe1
Fix failed test for Campaigns component.
2023-03-09 01:08:28 +08:00
Gan Eng Chin
66e46d8942
Run lint:css-fix.
2023-03-09 00:34:20 +08:00
Gan Eng Chin
4068808f0a
Merge branch 'feature/34909-marketing-create-campaign-modal' into feature/34904-marketing-introduction-banner
2023-03-08 03:03:31 +08:00
Gan Eng Chin
97ed1d2a7d
Fix array length rendering literal 0 in CreateNewCampaignModal.
2023-03-08 02:57:02 +08:00
Gan Eng Chin
42ac7e4d28
Better logic for displaying buttons in IntroductionBanner.
2023-03-08 02:54:43 +08:00
Gan Eng Chin
8fe3781266
Use ref instead of location hash to scroll to add channels section.
2023-03-08 02:06:06 +08:00
Gan Eng Chin
0cb2fb1cd0
Display CreateNewCampaignModal upon button click in IntroductionBanner.
2023-03-08 00:37:55 +08:00
Gan Eng Chin
a9b696d28c
Move CreateNewCampaignModal to shared components folder.
2023-03-08 00:34:09 +08:00
Rodrigue Tusse
ed6c19b827
Fix 0 rendered on short-circuit evaluation.
2023-03-07 15:06:25 +02:00
Gan Eng Chin
7c9eedbbb4
Merge branch 'feature/34909-marketing-create-campaign-modal' into feature/34904-marketing-introduction-banner
...
Conflicts:
plugins/woocommerce-admin/client/marketing/hooks/index.ts
plugins/woocommerce-admin/client/marketing/overview-multichannel/Channels/RecommendedChannels.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
2023-03-07 00:46:38 +08:00
Gan Eng Chin
3e620c41c6
Add tests for CreateNewCampaignModal.
2023-03-04 01:02:46 +08:00
Gan Eng Chin
15c57bf712
Fix and add tests for Campaigns card.
2023-03-03 03:25:00 +08:00
Gan Eng Chin
913f7176b2
Refetch registered channels after installing channel in Campaigns card.
2023-03-03 02:34:16 +08:00
Gan Eng Chin
ec15697d44
Load campaign types in Campaigns card.
2023-03-03 01:08:21 +08:00
Gan Eng Chin
e13112875b
Move useNewCampaignTypes to shared hooks directory.
2023-03-03 01:05:14 +08:00
Gan Eng Chin
51a5a18448
Simplify receiveCampaignTypes.
2023-03-03 00:54:21 +08:00
Gan Eng Chin
8132addd18
Simplify wp.data for receiveCampaignTypes.
2023-03-03 00:24:51 +08:00
Gan Eng Chin
2443bfd7a0
Merge branch 'feature/34905-marketing-campaigns-card' into feature/34909-marketing-create-campaign-modal
...
Conflicts:
plugins/woocommerce-admin/client/marketing/data-multichannel/action-types.ts
plugins/woocommerce-admin/client/marketing/data-multichannel/actions.ts
plugins/woocommerce-admin/client/marketing/data-multichannel/resolvers.ts
2023-03-03 00:11:35 +08:00
Gan Eng Chin
c0364ad0ab
Remove unused error property in CampaignsState.
2023-03-02 03:16:29 +08:00
Gan Eng Chin
4b87f0a4ed
Add JSDOC.
2023-03-02 03:15:38 +08:00
Gan Eng Chin
9feaf55a60
Simplify receive campaigns success and error.
2023-03-02 03:02:14 +08:00
Gan Eng Chin
5af90c5e77
Add JSDOC for getTotalFromResponse.
2023-03-02 01:16:51 +08:00
Gan Eng Chin
b83888577a
Fix getTotalFromResponse treating total 0 as undefined.
...
If total is 0, then the function should return 0, not undefined.
2023-03-02 01:13:42 +08:00
Gan Eng Chin
8e9f344478
Test code refactor with createTestCampaign.
2023-03-02 00:59:22 +08:00
Gan Eng Chin
d111370d1e
Make UI work with wp.data new campaign types.
2023-02-28 00:51:34 +08:00
Gan Eng Chin
9526608fbc
wp.data for getting new campaign types.
2023-02-28 00:45:47 +08:00
Gan Eng Chin
418e4fba02
Fix build error after merging.
2023-02-27 23:49:50 +08:00
Gan Eng Chin
f420a0ed9e
Merge branch 'feature/34905-marketing-campaigns-card' into feature/34909-marketing-create-campaign-modal
...
Conflicts:
plugins/woocommerce-admin/client/marketing/components/RecommendedChannelsList.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.scss
plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/Channels/Channels.tsx
plugins/woocommerce-admin/client/marketing/overview-multichannel/Channels/RecommendedChannels.tsx
2023-02-27 23:46:30 +08:00
Gan Eng Chin
e57181b987
Add tests for Campaigns component.
2023-02-27 02:23:11 +08:00
Gan Eng Chin
3513ef51a1
Merge branch 'trunk' into feature/34905-marketing-campaigns-card
2023-02-25 00:39:37 +08:00
Gan Eng Chin
f62b44ae2f
Set numberOfRows for TablePlaceholder in Campaigns card.
2023-02-24 23:48:04 +08:00
Gan Eng Chin
f7a1ef2123
Code refactor with getTotalFromResponse in getCampaigns.
2023-02-24 23:45:10 +08:00
Gan Eng Chin
a4e11924fd
Change meta.total to optional in receiveCampaignsSuccess.
2023-02-24 23:44:47 +08:00
Gan Eng Chin
f5ba6d94ac
Remove unused fetchWithHeaders control.
2023-02-24 23:35:40 +08:00
Gan Eng Chin
a982b7be21
Error handling in getCampaigns.
2023-02-24 18:32:33 +08:00
Gan Eng Chin
92762ca9b0
Better pagination with TablePlaceholder in Campaigns card.
2023-02-24 17:09:42 +08:00
Gan Eng Chin
cc5345db4e
Campaigns pagination UI logic.
2023-02-24 02:13:20 +08:00
Gan Eng Chin
60d815c582
wp.data for campaigns data pagination.
2023-02-24 02:10:37 +08:00
Gan Eng Chin
20ae504be0
Add controls with fetchWithHeaders.
2023-02-24 02:08:59 +08:00
Chi-Hsuan Huang
dcba4456cf
Add SlotFill for marketing overview screen ( #36828 )
...
* Add slot for marketing overview section slotfill
* Add changelog
* Remove unneed changes
* Add changelog
2023-02-17 09:46:52 +08:00
Gan Eng Chin
c9214abe1f
Merge branch 'feature/34906-marketing-channels-card' into feature/34905-marketing-campaigns-card
2023-02-03 00:54:51 +08:00
Gan Eng Chin
7bb042fcd2
Simplify CSS for CardHeaderDescription.
2023-02-02 21:50:36 +08:00
Gan Eng Chin
048906ad80
Change Campaigns CSS to use @include font-size().
2023-02-02 19:06:17 +08:00
Gan Eng Chin
7b068bf908
Code refactor for Campaigns card CSS.
2023-02-02 17:52:22 +08:00
Gan Eng Chin
c17f336acc
Code refactor for Campaigns card.
2023-02-02 17:47:42 +08:00
Gan Eng Chin
0abe368962
Display error state in Campaigns card.
2023-02-02 17:17:29 +08:00
Gan Eng Chin
743c0e5085
Set per_page to 100 for getCampaigns.
...
100 is the maximum limit allowed by the API.
We do this because the API does not return total number of rows, so we use 100 to get "all" rows, to support pagination in the UI.
2023-02-02 01:03:15 +08:00
Gan Eng Chin
183fc48132
Show CardFooter and Pagination only when it is needed.
...
This means when total is more than perPage.
2023-02-01 20:29:32 +08:00
Gan Eng Chin
eda6f194b9
Use perPage constant instead of literal 5.
2023-02-01 20:27:07 +08:00
Gan Eng Chin
274ea3dd60
Use Link component in Campaigns.
...
This allows fast client-side navigation.
2023-02-01 20:23:14 +08:00
Gan Eng Chin
29154425cb
Check description before rendering FlexItem.
...
This is to eliminate the unneeded flex gap when there is no description.
2023-02-01 20:17:53 +08:00
Gan Eng Chin
c342cbb98d
Change to color variable in Campaigns CSS.
2023-02-01 20:09:17 +08:00
Gan Eng Chin
cd7b5f2c96
Fetch and display campaigns with wp.data.
2023-02-01 19:02:03 +08:00
Gan Eng Chin
46adb0dc25
Rename Channels to RegisteredChannels.
2023-02-01 02:58:49 +08:00
Gan Eng Chin
630bd0ab17
Merge branch 'feature/34906-marketing-channels-card' into feature/34905-marketing-campaigns-card
2023-02-01 00:52:48 +08:00
Gan Eng Chin
f050bb79b5
Rename Channel to RegisteredChannel.
...
This is for better clarity and consistency.
2023-02-01 00:52:35 +08:00
Gan Eng Chin
177fc59dea
Simplify rendering code in MarketingOverviewMultichannel.
2023-02-01 00:29:38 +08:00
Gan Eng Chin
3384ad576d
Remove unused import.
2023-02-01 00:20:04 +08:00
Gan Eng Chin
d69f7f00b7
Fix ids typescript error in Campaigns.
2023-02-01 00:18:53 +08:00
Gan Eng Chin
76102143ff
Merge branch 'feature/34906-marketing-channels-card' into feature/34905-marketing-campaigns-card
...
Conflicts:
plugins/woocommerce-admin/client/marketing/overview-multichannel/MarketingOverviewMultichannel.tsx
2023-01-31 23:50:03 +08:00