-
Couldn't load subscription status.
- Fork 0
feat: add bundled SectionCampaign mode #299
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
Conversation
8e98a26 to
98cb623
Compare
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.
Pull Request Overview
This PR introduces a new BundledCampaign custom element that fetches Nosto placement results and renders them using Shopify's Bundled Section Rendering API. The campaign metadata is persisted in cart attributes for tracking purposes.
Key changes:
- Added
postJSONutility function to handle POST requests with JSON payloads - Created new
BundledCampaigncomponent that integrates with Nosto's recommendation API and Shopify's cart system - Enhanced fetch utilities to support configurable request options
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/utils/fetch.ts |
Added postJSON function and enhanced fetchWithErrorHandling to accept optional request options |
src/components/BundledCampaign/BundledCampaign.ts |
New custom element implementation for bundled campaign functionality with Shopify integration |
52e8b99 to
33b35ce
Compare
be8abbd to
28de060
Compare
28de060 to
a1819d4
Compare
| async function getSectionMarkup(element: SectionCampaign, rec: JSONResult) { | ||
| const handles = rec.products.map(product => product.handle).join(":") | ||
| async function getBundledMarkup(element: SectionCampaign, handles: string, rec: JSONResult) { | ||
| const target = new URL("/cart/update.js", window.location.href) |
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.
Use with locale
`${window.Shopify.routes.root}cart/update.js`
| } | ||
|
|
||
| async function getSectionMarkup(element: SectionCampaign, handles: string, rec: JSONResult) { | ||
| const target = new URL("/search", window.location.href) |
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.
${window.Shopify.routes.root}search'
Context
Add new Section Campaign mode to fetch rendered section via Bundled Section Rendering API
Compared to the previous mode this supports self references of sections and blocks
Related Jira ticket
Screenshots