@carter-rmn/cpix-js 1.0.0-alpha.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.
@@ -0,0 +1,330 @@
1
+ /**
2
+ * Represents the initialization options for the application.
3
+ */
4
+ export interface InitOptions {
5
+ debug?: boolean;
6
+ tracker_server_url: string;
7
+ }
8
+ /**
9
+ * Represents the initialization options for the application.
10
+ */
11
+ export interface Init {
12
+ /**
13
+ * The client ID for the application.
14
+ */
15
+ client_id: string;
16
+ /**
17
+ * Additional options for the application.
18
+ */
19
+ options: Record<string, unknown>;
20
+ }
21
+ /**
22
+ * Represents the event properties.
23
+ */
24
+ export interface EventProperties {
25
+ [key: string]: unknown;
26
+ }
27
+ /**
28
+ * Represents the user properties.
29
+ */
30
+ export interface UserProperties {
31
+ /**
32
+ * The user ID.
33
+ */
34
+ user_id: string;
35
+ [key: string]: unknown;
36
+ }
37
+ /**
38
+ * Represents the location information.
39
+ */
40
+ export interface Location {
41
+ /**
42
+ * The country.
43
+ */
44
+ country: string;
45
+ /**
46
+ * The region.
47
+ */
48
+ region: string;
49
+ /**
50
+ * The city.
51
+ */
52
+ city: string;
53
+ /**
54
+ * The location.
55
+ */
56
+ loc: string;
57
+ /**
58
+ * The timezone.
59
+ */
60
+ timezone: string;
61
+ }
62
+ /**
63
+ * Represents the device information.
64
+ */
65
+ export interface Device {
66
+ /**
67
+ * The category of the device.
68
+ */
69
+ category: string;
70
+ /**
71
+ * The brand of the device.
72
+ */
73
+ brand: string;
74
+ /**
75
+ * The IP address of the device.
76
+ */
77
+ ip_address: string;
78
+ /**
79
+ * The platform of the device.
80
+ */
81
+ platform: string;
82
+ }
83
+ /**
84
+ * Represents the meta parameters for an event.
85
+ */
86
+ export interface MetaParameters {
87
+ /**
88
+ * The client ID.
89
+ */
90
+ client_id?: string;
91
+ /**
92
+ * The session ID.
93
+ */
94
+ session?: string;
95
+ /**
96
+ * The location information.
97
+ */
98
+ location?: Location;
99
+ /**
100
+ * The device information.
101
+ */
102
+ device?: Device;
103
+ /**
104
+ * The timestamp of the event.
105
+ */
106
+ timestamp?: number;
107
+ /**
108
+ * The referrer URL.
109
+ */
110
+ referrer?: string;
111
+ /**
112
+ * The UTM parameters.
113
+ */
114
+ utm_params?: unknown;
115
+ }
116
+ /**
117
+ * Represents an event.
118
+ */
119
+ export interface Event {
120
+ /**
121
+ * The event name.
122
+ */
123
+ event: string;
124
+ /**
125
+ * The event properties.
126
+ */
127
+ event_properties?: EventProperties;
128
+ /**
129
+ * The user properties.
130
+ */
131
+ user_properties?: UserProperties;
132
+ }
133
+ export interface EnrichedEvent extends Event, MetaParameters {
134
+ }
135
+ /**
136
+ * Represents the properties of a product.
137
+ */
138
+ export interface ProductProperties {
139
+ /**
140
+ * The ID of the product.
141
+ */
142
+ id: string;
143
+ /**
144
+ * The SKU ID of the product.
145
+ */
146
+ sku_id?: string;
147
+ /**
148
+ * The price of the product.
149
+ */
150
+ price: number;
151
+ /**
152
+ * The currency of the product price.
153
+ */
154
+ currency: string;
155
+ /**
156
+ * The title of the product.
157
+ */
158
+ title: string;
159
+ /**
160
+ * The image URL of the product.
161
+ */
162
+ image_url?: string;
163
+ /**
164
+ * The product URL.
165
+ */
166
+ product_url?: string;
167
+ /**
168
+ * The affiliation of the product.
169
+ */
170
+ affiliation?: unknown;
171
+ /**
172
+ * The first-level category of the product.
173
+ */
174
+ product_category_1?: string;
175
+ /**
176
+ * The second-level category of the product.
177
+ */
178
+ product_category_2?: string;
179
+ /**
180
+ * The third-level category of the product.
181
+ */
182
+ product_category_3?: string;
183
+ /**
184
+ * The fourth-level category of the product.
185
+ */
186
+ product_category_4?: string;
187
+ /**
188
+ * The fifth-level category of the product.
189
+ */
190
+ product_category_5?: string;
191
+ [key: string]: unknown;
192
+ }
193
+ /**
194
+ * Represents the properties of a cart item.
195
+ */
196
+ export interface CartProperties {
197
+ /**
198
+ * The ID of the cart item.
199
+ */
200
+ id: string;
201
+ /**
202
+ * The SKU ID of the cart item.
203
+ */
204
+ sku_id?: string;
205
+ /**
206
+ * The price of the cart item.
207
+ */
208
+ price: number;
209
+ /**
210
+ * The currency of the cart item price.
211
+ */
212
+ currency: string;
213
+ /**
214
+ * The title of the cart item.
215
+ */
216
+ title: string;
217
+ /**
218
+ * The image URL of the cart item.
219
+ */
220
+ image_url?: string;
221
+ /**
222
+ * The product URL.
223
+ */
224
+ product_url?: string;
225
+ /**
226
+ * The affiliation of the cart item.
227
+ */
228
+ affiliation?: unknown;
229
+ /**
230
+ * The first-level category of the cart item.
231
+ */
232
+ product_category_1?: string;
233
+ /**
234
+ * The second-level category of the cart item.
235
+ */
236
+ product_category_2?: string;
237
+ /**
238
+ * The third-level category of the cart item.
239
+ */
240
+ product_category_3?: string;
241
+ /**
242
+ * The fourth-level category of the cart item.
243
+ */
244
+ product_category_4?: string;
245
+ /**
246
+ * The fifth-level category of the cart item.
247
+ */
248
+ product_category_5?: string;
249
+ /**
250
+ * The quantity of the cart item.
251
+ */
252
+ quantity: number;
253
+ /**
254
+ * The discount applied to the cart item.
255
+ */
256
+ discount: number;
257
+ /**
258
+ * The total amount of the cart item.
259
+ */
260
+ amount: number;
261
+ }
262
+ /**
263
+ * Represents the properties of an address.
264
+ */
265
+ export interface AddressProperties {
266
+ /**
267
+ * The address line 1.
268
+ */
269
+ address_line_1: string;
270
+ /**
271
+ * The address line 2.
272
+ */
273
+ address_line_2: string;
274
+ /**
275
+ * The city.
276
+ */
277
+ city: string;
278
+ /**
279
+ * The province.
280
+ */
281
+ province: string;
282
+ /**
283
+ * The province code.
284
+ */
285
+ province_code: string;
286
+ /**
287
+ * The Country.
288
+ */
289
+ country: string;
290
+ /**
291
+ * The country code.
292
+ */
293
+ country_code: string;
294
+ /**
295
+ * The first name.
296
+ */
297
+ first_name: string;
298
+ /**
299
+ * The last name.
300
+ */
301
+ last_name: string;
302
+ /**
303
+ * The phone number.
304
+ */
305
+ phone: string;
306
+ }
307
+ /**
308
+ * Represents the properties of a discount.
309
+ */
310
+ export interface DiscountProperties {
311
+ /**
312
+ * The application of the discount.
313
+ */
314
+ application: string;
315
+ /**
316
+ * The discount code.
317
+ */
318
+ code: string;
319
+ /**
320
+ * The amount of the discount.
321
+ */
322
+ amount: number;
323
+ /**
324
+ * The target of the discount.
325
+ */
326
+ target: string;
327
+ }
328
+ export interface DeviceNetworkParameters extends Location {
329
+ ip_address: string;
330
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Represents the properties for a search operation.
3
+ */
4
+ export interface SearchProperties {
5
+ /**
6
+ * The search query.
7
+ */
8
+ query: string;
9
+ }
10
+ /**
11
+ * Represents the properties for a signup operation.
12
+ */
13
+ export interface SignupProperties {
14
+ /**
15
+ * The signup method.
16
+ */
17
+ method: string;
18
+ /**
19
+ * The user ID.
20
+ */
21
+ user_id: string;
22
+ }
23
+ /**
24
+ * Represents the properties for a login operation.
25
+ */
26
+ export interface LoginProperties {
27
+ /**
28
+ * The login method.
29
+ */
30
+ method: string;
31
+ /**
32
+ * The user ID.
33
+ */
34
+ user_id: string;
35
+ }
@@ -0,0 +1,69 @@
1
+ import * as commonType from './common.types';
2
+ /**
3
+ * Represents the properties for adding items to a cart.
4
+ */
5
+ export interface AddToCartProperties {
6
+ /**
7
+ * The total amount of the cart.
8
+ */
9
+ cart_amount: number;
10
+ /**
11
+ * The currency of the cart amount.
12
+ */
13
+ currency: string;
14
+ /**
15
+ * The array of cart items.
16
+ */
17
+ cart_items: Array<commonType.CartProperties>;
18
+ }
19
+ /**
20
+ * Represents the properties for removing items from a cart.
21
+ */
22
+ export interface RemoveFromCartProperties {
23
+ /**
24
+ * The total amount of the cart.
25
+ */
26
+ cart_amount: number;
27
+ /**
28
+ * The currency of the cart amount.
29
+ */
30
+ currency: string;
31
+ /**
32
+ * The array of cart items.
33
+ */
34
+ cart_items: Array<commonType.CartProperties>;
35
+ }
36
+ /**
37
+ * Represents the properties for updating a cart.
38
+ */
39
+ export interface UpdateCartProperties {
40
+ /**
41
+ * The total amount of the cart.
42
+ */
43
+ cart_amount: number;
44
+ /**
45
+ * The currency of the cart amount.
46
+ */
47
+ currency: string;
48
+ /**
49
+ * The array of cart items.
50
+ */
51
+ cart_items: Array<commonType.CartProperties>;
52
+ }
53
+ /**
54
+ * Represents the properties for viewing a cart.
55
+ */
56
+ export interface ViewCartProperties {
57
+ /**
58
+ * The total amount of the cart.
59
+ */
60
+ cart_amount: number;
61
+ /**
62
+ * The currency of the cart amount.
63
+ */
64
+ currency: string;
65
+ /**
66
+ * The array of cart items.
67
+ */
68
+ cart_items: Array<commonType.CartProperties>;
69
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@carter-rmn/cpix-js",
3
+ "version": "1.0.0-alpha.1",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "dist/cpix.umd.cjs",
9
+ "module": "dist/cpix.js",
10
+ "types": "dist/cpix.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/cpix.js",
14
+ "require": "./dist/cpix.umd.cjs"
15
+ }
16
+ },
17
+ "devDependencies": {
18
+ "picocolors": "^1.0.0",
19
+ "rollup-plugin-visualizer": "^5.12.0",
20
+ "typescript": "^5.2.2",
21
+ "vite": "^5.2.0",
22
+ "vite-plugin-progress": "^0.0.7"
23
+ },
24
+ "dependencies": {
25
+ "vite-plugin-dts": "^3.8.1"
26
+ },
27
+ "scripts": {
28
+ "dev": "vite",
29
+ "build": "tsc && vite build",
30
+ "preview": "vite preview"
31
+ }
32
+ }