Skip to content

feat: Calendly#750

Open
harlan-zw wants to merge 4 commits intomainfrom
feat/calendly
Open

feat: Calendly#750
harlan-zw wants to merge 4 commits intomainfrom
feat/calendly

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

@harlan-zw harlan-zw commented May 7, 2026

🔗 Linked issue

Related to #177

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Adds Calendly to the registry as useScriptCalendly. Bundled and proxied via assets.calendly.com with PRIVACY_IP_ONLY; the booking iframe still hits calendly.com directly since the vendor frame must load from origin. Composable auto-injects the widget stylesheet on first use, exposes a stub queue for initInlineWidget / initPopupWidget / initBadgeWidget (full args spread to avoid the regression flagged on #741), and ships a typed surface for the popup/close helpers. Includes docs, playground, bundled + CDN fixtures, e2e suite, proxy/first-party unit rows, and the stub-queue regression guard.

Adds the Calendly booking widget to the registry as `useScriptCalendly`,
covering inline, popup, and badge embeds with first-party proxy support
for `assets.calendly.com` and Partytown forwards for the widget initialisers.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scripts-playground Ready Ready Preview, Comment May 7, 2026 6:08am

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 7, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​nuxt/​ui@​4.7.19710010098100

View full report

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@750

commit: 47fc93b

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f698a979-3a1e-4551-b8a5-5e1cb8a61f45

📥 Commits

Reviewing files that changed from the base of the PR and between c1a9b11 and 47fc93b.

📒 Files selected for processing (5)
  • packages/script/src/registry-types.json
  • packages/script/src/runtime/registry/calendly.ts
  • test/fixtures/calendly-cdn/pages/calendly.vue
  • test/fixtures/calendly/pages/calendly.vue
  • test/unit/calendly-stub-queue.test.ts
✅ Files skipped from review due to trivial changes (3)
  • test/fixtures/calendly/pages/calendly.vue
  • test/fixtures/calendly-cdn/pages/calendly.vue
  • packages/script/src/runtime/registry/calendly.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/unit/calendly-stub-queue.test.ts
  • packages/script/src/registry-types.json

📝 Walkthrough

Walkthrough

This pull request introduces Calendly scheduling widget integration to Nuxt Scripts. The implementation provides a useScriptCalendly() composable that handles loading the Calendly external widget script with optional bundling and proxying, injects the widget stylesheet, and exposes a typed proxy wrapping window.Calendly methods. The integration includes widget variants for inline, popup, and badge embeds with support for prefill and UTM tracking options. A stub queue mechanism queues method calls until the SDK loads. The PR adds user documentation, playground demonstrations, comprehensive E2E test coverage for both bundled and CDN delivery modes, unit tests validating the stub queue and proxy configuration, and privacy tier declarations marking Calendly as PRIVACY_IP_ONLY with domain-level IP anonymization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Calendly' is concise and directly describes the main feature being added to the codebase.
Description check ✅ Passed The description is detailed and related to the changeset, explaining the new Calendly integration with composable, bundling, proxying, and testing details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/calendly

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
FIRST_PARTY.md (1)

116-148: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify Calendly’s iframe exception in the table.

Current wording can imply all Calendly traffic is first-party proxied, but the booking iframe remains direct to calendly.com. Add a brief note to avoid privacy-scope confusion.

✏️ Suggested doc clarification
-| `calendly` | calendly | `PRIVACY_IP_ONLY` | Path A |
+| `calendly` | calendly | `PRIVACY_IP_ONLY` | Path A (script asset proxying; booking iframe remains direct to calendly.com) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@FIRST_PARTY.md` around lines 116 - 148, The table entry for the `calendly`
config key (row showing `calendly` | `PRIVACY_IP_ONLY` | Path A) is ambiguous
about Calendly’s iframe being proxied; update that row to add a concise
clarifying note that while general Calendly integrations are treated as
PRIVACY_IP_ONLY via Path A, the booking iframe loads directly from calendly.com
and is not proxied (e.g., append “— booking iframe loads directly from
calendly.com, not proxied” or similar) so readers don’t assume full first‑party
proxy coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/script/src/runtime/registry/calendly.ts`:
- Around line 34-40: The CalendlyInlineWidgetOptions interface currently types
parentElement as HTMLElement | string which allows invalid selector strings;
change parentElement to only HTMLElement in the CalendlyInlineWidgetOptions
declaration so callers must pass a DOM element, and update any call sites or
helper functions that constructed or accepted selector strings to instead
resolve the element (e.g., querySelector) before passing it to the
CalendlyInlineWidgetOptions constructor or to the functions that consume
parentElement; ensure references to parentElement in functions like the inline
widget renderer treat it as an HTMLElement (no string handling) and add runtime
checks where appropriate to throw a clear error if a non-HTMLElement is
supplied.

---

Outside diff comments:
In `@FIRST_PARTY.md`:
- Around line 116-148: The table entry for the `calendly` config key (row
showing `calendly` | `PRIVACY_IP_ONLY` | Path A) is ambiguous about Calendly’s
iframe being proxied; update that row to add a concise clarifying note that
while general Calendly integrations are treated as PRIVACY_IP_ONLY via Path A,
the booking iframe loads directly from calendly.com and is not proxied (e.g.,
append “— booking iframe loads directly from calendly.com, not proxied” or
similar) so readers don’t assume full first‑party proxy coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e0facc9-42af-4d83-bbe3-70f9832d2578

📥 Commits

Reviewing files that changed from the base of the PR and between 6ddc9f6 and 7454fcc.

📒 Files selected for processing (25)
  • FIRST_PARTY.md
  • docs/content/docs/1.guides/2.first-party.md
  • docs/content/scripts/calendly.md
  • packages/script/src/registry-logos.ts
  • packages/script/src/registry-types.json
  • packages/script/src/registry.ts
  • packages/script/src/runtime/registry/calendly.ts
  • packages/script/src/runtime/registry/schemas.ts
  • packages/script/src/runtime/types.ts
  • packages/script/src/script-meta.ts
  • playground/pages/index.vue
  • playground/pages/third-parties/calendly/default.vue
  • playground/pages/third-parties/calendly/nuxt-scripts.vue
  • test/e2e/_calendly-suite.ts
  • test/e2e/calendly-cdn.test.ts
  • test/e2e/calendly.test.ts
  • test/fixtures/calendly-cdn/nuxt.config.ts
  • test/fixtures/calendly-cdn/tsconfig.json
  • test/fixtures/calendly/app.vue
  • test/fixtures/calendly/nuxt.config.ts
  • test/fixtures/calendly/package.json
  • test/fixtures/calendly/pages/index.vue
  • test/fixtures/calendly/tsconfig.json
  • test/types/types.test-d.ts
  • test/unit/proxy-configs.test.ts

Comment thread packages/script/src/runtime/registry/calendly.ts
The calendly e2e tests failed in CI because:
- The fixtures lacked a `prepare:fixtures` entry, so `.nuxt/tsconfig.json`
  was missing when Vite parsed the page that imports `useScriptCalendly`.
- The cdn fixture had no per-call `bundle: false`, so the script was
  always served from /_scripts/assets/ (proxy) instead of the CDN.
- The stub queue e2e was racing the real script load (`onNuxtReady`)
  and is now a deterministic unit test.

Restructure pages to mirror the linkedin-insight fixtures: empty index,
composable usage on `/calendly`. cdn fixture now overrides the page +
registry config to disable bundling. Add unit test guarding the
multi-arg push regression (#741) on the stub queue.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/unit/calendly-stub-queue.test.ts (1)

53-62: ⚡ Quick win

Missing queue-length guard in the multi-arg test

The second test asserts the shape of stub.q[0] but never verifies that exactly one entry was enqueued. If a future change to the stub accidentally pushes the entry multiple times (e.g., once per arg), the assertion on q[0] alone would still pass.

🛡️ Proposed fix
  it('preserves multiple positional args (showPopupWidget(url, ...))', () => {
    const stub = createStub()
    stub.showPopupWidget('https://calendly.com/example/30min', { foo: 'bar' }, 42)
+   expect(stub.q).toHaveLength(1)
    expect(stub.q[0]).toEqual([
      'showPopupWidget',
      'https://calendly.com/example/30min',
      { foo: 'bar' },
      42,
    ])
  })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/calendly-stub-queue.test.ts` around lines 53 - 62, The test for
createStub's showPopupWidget should assert the queue length before inspecting
stub.q[0]; add an explicit expectation that stub.q.length === 1 (or toEqual(1))
immediately after calling stub.showPopupWidget to ensure exactly one entry was
enqueued, then keep the existing equality check on stub.q[0]; reference
createStub, stub.showPopupWidget and stub.q when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/fixtures/calendly/pages/calendly.vue`:
- Around line 11-14: The call to proxy.Calendly.initInlineWidget uses a CSS
selector string for parentElement but Calendly expects an actual DOM node;
change the invocation so parentElement is a resolved HTMLElement (e.g., obtain
the element via document.getElementById('calendly-host') or
document.querySelector('#calendly-host') and pass that variable into
proxy.Calendly.initInlineWidget) to ensure the widget mounts inside the intended
container.

---

Nitpick comments:
In `@test/unit/calendly-stub-queue.test.ts`:
- Around line 53-62: The test for createStub's showPopupWidget should assert the
queue length before inspecting stub.q[0]; add an explicit expectation that
stub.q.length === 1 (or toEqual(1)) immediately after calling
stub.showPopupWidget to ensure exactly one entry was enqueued, then keep the
existing equality check on stub.q[0]; reference createStub, stub.showPopupWidget
and stub.q when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 47210afd-2374-4e5b-b53e-cc841be0a607

📥 Commits

Reviewing files that changed from the base of the PR and between 7454fcc and c1a9b11.

📒 Files selected for processing (8)
  • package.json
  • test/e2e/_calendly-suite.ts
  • test/fixtures/calendly-cdn/nuxt.config.ts
  • test/fixtures/calendly-cdn/pages/calendly.vue
  • test/fixtures/calendly/nuxt.config.ts
  • test/fixtures/calendly/pages/calendly.vue
  • test/fixtures/calendly/pages/index.vue
  • test/unit/calendly-stub-queue.test.ts
✅ Files skipped from review due to trivial changes (3)
  • package.json
  • test/fixtures/calendly/nuxt.config.ts
  • test/fixtures/calendly-cdn/pages/calendly.vue
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/fixtures/calendly/pages/index.vue
  • test/fixtures/calendly-cdn/nuxt.config.ts
  • test/e2e/_calendly-suite.ts

Comment thread test/fixtures/calendly/pages/calendly.vue
Calendly's `initInlineWidget` API requires a DOM element reference;
CSS selector strings are not supported. Tighten the type and update
fixtures to resolve the element via `querySelector` first.

Per CodeRabbit review on #750.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant