Conversation
- Add entry fetching and error handling - Add identify/reset user logic - Render entries using ContentEntry and NestedContentEntry - Wrap App in OptimizationProvider in main.tsx - Update types for ContentfulEntry to use SDK Entry type - Fix OptimizationProvider context value typo (isReadable → isReady)
- Add contentful@^11.10.3 to dependencies
- Add Playwright config and two e2e tests for identified and unidentified user variants - Refactor App to separate auto and manually observed entries - Implement consent controls and display personalization count - Enable auto entry view tracking in optimization config - Update ContentEntry and NestedContentItem to support tracking attributes and manual observation - Remove unused analytics tracking from entry components
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
- Add @contentful/rich-text-react-renderer and @contentful/rich-text-types - Update test:e2e script to run Playwright tests directly - Allow Playwright baseURL to be set via environment variable
- Simplify Contentful type definitions and remove unused helpers - Update fetchEntry to use getEntry instead of getEntries - Inline isEntry logic and remove isContentfulEntry usage - Update RichTextNode typing in RichTextRenderer
- Delete src/config/env.ts and update imports - Read env vars directly with fallback defaults in code - Update README with new env handling and local mock instructions
- Refactor App to use routes and split home/page-two views. - Emit page events on route changes using location.pathname. - Add e2e test for navigation page events. - Extract entry IDs and route paths to config files.
- Improve line wrapping in README for clarity - Simplify await expect.poll usage in navigation-page-events.spec.ts - Reorder imports and define embedded entry node type in RichTextRenderer - Use nullish coalescing (??) for env var fallbacks in createOptimization - Remove unused generic from ContentEntrySkeleton type
Update Playwright baseURL default to localhost:3001
- Move isRecord to utils/typeGuards and use throughout codebase - Add getContentfulConfigError for clearer Contentful env var errors - Support PUBLIC_OPTIMIZATION_LOG_LEVEL with sensible defaults - Update README E2E instructions and usage examples - Improve event display keying and RichTextRenderer spacing - Add DEV to ImportMetaEnv typings
| needs: [setup, changes, build] | ||
| if: needs.changes.outputs.e2e_web_react == 'true' | ||
| steps: | ||
| - uses: namespacelabs/nscloud-checkout-action@v8 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| node-version-file: '.nvmrc' | ||
| package-manager-cache: false | ||
|
|
||
| - uses: pnpm/action-setup@v4 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| - uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Set up caches (Namespace) | ||
| uses: namespacelabs/nscloud-cache-action@v1 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
| function isMergeTagEntry(entry: unknown): entry is MergeTagEntry { | ||
| if (!isRecord(entry)) { | ||
| return false | ||
| } | ||
|
|
||
| const { sys } = entry | ||
| if (!isRecord(sys) || !isRecord(sys.contentType)) { | ||
| return false | ||
| } | ||
|
|
||
| const { contentType } = sys | ||
| if (!isRecord(contentType) || !isRecord(contentType.sys)) { | ||
| return false | ||
| } | ||
|
|
||
| return contentType.sys.id === 'nt_mergetag' | ||
| } |
There was a problem hiding this comment.
We could possibly import MergeTagValueResolver and use MergeTagValueResolver.isMergeTagEntry(...) or directly use MergeTagEntry.safeParse(...).success to avoid having to know the shape of a merge tag entry. I'd be interested if you might have any ideas for a better facility for these kind of guards that we could expose from the SDKs directly. I have ideas but I don't want to tempt you to implement them in this PR 😛
While we could also supply type guards for records, links, and other general CTFL entry stuff, we'd probably want to avoid exporting those, to reduce maintenance work for anything that isn't directly related to P13n or A7s.
…-implementation-based-on-the-web-sdk
Summary
Adds and polishes the React Web reference implementation in
implementations/web-reactusing@contentful/optimization-webdirectly (local React adapter only).Included
Validation
pnpm lint✅pnpm --dir implementations/web-react typecheck✅pnpm --dir implementations/web-react test:e2e✅Follow-ups