@genvoris/node 1.0.1 → 1.1.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.
- package/README.md +53 -1
- package/dist/index.d.mts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +53 -1
- package/dist/index.mjs +53 -1
- package/package.json +1 -1
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,7 +170,7 @@ The client automatically retries `429`, `502`, `503`, and `504` responses using
|
|
|
118
170
|
|
|
119
171
|
```ts
|
|
120
172
|
const gv = new Genvoris({
|
|
121
|
-
apiKey:
|
|
173
|
+
apiKey: process.env.GENVORIS_API_KEY!,
|
|
122
174
|
baseUrl: 'https://genvoris.org/api/v1', // default
|
|
123
175
|
timeoutMs: 30_000, // default 30 s
|
|
124
176
|
maxRetries: 3, // default 3
|
package/dist/index.d.mts
CHANGED
|
@@ -283,6 +283,82 @@ declare class WebhooksResource {
|
|
|
283
283
|
static verify<T extends Record<string, unknown> = Record<string, unknown>>({ payload, header, secret, toleranceSeconds, }: WebhookVerifyOptions): GenvorisEvent<T>;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
type WidgetEventType = 'WIDGET_OPENED' | 'PHOTO_UPLOADED' | 'TRYON_GENERATED' | 'TRYON_VIEWED' | 'RESULT_SHARED' | 'ADDED_TO_CART' | 'CHECKOUT_STARTED' | 'CLOSED';
|
|
287
|
+
interface WidgetEventInput {
|
|
288
|
+
sessionId: string;
|
|
289
|
+
eventType: WidgetEventType;
|
|
290
|
+
productId?: string;
|
|
291
|
+
productTitle?: string;
|
|
292
|
+
pageUrl?: string;
|
|
293
|
+
metadata?: Record<string, unknown>;
|
|
294
|
+
}
|
|
295
|
+
interface EventBatchInput {
|
|
296
|
+
events: WidgetEventInput[];
|
|
297
|
+
}
|
|
298
|
+
interface EventsAccepted {
|
|
299
|
+
accepted: number;
|
|
300
|
+
}
|
|
301
|
+
declare class EventsResource {
|
|
302
|
+
private readonly config;
|
|
303
|
+
constructor(config: GenvorisConfig);
|
|
304
|
+
/** Track one hosted-widget funnel event. */
|
|
305
|
+
track(event: WidgetEventInput): Promise<EventsAccepted>;
|
|
306
|
+
/** Track a batch of 1–50 hosted-widget funnel events. */
|
|
307
|
+
trackBatch(events: WidgetEventInput[]): Promise<EventsAccepted>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type ConversionPlatform = 'shopify' | 'woocommerce' | 'custom';
|
|
311
|
+
interface ConversionCreateParams {
|
|
312
|
+
/** Platform order ID. Duplicate order IDs are idempotently deduped per merchant/platform. */
|
|
313
|
+
orderId: string;
|
|
314
|
+
platform: ConversionPlatform;
|
|
315
|
+
/** Order value in integer cents. */
|
|
316
|
+
amountCents: number;
|
|
317
|
+
/** ISO 4217 currency code. Defaults to USD server-side. */
|
|
318
|
+
currency?: string;
|
|
319
|
+
quantity?: number;
|
|
320
|
+
productId?: string;
|
|
321
|
+
productTitle?: string;
|
|
322
|
+
/** Widget session ID for hard attribution. */
|
|
323
|
+
sessionId?: string;
|
|
324
|
+
/** Hashed by the portal before storage. */
|
|
325
|
+
customerEmail?: string;
|
|
326
|
+
/** Soft-attribution lookback window. Default: 1440 minutes. */
|
|
327
|
+
attributionWindowMinutes?: number;
|
|
328
|
+
}
|
|
329
|
+
interface ConversionEvent {
|
|
330
|
+
id: string;
|
|
331
|
+
attributedFromTryOn: boolean;
|
|
332
|
+
deduped?: boolean;
|
|
333
|
+
}
|
|
334
|
+
declare class ConversionsResource {
|
|
335
|
+
private readonly config;
|
|
336
|
+
constructor(config: GenvorisConfig);
|
|
337
|
+
/** Store an order conversion for attribution/lift analytics. */
|
|
338
|
+
create(params: ConversionCreateParams): Promise<ConversionEvent>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface ReturnCreateParams {
|
|
342
|
+
/** Platform order ID matching a conversion when possible. */
|
|
343
|
+
orderId: string;
|
|
344
|
+
platform: ConversionPlatform;
|
|
345
|
+
/** Refunded amount in integer cents. */
|
|
346
|
+
refundedAmountCents: number;
|
|
347
|
+
/** ISO 4217 currency code. Defaults to USD server-side. */
|
|
348
|
+
currency?: string;
|
|
349
|
+
reason?: string;
|
|
350
|
+
}
|
|
351
|
+
interface ReturnEvent {
|
|
352
|
+
id: string;
|
|
353
|
+
conversionEventId: string | null;
|
|
354
|
+
}
|
|
355
|
+
declare class ReturnsResource {
|
|
356
|
+
private readonly config;
|
|
357
|
+
constructor(config: GenvorisConfig);
|
|
358
|
+
/** Store a return/refund event for conversion and returns-saved analytics. */
|
|
359
|
+
create(params: ReturnCreateParams): Promise<ReturnEvent>;
|
|
360
|
+
}
|
|
361
|
+
|
|
286
362
|
declare class GenvorisAPIError extends Error {
|
|
287
363
|
readonly status: number;
|
|
288
364
|
readonly code: string;
|
|
@@ -340,7 +416,10 @@ declare class Genvoris {
|
|
|
340
416
|
readonly plans: PlansResource;
|
|
341
417
|
readonly sessions: SessionsResource;
|
|
342
418
|
readonly webhooks: WebhooksResource;
|
|
419
|
+
readonly events: EventsResource;
|
|
420
|
+
readonly conversions: ConversionsResource;
|
|
421
|
+
readonly returns: ReturnsResource;
|
|
343
422
|
constructor(config: GenvorisConfig);
|
|
344
423
|
}
|
|
345
424
|
|
|
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 };
|
|
425
|
+
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
|
@@ -283,6 +283,82 @@ declare class WebhooksResource {
|
|
|
283
283
|
static verify<T extends Record<string, unknown> = Record<string, unknown>>({ payload, header, secret, toleranceSeconds, }: WebhookVerifyOptions): GenvorisEvent<T>;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
type WidgetEventType = 'WIDGET_OPENED' | 'PHOTO_UPLOADED' | 'TRYON_GENERATED' | 'TRYON_VIEWED' | 'RESULT_SHARED' | 'ADDED_TO_CART' | 'CHECKOUT_STARTED' | 'CLOSED';
|
|
287
|
+
interface WidgetEventInput {
|
|
288
|
+
sessionId: string;
|
|
289
|
+
eventType: WidgetEventType;
|
|
290
|
+
productId?: string;
|
|
291
|
+
productTitle?: string;
|
|
292
|
+
pageUrl?: string;
|
|
293
|
+
metadata?: Record<string, unknown>;
|
|
294
|
+
}
|
|
295
|
+
interface EventBatchInput {
|
|
296
|
+
events: WidgetEventInput[];
|
|
297
|
+
}
|
|
298
|
+
interface EventsAccepted {
|
|
299
|
+
accepted: number;
|
|
300
|
+
}
|
|
301
|
+
declare class EventsResource {
|
|
302
|
+
private readonly config;
|
|
303
|
+
constructor(config: GenvorisConfig);
|
|
304
|
+
/** Track one hosted-widget funnel event. */
|
|
305
|
+
track(event: WidgetEventInput): Promise<EventsAccepted>;
|
|
306
|
+
/** Track a batch of 1–50 hosted-widget funnel events. */
|
|
307
|
+
trackBatch(events: WidgetEventInput[]): Promise<EventsAccepted>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type ConversionPlatform = 'shopify' | 'woocommerce' | 'custom';
|
|
311
|
+
interface ConversionCreateParams {
|
|
312
|
+
/** Platform order ID. Duplicate order IDs are idempotently deduped per merchant/platform. */
|
|
313
|
+
orderId: string;
|
|
314
|
+
platform: ConversionPlatform;
|
|
315
|
+
/** Order value in integer cents. */
|
|
316
|
+
amountCents: number;
|
|
317
|
+
/** ISO 4217 currency code. Defaults to USD server-side. */
|
|
318
|
+
currency?: string;
|
|
319
|
+
quantity?: number;
|
|
320
|
+
productId?: string;
|
|
321
|
+
productTitle?: string;
|
|
322
|
+
/** Widget session ID for hard attribution. */
|
|
323
|
+
sessionId?: string;
|
|
324
|
+
/** Hashed by the portal before storage. */
|
|
325
|
+
customerEmail?: string;
|
|
326
|
+
/** Soft-attribution lookback window. Default: 1440 minutes. */
|
|
327
|
+
attributionWindowMinutes?: number;
|
|
328
|
+
}
|
|
329
|
+
interface ConversionEvent {
|
|
330
|
+
id: string;
|
|
331
|
+
attributedFromTryOn: boolean;
|
|
332
|
+
deduped?: boolean;
|
|
333
|
+
}
|
|
334
|
+
declare class ConversionsResource {
|
|
335
|
+
private readonly config;
|
|
336
|
+
constructor(config: GenvorisConfig);
|
|
337
|
+
/** Store an order conversion for attribution/lift analytics. */
|
|
338
|
+
create(params: ConversionCreateParams): Promise<ConversionEvent>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface ReturnCreateParams {
|
|
342
|
+
/** Platform order ID matching a conversion when possible. */
|
|
343
|
+
orderId: string;
|
|
344
|
+
platform: ConversionPlatform;
|
|
345
|
+
/** Refunded amount in integer cents. */
|
|
346
|
+
refundedAmountCents: number;
|
|
347
|
+
/** ISO 4217 currency code. Defaults to USD server-side. */
|
|
348
|
+
currency?: string;
|
|
349
|
+
reason?: string;
|
|
350
|
+
}
|
|
351
|
+
interface ReturnEvent {
|
|
352
|
+
id: string;
|
|
353
|
+
conversionEventId: string | null;
|
|
354
|
+
}
|
|
355
|
+
declare class ReturnsResource {
|
|
356
|
+
private readonly config;
|
|
357
|
+
constructor(config: GenvorisConfig);
|
|
358
|
+
/** Store a return/refund event for conversion and returns-saved analytics. */
|
|
359
|
+
create(params: ReturnCreateParams): Promise<ReturnEvent>;
|
|
360
|
+
}
|
|
361
|
+
|
|
286
362
|
declare class GenvorisAPIError extends Error {
|
|
287
363
|
readonly status: number;
|
|
288
364
|
readonly code: string;
|
|
@@ -340,7 +416,10 @@ declare class Genvoris {
|
|
|
340
416
|
readonly plans: PlansResource;
|
|
341
417
|
readonly sessions: SessionsResource;
|
|
342
418
|
readonly webhooks: WebhooksResource;
|
|
419
|
+
readonly events: EventsResource;
|
|
420
|
+
readonly conversions: ConversionsResource;
|
|
421
|
+
readonly returns: ReturnsResource;
|
|
343
422
|
constructor(config: GenvorisConfig);
|
|
344
423
|
}
|
|
345
424
|
|
|
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 };
|
|
425
|
+
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
|
@@ -64,7 +64,7 @@ var GenvorisValidationError = class extends GenvorisAPIError {
|
|
|
64
64
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
|
|
65
65
|
var MAX_DELAY_MS = 8e3;
|
|
66
66
|
var DEFAULT_BASE_URL = "https://genvoris.org/api/v1";
|
|
67
|
-
var SDK_VERSION = "1.
|
|
67
|
+
var SDK_VERSION = "1.1.0";
|
|
68
68
|
function sleep(ms) {
|
|
69
69
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
70
70
|
}
|
|
@@ -393,6 +393,55 @@ var WebhooksResource = class {
|
|
|
393
393
|
}
|
|
394
394
|
};
|
|
395
395
|
|
|
396
|
+
// src/resources/events.ts
|
|
397
|
+
var EventsResource = class {
|
|
398
|
+
constructor(config) {
|
|
399
|
+
this.config = config;
|
|
400
|
+
}
|
|
401
|
+
/** Track one hosted-widget funnel event. */
|
|
402
|
+
track(event) {
|
|
403
|
+
return request(this.config, "/events", {
|
|
404
|
+
method: "POST",
|
|
405
|
+
body: event
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/** Track a batch of 1–50 hosted-widget funnel events. */
|
|
409
|
+
trackBatch(events) {
|
|
410
|
+
return request(this.config, "/events", {
|
|
411
|
+
method: "POST",
|
|
412
|
+
body: { events }
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/resources/conversions.ts
|
|
418
|
+
var ConversionsResource = class {
|
|
419
|
+
constructor(config) {
|
|
420
|
+
this.config = config;
|
|
421
|
+
}
|
|
422
|
+
/** Store an order conversion for attribution/lift analytics. */
|
|
423
|
+
create(params) {
|
|
424
|
+
return request(this.config, "/conversions", {
|
|
425
|
+
method: "POST",
|
|
426
|
+
body: params
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/resources/returns.ts
|
|
432
|
+
var ReturnsResource = class {
|
|
433
|
+
constructor(config) {
|
|
434
|
+
this.config = config;
|
|
435
|
+
}
|
|
436
|
+
/** Store a return/refund event for conversion and returns-saved analytics. */
|
|
437
|
+
create(params) {
|
|
438
|
+
return request(this.config, "/returns", {
|
|
439
|
+
method: "POST",
|
|
440
|
+
body: params
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
396
445
|
// src/index.ts
|
|
397
446
|
var Genvoris = class {
|
|
398
447
|
constructor(config) {
|
|
@@ -403,6 +452,9 @@ var Genvoris = class {
|
|
|
403
452
|
this.plans = new PlansResource(config);
|
|
404
453
|
this.sessions = new SessionsResource(config);
|
|
405
454
|
this.webhooks = new WebhooksResource(config);
|
|
455
|
+
this.events = new EventsResource(config);
|
|
456
|
+
this.conversions = new ConversionsResource(config);
|
|
457
|
+
this.returns = new ReturnsResource(config);
|
|
406
458
|
}
|
|
407
459
|
};
|
|
408
460
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ var GenvorisValidationError = class extends GenvorisAPIError {
|
|
|
33
33
|
var RETRY_STATUSES = /* @__PURE__ */ new Set([429, 502, 503, 504]);
|
|
34
34
|
var MAX_DELAY_MS = 8e3;
|
|
35
35
|
var DEFAULT_BASE_URL = "https://genvoris.org/api/v1";
|
|
36
|
-
var SDK_VERSION = "1.
|
|
36
|
+
var SDK_VERSION = "1.1.0";
|
|
37
37
|
function sleep(ms) {
|
|
38
38
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
39
39
|
}
|
|
@@ -362,6 +362,55 @@ var WebhooksResource = class {
|
|
|
362
362
|
}
|
|
363
363
|
};
|
|
364
364
|
|
|
365
|
+
// src/resources/events.ts
|
|
366
|
+
var EventsResource = class {
|
|
367
|
+
constructor(config) {
|
|
368
|
+
this.config = config;
|
|
369
|
+
}
|
|
370
|
+
/** Track one hosted-widget funnel event. */
|
|
371
|
+
track(event) {
|
|
372
|
+
return request(this.config, "/events", {
|
|
373
|
+
method: "POST",
|
|
374
|
+
body: event
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Track a batch of 1–50 hosted-widget funnel events. */
|
|
378
|
+
trackBatch(events) {
|
|
379
|
+
return request(this.config, "/events", {
|
|
380
|
+
method: "POST",
|
|
381
|
+
body: { events }
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// src/resources/conversions.ts
|
|
387
|
+
var ConversionsResource = class {
|
|
388
|
+
constructor(config) {
|
|
389
|
+
this.config = config;
|
|
390
|
+
}
|
|
391
|
+
/** Store an order conversion for attribution/lift analytics. */
|
|
392
|
+
create(params) {
|
|
393
|
+
return request(this.config, "/conversions", {
|
|
394
|
+
method: "POST",
|
|
395
|
+
body: params
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// src/resources/returns.ts
|
|
401
|
+
var ReturnsResource = class {
|
|
402
|
+
constructor(config) {
|
|
403
|
+
this.config = config;
|
|
404
|
+
}
|
|
405
|
+
/** Store a return/refund event for conversion and returns-saved analytics. */
|
|
406
|
+
create(params) {
|
|
407
|
+
return request(this.config, "/returns", {
|
|
408
|
+
method: "POST",
|
|
409
|
+
body: params
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
365
414
|
// src/index.ts
|
|
366
415
|
var Genvoris = class {
|
|
367
416
|
constructor(config) {
|
|
@@ -372,6 +421,9 @@ var Genvoris = class {
|
|
|
372
421
|
this.plans = new PlansResource(config);
|
|
373
422
|
this.sessions = new SessionsResource(config);
|
|
374
423
|
this.webhooks = new WebhooksResource(config);
|
|
424
|
+
this.events = new EventsResource(config);
|
|
425
|
+
this.conversions = new ConversionsResource(config);
|
|
426
|
+
this.returns = new ReturnsResource(config);
|
|
375
427
|
}
|
|
376
428
|
};
|
|
377
429
|
export {
|