site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Implement partner service for new campaign creation completed signal

Open aaemnnosttv opened this issue 2 months ago • 7 comments

Feature Description

When the campaign creation portion of the PAX setup flow is completed, the partner campaignService can be used to respond to the event.

The handler is defined as part of the service and provided to the app at launch time.

This handler should be contained within the SetupMainPAX component given that it is only ever relative to PAX onboarding/setup flow. See #8558


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The SetupMainPAX component should be updated to provide an implementation of the app's notifyNewCampaignCreated handler of the campaignService
    • This requires an update to the PAX component as well such that it should receive a new optional onCampaignCreated function prop
      • When provided, this function should be included as the value to the services.campaignService.notifyNewCampaignCreated definition (example)
    • The onCampaignCreated function passed should (when called) set the conversion ID and customer IDs currently being set by the main submit button
    • The main submit button should then only be enabled when these IDs have valid values in state, and the campaign creation has been completed
      • Invoking it should then submit changes / save and navigate as usual
    • The embedded app can also be hidden once the conditions are met to enable the main submit button as above although this may not be necessary depending on the behavior of the displayMode

Implementation Brief

  • [x] Within the <SetupMainPAX> component file:
    • Define a function which uses the app instance (from the existing value provided to onLaunch defined in #8557) and its available services (via app.getServices()) as should already be done in the component, but attached to the main submit button
      • Extract the existing behavior (setting conversion + customer IDs) except for the submit changes action from the main submit button to this new function as defined in the AC
      • Hide the main PAX component if necessary
      • Pass this function to the (new) onCampaignCreated prop of the PAXEmbeddedApp
  • [x] Update the PAXEmbeddedApp to accept an optional onCampaignCreated prop
    • If provided a function, merge it into the definition of services provided to the app as services.campaignService.notifyNewCampaignCreated: onCampaignCreated

Test Coverage

  • Add or update existing tests for the PAXEmbeddedApp component to test that the callback function is included in the service definitions as expected

QA Brief

  • Set up Site Kit with adsPax feature flags
  • Go to Ads module setup screen and click on create account button
    • If you do not have adwords scope granted, you should see notice bellow the button, upon clicking the button, you will be redirected to the OAuth flow
    • If you have the scope already, it should skip OAuth step and launch PAX app
  • Upon completing all steps in PAX, a complete setup button should replace it
  • Once clicked, it should connect Ads module and redirect you to the dashboard with success subtle banner showing
  • Settings view of Ads module should show Conversion Tracking ID and Customer ID values, but not when editing the settings

Changelog entry

  • Implement partner service for new campaign creation completed signal.

aaemnnosttv avatar Apr 15 '24 22:04 aaemnnosttv