create-disposabl-app 0.15.0 → 0.16.0

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 (90) hide show
  1. package/README.md +15 -1
  2. package/dist/disposabl.js +357 -50
  3. package/dist/index.js +8973 -154
  4. package/dist/templates/default/apps/desktop/forge.config.mts +2 -1
  5. package/dist/templates/default/apps/docs/content/getting-started.mdx +1 -1
  6. package/dist/templates/default/apps/mobile/package.json +1 -0
  7. package/dist/templates/default/apps/web/eslint.config.ts +5 -1
  8. package/dist/templates/default/apps/web/public/disposabl-logo-light.svg +8 -0
  9. package/dist/templates/default/apps/web/public/landing/coast.jpg +0 -0
  10. package/dist/templates/default/apps/web/public/landing/community.jpg +0 -0
  11. package/dist/templates/default/apps/web/public/landing/stores/app-store.svg +46 -0
  12. package/dist/templates/default/apps/web/public/landing/stores/google-play.png +0 -0
  13. package/dist/templates/default/apps/web/public/landing/taste/LICENSE +21 -0
  14. package/dist/templates/default/apps/web/public/landing/taste/init.js +3 -0
  15. package/dist/templates/default/apps/web/public/landing/taste/moments/lib.js +189 -0
  16. package/dist/templates/default/apps/web/public/landing/taste/moments/moments.js +109 -0
  17. package/dist/templates/default/apps/web/public/landing/taste/moments/word-highlight/moment.css +8 -0
  18. package/dist/templates/default/apps/web/public/landing/taste/moments/word-highlight/moment.js +35 -0
  19. package/dist/templates/default/apps/web/public/landing/taste/motion/motion.css +321 -0
  20. package/dist/templates/default/apps/web/public/landing/taste/motion/motion.js +406 -0
  21. package/dist/templates/default/apps/web/routes.config.ts +14 -0
  22. package/dist/templates/default/apps/web/src/router/__root.tsx +8 -2
  23. package/dist/templates/default/apps/web/tsr.config.json +1 -1
  24. package/dist/templates/default/apps/web/vite.config.ts +10 -2
  25. package/dist/templates/default/bun.lock +6 -0
  26. package/dist/templates/default/bunfig.toml +1 -0
  27. package/dist/templates/default/disposabl.json +1 -1
  28. package/dist/templates/default/packages/backend/convex/authSetup.ts +2 -5
  29. package/dist/templates/default/packages/backend/convex/billing.ts +5 -0
  30. package/dist/templates/default/packages/backend/convex/billingHandoff.ts +6 -0
  31. package/dist/templates/default/packages/backend/convex/convex.config.ts +8 -0
  32. package/dist/templates/default/packages/backend/convex/http.ts +6 -0
  33. package/dist/templates/default/packages/backend/convex/revenuecat.ts +13 -0
  34. package/dist/templates/default/packages/backend/convex/schema.ts +44 -0
  35. package/dist/templates/default/packages/backend/convex/telemetry.ts +41 -5
  36. package/dist/templates/default/packages/backend/generate.ts +6 -0
  37. package/dist/templates/default/packages/cli/auth.ts +36 -3
  38. package/dist/templates/default/packages/cli/build.ts +6 -0
  39. package/dist/templates/default/packages/cli/client.ts +189 -19
  40. package/dist/templates/default/packages/cli/errors.ts +18 -0
  41. package/dist/templates/default/packages/cli/telemetry-build.ts +27 -0
  42. package/dist/templates/default/packages/cli/telemetry.ts +266 -0
  43. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +23 -5
  44. package/dist/templates/default/packages/disposabl-kit/client/lib/telemetry.ts +24 -2
  45. package/dist/templates/default/packages/disposabl-kit/client/lib/theme.ts +1 -0
  46. package/dist/templates/default/packages/disposabl-kit/client/routes/billing-login.tsx +92 -0
  47. package/dist/templates/default/packages/disposabl-kit/client/routes/pricing.tsx +113 -43
  48. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +13 -5
  49. package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +3 -2
  50. package/dist/templates/default/packages/disposabl-kit/lib/telemetry.ts +148 -12
  51. package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +143 -40
  52. package/dist/templates/default/packages/disposabl-kit/mobile/billing/paywall.ts +83 -0
  53. package/dist/templates/default/packages/disposabl-kit/mobile/billing/policy.ts +125 -0
  54. package/dist/templates/default/packages/disposabl-kit/mobile/billing/session.ts +31 -3
  55. package/dist/templates/default/packages/disposabl-kit/mobile/billing/topup.ts +99 -0
  56. package/dist/templates/default/packages/disposabl-kit/mobile/billing/use-topup.ts +116 -0
  57. package/dist/templates/default/packages/disposabl-kit/mobile/billing/web-checkout.ts +190 -0
  58. package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +9 -2
  59. package/dist/templates/default/packages/disposabl-kit/package.json +10 -1
  60. package/dist/templates/default/packages/disposabl-kit/payments/checkout-attempt.ts +64 -0
  61. package/dist/templates/default/packages/disposabl-kit/payments/config.ts +16 -3
  62. package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +218 -9
  63. package/dist/templates/default/packages/disposabl-kit/server/billing-handoff.ts +126 -0
  64. package/dist/templates/default/packages/disposabl-kit/server/billing-native-capability.ts +12 -0
  65. package/dist/templates/default/packages/disposabl-kit/server/billing-setup.ts +2 -0
  66. package/dist/templates/default/packages/disposabl-kit/server/billing.ts +31 -0
  67. package/dist/templates/default/packages/disposabl-kit/server/browser-session.ts +27 -0
  68. package/dist/templates/default/packages/disposabl-kit/server/lib/telemetry.ts +173 -59
  69. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-contract.ts +233 -0
  70. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-functions.ts +554 -0
  71. package/dist/templates/default/packages/disposabl-kit/server/revenuecat-validator.ts +76 -0
  72. package/dist/templates/default/packages/reconfigure-skill/SKILL.md +36 -0
  73. package/dist/templates/default/packages/sdk/README.md +21 -0
  74. package/dist/templates/default/packages/sdk/src/analytics.ts +102 -0
  75. package/dist/templates/default/packages/sdk/src/index.ts +2 -0
  76. package/dist/templates/default/packages/skill/SKILL.md +2 -0
  77. package/dist/templates/default/packages/skill/references/agent.md +2 -0
  78. package/dist/templates/default/packages/tests/billing-attempts.test.ts +156 -0
  79. package/dist/templates/default/packages/tests/billing-handoff.test.ts +116 -0
  80. package/dist/templates/default/packages/tests/billing-setup.test.ts +4 -3
  81. package/dist/templates/default/packages/tests/billing.test.ts +48 -4
  82. package/dist/templates/default/packages/tests/desktop-packaging.test.ts +12 -0
  83. package/dist/templates/default/packages/tests/flows/seo.e2e.ts +3 -1
  84. package/dist/templates/default/packages/tests/native-billing.test.ts +417 -0
  85. package/dist/templates/default/packages/tests/page-telemetry.test.ts +218 -0
  86. package/dist/templates/default/packages/tests/revenuecat-inbox.test.ts +476 -0
  87. package/dist/templates/default/packages/tests/sdk-analytics.test.ts +158 -0
  88. package/dist/templates/default/packages/tests/telemetry.test.ts +272 -55
  89. package/package.json +1 -1
  90. package/dist/templates/default/apps/web/src/routeTree.gen.ts +0 -578
@@ -0,0 +1,406 @@
1
+ /*
2
+ taste-skill motion.js - the moving half of the micro-interaction layer (motion.css is the rest).
3
+ Load it once, after system.js (motion.css needs no attribute; <html data-motion="off"> turns the layer off, JS too):
4
+ <script type="module" src="assets/motion/motion.js"></script>
5
+ It starts by itself. references/motion.md says what moves and how fast.
6
+
7
+ - the hero's entrance: .hero[data-enter] enters once on load (the h1 line by line, then the lead,
8
+ the buttons and the facts, the picture settling), about 1.1 s, when the head line set html.m-enter
9
+ before the first paint:
10
+ <script>document.documentElement.classList.add('m-enter');setTimeout(()=>document.documentElement.classList.add('m-enter-done'),700)</script>
11
+
12
+ - nav: .m-menu-open from the moment a menu starts to show (150ms of intent), so the next word swaps the panel at once
13
+ instead of waiting 150ms again; it stays while the pointer is on the word or its panel.
14
+ - tabs: every .tabs[role=tablist] gets one indicator that slides to the selected tab (system.js
15
+ still selects; this follows aria-selected).
16
+ - numbers: [data-m-count] on a stat ticks from 0 to its own text once, when 60% of it is on
17
+ screen (1.2 s, ease-out); prefix, suffix, decimals and thousands separators are kept. The
18
+ number's width is measured once the web fonts are in and again when it is first seen (a stat
19
+ in a hidden tab), so nothing beside it moves; a stat the observer never reports shows its own
20
+ text after 6 s on screen. A headless screenshot (HeadlessChrome) sees the final number unless
21
+ <html data-motion="live">.
22
+ - loops: [data-m-loop] marks a panel (or any box) whose CSS keyframe loops the page wrote itself;
23
+ they pause off screen, restart when the pointer enters the card around them, and get the
24
+ system's pause button (one per panel, shared with ui.js). ui.js restarts its own fragments.
25
+ - switches: a click on .m-switch flips aria-checked unless a handler before it called
26
+ preventDefault().
27
+ Under prefers-reduced-motion: no entrance, no indicator travel, no tick, no loops, no restart.
28
+ */
29
+ const html = document.documentElement;
30
+ const reducedQ = matchMedia('(prefers-reduced-motion: reduce)');
31
+ const reduced = () => reducedQ.matches;
32
+ const shot = () => /HeadlessChrome/.test(navigator.userAgent) && html.dataset.motion !== 'live';
33
+ const jump = (el, on) => { el.classList.toggle('is-jump', on); };
34
+
35
+ /* ---------------------------------------------------------------- nav */
36
+ function nav() {
37
+ const bar = document.querySelector('.nav');
38
+ const links = bar?.querySelector('.nav__links');
39
+ if (!links || bar.dataset.mNav) return;
40
+ bar.dataset.mNav = '1'; // no pill under the words (ST-08, ST-11): system.css draws their underline
41
+
42
+ // one menu open: the next word swaps the panel at once (figma.com); leaving the bar closes softly
43
+ let t = 0;
44
+ bar.querySelectorAll('.nav__item').forEach(item => {
45
+ const has = !!item.querySelector('.nav__menu');
46
+ item.addEventListener('pointerenter', () => {
47
+ clearTimeout(t);
48
+ // 150ms: the panel has started to show (motion.css lets it finish its own fade)
49
+ if (has) t = setTimeout(() => bar.classList.add('m-menu-open'), 150);
50
+ else bar.classList.remove('m-menu-open');
51
+ });
52
+ });
53
+ bar.addEventListener('pointerleave', () => { clearTimeout(t); bar.classList.remove('m-menu-open'); });
54
+ }
55
+
56
+ /* ---------------------------------------------------------------- tabs */
57
+ function tabs() {
58
+ document.querySelectorAll('.tabs[role="tablist"], [role="tablist"].m-tabs').forEach(list => {
59
+ if (!list.querySelector('[role="tab"]') || list.querySelector(':scope > .m-tab-ind')) return;
60
+ const ind = document.createElement('span');
61
+ ind.className = 'm-tab-ind';
62
+ ind.setAttribute('aria-hidden', 'true');
63
+ list.prepend(ind);
64
+ list.classList.add('m-has-ind');
65
+ let instant = true, at = null;
66
+ const set = (b, sx = 1, sy = 1) => {
67
+ ind.style.setProperty('--x', `${b.x}px`); ind.style.setProperty('--y', `${b.y}px`);
68
+ ind.style.setProperty('--w', `${b.w}px`); ind.style.setProperty('--h', `${b.h}px`);
69
+ ind.style.setProperty('--sx', String(sx)); ind.style.setProperty('--sy', String(sy));
70
+ };
71
+ // the pill travels by transform only: it takes the new tab's size at once, is drawn scaled to the
72
+ // old tab's size at the old place, and settles to scale 1 at the new place (motion.css)
73
+ const place = () => {
74
+ const sel = list.querySelector('[role="tab"][aria-selected="true"]');
75
+ if (!sel) { ind.style.opacity = '0'; return; }
76
+ ind.style.opacity = '';
77
+ const to = { x: sel.offsetLeft, y: sel.offsetTop, w: sel.offsetWidth, h: sel.offsetHeight };
78
+ if (instant || reduced() || !at || !to.w || !to.h) { jump(ind, true); set(to); ind.getBoundingClientRect(); jump(ind, false); }
79
+ else {
80
+ jump(ind, true);
81
+ set({ ...to, x: at.x, y: at.y }, at.w / to.w, at.h / to.h);
82
+ ind.getBoundingClientRect();
83
+ jump(ind, false);
84
+ set(to);
85
+ }
86
+ at = to;
87
+ instant = false;
88
+ };
89
+ place();
90
+ new MutationObserver(place).observe(list, { subtree: true, attributes: true, attributeFilter: ['aria-selected'] });
91
+ new ResizeObserver(() => { instant = true; place(); }).observe(list);
92
+ document.fonts?.ready.then(() => { instant = true; place(); });
93
+ });
94
+ }
95
+
96
+ /* ---------------------------------------------------------------- numbers */
97
+ // the first number in the element's text: "8,402", "4.2", "64%", "EUR 1.200", "12k"
98
+ // separators: . , and the no-break spaces (U+00A0, U+202F); a plain space ends the number ("12 4 h" is 12)
99
+ const NUM = /\d+(?:[.,\u00A0\u202F]\d+)*/;
100
+ function parse(text) {
101
+ const m = text.match(NUM);
102
+ if (!m) return null;
103
+ const raw = m[0];
104
+ const seps = raw.match(/[^\d]/g) || [];
105
+ let dec = '', group = '', decimals = 0;
106
+ const lastSep = raw.search(/[^\d](?=\d+$)/);
107
+ if (lastSep >= 0) {
108
+ const tail = raw.length - lastSep - 1;
109
+ // a last separator before exactly three digits groups thousands; otherwise it is the decimal point
110
+ if (tail === 3 && !(seps.length === 1 && raw[lastSep] === '.' && /^0/.test(raw))) group = raw[lastSep];
111
+ else { dec = raw[lastSep]; decimals = tail; group = seps.length > 1 ? seps[0] : ''; }
112
+ }
113
+ const intPart = dec ? raw.slice(0, lastSep) : raw;
114
+ const value = parseFloat(intPart.replace(/[^\d]/g, '') + (dec ? '.' + raw.slice(lastSep + 1) : ''));
115
+ return { index: m.index, raw, value, dec, group, decimals };
116
+ }
117
+ function format(v, p) {
118
+ let [i, d] = v.toFixed(p.decimals).split('.');
119
+ if (p.group) i = i.replace(/\B(?=(\d{3})+(?!\d))/g, p.group);
120
+ return d ? i + p.dec + d : i;
121
+ }
122
+ // the web fonts, or 3 s at most: a number measured in the fallback font comes out narrower
123
+ const fontsIn = () => Promise.race([document.fonts?.ready ?? Promise.resolve(), new Promise(r => setTimeout(r, 3000))]);
124
+ function counts() {
125
+ const els = [...document.querySelectorAll('[data-m-count]')].filter(el => !el.__mCount);
126
+ if (!els.length || reduced() || shot()) return;
127
+ const io = new IntersectionObserver(es => es.forEach(e => { if (e.isIntersecting) e.target.__mCount?.hit(); }), { threshold: 0.6 });
128
+ const ro = new ResizeObserver(es => es.forEach(e => e.target.__mCount?.arm()));
129
+ const items = [];
130
+ els.forEach(el => {
131
+ const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
132
+ let node, p;
133
+ while ((node = walk.nextNode()) && !(p = parse(node.data))) { /* next */ }
134
+ if (!node || !p) return;
135
+ // the number gets its own span, as wide as the final number and right-aligned, so nothing beside it
136
+ // moves. Until it is measured it shows its own text, never a 0
137
+ const after = node.splitText(p.index);
138
+ after.splitText(p.raw.length);
139
+ const span = document.createElement('span');
140
+ span.className = 'm-count__n';
141
+ span.style.display = 'inline-block';
142
+ span.style.textAlign = 'right';
143
+ span.textContent = p.raw;
144
+ after.replaceWith(span);
145
+ const ms = +el.dataset.mCount || 1200;
146
+ let state = 'wait', timer = 0; // wait (own text) -> armed (0, width held) -> run -> done
147
+ const stop = () => { clearTimeout(timer); io.unobserve(el); ro.unobserve(el); };
148
+ const onScreen = () => {
149
+ const r = span.getBoundingClientRect();
150
+ return r.width > 0 && r.bottom > 0 && r.top < innerHeight && r.right > 0 && r.left < innerWidth && document.visibilityState === 'visible';
151
+ };
152
+ // the safety net: a stat on screen for 6 s that the observer never reported shows its own text
153
+ const watch = () => {
154
+ clearTimeout(timer);
155
+ timer = setTimeout(() => {
156
+ if (state !== 'armed') return;
157
+ if (onScreen()) { state = 'done'; stop(); span.textContent = p.raw; } else watch();
158
+ }, 6000);
159
+ };
160
+ const ctl = {
161
+ /** measure the final number in the page's font and hold its width; false while it has none (hidden) */
162
+ arm() {
163
+ if (state === 'run' || state === 'done') return false;
164
+ span.textContent = p.raw;
165
+ span.style.minWidth = '';
166
+ const w = span.getBoundingClientRect().width;
167
+ if (!w) { state = 'wait'; clearTimeout(timer); return false; }
168
+ span.style.minWidth = `${w}px`;
169
+ span.textContent = format(0, p);
170
+ if (state !== 'armed') { state = 'armed'; watch(); }
171
+ return true;
172
+ },
173
+ /** print: stop waiting and show the written number */
174
+ show() { if (state === 'done') return; state = 'done'; stop(); span.textContent = p.raw; },
175
+ /** first seen: measure again (a font or a tab that changed since), then tick once */
176
+ hit() {
177
+ if (state === 'run' || state === 'done' || !ctl.arm()) return;
178
+ state = 'run';
179
+ stop();
180
+ const t0 = performance.now();
181
+ const step = now => {
182
+ const k = Math.min(1, (now - t0) / ms);
183
+ span.textContent = k < 1 ? format(p.value * (1 - Math.pow(1 - k, 4)), p) : p.raw;
184
+ if (k < 1) requestAnimationFrame(step); else state = 'done';
185
+ };
186
+ requestAnimationFrame(step);
187
+ },
188
+ };
189
+ el.__mCount = ctl;
190
+ items.push(el);
191
+ });
192
+ // measured only once the fonts are in; the resize observer measures again when a hidden stat shows
193
+ fontsIn().then(() => items.forEach(el => { el.__mCount.arm(); ro.observe(el); io.observe(el); }));
194
+ // a printed page never scrolls the stats into view: each prints its own number
195
+ addEventListener('beforeprint', () => items.forEach(el => el.__mCount.show()));
196
+ }
197
+
198
+ /* ---------------------------------------------------------------- loops inside cards */
199
+ const ICON_PAUSE = '<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="4.25" y="3.25" width="2.75" height="9.5" rx="0.9"/><rect x="9" y="3.25" width="2.75" height="9.5" rx="0.9"/></svg>';
200
+ const ICON_PLAY = '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.25 3.7v8.6c0 .62.68 1 1.2.66l6.5-4.3c.47-.31.47-1 0-1.32l-6.5-4.3c-.52-.34-1.2.04-1.2.66Z"/></svg>';
201
+ const boxOf = el => el.closest('[data-ui-pause-host], .panel__screen, .panel, .frame') || el;
202
+ const hostOf = el => el.closest('.card, .tile, .menu-card, a') || boxOf(el);
203
+
204
+ function restart(loop) {
205
+ if (reduced() || loop.classList.contains('is-m-paused')) return;
206
+ // the page's keyframe loops only: a hover transition in the panel (the pause button's) is no cycle.
207
+ // ui.js fragments in the card restart by themselves
208
+ const anims = loop.getAnimations({ subtree: true }).filter(a => typeof CSSAnimation === 'function' && a instanceof CSSAnimation);
209
+ if (!anims.length) return;
210
+ const dur = a => Number(a.effect?.getComputedTiming().duration) || 0;
211
+ const main = anims.reduce((m, a) => (dur(a) > dur(m) ? a : m));
212
+ const d = dur(main), t = Number(main.currentTime) || 0;
213
+ // restart only when the cycle is past its first quarter, so a quick in-and-out never stutters
214
+ if (!d || (t % d) / d > 0.25) anims.forEach(a => { a.currentTime = 0; });
215
+ }
216
+ function setPaused(box, paused) {
217
+ box.querySelectorAll('[data-m-loop]').forEach(l => l.classList.toggle('is-m-paused', paused));
218
+ if (box.matches('[data-m-loop]')) box.classList.toggle('is-m-paused', paused);
219
+ }
220
+ function pauseButton(loop) {
221
+ const box = boxOf(loop);
222
+ if (box.querySelector(':scope > .loop-pause')) return; // ui.js or the page put one there: it is shared
223
+ const btn = document.createElement('button');
224
+ btn.type = 'button';
225
+ btn.className = 'loop-pause m-own';
226
+ const show = paused => {
227
+ btn.innerHTML = paused ? ICON_PLAY : ICON_PAUSE;
228
+ btn.setAttribute('aria-label', `${paused ? 'Play' : 'Pause'} animation`);
229
+ btn.title = btn.getAttribute('aria-label');
230
+ btn.classList.toggle('is-paused', paused);
231
+ };
232
+ show(false);
233
+ if (getComputedStyle(box).position === 'static') box.style.position = 'relative';
234
+ box.append(btn);
235
+ btn.__show = show;
236
+ }
237
+ function loops() {
238
+ const els = [...document.querySelectorAll('[data-m-loop]')].filter(el => !el.__mLoop);
239
+ if (!els.length) return;
240
+ if (reduced() || matchMedia('(max-width: 639px)').matches) return; // motion.css holds them on their finished picture
241
+ const io = new IntersectionObserver(es => es.forEach(e => e.target.classList.toggle('is-m-off', !e.isIntersecting)), { rootMargin: '48px' });
242
+ els.forEach(el => {
243
+ el.__mLoop = true;
244
+ io.observe(el);
245
+ pauseButton(el);
246
+ hostOf(el).addEventListener('pointerenter', e => { if (e.pointerType !== 'touch') restart(el); }); // a mouse or pen, never a tap
247
+ hostOf(el).addEventListener('focusin', e => { if (!e.target.closest('.loop-pause')) restart(el); });
248
+ });
249
+ }
250
+ // one listener for every pause button: its own (m-own) toggles; a ui.js one is mirrored after ui.js ran
251
+ document.addEventListener('click', e => {
252
+ const btn = e.target.closest('.loop-pause');
253
+ if (!btn) return;
254
+ const box = btn.parentElement;
255
+ if (btn.classList.contains('m-own')) {
256
+ const paused = !btn.classList.contains('is-paused');
257
+ btn.__show(paused);
258
+ setPaused(box, paused);
259
+ box.querySelectorAll('[data-ui]').forEach(r => { try { paused ? r.__ui?.pause() : r.__ui?.resume(); } catch { /* none */ } });
260
+ } else setPaused(box, btn.classList.contains('is-paused'));
261
+ });
262
+
263
+ /* ---------------------------------------------------------------- switches */
264
+ document.addEventListener('click', e => {
265
+ const sw = e.target.closest('.m-switch');
266
+ if (!sw || e.defaultPrevented) return;
267
+ sw.setAttribute('aria-checked', String(sw.getAttribute('aria-checked') !== 'true'));
268
+ });
269
+
270
+ /* ---------------------------------------------------------------- the hero's entrance */
271
+ // Once, on load (motion.md, The hero's entrance): the h1 rises line by line out of its masks, then what
272
+ // follows it (the lead, each button, the facts) fades up 60ms apart, while the picture settles from a
273
+ // slight scale; about 1.1 s in all, ease-out, transform and opacity only. motion.css hides the words
274
+ // (never the picture) only while the head line's html.m-enter is on and its 700ms safety mark
275
+ // (m-enter-done) is not; the picture waits at its start scale and settles by a CSS transition, so it
276
+ // never blinks however late this file is. Without script, under reduced motion and in print the hero
277
+ // simply stands; when this file is later than the mark, the words fade in by CSS and the hero stands.
278
+ // The h1 gets its word masks for the length of the entrance and its own nodes back afterwards.
279
+ const ENTER_MEDIA = '[data-enter-media], .hero__bg, .hero__media, .hero__stage, .hero__art, .hero__window, .hero-visual, .ly-collage';
280
+ const ENTER_TEXT = 'h1 ~ *, :has(> h1) ~ *, :has(~ h1)';
281
+ const ENTER_LEAF = 'p, dl, ul, ol, a, button, img, picture, video, figure, blockquote, h2, h3, .pill, .btn';
282
+ function maskWords(h1) {
283
+ // an h1 another script reworks (layout.js: a live word, letters, a picture in the line) rises whole
284
+ if (h1.matches('[data-ly-letters], [data-enter-whole]') || h1.querySelector('.ly-word, .ly-pic, .ly-mark, svg, img')) return null;
285
+ const own = document.createDocumentFragment();
286
+ own.append(...h1.childNodes);
287
+ const copy = own.cloneNode(true);
288
+ const words = [];
289
+ const walk = node => [...node.childNodes].forEach(n => {
290
+ if (n.nodeType === 1) return walk(n);
291
+ if (n.nodeType !== 3) return;
292
+ const frag = document.createDocumentFragment();
293
+ n.textContent.split(/(\s+)/).forEach(part => {
294
+ if (!part) return;
295
+ if (/^\s+$/.test(part)) { frag.append(part); return; }
296
+ const w = document.createElement('span'), i = document.createElement('span');
297
+ w.className = 'm-w'; i.className = 'm-w__in'; i.textContent = part;
298
+ w.append(i); frag.append(w); words.push(w);
299
+ });
300
+ n.replaceWith(frag);
301
+ });
302
+ walk(copy);
303
+ const label = h1.hasAttribute('aria-label');
304
+ if (!label) h1.setAttribute('aria-label', own.textContent.replace(/\s+/g, ' ').trim());
305
+ h1.append(copy);
306
+ h1.querySelectorAll('.m-w').forEach(w => w.setAttribute('aria-hidden', 'true'));
307
+ // words grouped into the lines the browser set them on
308
+ const lines = [];
309
+ let top = null;
310
+ words.forEach(w => { const t = w.getBoundingClientRect().top; if (top === null || Math.abs(t - top) > 3) { lines.push([]); top = t; } lines[lines.length - 1].push(w.firstChild); });
311
+ return { lines, restore() { h1.replaceChildren(own); if (!label) h1.removeAttribute('aria-label'); } };
312
+ }
313
+ function enterSteps(hero, h1, media) {
314
+ // what follows (and precedes) the h1 in its column, as whole blocks in reading order; a box of
315
+ // layout (a div with no words of its own) is opened, a button row gives one step a button.
316
+ // A picture, window or collage (or a box round one) is never opened: it stands as one block and
317
+ // settles by itself (motion.css), even when it carries words of its own (a menu card, a note)
318
+ const out = [];
319
+ const take = el => {
320
+ if (el === h1 || el.contains(h1) || out.includes(el) || el.matches('img, picture, video, canvas, .frame__img')) return;
321
+ if (media.includes(el) || media.some(m => el.contains(m))) return;
322
+ if (el.matches('.btn-row')) { [...el.children].forEach(take); return; }
323
+ const own = [...el.childNodes].some(n => n.nodeType === 3 && n.textContent.trim());
324
+ if (own || !el.children.length || el.matches(ENTER_LEAF)) out.push(el);
325
+ else [...el.children].forEach(take);
326
+ };
327
+ hero.querySelectorAll(ENTER_TEXT).forEach(take);
328
+ return out.filter(el => !el.closest('[aria-hidden="true"]') && !out.some(o => o !== el && o.contains(el)))
329
+ .sort((a, b) => (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
330
+ }
331
+ function enter() {
332
+ const hero = document.querySelector('.hero[data-enter]:not([data-enter="off"])');
333
+ if (!hero || hero.classList.contains('is-entered') || hero.classList.contains('is-entering')) return;
334
+ // still: the picture takes its place at once (no settle); otherwise the CSS settle and fade run out first
335
+ const done = (still = false) => { if (still) hero.classList.add('is-still'); hero.classList.add('is-entered'); };
336
+ const late = () => setTimeout(done, 1150);
337
+ // the head line did not run, reduced motion, a headless shot (it sees the hero at rest, as it sees the
338
+ // final number, unless data-motion="live") or the visitor is already below the hero (a reload half way
339
+ // down): the hero stands as written. The safety mark has passed: motion.css is fading the words in and
340
+ // settling the picture; the hero is marked done once they are through
341
+ if (!html.classList.contains('m-enter') || reduced() || shot() || hero.getBoundingClientRect().bottom < 0) return done(true);
342
+ if (html.classList.contains('m-enter-done')) return late();
343
+ const h1 = hero.querySelector('h1');
344
+ if (!h1) return done(true);
345
+ const media = [...hero.querySelectorAll(ENTER_MEDIA)].filter((m, i, all) => !all.some(o => o !== m && o.contains(m)));
346
+ const steps = enterSteps(hero, h1, media);
347
+ const EASE = 'cubic-bezier(.22, 1, .36, 1)';
348
+ const anims = [];
349
+ let masks = null, over = false;
350
+ const finish = () => {
351
+ if (over) return;
352
+ over = true;
353
+ anims.forEach(a => { try { a.cancel(); } catch { /* gone */ } });
354
+ masks?.restore();
355
+ hero.classList.remove('is-entering');
356
+ done();
357
+ };
358
+ // the fonts first (a line set in the fallback face breaks elsewhere), 250ms at most: the words are
359
+ // hidden meanwhile, so nothing is seen twice
360
+ Promise.race([document.fonts?.ready ?? Promise.resolve(), new Promise(r => setTimeout(r, 250))]).then(() => {
361
+ if (html.classList.contains('m-enter-done') && !hero.classList.contains('is-entering')) { over = true; return late(); } // the safety mark won: CSS shows it
362
+ masks = maskWords(h1);
363
+ // .is-entering ends the CSS hold: the words are held by their animations from here, and the
364
+ // picture starts its CSS settle in the same frame
365
+ hero.classList.add('is-entering');
366
+ const lines = masks ? masks.lines : [[h1]];
367
+ const lineStep = Math.min(80, 240 / Math.max(1, lines.length - 1));
368
+ // a word starts wholly below its mask, which reaches .12em under the line: no tops show before it rises
369
+ lines.forEach((ws, k) => ws.forEach(w => anims.push(w.animate(masks
370
+ ? [{ transform: 'translateY(calc(100% + .2em))' }, { transform: 'none' }]
371
+ : [{ transform: 'translateY(.35em)', opacity: 0 }, { transform: 'none', opacity: 1 }],
372
+ { duration: 700, delay: 80 + k * lineStep, easing: EASE, fill: 'both' }))));
373
+ // a line above the h1 (a notice, a pill) comes with its first line; what follows starts as its
374
+ // last line is half way up
375
+ const after = 80 + (lines.length - 1) * lineStep + 220;
376
+ let k = 0;
377
+ steps.forEach(el => {
378
+ const above = !!(el.compareDocumentPosition(h1) & Node.DOCUMENT_POSITION_FOLLOWING);
379
+ // the rise is added to whatever transform the part has of its own; the fade replaces its opacity
380
+ const t = { duration: 520, delay: above ? 40 : after + Math.min(k++, 6) * 60, easing: EASE, fill: 'both' };
381
+ anims.push(el.animate([{ opacity: 0 }, { opacity: 1 }], t), el.animate([{ transform: 'translateY(12px)' }, { transform: 'none' }], { ...t, composite: 'add' }));
382
+ });
383
+ // a panel the words sit on stands from the first paint (it was never hidden, so it never blinks);
384
+ // the pictures settle by CSS over 1.1 s: the hero is done when both are through
385
+ anims.push({ finished: new Promise(r => setTimeout(r, 1150)), cancel() {} });
386
+ Promise.all(anims.map(a => a.finished)).then(finish, finish);
387
+ }).catch(finish);
388
+ setTimeout(finish, 2400); // whatever stalls (a hidden tab), the hero stands after 2.4 s
389
+ }
390
+
391
+ /* ---------------------------------------------------------------- start */
392
+ export function init() {
393
+ if (html.dataset.motion === 'off') { html.classList.add('m-enter-done'); return; }
394
+ if (!html.hasAttribute('data-motion')) html.setAttribute('data-motion', '');
395
+ try { enter(); } catch (e) { console.warn('motion.js: enter', e); document.querySelector('.hero[data-enter]')?.classList.add('is-entered'); }
396
+ try { nav(); } catch (e) { console.warn('motion.js: nav', e); }
397
+ try { tabs(); } catch (e) { console.warn('motion.js: tabs', e); }
398
+ try { counts(); } catch (e) { console.warn('motion.js: counts', e); }
399
+ try { loops(); } catch (e) { console.warn('motion.js: loops', e); }
400
+ }
401
+ /** call again after the page adds markup (a tab list, a stat, a loop) */
402
+ export const refresh = init;
403
+ export default { init, refresh };
404
+
405
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });
406
+ else init();
@@ -0,0 +1,14 @@
1
+ import { existsSync } from "node:fs";
2
+ import app from "../../disposabl.json";
3
+ import { createRoutes } from "@disposabl/disposabl-kit/client/vite.config";
4
+
5
+ const features: readonly string[] = app.features;
6
+ export const routes = createRoutes(
7
+ features.includes("authentication"),
8
+ !existsSync("src/router/pricing.tsx"),
9
+ );
10
+ export default {
11
+ routesDirectory: "router",
12
+ routeFileIgnorePattern: "__root\\.tsx$",
13
+ virtualRouteConfig: routes,
14
+ };
@@ -17,6 +17,8 @@ export const Route = createRootRoute({
17
17
  meta: [
18
18
  { charSet: "utf-8" },
19
19
  { name: "viewport", content: "width=device-width, initial-scale=1" },
20
+ { name: "page-type", content: "software" },
21
+ { name: "site-kind", content: "software" },
20
22
  { title },
21
23
  {
22
24
  name: "robots",
@@ -30,7 +32,7 @@ export const Route = createRootRoute({
30
32
  { name: "description", content: description },
31
33
  { property: "og:site_name", content: site.name },
32
34
  { property: "og:locale", content: "en_US" },
33
- { name: "theme-color", content: "#F8F5EF" },
35
+ { name: "theme-color", content: "#ffffff" },
34
36
  { property: "og:type", content: "website" },
35
37
  { property: "og:title", content: title },
36
38
  { property: "og:description", content: description },
@@ -57,6 +59,10 @@ export const Route = createRootRoute({
57
59
  scripts:
58
60
  pathname === "/"
59
61
  ? [
62
+ {
63
+ children:
64
+ "document.documentElement.classList.add('m-enter');setTimeout(()=>document.documentElement.classList.add('m-enter-done'),700)",
65
+ },
60
66
  {
61
67
  type: "application/ld+json",
62
68
  children: JSON.stringify({
@@ -87,7 +93,7 @@ export const Route = createRootRoute({
87
93
 
88
94
  function RootDocument({ children }: { children: React.ReactNode }) {
89
95
  return (
90
- <html lang="en">
96
+ <html lang="en" data-type="software" suppressHydrationWarning>
91
97
  <head>
92
98
  <HeadContent />
93
99
  </head>
@@ -2,5 +2,5 @@
2
2
  "routesDirectory": "./src/router",
3
3
  "routeFileIgnorePattern": "__root\\.tsx$",
4
4
  "generatedRouteTree": "./src/routeTree.gen.ts",
5
- "virtualRouteConfig": "../../packages/disposabl-kit/client/vite.config.ts"
5
+ "virtualRouteConfig": "./routes.config.ts"
6
6
  }
@@ -8,7 +8,7 @@ import {
8
8
  import { cp, rm } from "node:fs/promises";
9
9
  import { serveDocs } from "../docs/dev";
10
10
  // docs:end
11
- import kitRouter from "@disposabl/disposabl-kit/client/vite.config";
11
+ import kitRouter from "./routes.config";
12
12
  import {
13
13
  createPrerenderFilter,
14
14
  pageRoutes,
@@ -57,6 +57,7 @@ const config = defineConfig(({ mode }) => {
57
57
  throw new Error("VITE_PUBLIC_SITE_URL must be an HTTP(S) origin");
58
58
  const siteUrl = publicUrl.origin;
59
59
  const indexable = isProductionSite(mode, url.origin, site);
60
+ const prerenderFilter = createPrerenderFilter();
60
61
  const productionBackend =
61
62
  (app as { productionConvexSiteUrl?: string }).productionConvexSiteUrl ||
62
63
  site.backendOrigin;
@@ -105,7 +106,14 @@ const config = defineConfig(({ mode }) => {
105
106
  autoStaticPathsDiscovery: true,
106
107
  crawlLinks: true,
107
108
  failOnError: true,
108
- filter: createPrerenderFilter(),
109
+ filter: (page) => {
110
+ // Section links are useful navigation, not separate indexed pages.
111
+ if (new URL(page.path, siteUrl).hash) {
112
+ page.sitemap = { ...page.sitemap, exclude: true };
113
+ return false;
114
+ }
115
+ return prerenderFilter(page);
116
+ },
109
117
  },
110
118
  sitemap: { enabled: true, host: siteUrl },
111
119
  }),
@@ -96,6 +96,7 @@
96
96
  "react-native-css": "3.1.0-rc.1",
97
97
  "react-native-gesture-handler": "~3.3.0",
98
98
  "react-native-purchases": "10.16.0",
99
+ "react-native-purchases-ui": "10.16.0",
99
100
  "react-native-reanimated": "4.7.1",
100
101
  "react-native-safe-area-context": "~5.11.1",
101
102
  "react-native-screens": "~4.30.1",
@@ -203,6 +204,7 @@
203
204
  "convex": "catalog:",
204
205
  "jose": "^6.2.15",
205
206
  "lucide-react": "catalog:",
207
+ "next-themes": "^0.4.6",
206
208
  "react": "catalog:",
207
209
  "react-dom": "catalog:",
208
210
  "shadcn": "^4.23.0",
@@ -234,6 +236,7 @@
234
236
  "react-native": "0.88.1",
235
237
  "react-native-css": "3.1.0-rc.1",
236
238
  "react-native-purchases": "10.16.0",
239
+ "react-native-purchases-ui": "10.16.0",
237
240
  "react-native-safe-area-context": "~5.11.1",
238
241
  },
239
242
  "optionalPeers": [
@@ -248,6 +251,7 @@
248
251
  "react-native",
249
252
  "react-native-css",
250
253
  "react-native-purchases",
254
+ "react-native-purchases-ui",
251
255
  "react-native-safe-area-context",
252
256
  ],
253
257
  },
@@ -3205,6 +3209,8 @@
3205
3209
 
3206
3210
  "react-native-purchases": ["react-native-purchases@10.16.0", "", { "dependencies": { "@revenuecat/purchases-js-hybrid-mappings": "19.17.0", "@revenuecat/purchases-typescript-internal": "19.17.0" }, "peerDependencies": { "react": ">= 16.6.3", "react-native": ">= 0.73.0", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-Rcoy4A7uaaY4Fbgw6aaw5ummkyMPZuA/T1bC7IKHIQCxqoNo/L75PxzZ/8mEMpjhisbHERWl1mXmt0KTfllcDg=="],
3207
3211
 
3212
+ "react-native-purchases-ui": ["react-native-purchases-ui@10.16.0", "", { "dependencies": { "@revenuecat/purchases-typescript-internal": "19.17.0" }, "peerDependencies": { "react": "*", "react-native": ">= 0.73.0", "react-native-purchases": "10.16.0", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-IX0rdegsj590P8FKqx72fYzlsNN0U3tVv8T/pWf4xNCE462xtzVQQ0IjmdVs4Pyq6UwEgehDy1DwATKOhDGvRw=="],
3213
+
3208
3214
  "react-native-reanimated": ["react-native-reanimated@4.7.1", "", { "dependencies": { "react-native-is-edge-to-edge": "^1.3.1", "semver": "^7.7.3" }, "peerDependencies": { "react": "*", "react-native": "0.86 - 0.88", "react-native-worklets": "0.13.x" } }, "sha512-HviDFSZ6V4KTRsrLS6hRbBJ4j63l/L8a5az0EoWdJwaMLYnBNyYISTDxwXpEYkMbAbLzCMCviIdiOxXHYQWcNA=="],
3209
3215
 
3210
3216
  "react-native-safe-area-context": ["react-native-safe-area-context@5.11.1", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-yCltXXwhwp42vMqfhAsH5BWgAysbLNgwfn3PDwNpOn/CgwfM+eMWgScZIbHbMzJYNLi5bKJEOIUEG4RwKNiECA=="],
@@ -8,6 +8,7 @@ pathIgnorePatterns = ["**/dist/**", "**/out/**", "**/.output/**"]
8
8
 
9
9
  [fmt]
10
10
  ignorePatterns = [
11
+ "apps/web/public/landing/taste/**",
11
12
  "**/routeTree.gen.ts",
12
13
  "**/convex/_generated/**",
13
14
  "**/.agents/**",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "platforms": ["web", "android", "ios", "api", "mcp", "cli", "typescript-sdk"],
4
- "features": ["authentication", "docs", "faster-ci"]
4
+ "features": ["authentication", "docs", "analytics"]
5
5
  }
@@ -1,11 +1,8 @@
1
1
  import { setupConvexAuth } from "@convex-dev/auth/server";
2
2
  import { components } from "./_generated/api";
3
+ import { browserSessionTtl } from "@disposabl/disposabl-kit/server/browser-session";
3
4
 
4
- export const sessionTtl = {
5
- accessTokenTtlSeconds: 60,
6
- refreshInactivityTimeoutSeconds: 30 * 24 * 60 * 60,
7
- sessionMaxLifetimeSeconds: 30 * 24 * 60 * 60,
8
- };
5
+ export const sessionTtl = browserSessionTtl;
9
6
  export const auth = setupConvexAuth({
10
7
  component: components.auth,
11
8
  ...sessionTtl,
@@ -3,4 +3,9 @@ export {
3
3
  snapshot,
4
4
  checkout,
5
5
  portal,
6
+ beginAttempt,
7
+ finishAttempt,
8
+ resolveAttempt,
9
+ hasUnknownAttempt,
10
+ hasPendingMonthlyAttempt,
6
11
  } from "@disposabl/disposabl-kit/server/billing-functions";
@@ -0,0 +1,6 @@
1
+ export {
2
+ create,
3
+ inspect,
4
+ redeem,
5
+ cleanup,
6
+ } from "@disposabl/disposabl-kit/server/billing-handoff";
@@ -17,6 +17,14 @@ const app = defineApp({
17
17
  R2_SECRET_ACCESS_KEY: v.optional(v.string()),
18
18
  AUTUMN_SECRET_KEY: v.optional(v.string()),
19
19
  BILLING_RETURN_URL: v.optional(v.string()),
20
+ MOBILE_WEB_CHECKOUT_ENABLED: v.optional(v.string()),
21
+ REVENUECAT_CONSUMABLE_OWNER: v.optional(v.string()),
22
+ REVENUECAT_CONSUMABLE_INTEGRATION_VERIFIED: v.optional(v.string()),
23
+ REVENUECAT_WEBHOOK_AUTH: v.optional(v.string()),
24
+ REVENUECAT_PROJECT_ID: v.optional(v.string()),
25
+ REVENUECAT_ENVIRONMENT: v.optional(v.string()),
26
+ REVENUECAT_ROUTES: v.optional(v.string()),
27
+ REVENUECAT_SYNC_ENABLED: v.optional(v.string()),
20
28
  DISPOSABL_ENVIRONMENT: v.optional(v.string()),
21
29
  POSTHOG_ENABLED: v.optional(v.string()),
22
30
  POSTHOG_PROJECT_TOKEN: v.optional(v.string()),
@@ -1,8 +1,14 @@
1
+ import { webhook as revenueCatWebhook } from "@disposabl/disposabl-kit/server/revenuecat-functions";
1
2
  import { desktopUpdate } from "./desktopUpdates";
2
3
  import { page, options as telemetryOptions } from "./telemetry";
3
4
  import createHttpRouter from "@disposabl/disposabl-kit/server/http";
4
5
 
5
6
  const http = createHttpRouter();
7
+ http.route({
8
+ path: "/revenuecat/webhook",
9
+ method: "POST",
10
+ handler: revenueCatWebhook,
11
+ });
6
12
  http.route({ path: "/telemetry/page", method: "POST", handler: page });
7
13
  http.route({
8
14
  path: "/telemetry/page",
@@ -0,0 +1,13 @@
1
+ export {
2
+ receive,
3
+ claim,
4
+ complete,
5
+ dispatch,
6
+ routing,
7
+ inspect,
8
+ confirmFullRefund,
9
+ confirmUnknown,
10
+ receiveTransfer,
11
+ inspectTransfers,
12
+ inspectConflicts,
13
+ } from "@disposabl/disposabl-kit/server/revenuecat-functions";