Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update event payloads #14

Merged
merged 9 commits into from
Jan 4, 2023
Merged

Update event payloads #14

merged 9 commits into from
Jan 4, 2023

Conversation

NothingButThyme
Copy link
Collaborator

Description

The purpose of this PR is to clearly specify the fields that will be expected in messages coming from the Vendor, and to provide a starting point for discussion about changes to those fields.

Also includes some updates that have been discussed previously:

  1. iFrameRedirect event
  2. Added retailPrice to the AddToCart Metadata

Type of Change

  • Bug Fix
  • [X ] New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

Add more details to the payloads of many of the previous events that had undefined payloads
uuid to requestId
Made ATC and ConsultDesigner use separate payloads because ConsultDesigner requires fewer fields.
@sdashner
Copy link
Collaborator

We will need 2 net new events for atc and continue to cart flow

Vendor comms

  • continue to cart would have {message, EventPayload}
    client comms
  • add to cart status event {success: boolean, message: string, projectId: string, versionId }


interface AddToCartPayload {
schema: string;
interface CommonPayload {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NothingButThyme I took a pass at creating general/common interfaces that are extended for specific events. This commit is a proposal for us to discuss, not intended to unilaterally override the commit you pushed up (didn't think a whole separate PR for it was warranted). Thoughts appreciated!

The main point to get across here is the requirement for token and customerId be included in the majority of event payloads (excluding non-customer-centric events like tracking) so we can validate the token and make sure it's intended for the right customer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. I don't have any objections.

I am curious what future-proofing is being accomplished by CommonMedata vs CabinetsMetadata, because 'source' and 'area' seem like they would apply to other things besides cabinets.

addToCart(payload: EventPayload): void {
this.post({type: VendorEvent.AddToCart, payload});
appInitialized(message: string): void {
this.post({type: VendorEvent.AddToCart, payload: message});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this should be type: VendorEvent.AppInitialized

projectId: string;
}

interface DirtyStateChangedPayload {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add projectId

isDirty: boolean;
}

interface iFrameRedirectPayload {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to generalize this into a navigation event?

  • One event for when the iframe re-initialized
  • One for internal navigation to update the url

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a small preference to keep them separate, because we want to see a clear difference between an "application exit" event and a navigation tracking event. It's just a convenience on our side for developers to be able to see when an event is expected to trigger a redirect.

}

interface EventPayload {
interface AddToCartPayload {
schema: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add message to the EventPayload interface since you are sending it.

Ian White added 4 commits January 4, 2023 10:37
@impressiver impressiver merged commit 5623f1e into main Jan 4, 2023
@impressiver impressiver deleted the update_payloads branch January 4, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants