App Embed Settings Plan
Plan for exposing widget settings inside Shopify Theme Editor app embed.
App Embed Settings Plan
Section titled “App Embed Settings Plan”Status: IMPLEMENTED (simplified model: embed activation only + DB-first appearance settings).
1) Goal
Section titled “1) Goal”Allow merchants to configure key chat widget options directly from Shopify Theme Editor app embed settings, while keeping your in-app Admin pages as the source of advanced configuration.
Target editor location:
Online Store -> Themes -> Customize -> App embeds -> Appifire AI Chat
2) Why this matters
Section titled “2) Why this matters”- Merchants expect storefront display controls in Theme Editor.
- Faster activation and simpler onboarding (toggle + visual options in one place).
- Reduces context switching between app admin and theme customizer.
- Keeps app aligned with common Shopify app UX conventions.
3) Settings model (simplified)
Section titled “3) Settings model (simplified)”Theme Editor app embed now exposes no storefront controls.
- Merchant action in Theme Editor: enable the AppiFire Chat embed and save.
- No title/message/color/position fields are configured in Theme Editor.
All other widget settings are managed in app admin only:
- Widget title
- Welcome message
- Brand color
- Bubble position
- Business/operational settings (billing, limits, data sync, knowledge, etc.)
4) Source of truth and precedence
Section titled “4) Source of truth and precedence”To avoid conflicts between Admin app settings and Theme Editor app embed settings, the implementation uses a DB-first runtime model.
Implemented model (DB source of truth)
Section titled “Implemented model (DB source of truth)”- Database value (
shopstable) is canonical. - Admin edits write directly to DB.
- Storefront widget runtime fetches DB settings from
GET /api/widget-settings. - Code defaults are used only when DB/client values are missing or invalid.
Data strategy (implemented)
Section titled “Data strategy (implemented)”- Keep current DB fields (no destructive change).
- Read embed settings in storefront runtime (
window.AppifireChat.settings) as optional metadata only. - Fetch DB settings from
GET /api/widget-settingsand apply them for appearance values (title, welcome message, brand color, bubble position). - Result: merchants manage all widget behavior in app admin, and use Theme Editor only to activate embed placement.
5) UX behavior
Section titled “5) UX behavior”In Theme Editor
Section titled “In Theme Editor”- Merchant enables embed and clicks Save in theme customizer.
- Storefront preview updates immediately.
In App Admin (Appearance/Settings pages)
Section titled “In App Admin (Appearance/Settings pages)”- Keep existing forms.
- Add helper copy:
- “App admin is the source of truth. Theme Editor embed fields can remain empty.”
- Keep deep link action: “Open Theme Editor (App embeds)”.
Navigation links
Section titled “Navigation links”Add quick links so merchants know where to configure related features outside embed display settings:
- Appearance (
/app/appearance) — visual widget settings and storefront visibility. - Knowledge Hub (
/app/knowledge) — website/business content used for responses. - Chats (
/app/chat-logs) — review real conversations and optimize copy. - Billing (
/app/billing) — plan, usage, and credit balance management.
Suggested placement:
- In the app embed help/description text, include module navigation shortcuts back to app admin:
- Dashboard (
/apps/appifire-ai-chat/app) - Chats (
/apps/appifire-ai-chat/app/chat-logs) - Data Sync (
/apps/appifire-ai-chat/app/data-sync) - Knowledge Hub (
/apps/appifire-ai-chat/app/knowledge) - Settings (
/apps/appifire-ai-chat/app/settings) - Appearance (
/apps/appifire-ai-chat/app/appearance) - Billing & Usage (
/apps/appifire-ai-chat/app/billing)
- Dashboard (
- In the
Appearancepage, show clear links:- Dashboard (
/app) - Chats (
/app/chat-logs) - Data Sync (
/app/data-sync) - Knowledge Hub (
/app/knowledge) - Settings (
/app/settings) - Appearance (
/app/appearance) - Billing & Usage (
/app/billing)
- Dashboard (
- Optional: in Theme Editor docs/help tooltip with “Open App Admin” deep links.
6) Technical implementation plan
Section titled “6) Technical implementation plan”Step 1: Define schema in extension
Section titled “Step 1: Define schema in extension”- Keep app embed extension schema informational-only:
- no runtime behavior controls in embed settings
- include guidance text + admin module links
Step 2: Wire settings into storefront widget runtime
Section titled “Step 2: Wire settings into storefront widget runtime”- In widget liquid/script render path:
- Read
widget_enabledfrom Shopify-provided embed settings. - Pass these values into
chat-widget.jsconfig. - Resolve effective values with DB-first precedence for appearance settings.
- Keep defaults as final fallback for invalid/missing values.
- Read
Step 3: Keep backward compatibility
Section titled “Step 3: Keep backward compatibility”- If merchant has not saved embed settings, existing DB-driven behavior remains unchanged.
- No migration required for initial rollout.
Step 4: Admin app messaging
Section titled “Step 4: Admin app messaging”- Add subtle notice in
Appearancepage clarifying DB-first behavior. - Add “Open Theme Editor” action for convenience.
- Add quick nav links to related pages:
Appearance,Knowledge Hub,Chats,Billing.
Step 5: QA matrix
Section titled “Step 5: QA matrix”- New install: defaults render correctly.
- Existing install with DB values: behavior unchanged.
- Title + welcome + color + position + visibility update correctly from app admin.
- Admin change appears on storefront immediately after save.
- Theme Editor shows informational text with admin navigation links.
- Mobile + desktop behavior remains stable.
7) Suggested release phases
Section titled “7) Suggested release phases”Phase 1 (current)
Section titled “Phase 1 (current)”- Theme Editor used for embed activation only
- Keep all appearance fields in app admin
Phase 2 (optional future)
Section titled “Phase 2 (optional future)”- If needed, expose selected advanced controls in Theme Editor after merchant feedback
8) Risks and mitigations
Section titled “8) Risks and mitigations”- Confusion from duplicated settings
- Mitigation: clear precedence note in admin UI.
- Theme-specific differences
- Mitigation: test on Dawn + one custom theme.
- Unexpected mobile regressions
- Mitigation: dedicated device QA checklist before release.
9) Final recommendation
Section titled “9) Final recommendation”Keep Theme Editor embed simple with activation-only flow.
Keep visual, business, and operational controls inside app admin.
Keep shops table as source of truth for appearance values and provide clear in-app navigation guidance.