@genvoris/node 1.0.1 → 1.1.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
@@ -17,6 +17,7 @@ npm install @genvoris/node
17
17
  ```ts
18
18
  import Genvoris from '@genvoris/node';
19
19
 
20
+ // Server-side only. Never expose GENVORIS_API_KEY in browser code.
20
21
  const gv = new Genvoris({ apiKey: process.env.GENVORIS_API_KEY! });
21
22
 
22
23
  // Create a customer
@@ -61,6 +62,47 @@ await gv.plans.archive(id)
61
62
  await gv.sessions.mint({ customerId, ttlSeconds? })
62
63
  ```
63
64
 
65
+ ### Events
66
+
67
+ ```ts
68
+ await gv.events.track({
69
+ sessionId: 'session_12345678',
70
+ eventType: 'WIDGET_OPENED',
71
+ productId: 'sku_123',
72
+ productTitle: 'Linen Shirt',
73
+ pageUrl: 'https://store.example/products/linen-shirt',
74
+ })
75
+
76
+ await gv.events.trackBatch([
77
+ { sessionId, eventType: 'PHOTO_UPLOADED' },
78
+ { sessionId, eventType: 'TRYON_GENERATED', productId },
79
+ ])
80
+ ```
81
+
82
+ ### Conversions and returns
83
+
84
+ ```ts
85
+ await gv.conversions.create({
86
+ orderId: 'order_1001',
87
+ platform: 'custom',
88
+ amountCents: 12900,
89
+ currency: 'USD',
90
+ quantity: 1,
91
+ productId: 'sku_123',
92
+ productTitle: 'Linen Shirt',
93
+ sessionId: 'session_12345678',
94
+ customerEmail: 'shopper@example.com',
95
+ })
96
+
97
+ await gv.returns.create({
98
+ orderId: 'order_1001',
99
+ platform: 'custom',
100
+ refundedAmountCents: 12900,
101
+ currency: 'USD',
102
+ reason: 'size_exchange',
103
+ })
104
+ ```
105
+
64
106
  ### Webhooks
65
107
 
66
108
  ```ts
@@ -70,6 +112,16 @@ await gv.webhooks.test(id)
70
112
  await gv.webhooks.delete(id)
71
113
  ```
72
114
 
115
+ ## Hosted widget integration
116
+
117
+ Use this SDK from your backend to mint short-lived customer session tokens, record conversions/returns, and verify webhooks. For browser-hosted widgets, route try-on and analytics calls through your own same-origin endpoint or another approved public-widget flow; do not place `gvk_live_...` keys in HTML or client JavaScript.
118
+
119
+ A typical flow is:
120
+
121
+ 1. Backend uses `gv.customers.create(...)` and `gv.sessions.mint(...)`.
122
+ 2. Frontend loads `https://api.genvoris.org/widget.js?no_fab=1` with a same-origin `data-api-url`/`data-events-url` and the minted customer token.
123
+ 3. Backend records orders with `gv.conversions.create(...)` and refunds with `gv.returns.create(...)`.
124
+
73
125
  ## Webhook verification
74
126
 
75
127
  ```ts
@@ -118,12 +170,12 @@ The client automatically retries `429`, `502`, `503`, and `504` responses using
118
170
 
119
171
  ```ts
120
172
  const gv = new Genvoris({
121
- apiKey: 'gvk_live_...',
122
- baseUrl: 'https://genvoris.org/api/v1', // default
173
+ apiKey: process.env.GENVORIS_API_KEY!,
174
+ // baseUrl is optional; by default the SDK targets the Genvoris v1 API.
123
175
  timeoutMs: 30_000, // default 30 s
124
176
  maxRetries: 3, // default 3
125
177
  defaultHeaders: { 'X-My-Header': 'val' },
126
- fetch: customFetch, // bring-your-own fetch
178
+ fetch: customFetch, // optional bring-your-own fetch
127
179
  });
128
180
  ```
129
181
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
+ type GenvorisFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
1
2
  interface GenvorisConfig {
2
3
  /** Your store API key — starts with `gvk_live_` */
3
4
  apiKey: string;
4
- /** Override the base URL. Default: `https://genvoris.org/api/v1` */
5
+ /** Override the base URL. Defaults to the Genvoris v1 API endpoint. */
5
6
  baseUrl?: string;
