create-ilorb 0.3.0 → 0.3.1

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.
package/README.md CHANGED
@@ -41,7 +41,7 @@ Everything that differs from one product to another lives in a single registry
41
41
  | Generated secrets (`.overture/secrets.env`) | `CHAT_SECRETS_KEY` | `WIDGETS_VISITOR_KEY`, `WIDGETS_SECRETS_KEY` | `PAYMENTS_TOKEN`, `PAYMENTS_CALLBACK_SECRET` — **the Core Worker also receives both** (same value: product → Core and the signed callback Core → product) |
42
42
  | Product Worker secrets | `CORE_SERVICE_TOKEN`, `SECRETS_KEY` (+ `OPERA_APP_SECRET`, `OPERA_CALLBACK_SECRET` if provided) | `CORE_SERVICE_TOKEN`, `VISITOR_KEY`, `SECRETS_KEY` (+ the Ilorb Signal ones and `RESEND_API_KEY`, if provided) | `CORE_SERVICE_TOKEN`, `PAYMENTS_TOKEN`, `PAYMENTS_CALLBACK_SECRET` (+ the Ilorb Signal ones and `RESEND_API_KEY`, if provided) |
43
43
  | Worker vars | `CORE_URL`, `PRODUCT`, `OPERA_APP_ID`, `OPERA_CHAT_URL`, `OPERA_ROOMS_URL`, `CALL_MEDIA`, `APNS_BUNDLE_ID` | `CORE_URL`, `PUBLIC_URL` (the snippet), `OPERA_APP_ID`, `OPERA_CHAT_URL`, `OPERA_ROOMS_URL`, `CALL_MEDIA`, `CORS_ORIGINS` (= the panel), `EMAIL_FROM` | `CORE_URL`, `PRODUCT`, `PUBLIC_URL`, `APP_URL` (local), `OPERA_*`, `CALL_MEDIA`, `NOTIFY_MODE` (cloud `live`, local `log`), `CORS_ORIGINS` (panel + local web app), `EMAIL_FROM` · **cron `* * * * *`** (24 h/15 min reminders, expired locks; local: `dev-local` calls `/__scheduled` every minute on the Core and on Consultas) |
44
- | R2 | `<app>-media` | — (messages and media stay in Ilorb Signal) | — |
44
+ | Product R2 | — (photos and voice messages go to Ilorb Signal; an unused `<app>-media` from older installs is left alone) | — (messages and media stay in Ilorb Signal) | — |
45
45
  | App | Expo (`overture-chat/app/react-native`): bundle id, `app.json`, `eas.json`, `expo export` in local | — (no mobile app: no bundle id, no EAS) | Expo (`overture-consultas/app/react-native`, `EXPO_PUBLIC_CONSULTAS_API_URL`) |
46
46
  | Build before deploy | — | `node build.mjs` in `overture-widgets/web/js` → `api/workers/src/generated/assets.ts` (the widget goes INSIDE the Worker; widget changed → build + deploy only the Widgets Worker) | — |
47
47
  | Core `settings.products` | `{id:"chat", name:<app name>, platforms:[ios,android,web], apiUrl}` | `{id:"widgets", name:"Ilorb Widgets", platforms:[web], apiUrl}` | `{id:"consultas", name:<app name>, platforms:[ios,android,web], apiUrl}` (`apiUrl` is where the payment callbacks go) |
@@ -141,7 +141,7 @@ between the migrations and the deploys; the product Worker is `<app>-widgets` wi
141
141
  | 5 | Cloudflare account | token (`CLOUDFLARE_API_TOKEN`) or `wrangler login` | — |
142
142
  | 6 | workers.dev | discovers `<sub>.workers.dev` (without a token: from the 1st deploy) | — |
143
143
  | 7–8 | D1 `<app>-identity`, `<app>-chat` | looks it up; creates it if missing | looks up first; **exists and isn't ours → stops** |
144
- | 9 | R2 `<app>-media` | looks it up; creates it | same |
144
+ | 9 | R2 `<app>-theme` | the Core appearance bucket (logo, favicon): looks it up; creates it | same |
145
145
  | 10 | Pages `<app>-admin` | looks it up; creates it (the real subdomain comes from Cloudflare) | same |
146
146
  | 11 | Configuration | `wrangler.jsonc` with ids/URLs/vars, `app.json`, `eas.json`, `overture.json` | redoes only if something changed |
147
147
  | 12–13 | Migrations | `wrangler d1 migrations apply --remote` | D1 keeps track of what was already applied |
package/dist/generate.js CHANGED
@@ -4,11 +4,13 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
4
4
  import { join } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { copyTree, isIgnored, readJson, readJsonc, walk, writeFileAtomic, writeJson } from "./fsutil.js";
7
- import { COPY_EXCLUDE, COPY_EXCLUDE_RE, CORE_R2, FORBIDDEN_TEMPLATE_RE } from "./products.js";
7
+ import { COPY_EXCLUDE, COPY_EXCLUDE_RE, CORE_R2, FORBIDDEN_TEMPLATE_RE, appScheme, optionalTemplates } from "./products.js";
8
8
  import { formatEnv } from "./state.js";
