-
Notifications
You must be signed in to change notification settings - Fork 141
Conversation
I was thinking this would replace our current categories and let users map destinations directly to categories. |
That sounds good to me! Should it be to entire categories of destinations <> consent category, or allow specific destination <> consent category? |
I think specific would be more useful! |
Actually, going to make this map custom category <> destination name - since you made a good point about customCategories being a very specific feature Max :-) |
…feature parity with default categories)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
]
@@ -23,6 +23,7 @@ interface ContainerProps { | |||
resetPreferences: () => void | |||
closeBehavior?: CloseBehavior | |||
destinations: Destination[] | |||
customCategories?: CustomCategories | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the ?
take care of the undefined case here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I originally had it as just customCategories?: CustomCategories
but it was failing validation - because sometimes we do pass in customCategories but the value is undefined.
if (customCategories) { | ||
for (const preferenceName of Object.keys(customCategories)) { | ||
const value = preferences[preferenceName] | ||
if (typeof value === 'boolean') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just do this here I think:
customPreferences[preferenceName] = Boolean(value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is saying "if explicitly set as true or false, set as true or false, if not set (i.e. value is null), set to true"
Add Custom Categories
This PR adds a config property to ConsentManager called
customCategories
that looks like the following:Users can verify their integration names via
https://cdn.segment.com/v1/projects/<writeKey>/integrations
. That returns an array of integration objects:(
name
would beSlack
here)Example
renders as:
which in turn, reflects this cookie:
Manual Flow Tests
Default Consent Categories
Custom Consent Categories