Repository navigation
Conversation
…c hooks (Phase 1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_data) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # assets/public/js/crossSite.js # assets/public/js/frontend.js
The card used the bare NotificationX icon, so it had no name next to the Google Analytics card. It now shows "Built-in Counter", like the other source logos.
ShahrearMSf
left a comment
There was a problem hiding this comment.
✅ Approved: Free side of the built-in live visitor count
@sh03rohan bhai, the Free hooks are tidy and do exactly what Pro #63 needs, and nothing new runs until a live notification is switched on. I merged the latest dev into the branch, rebuilt the bundles and fixed one small design gap in the source card. Details below.
What I fixed (pushed to this branch)
- Merged
devinto the branch (a4763bd). The only conflicts were the builtfrontend.jsandcrossSite.js. I rebuilt both from the merged source with the lockfile toolchain (npm ci --ignore-scripts, webpack 5.99.8);check:bundlepasses (431.7 KB / 432.1 KB raw). - Built-in source card had no name (2d46f12). It used the bare
logo-icon.svg, so next to the Google Analytics logo it was just a small bell nobody could identify. It now usesimages/extensions/sources/live-visitors.png("Built-in Counter" in the same navy wordmark style ascustom.png).
What I tested
Automated
- Jest: 233/233 (16 suites), including the new
entry-filtertests. - PHPUnit (full Free suite, WP 7.1.4 test lib, MySQL): 323/0.
- PHP 7.4 lint on every changed PHP file: clean, with no PHP 8-only syntax.
Live (local WP 7.1.4 + WooCommerce 11.2, PHP 8.4, together with Pro #63)
- Builder: with both modules on, picking Page Analytics still defaults to Google Analytics, as before. Selecting Built-in hides the "connect your Google Analytics" warning, swaps the sidebar text for the new
doc(), limits Design topa-theme-threeand adds the Pro content fields. Publishing savessource = live_visitors. Preview shows a sample number. - Frontend: the entry stays hidden while
nx_awaiting_datais set, and the count appears throughnx_frontend_entry. Desktop and 390px (Pro's mobile card): no horizontal overflow.
Version mixes (no fatal, no JS errors):
| Combination | Result |
|---|---|
| This Free alone | Page Analytics locked as before; live notifications not printed; no ping script |
| This Free + released Pro 3.2.7 | Built-in card shows "NotificationX Pro needs an update."; saved live notifications are excluded from the page (exclude_unsupported) |
| Released Free 3.3.8 + Pro #63 | Pro stays inert without NOTIFICATIONX_LIVE_API; admin and frontend fine |
- REST:
/notificationx/v1/livepasses the "Enable REST API" restriction as a logged-out user.is_public_route_name()rejects other namespaces (covered by your seam tests).
Content
No content issues. "Built-in (no Google Analytics)", the upsell text and the update popup read clearly.
Design
- Source card: fixed above.
Note (not a blocker)
- If Free is downgraded to 3.3.8 while saved live notifications still exist, 3.3.8's
ExtensionFactory::get()logs "Undefined array key live_visitors". That's old Free code meeting an unknown source, not something this PR can change.
Merge readiness
Ready to merge, together with Pro #63 (Free first, as the description says).
Brings Free PR #207 up to date with dev (77443de). Conflicts: assets/public/js/frontend.js and crossSite.js only. Both were rebuilt from the merged sources (npm run build) instead of taking a side; every other built file is byte-identical to the fresh build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A live visitors notice waits for its count: NotificationContainer draws nothing while the `nx_frontend_entry` filter returns null or the entry is still `nx_awaiting_data`. But useNotificationX added it to the list every cycle anyway, and a notice only leaves the list through its own card's timer. So a visitor who waited about a minute before the count arrived got four identical cards at once. dispatchNotification() now skips a cycle while the notice is held back (heldBack.ts) and keeps the loop; the next cycle shows it once the count is known. Only entries (objects) can be held back: bar, popup and GDPR content is never touched, and without an add-on filter nothing changes. Tests: tests/js/frontend/held-back.test.js (hidden cycles add nothing, it shows exactly once when the count arrives, the loop keeps running, a sales notification loops as before, plain entries without filters, isHeldBack). Rebuilt frontend.js and crossSite.js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ShahrearMSf Updated since the 12 Nov approval:
Checks: Jest 1066/1066, PHP 520, build and Could you take a quick re-review? Thank you! |
Free part of the built-in live visitor count ("12 people are viewing this now") that works without Google Analytics. The counting logic lives in Pro (PR: ). Merge this one first.
What's added
nx_frontend_entry(supply or hold back an entry),notificationx:refresh,nx_live_viewers_available,nx_live_visitors_themes, and theNOTIFICATIONX_LIVE_APImarker.nx_public_rest_routes: lets an add-on make one of NotificationX's own routes public. Restricted to the NotificationX namespace; other plugins' routes and malformed names are rejected, and a request whose login check failed runs as a logged-out visitor.nx_awaiting_data: an entry marked as waiting for data never renders until a filter supplies it, so a failed add-on script can't show an empty number.Unchanged
Testing
Notes
@since x.x.xplaceholders; the version is set at release.