9
9
  export function copyTemplates(templatesRoot, dir, product) {
10
10
  let n = 0;
11
- for (const rel of product.templates) {
11
+ // the required list + the optional files this template folder has (DOCS.md)
12
+ const optional = optionalTemplates(product).filter((rel) => existsSync(join(templatesRoot, rel)));
13
+ for (const rel of [...product.templates, ...optional]) {
12
14
  // the Opera chat server (vendor/…/apps) NEVER goes to the buyer — not even if someone puts it in the list
13
15
  if (FORBIDDEN_TEMPLATE_RE.test(rel))
14
16
  throw new Error(`template proibido: ${rel}`);
@@ -153,7 +155,7 @@ function applyAppConfig(dir, rel, product, a, urls, local) {
153
155
  const e = appJson.expo;
154
156
  e.name = a.appName;
155
157
  e.slug = a.slug;
156
- e.scheme = a.slug;
158
+ e.scheme = appScheme(a);
157
159
  e.ios = { ...e.ios, bundleIdentifier: a.bundleId };
158
160
  e.android = { ...e.android, package: a.bundleId };
159
161
  e.web = { ...e.web, name: a.appName };
package/dist/i18n/en.js CHANGED
@@ -34,6 +34,7 @@ Answers:
34
34
  --status-domain <host> status: your own domain for the status page (e.g. status.company.com)
35
35
  --short-domain <host> link: your own short domain (e.g. lnk.company.com) · --workers-paid you have the Workers Paid plan (clicks queue)
36
36
  --site-domain <host> classificados: your own site domain (SEO depends on it)
37
+ --turnstile-site-key <key> helpcenter: the public Turnstile site key (env TURNSTILE_SITE_KEY; the secret: env TURNSTILE_SECRET)
37
38
  --sample-data quiz: import the sample questions (default: yes on local) · --no-sample-data
38
39
  --no-serve local: install, configure and stop (do not keep it running)
39
40
  `,
@@ -97,6 +98,9 @@ Answers:
97
98
  'q.email.later': 'Skip — I (the owner) sign in with the first-access link; I set up e-mail later in the panel',
98
99
  'q.email.key': 'Resend API key (hidden)',
99
100
  'q.email.from': 'Sender (e.g. "My App <login@mydomain.com>")',
101
+ 'q.publicVar': '{name} (public; {secret} was given — the captcha only turns on with both; Enter = skip)',
102
+ 'q.publicVar.invalid': 'Use letters, digits, - or _ (4 to 200).',
103
+ 'q.publicVar.unpaired': '{name} and {secret} work together: {missing} is missing, so the captcha stays OFF (pass both to turn it on).',
100
104
  'q.summary': 'Summary',
101
105
  'q.confirm': 'Install with these choices?',
102
106
  'q.cancelled': 'Cancelled. Nothing was created.',
@@ -350,7 +354,7 @@ Answers:
350
354
  'sample.skipped': 'skipped (no --sample-data)',
351
355
  'sample.imported': '{n} sample questions imported',
352
356
  'sample.failed': 'Could not import the samples now (everything else is ready). In the panel → Quiz → Import, upload overture-quiz/exemplos/perguntas-exemplo.csv.',
353
- 'final.next.imoveis': 'In the panel → Real estate: plans (limits, featured, price), places and portal settings; in Payments (Core panel), the Stripe/Mercado Pago/dLocal keys. The portal site is at {site}; advertisers use the app (cd overture-imoveis/app/react-native && npx eas-cli build). The cron runs every hour.',
357
+ 'final.next.imoveis': 'In the panel → Real estate: plans (limits, featured, price), places and portal settings; in Payments (Core panel), the Stripe/Mercado Pago/dLocal keys. The portal site is at {site}; advertisers use the web app at {app} (e-mail links and the chat button point to it) or the store app (cd overture-imoveis/app/react-native && npx eas-cli build). The cron runs every hour.',
354
358
  'final.next.imoveisLocal': 'To test: open the web app at {app}, sign in (the code shows on screen), create the agency and a listing; the site is at {site} and the panel → Real estate moderates. Local payment is SIMULATED.',
355
359
  'final.next.quiz': 'In the panel → Quiz: categories, questions (or Import CSV: overture-quiz/exemplos/perguntas-exemplo.csv) and settings; in Payments (Core panel), the Stripe/Mercado Pago/dLocal keys. The web game is at {app}. The cron runs every hour.',
356
360
  'final.next.quizLocal': 'To test: open the game at {app} and play a round (the code shows on screen); the panel → Quiz shows the questions and players. Local payment is SIMULATED.',
package/dist/i18n/es.js CHANGED
@@ -33,6 +33,7 @@ Respuestas:
33
33
  --status-domain <host> status: dominio propio de la página de estado (p. ej. status.empresa.com)
34
34
  --short-domain <host> link: dominio corto propio (p. ej. lnk.empresa.com) · --workers-paid tiene el plan pago de Workers (cola de clics)
35
35
  --site-domain <host> clasificados: dominio propio del sitio (el SEO depende de él)
36
+ --turnstile-site-key <clave> helpcenter: la clave pública de Turnstile (env TURNSTILE_SITE_KEY; el secreto: env TURNSTILE_SECRET)
36
37
  --sample-data quiz: importar las preguntas de ejemplo (por defecto: sí en local) · --no-sample-data
37
38
  --no-serve local: instala, configura y se detiene (no lo deja corriendo)
38
39
  `,
@@ -93,6 +94,9 @@ Respuestas:
93
94
  'q.email.later': 'Saltar — yo (dueño) entro con el enlace de primer acceso; configuro el correo después en el panel',
94
95
  'q.email.key': 'Clave de API de Resend (oculta)',
95
96
  'q.email.from': 'Remitente (p. ej. "Mi App <login@midominio.com>")',
97
+ 'q.publicVar': '{name} (pública; vino {secret} — el captcha solo se activa con los dos; Enter = omitir)',
98
+ 'q.publicVar.invalid': 'Usa letras, números, - o _ (4 a 200).',
99
+ 'q.publicVar.unpaired': '{name} y {secret} van juntos: falta {missing}, así que el captcha queda APAGADO (pasa los dos para activarlo).',
96
100
  'q.summary': 'Resumen',
97
101
  'q.confirm': '¿Instalar con estas opciones?',
98
102
  'q.cancelled': 'Cancelado. No se creó nada.',
@@ -342,7 +346,7 @@ Respuestas:
342
346
  'sample.skipped': 'omitido (sin --sample-data)',
343
347
  'sample.imported': '{n} preguntas de ejemplo importadas',
344
348
  'sample.failed': 'No se pudieron importar los ejemplos ahora (el resto está listo). En el panel → Quiz → Importar, sube overture-quiz/exemplos/perguntas-exemplo.csv.',
345
- 'final.next.imoveis': 'En el panel → Inmuebles: planes (límites, destacados, precio), lugares y ajustes del portal; en Pagos (panel del Core), las claves de Stripe/Mercado Pago/dLocal. El sitio del portal está en {site}; los anunciantes usan la app (cd overture-imoveis/app/react-native && npx eas-cli build). El cron corre cada hora.',
349
+ 'final.next.imoveis': 'En el panel → Inmuebles: planes (límites, destacados, precio), lugares y ajustes del portal; en Pagos (panel del Core), las claves de Stripe/Mercado Pago/dLocal. El sitio del portal está en {site}; los anunciantes usan la app web en {app} (los enlaces de los correos y el botón del chat apuntan a ella) o la app de las tiendas (cd overture-imoveis/app/react-native && npx eas-cli build). El cron corre cada hora.',
346
350
  'final.next.imoveisLocal': 'Para probar: abre la app web en {app}, entra (el código aparece en pantalla), crea la inmobiliaria y un anuncio; el sitio está en {site} y el panel → Inmuebles modera. El pago local es SIMULADO.',
347
351
  'final.next.quiz': 'En el panel → Quiz: categorías, preguntas (o Importar CSV: overture-quiz/exemplos/perguntas-exemplo.csv) y ajustes; en Pagos (panel del Core), las claves de Stripe/Mercado Pago/dLocal. El juego web está en {app}. El cron corre cada hora.',
348
352
  'final.next.quizLocal': 'Para probar: abre el juego en {app} y juega una partida (el código aparece en pantalla); el panel → Quiz muestra las preguntas y los jugadores. El pago local es SIMULADO.',
package/dist/i18n/pt.js CHANGED
@@ -33,6 +33,7 @@ Respostas:
33
33
  --status-domain <host> status: domínio próprio da página de status (ex.: status.empresa.com)
34
34
  --short-domain <host> link: domínio curto próprio (ex.: lnk.empresa.com) · --workers-paid tem o plano pago de Workers (fila de cliques)
35
35
  --site-domain <host> classificados: domínio próprio do site (o SEO depende dele)
36
+ --turnstile-site-key <chave> helpcenter: a chave pública do Turnstile (env TURNSTILE_SITE_KEY; o segredo: env TURNSTILE_SECRET)
36
37
  --sample-data quiz: importar as perguntas de exemplo (padrão: sim no local) · --no-sample-data
37
38
  --no-serve local: instala, configura e para (não deixa rodando)
38
39
  `,
@@ -93,6 +94,9 @@ Respostas:
93
94
  'q.email.later': 'Pular — eu (dono) entro pelo link de 1º acesso; configuro o e-mail depois no painel',
94
95
  'q.email.key': 'Chave de API do Resend (escondida)',
95
96
  'q.email.from': 'Remetente (ex.: "Meu App <login@meudominio.com>")',
97
+ 'q.publicVar': '{name} (pública; o {secret} veio — o captcha só liga com os dois; Enter = pular)',
98
+ 'q.publicVar.invalid': 'Use letras, números, - ou _ (4 a 200).',
99
+ 'q.publicVar.unpaired': '{name} e {secret} andam juntos: falta {missing}, então o captcha fica DESLIGADO (passe os dois para ligar).',
96
100
  'q.summary': 'Resumo',
97
101
  'q.confirm': 'Instalar com estas escolhas?',
98
102
  'q.cancelled': 'Cancelado. Nada foi criado.',
@@ -342,7 +346,7 @@ Respostas:
342
346
  'sample.skipped': 'pulado (sem --sample-data)',
343
347
  'sample.imported': '{n} perguntas de exemplo importadas',
344
348
  'sample.failed': 'Não deu para importar os exemplos agora (o resto está pronto). No painel → Quiz → Importar, envie overture-quiz/exemplos/perguntas-exemplo.csv.',
345
- 'final.next.imoveis': 'No painel → Imóveis: planos (limites, destaques, preço), lugares e ajustes do portal; em Pagamentos (painel do Core), as chaves do Stripe/Mercado Pago/dLocal. O site do portal está em {site}; os anunciantes usam o app (cd overture-imoveis/app/react-native && npx eas-cli build). O cron roda de hora em hora.',
349
+ 'final.next.imoveis': 'No painel → Imóveis: planos (limites, destaques, preço), lugares e ajustes do portal; em Pagamentos (painel do Core), as chaves do Stripe/Mercado Pago/dLocal. O site do portal está em {site}; os anunciantes usam o app web em {app} (links dos e-mails e o botão do chat apontam para ele) ou o app das lojas (cd overture-imoveis/app/react-native && npx eas-cli build). O cron roda de hora em hora.',
346
350
  'final.next.imoveisLocal': 'Para testar: abra o app web em {app}, entre (o código aparece na tela), crie a imobiliária e um anúncio; o site está em {site} e o painel → Imóveis modera. O pagamento local é SIMULADO.',
347
351
  'final.next.quiz': 'No painel → Quiz: categorias, perguntas (ou Importar CSV: overture-quiz/exemplos/perguntas-exemplo.csv) e ajustes; em Pagamentos (painel do Core), as chaves do Stripe/Mercado Pago/dLocal. O jogo na web está em {app}. O cron roda de hora em hora.',
348
352
  'final.next.quizLocal': 'Para testar: abra o jogo em {app} e jogue uma partida (o código aparece na tela); o painel → Quiz mostra as perguntas e os jogadores. O pagamento local é SIMULADO.',
package/dist/main.js CHANGED
@@ -14,7 +14,7 @@ import { realExec } from "./exec.js";
14
14
  import { detectLang, hasMsg, setLang, t } from "./i18n/index.js";
15
15
  import { DEFAULT_LICENSE_SERVER } from "./license/keys.js";
16
16
  import { looksLikeLicenseKey, looksLikePurchaseCode, maskCredential } from "./license/verify.js";
17
- import { BUNDLE_RE, DEFAULT_LOCALES, DOMAIN_RE, EMAIL_RE, HEX_RE, LOCALES, PRODUCTS, slugify, suggestBundleId } from "./products.js";
17
+ import { BUNDLE_RE, DEFAULT_LOCALES, DOMAIN_RE, EMAIL_RE, HEX_RE, LOCALES, PRODUCTS, PUBLIC_VAR_RE, slugify, suggestBundleId } from "./products.js";
18
18
  import { licensePath, loadSecrets, loadState, newState, saveSecrets, saveState, STATE_DIR, } from "./state.js";
19
19
  import { buildSteps } from "./steps.js";
20
20
  import { normalizeHex, PRESET_IDS, primaryReport, readThemeFile, resolveTheme, themeLine } from "./theme/preview.js";
@@ -421,6 +421,22 @@ async function collectAnswers(i) {
421
421
  for (const k of i.product.envSecrets ?? [])
422
422
  if (env[k])
423
423
  secrets[k] = env[k];
424
+ // optional PUBLIC product values (Help Center: TURNSTILE_SITE_KEY) — flag, environment or the saved answer; asked only when
425
+ // its paired secret came and it did not (the captcha only turns on with both)
426
+ const vars = {};
427
+ for (const v of i.product.publicVars ?? []) {
428
+ let val = str(flags[v.flag]) ?? str(env[v.name]) ?? prev?.vars?.[v.name];
429
+ const paired = v.pairedSecret ? !!secrets[v.pairedSecret] : false;
430
+ if (!val && paired && prompter) {
431
+ val = (await prompter.text(t('q.publicVar', { name: v.name, secret: v.pairedSecret }), { validate: (x) => (!x.trim() || PUBLIC_VAR_RE.test(x.trim()) ? null : t('q.publicVar.invalid')) })).trim() || undefined;
432
+ }
433
+ if (val && !PUBLIC_VAR_RE.test(val))
434
+ throw invalid(`--${v.flag}`, val, t('q.publicVar.invalid'));
435
+ if (val)
436
+ vars[v.name] = val;
437
+ if (v.pairedSecret && paired !== !!val)
438
+ out.warn(t('q.publicVar.unpaired', { name: v.name, secret: v.pairedSecret, missing: val ? v.pairedSecret : v.name }));
439
+ }
424
440
  // code email (cloud only; local shows the code on screen)
425
441
  let emailFrom = str(flags['email-from']) ?? prev?.email.from ?? null;
426
442
  if (env.RESEND_API_KEY)
@@ -482,6 +498,7 @@ async function collectAnswers(i) {
482
498
  ...(i.product.customDomain ? { domain } : {}),
483
499
  ...(i.product.paidQueue ? { workersPaid } : {}),
484
500
  ...(i.product.sampleImport ? { sampleData } : {}),
501
+ ...(Object.keys(vars).length ? { vars } : {}),
485
502
  license: i.credential ? { type: i.credential.type, masked: maskCredential(i.credential.type === 'license' ? i.credential.key : i.credential.purchaseCode) } : null,
486
503
  };
487
504
  }
package/dist/products.js CHANGED
@@ -19,10 +19,20 @@ export const OPERA_VENDOR_TEMPLATES = [`${OPERA_VENDOR}/packages`, `${OPERA_VEND
19
19
  /** The Ilorb SDK as bundled in the Ilorb Code templates (vendor/make-ilorb-sdk.sh; imported as @ilorb/*). Chat, Consultas and Widgets use it (with the chat scope in the token since 1d00db17). */
20
20
  export const ILORB_SDK = 'vendor/ilorb-sdk';
21
21
  export const ILORB_SDK_TEMPLATES = [`${ILORB_SDK}/packages`, `${ILORB_SDK}/tsconfig.base.json`];
22
+ /**
23
+ * Template files copied WHEN the template folder has them (a download older than 14.14 may not): the template's buyer docs,
24
+ * `overture-<id>/DOCS.md` (install, architecture, configuration, updating, FAQ). Not in `templates` on purpose: a missing one is
25
+ * never a `templates_missing` error. Used by the install copy and by the `update` scanner (so updates bring new docs too).
26
+ */
27
+ export function optionalTemplates(product) {
28
+ return [`${product.api.dir.split('/')[0]}/DOCS.md`];
29
+ }
22
30
  /** paths forbidden in the generated project (copyTemplates refuses them and the test checks) */
23
31
  export const FORBIDDEN_TEMPLATE_RE = /^vendor\/[^/]+\/apps(\/|$)|(^|\/)apps\/chat(\/|$)/;
24
32
  /** CLOUD Opera chat (the buyer uses a TEST app of their own in local mode and the production app in the cloud) */
25
33
  export const OPERA_CLOUD = { chat: 'https://chat-signal.ilorb.app', rooms: 'https://api-signal.ilorb.app' };
34
+ /** the deep-link scheme the installer writes into the app's app.json (`expo.scheme`) — the slug, always a valid URI scheme */
35
+ export const appScheme = (a) => a.slug;
26
36
  const b64 = (n) => randomBytes(n).toString('base64');
27
37
  const b64url = (n) => randomBytes(n).toString('base64url');
28
38
  /** the Opera keys go along when the buyer provided them (otherwise: via the panel) */
@@ -50,8 +60,9 @@ export const PRODUCTS = {
50
60
  { key: 'identity', suffix: 'identity', dir: 'overture-core/api/workers', migrations: 'migrations' },
51
61
  { key: 'chat', suffix: 'chat', dir: 'overture-chat/api/workers', migrations: 'migrations' },
52
62
  ],
53
- // R2 reserved for product media (Core avatar/upload in Phase 2). Chat photos stay in Opera's R2.
54
- r2: [{ key: 'media', suffix: 'media' }],
63
+ // NO product R2: photos and voice messages go to Ilorb Signal (uploadMedia); the Chat Worker binds no bucket. Older installs
64
+ // created an unused `<slug>-media` — it stays in their state/account untouched (never deleted), nothing reads it.
65
+ r2: [],
55
66
  queues: [],
56
67
  api: { suffix: 'chat', dir: 'overture-chat/api/workers', d1Key: 'chat', health: '/v1/config' },
57
68
  pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
@@ -237,6 +248,8 @@ export const PRODUCTS = {
237
248
  // Opera callback URL and the payment return when there is no web app
238
249
  PUBLIC_URL: urls.api,
239
250
  ...(urls.app ? { APP_URL: urls.app } : {}),
251
+ // the phone payment return opens <APP_SCHEME>://booking/<id>: the same scheme written into app.json
252
+ APP_SCHEME: appScheme(a),
240
253
  OPERA_APP_ID: a.opera.appId ?? '',
241
254
  OPERA_CHAT_URL: urls.opera,
242
255
  OPERA_ROOMS_URL: urls.rooms,
@@ -254,6 +267,7 @@ export const PRODUCTS = {
254
267
  PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
255
268
  PUBLIC_URL: urls.api,
256
269
  ...(urls.app ? { APP_URL: urls.app } : {}),
270
+ APP_SCHEME: appScheme(a),
257
271
  OPERA_APP_ID: a.opera.appId ?? '',
258
272
  OPERA_APP_SECRET: s.OPERA_APP_SECRET ?? '',
259
273
  ...(s.OPERA_CALLBACK_SECRET ? { OPERA_CALLBACK_SECRET: s.OPERA_CALLBACK_SECRET } : {}),
@@ -264,6 +278,8 @@ export const PRODUCTS = {
264
278
  NOTIFY_MODE: 'log',
265
279
  CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
266
280
  }),
281
+ // 1: APP_SCHEME (payment return deep link) — old installs get it on --resume
282
+ configRev: 1,
267
283
  core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
268
284
  opera: true,
269
285
  customDomain: false,
@@ -397,23 +413,28 @@ export const PRODUCTS = {
397
413
  PUBLIC_URL: urls.api,
398
414
  // links in e-mails and the payment return: the public booking page
399
415
  ...(urls.site ? { APP_URL: urls.site } : {}),
416
+ // the phone payment return opens <APP_SCHEME>://booking/<id>: the same scheme written into app.json
417
+ APP_SCHEME: appScheme(a),
400
418
  NOTIFY_MODE: local ? 'log' : 'live',
401
419
  ENVIRONMENT: local ? 'dev' : 'production',
402
420
  // the panel, the booking page (and its iframe on the buyer's site) and the local web app
403
421
  CORS_ORIGINS: [urls.admin, urls.site, urls.app].filter(Boolean).join(','),
404
422
  ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
405
423
  }),
406
- localDevVars: (_a, s, urls) => ({
424
+ localDevVars: (a, s, urls) => ({
407
425
  CORE_URL: urls.auth,
408
426
  CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
409
427
  PAYMENTS_TOKEN: s.PAYMENTS_TOKEN,
410
428
  PAYMENTS_CALLBACK_SECRET: s.PAYMENTS_CALLBACK_SECRET,
411
429
  PUBLIC_URL: urls.api,
412
430
  ...(urls.site ? { APP_URL: urls.site } : {}),
431
+ APP_SCHEME: appScheme(a),
413
432
  NOTIFY_MODE: 'log',
414
433
  ENVIRONMENT: 'dev',
415
434
  CORS_ORIGINS: [urls.admin, urls.site, urls.app].filter(Boolean).join(','),
416
435
  }),
436
+ // 1: APP_SCHEME (payment return deep link) — old installs get it on --resume
437
+ configRev: 1,
417
438
  // the client books via the app (iOS/Android) and via the public page / widget (web)
418
439
  core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
419
440
  opera: false,
@@ -678,7 +699,12 @@ export const PRODUCTS = {
678
699
  r2: [{ key: 'media', suffix: 'imoveis-media', binding: 'MEDIA' }],
679
700
  queues: [],
680
701
  api: { suffix: 'imoveis', dir: 'overture-imoveis/api/workers', d1Key: 'imoveis', health: '/v1/health' },
681
- pages: [{ key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' }],
702
+ pages: [
703
+ { key: 'admin', suffix: 'admin', dir: 'overture-core/web/react' },
704
+ // the advertiser web app (expo export) on Pages `<app>-app`: its URL is the Worker's APP_URL in the cloud too (lead and
705
+ // invite e-mail links, payment return, the site's "advertise" and chat buttons) — without it they were relative/empty
706
+ { key: 'app', suffix: 'app', dir: 'overture-imoveis/app/react-native' },
707
+ ],
682
708
  app: { dir: 'overture-imoveis/app/react-native', apiEnv: 'EXPO_PUBLIC_IMOVEIS_API_URL' },
683
709
  prebuild: null,
684
710
  generatedSecrets: {
@@ -701,7 +727,7 @@ export const PRODUCTS = {
701
727
  ...(a.opera.appId ? { ILORB_APP_ID: a.opera.appId, ILORB_CHAT_URL: urls.opera } : {}),
702
728
  // the site (canonical, sitemap, links)
703
729
  PUBLIC_URL: urls.api,
704
- // the advertiser app's web (links in e-mails, payment return) — local only (in the cloud the app is the store one)
730
+ // the advertiser app's web (links in e-mails, payment return, the site's chat button): cloud = Pages `<app>-app`, local = the port
705
731
  ...(urls.app ? { APP_URL: urls.app } : {}),
706
732
  NOTIFY_MODE: local ? 'log' : 'live',
707
733
  ENVIRONMENT: local ? 'dev' : 'production',
@@ -849,8 +875,10 @@ export const PRODUCTS = {
849
875
  coreSecrets: [],
850
876
  // SLA (about to expire/expired) and e-mails that failed: every minute
851
877
  cron: '* * * * *',
852
- // Turnstile for the public form (optional)
878
+ // Turnstile for the public form (optional): the secret from the environment, the PUBLIC site key from
879
+ // --turnstile-site-key / TURNSTILE_SITE_KEY. The server only enforces the captcha when BOTH are set.
853
880
  envSecrets: ['TURNSTILE_SECRET'],
881
+ publicVars: [{ name: 'TURNSTILE_SITE_KEY', flag: 'turnstile-site-key', pairedSecret: 'TURNSTILE_SECRET' }],
854
882
  workerSecrets: (s) => ({
855
883
  CORE_SERVICE_TOKEN: s.PRODUCT_SERVICE_TOKEN,
856
884
  SIGNING_KEY: s.HELPCENTER_SIGNING_KEY,
@@ -870,6 +898,8 @@ export const PRODUCTS = {
870
898
  // CORS only for the PANEL routes; the public ones (widget/center) accept any site by design
871
899
  CORS_ORIGINS: urls.admin,
872
900
  ...(a.email.from ? { EMAIL_FROM: a.email.from } : {}),
901
+ // the public Turnstile site key (the widget on /help/new); a plain var — it is public
902
+ ...(a.vars?.TURNSTILE_SITE_KEY ? { TURNSTILE_SITE_KEY: a.vars.TURNSTILE_SITE_KEY } : {}),
873
903
  }),
874
904
  localDevVars: (a, s, urls) => ({
875
905
  CORE_URL: urls.auth,
@@ -879,6 +909,7 @@ export const PRODUCTS = {
879
909
  NOTIFY_MODE: 'log',
880
910
  CORS_ORIGINS: urls.admin,
881
911
  ...(s.TURNSTILE_SECRET ? { TURNSTILE_SECRET: s.TURNSTILE_SECRET } : {}),
912
+ ...(a.vars?.TURNSTILE_SITE_KEY ? { TURNSTILE_SITE_KEY: a.vars.TURNSTILE_SITE_KEY } : {}),
882
913
  // live chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
883
914
  ...(a.opera.appId && s.OPERA_APP_SECRET
884
915
  ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
@@ -1436,6 +1467,8 @@ O Faturas faz orçamentos, faturas e cobranças; ele NÃO emite nota fiscal ofic
1436
1467
  PUBLIC_URL: urls.api,
1437
1468
  // the web app: payment return on the web
1438
1469
  ...(urls.app ? { APP_URL: urls.app } : {}),
1470
+ // the phone payment return opens <APP_SCHEME>://checkout: the same scheme written into app.json
1471
+ APP_SCHEME: appScheme(a),
1439
1472
  VIDEO_URL_TTL: '7200',
1440
1473
  CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1441
1474
  }),
@@ -1446,6 +1479,7 @@ O Faturas faz orçamentos, faturas e cobranças; ele NÃO emite nota fiscal ofic
1446
1479
  VIDEO_SIGNING_KEY: s.VIDEO_SIGNING_KEY,
1447
1480
  PUBLIC_URL: urls.api,
1448
1481
  ...(urls.app ? { APP_URL: urls.app } : {}),
1482
+ APP_SCHEME: appScheme(a),
1449
1483
  VIDEO_URL_TTL: '7200',
1450
1484
  CORS_ORIGINS: [urls.admin, urls.app].filter(Boolean).join(','),
1451
1485
  // class chat: the Ilorb key (ilorb.env of the download, or --opera-app-id + OPERA_APP_SECRET) — only both
@@ -1453,6 +1487,8 @@ O Faturas faz orçamentos, faturas e cobranças; ele NÃO emite nota fiscal ofic
1453
1487
  ? { ILORB_APP_ID: a.opera.appId, ILORB_APP_SECRET: s.OPERA_APP_SECRET, ILORB_CHAT_URL: urls.opera, ILORB_TOKEN_TTL: '600' }
1454
1488
  : {}),
1455
1489
  }),
1490
+ // 1: APP_SCHEME (payment return deep link) — old installs get it on --resume
1491
+ configRev: 1,
1456
1492
  core: { name: (a) => a.appName, platforms: ['ios', 'android', 'web'] },
1457
1493
  opera: false,
1458
1494
  ilorbOptional: true,
@@ -1526,3 +1562,5 @@ export function suggestBundleId(ownerEmail, slug) {
1526
1562
  export const BUNDLE_RE = /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/;
1527
1563
  export const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
1528
1564
  export const HEX_RE = /^#?[0-9a-fA-F]{6}$/;
1565
+ /** a public product value (ProductSpec.publicVars: a Turnstile site key `0x4AAA…`) — safe inside wrangler.jsonc and HTML */
1566
+ export const PUBLIC_VAR_RE = /^[A-Za-z0-9_-]{4,200}$/;
package/dist/readme.js CHANGED
@@ -117,7 +117,7 @@ scripts/dev-local.mjs pnpm dev`
117
117
  overture-core/web/react ${a.slug}-admin — painel (Cloudflare Pages) com as páginas do Imóveis
118
118
  overture-core/app/react-native/packages tema (e as fontes OFL que o site serve), i18n, componentes e login
119
119
  overture-imoveis/api/workers ${a.slug}-imoveis — site + API + D1 ${a.slug}-imoveis + R2 ${a.slug}-imoveis-media (cron ${p.cron})
120
- overture-imoveis/app/react-native o app do anunciante (Expo: iOS, Android e web) — ${a.bundleId}
120
+ overture-imoveis/app/react-native o app do anunciante (Expo: iOS, Android e web → Pages ${a.slug}-app) — ${a.bundleId}
121
121
  overture-imoveis/web/react páginas no painel (visão, anúncios, imobiliárias, leads, lugares, planos, ajustes)
122
122
  scripts/dev-local.mjs pnpm dev`
123
123
  : p.id === 'quiz'
package/dist/steps.js CHANGED
@@ -357,7 +357,8 @@ function configStep() {
357
357
  return {
358
358
  id: 'config',
359
359
  title: t('step.config'),
360
- hash: (c) => hashOf(c.answers, c.answers.target === 'cloud' ? cloudUrls(c) : localUrls(c), c.state.resources.d1, c.state.local),
360
+ // configRev (only when the spec sets it) reruns the config of OLD installs on --resume when a product gains a var
361
+ hash: (c) => hashOf(c.answers, c.answers.target === 'cloud' ? cloudUrls(c) : localUrls(c), c.state.resources.d1, c.state.local, ...(c.product.configRev ? [c.product.configRev] : [])),
361
362
  plan: (c) => c.answers.target === 'cloud'
362
363
  ? [
363
364
  `${names(c.answers, c.product).auth}: wrangler.jsonc com o id do D1, PUBLIC_URL=${cloudUrls(c).auth}, OWNER_EMAIL, ENVIRONMENT=production, DELIVERY_MODE=send`,
@@ -34,16 +34,16 @@ export function isAssetUrl(v) {
34
34
  export function checkThemeShape(input, opts = {}) {
35
35
  const issues = [];
36
36
  if (!isObj(input))
37
- return [{ code: 'invalid_value', severity: 'error', field: '', message: 'o tema precisa ser um objeto' }];
37
+ return [{ code: 'invalid_value', severity: 'error', field: '', message: 'the theme must be an object' }];
38
38
  const bad = (field, message, suggestion) => issues.push({ code: 'invalid_value', severity: 'error', field, message, ...(suggestion !== undefined ? { suggestion } : {}) });
39
39
  for (const [k, v] of Object.entries(input)) {
40
40
  if (!THEME_FIELDS.includes(k)) {
41
- issues.push({ code: 'unknown_field', severity: 'error', field: k, suggestion: null, message: `campo desconhecido: ${k}` });
41
+ issues.push({ code: 'unknown_field', severity: 'error', field: k, suggestion: null, message: `unknown field: ${k}` });
42
42
  continue;
43
43
  }
44
44
  if (v === null || v === undefined) {
45
45
  if (k === 'preset' && !opts.partial)
46
- bad(k, 'preset é obrigatório', 'clean');
46
+ bad(k, 'preset is required', 'clean');
47
47
  continue;
48
48
  }
49
49
  switch (k) {
@@ -74,22 +74,22 @@ export function checkThemeShape(input, opts = {}) {
74
74
  case 'fontSize':
75
75
  if (typeof v !== 'number' || !Number.isInteger(v) || v < FONT_SIZE.min || v > FONT_SIZE.max) {
76
76
  const n = typeof v === 'number' && Number.isFinite(v) ? Math.min(FONT_SIZE.max, Math.max(FONT_SIZE.min, Math.round(v))) : FONT_SIZE.default;
77
- bad(k, `fontSize: inteiro de ${FONT_SIZE.min} a ${FONT_SIZE.max}`, n);
77
+ bad(k, `fontSize: integer from ${FONT_SIZE.min} to ${FONT_SIZE.max}`, n);
78
78
  }
79
79
  break;
80
80
  case 'logo':
81
81
  case 'logoDark':
82
82
  case 'favicon':
83
83
  if (!isAssetUrl(v))
84
- bad(k, `${k}: URL https (até 500 caracteres)`, null);
84
+ bad(k, `${k}: https URL (up to 500 characters)`, null);
85
85
  break;
86
86
  default:
87
87
  if (!isHex(v))
88
- bad(k, `${k}: cor em hex (#RRGGBB)`, null);
88
+ bad(k, `${k}: hex color (#RRGGBB)`, null);
89
89
  }
90
90
  }
91
91
  if (!opts.partial && !('preset' in input))
92
- bad('preset', 'preset é obrigatório', 'clean');
92
+ bad('preset', 'preset is required', 'clean');
93
93
  return issues;
94
94
  }
95
95
  /** Merges the general theme with the product's "only what changes" (field by field; `null` in the product = inherit). */
@@ -133,8 +133,8 @@ function checkLegibility(cfg) {
133
133
  code: 'background_range', severity: 'error', field: bgField, scheme, pair: [bgField, scheme === 'light' ? '#000000' : '#FFFFFF'],
134
134
  colors: [bg, r.against], ratio: round2(ratio), min: r.min, suggestion: ensureContrast(bg, r.against, r.min + 0.2),
135
135
  message: scheme === 'light'
136
- ? `fundo do modo claro escuro demais (${round2(ratio)}:1 com o preto; mínimo ${r.min}:1)`
137
- : `fundo do modo escuro claro demais (${round2(ratio)}:1 com o branco; mínimo ${r.min}:1)`,
136
+ ? `light mode background too dark (${round2(ratio)}:1 against black; minimum ${r.min}:1)`
137
+ : `dark mode background too light (${round2(ratio)}:1 against white; minimum ${r.min}:1)`,
138
138
  });
139
139
  bg = fixed;
140
140
  }
@@ -152,7 +152,7 @@ function checkLegibility(cfg) {
152
152
  issues.push({
153
153
  code: 'low_contrast', severity: 'error', field, scheme, pair: [textField, bgField], colors: [text, bg],
154
154
  ratio: round2(ratio), min: TEXT_MIN, suggestion,
155
- message: `texto sobre o fundo (${scheme === 'light' ? 'claro' : 'escuro'}) = ${round2(ratio)}:1; mínimo ${TEXT_MIN}:1`,
155
+ message: `text on the background (${scheme}) = ${round2(ratio)}:1; minimum ${TEXT_MIN}:1`,
156
156
  });
157
157
  }
158
158
  }
@@ -169,7 +169,7 @@ function checkLegibility(cfg) {
169
169
  issues.push({
170
170
  code: 'adjusted', severity: 'warning', field, scheme: 'light', pair: [field, 'on'], colors: [chosenColor, on],
171
171
  ratio: round2(contrast(chosenColor, on)), min: 4.5, suggestion: solid,
172
- message: `${field}: o texto em cima não passa 4.5; o app mostra ${solid}`,
172
+ message: `${field}: the text on top does not reach 4.5; the app shows ${solid}`,
173
173
  });
174
174
  }
175
175
  }
@@ -180,7 +180,7 @@ function checkLegibility(cfg) {
180
180
  issues.push({
181
181
  code: 'low_visibility', severity: 'warning', field: 'primary', scheme: 'light', pair: ['primary', 'background'],
182
182
  colors: [solid, lightBg], ratio: round2(ratio), min: 3, suggestion: ensureContrast(solid, lightBg, 3.1),
183
- message: `botão principal quase some no fundo (${round2(ratio)}:1; recomendado 3:1)`,
183
+ message: `primary button barely visible on the background (${round2(ratio)}:1; recommended 3:1)`,
184
184
  });
185
185
  }
186
186
  }
package/dist/update.js CHANGED
@@ -17,7 +17,7 @@ import { dirname, join, relative, resolve, sep } from 'node:path';
17
17
  import { HumanError } from "./errors.js";
18
18
  import { writeFileAtomic } from "./fsutil.js";
19
19
  import { getLang, t } from "./i18n/index.js";
20
- import { COPY_EXCLUDE, COPY_EXCLUDE_RE, FORBIDDEN_TEMPLATE_RE, PRODUCTS } from "./products.js";
20
+ import { COPY_EXCLUDE, COPY_EXCLUDE_RE, FORBIDDEN_TEMPLATE_RE, optionalTemplates, PRODUCTS } from "./products.js";
21
21
  import { loadState, saveState } from "./state.js";
22
22
  export const TEMPLATE_VERSION_FILE = 'ilorb-template.json';
23
23
  export const DEFAULT_SITE = 'https://code.ilorb.com';
@@ -95,7 +95,8 @@ export function scanTemplate(root, product) {
95
95
  add(rel);
96
96
  }
97
97
  };
98
- for (const rel of product.templates) {
98
+ // + the optional files (DOCS.md): an update brings the template's new or changed docs (missing ones are skipped below)
99
+ for (const rel of [...product.templates, ...optionalTemplates(product)]) {
99
100
  if (FORBIDDEN_TEMPLATE_RE.test(rel))
100
101
  continue;
101
102
  const src = join(root, rel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ilorb",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Ilorb Code installer: a free template (with its Ilorb key from ilorb.env) → your project, database and Ilorb Core, locally or on your own Cloudflare account. npm create ilorb",
5
5
  "license": "MIT",
6
6
  "type": "module",