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

Braze app [INTEG-2348] #9590

Merged
merged 21 commits into from
Mar 25, 2025
Merged

Braze app [INTEG-2348] #9590

merged 21 commits into from
Mar 25, 2025

Conversation

joaquincasal
Copy link
Collaborator

Purpose

This is the first version of the Braze app.

Approach

The main logic of the app is in the Dialog location, which consists of a three-step wizard: field selection, locale selection and code blocks. There's one component for each of the steps of the wizard to separate their logic.
Under the fields folder there are typescript classes that represent the different types of contentful fields. The idea is to separate the logic of generating the graphql query and the liquid tags for each field, since each field has different information.
The FieldsFactory class retrieves the necessary information from the entry fields and content type and creates one instance of the correspoding class for each field of the entry.
Reference fields can contain other nested fields or references up to 5 levels.

Testing steps

  • Automated tests can be run with npm test.
  • For testing the app in a Contentful entry, install the app in a space. In the app registration set the locations for App configuration and Entry sidebar. Then add the app to the sidebar for the content type that will be used for testing. Then start the app with npm start and go to an entry of that content type, a button should appear in the sidebar, which will trigger the dialog to appear. The second step of the wizard only appears if there are localized fields in the entry, otherwise it's skipped.
    • Once in the third step, three code blocks will be shown: connected content call, liquid tags and example response. The generated connected content call and the liquid tags can be pasted into a content block in Braze to verify that they work.

Breaking Changes

N/A

Dependencies and/or References

N/A

Deployment

N/A

FBanfi and others added 19 commits February 19, 2025 11:18
* adding main structure to configscreen

* refactor: generic splitter

* updating labels

* adding configuration parameters on app instalation

* adding tests fot the configuration screen

* adding test to check if the link manage api key renders

* adding test to check if the api key is set correctly

* Fixing tests

* removing comments

* running prettier

* adding placeholder

---------

Co-authored-by: francobanfi <franco.banfi@external.contentful.com>
* Assemble graphql query

* Fix type for contentful-resolve-response

* Refactor graphql query assembly

* test for simple liquid tag generation

* multiple liquid tag generation

* test for asset liquid tag generation

* new test for location and list of texts + refactor on basic field liquid tag generation test

* removing test for list text

* refactor to use a utils constant to generate location lat and long liquid tag

* initial structure for polimorfic fields

* Adding simple references and asset

* Braze integ 2403 (#9545)

* Display example response

* Fix linter

* Adding arrays of entries

* refactor on the field type to generate the array liquid tags

* new test and implementation for text array liquid tag generation

* extracting methods refactor

* skiping generation of rich text liquid tag

* liquid tags for basic fields

---------

Revert "addressing array types"

This reverts commit d57c5e9.

addressing array types

Co-Authored-By: francobanfi <franco.banfi@external.contentful.com>
Co-Authored-By: Juli Rossi <juliana.rossi@10pines.com>
* addressing array types

removing todo

Revert "addressing array types"

This reverts commit d57c5e9.

addressing array types

* test for nested entry references

* array for basic fields

* asset array liquid tag modification

* Addressing tests errors

* Fixing prettier

* correcting pr comments

---------

Co-authored-by: francobanfi <franco.banfi@external.contentful.com>
* Setup dialog steps

* Create components for each step
* wip code block component creation

* Adding styles

* Adding styles

* styling code block

* Updating styles

* adding formating to the graphql response to ident the example json code block

* Fixing indentation

* Test

* omiting richtext in the connected content call query and json

* correcting an import

* adding tests

* changing the import of the react-syntax-highlighter

* format import with prettier

---------

Co-authored-by: Juli Rossi <juliana.rossi@10pines.com>
* Add classes for each field type

* Replace usage of field types with classes

* Add and reorganize tests

* Set max depth for nested fields

* Separate Location and RichText from BasicField

* Refactor: create Entry class

* Add clarifying comments
* Save content type id instead of name

* Set first letter of content type to lowercase

* Update apps/braze/src/utils.ts

Co-authored-by: JuliRossi <juliana.rossi@10pines.com>

---------

Co-authored-by: JuliRossi <juliana.rossi@10pines.com>
* config screen validation when api key is null

* first version of the config screen validations

* adding validation message to textinput

* fixing test to work with validations

* adding test for invalid api key

* changes in the validations for the config screen

* test to install the app when api key is invalid

* using sdk to get the contentful base url

* changing method name in config screen location
* changing the extensions for the style files

* changing the extensions for the style files

* correction of PR comments
* adding type password to the contentful api key input

* removing braces
* WIP

* Refactor

* refactor

* making better tests

* Fix indentation

* Fix initialization

* Refactor
* Allow to select entry fields

* Rename styles file

* Apply margin to nested fields

* Address PR comments

* Display field name in checkbox

* Address PR comments

- Replace field.select and field.deselect with field.toggle
- Extracted repeated logic into entry.selectedFields
- Updated fields ids in tests
@joaquincasal joaquincasal requested a review from a team as a code owner March 20, 2025 21:30
Copy link

netlify bot commented Mar 20, 2025

Deploy Preview for ecommerce-app-base-components canceled.

Name Link
🔨 Latest commit 3c6e543
🔍 Latest deploy log https://app.netlify.com/sites/ecommerce-app-base-components/deploys/67e2b5e028bede0009725aff

@joaquincasal joaquincasal changed the title Braze app Braze app [INTEG-2348] Mar 20, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

export const BRAZE_DOCUMENTATION =
'https://braze.com/docs/user_guide/personalization_and_dynamic_content/connected_content';

export async function callToContentful(url: string, newApiKey: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like this pattern and will probably use it for other apps we maintain 😄

Copy link
Contributor

@mgoudy91 mgoudy91 left a comment

Choose a reason for hiding this comment

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

I really cannot find anything meaningful to be concerned with here. This is a really well-organized and written app. Great work 🎉

Two procedural points:

  1. We'll need to remove the two deploy commands for now. I left a suggestion to do so. Happy to approve once that's done!
  2. Looks like the rebase can't be automatic, which is totally fine. Assuming no one on the marketplace team has any concerns, I'll go ahead and squash the history and merge this in on Monday.

Co-authored-by: Mitch Goudy <mgoudy91@gmail.com>
@mgoudy91 mgoudy91 merged commit 0b36109 into master Mar 25, 2025
17 checks passed
@mgoudy91 mgoudy91 deleted the braze-app branch March 25, 2025 16:22
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