@kaikybrofc/omnizap-system 2.2.10 → 2.3.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 (119) hide show
  1. package/README.md +20 -18
  2. package/app/config/adminIdentity.js +1 -3
  3. package/app/connection/socketController.js +10 -20
  4. package/app/controllers/messageController.js +7 -28
  5. package/app/modules/aiModule/catCommand.js +29 -192
  6. package/app/modules/broadcastModule/noticeCommand.js +28 -97
  7. package/app/modules/gameModule/diceCommand.js +6 -32
  8. package/app/modules/playModule/playCommand.js +57 -258
  9. package/app/modules/quoteModule/quoteCommand.js +2 -4
  10. package/app/modules/rpgPokemonModule/rpgPokemonRepository.js +1 -13
  11. package/app/modules/statsModule/noMessageCommand.js +16 -84
  12. package/app/modules/statsModule/rankingCommand.js +5 -25
  13. package/app/modules/statsModule/rankingCommon.js +1 -9
  14. package/app/modules/stickerModule/convertToWebp.js +4 -27
  15. package/app/modules/stickerModule/stickerCommand.js +13 -24
  16. package/app/modules/stickerModule/stickerTextCommand.js +13 -25
  17. package/app/modules/stickerPackModule/autoPackCollectorService.js +16 -7
  18. package/app/modules/stickerPackModule/domainEventOutboxRepository.js +20 -36
  19. package/app/modules/stickerPackModule/domainEvents.js +2 -11
  20. package/app/modules/stickerPackModule/semanticReclassificationEngine.js +13 -50
  21. package/app/modules/stickerPackModule/semanticReclassificationEngine.test.js +2 -15
  22. package/app/modules/stickerPackModule/semanticThemeClusterService.js +14 -41
  23. package/app/modules/stickerPackModule/stickerAssetClassificationRepository.js +25 -95
  24. package/app/modules/stickerPackModule/stickerAssetRepository.js +12 -31
  25. package/app/modules/stickerPackModule/stickerAssetReprocessQueueRepository.js +13 -18
  26. package/app/modules/stickerPackModule/stickerAutoPackByTagsRuntime.js +284 -709
  27. package/app/modules/stickerPackModule/stickerClassificationBackgroundRuntime.js +27 -106
  28. package/app/modules/stickerPackModule/stickerClassificationService.js +46 -77
  29. package/app/modules/stickerPackModule/stickerDedicatedTaskWorkerRuntime.js +13 -53
  30. package/app/modules/stickerPackModule/stickerDomainEventBus.js +10 -16
  31. package/app/modules/stickerPackModule/stickerDomainEventConsumerRuntime.js +13 -34
  32. package/app/modules/stickerPackModule/stickerMarketplaceDriftService.js +1 -4
  33. package/app/modules/stickerPackModule/stickerObjectStorageService.js +26 -26
  34. package/app/modules/stickerPackModule/stickerPackCommandHandlers.js +32 -187
  35. package/app/modules/stickerPackModule/stickerPackInteractionEventRepository.js +6 -15
  36. package/app/modules/stickerPackModule/stickerPackItemRepository.js +6 -32
  37. package/app/modules/stickerPackModule/stickerPackMarketplaceService.js +12 -36
  38. package/app/modules/stickerPackModule/stickerPackMessageService.js +12 -40
  39. package/app/modules/stickerPackModule/stickerPackRepository.js +23 -66
  40. package/app/modules/stickerPackModule/stickerPackScoreSnapshotRepository.js +9 -21
  41. package/app/modules/stickerPackModule/stickerPackScoreSnapshotRuntime.js +10 -40
  42. package/app/modules/stickerPackModule/stickerPackService.js +50 -115
  43. package/app/modules/stickerPackModule/stickerPackServiceRuntime.js +2 -21
  44. package/app/modules/stickerPackModule/stickerPackUtils.js +13 -3
  45. package/app/modules/stickerPackModule/stickerStorageService.js +16 -65
  46. package/app/modules/stickerPackModule/stickerWorkerPipelineRuntime.js +4 -22
  47. package/app/modules/stickerPackModule/stickerWorkerTaskQueueRepository.js +14 -29
  48. package/app/modules/systemMetricsModule/pingCommand.js +9 -39
  49. package/app/modules/tiktokModule/tiktokCommand.js +17 -109
  50. package/app/modules/userModule/userCommand.js +2 -88
  51. package/app/observability/metrics.js +5 -16
  52. package/app/services/captchaService.js +1 -6
  53. package/app/services/dbWriteQueue.js +3 -18
  54. package/app/services/featureFlagService.js +2 -8
  55. package/app/services/newsBroadcastService.js +0 -1
  56. package/app/services/queueUtils.js +2 -4
  57. package/app/services/whatsappLoginLinkService.js +7 -9
  58. package/app/store/premiumUserStore.js +1 -2
  59. package/app/utils/antiLink/antiLinkModule.js +3 -233
  60. package/app/utils/logger/loggerModule.js +9 -34
  61. package/app/utils/systemMetrics/systemMetricsModule.js +1 -4
  62. package/database/init.js +1 -8
  63. package/docker-compose.yml +27 -27
  64. package/docs/seo/omnizap-seo-playbook-br-2026-02-28.md +26 -0
  65. package/docs/seo/satellite-page-template.md +2 -0
  66. package/docs/seo/satellite-pages-phase1.json +40 -177
  67. package/eslint.config.js +2 -15
  68. package/index.js +8 -36
  69. package/ml/clip_classifier/README.md +4 -6
  70. package/observability/alert-rules.yml +12 -12
  71. package/observability/grafana/provisioning/dashboards/dashboards.yml +1 -1
  72. package/package.json +6 -3
  73. package/public/api-docs/index.html +220 -193
  74. package/public/bot-whatsapp-para-grupo/index.html +291 -261
  75. package/public/bot-whatsapp-sem-programar/index.html +291 -261
  76. package/public/comandos/index.html +421 -406
  77. package/public/como-automatizar-avisos-no-whatsapp/index.html +291 -261
  78. package/public/como-criar-comandos-whatsapp/index.html +291 -261
  79. package/public/como-evitar-spam-no-whatsapp/index.html +291 -261
  80. package/public/como-moderar-grupo-whatsapp/index.html +291 -261
  81. package/public/como-organizar-comunidade-whatsapp/index.html +291 -261
  82. package/public/css/github-project-panel.css +13 -8
  83. package/public/css/stickers-admin.css +25 -9
  84. package/public/css/styles.css +23 -16
  85. package/public/index.html +1117 -994
  86. package/public/js/apps/apiDocsApp.js +17 -167
  87. package/public/js/apps/createPackApp.js +69 -332
  88. package/public/js/apps/homeApp.js +94 -74
  89. package/public/js/apps/loginApp.js +3 -12
  90. package/public/js/apps/stickersAdminApp.js +190 -181
  91. package/public/js/apps/stickersApp.js +496 -1397
  92. package/public/js/catalog.js +11 -74
  93. package/public/js/github-panel/components/ErrorState.js +1 -8
  94. package/public/js/github-panel/components/GithubProjectPanel.js +2 -9
  95. package/public/js/github-panel/components/SkeletonPanel.js +1 -11
  96. package/public/js/github-panel/components/StatCard.js +1 -7
  97. package/public/js/github-panel/vendor/react.js +1 -9
  98. package/public/js/runtime/react-runtime.js +1 -9
  99. package/public/licenca/index.html +104 -86
  100. package/public/login/index.html +315 -325
  101. package/public/melhor-bot-whatsapp-para-grupos/index.html +291 -261
  102. package/public/stickers/admin/index.html +14 -19
  103. package/public/stickers/create/index.html +39 -44
  104. package/public/stickers/index.html +96 -107
  105. package/public/termos-de-uso/index.html +142 -115
  106. package/public/user/index.html +347 -350
  107. package/scripts/cache-bust.mjs +5 -24
  108. package/scripts/generate-seo-satellite-pages.mjs +10 -13
  109. package/scripts/run-prettier-all.mjs +25 -0
  110. package/scripts/sticker-catalog-loadtest.mjs +13 -11
  111. package/scripts/sticker-worker-task.mjs +1 -4
  112. package/scripts/sync-readme-snapshot.mjs +3 -2
  113. package/server/controllers/stickerCatalogController.js +67 -5
  114. package/server/http/httpServer.js +2 -10
  115. package/server/routes/stickerCatalog/catalogHandlers/catalogAdminHttp.js +1 -8
  116. package/server/routes/stickerCatalog/catalogHandlers/catalogAuthHttp.js +1 -9
  117. package/server/routes/stickerCatalog/catalogHandlers/catalogPublicHttp.js +10 -11
  118. package/server/routes/stickerCatalog/catalogHandlers/catalogUploadHttp.js +1 -10
  119. package/server/routes/stickerCatalog/catalogRouter.js +11 -13
@@ -1,4 +1,40 @@
1
1
  const FALLBACK_THUMB_URL = '/assets/images/brand-logo-128.webp';
2
+ const HOME_BOOTSTRAP_ENDPOINT = '/api/sticker-packs/home-bootstrap';
3
+ const SVG_NS = 'http://www.w3.org/2000/svg';
4
+ let homeBootstrapPayloadPromise = null;
5
+
6
+ const fetchHomeBootstrapPayload = async () => {
7
+ if (!homeBootstrapPayloadPromise) {
8
+ homeBootstrapPayloadPromise = fetch(HOME_BOOTSTRAP_ENDPOINT, { credentials: 'include' })
9
+ .then((response) => {
10
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
11
+ return response.json();
12
+ })
13
+ .then((payload) => payload?.data || {})
14
+ .catch((error) => {
15
+ homeBootstrapPayloadPromise = null;
16
+ throw error;
17
+ });
18
+ }
19
+ return homeBootstrapPayloadPromise;
20
+ };
21
+
22
+ const createIcon = (iconId, className = 'icon') => {
23
+ const wrapper = document.createElement('span');
24
+ wrapper.className = className;
25
+ wrapper.setAttribute('aria-hidden', 'true');
26
+
27
+ const svg = document.createElementNS(SVG_NS, 'svg');
28
+ svg.setAttribute('viewBox', '0 0 24 24');
29
+ svg.setAttribute('focusable', 'false');
30
+
31
+ const use = document.createElementNS(SVG_NS, 'use');
32
+ use.setAttribute('href', `#${iconId}`);
33
+
34
+ svg.appendChild(use);
35
+ wrapper.appendChild(svg);
36
+ return wrapper;
37
+ };
2
38
 
