@depict-ai/types
Version:
Autogenerated types of API responses used across Depict UI packages
130 lines (127 loc) • 3.44 kB
TypeScript
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* User Id. Persistent between devices, typically on a logged in user.
*/
export type UserId = string | null;
/**
* Session Id. Unique to a browser/app and stored locally, e.g. cookie or localStorage.
*/
export type SessionId = string | null;
/**
* Populated for integrations performed by Depict.ai only. Depict.ai Session Id.
*/
export type Dsid = string | null;
/**
* Unique identifier for the transaction.
*/
export type TransactionId = string;
/**
* The type identifier for this event: purchase.
*/
export type EventType = "purchase" | null;
/**
* Currency the purchase was paid in
*/
export type Currency = string;
/**
* All the products purchased in this transaction
*
* @minItems 1
*/
export type Products = [PurchasedProduct, ...PurchasedProduct[]];
/**
* Stock keeping unit, a distinct item for sale. If you are using Google Analytics, it should be the same id used for products there.
*/
export type Sku = string;
/**
* Price per unit. If there are discounts because of quantity, the unit price should be adjusted accordingly.
*/
export type Price = number;
/**
* The number of times the product was purchased.
*/
export type Quantity = number;
/**
* User Id. Persistent between devices, typically on a logged in user.
*/
export type UserId1 = string | null;
/**
* Session Id. Unique to a browser/app and stored locally, e.g. cookie or localStorage.
*/
export type SessionId1 = string | null;
/**
* Populated for integrations performed by Depict.ai only. Depict.ai Session Id.
*/
export type Dsid1 = string | null;
/**
* The type identifier for this event: product_unavailable.
*/
export type EventType1 = "product_unavailable";
/**
* Main product identifier
*/
export type ProductId = string;
export type EUnavailabilityType = "out_of_stock" | "missing";
export interface TrackV2Request {
/**
* Identifier associated with the API integration
*/
tenant: string;
/**
* Market identifier
*/
market: string;
events: (UserTransactionMappingEvent | PurchaseEvent | ProductUnavailableEvent)[];
}
export interface UserTransactionMappingEvent {
/**
* User Id. Persistent between devices, typically on a logged in user.
*/
user_id?: string;
/**
* Session Id. Unique to a browser/app and stored locally, e.g. cookie or localStorage.
*/
session_id?: string;
/**
* Populated for integrations performed by Depict.ai only. Depict.ai Session Id.
*/
dsid?: string;
/**
* Unique identifier for the transaction.
*/
transaction_id: string;
/**
* The type identifier for this event: transaction_mapping.
*/
event_type?: "transaction_mapping";
}
export interface PurchaseEvent {
user_id?: UserId;
session_id?: SessionId;
dsid?: Dsid;
transaction_id: TransactionId;
event_type?: EventType;
currency: Currency;
products: Products;
}
export interface PurchasedProduct {
sku: Sku;
price: Price;
quantity: Quantity;
}
export interface ProductUnavailableEvent {
user_id?: UserId1;
session_id?: SessionId1;
dsid?: Dsid1;
event_type: EventType1;
product_id: ProductId;
/**
* Reason the product isn't available for purchase
*/
unavailability_type: EUnavailabilityType;
}