fleek-track-analytics 1.17.36 → 1.17.41

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.
Files changed (42) hide show
  1. package/NODE_JS_BACKEND_INTEGRATION_GUIDE.md +363 -0
  2. package/README.md +0 -69
  3. package/lib/node/analytics-tool/node-rudderstack.d.ts +10 -0
  4. package/lib/node/analytics-tool/node-rudderstack.js +76 -0
  5. package/lib/node/analytics-tool/node-rudderstack.js.map +1 -0
  6. package/lib/node/analytics-tool/rudderstack-default-config.js.map +1 -0
  7. package/lib/node/analytics-tool/rudderstack-event-routing.js +18 -0
  8. package/lib/node/analytics-tool/rudderstack-event-routing.js.map +1 -0
  9. package/lib/node/track-analytics/track-analytics-types.d.ts +1 -0
  10. package/lib/node/track-analytics/track-analytics.d.ts +2 -0
  11. package/lib/node/track-analytics/track-analytics.js +113 -17
  12. package/lib/node/track-analytics/track-analytics.js.map +1 -1
  13. package/lib/react-native/track-analytics/track-analytics.d.ts +0 -2
  14. package/lib/react-native/track-analytics/track-analytics.js +32 -152
  15. package/lib/react-native/track-analytics/track-analytics.js.map +1 -1
  16. package/lib/track-analytics-types.d.ts +0 -5
  17. package/lib/web/track-analytics/track-analytics.d.ts +0 -2
  18. package/lib/web/track-analytics/track-analytics.js +38 -139
  19. package/lib/web/track-analytics/track-analytics.js.map +1 -1
  20. package/package.json +3 -3
  21. package/EXPO_RN_TESTING_GUIDE.md +0 -283
  22. package/lib/react-native/analytics-tool/react-native-rudderstack.d.ts +0 -12
  23. package/lib/react-native/analytics-tool/react-native-rudderstack.js +0 -87
  24. package/lib/react-native/analytics-tool/react-native-rudderstack.js.map +0 -1
  25. package/lib/react-native/analytics-tool/rudderstack-default-config.js +0 -8
  26. package/lib/react-native/analytics-tool/rudderstack-default-config.js.map +0 -1
  27. package/lib/react-native/analytics-tool/rudderstack-event-routing.d.ts +0 -6
  28. package/lib/react-native/analytics-tool/rudderstack-event-routing.js +0 -17
  29. package/lib/react-native/analytics-tool/rudderstack-event-routing.js.map +0 -1
  30. package/lib/web/analytics-tool/rudderstack-default-config.d.ts +0 -4
  31. package/lib/web/analytics-tool/rudderstack-default-config.js.map +0 -1
  32. package/lib/web/analytics-tool/rudderstack-event-routing.js +0 -16
  33. package/lib/web/analytics-tool/rudderstack-event-routing.js.map +0 -1
  34. package/lib/web/analytics-tool/web-rudderstack.d.ts +0 -17
  35. package/lib/web/analytics-tool/web-rudderstack.js +0 -76
  36. package/lib/web/analytics-tool/web-rudderstack.js.map +0 -1
  37. package/spec-files/rudderstack-migration/HLD_LLD.md +0 -353
  38. package/spec-files/rudderstack-migration/RUDDERSTACK_SELF_HOSTED_PARAMETERS.md +0 -283
  39. package/spec-files/rudderstack-migration/SEGMENT_VS_RUDDERSTACK_SDK_COMPARISON.md +0 -140
  40. /package/lib/{react-native → node}/analytics-tool/rudderstack-default-config.d.ts +0 -0
  41. /package/lib/{web → node}/analytics-tool/rudderstack-default-config.js +0 -0
  42. /package/lib/{web → node}/analytics-tool/rudderstack-event-routing.d.ts +0 -0
