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

add gpp enum to experience field #101

Closed
wants to merge 3 commits into from
Closed

Conversation

csmccarthy
Copy link
Member

Related Issues

Internal Changelog

This is priming the type system to allow us to add sets of iab signals to the experiences object. I was a bit torn between where our source of truth for this enum was going to live - here vs cm-types vs ag-types - but ultimately I think it fits in well here since its main purpose will be to inform the new GPP load option. If you'd suggest somewhere else lmk

@csmccarthy csmccarthy requested a review from a team November 2, 2023 15:27
Copy link

height bot commented Nov 2, 2023

This pull request has been linked to 1 task:

💡Tip: Add "Close T-27026" to the pull request title or description, to a commit message, or in a comment to mark this task as "Pending Deploy" when the pull request is merged.

Copy link
Contributor

@MadDataScience MadDataScience left a comment

Choose a reason for hiding this comment

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

LGTM, but I think I'd like @anotherminh 's and/or @eligrey 's eyes on this to make sure this makes sense.

* Set of IAB signals that we can communicate
*/
export enum IABSignal {
GppUsp = 'GPP_USP',
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. I suppose this will be extended to include TCF, other GPP signals?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was figuring start with GPP, but I could definitely imagine refactoring TCF to include this as well, yeah!

@@ -138,6 +145,8 @@ export interface ExperienceInput {
viewState: InitialViewState;
/** experience purposes to be added */
experiencePurposeInputs: ExperiencePurposeInput[];
/** set of IAB signals to be communicated in this experience */
iabSignals: IABSignal[];
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose we need this to be an array because a customer might need both USP and US CA, for instance?

export enum IABSignal {
GppUsp = 'GPP_USP',
}

export interface ExperienceInput {
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like this is used anywhere outside of being the return type for this function? @csmccarthy can you explain a bit about the overall larger goal here? It seems like we'd want to add a new config option, iabSignals, which is really just a config option for the gpp module if that is loaded, correct?

If so, I'm not sure this is the right place for it. In general, I'm not sure if we have a good pattern in place right now for encoding module-specific configuration -- essentially, additional "parameters" that we would like to pass to the module. @eligrey i think has thoughts on this...

If we did want to expose this module-specific configuration to airgap, then it would live here https://github.com/transcend-io/main/blob/e78a86bb6c3556c64d554e43f37898d4f2af09cb/frontend-support/ag-types/src/core.ts#L831-L842

Copy link
Member

Choose a reason for hiding this comment

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

I think this makes sense to be exposed as an arbitrary rich config input field for module descriptors. The module itself could consume the input through a well-defined interface.

I've thought about this a lot in the past when it comes to ag-core & XDI (e.g. could ag-core share its copy of nrc with xdi). There is no clean place to put this module input that works the same for both ESM and mon-ESM.

I'm going to think about it for a bit and come back with a unified model to solve this. Both ESM and non-ESM would get their own unique config reading process

Copy link
Member Author

@csmccarthy csmccarthy Nov 2, 2023

Choose a reason for hiding this comment

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

@anotherminh You've got the gist of it, yeah: the point was to define an enum whose values get loaded into the loadOptions so that the module has an idea of what to activate.

Broader scale, it's just a way for information to pass through from the experience record to the module that experience designates for loading, and there could very well be a better way to do that. I was following the tcfUI example here, which defines a type in airgap.js-types then uses that to define the loadOptions type, but I know that module is exceptional in a lot of ways so if there's a better way for me to do it I'm all for it.

I think editing the ModuleDescriptors is an interesting idea, but it seems to me like since those descriptors aren't (afaik) exposed globally, it would require airgap have the ability interface more strongly with the modules it's loading, e.g. through a function call or something, or otherwise expose those descriptors for the modules to retrieve those parameters themselves. I don't really have an opinion here on which would be better, but it seems like the latter is closer to how it works today so it might be easier to transition to that

Copy link
Member

@anotherminh anotherminh left a comment

Choose a reason for hiding this comment

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

@csmccarthy do you m ind also reorganizing this file? enums.ts should not contain anything other than enums.... the interface + helper function should live in its own file

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.

4 participants