@teleporthq/teleport-project-generator-next 0.45.6 → 0.45.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/__tests__/analytics-experiments.test.ts +45 -6
  2. package/__tests__/analytics-tracker-consent.test.ts +73 -4
  3. package/__tests__/content-site-index.test.ts +5 -5
  4. package/__tests__/item-comparison-project-plugin.test.ts +57 -0
  5. package/__tests__/static-export-project-plugin.test.ts +239 -0
  6. package/dist/cjs/access-rules/gate-runtime-source.d.ts +10 -1
  7. package/dist/cjs/access-rules/gate-runtime-source.d.ts.map +1 -1
  8. package/dist/cjs/access-rules/gate-runtime-source.js +20 -2
  9. package/dist/cjs/access-rules/gate-runtime-source.js.map +1 -1
  10. package/dist/cjs/analytics/experiments.d.ts +17 -8
  11. package/dist/cjs/analytics/experiments.d.ts.map +1 -1
  12. package/dist/cjs/analytics/experiments.js +30 -13
  13. package/dist/cjs/analytics/experiments.js.map +1 -1
  14. package/dist/cjs/analytics/tracker-source.d.ts +1 -1
  15. package/dist/cjs/analytics/tracker-source.d.ts.map +1 -1
  16. package/dist/cjs/analytics/tracker-source.js +1 -1
  17. package/dist/cjs/analytics/tracker-source.js.map +1 -1
  18. package/dist/cjs/blog/content-site-index.d.ts.map +1 -1
  19. package/dist/cjs/blog/content-site-index.js +1 -1
  20. package/dist/cjs/blog/content-site-index.js.map +1 -1
  21. package/dist/cjs/index.d.ts +1 -0
  22. package/dist/cjs/index.d.ts.map +1 -1
  23. package/dist/cjs/index.js +24 -22
  24. package/dist/cjs/index.js.map +1 -1
  25. package/dist/cjs/item-comparison/compare-route.d.ts.map +1 -1
  26. package/dist/cjs/item-comparison/compare-route.js +1 -1
  27. package/dist/cjs/item-comparison/compare-route.js.map +1 -1
  28. package/dist/cjs/item-comparison/settings.d.ts +11 -0
  29. package/dist/cjs/item-comparison/settings.d.ts.map +1 -1
  30. package/dist/cjs/item-comparison/settings.js +15 -1
  31. package/dist/cjs/item-comparison/settings.js.map +1 -1
  32. package/dist/cjs/static-export/project-plugin.d.ts +17 -0
  33. package/dist/cjs/static-export/project-plugin.d.ts.map +1 -0
  34. package/dist/cjs/static-export/project-plugin.js +182 -0
  35. package/dist/cjs/static-export/project-plugin.js.map +1 -0
  36. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  37. package/dist/esm/access-rules/gate-runtime-source.d.ts +10 -1
  38. package/dist/esm/access-rules/gate-runtime-source.d.ts.map +1 -1
  39. package/dist/esm/access-rules/gate-runtime-source.js +20 -2
  40. package/dist/esm/access-rules/gate-runtime-source.js.map +1 -1
  41. package/dist/esm/analytics/experiments.d.ts +17 -8
  42. package/dist/esm/analytics/experiments.d.ts.map +1 -1
  43. package/dist/esm/analytics/experiments.js +30 -13
  44. package/dist/esm/analytics/experiments.js.map +1 -1
  45. package/dist/esm/analytics/tracker-source.d.ts +1 -1
  46. package/dist/esm/analytics/tracker-source.d.ts.map +1 -1
  47. package/dist/esm/analytics/tracker-source.js +1 -1
  48. package/dist/esm/analytics/tracker-source.js.map +1 -1
  49. package/dist/esm/blog/content-site-index.d.ts.map +1 -1
  50. package/dist/esm/blog/content-site-index.js +1 -1
  51. package/dist/esm/blog/content-site-index.js.map +1 -1
  52. package/dist/esm/index.d.ts +1 -0
  53. package/dist/esm/index.d.ts.map +1 -1
  54. package/dist/esm/index.js +1 -0
  55. package/dist/esm/index.js.map +1 -1
  56. package/dist/esm/item-comparison/compare-route.d.ts.map +1 -1
  57. package/dist/esm/item-comparison/compare-route.js +1 -1
  58. package/dist/esm/item-comparison/compare-route.js.map +1 -1
  59. package/dist/esm/item-comparison/settings.d.ts +11 -0
  60. package/dist/esm/item-comparison/settings.d.ts.map +1 -1
  61. package/dist/esm/item-comparison/settings.js +15 -1
  62. package/dist/esm/item-comparison/settings.js.map +1 -1
  63. package/dist/esm/static-export/project-plugin.d.ts +17 -0
  64. package/dist/esm/static-export/project-plugin.d.ts.map +1 -0
  65. package/dist/esm/static-export/project-plugin.js +179 -0
  66. package/dist/esm/static-export/project-plugin.js.map +1 -0
  67. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  68. package/package.json +3 -3
  69. package/src/access-rules/gate-runtime-source.ts +69 -11
  70. package/src/analytics/experiments.ts +34 -13
  71. package/src/analytics/tracker-source.ts +34 -7
  72. package/src/blog/content-site-index.ts +3 -4
  73. package/src/index.ts +1 -0
  74. package/src/item-comparison/compare-route.ts +9 -5
  75. package/src/item-comparison/settings.ts +27 -0
  76. package/src/static-export/project-plugin.ts +137 -0
@@ -31,12 +31,22 @@ const uidlWith = (rootChildren: any[], componentChildren: any[] = []) =>
31
31
 
32
32
  function runScript(ids: string[], storage: Record<string, string>, random = 0.2) {
33
33
  const styles: string[] = []
34
+ const listeners: Record<string, Array<() => void>> = {}
34
35
  const fakeWindow = {
35
36
  localStorage: {
36
37
  getItem: (key: string) => (key in storage ? storage[key] : null),
37
38
  setItem: (key: string, value: string) => {
38
39
  storage[key] = value
39
40
  },
41
+ removeItem: (key: string) => {
42
+ delete storage[key]
43
+ },
44
+ },
45
+ addEventListener: (type: string, listener: () => void) => {
46
+ listeners[type] = (listeners[type] || []).concat(listener)
47
+ },
48
+ removeEventListener: (type: string, listener: () => void) => {
49
+ listeners[type] = (listeners[type] || []).filter((known) => known !== listener)
40
50
  },
41
51
  } as any
42
52
  const fakeDocument = {
@@ -48,7 +58,13 @@ function runScript(ids: string[], storage: Record<string, string>, random = 0.2)
48
58
  fakeDocument,
49
59
  Object.assign(Object.create(Math), { random: () => random })
50
60
  )
51
- return { assigned: fakeWindow.__tpExp as Record<string, string>, styles }
61
+ // What the cookie banner's Accept does: the workflow step writes the key and
62
+ // announces the write in this tab.
63
+ const accept = () => {
64
+ storage.cookieConsent = 'accepted'
65
+ ;(listeners['teleport:local-storage'] || []).forEach((listener) => listener())
66
+ }
67
+ return { assigned: fakeWindow.__tpExp as Record<string, string>, styles, accept }
52
68
  }
53
69
 
