fix(admin): theme editor deep links use block file handles

activateAppId pointed at a non-existent 'datewise-embed' handle; the embed is 'embed'.
Adds an addAppBlockId link that places the scheduler block on the cart template.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
metatroncubeswdev 2026-10-13 21:23:21 -04:00
parent 85ed1a8f0e
commit 893b0f6ada

View File

@ -55,7 +55,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
return { return {
today, todayCount, weekCount, review, waiting, rows, peaks, setup, today, todayCount, weekCount, review, waiting, rows, peaks, setup,
plan: cfg.shop.plan, monthCount, monthlyLimit: features.monthlyBookings, plan: cfg.shop.plan, monthCount, monthlyLimit: features.monthlyBookings,
themeEditor: `https://${cfg.shop.domain}/admin/themes/current/editor?context=apps&activateAppId=${process.env.SHOPIFY_API_KEY}/datewise-embed`, // Deep links: handles are the Liquid file names in extensions/datewise-widget/blocks/.
themeEditor: {
embed: `https://${cfg.shop.domain}/admin/themes/current/editor?context=apps&activateAppId=${process.env.SHOPIFY_API_KEY}/embed`,
block: `https://${cfg.shop.domain}/admin/themes/current/editor?template=cart&addAppBlockId=${process.env.SHOPIFY_API_KEY}/scheduler&target=newAppsSection`,
},
}; };
}; };
@ -140,7 +144,7 @@ function Kpi({ label, value, href, alert }: { label: string; value: number; href
type Setup = { anyLocation: boolean; widgetLive: boolean; guardOn: boolean }; type Setup = { anyLocation: boolean; widgetLive: boolean; guardOn: boolean };
function SetupGuide({ setup, themeEditor }: { setup: Setup; themeEditor: string }) { function SetupGuide({ setup, themeEditor }: { setup: Setup; themeEditor: { embed: string; block: string } }) {
const steps = [ const steps = [
{ {
id: "location", id: "location",
@ -148,13 +152,15 @@ function SetupGuide({ setup, themeEditor }: { setup: Setup; themeEditor: string
title: "Turn on a pickup or delivery location", title: "Turn on a pickup or delivery location",
body: "Your Shopify locations were imported switched off. Check the opening hours, time slots and capacity, then turn one on.", body: "Your Shopify locations were imported switched off. Check the opening hours, time slots and capacity, then turn one on.",
action: { label: "Open Locations & hours", href: "/app/locations" }, action: { label: "Open Locations & hours", href: "/app/locations" },
secondary: null,
}, },
{ {
id: "widget", id: "widget",
done: setup.widgetLive, done: setup.widgetLive,
title: "Add the scheduler to your cart", title: "Add the scheduler to your cart",
body: "In the theme editor, add the Delivery date & time block to the cart page and switch on the Datewise app embed so it also shows in the cart drawer. This step is marked done after the first shopper picks a time.", body: "Add the Delivery date & time block to your cart page, then switch on the Datewise app embed so the scheduler also appears in the cart drawer and checkout buttons wait for a time. Save in the theme editor after each. This step is marked done after the first shopper picks a time.",
action: { label: "Open theme editor", href: themeEditor, external: true }, action: { label: "Add block to cart page", href: themeEditor.block, external: true },
secondary: { label: "Turn on app embed", href: themeEditor.embed },
}, },
{ {
id: "guard", id: "guard",
@ -162,6 +168,7 @@ function SetupGuide({ setup, themeEditor }: { setup: Setup; themeEditor: string
title: "Require a time at checkout", title: "Require a time at checkout",
body: "The checkout guard stops orders without a valid date and time, including Buy it now and express checkouts. It works on every Shopify plan.", body: "The checkout guard stops orders without a valid date and time, including Buy it now and express checkouts. It works on every Shopify plan.",
action: { label: "Open Settings", href: "/app/settings" }, action: { label: "Open Settings", href: "/app/settings" },
secondary: null,
}, },
]; ];
const doneCount = steps.filter((x) => x.done).length; const doneCount = steps.filter((x) => x.done).length;
@ -206,6 +213,11 @@ function SetupGuide({ setup, themeEditor }: { setup: Setup; themeEditor: string
<s-button variant="primary" href={step.action.href} target={step.action.external ? "_blank" : undefined}> <s-button variant="primary" href={step.action.href} target={step.action.external ? "_blank" : undefined}>
{step.action.label} {step.action.label}
</s-button> </s-button>
{step.secondary && (
<s-button href={step.secondary.href} target="_blank">
{step.secondary.label}
</s-button>
)}
</s-stack> </s-stack>
)} )}
</s-stack> </s-stack>