Skip to content

Conversation

@timowestnosto
Copy link
Contributor

@timowestnosto timowestnosto commented Sep 2, 2025

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

Copilot AI review requested due to automatic review settings September 2, 2025 14:53
Copy link
Contributor

Copilot AI left a 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 postJSON utility function to handle POST requests with JSON payloads
  • Created new BundledCampaign component 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

@timowestnosto timowestnosto force-pushed the bundled-campaign branch 4 times, most recently from 52e8b99 to 33b35ce Compare September 2, 2025 16:11
@timowestnosto timowestnosto changed the title feat: add BundledCampaign feat: add bundled SectionCampaign mode Sep 2, 2025
@timowestnosto timowestnosto force-pushed the bundled-campaign branch 4 times, most recently from be8abbd to 28de060 Compare September 2, 2025 17:15
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)
Copy link
Contributor

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)
Copy link
Contributor

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants