veo-sdk 0.2.0 → 0.2.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 +8 -6
- package/dist/index.cjs +20 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.mjs +20 -10
- package/dist/index.mjs.map +1 -1
- package/dist/veo.js +2 -1
- package/dist/veo.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,8 +24,9 @@ import { init } from 'veo-sdk';
|
|
|
24
24
|
// Solo en el navegador (usa localStorage/DOM). En Next: client component.
|
|
25
25
|
const veo = init({
|
|
26
26
|
apiKey: 'pk_xxx',
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
guides: true, // opt-in: renderiza guías in-app
|
|
28
|
+
// apiUrl es OPCIONAL: por defecto apunta al backend gestionado de Veo.
|
|
29
|
+
// Solo se pasa para self-hosted / otra región.
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
veo.identify({ visitor: { id: 'user_123', traits: { email: 'a@b.com' } } });
|
|
@@ -39,14 +40,15 @@ Cargá `veo.js` desde unpkg y llamá `init` en el `onload` del `<script>`
|
|
|
39
40
|
|
|
40
41
|
```html
|
|
41
42
|
<script
|
|
42
|
-
src="https://unpkg.com/veo-sdk@0.2.
|
|
43
|
-
onload="window.veo.init({ apiKey: 'pk_xxx',
|
|
43
|
+
src="https://unpkg.com/veo-sdk@0.2.1/dist/veo.js"
|
|
44
|
+
onload="window.veo.init({ apiKey: 'pk_xxx', guides: true });
|
|
44
45
|
window.veo.identify({ visitor: { id: 'user_123' } });">
|
|
45
46
|
</script>
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
Fijá la versión (`@0.2.
|
|
49
|
-
|
|
49
|
+
`apiUrl` es opcional (default = backend gestionado). Fijá la versión (`@0.2.1`)
|
|
50
|
+
para no romperte con un release futuro. También por jsDelivr:
|
|
51
|
+
`https://cdn.jsdelivr.net/npm/veo-sdk@0.2.1/dist/veo.js`.
|
|
50
52
|
|
|
51
53
|
## API
|
|
52
54
|
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var dom = require('@floating-ui/dom');
|
|
4
4
|
|
|
5
|
+
// src/contract/v1.ts
|
|
6
|
+
var SDK_VERSION = "0.0.1";
|
|
7
|
+
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
8
|
+
var DEFAULT_FLUSH_BATCH_SIZE = 20;
|
|
9
|
+
var DEFAULT_API_URL = "https://veo-backend-production-8c78.up.railway.app";
|
|
10
|
+
|
|
11
|
+
// src/core/api-url.ts
|
|
12
|
+
function resolveApiUrl(config) {
|
|
13
|
+
const fromConfig = config?.apiUrl;
|
|
14
|
+
if (typeof fromConfig === "string" && fromConfig.trim()) return fromConfig;
|
|
15
|
+
const fromGlobal = globalThis.__VEO_API_URL__;
|
|
16
|
+
if (typeof fromGlobal === "string" && fromGlobal.trim()) return fromGlobal;
|
|
17
|
+
return DEFAULT_API_URL;
|
|
18
|
+
}
|
|
19
|
+
|
|
5
20
|
// src/utils/safe-env.ts
|
|
6
21
|
function hasWindow() {
|
|
7
22
|
return typeof window !== "undefined";
|
|
@@ -455,11 +470,6 @@ function spaRouterPlugin() {
|
|
|
455
470
|
});
|
|
456
471
|
}
|
|
457
472
|
|
|
458
|
-
// src/contract/v1.ts
|
|
459
|
-
var SDK_VERSION = "0.0.1";
|
|
460
|
-
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
461
|
-
var DEFAULT_FLUSH_BATCH_SIZE = 20;
|
|
462
|
-
|
|
463
473
|
// src/utils/uuid.ts
|
|
464
474
|
function uuidv7() {
|
|
465
475
|
const timestamp = Date.now();
|
|
@@ -791,12 +801,11 @@ var Client = class {
|
|
|
791
801
|
identify: /* @__PURE__ */ new Set()
|
|
792
802
|
};
|
|
793
803
|
if (!config.apiKey) throw new Error("apiKey is required");
|
|
794
|
-
if (!config.apiUrl) throw new Error("apiUrl is required");
|
|
795
804
|
this.storage = createStorage(config.storage ?? "localStorage");
|
|
796
805
|
this.session = new Session(this.storage);
|
|
797
806
|
this.transport = new Transport({
|
|
798
807
|
apiKey: config.apiKey,
|
|
799
|
-
apiUrl: config.
|
|
808
|
+
apiUrl: resolveApiUrl(config).replace(/\/$/, ""),
|
|
800
809
|
sdkVersion: SDK_VERSION
|
|
801
810
|
});
|
|
802
811
|
this.queue = new Queue({
|
|
@@ -1000,7 +1009,7 @@ function setupClient(config, onGuides) {
|
|
|
1000
1009
|
...config.builderUrl !== void 0 ? { builderUrl: config.builderUrl } : {},
|
|
1001
1010
|
...config.debug !== void 0 ? { debug: config.debug } : {},
|
|
1002
1011
|
...config.apiKey !== void 0 ? { apiKey: config.apiKey } : {},
|
|
1003
|
-
|
|
1012
|
+
apiUrl: resolveApiUrl(config)
|
|
1004
1013
|
});
|
|
1005
1014
|
}
|
|
1006
1015
|
return client;
|
|
@@ -3547,12 +3556,13 @@ function guidesPlugin(config) {
|
|
|
3547
3556
|
|
|
3548
3557
|
// src/index.ts
|
|
3549
3558
|
function init(config) {
|
|
3559
|
+
const apiUrl = resolveApiUrl(config);
|
|
3550
3560
|
return setupClient(config, (client) => {
|
|
3551
3561
|
const previewToken = getPreviewToken();
|
|
3552
3562
|
if (config.guides === true && !isBuilderMode() && previewToken === null) {
|
|
3553
3563
|
client.use(
|
|
3554
3564
|
guidesPlugin({
|
|
3555
|
-
apiUrl
|
|
3565
|
+
apiUrl,
|
|
3556
3566
|
apiKey: config.apiKey,
|
|
3557
3567
|
...config.debug !== void 0 ? { debug: config.debug } : {}
|
|
3558
3568
|
})
|
|
@@ -3561,7 +3571,7 @@ function init(config) {
|
|
|
3561
3571
|
if (previewToken !== null) {
|
|
3562
3572
|
void runPreviewMode({
|
|
3563
3573
|
apiKey: config.apiKey,
|
|
3564
|
-
apiUrl
|
|
3574
|
+
apiUrl,
|
|
3565
3575
|
token: previewToken,
|
|
3566
3576
|
...config.debug !== void 0 ? { debug: config.debug } : {}
|
|
3567
3577
|
});
|