Kajabi GamificationPackage Docs

Go Live Checklist

เอกสารแพ็กเกจ gamification สำหรับ Kajabi ที่ย้ายจาก repo มาไว้ใน Wize School เพื่อใช้เป็น productized package และใช้กับเว็บนี้ต่อได้เลย

GamifyKit — Go-Live Checklist (build → sell-ready)

A step-by-step runbook to close every blocker between "code complete" and "selling".

Do the stages **in order** — Stage 1 is the riskiest and gates everything else.

Mark each box; a stage isn't done until every **PASS** criterion holds.

Legend: 🔴 must-pass blocker · 🟡 important · ⚪ polish

---

Stage 0 — Prerequisites

  • [ ] Kajabi admin access to **Wize School** (site_id 2148621551).
  • [ ] Cloudflare account with Wrangler logged in (npx wrangler whoami).
  • [ ] Repo deps installed locally: bun install (so astro check / build work).
  • [ ] Build a fresh zip: cd packages/kajabi-gamify && node scripts/build-theme-zip.mjs --skin editorial-wize → dist/gamifykit-editorial-wize-GamifyKit-1.0.0.zip.

---

Stage 1 — 🔴 Prove it installs on Kajabi (closes Risk #1)

> This validates every assumption the theme was built on. Do it FIRST.

> NOTE: the theme is now aligned to Kajabi's official theme-cornerstone-product

> (schema delimiter {% schema %}, layouts/ dir, template names, content_for_header,

> sections-in-layout, current_site_user, image_picker_url). The checks below are now

> confirmations rather than likely failures — but still do them on a real upload.

  • [ ] Kajabi → Design → **Saved Templates → Upload Template** → drop the zip.

- **PASS:** upload succeeds, theme appears in Saved Templates.

- **IF FAIL:** note the error. Likely settings_schema.json format or zip layout

(files must be at archive root — they are). Compare against a Kajabi sample theme export.

  • [ ] **Confirm the schema-block delimiter.** Export/inspect a stock Kajabi product theme and

check whether sections use <schema>…</schema> or {% schema %}…{% endschema %}.

- **PASS:** our <schema> matches.

- **IF MISMATCH:** swap the delimiter in all 8 files in theme/sections/ (and update

scripts/validate-theme.mjs extractSchema — it already accepts both). Rebuild.

  • [ ] **Confirm template filenames.** Check Kajabi's expected names

(product.liquid / category.liquid / post.liquid vs .show variants).

- **PASS:** sections render on course home / category / lesson.

- **IF MISMATCH:** rename files in theme/templates/ to match.

  • [ ] Activate the theme on a **test/duplicate course** (not a live one yet).
  • [ ] Add each Gamify section in the editor.

- **PASS:** all 8 appear under the **Gamify** category; settings are editable.

  • [ ] Open the course as a student; click **Mark complete** on a lesson.

- **PASS:** XP rises, a badge unlocks, confetti fires; progress % matches Kajabi.

  • [ ] Verify completion.percent/completed/total/next_post actually populate

(the whole progress story depends on this).

  • [ ] 🟡 Mobile pass: open on a phone — no overlap, buttons reachable.
  • [ ] 🟡 Reduced-motion: enable OS "reduce motion" → confetti must NOT play.
  • [ ] 🟡 Uninstall test: switch back to the old theme → no broken pages.

**Gate:** ✅ theme installs, sections render, local gamification works on real Kajabi.

---

Stage 2 — 🔴 Stand up the Pro backend (closes Risk #2)

  • [ ] bun run check (astro check) → **0 errors** in src/lib/gamify + src/pages/api/gamify + src/pages/admin/gamify.astro. Fix any type errors.
  • [ ] No new DB needed — GamifyKit reuses the existing DB (wize-school-db). Apply tables:

npx wrangler d1 execute wize-school-db --remote --file=src/lib/gamify/schema.sql

  • [ ] Seed a buyer row (command in pro-setup.md); set a strong api_key + webhook_secret.
  • [ ] Set GAMIFY_ADMIN_EMAILS secret (your email).
  • [ ] Deploy, then smoke-test each endpoint:

- [ ] POST /api/gamify/state with Bearer key → 200, row written.

- [ ] GET /api/gamify/state?product=&student= → returns it.

- [ ] GET /api/gamify/leaderboard?product= → ranked list.

- [ ] GET /api/gamify/analytics?buyer= while logged in as admin → stats.

- [ ] Unauthorized (no/bad key) → 401.

**Gate:** ✅ all four endpoints work against live D1.

---

Stage 3 — 🔴 Solve identity + quiz (closes Risks #3, #4)

  • [ ] **studentKey:** on a Kajabi member/lesson page, inspect for a member identifier

(search the page JS for member, email, or a data attribute Kajabi injects).

- [ ] Update gamify-config.liquid → gkResolveStudent() to read the real identifier.

- **PASS:** the same logged-in student gets the SAME key on two different browsers/devices.

- **IF NONE EXISTS:** decide the fallback story (e.g. SSO via your better-auth, or accept

per-device and drop "cross-device" from Pro marketing). **Don't market sync until this passes.**

  • [ ] Set Mode = **Pro** in theme settings + paste API base/key; complete a lesson on device A,

open on device B → state syncs. Reset on A → B reflects it.

  • [ ] **Quiz webhook:** create a Kajabi automation on *quiz passed* → webhook to

…/api/gamify/webhook/kajabi?buyer=<id>. Capture the real payload.

- [ ] Align field names in src/pages/api/gamify/webhook/kajabi.ts (event/student/product/quiz)

and confirm the signature header name + format.

- **PASS:** passing a gated quiz unlocks the step.

- **IF Kajabi can't sign/webhook quizzes:** drop quiz-gating from Pro v1 (keep it roadmap).

**Gate:** ✅ sync works cross-device OR marketing copy adjusted; quiz-gate works OR descoped.

---

Stage 4 — 🟡 Dogfood + proof on Wize (Phase 6)

  • [ ] Install on real Wize courses: wize.chat 101, bootcamp waitlist, resources hub, AI directory.
  • [ ] Run with real learners for a short window.
  • [ ] Capture **before/after completion %**, screenshots, and a 60–90s demo video.
  • [ ] Put the live demo URL on the landing page (replace the local landing.html).

**Gate:** ✅ at least one honest proof point (numbers or video) you can show buyers.

---

Stage 5 — ⚪ Commercial readiness

  • [ ] Have license.md reviewed (ideally by someone legal); finalize refund window.
  • [ ] Create Kajabi **offers/checkout**: Streamlined $347, Designer $597, Pro subscription.
  • [ ] Delivery: how buyers receive the zip + license key (Kajabi product / email).
  • [ ] Support: inbox + response-time policy stated in the purchase email.
  • [ ] Record install + Pro-setup tutorial videos (link from install.md / pro-setup.md).
  • [ ] Decide distribution: self-sell now; **Kajabi Template Store** submission after #1–#4 pass

(check their review + commission terms first).

**Gate:** ✅ a buyer can pay, receive, install, and get support.

---

🚦 Sell-ready definition (all must be true)

1. Theme installs on real Kajabi; all sections render & customize. *(Stage 1)*

2. Local gamification works on a real course; progress matches Kajabi. *(Stage 1)*

3. Pro endpoints work on live D1; astro check clean. *(Stage 2)*

4. Either cross-device sync works, or Pro marketing claims match reality. *(Stage 3)*

5. At least one proof point from Wize. *(Stage 4)*

6. Checkout + delivery + license + support in place. *(Stage 5)*

Until 1–4 are checked, it is **not** sellable — those validate the assumptions the code was

built on. 5–6 are needed before taking money.