54
70
  describe('experiments — finding them in the project', () => {
@@ -87,23 +103,45 @@ describe('experiments — finding them in the project', () => {
87
103
  })
88
104
 
89
105
  describe('experiments — the head script', () => {
90
- it('flips a coin without consent, keeps the arm, and hides the other variant', () => {
106
+ it('flips a coin without consent, hides the other variant, and stores nothing on the device', () => {
91
107
  const storage: Record<string, string> = {}
92
108
  const first = runScript(['hero-1'], storage, 0.2)
93
109
  expect(first.assigned).toEqual({ 'hero-1': 'a' })
94
- expect(storage['tq_exp:hero-1']).toBe('a')
95
110
  expect(first.styles).toEqual([
96
111
  '[data-tq-exp="hero-1"][data-tq-exp-variant="b"],[data-tq-exp="hero-1"][data-tq-exp-variant="b"] *{display:none!important}',
97
112
  ])
98
- // A later visit with a different coin keeps the stored arm.
99
- const again = runScript(['hero-1'], storage, 0.9)
100
- expect(again.assigned).toEqual({ 'hero-1': 'a' })
113
+ expect(storage).toEqual({})
101
114
 
102
115
  const other = runScript(['hero-1'], {}, 0.9)
103
116
  expect(other.assigned).toEqual({ 'hero-1': 'b' })
104
117
  expect(other.styles[0]).toContain('[data-tq-exp-variant="a"]')
105
118
  })
106
119
 
120
+ it('without consent, removes an arm an earlier build stored instead of reading it', () => {
121
+ const storage: Record<string, string> = { 'tq_exp:hero-1': 'b', cookieConsent: 'declined' }
122
+ expect(runScript(['hero-1'], storage, 0.2).assigned).toEqual({ 'hero-1': 'a' })
123
+ expect(storage).toEqual({ cookieConsent: 'declined' })
124
+ })
125
+
126
+ it('stores the arm the visitor is seeing once they accept on this page, and keeps it after', () => {
127
+ const storage: Record<string, string> = {}
128
+ const page = runScript(['hero-1'], storage, 0.9)
129
+ expect(page.assigned).toEqual({ 'hero-1': 'b' })
130
+ expect(storage['tq_exp:hero-1']).toBeUndefined()
131
+
132
+ page.accept()
133
+ expect(storage['tq_exp:hero-1']).toBe('b')
134
+ // The next page load keeps the version they saw, whatever the coin says.
135
+ expect(runScript(['hero-1'], storage, 0.2).assigned).toEqual({ 'hero-1': 'b' })
136
+ })
137
+
138
+ it('with consent, flips a coin once, stores the arm and reuses it', () => {
139
+ const storage: Record<string, string> = { cookieConsent: 'accepted' }
140
+ expect(runScript(['hero-1'], storage, 0.2).assigned).toEqual({ 'hero-1': 'a' })
141
+ expect(storage['tq_exp:hero-1']).toBe('a')
142
+ expect(runScript(['hero-1'], storage, 0.9).assigned).toEqual({ 'hero-1': 'a' })
143
+ })
144
+
107
145
  it('derives the arm from the visitor id with consent — stable per visitor, not per site', () => {
108
146
  const consented = { cookieConsent: 'accepted', tp_aid: 'visitor-123' }
109
147
  const one = runScript(['hero-1', 'cta-2'], { ...consented }, 0.1)
@@ -126,6 +164,7 @@ describe('experiments — the head script', () => {
126
164
  throw new Error('blocked')
127
165
  },
128
166
  },
167
+ addEventListener: () => undefined,
129
168
  } as any
130
169
  const fakeDocument = {
131
170
  createElement: () => ({ textContent: '' }),
@@ -24,12 +24,14 @@ function memoryStorage() {
24
24
  }
25
25
  }
26
26
 
27
- function bootTracker() {
27
+ function bootTracker(options: { experiments?: Record<string, string> } = {}) {
28
28
  const localStorage = memoryStorage()
29
29
  const sessionStorage = memoryStorage()
30
30
  const batches: Sent[][] = []
31
31
  const heartbeats: Sent[] = []
32
32
  const documentListeners: Record<string, () => void> = {}
33
+ // The A/B tests whose element is on the current page.
34
+ let experimentsOnPage: string[] = []
33
35
 
34
36
  const fakeDocument = {
35
37
  visibilityState: 'visible',
@@ -38,7 +40,8 @@ function bootTracker() {
38
40
  addEventListener: (type: string, listener: () => void) => {
39
41
  documentListeners[type] = listener
40
42
  },
41
- querySelector: () => null,
43
+ querySelector: (selector: string) =>
44
+ experimentsOnPage.some((id) => selector === `[data-tq-exp="${id}"]`) ? {} : null,
42
45
  }
43
46
  const fakeWindow = {
44
47
  location: { hostname: 'shop.example.com', pathname: '/', search: '' },
@@ -48,6 +51,7 @@ function bootTracker() {
48
51
  innerHeight: 900,
49
52
  scrollY: 0,
50
53
  addEventListener: () => undefined,
54
+ __tpExp: options.experiments,
51
55
  }
52
56
  const fakeFetch = (url: string, init: { body: string }) => {
53
57
  const payload = JSON.parse(init.body)
@@ -94,12 +98,25 @@ function bootTracker() {
94
98
  fakeDocument.visibilityState = 'visible'
95
99
  documentListeners.visibilitychange()
96
100
  }
97
- const navigate = (path: string) => {
101
+ const navigate = (path: string, experiments: string[] = []) => {
98
102
  fakeWindow.location.pathname = path
103
+ experimentsOnPage = experiments
99
104
  tracker.trackRouteChange(path)
100
105
  }
106
+ const showExperiments = (experiments: string[]) => {
107
+ experimentsOnPage = experiments
108
+ }
101
109
 
102
- return { tracker, localStorage, sessionStorage, heartbeats, flush, show, navigate }
110
+ return {
111
+ tracker,
112
+ localStorage,
113
+ sessionStorage,
114
+ heartbeats,
115
+ flush,
116
+ show,
117
+ navigate,
118
+ showExperiments,
119
+ }
103
120
  }
104
121
 
105
122
  describe('tracker — consent given or withdrawn mid-visit', () => {
@@ -163,3 +180,55 @@ describe('tracker — consent given or withdrawn mid-visit', () => {
163
180
  expect(next.sessionId).not.toBe(landing.sessionId)
164
181
  })
165
182
  })
183
+
184
+ describe('tracker — the A/B test versions a visitor has seen', () => {
185
+ const SEEN_KEY = 'tq_exp_seen'
186
+
187
+ it('keeps them in memory until the banner is accepted, then stores them', () => {
188
+ const page = bootTracker({ experiments: { 'hero-1': 'b' } })
189
+ page.showExperiments(['hero-1'])
190
+ page.tracker.initTeleportAnalytics({})
191
+ const [landing] = page.flush()
192
+
193
+ expect(landing.exp).toBe('hero-1:b')
194
+ expect(page.localStorage.getItem(SEEN_KEY)).toBeNull()
195
+
196
+ // A page without the test still counts for the version that led there.
197
+ page.navigate('/checkout')
198
+ const [checkout] = page.flush()
199
+ expect(checkout.exp).toBe('hero-1:b')
200
+ expect(page.localStorage.getItem(SEEN_KEY)).toBeNull()
201
+
202
+ page.localStorage.setItem('cookieConsent', 'accepted')
203
+ page.navigate('/thanks')
204
+ const [thanks] = page.flush()
205
+ expect(thanks.exp).toBe('hero-1:b')
206
+ expect(JSON.parse(page.localStorage.getItem(SEEN_KEY) as string)).toEqual({ 'hero-1': 'b' })
207
+ })
208
+
209
+ it('removes the versions an earlier build stored for a visitor who has not accepted', () => {
210
+ const page = bootTracker({ experiments: { 'hero-1': 'a' } })
211
+ page.localStorage.setItem(SEEN_KEY, JSON.stringify({ 'cta-2': 'b' }))
212
+ page.showExperiments(['hero-1'])
213
+ page.tracker.initTeleportAnalytics({})
214
+ const [landing] = page.flush()
215
+
216
+ expect(landing.exp).toBe('hero-1:a')
217
+ expect(page.localStorage.getItem(SEEN_KEY)).toBeNull()
218
+ })
219
+
220
+ it('reads and stores them as before for a visitor who accepted earlier', () => {
221
+ const page = bootTracker({ experiments: { 'hero-1': 'a', 'cta-2': 'b' } })
222
+ page.localStorage.setItem('cookieConsent', 'accepted')
223
+ page.localStorage.setItem(SEEN_KEY, JSON.stringify({ 'cta-2': 'b' }))
224
+ page.showExperiments(['hero-1'])
225
+ page.tracker.initTeleportAnalytics({})
226
+ const [landing] = page.flush()
227
+
228
+ expect(landing.exp).toBe('hero-1:a,cta-2:b')
229
+ expect(JSON.parse(page.localStorage.getItem(SEEN_KEY) as string)).toEqual({
230
+ 'hero-1': 'a',
231
+ 'cta-2': 'b',
232
+ })
233
+ })
234
+ })
@@ -352,18 +352,18 @@ describe('the live sitemap', () => {
352
352
  expect(res.body).toContain('<lastmod>2026-01-02T00:00:00.000Z</lastmod>')
353
353
  expect(res.body).not.toContain('xhtml')
354
354
 
355
- // Published rows only, newest first with the id as tiebreak, a page at a time.
355
+ // Published rows only, newest first, a page at a time. ONE sort: a visitor
356
+ // read with more than one is refused, which left every sitemap without posts
357
+ // ("The posts could not be read: Invalid sorts" on the published store).
356
358
  expect(calls[0]).toMatchObject({
357
359
  limit: SITE_INDEX_PAGE_SIZE,
358
360
  offset: 0,
359
361
  filters: JSON.stringify([
360
362
  { type: 'condition', source: 'status', destination: 'published', operand: '=' },
361
363
  ]),
362
- sorts: JSON.stringify([
363
- { field: 'created_at', order: 'desc' },
364
- { field: 'id', order: 'asc' },
365
- ]),
364
+ sorts: JSON.stringify([{ field: 'created_at', order: 'desc' }]),
366
365
  })
366
+ expect(JSON.parse(calls[0].sorts as string)).toHaveLength(1)
367
367
  })
368
368
 
369
369
  it('reads page after page until one comes back short, listing a post once', async () => {
@@ -371,4 +371,61 @@ describe('NextItemComparisonProjectPlugin', () => {
371
371
  expect(priceCell({ price: 5 }).text).toBe('5.00')
372
372
  })
373
373
  })
374
+
375
+ describe('a bookable item’s price', () => {
376
+ // A `teleport_booking_items` row: a price, no currency column.
377
+ const ROOM = { price: '80.00' }
378
+
379
+ const bookingRouteWith = async (data?: Record<string, unknown>) => {
380
+ const structure = makeStructure(
381
+ { settings: { kinds: ['products', 'bookingItems'] }, ...(data ? { data } : {}) },
382
+ { store: true, bookings: true }
383
+ )
384
+ await new NextItemComparisonProjectPlugin().runAfter(structure)
385
+ return routeCells(structure.files.get('item-comparison-route').files[0].content as string)
386
+ }
387
+
388
+ it('is quoted in the bookings’ currency, the way the editor’s comparison prints it', async () => {
389
+ const { cell } = await bookingRouteWith({
390
+ priceSymbolSide: 'before',
391
+ bookingPrice: { symbol: '€', side: 'before' },
392
+ })
393
+ expect(cell('bookingItems', 'price', ROOM)).toEqual({ text: '€ 80.00', number: 80 })
394
+ })
395
+
396
+ it('writes the symbol on the side the editor says for the bookings’ currency', async () => {
397
+ const { cell } = await bookingRouteWith({ bookingPrice: { symbol: 'lei', side: 'after' } })
398
+ expect(cell('bookingItems', 'price', ROOM)).toEqual({ text: '80.00 lei', number: 80 })
399
+ })
400
+
401
+ it('leaves a product’s price exactly as before', async () => {
402
+ const { cell } = await bookingRouteWith({
403
+ priceSymbolSide: 'before',
404
+ bookingPrice: { symbol: 'lei', side: 'after' },
405
+ })
406
+ expect(cell('products', 'price', FLAT_PRODUCT)).toEqual({ text: 'lei 149.00', number: 149 })
407
+ expect(cell('products', 'price', { price: 5 })).toEqual({ text: '5.00', number: 5 })
408
+ })
409
+
410
+ it('stays a bare amount for a project exported before the editor sent the currency', async () => {
411
+ const { cell } = await bookingRouteWith({ priceSymbolSide: 'before' })
412
+ expect(cell('bookingItems', 'price', ROOM)).toEqual({ text: '80.00', number: 80 })
413
+ })
414
+
415
+ it('ignores a currency the editor did not send in a usable shape', () => {
416
+ const config = (bookingPrice: unknown) =>
417
+ resolveItemComparisonConfig(
418
+ makeStructure(
419
+ { settings: { kinds: ['bookingItems'] }, data: { bookingPrice } },
420
+ { bookings: true }
421
+ ).uidl
422
+ )!.bookingPrice
423
+ expect(config({ symbol: ' € ', side: 'after' })).toEqual({ symbol: '€', side: 'after' })
424
+ expect(config({ symbol: '€', side: 'sideways' })).toEqual({ symbol: '€', side: 'before' })
425
+ expect(config({ symbol: '' })).toBeNull()
426
+ expect(config({ symbol: 'A'.repeat(11) })).toBeNull()
427
+ expect(config('EUR')).toBeNull()
428
+ expect(config(undefined)).toBeNull()
429
+ })
430
+ })
374
431
  })
@@ -0,0 +1,239 @@
1
+ import { ProjectPluginStructure } from '@teleporthq/teleport-types'
2
+ import { buildGateHeadSnippet } from '../src/access-rules/gate-runtime-source'
3
+ import { AccessRulesSettings } from '../src/access-rules/settings'
4
+ import { StaticExportProjectPlugin } from '../src/static-export/project-plugin'
5
+
6
+ /**
7
+ * A download other than the Next.js app runs no workflows: its age gate is
8
+ * driven by the gate's head snippet alone (the style hides it, the snippet
9
+ * answers its controls by their marks), and its popups are left out.
10
+ */
11
+
12
+ const SETTINGS: AccessRulesSettings = {
13
+ ageGateEnabled: true,
14
+ minimumAge: 18,
15
+ ageGateMode: 'confirm',
16
+ ageGateScope: 'site',
17
+ rememberDays: 30,
18
+ allowCrawlers: true,
19
+ geoMode: 'off',
20
+ geoCountries: [],
21
+ geoUnknownCountry: 'allow',
22
+ }
23
+ const RUNTIME = { gatedPaths: [] as string[], unavailablePaths: ['/unavailable'] }
24
+
25
+ /** A control the visitor clicks: itself for the marks it carries, the gate around it. */
26
+ const control = (marks: string[], gate: unknown) => {
27
+ const element = {
28
+ closest: (selector: string): unknown =>
29
+ selector === '[data-tq-age-gate]'
30
+ ? gate
31
+ : marks.some((mark) => selector === `[${mark}]`)
32
+ ? element
33
+ : null,
34
+ }
35
+ return element
36
+ }
37
+
38
+ function openPage(pathname: string, settings = SETTINGS, runtime = RUNTIME) {
39
+ const attributes: Record<string, string> = {}
40
+ let click: (event: { target: unknown }) => void = () => undefined
41
+ const fakeDocument = {
42
+ cookie: '',
43
+ readyState: 'complete',
44
+ documentElement: {
45
+ setAttribute: (name: string, value: string) => {
46
+ attributes[name] = value
47
+ },
48
+ },
49
+ head: { appendChild: () => undefined },
50
+ body: { querySelector: () => ({}) },
51
+ querySelector: () => null,
52
+ createElement: () => ({ setAttribute: () => undefined }),
53
+ addEventListener: (type: string, listener: (event: { target: unknown }) => void) => {
54
+ if (type === 'click') {
55
+ click = listener
56
+ }
57
+ },
58
+ }
59
+ const told: string[] = []
60
+ const fakeWindow = {
61
+ addEventListener: () => undefined,
62
+ dispatchEvent: (event: { type: string }) => told.push(event.type),
63
+ }
64
+ const snippet = buildGateHeadSnippet(settings, runtime, { withoutWorkflows: true })
65
+ const script = snippet.slice(snippet.indexOf('<script>') + 8, snippet.lastIndexOf('</script>'))
66
+ new Function('window', 'document', 'location', 'history', 'CustomEvent', script)(
67
+ fakeWindow,
68
+ fakeDocument,
69
+ { pathname, protocol: 'https:' },
70
+ { pushState: () => undefined, replaceState: () => undefined },
71
+ function CustomEvent(this: { type: string }, type: string) {
72
+ this.type = type
73
+ }
74
+ )
75
+ return {
76
+ gate: () => attributes['data-tq-age-gate'],
77
+ cookie: () => fakeDocument.cookie,
78
+ click: (target: unknown) => click({ target }),
79
+ told,
80
+ }
81
+ }
82
+
83
+ describe('the age gate in a download that runs no workflows', () => {
84
+ it('lets the visitor in when they press the confirm button, and remembers it', () => {
85
+ const page = openPage('/index.html')
86
+ expect(page.gate()).toBe('open')
87
+
88
+ page.click(control(['data-tq-age-gate-confirm'], null))
89
+ expect(page.gate()).toBe('hidden')
90
+ expect(page.cookie()).toBe('tq_age_ok=18; Path=/; SameSite=Lax; Max-Age=2592000; Secure')
91
+ // Nothing waits for a component that listens for no event here.
92
+ expect(page.told).toEqual([])
93
+ })
94
+
95
+ it('checks a date of birth: an adult goes in, a minor is shown the gate’s error', () => {
96
+ const removed: string[] = []
97
+ const birthGate = (value: string) => ({
98
+ querySelector: (selector: string) =>
99
+ selector === '[data-tq-age-gate-birthdate]'
100
+ ? { value }
101
+ : selector === '[data-tq-age-gate-error]'
102
+ ? { removeAttribute: (name: string) => removed.push(name) }
103
+ : null,
104
+ })
105
+ const page = openPage('/', { ...SETTINGS, ageGateMode: 'birthdate' })
106
+
107
+ page.click(control(['data-tq-age-gate-submit'], birthGate('2020-05-01')))
108
+ expect(page.gate()).toBe('open')
109
+ expect(removed).toEqual(['hidden'])
110
+
111
+ page.click(control(['data-tq-age-gate-submit'], birthGate('1990-05-01')))
112
+ expect(page.gate()).toBe('hidden')
113
+ })
114
+
115
+ it('reads an HTML page’s file name as its path', () => {
116
+ const scoped = { ...SETTINGS, ageGateScope: 'pages' as const }
117
+ const shop = { ...RUNTIME, gatedPaths: ['/shop'] }
118
+ expect(openPage('/shop.html', scoped, shop).gate()).toBe('open')
119
+ expect(openPage('/index.html', scoped, shop).gate()).toBe('hidden')
120
+ expect(openPage('/unavailable.html').gate()).toBe('hidden')
121
+ })
122
+
123
+ it('leaves the published site’s script exactly as it was', () => {
124
+ const published = buildGateHeadSnippet(SETTINGS, RUNTIME)
125
+ expect(published).toBe(buildGateHeadSnippet(SETTINGS, RUNTIME, { withoutWorkflows: false }))
126
+ expect(published).not.toContain('data-tq-age-gate-confirm')
127
+ expect(published).not.toContain('.html')
128
+ expect(published).toContain('if (++tries < 40) setTimeout(tick, 250);')
129
+ })
130
+ })
131
+
132
+ describe('StaticExportProjectPlugin', () => {
133
+ const s = (content: unknown) => ({ type: 'static', content })
134
+ const instance = (name: string) => ({
135
+ type: 'element',
136
+ content: { elementType: 'component', semanticType: name, dependency: { type: 'local' } },
137
+ })
138
+ const structureWith = (extra: Record<string, unknown>) =>
139
+ ({
140
+ uidl: {
141
+ name: 'p',
142
+ globals: { settings: { title: 'P', language: 'en' }, assets: [] },
143
+ root: {
144
+ name: 'App',
145
+ node: {
146
+ type: 'element',
147
+ content: {
148
+ elementType: 'container',
149
+ children: [
150
+ instance('Hero'),
151
+ instance('WelcomePopup'),
152
+ {
153
+ type: 'conditional',
154
+ content: {
155
+ node: instance('WelcomePopup'),
156
+ reference: { type: 'dynamic', content: { referenceType: 'state', id: 'x' } },
157
+ value: true,
158
+ },
159
+ },
160
+ { type: 'element', content: { elementType: 'text', children: [s('Hi')] } },
161
+ ],
162
+ },
163
+ },
164
+ },
165
+ components: {
166
+ WelcomePopup: {
167
+ name: 'WelcomePopup',
168
+ node: { type: 'element', content: { elementType: 'container', children: [] } },
169
+ },
170
+ },
171
+ ...extra,
172
+ },
173
+ files: new Map(),
174
+ dependencies: {},
175
+ devDependencies: {},
176
+ template: { files: [], subFolders: [] },
177
+ } as unknown as ProjectPluginStructure)
178
+
179
+ it('leaves out the popups and keeps everything else', async () => {
180
+ const structure = structureWith({
181
+ popups: { popups: [{ id: 'p1', componentName: 'WelcomePopup' }], excludedPaths: [] },
182
+ })
183
+ await new StaticExportProjectPlugin().runBefore(structure)
184
+ const children = (structure.uidl.root.node.content as { children: unknown[] }).children
185
+ expect(children).toEqual([
186
+ instance('Hero'),
187
+ { type: 'element', content: { elementType: 'text', children: [s('Hi')] } },
188
+ ])
189
+ expect(structure.uidl.globals.customCode).toBeUndefined()
190
+ })
191
+
192
+ it('puts the gate’s snippet for downloads first in the head', async () => {
193
+ const structure = structureWith({
194
+ plugins: {
195
+ accessRules: {
196
+ settings: { ageGateEnabled: true },
197
+ data: { gate: 'component', gatedPaths: [] },
198
+ },
199
+ },
200
+ })
201
+ structure.uidl.globals.customCode = { head: '<meta name="x">' }
202
+ await new StaticExportProjectPlugin().runBefore(structure)
203
+ const head = structure.uidl.globals.customCode.head
204
+ expect(head.startsWith('<style>html[data-tq-age-gate="hidden"]')).toBe(true)
205
+ expect(head).toContain('"confirm":"data-tq-age-gate-confirm"')
206
+ expect(head.endsWith('<meta name="x">')).toBe(true)
207
+ })
208
+
209
+ it('keeps an A/B test’s original and leaves out its variation', async () => {
210
+ const version = (id: string, variant: string, label: string) => ({
211
+ type: 'element',
212
+ content: {
213
+ elementType: 'container',
214
+ attrs: { 'data-tq-exp': s(id), 'data-tq-exp-variant': s(variant) },
215
+ children: [s(label)],
216
+ },
217
+ })
218
+ const structure = structureWith({})
219
+ const page = structure.uidl.root.node.content as { children: unknown[] }
220
+ page.children = [
221
+ version('hero-1', 'a', 'Original'),
222
+ version('hero-1', 'b', 'Variation'),
223
+ // Not an id the generator acts on: left as it is.
224
+ version('NOT AN ID', 'b', 'Unmarked'),
225
+ ]
226
+ await new StaticExportProjectPlugin().runBefore(structure)
227
+ expect(page.children).toEqual([
228
+ version('hero-1', 'a', 'Original'),
229
+ version('NOT AN ID', 'b', 'Unmarked'),
230
+ ])
231
+ })
232
+
233
+ it('changes nothing in a project with none of them', async () => {
234
+ const structure = structureWith({})
235
+ const before = JSON.stringify(structure.uidl)
236
+ await new StaticExportProjectPlugin().runBefore(structure)
237
+ expect(JSON.stringify(structure.uidl)).toBe(before)
238
+ })
239
+ })
@@ -1,4 +1,13 @@
1
1
  import { AccessRulesSettings } from './settings';
2
+ export interface GateHeadSnippetOptions {
3
+ /**
4
+ * For a download that runs none of the project's workflows (HTML, React,
5
+ * Vue, Nuxt, Angular): the snippet answers the gate's controls itself, by
6
+ * their marks, and the style alone hides the gate — nothing tells the
7
+ * component to close. A page's `.html` is read as its path.
8
+ */
9
+ withoutWorkflows?: boolean;
10
+ }
2
11
  /**
3
12
  * The age gate's head snippet, for a project whose gate is the editor's Age
4
13
  * Gate component: drawn open on every published page, so a visitor who must
@@ -18,5 +27,5 @@ import { AccessRulesSettings } from './settings';
18
27
  export declare const buildGateHeadSnippet: (settings: AccessRulesSettings, runtime: {
19
28
  gatedPaths: string[];
20
29
  unavailablePaths: string[];
21
- }) => string;
30
+ }, options?: GateHeadSnippetOptions) => string;
22
31
  //# sourceMappingURL=gate-runtime-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gate-runtime-source.d.ts","sourceRoot":"","sources":["../../../src/access-rules/gate-runtime-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAahD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,aACrB,mBAAmB,WACpB;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAAE,KAC5D,MAmIF,CAAA"}
1
+ {"version":3,"file":"gate-runtime-source.d.ts","sourceRoot":"","sources":["../../../src/access-rules/gate-runtime-source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAqBhD,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,aACrB,mBAAmB,WACpB;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAAE,YACpD,sBAAsB,KAC9B,MA0KF,CAAA"}
@@ -12,6 +12,13 @@ var EVENTS = {
12
12
  open: 'tq-age-gate-open',
13
13
  tooYoung: 'tq-age-gate-too-young',
14
14
  };
15
+ /** The editor's marks on the gate's own controls (`access-rules-markers.ts` there). */
16
+ var CONTROLS = {
17
+ confirm: 'data-tq-age-gate-confirm',
18
+ birthdate: 'data-tq-age-gate-birthdate',
19
+ submit: 'data-tq-age-gate-submit',
20
+ error: 'data-tq-age-gate-error',
21
+ };
15
22
  /**
16
23
  * The age gate's head snippet, for a project whose gate is the editor's Age
17
24
  * Gate component: drawn open on every published page, so a visitor who must
@@ -28,7 +35,18 @@ var EVENTS = {
28
35
  *
29
36
  * ⛔ Shipped inside a `<script>` in the head: no closing-tag sequence in it.
30
37
  */
31
- var buildGateHeadSnippet = function (settings, runtime) {
38
+ var buildGateHeadSnippet = function (settings, runtime, options) {
39
+ if (options === void 0) { options = {}; }
40
+ var _a = options.withoutWorkflows, withoutWorkflows = _a === void 0 ? false : _a;
41
+ var staticPath = withoutWorkflows
42
+ ? "\n p = p.replace(/\\/index\\.html$/, '/').replace(/\\.html$/, '');"
43
+ : '';
44
+ var settleBody = withoutWorkflows
45
+ ? "\n return;"
46
+ : "\n var tries = 0;\n (function tick() {\n var shown = !!(document.body && document.body.querySelector(ROOT));\n if (shown === open) return;\n tell(open ? EVENTS.open : EVENTS.close);\n if (++tries < 40) setTimeout(tick, 250);\n })();";
47
+ var controls = withoutWorkflows
48
+ ? "\n // No workflow runs here: the gate's own controls are answered by their marks.\n var CONTROLS = ".concat((0, source_literals_1.toJsLiteral)(CONTROLS), ";\n function control(event, mark) {\n var target = event.target;\n return target && target.closest ? target.closest('[' + mark + ']') : null;\n }\n document.addEventListener('click', function (event) {\n if (control(event, CONTROLS.confirm)) {\n confirmed();\n return;\n }\n var submit = control(event, CONTROLS.submit);\n if (!submit) return;\n var gate = submit.closest(ROOT) || document;\n var field = gate.querySelector('[' + CONTROLS.birthdate + ']');\n var text = field && typeof field.value === 'string' ? field.value : '';\n if (!text) {\n if (field && field.reportValidity) field.reportValidity();\n return;\n }\n if (years(text) >= S.minimumAge) {\n confirmed();\n return;\n }\n var error = gate.querySelector('[' + CONTROLS.error + ']');\n if (error) error.removeAttribute('hidden');\n });")
49
+ : '';
32
50
  var client = {
33
51
  enabled: settings.ageGateEnabled,
34
52
  minimumAge: settings.minimumAge,
@@ -40,7 +58,7 @@ var buildGateHeadSnippet = function (settings, runtime) {
40
58
  noindex: !settings.allowCrawlers,
41
59
  };
42
60
  var style = "html[".concat(ROOT_ATTR, "=\"hidden\"] [").concat(ROOT_ATTR, "]{display:none!important}html[").concat(ROOT_ATTR, "=\"open\"]{overflow:hidden}");
43
- var script = "(function () {\n var S = ".concat((0, source_literals_1.toJsLiteral)(client), ";\n var COOKIE = ").concat((0, source_literals_1.toJsLiteral)(constants_1.AGE_COOKIE), ";\n var ATTR = ").concat((0, source_literals_1.toJsLiteral)(ROOT_ATTR), ";\n var ROOT = '[' + ATTR + ']';\n var PREFIX = 'workflow:custom:';\n var EVENTS = ").concat((0, source_literals_1.toJsLiteral)(EVENTS), ";\n var html = document.documentElement;\n function cookie() {\n var parts = document.cookie ? document.cookie.split('; ') : [];\n for (var i = 0; i < parts.length; i++) {\n var eq = parts[i].indexOf('=');\n if (eq > 0 && parts[i].slice(0, eq) === COOKIE) {\n try { return decodeURIComponent(parts[i].slice(eq + 1)); } catch (e) { return ''; }\n }\n }\n return '';\n }\n function remember() {\n var value = COOKIE + '=' + encodeURIComponent(String(S.minimumAge)) + '; Path=/; SameSite=Lax';\n if (S.rememberSeconds > 0) value += '; Max-Age=' + S.rememberSeconds;\n if (location.protocol === 'https:') value += '; Secure';\n document.cookie = value;\n }\n function path() {\n var p = location.pathname;\n return p.length > 1 ? p.replace(/\\/+$/, '').toLowerCase() : p;\n }\n function matches(p, patterns) {\n for (var i = 0; i < patterns.length; i++) {\n var pattern = patterns[i];\n if (pattern.slice(-2) === '/*') {\n var base = pattern.slice(0, -2) || '/';\n if (p === base || p.indexOf(base === '/' ? '/' : base + '/') === 0) return true;\n } else if (pattern.slice(-1) === '*') {\n if (p.indexOf(pattern.slice(0, -1)) === 0) return true;\n } else if (p === pattern) {\n return true;\n }\n }\n return false;\n }\n function gated(p) {\n if (!S.enabled || matches(p, S.ungated)) return false;\n return S.scope !== 'pages' || matches(p, S.pages);\n }\n function wanted() {\n return gated(path()) && cookie() !== String(S.minimumAge);\n }\n function tell(name, detail) {\n try {\n window.dispatchEvent(new CustomEvent(PREFIX + name, { detail: detail || {} }));\n } catch (e) {}\n }\n // The component answers only once hydrated: ask until the gate matches.\n // Looked for inside the body: <html> carries the same attribute as its mark.\n function settle(open) {\n var tries = 0;\n (function tick() {\n var shown = !!(document.body && document.body.querySelector(ROOT));\n if (shown === open) return;\n tell(open ? EVENTS.open : EVENTS.close);\n if (++tries < 40) setTimeout(tick, 250);\n })();\n }\n function noindex() {\n if (!S.noindex || !gated(path()) || document.querySelector('meta[name=\"robots\"][' + ATTR + ']')) return;\n var meta = document.createElement('meta');\n meta.name = 'robots';\n meta.content = 'noindex, nofollow';\n meta.setAttribute(ATTR, '');\n document.head.appendChild(meta);\n }\n function apply() {\n var open = wanted();\n html.setAttribute(ATTR, open ? 'open' : 'hidden');\n settle(open);\n noindex();\n }\n function confirmed() {\n remember();\n html.setAttribute(ATTR, 'hidden');\n settle(false);\n }\n function years(text) {\n var birth = new Date(text + 'T00:00:00');\n if (isNaN(birth.getTime())) return -1;\n var now = new Date();\n var age = now.getFullYear() - birth.getFullYear();\n var early = now.getMonth() < birth.getMonth() || (now.getMonth() === birth.getMonth() && now.getDate() < birth.getDate());\n return early ? age - 1 : age;\n }\n window.addEventListener(PREFIX + EVENTS.confirm, confirmed);\n window.addEventListener(PREFIX + EVENTS.birthdate, function (event) {\n var detail = event && event.detail;\n var text = typeof detail === 'string' ? detail : detail && typeof detail.value === 'string' ? detail.value : '';\n if (!text) return;\n if (years(text) >= S.minimumAge) confirmed();\n else tell(EVENTS.tooYoung);\n });\n html.setAttribute(ATTR, wanted() ? 'open' : 'hidden');\n function onRoute() {\n setTimeout(apply, 0);\n }\n var push = history.pushState;\n var replace = history.replaceState;\n history.pushState = function () {\n push.apply(this, arguments);\n onRoute();\n };\n history.replaceState = function () {\n replace.apply(this, arguments);\n onRoute();\n };\n window.addEventListener('popstate', onRoute);\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', apply);\n else apply();\n})();");
61
+ var script = "(function () {\n var S = ".concat((0, source_literals_1.toJsLiteral)(client), ";\n var COOKIE = ").concat((0, source_literals_1.toJsLiteral)(constants_1.AGE_COOKIE), ";\n var ATTR = ").concat((0, source_literals_1.toJsLiteral)(ROOT_ATTR), ";\n var ROOT = '[' + ATTR + ']';\n var PREFIX = 'workflow:custom:';\n var EVENTS = ").concat((0, source_literals_1.toJsLiteral)(EVENTS), ";\n var html = document.documentElement;\n function cookie() {\n var parts = document.cookie ? document.cookie.split('; ') : [];\n for (var i = 0; i < parts.length; i++) {\n var eq = parts[i].indexOf('=');\n if (eq > 0 && parts[i].slice(0, eq) === COOKIE) {\n try { return decodeURIComponent(parts[i].slice(eq + 1)); } catch (e) { return ''; }\n }\n }\n return '';\n }\n function remember() {\n var value = COOKIE + '=' + encodeURIComponent(String(S.minimumAge)) + '; Path=/; SameSite=Lax';\n if (S.rememberSeconds > 0) value += '; Max-Age=' + S.rememberSeconds;\n if (location.protocol === 'https:') value += '; Secure';\n document.cookie = value;\n }\n function path() {\n var p = location.pathname;").concat(staticPath, "\n return p.length > 1 ? p.replace(/\\/+$/, '').toLowerCase() : p;\n }\n function matches(p, patterns) {\n for (var i = 0; i < patterns.length; i++) {\n var pattern = patterns[i];\n if (pattern.slice(-2) === '/*') {\n var base = pattern.slice(0, -2) || '/';\n if (p === base || p.indexOf(base === '/' ? '/' : base + '/') === 0) return true;\n } else if (pattern.slice(-1) === '*') {\n if (p.indexOf(pattern.slice(0, -1)) === 0) return true;\n } else if (p === pattern) {\n return true;\n }\n }\n return false;\n }\n function gated(p) {\n if (!S.enabled || matches(p, S.ungated)) return false;\n return S.scope !== 'pages' || matches(p, S.pages);\n }\n function wanted() {\n return gated(path()) && cookie() !== String(S.minimumAge);\n }\n function tell(name, detail) {\n try {\n window.dispatchEvent(new CustomEvent(PREFIX + name, { detail: detail || {} }));\n } catch (e) {}\n }\n // The component answers only once hydrated: ask until the gate matches.\n // Looked for inside the body: <html> carries the same attribute as its mark.\n function settle(open) {").concat(settleBody, "\n }\n function noindex() {\n if (!S.noindex || !gated(path()) || document.querySelector('meta[name=\"robots\"][' + ATTR + ']')) return;\n var meta = document.createElement('meta');\n meta.name = 'robots';\n meta.content = 'noindex, nofollow';\n meta.setAttribute(ATTR, '');\n document.head.appendChild(meta);\n }\n function apply() {\n var open = wanted();\n html.setAttribute(ATTR, open ? 'open' : 'hidden');\n settle(open);\n noindex();\n }\n function confirmed() {\n remember();\n html.setAttribute(ATTR, 'hidden');\n settle(false);\n }\n function years(text) {\n var birth = new Date(text + 'T00:00:00');\n if (isNaN(birth.getTime())) return -1;\n var now = new Date();\n var age = now.getFullYear() - birth.getFullYear();\n var early = now.getMonth() < birth.getMonth() || (now.getMonth() === birth.getMonth() && now.getDate() < birth.getDate());\n return early ? age - 1 : age;\n }\n window.addEventListener(PREFIX + EVENTS.confirm, confirmed);\n window.addEventListener(PREFIX + EVENTS.birthdate, function (event) {\n var detail = event && event.detail;\n var text = typeof detail === 'string' ? detail : detail && typeof detail.value === 'string' ? detail.value : '';\n if (!text) return;\n if (years(text) >= S.minimumAge) confirmed();\n else tell(EVENTS.tooYoung);\n });").concat(controls, "\n html.setAttribute(ATTR, wanted() ? 'open' : 'hidden');\n function onRoute() {\n setTimeout(apply, 0);\n }\n var push = history.pushState;\n var replace = history.replaceState;\n history.pushState = function () {\n push.apply(this, arguments);\n onRoute();\n };\n history.replaceState = function () {\n replace.apply(this, arguments);\n onRoute();\n };\n window.addEventListener('popstate', onRoute);\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', apply);\n else apply();\n})();");
44
62
  return "<style>".concat(style, "</style><script>").concat(script, "</script>");
45
63
  };
46
64
  exports.buildGateHeadSnippet = buildGateHeadSnippet;
@@ -1 +1 @@
1
- {"version":3,"file":"gate-runtime-source.js","sourceRoot":"","sources":["../../../src/access-rules/gate-runtime-source.ts"],"names":[],"mappings":";;;AAAA,0DAAoD;AAEpD,yCAAwC;AAExC,2GAA2G;AAC3G,IAAM,SAAS,GAAG,kBAAkB,CAAA;AACpC,IAAM,MAAM,GAAG;IACb,OAAO,EAAE,qBAAqB;IAC9B,SAAS,EAAE,uBAAuB;IAClC,KAAK,EAAE,mBAAmB;IAC1B,IAAI,EAAE,k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