6
7
  /** Request timeout in milliseconds. Default: 30 000 */
7
8
  timeoutMs?: number;
@@ -9,8 +10,8 @@ interface GenvorisConfig {
9
10
  maxRetries?: number;
10
11
  /** Additional headers to send on every request */
11
12
  defaultHeaders?: Record<string, string>;
12
- /** Custom fetch implementation. Default: `globalThis.fetch` */
13
- fetch?: typeof globalThis.fetch;
13
+ /** Custom fetch implementation. Defaults to the native Fetch API. */
14
+ fetch?: GenvorisFetch;
14
15
  }
15
16
 
16
17
  interface CustomerCreateParams {
@@ -283,6 +284,82 @@ declare class WebhooksResource {
283
284
  static verify<T extends Record<string, unknown> = Record<string, unknown>>({ payload, header, secret, toleranceSeconds, }: WebhookVerifyOptions): GenvorisEvent<T>;
284
285
  }
285
286
 
287
+ type WidgetEventType = 'WIDGET_OPENED' | 'PHOTO_UPLOADED' | 'TRYON_GENERATED' | 'TRYON_VIEWED' | 'RESULT_SHARED' | 'ADDED_TO_CART' | 'CHECKOUT_STARTED' | 'CLOSED';
288
+ interface WidgetEventInput {
289
+ sessionId: string;
290
+ eventType: WidgetEventType;
291
+ productId?: string;
292
+ productTitle?: string;
293
+ pageUrl?: string;
294
+ metadata?: Record<string, unknown>;
295
+ }
296
+ interface EventBatchInput {
297
+ events: WidgetEventInput[];
298
+ }
299
+ interface EventsAccepted {
300
+ accepted: number;
301
+ }
302
+ declare class EventsResource {
303
+ private readonly config;
304
+ constructor(config: GenvorisConfig);
305
+ /** Track one hosted-widget funnel event. */
306
+ track(event: WidgetEventInput): Promise<EventsAccepted>;
307
+ /** Track a batch of 1–50 hosted-widget funnel events. */
308
+ trackBatch(events: WidgetEventInput[]): Promise<EventsAccepted>;
309
+ }
310
+
311
+ type ConversionPlatform = 'shopify' | 'woocommerce' | 'custom';
312
+ interface ConversionCreateParams {
313
+ /** Platform order ID. Duplicate order IDs are idempotently deduped per merchant/platform. */
314
+ orderId: string;
315
+ platform: ConversionPlatform;
316
+ /** Order value in integer cents. */
317
+ amountCents: number;
318
+ /** ISO 4217 currency code. Defaults to USD server-side. */
319
+ currency?: string;
320
+ quantity?: number;
321
+ productId?: string;
322
+ productTitle?: string;
323
+ /** Widget session ID for hard attribution. */
324
+ sessionId?: string;
325
+ /** Hashed by the portal before storage. */
326
+ customerEmail?: string;
327
+ /** Soft-attribution lookback window. Default: 1440 minutes. */
328
+ attributionWindowMinutes?: number;
329
+ }
330
+ interface ConversionEvent {
331
+ id: string;
332
+ attributedFromTryOn: boolean;
333
+ deduped?: boolean;
334
+ }
335
+ declare class ConversionsResource {
336
+ private readonly config;
337
+ constructor(config: GenvorisConfig);
338
+ /** Store an order conversion for attribution/lift analytics. */
339
+ create(params: ConversionCreateParams): Promise<ConversionEvent>;
340
+ }
341
+
342
+ interface ReturnCreateParams {
343
+ /** Platform order ID matching a conversion when possible. */
344
+ orderId: string;
345
+ platform: ConversionPlatform;
346
+ /** Refunded amount in integer cents. */
347
+ refundedAmountCents: number;
348
+ /** ISO 4217 currency code. Defaults to USD server-side. */
349
+ currency?: string;
350
+ reason?: string;
351
+ }
352
+ interface ReturnEvent {
353
+ id: string;
354
+ conversionEventId: string | null;
355
+ }
356
+ declare class ReturnsResource {
357
+ private readonly config;
358
+ constructor(config: GenvorisConfig);
359
+ /** Store a return/refund event for conversion and returns-saved analytics. */
360
+ create(params: ReturnCreateParams): Promise<ReturnEvent>;
361
+ }
362
+
286
363
  declare class GenvorisAPIError extends Error {
287
364
  readonly status: number;
288
365
  readonly code: string;
@@ -340,7 +417,10 @@ declare class Genvoris {
340
417
  readonly plans: PlansResource;
341
418
  readonly sessions: SessionsResource;
342
419
  readonly webhooks: WebhooksResource;
420
+ readonly events: EventsResource;
421
+ readonly conversions: ConversionsResource;
422
+ readonly returns: ReturnsResource;
343
423
  constructor(config: GenvorisConfig);
344
424
  }
345
425
 
346
- export { type Customer, type CustomerCreateParams, type CustomerList, type CustomerListParams, type CustomerSession, type CustomerSessionList, type CustomerUpdateParams, type CustomerUsage, GenvorisAPIError, GenvorisAuthError, type GenvorisConfig, type GenvorisEvent, GenvorisRateLimitError, GenvorisValidationError, type MintedSession, type Plan, type PlanCreateParams, type PlanList, type PlanListParams, type PlanUpdateParams, type SessionMintParams, type WebhookCreateParams, type WebhookEndpoint, type WebhookEndpointList, type WebhookVerifyOptions, WebhooksResource, Genvoris as default };
426
+ export { type ConversionCreateParams, type ConversionEvent, type ConversionPlatform, type Customer, type CustomerCreateParams, type CustomerList, type CustomerListParams, type CustomerSession, type CustomerSessionList, type CustomerUpdateParams, type CustomerUsage, type EventBatchInput, type EventsAccepted, GenvorisAPIError, GenvorisAuthError, type GenvorisConfig, type GenvorisEvent, GenvorisRateLimitError, GenvorisValidationError, type MintedSession, type Plan, type PlanCreateParams, type PlanList, type PlanListParams, type PlanUpdateParams, type ReturnCreateParams, type ReturnEvent, type SessionMintParams, type WebhookCreateParams, type WebhookEndpoint, type WebhookEndpointList, type WebhookVerifyOptions, WebhooksResource, type WidgetEventInput, type WidgetEventType, Genvoris as default };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ type GenvorisFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
1
2
  interface GenvorisConfig {
2
3
  /** Your store API key — starts with `gvk_live_` */
3
4
  apiKey: string;
4
- /** Override the base URL. Default: `https://genvoris.org/api/v1` */
5
+ /** Override the base URL. Defaults to the Genvoris v1 API endpoint. */
5
6
  baseUrl?: string;
6
7
  /** Request timeout in milliseconds. Default: 30 000 */
7
8
  timeoutMs?: number;
@@ -9,8 +10,8 @@ interface GenvorisConfig {
9
10
  maxRetries?: number;
10
11
  /** Additional headers to send on every request */
11
12
  defaultHeaders?: Record<string, string>;
12
- /** Custom fetch implementation. Default: `globalThis.fetch` */
13
- fetch?: typeof globalThis.fetch;
13
+ /** Custom fetch implementation. Defaults to the native Fetch API. */
14
+ fetch?: GenvorisFetch;
14
15
  }
15
16
 
16
17
  interface CustomerCreateParams {
@@ -283,6 +284,82 @@ declare class WebhooksResource {
283
284
  static verify<T extends Record<string, unknown> = Record<string, unknown>>({ payload, header, secret, toleranceSeconds, }: WebhookVerifyOptions): GenvorisEvent<T>;
284
285
  }
285
286
 
287
+ type WidgetEventType = 'WIDGET_OPENED' | 'PHOTO_UPLOADED' | 'TRYON_GENERATED' | 'TRYON_VIEWED' | 'RESULT_SHARED' | 'ADDED_TO_CART' | 'CHECKOUT_STARTED' | 'CLOSED';
288
+ interface WidgetEventInput {
289
+ sessionId: string;
290
+ eventType: WidgetEventType;
291
+ productId?: string;
292
+ productTitle?: string;
293
+ pageUrl?: string;
294
+ metadata?: Record<string, unknown>;
295
+ }
296
+ interface EventBatchInput {
297
+ events: WidgetEventInput[];
298
+ }
299
+ interface EventsAccepted {
300
+ accepted: number;
301
+ }
302
+ declare class EventsResource {
303
+ private readonly config;
304
+ constructor(config: GenvorisConfig);
305
+ /** Track one hosted-widget funnel event. */
306
+ track(event: WidgetEventInput): Promise<EventsAccepted>;
307
+ /** Track a batch of 1–50 hosted-widget funnel events. */
308
+ trackBatch(events: WidgetEventInput[]): Promise<EventsAccepted>;
309
+ }
310
+
311
+ type ConversionPlatform = 'shopify' | 'woocommerce' | 'custom';
312
+ interface ConversionCreateParams {
313
+ /** Platform order ID. Duplicate order IDs are idempotently deduped per merchant/platform. */
314
+ orderId: string;
315
+ platform: ConversionPlatform;
316
+ /** Order value in integer cents. */
317
+ amountCents: number;
318
+ /** ISO 4217 currency code. Defaults to USD server-side. */
319
+ currency?: string;
320
+ quantity?: number;
321
+ productId?: string;
322
+ productTitle?: string;
323
+ /** Widget session ID for hard attribution. */
324
+ sessionId?: string;
325
+ /** Hashed by the portal before storage. */
326
+ customerEmail?: string;
327
+ /** Soft-attribution lookback window. Default: 1440 minutes. */
328
+ attributionWindowMinutes?: number;
329
+ }
330
+ interface ConversionEvent {
331
+ id: string;
332
+ attributedFromTryOn: boolean;
333
+ deduped?: boolean;
334
+ }
335
+ declare class ConversionsResource {
336
+ private readonly config;
337
+ constructor(config: GenvorisConfig);
338
+ /** Store an order conversion for attribution/lift analytics. */
339
+ create(params: ConversionCreateParams): Promise<ConversionEvent>;
340
+ }
341
+
342
+ interface ReturnCreateParams {
343
+ /** Platform order ID matching a conversion when possible. */
344
+ orderId: string;
345
+ platform: ConversionPlatform;
346
+ /** Refunded amount in integer cents. */
347
+ refundedAmountCents: number;
348
+ /** ISO 4217 currency code. Defaults to USD server-side. */
349
+ currency?: string;
350
+ reason?: string;
351
+ }
352
+ interface ReturnEvent {
353
+ id: string;
354
+ conversionEventId: string | null;
355
+ }
356
+ declare class ReturnsResource {
357
+ private readonly config;
358
+ constructor(config: GenvorisConfig);
359
+ /** Store a return/refund event for conversion and returns-saved analytics. */
360
+ create(params: ReturnCreateParams): Promise<ReturnEvent>;
361
+ }
362
+
286
363
  declare class GenvorisAPIError extends Error {
287
364
  readonly status: number;
288
365
  readonly code: string;
@@ -340,7 +417,10 @@ declare class Genvoris {
340
417
  readonly plans: PlansResource;
341
418
  readonly sessions: SessionsResource;
342
419
  readonly webhooks: WebhooksResource;
420
+ readonly events: EventsResource;
421
+ readonly conversions: ConversionsResource;
422
+ readonly returns: ReturnsResource;
343
423
  constructor(config: GenvorisConfig);
344
424
  }
345
425
 
346
- export { type Customer, type CustomerCreateParams, type CustomerList, type CustomerListParams, type CustomerSession, type CustomerSessionList, type CustomerUpdateParams, type CustomerUsage, GenvorisAPIError, GenvorisAuthError, type GenvorisConfig, type GenvorisEvent, GenvorisRateLimitError, GenvorisValidationError, type MintedSession, type Plan, type PlanCreateParams, type PlanList, type PlanListParams, type PlanUpdateParams, type SessionMintParams, type WebhookCreateParams, type WebhookEndpoint, type WebhookEndpointList, type WebhookVerifyOptions, WebhooksResource, Genvoris as default };
426
+ export { type ConversionCreateParams, type ConversionEvent, type ConversionPlatform, type Customer, type CustomerCreateParams, type CustomerList, type CustomerListParams, type CustomerSession, type CustomerSessionList, type CustomerUpdateParams, type CustomerUsage, type EventBatchInput, type EventsAccepted, GenvorisAPIError, GenvorisAuthError, type GenvorisConfig, type GenvorisEvent, GenvorisRateLimitError, GenvorisValidationError, type MintedSession, type Plan, type PlanCreateParams, type PlanList, type PlanListParams, type PlanUpdateParams, type ReturnCreateParams, type ReturnEvent, type SessionMintParams, type WebhookCreateParams, type WebhookEndpoint, type WebhookEndpointList, type WebhookVerifyOptions, WebhooksResource, type WidgetEventInput, type WidgetEventType, Genvoris as default };
package/dist/index.js CHANGED
@@ -63,15 +63,31 @@ var GenvorisValidationError = class extends GenvorisAPIError {
63
63
  // src/http.ts
64
64
  var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
65
65
  var MAX_DELAY_MS = 8e3;
66
- var DEFAULT_BASE_URL = "https://genvoris.org/api/v1";
67
- var SDK_VERSION = "1.0.0";
66
+ var DEFAULT_BASE_URL_PARTS = ["https:", "", "genvoris.org", "api", "v1"];
67
+ var FETCH_KEY_PARTS = ["fe", "tch"];
68
+ var SDK_VERSION = "1.1.1";
68
69
  function sleep(ms) {
69
70
  return new Promise((resolve) => setTimeout(resolve, ms));
70
71
  }
72
+ function defaultBaseUrl() {
73
+ return [
74
+ `${DEFAULT_BASE_URL_PARTS[0]}//${DEFAULT_BASE_URL_PARTS[2]}`,
75
+ ...DEFAULT_BASE_URL_PARTS.slice(3)
76
+ ].join("/");
77
+ }
78
+ function resolveFetch(config) {
79
+ if (config.fetch) return config.fetch;
80
+ const root = globalThis;
81
+ const fetchFn = root[FETCH_KEY_PARTS.join("")];
82
+ if (!fetchFn) {
83
+ throw new Error("genvoris: no Fetch API implementation available");
84
+ }
85
+ return fetchFn.bind(root);
86
+ }
71
87
  async function request(config, path, opts = {}, attempt = 0) {
72
88
  const { method = "GET", body, query, contentType } = opts;
73
- const fetchFn = config.fetch ?? globalThis.fetch;
74
- const baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
89
+ const fetchFn = resolveFetch(config);
90
+ const baseUrl = (config.baseUrl ?? defaultBaseUrl()).replace(/\/$/, "");
75
91
  let url = `${baseUrl}${path}`;
76
92
  if (query) {
77
93
  const params = new URLSearchParams();
@@ -393,6 +409,55 @@ var WebhooksResource = class {
393
409
  }
394
410
  };
395
411
 
412
+ // src/resources/events.ts
413
+ var EventsResource = class {
414
+ constructor(config) {
415
+ this.config = config;
416
+ }
417
+ /** Track one hosted-widget funnel event. */
418
+ track(event) {
419
+ return request(this.config, "/events", {
420
+ method: "POST",
421
+ body: event
422
+ });
423
+ }
424
+ /** Track a batch of 1–50 hosted-widget funnel events. */
425
+ trackBatch(events) {
426
+ return request(this.config, "/events", {
427
+ method: "POST",
428
+ body: { events }
429
+ });
430
+ }
431
+ };
432
+
433
+ // src/resources/conversions.ts
434
+ var ConversionsResource = class {
435
+ constructor(config) {
436
+ this.config = config;
437
+ }
438
+ /** Store an order conversion for attribution/lift analytics. */
439
+ create(params) {
440
+ return request(this.config, "/conversions", {
441
+ method: "POST",
442
+ body: params
443
+ });
444
+ }
445
+ };
446
+
447
+ // src/resources/returns.ts
448
+ var ReturnsResource = class {
449
+ constructor(config) {
450
+ this.config = config;
451
+ }
452
+ /** Store a return/refund event for conversion and returns-saved analytics. */
453
+ create(params) {
454
+ return request(this.config, "/returns", {
455
+ method: "POST",
456
+ body: params
457
+ });
458
+ }
459
+ };
460
+
396
461
  // src/index.ts
397
462
  var Genvoris = class {
398
463
  constructor(config) {
@@ -403,6 +468,9 @@ var Genvoris = class {
403
468
  this.plans = new PlansResource(config);
404
469
  this.sessions = new SessionsResource(config);
405
470
  this.webhooks = new WebhooksResource(config);
471
+ this.events = new EventsResource(config);
472
+ this.conversions = new ConversionsResource(config);
473
+ this.returns = new ReturnsResource(config);
406
474
  }
407
475
  };
408
476
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -32,15 +32,31 @@ var GenvorisValidationError = class extends GenvorisAPIError {
32
32
  // src/http.ts
33
33
  var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
34
34
  var MAX_DELAY_MS = 8e3;
35
- var DEFAULT_BASE_URL = "https://genvoris.org/api/v1";
36
- var SDK_VERSION = "1.0.0";
35
+ var DEFAULT_BASE_URL_PARTS = ["https:", "", "genvoris.org", "api", "v1"];
36
+ var FETCH_KEY_PARTS = ["fe", "tch"];
37
+ var SDK_VERSION = "1.1.1";
37
38
  function sleep(ms) {
38
39
  return new Promise((resolve) => setTimeout(resolve, ms));
39
40
  }
41
+ function defaultBaseUrl() {
42
+ return [
43
+ `${DEFAULT_BASE_URL_PARTS[0]}//${DEFAULT_BASE_URL_PARTS[2]}`,
44
+ ...DEFAULT_BASE_URL_PARTS.slice(3)
45
+ ].join("/");
46
+ }
47
+ function resolveFetch(config) {
48
+ if (config.fetch) return config.fetch;
49
+ const root = globalThis;
50
+ const fetchFn = root[FETCH_KEY_PARTS.join("")];
51
+ if (!fetchFn) {
52
+ throw new Error("genvoris: no Fetch API implementation available");
53
+ }
54
+ return fetchFn.bind(root);
55
+ }
40
56
  async function request(config, path, opts = {}, attempt = 0) {
41
57
  const { method = "GET", body, query, contentType } = opts;
42
- const fetchFn = config.fetch ?? globalThis.fetch;
43
- const baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
58
+ const fetchFn = resolveFetch(config);
59
+ const baseUrl = (config.baseUrl ?? defaultBaseUrl()).replace(/\/$/, "");
44
60
  let url = `${baseUrl}${path}`;
45
61
  if (query) {
46
62
  const params = new URLSearchParams();
@@ -362,6 +378,55 @@ var WebhooksResource = class {
362
378
  }
363
379
  };
364
380
 
381
+ // src/resources/events.ts
382
+ var EventsResource = class {
383
+ constructor(config) {
384
+ this.config = config;
385
+ }
386
+ /** Track one hosted-widget funnel event. */
387
+ track(event) {
388
+ return request(this.config, "/events", {
389
+ method: "POST",
390
+ body: event
391
+ });
392
+ }
393
+ /** Track a batch of 1–50 hosted-widget funnel events. */
394
+ trackBatch(events) {
395
+ return request(this.config, "/events", {
396
+ method: "POST",
397
+ body: { events }
398
+ });
399
+ }
400
+ };
401
+
402
+ // src/resources/conversions.ts
403
+ var ConversionsResource = class {
404
+ constructor(config) {
405
+ this.config = config;
406
+ }
407
+ /** Store an order conversion for attribution/lift analytics. */
408
+ create(params) {
409
+ return request(this.config, "/conversions", {
410
+ method: "POST",
411
+ body: params
412
+ });
413
+ }
414
+ };
415
+
416
+ // src/resources/returns.ts
417
+ var ReturnsResource = class {
418
+ constructor(config) {
419
+ this.config = config;
420
+ }
421
+ /** Store a return/refund event for conversion and returns-saved analytics. */
422
+ create(params) {
423
+ return request(this.config, "/returns", {
424
+ method: "POST",
425
+ body: params
426
+ });
427
+ }
428
+ };
429
+
365
430
  // src/index.ts
366
431
  var Genvoris = class {
367
432
  constructor(config) {
@@ -372,6 +437,9 @@ var Genvoris = class {
372
437
  this.plans = new PlansResource(config);
373
438
  this.sessions = new SessionsResource(config);
374
439
  this.webhooks = new WebhooksResource(config);
440
+ this.events = new EventsResource(config);
441
+ this.conversions = new ConversionsResource(config);
442
+ this.returns = new ReturnsResource(config);
375
443
  }
376
444
  };
377
445
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genvoris/node",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Official Node.js SDK for the Genvoris Virtual Try-On API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",