@holdyapp/install 0.1.0 → 0.2.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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +16 -16
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -64,7 +64,7 @@ Re-rodar o CLI no mesmo projeto = no-op. Os patches detectam o marker `holdy-ins
64
64
 
65
65
  npm install @holdyapp/sdk
66
66
 
67
- [4] Pronto! Inicie o app e abra o widget de status em app.holdy.com.br
67
+ [4] Pronto! Inicie o app e abra o widget de status em holdy.chat
68
68
  ```
69
69
 
70
70
  ## Licença
package/dist/cli.js CHANGED
@@ -82,7 +82,7 @@ function pick(cwd, candidates) {
82
82
  var import_node_fs2 = require("node:fs");
83
83
  var import_node_path2 = require("node:path");
84
84
  var HOLDY_MARKER = "holdy-installed-by-cli";
85
- var CDN_URL = "https://app.holdy.com.br/sdk/v0/holdy.iife.js";
85
+ var CDN_URL = "https://holdy.chat/sdk/v1/holdy.js";
86
86
  function inject(detection, opts) {
87
87
  switch (detection.framework) {
88
88
  case "next-app":
@@ -189,7 +189,7 @@ export function HoldyScript() {
189
189
  s.onload = () => {
190
190
  window.Holdy?.init({
191
191
  apiKey: '${opts.apiKey}',
192
- ${opts.accountId ? `accountId: '${opts.accountId}',
192
+ ${opts.accountId ? `accountKey: '${opts.accountId}',
193
193
  ` : ""}autoCapture: ${opts.autoCapture},
194
194
  })
195
195
  }
@@ -228,11 +228,11 @@ function injectNextPages(file, opts) {
228
228
  if (original.includes(HOLDY_MARKER) || original.includes("@holdyapp/sdk")) {
229
229
  return { ok: true, modified: false, file, message: "Holdy j\xE1 presente no _app \xB7 skip" };
230
230
  }
231
- let patched = addImport(original, `import { Holdy } from '@holdyapp/sdk' // ${HOLDY_MARKER}`);
231
+ let patched = addImport(original, `import { initHoldy } from '@holdyapp/sdk/web' // ${HOLDY_MARKER}`);
232
232
  patched = patched.replace(
233
233
  /export default function (\w+)\([^)]*\)\s*\{/,
234
234
  (match) => `${match}
235
- if (typeof window !== 'undefined' && !window.__holdyInit) { Holdy.init({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountId: '${opts.accountId}', ` : ""}autoCapture: ${opts.autoCapture} }); (window as unknown as { __holdyInit?: boolean }).__holdyInit = true }`
235
+ if (typeof window !== 'undefined' && !window.__holdyInit) { initHoldy({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountKey: '${opts.accountId}', ` : ""}autoCapture: ${opts.autoCapture} }); (window as unknown as { __holdyInit?: boolean }).__holdyInit = true }`
236
236
  );
237
237
  (0, import_node_fs2.writeFileSync)(file, patched);
238
238
  return { ok: true, modified: true, file, message: `Patched ${displayPath(file)} \xB7 rode npm install @holdyapp/sdk` };
@@ -251,8 +251,8 @@ function injectViteReact(file, opts) {
251
251
  if (original.includes(HOLDY_MARKER) || original.includes("@holdyapp/sdk")) {
252
252
  return { ok: true, modified: false, file, message: "Holdy j\xE1 presente no entry \xB7 skip" };
253
253
  }
254
- const patched = `import { Holdy } from '@holdyapp/sdk' // ${HOLDY_MARKER}
255
- Holdy.init({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountId: '${opts.accountId}', ` : ""}autoCapture: ${opts.autoCapture} })
254
+ const patched = `import { initHoldy } from '@holdyapp/sdk/web' // ${HOLDY_MARKER}
255
+ initHoldy({ apiKey: '${opts.apiKey}', ${opts.accountId ? `accountKey: '${opts.accountId}', ` : ""}autoCapture: ${opts.autoCapture} })
256
256
 
257
257
  ${original}`;
258
258
  (0, import_node_fs2.writeFileSync)(file, patched);
@@ -267,12 +267,12 @@ function injectNuxt(file, opts) {
267
267
  }
268
268
  ensureDir(file);
269
269
  const content = `// ${HOLDY_MARKER}
270
- import { Holdy } from '@holdyapp/sdk'
270
+ import { initHoldy } from '@holdyapp/sdk/web'
271
271
 
272
272
  export default defineNuxtPlugin(() => {
273
- Holdy.init({
273
+ initHoldy({
274
274
  apiKey: '${opts.apiKey}',
275
- ${opts.accountId ? `accountId: '${opts.accountId}',
275
+ ${opts.accountId ? `accountKey: '${opts.accountId}',
276
276
  ` : ""}autoCapture: ${opts.autoCapture},
277
277
  })
278
278
  })
@@ -341,7 +341,7 @@ function injectHtmlOrAstro(file, opts) {
341
341
  }
342
342
  function buildScriptSnippet(opts) {
343
343
  const accountLine = opts.accountId ? `
344
- accountId: '${opts.accountId}',` : "";
344
+ accountKey: '${opts.accountId}',` : "";
345
345
  return `<script src="${CDN_URL}"></script>
346
346
  <script>
347
347
  Holdy.init({
@@ -352,10 +352,10 @@ function buildScriptSnippet(opts) {
352
352
  }
353
353
  function buildEsImportSnippet(opts) {
354
354
  const accountLine = opts.accountId ? `
355
- accountId: '${opts.accountId}',` : "";
356
- return `import { Holdy } from '@holdyapp/sdk'
355
+ accountKey: '${opts.accountId}',` : "";
356
+ return `import { initHoldy } from '@holdyapp/sdk/web'
357
357
 
358
- Holdy.init({
358
+ initHoldy({
359
359
  apiKey: '${opts.apiKey}',${accountLine}
360
360
  autoCapture: ${opts.autoCapture},
361
361
  })`;
@@ -407,7 +407,7 @@ async function main() {
407
407
  apiKey = await promptApiKey();
408
408
  }
409
409
  if (!apiKey || !apiKey.startsWith("hol_")) {
410
- log.error("API key inv\xE1lida. Use formato hol_live_\u2026 ou hol_test_\u2026 \xB7 gere em app.holdy.com.br/settings.");
410
+ log.error("API key inv\xE1lida. Use formato hol_live_\u2026 ou hol_test_\u2026 \xB7 gere em holdy.chat/settings.");
411
411
  process.exit(1);
412
412
  }
413
413
  log.step("2", "Aplicando snippet no(s) arquivo(s)\u2026");
@@ -439,7 +439,7 @@ async function main() {
439
439
  } else {
440
440
  log.step("3", "Sem npm install necess\xE1rio \xB7 script tag via CDN.");
441
441
  }
442
- log.step("4", 'Pronto! Inicie o app e abra o widget de status em app.holdy.com.br \xB7 voc\xEA deve ver "conectado" em segundos.');
442
+ log.step("4", 'Pronto! Inicie o app e abra o widget de status em holdy.chat \xB7 voc\xEA deve ver "conectado" em segundos.');
443
443
  process.exit(0);
444
444
  }
445
445
  function parseArgs(argv) {
@@ -484,7 +484,7 @@ ${bold("Argumentos:")}
484
484
  apiKey Token Holdy (hol_live_\u2026 ou hol_test_\u2026)
485
485
 
486
486
  ${bold("Op\xE7\xF5es:")}
487
- --account <id> Account ID padr\xE3o (vai pro Holdy.init)
487
+ --account <id> Chave da account padr\xE3o (vira context.account_external_id)
488
488
  --no-auto-capture Desabilita captura autom\xE1tica de page views
489
489
  --version, -v Mostra vers\xE3o
490
490
  --help, -h Mostra esta mensagem
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@holdyapp/install",
3
- "version": "0.1.0",
4
- "description": "Holdy install CLI · detects your framework and wires the SDK in 1 step",
3
+ "version": "0.2.0",
4
+ "description": "Holdy install CLI \u00b7 detects your framework and wires the SDK in 1 step",
5
5
  "license": "MIT",
6
- "homepage": "https://app.holdy.com.br",
6
+ "homepage": "https://holdy.chat",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/augustoperolligaedke/holdymvp.git",
9
+ "url": "git+https://github.com/augustoperolligaedke/holdy.git",
10
10
  "directory": "packages/install-cli"
11
11
  },
12
12
  "bin": {