fk-platform-sdk 1.1.0-beta.4 → 1.1.0-beta.5

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.
@@ -61,3 +61,46 @@ export declare class PageViewEvent implements AnalyticsEvent {
61
61
  constructor(isBack: boolean, timestamp: number, responseType?: string, hyperlocalEligible?: boolean, pageMetaInfo?: PageMetaInfo, vertical?: string, category?: string);
62
62
  getValidator(): EventValidator;
63
63
  }
64
+ export interface TravelBookingEventParams {
65
+ timestamp: number;
66
+ revenue: number;
67
+ isInternational: boolean;
68
+ bookingId: string;
69
+ dateDeparture: string;
70
+ destinationCity: string;
71
+ originCity: string;
72
+ diffToDepartureDate?: number;
73
+ couponName?: string;
74
+ discount?: number;
75
+ tripFlag?: string;
76
+ journeyType?: string;
77
+ lengthOfStay?: number;
78
+ paymentMethod?: string;
79
+ bookingType?: string;
80
+ operator?: string;
81
+ segments?: string;
82
+ }
83
+ export declare class TravelBookingEvent implements AnalyticsEvent {
84
+ type: string;
85
+ private readonly en;
86
+ private readonly _ev;
87
+ private t;
88
+ private r;
89
+ private iit;
90
+ private bid;
91
+ private dtdd?;
92
+ private dd;
93
+ private dc;
94
+ private oc;
95
+ private cn?;
96
+ private d?;
97
+ private tf?;
98
+ private jt?;
99
+ private los?;
100
+ private pm?;
101
+ private bt?;
102
+ private o?;
103
+ private seg?;
104
+ constructor(params: TravelBookingEventParams);
105
+ getValidator(): EventValidator;
106
+ }
@@ -147,3 +147,57 @@ var PageViewEvent = /** @class */ (function () {
147
147
  return PageViewEvent;
148
148
  }());
149
149
  exports.PageViewEvent = PageViewEvent;
150
+ var TravelBookingEvent = /** @class */ (function () {
151
+ function TravelBookingEvent(params) {
152
+ this.type = "Travel.TravelBookingEvent";
153
+ this.en = "TOC";
154
+ this._ev = "1.0";
155
+ this.t = params.timestamp;
156
+ this.r = params.revenue;
157
+ this.iit = params.isInternational;
158
+ this.bid = params.bookingId;
159
+ this.dtdd = params.diffToDepartureDate;
160
+ this.dd = params.dateDeparture;
161
+ this.dc = params.destinationCity;
162
+ this.oc = params.originCity;
163
+ this.cn = params.couponName;
164
+ this.d = params.discount;
165
+ this.tf = params.tripFlag;
166
+ this.jt = params.journeyType;
167
+ this.los = params.lengthOfStay;
168
+ this.pm = params.paymentMethod;
169
+ this.bt = params.bookingType;
170
+ this.o = params.operator;
171
+ this.seg = params.segments;
172
+ }
173
+ TravelBookingEvent.prototype.getValidator = function () {
174
+ var invalidValues = Validator_1.validate(metadataMap, this, "TravelBookingEvent");
175
+ return new EventValidator_1.EventValidator(invalidValues);
176
+ };
177
+ __decorate([
178
+ decorators_1.Positive(metadataMap, "TravelBookingEvent")
179
+ ], TravelBookingEvent.prototype, "t", void 0);
180
+ __decorate([
181
+ decorators_1.NonNegative(metadataMap, "TravelBookingEvent")
182
+ ], TravelBookingEvent.prototype, "r", void 0);
183
+ __decorate([
184
+ decorators_1.NonNull(metadataMap, "TravelBookingEvent")
185
+ ], TravelBookingEvent.prototype, "iit", void 0);
186
+ __decorate([
187
+ decorators_1.NonEmpty(metadataMap, "TravelBookingEvent")
188
+ ], TravelBookingEvent.prototype, "bid", void 0);
189
+ __decorate([
190
+ decorators_1.NonEmpty(metadataMap, "TravelBookingEvent")
191
+ ], TravelBookingEvent.prototype, "dd", void 0);
192
+ __decorate([
193
+ decorators_1.NonEmpty(metadataMap, "TravelBookingEvent")
194
+ ], TravelBookingEvent.prototype, "dc", void 0);
195
+ __decorate([
196
+ decorators_1.NonEmpty(metadataMap, "TravelBookingEvent")
197
+ ], TravelBookingEvent.prototype, "oc", void 0);
198
+ __decorate([
199
+ decorators_1.NonNegative(metadataMap, "TravelBookingEvent")
200
+ ], TravelBookingEvent.prototype, "d", void 0);
201
+ return TravelBookingEvent;
202
+ }());
203
+ exports.TravelBookingEvent = TravelBookingEvent;
@@ -1,5 +1,5 @@
1
1
  import { Bill, Cab, FoodDelivery, Recharge, Ticket, Travel, Healthcare, Nft } from "../";
