Commit 0163c71
authored
feat(product tours): click element to advance to next step (#2783)
## Problem
product tours only support progression through a "next" button, which means you cannot build a tour that requires any user interaction (e.g. opening a drawer or modal, etc)
<!-- Who are we building for, what are their needs, why is this important? -->
## Changes
adds support for a new `click`\-type trigger that will progress the tour when the target element is clicked. after click, the tour waits up to 2s for the next step's element to be visible.
also:
- removes the strict validation that "all elements must be in the dom at tour start"
- adds URL "normalization" to strip trailing slashes when the operator is `exact` (PR to add this note in main repo coming soon)
[product-tour-click-action.mp4 <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.com/user-attachments/thumbnails/47ac12a5-4f73-4e73-af8b-035c909da6ff.mp4" />](https://app.graphite.com/user-attachments/video/47ac12a5-4f73-4e73-af8b-035c909da6ff.mp4)
<!-- What is changed and what information would be useful to a reviewer? -->
## Release info Sub-libraries affected
### Libraries affected
<!-- Please mark which libraries will require a version bump. -->
- [ ] All of them
- [x] posthog-js (web)
- [ ] posthog-js-lite (web lite)
- [ ] posthog-node
- [ ] posthog-react-native
- [ ] @posthog/react
- [ ] @posthog/ai
- [ ] @posthog/nextjs-config
- [ ] @posthog/nuxt
- [ ] @posthog/rollup-plugin
- [ ] @posthog/webpack-plugin
## Checklist
- [ ] Tests for new code
- [x] Accounted for the impact of any changes across different platforms
- [x] Accounted for backwards compatibility of any changes (no breaking changes!)
- [x] Took care not to unnecessarily increase the bundle size
### If releasing new changes
- [x] Ran `pnpm changeset` to generate a changeset file
- [x] Added the "release" label to the PR to indicate we're publishing new versions for the affected packages
<!-- For more details check RELEASING.md -->1 parent ee5e76d commit 0163c71
File tree
6 files changed
+118
-18
lines changed- .changeset
- packages/browser/src
- extensions/product-tours
- components
- playground/nextjs/pages
6 files changed
+118
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
| |||
295 | 303 | | |
296 | 304 | | |
297 | 305 | | |
| 306 | + | |
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
| |||
322 | 331 | | |
323 | 332 | | |
324 | 333 | | |
325 | | - | |
326 | | - | |
| 334 | + | |
| 335 | + | |
327 | 336 | | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
331 | 340 | | |
332 | 341 | | |
333 | | - | |
334 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
335 | 349 | | |
336 | 350 | | |
337 | 351 | | |
| |||
367 | 381 | | |
368 | 382 | | |
369 | 383 | | |
370 | | - | |
371 | | - | |
372 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
373 | 389 | | |
374 | 390 | | |
375 | 391 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
Lines changed: 44 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
| |||
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
38 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
| |||
232 | 243 | | |
233 | 244 | | |
234 | 245 | | |
235 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
236 | 249 | | |
237 | 250 | | |
238 | 251 | | |
| |||
280 | 293 | | |
281 | 294 | | |
282 | 295 | | |
283 | | - | |
| 296 | + | |
284 | 297 | | |
285 | | - | |
| 298 | + | |
286 | 299 | | |
287 | 300 | | |
288 | 301 | | |
289 | 302 | | |
290 | | - | |
| 303 | + | |
291 | 304 | | |
292 | 305 | | |
293 | 306 | | |
294 | 307 | | |
295 | 308 | | |
296 | | - | |
| 309 | + | |
297 | 310 | | |
298 | 311 | | |
299 | 312 | | |
| |||
305 | 318 | | |
306 | 319 | | |
307 | 320 | | |
308 | | - | |
| 321 | + | |
309 | 322 | | |
310 | 323 | | |
311 | 324 | | |
| |||
382 | 395 | | |
383 | 396 | | |
384 | 397 | | |
385 | | - | |
| 398 | + | |
386 | 399 | | |
387 | 400 | | |
388 | 401 | | |
| |||
410 | 423 | | |
411 | 424 | | |
412 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
413 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
414 | 444 | | |
415 | 445 | | |
416 | 446 | | |
| |||
419 | 449 | | |
420 | 450 | | |
421 | 451 | | |
| 452 | + | |
| 453 | + | |
422 | 454 | | |
423 | 455 | | |
424 | 456 | | |
425 | | - | |
| 457 | + | |
| 458 | + | |
426 | 459 | | |
427 | 460 | | |
428 | 461 | | |
| |||
613 | 646 | | |
614 | 647 | | |
615 | 648 | | |
616 | | - | |
| 649 | + | |
617 | 650 | | |
618 | 651 | | |
619 | 652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
117 | 153 | | |
118 | 154 | | |
119 | 155 | | |
| |||
0 commit comments