@@ -0,0 +1,363 @@
1
+ # Node.js Backend Integration Guide - fleek-track-analytics
2
+
3
+ ## Overview
4
+
5
+ The `fleek-track-analytics` library provides a unified analytics interface for Node.js backends, supporting dual-send to both Segment and RudderStack. Events can be sent to both platforms simultaneously, with selective routing to RudderStack based on configuration.
6
+
7
+ ## Package Information
8
+
9
+ **Package Name**: `fleek-track-analytics`
10
+ **Current Version**: `1.17.40`
11
+ **npm Registry**: https://www.npmjs.com/package/fleek-track-analytics
12
+
13
+ ### Dependencies Used by the Library
14
+
15
+ The library uses the following packages internally:
16
+
17
+ - **@rudderstack/rudder-sdk-node**: `^2.0.0` - RudderStack Node.js SDK
18
+ - **@segment/analytics-node**: `^2.1.0` - Segment Node.js SDK
19
+
20
+ **Note**: These are peer dependencies managed by the library. Your backend does NOT need to install them directly.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install fleek-track-analytics@1.17.40
26
+ # or
27
+ yarn add fleek-track-analytics@1.17.40
28
+ ```
29
+
30
+ ## How It Works
31
+
32
+ ### Architecture
33
+
34
+ 1. **Dual-Send Pattern**: Events are sent to Segment (always) and RudderStack (conditionally based on routing config)
35
+ 2. **Independent Initialization**: Segment and RudderStack initialize independently - failures in one don't affect the other
36
+ 3. **Event Routing**: Only events in the routing configuration are sent to RudderStack
37
+ 4. **Mutual Exclusivity**: SDK failures are isolated - if Segment fails, RudderStack still works and vice versa
38
+
39
+ ### Event Flow
40
+
41
+ ```
42
+ Backend Code
43
+
44
+ TrackAnalytics.track() / identify() / page()
45
+
46
+ ┌─────────────────────────────────────┐
47
+ │ Segment (Always) │
48
+ │ - Sends all events │
49
+ └─────────────────────────────────────┘
50
+
51
+ ┌─────────────────────────────────────┐
52
+ │ RudderStack (Conditional) │
53
+ │ - Checks event routing config │
54
+ │ - Sends only if event matches │
55
+ └─────────────────────────────────────┘
56
+ ```
57
+
58
+ ## Initialization
59
+
60
+ ### Import
61
+
62
+ ```typescript
63
+ import { TrackAnalytics } from 'fleek-track-analytics/lib/node';
64
+ ```
65
+
66
+ ### Configuration Interface
67
+
68
+ ```typescript
69
+ interface IAnalyticsInit {
70
+ platform: 'NODE';
71
+ App: 'VENDOR_APP' | 'CONSUMER_APP' | 'CONSUMER_WEB' | 'SHOPIFY_CHECKOUT' | 'VENDOR_WEB_PORTAL' | 'QC_APP';
72
+ segment: boolean;
73
+ segmentKey: string;
74
+ devMode?: boolean;
75
+ debug?: boolean;
76
+ errorHandler: (e: unknown) => void;
77
+
78
+ // Trace manager (optional)
79
+ traceManager?: {
80
+ enabled?: boolean;
81
+ sessionTimeout?: number;
82
+ debug?: boolean;
83
+ errorHandler?: (error: Error) => void;
84
+ };
85
+
86
+ // RudderStack configuration (optional)
87
+ rudderstack?: {
88
+ enabled: boolean;
89
+ writeKey?: string; // Optional - uses default if not provided
90
+ dataPlaneUrl?: string; // Optional - uses default if not provided
91
+ };
92
+ }
93
+ ```
94
+
95
+ ### Default RudderStack Configuration
96
+
97
+ If `writeKey` or `dataPlaneUrl` are not provided, the library uses these defaults:
98
+ - **dataPlaneUrl**: `https://rudderstack.joinfleek.com`
99
+ - **writeKey**: `37DB5IcrJ9GQNtcww0uenrGfy0p`
100
+
101
+ ### Example Initialization
102
+
103
+ ```typescript
104
+ import { TrackAnalytics } from 'fleek-track-analytics/lib/node';
105
+
106
+ // Create instance
107
+ const analytics = new TrackAnalytics({
108
+ platform: 'NODE',
109
+ App: 'VENDOR_WEB_PORTAL', // or your app type
110
+ segment: true,
111
+ segmentKey: 'your-segment-write-key',
112
+ debug: process.env.NODE_ENV === 'development',
113
+ errorHandler: (error) => {
114
+ console.error('Analytics error:', error);
115
+ // Optionally send to error tracking service
116
+ },
117
+ rudderstack: {
118
+ enabled: true,
119
+ // Optional - will use defaults if not provided
120
+ // writeKey: 'your-rudderstack-write-key',
121
+ // dataPlaneUrl: 'https://rudderstack.joinfleek.com',
122
+ },
123
+ });
124
+
125
+ // Initialize (must be called before using track/identify/page)
126
+ await analytics.initAnalytics();
127
+ ```
128
+
129
+ ## Usage
130
+
131
+ ### Track Events
132
+
133
+ ```typescript
134
+ analytics.track(
135
+ {
136
+ eventName: 'Order Placed FOR VENDOR',
137
+ eventParams: {
138
+ orderId: 'order-123',
139
+ amount: 99.99,
140
+ currency: 'USD',
141
+ // ... other event properties
142
+ },
143
+ userId: 'user-123', // Optional
144
+ anonymousId: 'anon-456', // Optional (if no userId)
145
+ },
146
+ () => {
147
+ // Optional callback after event is sent
148
+ console.log('Event sent');
149
+ }
150
+ );
151
+ ```
152
+
153
+ ### Identify Users
154
+
155
+ ```typescript
156
+ analytics.identify({
157
+ userId: 'user-123',
158
+ anonymousId: 'anon-456', // Optional
159
+ traits: {
160
+ email: 'user@example.com',
161
+ name: 'John Doe',
162
+ plan: 'premium',
163
+ // ... other user traits
164
+ },
165
+ });
166
+ ```
167
+
168
+ ### Page Views
169
+
170
+ ```typescript
171
+ analytics.page({
172
+ userId: 'user-123', // Optional
173
+ anonymousId: 'anon-456', // Optional
174
+ name: 'Order Confirmation',
175
+ category: 'Shop',
176
+ properties: {
177
+ orderId: 'order-123',
178
+ // ... other page properties
179
+ },
180
+ });
181
+ ```
182
+
183
+ ## Event Routing to RudderStack
184
+
185
+ ### How Routing Works
186
+
187
+ Events are sent to RudderStack only if they match the routing configuration. The routing is defined **inside the library** (not configurable from your backend).
188
+
189
+ ### Events Currently Routed to RudderStack
190
+
191
+ The following events are automatically sent to RudderStack (in addition to Segment):
192
+
193
+ - `collection_viewed`
194
+ - `collection_plp_viewed`
195
+ - `vendor_plp_viewed`
196
+ - `Search Used`
197
+ - `Message sent in chat`
198
+ - `Send Message`
199
+ - `New Order Tracking Update`
200
+ - `vendor_list_experiment`
201
+ - `Order Placed FOR VENDOR`
202
+ - `Order Placed FOR CUSTOMER`
203
+
204
+ **Note**: All events are **always** sent to Segment. Only the events listed above are also sent to RudderStack.
205
+
206
+ ### Routing Logic
207
+
208
+ 1. Check if event name is in `sendToRudderstack` array
209
+ 2. If not found, check if event matches any `eventPatterns` (regex patterns)
210
+ 3. If either condition matches, send to RudderStack
211
+
212
+ ## RudderStack Configuration
213
+
214
+ ### Batching Behavior
215
+
216
+ The RudderStack Node.js SDK is configured with:
217
+ - **flushAt**: 20 events (batch size)
218
+ - **flushInterval**: 10000ms (10 seconds)
219
+
220
+ Events are automatically batched and sent when either:
221
+ - 20 events accumulate, OR
222
+ - 10 seconds pass
223
+
224
+ ### Data Enrichment
225
+
226
+ All events sent to RudderStack are automatically enriched with:
227
+ - `anlaytics_lib_version`: Library version
228
+ - `fleek_platform`: App type (e.g., 'VENDOR_WEB_PORTAL')
229
+ - `time_stamp`: Unix timestamp
230
+
231
+ ## Error Handling
232
+
233
+ ### Independent Error Handling
234
+
235
+ - **Segment failures** don't affect RudderStack
236
+ - **RudderStack failures** don't affect Segment
237
+ - Errors are logged via the `errorHandler` callback
238
+ - Application continues to function even if both SDKs fail
239
+
240
+ ### Error Handler Example
241
+
242
+ ```typescript
243
+ errorHandler: (error) => {
244
+ // Log to your error tracking service
245
+ console.error('Analytics error:', error);
246
+
247
+ // Optionally send to Sentry, DataDog, etc.
248
+ // sentry.captureException(error);
249
+ }
250
+ ```
251
+
252
+ ## TypeScript Types
253
+
254
+ ### Event Parameters
255
+
256
+ ```typescript
257
+ // Track event
258
+ analytics.track({
259
+ eventName: string, // Event name from EVENT_NAMES type
260
+ eventParams: Record<string, unknown>, // Event-specific properties
261
+ userId?: string,
262
+ anonymousId?: string,
263
+ // ... other optional fields
264
+ }, callback?: () => void);
265
+
266
+ // Identify
267
+ analytics.identify({
268
+ userId?: string,
269
+ anonymousId?: string,
270
+ traits?: Record<string, string | boolean>,
271
+ // ... other optional fields
272
+ });
273
+
274
+ // Page
275
+ analytics.page({
276
+ userId?: string,
277
+ anonymousId?: string,
278
+ name?: string,
279
+ category?: string,
280
+ properties?: Record<string, unknown>,
281
+ // ... other optional fields
282
+ });
283
+ ```
284
+
285
+ ## Complete Example
286
+
287
+ ```typescript
288
+ import { TrackAnalytics } from 'fleek-track-analytics/lib/node';
289
+
290
+ // Initialize
291
+ const analytics = new TrackAnalytics({
292
+ platform: 'NODE',
293
+ App: 'VENDOR_WEB_PORTAL',
294
+ segment: true,
295
+ segmentKey: process.env.SEGMENT_WRITE_KEY!,
296
+ debug: process.env.NODE_ENV === 'development',
297
+ errorHandler: (error) => {
298
+ console.error('Analytics error:', error);
299
+ },
300
+ rudderstack: {
301
+ enabled: true,
302
+ // Uses defaults: https://rudderstack.joinfleek.com
303
+ },
304
+ });
305
+
306
+ await analytics.initAnalytics();
307
+
308
+ // Track an event
309
+ analytics.track({
310
+ eventName: 'Order Placed FOR VENDOR',
311
+ eventParams: {
312
+ orderId: 'order-123',
313
+ amount: 99.99,
314
+ vendorId: 'vendor-456',
315
+ },
316
+ userId: 'user-789',
317
+ });
318
+
319
+ // Identify a user
320
+ analytics.identify({
321
+ userId: 'user-789',
322
+ traits: {
323
+ email: 'vendor@example.com',
324
+ name: 'Vendor Name',
325
+ },
326
+ });
327
+ ```
328
+
329
+ ## Important Notes
330
+
331
+ 1. **Initialization Required**: Always call `await analytics.initAnalytics()` before using track/identify/page methods
332
+ 2. **Callback-Based API**: All methods use callbacks (not promises) - this is by design for Node.js compatibility
333
+ 3. **Event Routing is Internal**: The routing configuration exists in the library, not in your backend code
334
+ 4. **Default Config**: If you don't provide RudderStack `writeKey` or `dataPlaneUrl`, defaults are used
335
+ 5. **Mutual Exclusivity**: Segment and RudderStack operate independently - one can fail without affecting the other
336
+
337
+ ## Troubleshooting
338
+
339
+ ### Events Not Appearing in RudderStack
340
+
341
+ 1. Check if RudderStack is enabled: `rudderstack.enabled === true`
342
+ 2. Verify the event name is in the routing configuration
343
+ 3. Check errorHandler logs for initialization failures
344
+ 4. Verify writeKey and dataPlaneUrl are correct (or using defaults)
345
+
346
+ ### TypeScript Errors
347
+
348
+ - Ensure you're importing from `fleek-track-analytics/lib/node`
349
+ - Check that `platform: 'NODE'` is set correctly
350
+ - Verify all required fields in `IAnalyticsInit` are provided
351
+
352
+ ## Package Versions Summary
353
+
354
+ | Package | Version | Purpose |
355
+ |---------|---------|---------|
356
+ | `fleek-track-analytics` | `1.17.40` | Main library |
357
+ | `@rudderstack/rudder-sdk-node` | `^2.0.0` | RudderStack SDK (internal) |
358
+ | `@segment/analytics-node` | `^2.1.0` | Segment SDK (internal) |
359
+
360
+ ## Support
361
+
362
+ For issues or questions, refer to the library repository or contact the maintainers.
363
+
package/README.md CHANGED
@@ -76,75 +76,6 @@ Parameter description for TrackAnalytics class constructor
76
76
  | devMode | boolean | if enabled, only log the event do not trigger network calls |