3
39
  const shortNum = (value) =>
4
40
  new Intl.NumberFormat('pt-BR', {
@@ -142,9 +178,7 @@ const initAuthSession = () => {
142
178
  authLink.removeAttribute('aria-label');
143
179
  clearChildren(authLink);
144
180
 
145
- const icon = document.createElement('i');
146
- icon.className = 'fa-solid fa-right-to-bracket';
147
- icon.setAttribute('aria-hidden', 'true');
181
+ const icon = createIcon('icon-login');
148
182
 
149
183
  authLink.append(icon, document.createTextNode('Entrar'));
150
184
 
@@ -188,9 +222,7 @@ const initAuthSession = () => {
188
222
  const nameBubble = document.createElement('span');
189
223
  nameBubble.className = 'nav-user-name-bubble';
190
224
 
191
- const icon = document.createElement('i');
192
- icon.className = 'fa-solid fa-user nav-user-icon';
193
- icon.setAttribute('aria-hidden', 'true');
225
+ const icon = createIcon('icon-user', 'icon nav-user-icon');
194
226
 
195
227
  const name = document.createElement('span');
196
228
  name.className = 'nav-user-name';
@@ -209,36 +241,23 @@ const initAuthSession = () => {
209
241
  }
210
242
  };
211
243
 
212
- return runAfterLoadIdle(() => {
213
- fetch('/api/sticker-packs/auth/google/session', { credentials: 'include' })
214
- .then((response) => {
215
- if (!response.ok) throw new Error('Sessão indisponível');
216
- return response.json();
217
- })
218
- .then((payload) => {
219
- const sessionData = payload?.data || {};
220
- if (!sessionData?.authenticated || !sessionData?.user?.sub) {
244
+ return runAfterLoadIdle(
245
+ () => {
246
+ fetchHomeBootstrapPayload()
247
+ .then((bootstrapData) => {
248
+ const sessionData = bootstrapData?.session || {};
249
+ if (!sessionData?.authenticated || !sessionData?.user?.sub) {
250
+ setLoginState();
251
+ return;
252
+ }
253
+ setLoggedState(sessionData);
254
+ })
255
+ .catch(() => {
221
256
  setLoginState();
222
- return;
223
- }
224
- setLoggedState(sessionData);
225
- })
226
- .catch(() => {
227
- setLoginState();
228
- });
229
- }, { delayMs: 160, timeoutMs: 1200 });
230
- };
231
-
232
- const resolveSupportUrl = async () => {
233
- try {
234
- const response = await fetch('/api/sticker-packs/support');
235
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
236
- const payload = await response.json();
237
- const url = String(payload?.data?.url || '').trim();
238
- return url || '';
239
- } catch {
240
- return '';
241
- }
257
+ });
258
+ },
259
+ { delayMs: 520, timeoutMs: 1200 },
260
+ );
242
261
  };
243
262
 
244
263
  const initAddBotCtas = () => {
@@ -263,18 +282,22 @@ const initAddBotCtas = () => {
263
282
  return true;
264
283
  };
265
284
 
266
- return runAfterLoadIdle(() => {
267
- resolveSupportUrl()
268
- .then((url) => {
269
- const applied = applyLink(url);
270
- if (!applied && floatButton) {
271
- floatButton.hidden = true;
272
- }
273
- })
274
- .catch(() => {
275
- if (floatButton) floatButton.hidden = true;
276
- });
277
- }, { delayMs: 120, timeoutMs: 1400 });
285
+ return runAfterLoadIdle(
286
+ () => {
287
+ fetchHomeBootstrapPayload()
288
+ .then((bootstrapData) => {
289
+ const url = String(bootstrapData?.support?.url || '').trim();
290
+ const applied = applyLink(url);
291
+ if (!applied && floatButton) {
292
+ floatButton.hidden = true;
293
+ }
294
+ })
295
+ .catch(() => {
296
+ if (floatButton) floatButton.hidden = true;
297
+ });
298
+ },
299
+ { delayMs: 480, timeoutMs: 1400 },
300
+ );
278
301
  };
279
302
 
280
303
  const initSocialProof = () => {
@@ -293,7 +316,9 @@ const initSocialProof = () => {
293
316
  };
294
317
 
295
318
  const normalizeStatus = (value) => {
296
- const normalized = String(value || '').trim().toLowerCase();
319
+ const normalized = String(value || '')
320
+ .trim()
321
+ .toLowerCase();
297
322
  if (!normalized) return 'pronto';
298
323
  if (['online', 'ok', 'healthy'].includes(normalized)) return 'online';
299
324
  if (['connecting', 'opening', 'reconnecting'].includes(normalized)) return 'conectando';
@@ -301,32 +326,27 @@ const initSocialProof = () => {
301
326
  return 'pronto';
302
327
  };
303
328
 
304
- return runAfterLoadIdle(() => {
305
- Promise.all([
306
- fetch('/api/sticker-packs/stats'),
307
- fetch('/api/sticker-packs/system-summary'),
308
- ])
309
- .then(async ([statsRes, summaryRes]) => {
310
- if (!statsRes.ok || !summaryRes.ok) throw new Error('Falha ao carregar prova social');
311
-
312
- const statsPayload = await statsRes.json();
313
- const summaryPayload = await summaryRes.json();
314
-
315
- const stats = statsPayload?.data || {};
316
- const summary = summaryPayload?.data || {};
317
-
318
- animateCountUp(packsEl, Number(stats.packs_total || 0));
319
- animateCountUp(stickersEl, Number(stats.stickers_total || 0));
320
- animateCountUp(groupsEl, Number(summary?.platform?.total_groups || 0));
321
-
322
- if (statusEl) {
323
- statusEl.textContent = `bot ${normalizeStatus(summary?.system_status || summary?.bot?.connection_status)}`;
324
- }
325
- })
326
- .catch(() => {
327
- setFallback();
328
- });
329
- }, { delayMs: 260, timeoutMs: 1500 });
329
+ return runAfterLoadIdle(
330
+ () => {
331
+ fetchHomeBootstrapPayload()
332
+ .then((bootstrapData) => {
333
+ const stats = bootstrapData?.stats || {};
334
+ const summary = bootstrapData?.system_summary || {};
335
+
336
+ animateCountUp(packsEl, Number(stats.packs_total || 0));
337
+ animateCountUp(stickersEl, Number(stats.stickers_total || 0));
338
+ animateCountUp(groupsEl, Number(summary?.platform?.total_groups || 0));
339
+
340
+ if (statusEl) {
341
+ statusEl.textContent = `bot ${normalizeStatus(summary?.system_status || summary?.bot?.connection_status)}`;
342
+ }
343
+ })
344
+ .catch(() => {
345
+ setFallback();
346
+ });
347
+ },
348
+ { delayMs: 620, timeoutMs: 1500 },
349
+ );
330
350
  };
331
351
 
332
352
  const registerCleanup = (cleanups, cleanup) => {
@@ -146,18 +146,12 @@ if (root) {
146
146
 
147
147
  const renderHint = () => {
148
148
  if (!state.hint.hasPayload) {
149
- setText(
150
- ui.hint,
151
- 'Voce abriu esta pagina direto. Por seguranca, gere seu link no WhatsApp clicando no botao abaixo e enviando "iniciar".',
152
- );
149
+ setText(ui.hint, 'Voce abriu esta pagina direto. Por seguranca, gere seu link no WhatsApp clicando no botao abaixo e enviando "iniciar".');
153
150
  return;
154
151
  }
155
152
 
156
153
  if (!state.hint.phone) {
157
- setText(
158
- ui.hint,
159
- 'Este link nao trouxe um numero de WhatsApp valido. Ele pode ter sido alterado ou expirado. Gere um novo link enviando "iniciar".',
160
- );
154
+ setText(ui.hint, 'Este link nao trouxe um numero de WhatsApp valido. Ele pode ter sido alterado ou expirado. Gere um novo link enviando "iniciar".');
161
155
  return;
162
156
  }
163
157
 
@@ -193,10 +187,7 @@ if (root) {
193
187
  }
194
188
 
195
189
  if (state.hint.phone) {
196
- setText(
197
- ui.summaryOwner,
198
- `Numero detectado: +${formatPhone(state.hint.phone)}. Clique no botao do Google para concluir o vinculo.`,
199
- );
190
+ setText(ui.summaryOwner, `Numero detectado: +${formatPhone(state.hint.phone)}. Clique no botao do Google para concluir o vinculo.`);
200
191
  renderWhatsAppCta();
201
192
  return;
202
193
  }