2
- import { PageMetaInfo } from "../Travel";
2
+ import { PageMetaInfo, TravelBookingEventParams } from "../Travel";
3
3
  import { FoodDish } from "../FoodDish";
4
4
  import { Person } from "../Person";
5
5
  export interface AnalyticsHelper {
@@ -48,6 +48,7 @@ export interface TravelAnalyticsHelper {
48
48
  customerDetails: (email: string, phoneNumber: string, travellers: Person[]) => Travel.CustomerDetails;
49
49
  orderConfirmation: (amountToPay: number, paymentMethod: string) => Travel.OrderConfirmation;
50
50
  pageView: (isBack: boolean, timestamp: number, responseType?: string, hyperlocalEligible?: boolean, pageMetaInfo?: PageMetaInfo, vertical?: string, category?: string) => Travel.PageViewEvent;
51
+ travelBookingEvent: (params: TravelBookingEventParams) => Travel.TravelBookingEvent;
51
52
  }
52
53
  export interface NFTAnalyticsHelper {
53
54
  wallet: (stage: string, session_id: string) => Nft.Wallet;
@@ -9,6 +9,15 @@ var __extends = (this && this.__extends) || (function () {
9
9
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10
10
  };
11
11
  })();
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
18
+ t[p[i]] = s[p[i]];
19
+ return t;
20
+ };
12
21
  Object.defineProperty(exports, "__esModule", { value: true });
13
22
  var NativeModuleHelper_1 = require("../managers/NativeModuleHelper");
14
23
  var AnalyticsModuleImpl = /** @class */ (function (_super) {
@@ -72,13 +81,12 @@ var AnalyticsModuleImpl = /** @class */ (function (_super) {
72
81
  AnalyticsModuleImpl.prototype.ultraTrackEvent = function (event, partialNavigationContext, trackImmediately) {
73
82
  var _this = this;
74
83
  this.nativeModuleCallbackManager.executeOnBridge(function (requestId) {
75
- var type = event.type;
76
- delete event.type;
84
+ var type = event.type, eventData = __rest(event, ["type"]);
77
85
  var eventValidator = event.getValidator();
78
86
  if (eventValidator.isValid()) {
79
87
  _this.postMessage({
80
88
  methodName: "ultraTrackEvent",
81
- event: JSON.stringify(event),
89
+ event: JSON.stringify(eventData),
82
90
  partialNavigationContext: partialNavigationContext ? JSON.stringify(partialNavigationContext) : null,
83
91
  trackImmediately: trackImmediately || false,
84
92
  });
@@ -149,6 +149,9 @@ var SetupHelper = /** @class */ (function () {
149
149
  pageView: function (isBack, timestamp, responseType, hyperlocalEligible, pageMetaInfo, vertical, category) {
150
150
  return new analytics_1.Travel.PageViewEvent(isBack, timestamp, responseType, hyperlocalEligible, pageMetaInfo, vertical, category);
151
151
  },
152
+ travelBookingEvent: function (params) {
153
+ return new analytics_1.Travel.TravelBookingEvent(params);
154
+ },
152
155
  };
153
156
  };
154
157
  SetupHelper.getBillObject = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fk-platform-sdk",
3
- "version": "1.1.0-beta.4",
3
+ "version": "1.1.0-beta.5",
4
4
  "description": "SDK to enable external experience integration within flipkart app.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",