77
77
  | debug | boolean | if enabled, triggers network calls for events when devMode is true. |
78
78
  | errorHandler | function | an error handler to manage any errors thrown while initialising and sending events |
79
- | rudderstack | object (optional) | RudderStack configuration for self-hosted migration (see RudderStack Setup below) |
80
-
81
- ## RudderStack Setup (Self-Hosted Migration)
82
-
83
- This library supports dual-sending events to both Segment and RudderStack for gradual migration. RudderStack integration is currently available for **Web platform only** (PoC phase).
84
-
85
- ### Configuration
86
-
87
- To enable RudderStack, add the `rudderstack` configuration to your `TrackAnalytics` initialization:
88
-
89
- ```ts
90
- const analyticsWrapper = new TrackAnalytics({
91
- platform: 'WEB',
92
- App: 'CONSUMER_WEB',
93
- segment: true,
94
- segmentKey: process.env.SEGMENT_KEY || '',
95
- rudderstack: {
96
- enabled: true,
97
- writeKey: process.env.RUDDERSTACK_WRITE_KEY || '',
98
- dataPlaneUrl: process.env.RUDDERSTACK_DATA_PLANE_URL || '', // e.g., 'https://dataplane.yourdomain.com'
99
- },
100
- errorHandler: analyticsException,
101
- });
102
- ```
103
-
104
- ### Event Routing
105
-
106
- Event routing to RudderStack is controlled by an **internal library configuration** file (`src/web/analytics-tool/rudderstack-event-routing.ts`). This allows you to selectively send specific events to RudderStack during the PoC phase without requiring application changes.
107
-
108
- **Important**:
109
- - All events are **always sent to Segment** (unchanged behavior)
110
- - Events are **conditionally sent to RudderStack** based on the internal routing configuration
111
- - RudderStack failures do not affect Segment sending
112
-
113
- ### How It Works
114
-
115
- 1. **Dual-Send Architecture**: Events are sent to both Segment and RudderStack (when configured)
116
- 2. **Internal Routing Config**: Modify `src/web/analytics-tool/rudderstack-event-routing.ts` in this repository to control which events are sent to RudderStack
117
- 3. **Fail-Safe**: If RudderStack initialization or sending fails, the library continues with Segment only
118
-
119
- ### Event Routing Configuration
120
-
121
- To control which events are sent to RudderStack, modify the `rudderstackEventRouting` object in `src/web/analytics-tool/rudderstack-event-routing.ts`:
122
-
123
- ```ts
124
- export const rudderstackEventRouting: IRudderstackEventRouting = {
125
- // Option 1: List specific event names
126
- sendToRudderstack: [
127
- 'event_name_1',
128
- 'event_name_2',
129
- ],
130
-
131
- // Option 2: Use regex patterns
132
- eventPatterns: ['^test_', '^poc_'], // Matches events starting with 'test_' or 'poc_'
133
- };
134
- ```
135
-
136
- ### Requirements
137
-
138
- - **Data Plane URL**: Your self-hosted RudderStack data plane endpoint
139
- - **Write Key**: Source write key from RudderStack control plane
140
- - **Self-Hosted Setup**: See `spec-files/rudderstack-migration/RUDDERSTACK_SELF_HOSTED_PARAMETERS.md` for detailed setup instructions
141
-
142
- ### Documentation
143
-
144
- For more details on the migration, see:
145
- - SDK Comparison: `spec-files/rudderstack-migration/SEGMENT_VS_RUDDERSTACK_SDK_COMPARISON.md`
146
- - Self-Hosted Parameters: `spec-files/rudderstack-migration/RUDDERSTACK_SELF_HOSTED_PARAMETERS.md`
147
- - Architecture (HLD/LLD): `spec-files/rudderstack-migration/HLD_LLD.md`
148
79
 
