@salecycle/node-sdk 1.0.3 → 1.0.6
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/dist/npm/client.d.ts +4 -0
- package/dist/npm/config.d.ts +1 -0
- package/dist/npm/index.cjs +51 -0
- package/dist/npm/index.cjs.map +7 -0
- package/dist/npm/index.d.ts +38 -0
- package/dist/npm/index.mjs +24 -0
- package/dist/npm/index.mjs.map +7 -0
- package/dist/npm/types/basket.d.ts +29 -0
- package/dist/npm/types/basketItem.d.ts +19 -0
- package/dist/npm/types/boundEvent.d.ts +5 -0
- package/dist/npm/types/consent.d.ts +9 -0
- package/dist/npm/types/customer.d.ts +28 -0
- package/dist/npm/types/device.d.ts +19 -0
- package/dist/npm/types/email.d.ts +6 -0
- package/dist/npm/types/identifiers.d.ts +11 -0
- package/dist/npm/types/impression.d.ts +56 -0
- package/dist/npm/types/meta.d.ts +10 -0
- package/dist/npm/types/page.d.ts +6 -0
- package/dist/npm/types/phone.d.ts +6 -0
- package/dist/npm/types/product.d.ts +53 -0
- package/dist/npm/types/registrationForm.d.ts +6 -0
- package/dist/npm/types/reward.d.ts +5 -0
- package/dist/npm/types/shared/address.d.ts +10 -0
- package/dist/npm/types/shared/clientRecommendations.d.ts +14 -0
- package/dist/npm/types/shared/contract.d.ts +8 -0
- package/dist/npm/types/shared/customFields.d.ts +13 -0
- package/dist/npm/types/shared/discount.d.ts +6 -0
- package/dist/npm/types/shared/order.d.ts +20 -0
- package/dist/npm/types/shared/osrData.d.ts +2 -0
- package/dist/npm/types/shared/product/category.d.ts +8 -0
- package/dist/npm/types/shared/product/color.d.ts +5 -0
- package/dist/npm/types/shared/product/size.d.ts +5 -0
- package/dist/npm/types/shared/shipping.d.ts +11 -0
- package/dist/npm/types/shared/tagBag.d.ts +2 -0
- package/dist/npm/types/shared/taxes.d.ts +8 -0
- package/dist/npm/types/source.d.ts +5 -0
- package/dist/npm/types/ticket.d.ts +10 -0
- package/dist/npm/types/travel/accommodation.d.ts +23 -0
- package/dist/npm/types/travel/journey.d.ts +27 -0
- package/dist/npm/types/travel/when.d.ts +7 -0
- package/dist/npm/types/travel/where.d.ts +6 -0
- package/dist/npm/types/travel/whereWhen.d.ts +7 -0
- package/dist/npm/types/trigger.d.ts +8 -0
- package/package.json +1 -1
- package/README.md +0 -43
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IMPRESSION_BASE_URL = "https://i.salecycle.com";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
SaleCycleClient: () => SaleCycleClient,
|
|
23
|
+
default: () => SaleCycleClient
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/config.ts
|
|
28
|
+
var IMPRESSION_BASE_URL = "https://i.salecycle.com";
|
|
29
|
+
|
|
30
|
+
// src/client.ts
|
|
31
|
+
var SaleCycleClient = class {
|
|
32
|
+
async SendImpression(msgId, impression) {
|
|
33
|
+
const endpoint = "/impression";
|
|
34
|
+
const response = await fetch(`${IMPRESSION_BASE_URL}${endpoint}?msgId=${msgId}`, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: encodeURI(JSON.stringify(impression)),
|
|
37
|
+
headers: { "Content-Type": "text/plain;charset=UTF-8" }
|
|
38
|
+
});
|
|
39
|
+
if (response.status > 299) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`SaleCycle API responded with status ${response.status}: ${response.statusText}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
SaleCycleClient
|
|
49
|
+
});
|
|
50
|
+
module.exports = module.exports.default;
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../src/config.ts", "../../src/client.ts"],
|
|
4
|
+
"sourcesContent": ["export { default as SaleCycleClient } from './client'\nexport { default } from './client'\n\nexport type * from './types/basket'\nexport type * from './types/basketItem'\nexport type * from './types/boundEvent'\nexport type * from './types/consent'\nexport type * from './types/customer'\nexport type * from './types/device'\nexport type * from './types/email'\nexport type * from './types/identifiers'\nexport type * from './types/impression'\nexport type * from './types/meta'\nexport type * from './types/page'\nexport type * from './types/phone'\nexport type * from './types/product'\nexport type * from './types/registrationForm'\nexport type * from './types/reward'\nexport type * from './types/source'\nexport type * from './types/ticket'\nexport type * from './types/trigger'\nexport type * from './types/shared/product/category'\nexport type * from './types/shared/product/color'\nexport type * from './types/shared/product/size'\nexport type * from './types/shared/address'\nexport type * from './types/shared/clientRecommendations'\nexport type * from './types/shared/contract'\nexport type * from './types/shared/customFields'\nexport type * from './types/shared/discount'\nexport type * from './types/shared/order'\nexport type * from './types/shared/osrData'\nexport type * from './types/shared/shipping'\nexport type * from './types/shared/tagBag'\nexport type * from './types/shared/taxes'\nexport type * from './types/travel/accommodation'\nexport type * from './types/travel/journey'\nexport type * from './types/travel/when'\nexport type * from './types/travel/where'\nexport type * from './types/travel/whereWhen'\n", "export const IMPRESSION_BASE_URL = 'https://i.salecycle.com'\n", "import { IMPRESSION_BASE_URL } from './config'\nimport type Impression from './types/impression'\n\nexport default class SaleCycleClient {\n async SendImpression(msgId: string, impression: Impression): Promise<void> {\n const endpoint = '/impression'\n\n const response = await fetch(`${IMPRESSION_BASE_URL}${endpoint}?msgId=${msgId}`, {\n method: 'POST',\n body: encodeURI(JSON.stringify(impression)),\n headers: { 'Content-Type': 'text/plain;charset=UTF-8' },\n })\n\n if (response.status > 299) {\n throw new Error(\n `SaleCycle API responded with status ${response.status}: ${response.statusText}`\n )\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,sBAAsB;;;ACGnC,IAAqB,kBAArB,MAAqC;AAAA,EACnC,MAAM,eAAe,OAAe,YAAuC;AACzE,UAAM,WAAW;AAEjB,UAAM,WAAW,MAAM,MAAM,GAAG,mBAAmB,GAAG,QAAQ,UAAU,KAAK,IAAI;AAAA,MAC/E,QAAQ;AAAA,MACR,MAAM,UAAU,KAAK,UAAU,UAAU,CAAC;AAAA,MAC1C,SAAS,EAAE,gBAAgB,2BAA2B;AAAA,IACxD,CAAC;AAED,QAAI,SAAS,SAAS,KAAK;AACzB,YAAM,IAAI;AAAA,QACR,uCAAuC,SAAS,MAAM,KAAK,SAAS,UAAU;AAAA,MAChF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { default as SaleCycleClient } from './client';
|
|
2
|
+
export { default } from './client';
|
|
3
|
+
export type * from './types/basket';
|
|
4
|
+
export type * from './types/basketItem';
|
|
5
|
+
export type * from './types/boundEvent';
|
|
6
|
+
export type * from './types/consent';
|
|
7
|
+
export type * from './types/customer';
|
|
8
|
+
export type * from './types/device';
|
|
9
|
+
export type * from './types/email';
|
|
10
|
+
export type * from './types/identifiers';
|
|
11
|
+
export type * from './types/impression';
|
|
12
|
+
export type * from './types/meta';
|
|
13
|
+
export type * from './types/page';
|
|
14
|
+
export type * from './types/phone';
|
|
15
|
+
export type * from './types/product';
|
|
16
|
+
export type * from './types/registrationForm';
|
|
17
|
+
export type * from './types/reward';
|
|
18
|
+
export type * from './types/source';
|
|
19
|
+
export type * from './types/ticket';
|
|
20
|
+
export type * from './types/trigger';
|
|
21
|
+
export type * from './types/shared/product/category';
|
|
22
|
+
export type * from './types/shared/product/color';
|
|
23
|
+
export type * from './types/shared/product/size';
|
|
24
|
+
export type * from './types/shared/address';
|
|
25
|
+
export type * from './types/shared/clientRecommendations';
|
|
26
|
+
export type * from './types/shared/contract';
|
|
27
|
+
export type * from './types/shared/customFields';
|
|
28
|
+
export type * from './types/shared/discount';
|
|
29
|
+
export type * from './types/shared/order';
|
|
30
|
+
export type * from './types/shared/osrData';
|
|
31
|
+
export type * from './types/shared/shipping';
|
|
32
|
+
export type * from './types/shared/tagBag';
|
|
33
|
+
export type * from './types/shared/taxes';
|
|
34
|
+
export type * from './types/travel/accommodation';
|
|
35
|
+
export type * from './types/travel/journey';
|
|
36
|
+
export type * from './types/travel/when';
|
|
37
|
+
export type * from './types/travel/where';
|
|
38
|
+
export type * from './types/travel/whereWhen';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
var IMPRESSION_BASE_URL = "https://i.salecycle.com";
|
|
3
|
+
|
|
4
|
+
// src/client.ts
|
|
5
|
+
var SaleCycleClient = class {
|
|
6
|
+
async SendImpression(msgId, impression) {
|
|
7
|
+
const endpoint = "/impression";
|
|
8
|
+
const response = await fetch(`${IMPRESSION_BASE_URL}${endpoint}?msgId=${msgId}`, {
|
|
9
|
+
method: "POST",
|
|
10
|
+
body: encodeURI(JSON.stringify(impression)),
|
|
11
|
+
headers: { "Content-Type": "text/plain;charset=UTF-8" }
|
|
12
|
+
});
|
|
13
|
+
if (response.status > 299) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
`SaleCycle API responded with status ${response.status}: ${response.statusText}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
SaleCycleClient,
|
|
22
|
+
SaleCycleClient as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/config.ts", "../../src/client.ts"],
|
|
4
|
+
"sourcesContent": ["export const IMPRESSION_BASE_URL = 'https://i.salecycle.com'\n", "import { IMPRESSION_BASE_URL } from './config'\nimport type Impression from './types/impression'\n\nexport default class SaleCycleClient {\n async SendImpression(msgId: string, impression: Impression): Promise<void> {\n const endpoint = '/impression'\n\n const response = await fetch(`${IMPRESSION_BASE_URL}${endpoint}?msgId=${msgId}`, {\n method: 'POST',\n body: encodeURI(JSON.stringify(impression)),\n headers: { 'Content-Type': 'text/plain;charset=UTF-8' },\n })\n\n if (response.status > 299) {\n throw new Error(\n `SaleCycle API responded with status ${response.status}: ${response.statusText}`\n )\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,sBAAsB;;;ACGnC,IAAqB,kBAArB,MAAqC;AAAA,EACnC,MAAM,eAAe,OAAe,YAAuC;AACzE,UAAM,WAAW;AAEjB,UAAM,WAAW,MAAM,MAAM,GAAG,mBAAmB,GAAG,QAAQ,UAAU,KAAK,IAAI;AAAA,MAC/E,QAAQ;AAAA,MACR,MAAM,UAAU,KAAK,UAAU,UAAU,CAAC;AAAA,MAC1C,SAAS,EAAE,gBAAgB,2BAA2B;AAAA,IACxD,CAAC;AAED,QAAI,SAAS,SAAS,KAAK;AACzB,YAAM,IAAI;AAAA,QACR,uCAAuC,SAAS,MAAM,KAAK,SAAS,UAAU;AAAA,MAChF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type BasketItem from './basketItem';
|
|
2
|
+
import type Discount from './shared/discount';
|
|
3
|
+
import type Shipping from './shared/shipping';
|
|
4
|
+
import type TagBag from './shared/tagBag';
|
|
5
|
+
import type Taxes from './shared/taxes';
|
|
6
|
+
type Costs = {
|
|
7
|
+
subtotal: string;
|
|
8
|
+
total?: string;
|
|
9
|
+
claim?: string;
|
|
10
|
+
taxes?: Taxes;
|
|
11
|
+
previousSubTotal?: string;
|
|
12
|
+
};
|
|
13
|
+
type Basket = {
|
|
14
|
+
id?: string;
|
|
15
|
+
costs: Costs;
|
|
16
|
+
currency?: string;
|
|
17
|
+
discount?: Discount;
|
|
18
|
+
repopulationUrl?: string;
|
|
19
|
+
shipping?: Shipping;
|
|
20
|
+
tagBag?: TagBag;
|
|
21
|
+
items: BasketItem[];
|
|
22
|
+
keywords?: string[];
|
|
23
|
+
paymentType?: string;
|
|
24
|
+
source?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
sendOverride?: string;
|
|
27
|
+
basketEmptied?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export default Basket;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type Product from './product';
|
|
2
|
+
import type ClientRecommendations from './shared/clientRecommendations';
|
|
3
|
+
import type CustomFields from './shared/customFields';
|
|
4
|
+
import type TagBag from './shared/tagBag';
|
|
5
|
+
type BasketItemCosts = {
|
|
6
|
+
subtotal: string;
|
|
7
|
+
previousSubtotal: string;
|
|
8
|
+
};
|
|
9
|
+
type BasketItem = {
|
|
10
|
+
product: Product;
|
|
11
|
+
costs?: BasketItemCosts;
|
|
12
|
+
quantity: number;
|
|
13
|
+
tagBag?: TagBag;
|
|
14
|
+
subItems?: BasketItem[];
|
|
15
|
+
sortOrder?: number;
|
|
16
|
+
clientRecommendations?: ClientRecommendations[];
|
|
17
|
+
customFields?: CustomFields;
|
|
18
|
+
};
|
|
19
|
+
export default BasketItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ConsentType = 'OptIn' | 'OptOut' | 'OptOutOpportunity' | 'InvalidateOptIn' | 'InvalidateOptOut';
|
|
2
|
+
type DataType = 'Email' | 'Phone';
|
|
3
|
+
type Consent = {
|
|
4
|
+
consentType: ConsentType;
|
|
5
|
+
dataType: DataType;
|
|
6
|
+
value: string;
|
|
7
|
+
source?: string;
|
|
8
|
+
};
|
|
9
|
+
export default Consent;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type Address from './shared/address';
|
|
2
|
+
import type Phone from './phone';
|
|
3
|
+
type OptIns = {
|
|
4
|
+
email: boolean;
|
|
5
|
+
phone: boolean;
|
|
6
|
+
};
|
|
7
|
+
type Orders = {
|
|
8
|
+
status: string;
|
|
9
|
+
previousOrderDate: string;
|
|
10
|
+
};
|
|
11
|
+
type Customer = {
|
|
12
|
+
earlyBirdsId: string;
|
|
13
|
+
id: string;
|
|
14
|
+
salutation: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
dob: string;
|
|
18
|
+
gender: string;
|
|
19
|
+
address: Address;
|
|
20
|
+
phone: Phone;
|
|
21
|
+
optIns: OptIns;
|
|
22
|
+
loggedIn: boolean;
|
|
23
|
+
orders: Orders;
|
|
24
|
+
usingTranslate: boolean;
|
|
25
|
+
type: string;
|
|
26
|
+
marketingStatus: string;
|
|
27
|
+
};
|
|
28
|
+
export default Customer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type DeviceTime = {
|
|
2
|
+
utc: number;
|
|
3
|
+
offset: number;
|
|
4
|
+
};
|
|
5
|
+
type DeviceScreen = {
|
|
6
|
+
availWidth?: number | string;
|
|
7
|
+
availHeight?: number | string;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
10
|
+
depth?: number | string;
|
|
11
|
+
};
|
|
12
|
+
type Device = {
|
|
13
|
+
manufacturer?: string;
|
|
14
|
+
model?: string;
|
|
15
|
+
userAgent: string;
|
|
16
|
+
time: DeviceTime;
|
|
17
|
+
screen?: DeviceScreen;
|
|
18
|
+
};
|
|
19
|
+
export default Device;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type Basket from './basket';
|
|
2
|
+
import type BoundEvent from './boundEvent';
|
|
3
|
+
import type Device from './device';
|
|
4
|
+
import type ClientRecommendations from './shared/clientRecommendations';
|
|
5
|
+
import type Consent from './consent';
|
|
6
|
+
import type CustomFields from './shared/customFields';
|
|
7
|
+
import type Customer from './customer';
|
|
8
|
+
import type Email from './email';
|
|
9
|
+
import type Identifiers from './identifiers';
|
|
10
|
+
import type Meta from './meta';
|
|
11
|
+
import type Order from './shared/order';
|
|
12
|
+
import type OsrData from './shared/osrData';
|
|
13
|
+
import type Page from './page';
|
|
14
|
+
import type Phone from './phone';
|
|
15
|
+
import type Product from './product';
|
|
16
|
+
import type RegistrationForm from './registrationForm';
|
|
17
|
+
import type Source from './source';
|
|
18
|
+
import type TagBag from './shared/tagBag';
|
|
19
|
+
import type Trigger from './trigger';
|
|
20
|
+
type Event = {
|
|
21
|
+
name: string;
|
|
22
|
+
data?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
type Impression = {
|
|
25
|
+
basket?: Basket;
|
|
26
|
+
boundEvents?: BoundEvent[];
|
|
27
|
+
clientRecommendations?: ClientRecommendations[];
|
|
28
|
+
consent?: Consent[];
|
|
29
|
+
currency?: string;
|
|
30
|
+
currencySymbol?: string;
|
|
31
|
+
customer?: Customer;
|
|
32
|
+
customFields?: CustomFields;
|
|
33
|
+
device: Device;
|
|
34
|
+
email?: Email;
|
|
35
|
+
errors?: Record<string, unknown>[];
|
|
36
|
+
events: (Event | string)[];
|
|
37
|
+
ids: Identifiers;
|
|
38
|
+
keywords?: Record<string, unknown>;
|
|
39
|
+
locale?: string;
|
|
40
|
+
meta: Meta;
|
|
41
|
+
order?: Order;
|
|
42
|
+
osrData?: OsrData;
|
|
43
|
+
page: Page;
|
|
44
|
+
pages?: Page[];
|
|
45
|
+
phone?: Phone;
|
|
46
|
+
product?: Product;
|
|
47
|
+
registrationForm?: RegistrationForm;
|
|
48
|
+
shouldClaimSession?: boolean;
|
|
49
|
+
trigger?: Trigger;
|
|
50
|
+
tagBag?: TagBag;
|
|
51
|
+
thirdPartyUserId?: string;
|
|
52
|
+
source?: Source;
|
|
53
|
+
sendOverride?: string;
|
|
54
|
+
visitationId?: string;
|
|
55
|
+
};
|
|
56
|
+
export default Impression;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type Accommodation from './travel/accommodation';
|
|
2
|
+
import type Category from './shared/product/category';
|
|
3
|
+
import type Color from './shared/product/color';
|
|
4
|
+
import type Contract from './shared/contract';
|
|
5
|
+
import type Discount from './shared/discount';
|
|
6
|
+
import type Journey from './travel/journey';
|
|
7
|
+
import type Reward from './reward';
|
|
8
|
+
import type Shipping from './shared/shipping';
|
|
9
|
+
import type Size from './shared/product/size';
|
|
10
|
+
import type Taxes from './shared/taxes';
|
|
11
|
+
import type Ticket from './ticket';
|
|
12
|
+
type Product = {
|
|
13
|
+
id?: string;
|
|
14
|
+
reviewId?: string;
|
|
15
|
+
recommendationId?: string;
|
|
16
|
+
metricId?: string;
|
|
17
|
+
inStock: boolean;
|
|
18
|
+
clientProductId?: string;
|
|
19
|
+
name: string;
|
|
20
|
+
brand?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
singleItemPrice?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
images: {
|
|
25
|
+
thumbnail: string;
|
|
26
|
+
additional?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
accommodation: Accommodation;
|
|
29
|
+
journey: Journey[];
|
|
30
|
+
costs: {
|
|
31
|
+
singleItem: string;
|
|
32
|
+
taxes: Taxes;
|
|
33
|
+
previous: string;
|
|
34
|
+
discount: Discount;
|
|
35
|
+
shipping: Shipping;
|
|
36
|
+
contract: Contract;
|
|
37
|
+
};
|
|
38
|
+
currency: string;
|
|
39
|
+
category: Category;
|
|
40
|
+
color: Color;
|
|
41
|
+
size: Size;
|
|
42
|
+
rating: {
|
|
43
|
+
value: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
};
|
|
46
|
+
audience: string;
|
|
47
|
+
reward: Reward;
|
|
48
|
+
ticket: Ticket;
|
|
49
|
+
gender: string;
|
|
50
|
+
productCategories: Category[];
|
|
51
|
+
isLowStock: boolean;
|
|
52
|
+
};
|
|
53
|
+
export default Product;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ClientRecommendations = {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string;
|
|
4
|
+
image: string;
|
|
5
|
+
cost: string;
|
|
6
|
+
description: string;
|
|
7
|
+
prevCost: string;
|
|
8
|
+
brand: string;
|
|
9
|
+
saving: string;
|
|
10
|
+
id: string;
|
|
11
|
+
size: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
export default ClientRecommendations;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type CustomFields = {
|
|
2
|
+
customOne: string;
|
|
3
|
+
customTwo: string;
|
|
4
|
+
customThree: string;
|
|
5
|
+
customFour: string;
|
|
6
|
+
customFive: string;
|
|
7
|
+
customSix: string;
|
|
8
|
+
customSeven: string;
|
|
9
|
+
customEight: string;
|
|
10
|
+
customNine: string;
|
|
11
|
+
customTen: string;
|
|
12
|
+
};
|
|
13
|
+
export default CustomFields;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type Discount from './discount';
|
|
2
|
+
import type Shipping from './shipping';
|
|
3
|
+
import type TagBag from './tagBag';
|
|
4
|
+
import type Taxes from './taxes';
|
|
5
|
+
type Order = {
|
|
6
|
+
id: string;
|
|
7
|
+
idSource: string;
|
|
8
|
+
shipping: Shipping;
|
|
9
|
+
discount: Discount;
|
|
10
|
+
costs: {
|
|
11
|
+
subtotal: string;
|
|
12
|
+
total: string;
|
|
13
|
+
claim: string;
|
|
14
|
+
taxes: Taxes;
|
|
15
|
+
};
|
|
16
|
+
currency: string;
|
|
17
|
+
tagBag: TagBag;
|
|
18
|
+
paymentType: string;
|
|
19
|
+
};
|
|
20
|
+
export default Order;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type When from './when';
|
|
2
|
+
type Duration = {
|
|
3
|
+
nights: number;
|
|
4
|
+
days: number;
|
|
5
|
+
};
|
|
6
|
+
type Occupants = {
|
|
7
|
+
adults: number;
|
|
8
|
+
infants: number;
|
|
9
|
+
children: number;
|
|
10
|
+
};
|
|
11
|
+
type Accommodation = {
|
|
12
|
+
name: string;
|
|
13
|
+
location?: string;
|
|
14
|
+
start?: When;
|
|
15
|
+
end?: When;
|
|
16
|
+
duration?: Duration;
|
|
17
|
+
numRooms?: number;
|
|
18
|
+
roomType?: string;
|
|
19
|
+
roomName?: string;
|
|
20
|
+
boardType?: string;
|
|
21
|
+
occupants?: Occupants;
|
|
22
|
+
};
|
|
23
|
+
export default Accommodation;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type WhereWhen from './whereWhen';
|
|
2
|
+
type Airline = {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
type Grade = {
|
|
6
|
+
value: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
type Passengers = {
|
|
10
|
+
adults: number;
|
|
11
|
+
infants: number;
|
|
12
|
+
children: number;
|
|
13
|
+
};
|
|
14
|
+
type Journey = {
|
|
15
|
+
airline?: Airline;
|
|
16
|
+
duration?: string;
|
|
17
|
+
type: string;
|
|
18
|
+
flightName?: string;
|
|
19
|
+
flightNUmber?: string;
|
|
20
|
+
direction?: string;
|
|
21
|
+
start: WhereWhen;
|
|
22
|
+
end?: WhereWhen;
|
|
23
|
+
grade?: Grade;
|
|
24
|
+
passengers?: Passengers;
|
|
25
|
+
numberOfStops?: number;
|
|
26
|
+
};
|
|
27
|
+
export default Journey;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TriggerType: readonly ["DomEvent", "DomMutation", "IdleTime", "ManualTrigger", "MouseOut", "PageLoad", "PageVisibility", "UrlChange", "UserInteraction", "OSREvent", "RTMEvent"];
|
|
2
|
+
export type TriggerType = (typeof TriggerType)[keyof typeof TriggerType];
|
|
3
|
+
type Trigger = {
|
|
4
|
+
eventType?: string;
|
|
5
|
+
scriptSelector?: string;
|
|
6
|
+
type: TriggerType;
|
|
7
|
+
};
|
|
8
|
+
export default Trigger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salecycle/node-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build:types": "tsc -p tsconfig.release.json --emitDeclarationOnly --declaration --outDir dist/npm",
|
|
6
6
|
"build": "pnpm run clean && pnpm run build:types && npx tsx scripts/build.ts",
|
package/README.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
|
-
# Node SDK
|
|
4
|
-
|
|
5
|
-
Allows impression data to be sent to SaleCycle, without relying on custom script implementations.
|
|
6
|
-
|
|
7
|
-
### Usage
|
|
8
|
-
|
|
9
|
-
**Node ESM**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
import SaleCycleClient from '@salecycle/node-sdk'
|
|
13
|
-
|
|
14
|
-
const client = new SaleCycleClient()
|
|
15
|
-
client.SendImpression(msgId, impressionData)
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
**Node CJS**
|
|
19
|
-
```typescript
|
|
20
|
-
const SaleCycleClient = require('@salecycle/node-sdk')
|
|
21
|
-
|
|
22
|
-
const client = new SaleCycleClient()
|
|
23
|
-
client.SendImpression(msgId, impressionData)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Browser ESM**
|
|
27
|
-
```html
|
|
28
|
-
<script type="module">
|
|
29
|
-
import SaleCycleClient from './sdk.mjs'
|
|
30
|
-
|
|
31
|
-
const client = new SaleCycleClient();
|
|
32
|
-
client.SendImpression('123', {})
|
|
33
|
-
</script>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Browser CJS**
|
|
37
|
-
```html
|
|
38
|
-
<script src="https://i.salecycle.com/sdk.min.js"></script>
|
|
39
|
-
<script>
|
|
40
|
-
const client = new SaleCycleClient();
|
|
41
|
-
client.SendImpression('123', impressionData)
|
|
42
|
-
</script>
|
|
43
|
-
```
|