149
80
  4. Use the intialised instance in your app to send events by using the Event Names
150
81
 
@@ -0,0 +1,10 @@
1
+ import { tNodeToolWraperFunction } from './analytics-tool-types';
2
+ import { INodeAnalyticsWrapper } from '../track-analytics/track-analytics-types';
3
+ interface IRudderstackNodeWrapperParams {
4
+ writeKey: string;
5
+ dataPlaneUrl: string;
6
+ app: Parameters<tNodeToolWraperFunction>[1];
7
+ debug?: boolean;
8
+ }
9
+ export declare const nodeRudderstack: ({ writeKey, dataPlaneUrl, app, debug }: IRudderstackNodeWrapperParams) => INodeAnalyticsWrapper;
10
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.nodeRudderstack = void 0;
7
+ const rudder_sdk_node_1 = __importDefault(require("@rudderstack/rudder-sdk-node"));
8
+ const package_json_1 = require("../../../package.json");
9
+ const nodeRudderstack = ({ writeKey, dataPlaneUrl, app, debug }) => {
10
+ const normalizedDataPlaneUrl = (dataPlaneUrl === null || dataPlaneUrl === void 0 ? void 0 : dataPlaneUrl.endsWith('/')) ? dataPlaneUrl.slice(0, -1) : dataPlaneUrl || '';
11
+ const client = new rudder_sdk_node_1.default(writeKey, {
12
+ dataPlaneUrl: normalizedDataPlaneUrl,
13
+ flushAt: 20,
14
+ flushInterval: 10000,
15
+ });
16
+ return {
17
+ track: ((params, callback) => {
18
+ const { eventName, eventParams, anonymousId, userId } = params;
19
+ if (debug) {
20
+ console.log('RUDDERSTACK TRACK EVENT', eventName, eventParams);
21
+ }
22
+ const trackParams = {
23
+ event: eventName,
24
+ properties: Object.assign(Object.assign({}, eventParams), { anlaytics_lib_version: package_json_1.version, fleek_platform: app, time_stamp: Date.now() }),
25
+ };
26
+ if (userId) {
27
+ trackParams.userId = userId;
28
+ }
29
+ else if (anonymousId) {
30
+ trackParams.anonymousId = anonymousId;
31
+ }
32
+ client.track(trackParams, callback || (() => { }));
33
+ }),
34
+ page: ((params) => {
35
+ if (debug) {
36
+ console.log('RUDDERSTACK PAGE EVENT', params);
37
+ }
38
+ const { anonymousId, userId, properties } = params;
39
+ const pageProperties = (properties || {});
40
+ const name = pageProperties.name || 'page';
41
+ const category = pageProperties.category || undefined;
42
+ const pageParams = {
43
+ name,
44
+ properties: Object.assign(Object.assign({}, pageProperties), { fleek_platform: app }),
45
+ };
46
+ if (userId)
47
+ pageParams.userId = userId;
48
+ if (anonymousId)
49
+ pageParams.anonymousId = anonymousId;
50
+ if (category)
51
+ pageParams.category = category;
52
+ client.page(pageParams, () => { });
53
+ }),
54
+ identify: ((params) => {
55
+ if (debug) {
56
+ console.log('RUDDERSTACK IDENTIFY EVENT', params);
57
+ }
58
+ const { userId, anonymousId, traits } = params;
59
+ const traitsObj = (traits || {});
60
+ const identifyParams = {
61
+ traits: traitsObj,
62
+ };
63
+ if (userId) {
64
+ identifyParams.userId = userId;
65
+ }
66
+ else if (anonymousId) {
67
+ identifyParams.anonymousId = anonymousId;
68
+ }
69
+ client.identify(identifyParams, () => { });
70
+ }),
71
+ type: 'NODE_RUDDERSTACK',
72
+ analytics_source_type: 'NODE_RUDDERSTACK',
73
+ };
74
+ };
75
+ exports.nodeRudderstack = nodeRudderstack;
76
+ //# sourceMappingURL=node-rudderstack.js.map
@@ -0,0 +1 @@
1
+ {"version":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AE,SAAS;aAClB,CAAC;YAEF,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;YACjC,CAAC;iBAAM,IAAI,WAAW,EAAE,CAAC;gBACvB,cAAc,CAAC,WAAW,GAAG,WAAW,CAAC;YAC3C,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC,cAAqB,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnD,CAAC,CAAkB;QACnB,IAAI,EAAE,kBAAkB;QACxB,qBAAqB,EAAE,kBAAkB;KAC1C,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,eAAe,mBAyG1B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rudderstack-default-config.js","sourceRoot":"","sources":["../../../src/node/analytics-tool/rudderstack-default-config.ts"],"names":[],"mappings":";;;AAAa,QAAA,0BAA0B,GAAG;IACxC,YAAY,EAAE,mCAAmC;IACjD,QAAQ,EAAE,6BAA6B;CACxC,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rudderstackEventRouting = void 0;
4
+ exports.rudderstackEventRouting = {
5
+ sendToRudderstack: [
6
+ 'collection_viewed',
7
+ 'collection_plp_viewed',
8
+ 'vendor_plp_viewed',
9
+ 'Search Used',
10
+ 'Message sent in chat',
11
+ 'Send Message',
12
+ 'New Order Tracking Update',
13
+ 'vendor_list_experiment',
14
+ 'Order Placed FOR VENDOR',
15
+ 'Order Placed FOR CUSTOMER',
16
+ ],
17
+ };
18
+ //# sourceMappingURL=rudderstack-event-routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rudderstack-event-routing.js","sourceRoot":"","sources":["../../../src/node/analytics-tool/rudderstack-event-routing.ts"],"names":[],"mappings":";;;AAUa,QAAA,uBAAuB,GAA6B;IAC/D,iBAAiB,EAAE;QACjB,mBAAmB;QACnB,uBAAuB;QACvB,mBAAmB;QACnB,aAAa;QACb,sBAAsB;QACtB,cAAc;QACd,2BAA2B;QAC3B,wBAAwB;QACxB,yBAAyB;QACzB,2BAA2B;KAC5B;CACF,CAAC"}
@@ -42,6 +42,7 @@ export interface INodeAnalyticsWrapper {
42
42
  identify: tNodeIdentify;
43
43
  page: tNodePage;
44
44
  type: string;
45
+ analytics_source_type?: string;
45
46
  }
46
47
  export type tToolWraperFunction = (APP: tAPP) => INodeAnalyticsWrapper;
47
48
  export {};
@@ -3,9 +3,11 @@ import { tNodeIdentify, tNodePage, tNodeTrack } from './track-analytics-types';
3
3
  declare class TrackAnalytics {
4
4
  private initParams;
5
5
  private analyticsWrapper;
6
+ private rudderstackWrapper;
6
7
  constructor(params: IAnalyticsInit);
7
8
  initAnalytics: () => Promise<void>;
8
9
  private checkInitDone;
10
+ private shouldSendToRudderstack;
9
11
  track: tNodeTrack;
10
12
  identify: tNodeIdentify;
11
13
  page: tNodePage;