@cleartrip/ct-platform-utils 4.6.0 → 4.6.1-beta.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.
- package/dist/api.utils.d.ts.map +1 -1
- package/dist/biztrip.api.utils.d.ts +21 -0
- package/dist/biztrip.api.utils.d.ts.map +1 -0
- package/dist/biztrip.constants.d.ts +23 -0
- package/dist/biztrip.constants.d.ts.map +1 -0
- package/dist/biztrip.types.d.ts +116 -0
- package/dist/biztrip.types.d.ts.map +1 -0
- package/dist/biztrip.ui.types.d.ts +40 -0
- package/dist/biztrip.ui.types.d.ts.map +1 -0
- package/dist/bookZeroTrip.utils.d.ts.map +1 -1
- package/dist/common.utils.d.ts +2 -1
- package/dist/common.utils.d.ts.map +1 -1
- package/dist/ct-platform-utils.cjs.js +1 -1
- package/dist/ct-platform-utils.cjs.js.map +1 -1
- package/dist/ct-platform-utils.esm.js +1 -1
- package/dist/ct-platform-utils.esm.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/raven.utils.d.ts.map +1 -1
- package/dist/recentSearch.utils.d.ts +1 -1
- package/dist/recentSearch.utils.d.ts.map +1 -1
- package/dist/useBiztripConfig.d.ts +73 -0
- package/dist/useBiztripConfig.d.ts.map +1 -0
- package/dist/user.utils.d.ts.map +1 -1
- package/dist/utmManager.d.ts +2 -2
- package/dist/utmManager.d.ts.map +1 -1
- package/package.json +8 -3
package/dist/api.utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/api.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,cAAc,EAEjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACH,MAAM,EAEN,aAAa,EAEb,iBAAiB,EACpB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"api.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/api.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,cAAc,EAEjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACH,MAAM,EAEN,aAAa,EAEb,iBAAiB,EACpB,MAAM,8BAA8B,CAAC;AA0DtC,eAAO,MAAM,gBAAgB,SACnB,MAAM,+CAEH,OAAO,YACP,iBAAiB,WAClB,aAAa,qEAGtB,QAAQ,MAAM,CAyFhB,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACnB,MAAM,YACH,iBAAiB,WAClB,aAAa,qEAGtB,QAAQ,MAAM,CAcZ,CAAC;AAEN,eAAO,MAAM,sBAAsB,SACzB,MAAM,WACJ,cAAc,YACb,OAAO,YACP,iBAAiB,WAClB,aAAa,qEAGtB,QAAQ,MAAM,CAcZ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BiztripEmployeeDetailsResponse, BiztripOnboardingResponse, BiztripProfileResponse } from './biztrip.types';
|
|
2
|
+
export declare const getBiztripErrorMessage: (response: Response) => Promise<string>;
|
|
3
|
+
type BiztripFetchResult<T> = {
|
|
4
|
+
ok: true;
|
|
5
|
+
data: T;
|
|
6
|
+
status: number;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
status: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const fetchBiztripOnboarding: () => Promise<BiztripFetchResult<BiztripOnboardingResponse>>;
|
|
13
|
+
export declare const fetchBiztripProfile: () => Promise<BiztripFetchResult<BiztripProfileResponse>>;
|
|
14
|
+
export declare const fetchBiztripEmployeeDetails: (orgId: string) => Promise<BiztripFetchResult<BiztripEmployeeDetailsResponse>>;
|
|
15
|
+
export declare const postBiztripLogout: () => Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
error?: string | undefined;
|
|
18
|
+
status: number;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=biztrip.api.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biztrip.api.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/biztrip.api.utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAER,8BAA8B,EAC9B,yBAAyB,EACzB,sBAAsB,EACzB,MAAM,iBAAiB,CAAC;AAqCzB,eAAO,MAAM,sBAAsB,aACrB,QAAQ,KACnB,QAAQ,MAAM,CAWhB,CAAC;AAEF,KAAK,kBAAkB,CAAC,CAAC,IACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA2BnD,eAAO,MAAM,sBAAsB,QACrB,QAAQ,mBAAmB,yBAAyB,CAAC,CAS9D,CAAC;AAEN,eAAO,MAAM,mBAAmB,QAClB,QAAQ,mBAAmB,sBAAsB,CAAC,CAIvD,CAAC;AAEV,eAAO,MAAM,2BAA2B,UAC7B,MAAM,KACd,QAAQ,mBAAmB,8BAA8B,CAAC,CAY5D,CAAC;AAEF,eAAO,MAAM,iBAAiB;aACjB,OAAO;;YAER,MAAM;EA6BjB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IAccountOptionsPopupConfig, IAccountPill, IHeaderBrandLogo, ISupportConfig, LobDataItem, NavbarOption } from './biztrip.ui.types';
|
|
2
|
+
export declare const CLEARTIP_HOME_URL = "https://www.cleartrip.com";
|
|
3
|
+
export declare const BIZTRIP_HOME_URL = "/hotels";
|
|
4
|
+
export declare const BIZTRIP_TRIPS_URL = "/accounts/trips";
|
|
5
|
+
export declare const BIZTRIP_APPROVALS_URL = "/biztrip-approvals";
|
|
6
|
+
export declare const BIZTRIP_ADMIN_URL = "/biztrip-admin/dashboard";
|
|
7
|
+
export declare const BIZTRIP_PROFILE_URL = "/biztrip-profile";
|
|
8
|
+
export declare const BIZTRIP_SAVED_PAYMENT_URL = "/accounts/expressway";
|
|
9
|
+
export declare const BIZTRIP_LOGO_URL = "https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/CFW_SME/Biztrip_logo.png";
|
|
10
|
+
export declare const BIZTRIP_BRAND_LOGO: IHeaderBrandLogo;
|
|
11
|
+
export declare const BIZTRIP_HOVER_COLOR = "#0F6BFF";
|
|
12
|
+
export declare const BIZTRIP_NAVBAR_OPTIONS: NavbarOption[];
|
|
13
|
+
export declare const BIZTRIP_LOB_IMAGES: {
|
|
14
|
+
flights: string;
|
|
15
|
+
hotels: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const BIZTRIP_LOB_DATA: LobDataItem[];
|
|
18
|
+
export declare const BIZTRIP_ACCOUNT_HEADER_BACKGROUND = "#ECF3FF";
|
|
19
|
+
export declare const BIZTRIP_ACCOUNT_OPTIONS: IAccountOptionsPopupConfig[];
|
|
20
|
+
export declare const BIZTRIP_SUPPORT_CONFIG: ISupportConfig;
|
|
21
|
+
export declare const BIZTRIP_DESKTOP_API_KEY = "1230856B559-ED8A-4284-BB21-8373BB71F878";
|
|
22
|
+
export declare const BIZTRIP_ACCOUNT_PILLS: IAccountPill[];
|
|
23
|
+
//# sourceMappingURL=biztrip.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biztrip.constants.d.ts","sourceRoot":"","sources":["../packages/utils/src/biztrip.constants.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,YAAY,EACf,MAAM,oBAAoB,CAAC;AAkB5B,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAC7D,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,iBAAiB,oBAAoB,CAAC;AACnD,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAC1D,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AACtD,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE,eAAO,MAAM,gBAAgB,2GAC+E,CAAC;AAE7G,eAAO,MAAM,kBAAkB,EAAE,gBAUhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,sBAAsB,EAAE,YAAY,EAuChD,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;CAI9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,EAWzC,CAAC;AAEF,eAAO,MAAM,iCAAiC,YAAY,CAAC;AAE3D,eAAO,MAAM,uBAAuB,EAAE,0BAA0B,EAqB/D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cAIpC,CAAC;AAGF,eAAO,MAAM,uBAAuB,4CACS,CAAC;AAE9C,eAAO,MAAM,qBAAqB,EAAE,YAAY,EAO/C,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export interface BiztripApiErrorBody {
|
|
2
|
+
error?: {
|
|
3
|
+
message?: string;
|
|
4
|
+
uiMessage?: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export type OrgVerificationStatus = 'DRAFT' | 'PENDING' | 'ACTIVE' | 'REJECTED';
|
|
8
|
+
export type OrgVerificationEntity = 'organisation' | 'orgVerification';
|
|
9
|
+
export interface IOrgVerificationIdentifier {
|
|
10
|
+
id?: string;
|
|
11
|
+
identifierType: string;
|
|
12
|
+
identifierValue: string;
|
|
13
|
+
artifactRefId: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IOrgVerificationMetadata {
|
|
16
|
+
address?: string;
|
|
17
|
+
employeeCount?: string;
|
|
18
|
+
annualTravelSpend?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IOrganisationData {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
domains?: string[];
|
|
24
|
+
status?: string;
|
|
25
|
+
identifiers?: IOrgVerificationIdentifier[];
|
|
26
|
+
metadata?: IOrgVerificationMetadata;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
updatedAt?: string;
|
|
29
|
+
wallet?: IOrgVerificationWallet;
|
|
30
|
+
}
|
|
31
|
+
export interface IOrgVerificationWallet {
|
|
32
|
+
balance?: number;
|
|
33
|
+
minimumBalanceAlert?: number;
|
|
34
|
+
status?: 'ACTIVE' | 'INACTIVE';
|
|
35
|
+
}
|
|
36
|
+
export interface IOrgVerificationDetails {
|
|
37
|
+
id: string;
|
|
38
|
+
orgId?: string;
|
|
39
|
+
identifiers?: IOrgVerificationIdentifier[];
|
|
40
|
+
metadata?: IOrgVerificationMetadata;
|
|
41
|
+
status?: string;
|
|
42
|
+
createdAt?: string;
|
|
43
|
+
updatedAt?: string;
|
|
44
|
+
org?: {
|
|
45
|
+
id?: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
status?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface BiztripOnboardingResponse {
|
|
51
|
+
status: boolean;
|
|
52
|
+
data: {
|
|
53
|
+
status: OrgVerificationStatus;
|
|
54
|
+
entity: OrgVerificationEntity;
|
|
55
|
+
organisation: IOrganisationData;
|
|
56
|
+
orgVerification: IOrgVerificationDetails;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface IUserProfileAcquisition {
|
|
60
|
+
type: string;
|
|
61
|
+
orgId: string | null;
|
|
62
|
+
inviteId: string | null;
|
|
63
|
+
source: string;
|
|
64
|
+
}
|
|
65
|
+
export interface IUserProfileUser {
|
|
66
|
+
id: string;
|
|
67
|
+
firstName: string;
|
|
68
|
+
lastName: string;
|
|
69
|
+
email: string;
|
|
70
|
+
countryCode: string;
|
|
71
|
+
mobile: string;
|
|
72
|
+
emailVerified: boolean;
|
|
73
|
+
mobileVerified: boolean;
|
|
74
|
+
status: string;
|
|
75
|
+
acquisition: IUserProfileAcquisition;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
export interface IUserProfileOrgIdentifier {
|
|
80
|
+
id: string;
|
|
81
|
+
identifierType: string;
|
|
82
|
+
identifierValue: string;
|
|
83
|
+
artifactRefId: string;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
}
|
|
86
|
+
export interface IUserProfileOrg {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
status: string;
|
|
90
|
+
domains: string[];
|
|
91
|
+
identifiers: IUserProfileOrgIdentifier[];
|
|
92
|
+
createdAt: string;
|
|
93
|
+
updatedAt: string;
|
|
94
|
+
}
|
|
95
|
+
export interface BiztripProfileResponse {
|
|
96
|
+
data?: {
|
|
97
|
+
tenant?: string;
|
|
98
|
+
user: IUserProfileUser;
|
|
99
|
+
org?: IUserProfileOrg;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface BiztripEmployeeDetailsResponse {
|
|
103
|
+
status: boolean;
|
|
104
|
+
data?: {
|
|
105
|
+
user?: Record<string, unknown>;
|
|
106
|
+
membership?: {
|
|
107
|
+
employeeRole?: string;
|
|
108
|
+
[key: string]: unknown;
|
|
109
|
+
};
|
|
110
|
+
org?: Record<string, unknown>;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export type BiztripLogoutResult = {
|
|
114
|
+
success: boolean;
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=biztrip.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biztrip.types.d.ts","sourceRoot":"","sources":["../packages/utils/src/biztrip.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAChC,KAAK,CAAC,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACL;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAChF,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG,iBAAiB,CAAC;AAEvE,MAAM,WAAW,0BAA0B;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC3C,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC3C,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE;QACF,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACL;AAED,MAAM,WAAW,yBAAyB;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE;QACF,MAAM,EAAE,qBAAqB,CAAC;QAC9B,MAAM,EAAE,qBAAqB,CAAC;QAC9B,YAAY,EAAE,iBAAiB,CAAC;QAChC,eAAe,EAAE,uBAAuB,CAAC;KAC5C,CAAC;CACL;AAED,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,uBAAuB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,yBAAyB,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACnC,IAAI,CAAC,EAAE;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,gBAAgB,CAAC;QACvB,GAAG,CAAC,EAAE,eAAe,CAAC;KACzB,CAAC;CACL;AAED,MAAM,WAAW,8BAA8B;IAC3C,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE;QACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,UAAU,CAAC,EAAE;YACT,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;SAC1B,CAAC;QACF,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAAC;CACL;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
export interface IHeaderBrandLogo {
|
|
4
|
+
src: string;
|
|
5
|
+
alt: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface NavbarOption {
|
|
11
|
+
lefticon?: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
12
|
+
text?: string;
|
|
13
|
+
ravenActionName: string;
|
|
14
|
+
isHoverable: boolean;
|
|
15
|
+
isClickable: boolean;
|
|
16
|
+
link?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LobDataItem {
|
|
19
|
+
title: string;
|
|
20
|
+
image: string;
|
|
21
|
+
link: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IAccountOptionsPopupConfig {
|
|
24
|
+
text: string;
|
|
25
|
+
icon: ReactElement;
|
|
26
|
+
redirectionLink: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ISupportConfig {
|
|
29
|
+
email: string;
|
|
30
|
+
adminEmail: string;
|
|
31
|
+
phone: string;
|
|
32
|
+
}
|
|
33
|
+
export interface IAccountPill {
|
|
34
|
+
text: string;
|
|
35
|
+
icon: ReactElement;
|
|
36
|
+
onClick?: () => void;
|
|
37
|
+
backgroundColor?: string;
|
|
38
|
+
hoverBackgroundColor?: string;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=biztrip.ui.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"biztrip.ui.types.d.ts","sourceRoot":"","sources":["../packages/utils/src/biztrip.ui.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookZeroTrip.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/bookZeroTrip.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bookZeroTrip.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/bookZeroTrip.utils.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,2BAA2B,cACzB,MAAM,WACR,MAAM,KAChB,MAKF,CAAC;AAGF,eAAO,MAAM,6BAA6B,sBACnB,MAAM,KAC1B,MAeF,CAAC;AAEF,eAAO,MAAM,iCAAiC,sBACvB,MAAM,KAC1B,MAcF,CAAC;AAEF,eAAO,MAAM,+BAA+B,aAAc,MAAM,uCAU7D,CAAC;AACF,eAAO,MAAM,mCAAmC,aAAc,MAAM,yCAUnE,CAAC"}
|
package/dist/common.utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const urlJoin: (...parts: string[]) => string;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getBiztripApiDomain: () => string;
|
|
3
|
+
export declare const getApiDomain: () => "https://work.cleartrip.com" | "https://workqa2.cleartrip.com" | "https://qa2new.cleartrip.com" | "https://qa2.cleartrip.com" | "https://qa3new.cleartrip.com" | "https://www.cleartrip.com";
|
|
3
4
|
export declare const getNestedValue: (data: any, path: string[]) => any;
|
|
4
5
|
export declare const path: (p: string[], o: unknown) => unknown;
|
|
5
6
|
export declare const MULTI_SPACE: RegExp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/common.utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,aAAc,MAAM,EAAE,WAKzC,CAAC;AAEF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"common.utils.d.ts","sourceRoot":"","sources":["../packages/utils/src/common.utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,aAAc,MAAM,EAAE,WAKzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,MA0BtC,CAAC;AAEF,eAAO,MAAM,YAAY,oMAqBxB,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,GAAG,QAAQ,MAAM,EAAE,QAKvD,CAAC;AAEF,eAAO,MAAM,IAAI,MAAO,MAAM,EAAE,KAAK,OAAO,YAI3C,CAAC;AAEF,eAAO,MAAM,WAAW,QAAW,CAAC;AAEpC,eAAO,MAAM,OAAO,QAAS,GAAG,KAAG,OAkClC,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAS,OAAO,4BAO9C,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,GAAG,YAEnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MACiC,CAAC;AAE9D,eAAO,MAAM,aAAa,eAAgB,MAAM,kBAO/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,MAIrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAAM,GAAG,SAc1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAS,MAAM,KAAG,MAAM,GAAG,SAczD,CAAC;AAEF,eAAO,MAAM,QAAQ,eAEpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,OAgB5D;AAQD,eAAO,MAAM,wBAAwB,oBAElC,OAAO,OAAO,GAAG,QAAQ,EAAE,MAAM,CAAC,GACjC,OAAO,eAAe,GAAG,gBAAgB,EAAE,MAAM,CAUpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,GAAG,SAAS,KAAG,MAe7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,eACjB,MAAM,yCAGnB,MAkBF,CAAC;AAEF,eAAO,MAAM,cAAc,UAChB,MAAM,GAAG,MAAM,yBAEvB,MAqBF,CAAC;AAEF,eAAO,MAAM,SAAS;gBAON,MAAM;iBACL,MAAM;;;;;UAsBtB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB3E;AASD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAUhE;AAED,eAAO,MAAM,qBAAqB,SAAU,MAAM,KAAG,MAepD,CAAC;AAMF,eAAO,MAAM,wBAAwB,UAAW,MAAM,KAAG,MA6BxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,MAAM,WAKhD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("tslib"),e=require("uuid"),n=require("@cleartrip/ct-platform-constants"),r=require("ua-parser-js"),o=require("@cleartrip/ct-platform-types");function i(t){return t&&t.__esModule?t:{default:t}}var a=i(r),u=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.map((function(t){return t.trim().replace(/^[/]+/,"")})).join("/");return n=n.replace(/\/\?/g,"?")},s=function(){var t="undefined"!=typeof window?window.location.hostname:"";switch(console.log("API_BASE domain",t),t){case"localhost":case"0.0.0.0":case"qa2new.cleartrip.com":return"https://qa2new.cleartrip.com";case"qa2.cleartrip.com":return"https://qa2.cleartrip.com";case"qa3new.cleartrip.com":return"https://qa3new.cleartrip.com";case"beta.cleartrip.com":return"https://beta.cleartrip.com";default:return"https://www.cleartrip.com"}},l=function(t,e){return e.reduce((function(t,e){return t&&t[e]?t[e]:null}),t)},c=function(t){if(t instanceof Date)return!1;if(null==t)return!0;var e,n=function(t){return"[object Number]"===Object.prototype.toString.call(t)};if(n(t))return n(e=t)&&"NaN"===e.toString();if(t.length>0)return!1;if(0===t.length)return!0;if("object"!=typeof t)return!0;for(var r=Object.keys(t),o=0,i=r[o];o<r.length;o+=1)if(Object.prototype.hasOwnProperty.call(t,i))return!1;return!0},d="undefined"!=typeof window?window.location.href:"",v=function(t){return g()?"":new URLSearchParams(window.location.search).get(t)},p=function(){return"undefined"!=typeof window?(window.location.pathname+window.location.search).slice(1):""},_=function(t){if(t){var e=t.match(/h_(\d+)[,\/]/);return e&&e[1]?parseInt(e[1],10):void 0}},f=function(t){if(t){var e=t.match(/w_(\d+)[,\/]/);return e&&e[1]?parseInt(e[1],10):void 0}},g=function(){return"undefined"==typeof window||!window};function w(t,e){var n=e||l(document,["cookie"]);if(n){for(var r=t+"=",o=n.split(";"),i=0;i<o.length;i++){for(var a=o[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(r))return a.substring(r.length,a.length)}return""}return""}var m=function(t){try{if(!t||Number.isNaN(Number(t)))return"";var e=new Date(1e3*t),n=e.getFullYear(),r=String(e.getDate()).padStart(2,"0"),o=String(e.getMonth()+1).padStart(2,"0");return"".concat(n,"-").concat(o,"-").concat(r)}catch(t){return""}};var h=function(t){if(!t||""===t.trim())return"";var e=t.trim().split("-");if(3!==e.length)return"";var n=e[0],r=e[1],o=e[2];return 2!==n.length||2!==r.length||4!==o.length||isNaN(Number(n))||isNaN(Number(r))||isNaN(Number(o))?"":"".concat(n,"/").concat(r,"/").concat(o)},y=function(){var t,e=null===(t=l(window,["navigator","userAgent"]))||void 0===t?void 0:t.toLowerCase(),r=/safari/.test(e),o=/iphone|ipod|ipad/.test(e);return l(window,["androidData","app-agent"])&&l(window,["androidData","js-version"])||"function"==typeof l(window,["MobileApp","getAppSpecificData"])?n.Platform.ANDROID:l(window,["iosData","app-agent"])&&l(window,["iosData","js-version"])||o&&!r?n.Platform.IOS:n.Platform.PWA},S=function(){var t,e,r=y();return r===n.Platform.IOS?null!==(t=l(window,["iosData","app-agent"]))&&void 0!==t?t:n.AppAgent.IOS:r===n.Platform.ANDROID?null!==(e=l(window,["androidData","app-agent"]))&&void 0!==e?e:n.AppAgent.ANDROID:n.AppAgent.PWA},N=function(){if(g())return n.AppAgent.H_UNKNOWN;var t=y();return t===n.Platform.IOS?n.AppAgent.H_IOS:(t===n.Platform.ANDROID&&n.AppAgent.H_ANDROID,n.AppAgent.H_PWA)},E=function(){var t="";return A()?t=l(window,["iosData","js-version"]):O()&&(t=l(window,["androidData","js-version"])),t&&(t=t.toString().split(".")[0]),t},b=function(){var t,e,n,r;if(!g())return"";var o=new a.default(null===(t=null===window||void 0===window?void 0:window.navigator)||void 0===t?void 0:t.userAgent);return null!==(r=null===(n=null===(e=null==o?void 0:o.getDevice())||void 0===e?void 0:e.model)||void 0===n?void 0:n.toLowerCase())&&void 0!==r?r:""},P=function(){return y()!==n.Platform.ANDROID&&y()!==n.Platform.IOS},O=function(){return y()===n.Platform.ANDROID},T=function(t){return parseInt(E())>=t},A=function(){return y()===n.Platform.IOS},I=function(t,e){switch(e){case"android":return JSON.stringify(t);case"ios":return{action:"onUserLogin",properties:t};default:return t}},R=s(),D=function(r,o,i,a,l,c,d){return void 0===o&&(o=n.RequestMethods.GET),void 0===a&&(a={}),void 0===l&&(l={}),void 0===c&&(c=!1),void 0===d&&(d={}),t.__awaiter(void 0,void 0,void 0,(function(){var v,p,_,f,m,h,N,E,P,O,T,A;return t.__generator(this,(function(I){switch(I.label){case 0:return v=function(t,e){var r=n.API_ROUTES[t];if(r&&r.trim().length){if(r=u(R,r),null==e?void 0:e.pathParams)for(var o=0,i=Object.entries(e.pathParams);o<i.length;o++){var a=i[o],s=a[0],l=a[1];r=r.replace(":".concat(s),l)}return(null==e?void 0:e.queryParams)&&(r+="?".concat(new URLSearchParams(e.queryParams).toString())),r}}(r,l),v&&v.trim().length?(p="",_="",f=s(),g()||(p=y(),_=JSON.stringify(function(r){var o={trackingId:e.v4(),source:n.SOURCE_NAME};return g()?t.__assign(t.__assign({},o),null!=r?r:{}):t.__assign(t.__assign(t.__assign({},o),{platform:S(),deviceModel:b()}),null!=r?r:{})}(d))),m=g()?"":w(n.FEATURE_COOKIE_NAME)||"",h={method:o,headers:t.__assign(t.__assign({channel:p,Caller:R,Origin:R,Referer:R,Authority:f,x_ct_sourcetype:"MOBILE","app-agent":S(),"x-unified-header":_,"Content-Type":"application/json"},m&&(A={},A[n.FEATURE_COOKIE_NAME]=m,A)),a)},i&&(h.body=JSON.stringify(i)),[4,fetch(v,h)]):[2,Promise.reject("URL parameter missing")];case 1:return E=I.sent(),P={name:"API_FAILURE",status:E.status,message:"UNKNOWN_ERROR",statusText:E.statusText},(null==E?void 0:E.ok)?[3,3]:c?[2,Promise.reject(P)]:[4,E.json()];case 2:throw O=I.sent().message,P.message=O,P;case 3:return(null==(T=E.headers.get("content-type"))?void 0:T.includes("application/json"))?[4,E.json()]:[3,5];case 4:return N=I.sent(),[3,9];case 5:return(null==T?void 0:T.includes("text"))?[4,E.text()]:[3,7];case 6:return N=I.sent(),[3,9];case 7:return 204===E.status?[3,9]:[4,E.blob()];case 8:N=I.sent(),I.label=9;case 9:return[2,{data:N,status:E.status}]}}))}))},x=function(e,r,o,i,a){return void 0===r&&(r={}),void 0===o&&(o={}),void 0===i&&(i=!1),void 0===a&&(a={}),t.__awaiter(void 0,void 0,void 0,(function(){return t.__generator(this,(function(u){return[2,D(e,n.RequestMethods.GET,null,t.__assign({expires:"0",accept:"application/json","cache-control":"no-cache"},r),o,i,a)]}))}))},U=function(e,r,o,i,a,u,s){return void 0===r&&(r=n.RequestMethods.POST),void 0===o&&(o={}),void 0===i&&(i={}),void 0===a&&(a={}),void 0===u&&(u=!1),void 0===s&&(s={}),t.__awaiter(void 0,void 0,void 0,(function(){return t.__generator(this,(function(n){return[2,D(e,r,o,t.__assign({expires:"0",accept:"application/json","cache-control":"no-cache"},i),a,u,s)]}))}))},C=function(t,e){return(null==t?void 0:t.length)>e?"".concat(null==t?void 0:t.substring(0,e),"..."):t||""},M=function(t){var e,r=null==t?void 0:t.toLowerCase();return((e={})[n.HOTEL_VERTICAL]=n.HOTEL_FUNNEL_JOURNEY,e[n.AIR_VERTICAL]=n.AIR_FUNNEL_JOURNEY,e[n.UAR_VERTICAL]=n.FUNNEL_JOURNEY,e)[r]||n.FUNNEL_JOURNEY},L=function(t,e){return t&&e===n.UAR_VERTICAL?n.MAX_DISPLAYED_CARDS:n.MIN_DISPLAYED_CARDS},k=function(t,e){var r,o=null==t?void 0:t.toLowerCase(),i=((r={})[n.HOTEL_VERTICAL]="h_",r[n.AIR_VERTICAL]="a_",r[n.UAR_VERTICAL]="u_",r)[o]||"u_";return"".concat(i).concat(e)},F=function(t){try{if(!t||""===t.trim())return null;if(!/^\d{2}-\d{2}-\d{4}$/.test(t.trim()))return null;var e=t.split("-");if(3!==e.length)return null;var n=Number(e[0]),r=Number(e[1]),o=Number(e[2]);if(isNaN(n)||isNaN(r)||isNaN(o)||n<1||n>31||r<1||r>12||o<1e3)return null;var i=new Date(o,r-1,n);return i.getFullYear()!==o||i.getMonth()!==r-1||i.getDate()!==n?null:{day:n,month:r-1,year:o}}catch(t){return console.error("Error parsing travel date:",t),null}},H=function(t,e){var n,r;try{var o=null!==(n=null==e?void 0:e.trim())&&void 0!==n?n:"",i=null!==(r=null==t?void 0:t.trim())&&void 0!==r?r:"";if(""===o)return"na";var a=F(i),u=F(o);if(!a||!u)return"na";var s=Date.UTC(a.year,a.month,a.day),l=Date.UTC(u.year,u.month,u.day)-s;return l<0?"na":String(l/864e5)}catch(t){return"na"}},j=function(t,e){var n,r,o=null==t?void 0:t.metaData;return{h_search_destination:(null==t?void 0:t.title)||"na",h_search_destination_city:(null==o?void 0:o.location)||"na",h_checkin_date:h(null===(n=null==o?void 0:o.travelDates)||void 0===n?void 0:n.start)||"na",h_checkout_date:h(null===(r=null==o?void 0:o.travelDates)||void 0===r?void 0:r.end)||"na",h_room_count:(null==o?void 0:o.roomCount)||"na",h_hotel_id:(null==o?void 0:o.hotelId)||"na",h_hotel_name:(null==o?void 0:o.hotelName)||"na",h_utm_source:(null==o?void 0:o.utmSource)||"organic",h_horizontal_rank:e.toString()||"na"}},q=function(t,e){var n,r,o=null==t?void 0:t.metaData,i=null===(n=null==o?void 0:o.travelDates)||void 0===n?void 0:n.start,a=null===(r=null==o?void 0:o.travelDates)||void 0===r?void 0:r.end;return{search_destination:(null==o?void 0:o.destination)||"na",search_origin:(null==o?void 0:o.source)||"na",onward_date:h(i)||"na",return_date:h(a)||"na",journey_type:(null==o?void 0:o.journeyType)||"na",trip_type:(null==o?void 0:o.tripType)||"na",adult_count:(null==o?void 0:o.adultCount)||"na",child_count:(null==o?void 0:o.childCount)||"na",infant_count:(null==o?void 0:o.infantCount)||"na",fare_type:(null==o?void 0:o.ptcFareType)||"na",is_cfw_user:(null==o?void 0:o.isCfwUser)||"na",a_horizontal_rank:(null==e?void 0:e.toString())||"na",dx:H(i,a)}},J=function(t){var e=t.getDate(),n=t.toLocaleString("en-GB",{month:"short"});return"".concat(e," ").concat(n)},Y=function(t){var e=F(t);if(!e)return null;var n=new Date(e.year,e.month,e.day);return Number.isNaN(n.getTime())?null:n},B=function(e,n){return t.__assign({type:"EMAIL",value:e,action:"UPDATE_EMAIL"},n?{otp:n}:{})},G=function(t){var e="",r=t.match(n.MOBILE_CONSTANTS.REGEX);return r&&(e=r[0].replace(/\D/g,"")),e},V=function(){var t,e,n;null===(n=null===(e=null===(t=window.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===e?void 0:e.PWA_IS_SIGNIN)||void 0===n||n.postMessage({isSignIn:!0})},W=function(){var t;null===(t=window.MobileApp)||void 0===t||t.onPWALoginStatus(JSON.stringify({isSignIn:!0}))},K=function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,n;return t.__generator(this,(function(t){return(null===(n=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===n?void 0:n.get)&&"OTPCredential"in window?(e=new AbortController,setTimeout((function(){e.abort()}),6e4),[2,navigator.credentials.get({otp:{transport:["sms"]},signal:e.signal}).then((function(t){return null==t?void 0:t.code}))]):[2,Promise.reject("NOT_SUPPORTED")]}))}))},z=function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,n;return t.__generator(this,(function(t){return n=new Promise((function(t){e=t})),window.sendOtpValue=function(t){e(t)},[2,n]}))}))},Z=function(e,r,o){return t.__awaiter(void 0,void 0,void 0,(function(){var i,a;return t.__generator(this,(function(t){switch(t.label){case 0:return i=s(),[4,U("FK_REDIRECTION_INFO",n.RequestMethods.POST,{provider:"flipkart",fallbackUri:u(i,e||o),signupPageUri:u(i,r||"personal-details"),currentPageUri:u(i,o)})];case 1:return[2,null==(a=t.sent())?void 0:a.data]}}))}))},$=function(t){var e,n=null!==(e=null==t?void 0:t.params)&&void 0!==e?e:{},r=null==t?void 0:t.redirectUri;if(r){for(var o in r+="?",n)r+=o+"="+n[o]+"&";return Promise.resolve(r)}return Promise.reject()},Q=function(e){var n,r,o=null==e?void 0:e.params;if(c(o)||"function"!=typeof(null===(n=window.MobileApp)||void 0===n?void 0:n.onNavigationChange))return Promise.reject();var i=u(s(),"dl/oauth2");return null===(r=window.MobileApp)||void 0===r||r.onNavigationChange(JSON.stringify({type:"FkSSO",miscData:t.__assign(t.__assign({},o),{redirectURI:i})})),Promise.resolve()};function X(t){try{var e=decodeURIComponent(w("userid",t)||"").split("|");return{email:e[0],profileName:e[1],gender:e[2],photo:e[3],userId:e[4]}}catch(t){return{}}}var tt=function(t){var e=X(t)||{};return!!(decodeURIComponent(w("usermisc",t)||"").split("|").includes("SIGNED_IN")&&e.userId&&e.userId.length>0)},et=function(e){return t.__awaiter(void 0,void 0,void 0,(function(){var n;return t.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,x("USER_INSIGHTS",{},{pathParams:{userId:e}})];case 1:return[2,null==(n=t.sent())?void 0:n.data];case 2:return t.sent(),[2,Promise.resolve(null)];case 3:return[2]}}))}))},nt=function(e){return t.__awaiter(void 0,void 0,void 0,(function(){var n,r,o,i,a,u,s,l;return t.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),(n=null!=e?e:X().userId)?(r=null===(u=null===window||void 0===window?void 0:window.sessionStorage)||void 0===u?void 0:u.getItem("martech_user_attributes"),o=void 0,"string"==typeof r&&(o=JSON.parse(r)),n!==(null==o?void 0:o.accountId)&&(null===(s=null===window||void 0===window?void 0:window.sessionStorage)||void 0===s||s.removeItem("martech_user_attributes")),[4,et(n)]):(null===(a=null===window||void 0===window?void 0:window.sessionStorage)||void 0===a||a.removeItem("martech_user_attributes"),[2,null]);case 1:return i=t.sent(),c(null==i?void 0:i.data)?[2,null]:(null===(l=null===window||void 0===window?void 0:window.sessionStorage)||void 0===l||l.setItem("martech_user_attributes",JSON.stringify(null==i?void 0:i.data)),[2,null==i?void 0:i.data]);case 2:return t.sent(),[2,null];case 3:return[2]}}))}))},rt=function(t){return Object.keys(t).forEach((function(e){t[e]="a_fare_price"===e||"a_ct_discount"===e||"supercoin_balance"===e||"supercoin_earned"===e||"supercoin_burnt"===e||"wallet_balance_used"===e||"convenience_fee"===e?Number(t[e]):""+t[e]})),t},ot=function(){try{if(g())return"";var t=w("ct_statsig_experiments")||"{}",e=t?JSON.parse(decodeURIComponent(t)):{};return Object.keys(e).map((function(t){return t&&e[t]?"".concat(t,":").concat(e[t]):""})).filter((function(t){return!!t})).join("|")}catch(t){return""}},it=function(e,n){var r;if(window&&window.ravenWebManager){var o=ut(),i={page_name:o.pageName,u_utm_source:o.utmSource,domain:window.location.host,u_ab_key:ot(),platform:null===(r=y())||void 0===r?void 0:r.toLowerCase(),login_status:tt()?"yes":"no"},a=rt(n),u=window.ravenWebManager;null==u||u.triggerRaven(e,t.__assign(t.__assign({},i),a))}},at=function(){if(window&&"undefined"!=typeof window){var t=l(window,["location","pathname"]);if("/"===t||"/flights"===t)return!0}return!1},ut=function(){var t,e;if(window&&"undefined"!=typeof window){var n=window.location.pathname,r=null!==(t=v("service"))&&void 0!==t?t:"",o=null!==(e=v("utm_source"))&&void 0!==e?e:"organic",i=at()?"skippable_login":"account_login",a="air",u=n.includes("flights/itinerary")||r.includes("flights/itinerary")?"a_itinerary":"a_home";return r.includes("my-account")&&(a="uar",u="account"),r.includes("hotels")&&(a="hotel",u=r.includes("hotels/itinerary")?"h_itinerary":"h_home"),r.includes("bus")&&(a="bus",u=r.includes("bus/itinerary")?"b_itinerary":"b_home"),{loginForm:i,vertical:a,pageName:u,utmSource:o}}return{}},st=function(t){var e,n,r,o,i,a,u,s,l;c(t)||(null===(e=null===window||void 0===window?void 0:window.sessionStorage)||void 0===e?void 0:e.getItem("martech_user_props_sent"))||(A()&&(null===(r=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===r?void 0:r.SEND_ATTRIBUTES)?(null===(o=window.webkit.messageHandlers.SEND_ATTRIBUTES)||void 0===o||o.postMessage({type:"GA",params:t}),null===(i=window.webkit.messageHandlers.SEND_ATTRIBUTES)||void 0===i||i.postMessage({type:"Clevertap",params:t}),null===(a=null===window||void 0===window?void 0:window.sessionStorage)||void 0===a||a.setItem("martech_user_props_sent","true")):O()&&(null===(u=null===window||void 0===window?void 0:window.MobileApp)||void 0===u?void 0:u.sendAttributes)?(window.MobileApp.sendAttributes("GA",JSON.stringify(t)),window.MobileApp.sendAttributes("Clevertap",JSON.stringify(t)),null===(s=null===window||void 0===window?void 0:window.sessionStorage)||void 0===s||s.setItem("martech_user_props_sent","true")):P()&&window.clevertap&&(window.clevertap.profile.push({Site:t}),null===(l=null===window||void 0===window?void 0:window.sessionStorage)||void 0===l||l.setItem("martech_user_props_sent","true")))},lt=function(){function t(){this.STORAGE_KEY="appPushUTMAttributes",this.utmParamsToTrack=["utm_custom","traffic_source"]}return t.prototype.saveCurrentURLParams=function(){if(g())return!1;var t=window.location.search.slice(1);return!!t&&this.setParamsToStorage(t)},t.prototype.getStoredParams=function(){if(g())return{};try{var t=sessionStorage.getItem(this.STORAGE_KEY);if(!t)return{};var e=JSON.parse(t).utmParams||"";if(!e)return{};var n=new URLSearchParams(e),r={};return n.forEach((function(t,e){r[e]=t})),r}catch(t){return console.error("Error parsing stored UTM params:",t),{}}},t.prototype.setParamsToStorage=function(t){if(g())return!1;var e=new URLSearchParams(t),n=sessionStorage.getItem(this.STORAGE_KEY);if(n)try{var r=JSON.parse(n).utmParams||"";if(r){var o=new URLSearchParams(r);new URLSearchParams(t).forEach((function(t,e){o.set(e,t)})),e=o}}catch(t){console.error("Error merging existing UTM params:",t)}try{var i={utmParams:e.toString()};return sessionStorage.setItem(this.STORAGE_KEY,JSON.stringify(i)),!0}catch(t){return console.error("Error storing UTM params:",t),!1}},t.prototype.getSpecificParams=function(t){var e={},n=this.getStoredParams();return Array.isArray(t)?(t.forEach((function(t){Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])})),e):(console.warn("getSpecificParams expects an array of strings."),e)},t.prototype.clearStoredParams=function(){g()||sessionStorage.removeItem(this.STORAGE_KEY)},t.prototype.getUTMBasedParams=function(){return this.getSpecificParams(this.utmParamsToTrack)},t.prototype.setUTMParamsToTrack=function(t){this.utmParamsToTrack=t},t.prototype.getSpecificParamsFromURL=function(t){if(g())return{};var e={};return t.forEach((function(t){var n;e[t]=null!==(n=new URLSearchParams(window.location.search).get(t))&&void 0!==n?n:""})),e},t}(),ct=Object.freeze(new lt);exports.MULTI_SPACE=/\s\s+/g,exports.autoReadOtp=function(){return t.__awaiter(void 0,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,O()?z():K()]}))}))},exports.batchRavenEvent=function(t,e){"undefined"!=typeof window&&"function"==typeof window.requestIdleCallback?requestIdleCallback((function(){it(t,e)})):setTimeout((function(){it(t,e)}),0)},exports.buildFlightsCardRavenPayload=q,exports.buildHotelCardRavenPayload=j,exports.constructHotelImage=function(t){return(null==t?void 0:t.trim())?t.startsWith("https")?t:"https://rukmini-ct.flixcart.com/w_208,h_240,fl_progressive,e_sharpen:80,q_auto,c_fill/ct-hotel-images/places/hotels".concat(t):n.DEFAULT_IMAGE_URL},exports.createAPIRequest=D,exports.createGetRequest=x,exports.createPostOrPutRequest=U,exports.createRecentSearchCardRavenPayload=function(e,r,o,i){return t.__assign(t.__assign(t.__assign(t.__assign({},r),{action_name:e,card_number:null==o?void 0:o.id}),(null==o?void 0:o.type)===n.HOTEL_FUNNEL_JOURNEY?j(o,i):{}),(null==o?void 0:o.type)===n.AIR_FUNNEL_JOURNEY?q(o,i):{})},exports.extractQueryParamsAsObj=function(t){try{var e=new URL(t),n=new URLSearchParams(e.search),r={};return n.forEach((function(t,e){r[e]=t})),r}catch(t){return{}}},exports.fetchRecentSearchesData=function(e,n,r,o,i){return void 0===r&&(r=5e3),void 0===o&&(o={}),void 0===i&&(i={}),t.__awaiter(void 0,void 0,void 0,(function(){var a,u,s,l,c,d,v,p;return t.__generator(this,(function(_){switch(_.label){case 0:a=[{usecase:"FUNNEL_JOURNEY",content:[]}],_.label=1;case 1:return _.trys.push([1,3,,4]),u=null,s=new Promise((function(t){u=setTimeout((function(){t(a[0])}),r)})),l=M(n),c=L(e,n),d=function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,n;return t.__generator(this,(function(r){switch(r.label){case 0:return[4,x("GET_CYS_RECENT_SEARCHES",o,{queryParams:t.__assign({usecases:l,size:c.toString()},i)})];case 1:return e=r.sent(),[2,null===(n=null==e?void 0:e.data)||void 0===n?void 0:n[0]]}}))}))},[4,Promise.race([d(),s])];case 2:return v=_.sent(),u&&clearTimeout(u),[2,v];case 3:return p=_.sent(),console.error("Error fetching recent searches",p),[2,a[0]];case 4:return[2]}}))}))},exports.formatBookZeroPaymentDueLabel=function(t){var e=new Date(t);if(Number.isNaN(e.getTime()))return"";var n=e.getDate(),r=e.toLocaleString("en-GB",{month:"short"}),o=e.toLocaleString("en-IN",{hour:"numeric",minute:"2-digit",hour12:!0}).toLowerCase();return"by ".concat(function(t){var e=t%10,n=t%100;return"".concat(t,1===e&&11!==n?"st":2===e&&12!==n?"nd":3===e&&13!==n?"rd":"th")}(n)," ").concat(r,", ").concat(o)},exports.formatBookZeroStayDateRange=function(t,e){var n=Y(t),r=Y(e);return n&&r?"".concat(J(n)," - ").concat(J(r)):""},exports.formatCurrency=function(t,e){void 0===e&&(e=!0);try{var n={currency:"INR",minimumFractionDigits:0};return e&&(n.style="currency"),"string"!=typeof t&&(t=null==t?void 0:t.toString()),t=t.replace(/,/g,""),parseInt(t,10).toLocaleString("en-IN",n)}catch(t){return""}},exports.formatDateForWithSlashes=h,exports.formatFullDateString=function(t,e,n){void 0===e&&(e="dd-mm-yyyy"),void 0===n&&(n="");try{var r=new Date(t),o=r.getFullYear(),i=String(r.getDate()).padStart(2,"0"),a=String(r.getMonth()+1).padStart(2,"0");return"yyyy-mm-dd"===e?"".concat(o,"-").concat(a,"-").concat(i):"".concat(i,"-").concat(a,"-").concat(o)}catch(t){return n}},exports.formatRemainingMsAsHoursCountdown=function(t){var e,n=(new Date(t).getTime()-(new Date).getTime())/36e5;if(n>0&&n<=24){var r=Math.max(1,Math.floor(n));e="".concat(r," hrs remaining to pay")}return e},exports.getApiDomain=s,exports.getAppAgent=S,exports.getAppAgentForHotelUnifiedHeader=N,exports.getAutoDetectedMobile=G,exports.getCTStatsigExpForRaven=ot,exports.getCookie=w,exports.getCurrentPathName=p,exports.getCurrentUrl=d,exports.getDeviceModel=b,exports.getDevicePlatform=y,exports.getDimensionFromImageUrl=function(t){void 0===t&&(t="");var e=_(t)||0,n=f(t)||0;return{height:"".concat(e,"px"),width:"".concat(n,"px"),heightInNumber:e,widthInNumber:n}},exports.getEventNameByVertical=k,exports.getFlightsTitleParts=function(t,e,r){var o=(null==t?void 0:t.split("_"))||[];return 2!==(null==o?void 0:o.length)?null:{origin:C(null==o?void 0:o[0],r),destination:C(null==o?void 0:o[1],r),isOneWay:(null==e?void 0:e.journeyType)===n.JOURNEY_TYPE_ONE_WAY}},exports.getFunnelJourneyType=M,exports.getFutureDateFromDays=function(t){try{var e=new Date;e.setDate(e.getDate()+t);var n=e.getDate(),r=e.toLocaleString("default",{month:"short"}),o=e.getFullYear();return"".concat(n," ").concat(r,", ").concat(o)}catch(t){return""}},exports.getHeightFromImgUrl=_,exports.getHotelCrossSellRecos=function(e,n,r,o,i,a,u,s,l){return void 0===r&&(r=450),void 0===o&&(o="Flyer Exclusive"),void 0===i&&(i="deal on hotels"),void 0===a&&(a="CTBEST - Code pre-applied for you."),void 0===u&&(u={}),void 0===s&&(s={}),void 0===l&&(l=!1),t.__awaiter(void 0,void 0,void 0,(function(){var c,d,v,p,_,f;return t.__generator(this,(function(g){switch(g.label){case 0:c=null!==(f=null===(_=X())||void 0===_?void 0:_.userId)&&void 0!==f?f:"",d={couponCode:"",couponCallOut:"",couponCallOutPrefix:o,couponCallOutSuffix:i,offerCallOut:a,pageLandingUrl:n,knowMoreFlag:l},g.label=1;case 1:return g.trys.push([1,3,,4]),v=new Promise((function(t){setTimeout((function(){t(d)}),r)})),p=x("HOTEL_RECOMMENDATIONS",u,{queryParams:t.__assign({userId:c,vertical:e},s)},!1,{userBuckets:{"x-cross-sell":"true"},platform:N()}).then((function(t){return t.data})),[4,Promise.race([p,v])];case 2:return[2,g.sent()];case 3:return g.sent(),[2,d];case 4:return[2]}}))}))},exports.getJSVersion=E,exports.getLOBType=function(t){switch(t){case n.HOTEL_FUNNEL_JOURNEY:return"Hotels";case n.AIR_FUNNEL_JOURNEY:return"Flights";default:return""}},exports.getNestedValue=l,exports.getNoOfDaysFromToday=function(t){var e=new Date(t),n=new Date;n.setHours(12,0,0,0),e.setHours(12,0,0,0);var r=(e.getTime()-n.getTime())/864e5;return Math.round(r)},exports.getQueryParam=v,exports.getRavenEventProps=ut,exports.getRecentSearchCardTravelDateText=function(t){var e=t||{},r=e.cardType,o=void 0===r?"":r,i=e.journeyType,a=void 0===i?"":i,u=e.travelDates,s=void 0===u?{}:u,l=F(null==s?void 0:s.start),c=F(null==s?void 0:s.end);return o===n.AIR_FUNNEL_JOURNEY&&a===n.JOURNEY_TYPE_ONE_WAY?l?function(t){try{var e=n.MONTH_NAMES[t.month];if(!e||!t.day||!t.year)return"";var r=String(t.year).slice(-2);return"".concat(t.day," ").concat(e," ").concat(r)}catch(t){return console.error("Error formatting travel date label:",t),""}}(l):"":l&&c?function(t,e){try{var r=n.MONTH_NAMES[t.month],o=n.MONTH_NAMES[e.month];if(!(r&&o&&t.day&&e.day))return"";var i=String(t.year).slice(-2),a=String(e.year).slice(-2);return t.month===e.month&&t.year===e.year?"".concat(t.day," - ").concat(e.day," ").concat(r," ").concat(i):t.year===e.year?"".concat(t.day," ").concat(r," - ").concat(e.day," ").concat(o," ").concat(i):"".concat(t.day," ").concat(r," ").concat(i," - ").concat(e.day," ").concat(o," ").concat(a)}catch(t){return console.error("Error formatting travel date range label:",t),""}}(l,c):""},exports.getSize=L,exports.getTravelDatesDayDifferenceForDx=H,exports.getUserAuthValues=X,exports.getUtmSourceEventData=function(t){var e,r,o=(null===(r=w(n.UTM_SOURCE))||void 0===r?void 0:r.toLowerCase())||"organic";return(e={})[k(t,"utm_source")]=o,e},exports.getWidthFromImgUrl=f,exports.handleFKSSO=function(e,n){return t.__awaiter(void 0,void 0,void 0,(function(){var n,r;return t.__generator(this,(function(t){switch(t.label){case 0:return A()?[2,Promise.reject()]:(n=p(),[4,Z(e,n,n)]);case 1:return r=t.sent(),O()?[2,Q(r)]:[2,$(r)]}}))}))},exports.handleProfileFetch=function(e){return void 0===e&&(e=!0),t.__awaiter(void 0,void 0,void 0,(function(){var n;return t.__generator(this,(function(r){switch(r.label){case 0:return[4,t.__awaiter(void 0,void 0,void 0,(function(){var e,n;return t.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,x("GET_PROFILE_DETAILS",{caller:s(),"app-agent":S()},{})];case 1:return[2,null==(e=t.sent())?void 0:e.data];case 2:return n=t.sent(),console.error("Failed to fetch user details. Error: ",n),[2,Promise.resolve(null)];case 3:return[2]}}))}))];case 1:return(n=r.sent())&&e&&function(t){var e,n,r,o,i,a,u,s;try{if(g()||!(null===window||void 0===window?void 0:window.clevertap)||c(t))return;var l={Identity:null!==(e=null==t?void 0:t.id)&&void 0!==e?e:"",Gender:null!==(n=null==t?void 0:t.gender)&&void 0!==n?n:"",Email:null!==(r=null==t?void 0:t.username)&&void 0!==r?r:"",Phone:"".concat(null==t?void 0:t.countryCode).concat(null==t?void 0:t.mobile),"MSG-sms":!0,"MSG-push":!0,"MSG-email":!1,"MSG-whatsapp":!0};if(null===(o=null==t?void 0:t.travellerDetails)||void 0===o?void 0:o.length)for(var d=0;d<(null===(i=null==t?void 0:t.travellerDetails)||void 0===i?void 0:i.length);d++){var v=null==t?void 0:t.travellerDetails[d];if(v.isRegistered){var p=v.personalDetails.dateOfBirth;l.Name="".concat(v.personalDetails.firstName," ").concat(v.personalDetails.lastName),isNaN(p)||(l.DOB=new Date(p));break}}if(O()&&(null===window||void 0===window?void 0:window.CleverTap)){var _=I(l,"android");return void(null===window||void 0===window||window.CleverTap.onUserLogin(_))}if(A()&&(null===(u=null===(a=null===window||void 0===window?void 0:window.webkit)||void 0===a?void 0:a.messageHandlers)||void 0===u?void 0:u.clevertap))return _=I(l,"ios"),void window.webkit.messageHandlers.clevertap.postMessage(_);null===(s=null===window||void 0===window?void 0:window.clevertap)||void 0===s||s.onUserLogin.push({Site:l})}catch(t){console.log("Error pushing clevertap profile information. Error: ",t)}}(n),[2]}}))}))},exports.handlePushPrimerCTA=function(t){var e,n,r,o,i,a,u,s;O()&&"function"==typeof(null===(e=window.MobileApp)||void 0===e?void 0:e.handlePNPermission)?null===(n=window.MobileApp)||void 0===n||n.handlePNPermission(JSON.stringify({type:t})):A()&&(null===(o=null===(r=null===window||void 0===window?void 0:window.webkit)||void 0===r?void 0:r.messageHandlers)||void 0===o?void 0:o.HANDLE_PN_PERMISSION)&&(null===(s=null===(u=null===(a=null===(i=window.webkit)||void 0===i?void 0:i.messageHandlers)||void 0===a?void 0:a.HANDLE_PN_PERMISSION)||void 0===u?void 0:u.postMessage)||void 0===s||s.call(u,JSON.stringify({type:t})))},exports.isAirHomePage=at,exports.isAndroidApp=O,exports.isEmpty=c,exports.isFKSSOEnabled=function(){return P()||!A()&&T(5)},exports.isHTMLInputElement=function(t){return"object"==typeof t&&null!==t&&"value"in t&&t instanceof HTMLInputElement},exports.isIOSApp=A,exports.isJSVersionUpdated=T,exports.isNumeric=function(t){return/^[0-9]*$/.test(t)},exports.isPwa=P,exports.isServer=g,exports.isUserSignedIn=tt,exports.isValidMobileNumber=function(t){return(null==t?void 0:t.length)===n.MOBILE_CONSTANTS.LENGTH&&/^\d{10}$/.test(t)},exports.mapBookZeroRavenEventActionName=function(t){switch(null==t?void 0:t.toLowerCase()){case"uar":return"u_ui_action";case"hotels":return"h_ui_action";default:return""}},exports.mapBookZeroRavenEventImpressionName=function(t){switch(null==t?void 0:t.toLowerCase()){case"uar":return"u_impression";case"hotels":return"h_impression";default:return""}},exports.parseTravelDate=F,exports.path=function(t,e){return t.reduce((function(t,e){return t&&t[e]?t[e]:null}),e)},exports.ravenSDKTrigger=it,exports.removeCardFromContentById=function(t,e){var n;return null!==(n=null==t?void 0:t.filter((function(t){return(null==t?void 0:t.id)!==e})))&&void 0!==n?n:[]},exports.removeRecentSearchCardViaApi=function(e,r,o){return t.__awaiter(void 0,void 0,void 0,(function(){var i,a;return t.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),i=M(o),[4,U("REMOVE_CYS_RECENT_SEARCHES_CARD",n.RequestMethods.POST,{usecase:i,content:{id:e,type:r}})];case 1:return t.sent(),[3,3];case 2:return a=t.sent(),console.error("Error removing CYS card:",a),[3,3];case 3:return[2]}}))}))},exports.secondsToDateString=m,exports.sendEmailOtp=function(e){return t.__awaiter(void 0,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,U("SEND_OTP",n.RequestMethods.POST,B(e))]}))}))},exports.sendEventWithUserInsights=function(e,n,r){return t.__awaiter(void 0,void 0,void 0,(function(){var o,i,a,u,s,l,d,v,p,_,f,g,w,h,y,S,N,E,b,P;return t.__generator(this,(function(O){switch(O.label){case 0:return[4,nt(r)];case 1:return o=O.sent(),i=t.__assign(t.__assign({},n),{fk_loyalty_status:"na",fk_loyalty_end_dt:"na",ct_last_booking_dt:"na",ct_lifetime_booking:"na",fk_loyalty_start_dt:"na",ct_first_booking_dt:"na",myntra_loyalty_status:"na",ct_postmerger_booking:"na",ct_last_1year_booking:"na",myntra_loyalty_end_dt:"na",ct_2nd_last_booking_dt:"na",myntra_loyalty_start_dt:"na"}),c(o)||(a=(null!==(s=null==o?void 0:o.loyaltyStatus)&&void 0!==s?s:[]).reduce((function(e,n){return t.__assign(t.__assign({},e),n)}),{}),u={ct_lifetime_booking:(null!==(d=null===(l=null==o?void 0:o.bookingStatus)||void 0===l?void 0:l.lifetimeBooking)&&void 0!==d?d:"na").toString(),ct_postmerger_booking:(null!==(p=null===(v=null==o?void 0:o.bookingStatus)||void 0===v?void 0:v.postmergerBooking)&&void 0!==p?p:"na").toString(),ct_last_1year_booking:(null!==(f=null===(_=null==o?void 0:o.bookingStatus)||void 0===_?void 0:_.lastOneYearBooking)&&void 0!==f?f:"na").toString(),ct_first_booking_dt:m(null===(g=null==o?void 0:o.bookingStatus)||void 0===g?void 0:g.firstbookingDate)||"na",ct_last_booking_dt:m(null===(w=null==o?void 0:o.bookingStatus)||void 0===w?void 0:w.lastbookingDate)||"na",ct_2nd_last_booking_dt:m(null===(h=null==o?void 0:o.bookingStatus)||void 0===h?void 0:h.secondLastbookingDate)||"na",fk_loyalty_status:(null===(y=null==a?void 0:a.fk)||void 0===y?void 0:y.program)||"na",myntra_loyalty_status:(null===(S=null==a?void 0:a.myntra)||void 0===S?void 0:S.program)||"na",fk_loyalty_end_dt:m(null===(N=null==a?void 0:a.fk)||void 0===N?void 0:N.loyaltyEndDate)||"",fk_loyalty_start_dt:m(null===(E=null==a?void 0:a.fk)||void 0===E?void 0:E.loyaltyStartDate)||"na",myntra_loyalty_start_dt:m(null===(b=null==a?void 0:a.myntra)||void 0===b?void 0:b.loyaltyStartDate)||"na",myntra_loyalty_end_dt:m(null===(P=null==a?void 0:a.myntra)||void 0===P?void 0:P.loyaltyEndDate)||"na"},i=t.__assign(t.__assign({},i),u),st(u)),it(e,i),[2]}}))}))},exports.sendLoginOtp=function(e,r){return t.__awaiter(void 0,void 0,void 0,(function(){var o;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,U("SEND_OTP",n.RequestMethods.POST,{value:e,type:"MOBILE",action:"SIGNIN",countryCode:n.MOBILE_CONSTANTS.COUNTRY_CODE},{"ab-otp":"b",dvid_data:r})];case 1:return[2,null==(o=t.sent())?void 0:o.data]}}))}))},exports.setCookie=function(t){var e,n=t.cookieName,r=t.cookieValue,o=t.expiryInDay,i=t.expiryInHours,a=t.expiryInMinutes,u=new Date;o?(u.setTime(u.getTime()+24*o*60*60*1e3),e=u.toUTCString()):i?(u.setTime(u.getTime()+3600*i*1e3),e=u.toUTCString()):a?(u.setTime(u.getTime()+60*a*1e3),e=u.toUTCString()):e="",document.cookie="".concat(n,"=").concat(r,"; expires=").concat(e,"; path=/")},exports.setMartechUserProperties=st,exports.shouldShowPushPrimer=function(){return t.__awaiter(void 0,void 0,void 0,(function(){var e,n;return t.__generator(this,(function(t){return O()&&"function"==typeof(null===(e=window.MobileApp)||void 0===e?void 0:e.isPNPermissionEnabled)?[2,Promise.resolve(!(null===(n=window.MobileApp)||void 0===n?void 0:n.isPNPermissionEnabled()))]:A()?[2,new Promise((function(t,e){var n,r,o,i;window.pushNotifcationPermissionStatus=function(e){var n=JSON.parse(e),r=null==n?void 0:n.status;"boolean"==typeof r&&t(!r)};try{null===(i=null===(o=null===(r=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===r?void 0:r.IS_PN_PERMISSION_ENABLED)||void 0===o?void 0:o.postMessage)||void 0===i||i.call(o,"")}catch(e){t(!1)}}))]:[2,Promise.resolve(!1)]}))}))},exports.showMobileNumberHint=function(){var t;if("function"==typeof(null===(t=window.MobileApp)||void 0===t?void 0:t.onRequestMobileNumber)){var e;window.MobileApp.onRequestMobileNumber();var n=new Promise((function(t){e=t}));return window.sendSelectedMobileNumber=function(t){return e(G(t))},n}return Promise.resolve("")},exports.stringifyPayload=rt,exports.transmorphProfileDetailsPayload=I,exports.triggerOTPListener=function(){var t;O()&&(null===(t=window.MobileApp)||void 0===t||t.onPageStart("OTP_SCREEN"))},exports.truncateText=C,exports.updateNativeAndroidOnSignIn=W,exports.updateNativeIOSOnSignIn=V,exports.updateNativeOnLogin=function(){A()?V():O()&&W()},exports.urlJoin=u,exports.utmParamManager=ct,exports.validateEmailOtp=function(e,r){return t.__awaiter(void 0,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,U("VALIDATE_OTP",n.RequestMethods.POST,B(e,r))]}))}))},exports.validateOtp=function(e,r){return t.__awaiter(void 0,void 0,void 0,(function(){var i,a;return t.__generator(this,(function(u){switch(u.label){case 0:return[4,U("VALIDATE_OTP",n.RequestMethods.POST,{otp:r,value:e,type:"MOBILE",action:"SIGNIN",countryCode:"+91"},{"ab-otp":"b"})];case 1:return i=u.sent(),a=null==i?void 0:i.data,[2,t.__assign(t.__assign({},i),{signup:(null==a?void 0:a.action)===o.ValidateOTPAction.SIGNUP,action:null==a?void 0:a.action,status:null==i?void 0:i.status})]}}))}))};
|
|
1
|
+
"use strict";var e=require("tslib"),t=require("uuid"),n=require("@cleartrip/ct-platform-constants"),r=require("ua-parser-js"),o=require("react/jsx-runtime"),i=require("@cleartrip/ct-design-icons"),a=require("react"),s=require("@cleartrip/ct-design-toast"),u=require("@cleartrip/ct-platform-assets"),l=require("@cleartrip/ct-platform-types");function c(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var v=c(r),p=d(i),g=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.map((function(e){return e.trim().replace(/^[/]+/,"")})).join("/");return n=n.replace(/\/\?/g,"?")},_=function(){if(N())return"https://work.cleartrip.com";var e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||"0.0.0.0"===e?"http://localhost:3000/api":"localhost"===e||"127.0.0.1"===e||"0.0.0.0"===e||"workqa2.cleartrip.com"===e||e.includes("workqa2")?"https://workqa2.cleartrip.com":"https://work.cleartrip.com"},f=function(){switch("undefined"!=typeof window?window.location.hostname:""){case"0.0.0.0":case"workqa2.cleartrip.com":return"https://workqa2.cleartrip.com";case"localhost":case"qa2new.cleartrip.com":return"https://qa2new.cleartrip.com";case"qa2.cleartrip.com":return"https://qa2.cleartrip.com";case"qa3new.cleartrip.com":return"https://qa3new.cleartrip.com";case"work.cleartrip.com":return"https://work.cleartrip.com";default:return"https://www.cleartrip.com"}},h=function(e,t){return t.reduce((function(e,t){return e&&e[t]?e[t]:null}),e)},m=function(e){if(e instanceof Date)return!1;if(null==e)return!0;var t,n=function(e){return"[object Number]"===Object.prototype.toString.call(e)};if(n(e))return n(t=e)&&"NaN"===t.toString();if(e.length>0)return!1;if(0===e.length)return!0;if("object"!=typeof e)return!0;for(var r=Object.keys(e),o=0,i=r[o];o<r.length;o+=1)if(Object.prototype.hasOwnProperty.call(e,i))return!1;return!0},w="undefined"!=typeof window?window.location.href:"",y=function(e){return N()?"":new URLSearchParams(window.location.search).get(e)},S=function(){return"undefined"!=typeof window?(window.location.pathname+window.location.search).slice(1):""},E=function(e){if(e){var t=e.match(/h_(\d+)[,\/]/);return t&&t[1]?parseInt(t[1],10):void 0}},I=function(e){if(e){var t=e.match(/w_(\d+)[,\/]/);return t&&t[1]?parseInt(t[1],10):void 0}},N=function(){return"undefined"==typeof window||!window};function b(e,t){var n=t||h(document,["cookie"]);if(n){for(var r=e+"=",o=n.split(";"),i=0;i<o.length;i++){for(var a=o[i];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(r))return a.substring(r.length,a.length)}return""}return""}var O=function(e){try{if(!e||Number.isNaN(Number(e)))return"";var t=new Date(1e3*e),n=t.getFullYear(),r=String(t.getDate()).padStart(2,"0"),o=String(t.getMonth()+1).padStart(2,"0");return"".concat(n,"-").concat(o,"-").concat(r)}catch(e){return""}};var A=function(e){if(!e||""===e.trim())return"";var t=e.trim().split("-");if(3!==t.length)return"";var n=t[0],r=t[1],o=t[2];return 2!==n.length||2!==r.length||4!==o.length||isNaN(Number(n))||isNaN(Number(r))||isNaN(Number(o))?"":"".concat(n,"/").concat(r,"/").concat(o)},T=function(){var e,t=null===(e=h(window,["navigator","userAgent"]))||void 0===e?void 0:e.toLowerCase(),r=/safari/.test(t),o=/iphone|ipod|ipad/.test(t);return h(window,["androidData","app-agent"])&&h(window,["androidData","js-version"])||"function"==typeof h(window,["MobileApp","getAppSpecificData"])?n.Platform.ANDROID:h(window,["iosData","app-agent"])&&h(window,["iosData","js-version"])||o&&!r?n.Platform.IOS:n.Platform.PWA},P=function(){var e,t,r=T();return r===n.Platform.IOS?null!==(e=h(window,["iosData","app-agent"]))&&void 0!==e?e:n.AppAgent.IOS:r===n.Platform.ANDROID?null!==(t=h(window,["androidData","app-agent"]))&&void 0!==t?t:n.AppAgent.ANDROID:n.AppAgent.PWA},R=function(){if(N())return n.AppAgent.H_UNKNOWN;var e=T();return e===n.Platform.IOS?n.AppAgent.H_IOS:(e===n.Platform.ANDROID&&n.AppAgent.H_ANDROID,n.AppAgent.H_PWA)},x=function(){var e="";return L()?e=h(window,["iosData","js-version"]):C()&&(e=h(window,["androidData","js-version"])),e&&(e=e.toString().split(".")[0]),e},D=function(){var e,t,n,r;if(!N())return"";var o=new v.default(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent);return null!==(r=null===(n=null===(t=null==o?void 0:o.getDevice())||void 0===t?void 0:t.model)||void 0===n?void 0:n.toLowerCase())&&void 0!==r?r:""},k=function(){return T()!==n.Platform.ANDROID&&T()!==n.Platform.IOS},C=function(){return T()===n.Platform.ANDROID},U=function(e){return parseInt(x())>=e},L=function(){return T()===n.Platform.IOS},M=function(e,t){switch(t){case"android":return JSON.stringify(e);case"ios":return{action:"onUserLogin",properties:e};default:return e}},F=function(){return f()},B=function(r,o,i,a,s,u,l){return void 0===o&&(o=n.RequestMethods.GET),void 0===a&&(a={}),void 0===s&&(s={}),void 0===u&&(u=!1),void 0===l&&(l={}),e.__awaiter(void 0,void 0,void 0,(function(){var c,d,v,p,_,h,m,w,y,S,E,I,O,A,R;return e.__generator(this,(function(x){switch(x.label){case 0:return c=function(e,t){var r=n.API_ROUTES[e];if(r&&r.trim().length){if(r=g(F(),r),null==t?void 0:t.pathParams)for(var o=0,i=Object.entries(t.pathParams);o<i.length;o++){var a=i[o],s=a[0],u=a[1];r=r.replace(":".concat(s),u)}return(null==t?void 0:t.queryParams)&&(r+="?".concat(new URLSearchParams(t.queryParams).toString())),r}}(r,s),c&&c.trim().length?(d="",v="",p=F(),_=f(),N()||(d=T(),v=JSON.stringify(function(r){var o={trackingId:t.v4(),source:n.SOURCE_NAME};return N()?e.__assign(e.__assign({},o),null!=r?r:{}):e.__assign(e.__assign(e.__assign({},o),{platform:P(),deviceModel:D()}),null!=r?r:{})}(l))),h=N()?"":b(n.FEATURE_COOKIE_NAME)||"",m={method:o,headers:e.__assign(e.__assign({channel:d,Caller:p,Origin:p,Referer:p,Authority:_,x_ct_sourcetype:"MOBILE","app-agent":P(),"x-unified-header":v,"Content-Type":"application/json"},h&&(O={},O[n.FEATURE_COOKIE_NAME]=h,O)),a)},i&&(m.body=JSON.stringify(i)),[4,fetch(c,m)]):[2,Promise.reject("URL parameter missing")];case 1:if(y=x.sent(),S={name:"API_FAILURE",status:y.status,message:"UNKNOWN_ERROR",statusText:y.statusText},null==y?void 0:y.ok)return[3,6];if(u)return[2,Promise.reject(S)];x.label=2;case 2:return x.trys.push([2,4,,5]),[4,y.json()];case 3:return E=x.sent(),S.message=(null===(A=null==E?void 0:E.error)||void 0===A?void 0:A.message)||(null==E?void 0:E.message)||"UNKNOWN_ERROR",S.code=null===(R=null==E?void 0:E.error)||void 0===R?void 0:R.code,[3,5];case 4:return x.sent(),S.message="UNKNOWN_ERROR",[3,5];case 5:throw S;case 6:return(null==(I=y.headers.get("content-type"))?void 0:I.includes("application/json"))?[4,y.json()]:[3,8];case 7:return w=x.sent(),[3,12];case 8:return(null==I?void 0:I.includes("text"))?[4,y.text()]:[3,10];case 9:return w=x.sent(),[3,12];case 10:return 204===y.status?[3,12]:[4,y.blob()];case 11:w=x.sent(),x.label=12;case 12:return[2,{data:w,status:y.status}]}}))}))},H=function(t,r,o,i,a){return void 0===r&&(r={}),void 0===o&&(o={}),void 0===i&&(i=!1),void 0===a&&(a={}),e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(s){return[2,B(t,n.RequestMethods.GET,null,e.__assign({expires:"0",accept:"application/json","cache-control":"no-cache"},r),o,i,a)]}))}))},j=function(t,r,o,i,a,s,u){return void 0===r&&(r=n.RequestMethods.POST),void 0===o&&(o={}),void 0===i&&(i={}),void 0===a&&(a={}),void 0===s&&(s=!1),void 0===u&&(u={}),e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(n){return[2,B(t,r,o,e.__assign({expires:"0",accept:"application/json","cache-control":"no-cache"},i),a,s,u)]}))}))},q=function(e,t){var n;return void 0===t&&(t=i.CTLogo),null!==(n=p[e])&&void 0!==n?n:t},G=q("Admin"),Y=q("Approvals"),J=q("CTSquareLogo",i.CTLogo),W=q("MyAccount"),z=q("MyTrips"),K=q("SavedCard"),V=q("SupportIcon"),Z=q("Wallet"),$="https://www.cleartrip.com",Q="/hotels",X="/accounts/trips",ee="/biztrip-approvals",te="/biztrip-admin/dashboard",ne="/biztrip-profile",re="/accounts/expressway",oe="https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/CFW_SME/Biztrip_logo.png",ie={src:oe,alt:"Biztrip",width:84,height:24,onClick:function(){"undefined"!=typeof window&&(window.location.href=Q)}},ae="#0F6BFF",se=[{lefticon:i.CTLogo,ravenActionName:"cleartrip",isHoverable:!1,isClickable:!0,link:$},{lefticon:z,text:"My Trips",ravenActionName:"mytrips",isHoverable:!1,isClickable:!0,link:X},{lefticon:Y,text:"Approvals",ravenActionName:"approvals",isHoverable:!1,isClickable:!0,link:ee},{lefticon:G,text:"Admin",ravenActionName:"admin",isHoverable:!1,isClickable:!0,link:te},{lefticon:V,text:"Support",ravenActionName:"support",isHoverable:!0,isClickable:!1}],ue={flights:"https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true",hotels:"https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true"},le=[{title:"Flights",image:ue.flights,link:"/flights"},{title:"Hotels",image:ue.hotels,link:"/hotels"}],ce="#ECF3FF",de=[{text:"My profile",icon:o.jsx(W,{width:24,height:24}),redirectionLink:ne},{text:"Switch to Cleartrip",icon:o.jsx(J,{width:24,height:24}),redirectionLink:$},{text:"My trips",icon:o.jsx(z,{width:24,height:24}),redirectionLink:X},{text:"Saved payment methods",icon:o.jsx(K,{}),redirectionLink:re}],ve={email:"support@biztrip.com",adminEmail:"admin@biztrip.com",phone:"+91 9876543210"},pe="1230856B559-ED8A-4284-BB21-8373BB71F878",ge=[{text:"Unlock wallet",icon:o.jsx(Z,{width:24,height:24}),backgroundColor:"#FFFFFF",hoverBackgroundColor:"#F2F2F2"}],_e="An error occurred",fe=function(){return JSON.stringify({platform:"desktop",trackingId:t.v4(),source:n.SOURCE_NAME,deviceModel:N()?"":D()})},he=function(t){var r;void 0===t&&(t={});var o=_(),i=N()?"":b(n.FEATURE_COOKIE_NAME)||"";return e.__assign(e.__assign({accept:"*/*","content-type":"application/json",channel:"desktop","cache-control":"no-cache","x-client-id":"cleartrip","x-source-type":"Desktop","x-tenant-id":"CFW","x-api-key":pe,"x-unified-header":fe(),Origin:o,Referer:"".concat(o,"/hotels")},i?((r={})[n.FEATURE_COOKIE_NAME]=i,r):{}),t)},me=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var n,r,o;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.json()];case 1:return n=e.sent(),[2,(null===(r=null==n?void 0:n.error)||void 0===r?void 0:r.uiMessage)||(null===(o=null==n?void 0:n.error)||void 0===o?void 0:o.message)||_e];case 2:return e.sent(),[2,_e];case 3:return[2]}}))}))},we=function(t,n){return void 0===n&&(n={}),e.__awaiter(void 0,void 0,void 0,(function(){var r,o,i,a,s;return e.__generator(this,(function(u){switch(u.label){case 0:return r=n.extraHeaders,o=void 0===r?{}:r,i=e.__rest(n,["extraHeaders"]),a=g(_(),t),[4,fetch(a,e.__assign(e.__assign({credentials:"include"},i),{headers:e.__assign(e.__assign({},he(o)),i.headers)}))];case 1:return(s=u.sent()).ok?[3,3]:[4,me(s)];case 2:return[2,{ok:!1,error:u.sent(),status:s.status}];case 3:return[4,s.json()];case 4:return[2,{ok:!0,data:u.sent(),status:s.status}]}}))}))},ye=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){return t=N()?"":b("user_id"),[2,we("/cfw-onboarding-orchestrator/v1/org/onboarding",{method:"GET",extraHeaders:t?{"x-user-id":t}:{}})]}))}))},Se=function(){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,we("/v1/user/profile?include=user",{method:"GET"})]}))}))},Ee=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var n;return e.__generator(this,(function(r){return n=N()?"":b("user_id"),[2,we("/cfw-onboarding-orchestrator/v1/employees/details",{method:"GET",extraHeaders:e.__assign({"x-org-id":t},n?{"x-user-id":n}:{})})]}))}))},Ie=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,r,o,i;return e.__generator(this,(function(a){switch(a.label){case 0:return t=_(),r=N()?"":b(n.FEATURE_COOKIE_NAME)||"",[4,fetch(g(t,"/v1/user/logout"),{method:"POST",credentials:"include",headers:e.__assign({accept:"*/*","content-type":"application/json",channel:"desktop","cache-control":"no-cache","x-client-id":"cleartrip","x-source-type":"Desktop","x-tenant-id":"CFW","x-unified-header":fe(),Origin:t,Referer:"".concat(t,"/hotels")},r?(i={},i[n.FEATURE_COOKIE_NAME]=r,i):{})})];case 1:return 200===(o=a.sent()).status?[2,{success:!0,status:o.status}]:[4,me(o)];case 2:return[2,{success:!1,error:a.sent(),status:o.status}]}}))}))},Ne=function(e,t){return(null==e?void 0:e.length)>t?"".concat(null==e?void 0:e.substring(0,t),"..."):e||""},be=function(e){var t,r=null==e?void 0:e.toLowerCase();return((t={})[n.HOTEL_VERTICAL]=n.HOTEL_FUNNEL_JOURNEY,t[n.AIR_VERTICAL]=n.AIR_FUNNEL_JOURNEY,t[n.UAR_VERTICAL]=n.FUNNEL_JOURNEY,t)[r]||n.FUNNEL_JOURNEY},Oe=function(e,t){return e&&t===n.UAR_VERTICAL?n.MAX_DISPLAYED_CARDS:n.MIN_DISPLAYED_CARDS},Ae=function(e){try{if(!e||""===e.trim())return null;if(!/^\d{2}-\d{2}-\d{4}$/.test(e.trim()))return null;var t=e.split("-");if(3!==t.length)return null;var n=Number(t[0]),r=Number(t[1]),o=Number(t[2]);if(isNaN(n)||isNaN(r)||isNaN(o)||n<1||n>31||r<1||r>12||o<1e3)return null;var i=new Date(o,r-1,n);return i.getFullYear()!==o||i.getMonth()!==r-1||i.getDate()!==n?null:{day:n,month:r-1,year:o}}catch(e){return console.error("Error parsing travel date:",e),null}},Te=function(e,t){var n,r;try{var o=null!==(n=null==t?void 0:t.trim())&&void 0!==n?n:"",i=null!==(r=null==e?void 0:e.trim())&&void 0!==r?r:"";if(""===o)return"na";var a=Ae(i),s=Ae(o);if(!a||!s)return"na";var u=Date.UTC(a.year,a.month,a.day),l=Date.UTC(s.year,s.month,s.day)-u;return l<0?"na":String(l/864e5)}catch(e){return"na"}},Pe=function(e,t){var n,r,o=null==e?void 0:e.metaData;return{h_search_destination:(null==e?void 0:e.title)||"na",h_search_destination_city:(null==o?void 0:o.location)||"na",h_checkin_date:A(null===(n=null==o?void 0:o.travelDates)||void 0===n?void 0:n.start)||"na",h_checkout_date:A(null===(r=null==o?void 0:o.travelDates)||void 0===r?void 0:r.end)||"na",h_room_count:(null==o?void 0:o.roomCount)||"na",h_hotel_id:(null==o?void 0:o.hotelId)||"na",h_hotel_name:(null==o?void 0:o.hotelName)||"na",h_utm_source:(null==o?void 0:o.utmSource)||"organic",h_horizontal_rank:t.toString()||"na"}},Re=function(e,t){var n,r,o=null==e?void 0:e.metaData,i=null===(n=null==o?void 0:o.travelDates)||void 0===n?void 0:n.start,a=null===(r=null==o?void 0:o.travelDates)||void 0===r?void 0:r.end;return{search_destination:(null==o?void 0:o.destination)||"na",search_origin:(null==o?void 0:o.source)||"na",onward_date:A(i)||"na",return_date:A(a)||"na",journey_type:(null==o?void 0:o.journeyType)||"na",trip_type:(null==o?void 0:o.tripType)||"na",adult_count:(null==o?void 0:o.adultCount)||"na",child_count:(null==o?void 0:o.childCount)||"na",infant_count:(null==o?void 0:o.infantCount)||"na",fare_type:(null==o?void 0:o.ptcFareType)||"na",is_cfw_user:(null==o?void 0:o.isCfwUser)||"na",a_horizontal_rank:(null==t?void 0:t.toString())||"na",dx:Te(i,a)}},xe=function(e){var t=e.getDate(),n=e.toLocaleString("en-GB",{month:"short"});return"".concat(t," ").concat(n)},De=function(e){var t=Ae(e);if(!t)return null;var n=new Date(t.year,t.month,t.day);return Number.isNaN(n.getTime())?null:n};var ke=function(t,n){return e.__assign({type:"EMAIL",value:t,action:"UPDATE_EMAIL"},n?{otp:n}:{})},Ce=function(e){var t="",r=e.match(n.MOBILE_CONSTANTS.REGEX);return r&&(t=r[0].replace(/\D/g,"")),t},Ue=function(){var e,t,n;null===(n=null===(t=null===(e=window.webkit)||void 0===e?void 0:e.messageHandlers)||void 0===t?void 0:t.PWA_IS_SIGNIN)||void 0===n||n.postMessage({isSignIn:!0})},Le=function(){var e;null===(e=window.MobileApp)||void 0===e||e.onPWALoginStatus(JSON.stringify({isSignIn:!0}))},Me=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){return(null===(n=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===n?void 0:n.get)&&"OTPCredential"in window?(t=new AbortController,setTimeout((function(){t.abort()}),6e4),[2,navigator.credentials.get({otp:{transport:["sms"]},signal:t.signal}).then((function(e){return null==e?void 0:e.code}))]):[2,Promise.reject("NOT_SUPPORTED")]}))}))},Fe=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){return n=new Promise((function(e){t=e})),window.sendOtpValue=function(e){t(e)},[2,n]}))}))},Be=function(t,r,o){return e.__awaiter(void 0,void 0,void 0,(function(){var i,a;return e.__generator(this,(function(e){switch(e.label){case 0:return i=f(),[4,j("FK_REDIRECTION_INFO",n.RequestMethods.POST,{provider:"flipkart",fallbackUri:g(i,t||o),signupPageUri:g(i,r||"personal-details"),currentPageUri:g(i,o)})];case 1:return[2,null==(a=e.sent())?void 0:a.data]}}))}))},He=function(e){var t,n=null!==(t=null==e?void 0:e.params)&&void 0!==t?t:{},r=null==e?void 0:e.redirectUri;if(r){for(var o in r+="?",n)r+=o+"="+n[o]+"&";return Promise.resolve(r)}return Promise.reject()},je=function(t){var n,r,o=null==t?void 0:t.params;if(m(o)||"function"!=typeof(null===(n=window.MobileApp)||void 0===n?void 0:n.onNavigationChange))return Promise.reject();var i=g(f(),"dl/oauth2");return null===(r=window.MobileApp)||void 0===r||r.onNavigationChange(JSON.stringify({type:"FkSSO",miscData:e.__assign(e.__assign({},o),{redirectURI:i})})),Promise.resolve()};function qe(e){try{var t=decodeURIComponent(b("userid",e)||"").split("|");return{email:t[0],profileName:t[1],gender:t[2],photo:t[3],userId:t[4]}}catch(e){return{}}}var Ge=function(e){var t=qe(e)||{};return!!(decodeURIComponent(b("usermisc",e)||"").split("|").includes("SIGNED_IN")&&t.userId&&t.userId.length>0)},Ye=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var n;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,H("USER_INSIGHTS",{},{pathParams:{userId:t}})];case 1:return[2,null==(n=e.sent())?void 0:n.data];case 2:return e.sent(),[2,Promise.resolve(null)];case 3:return[2]}}))}))},Je=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var n,r,o,i,a,s,u,l,c;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=null!=t?t:qe().userId,console.log("checklog [getUserInsightsData] resolved userId",{fromArgument:void 0!==t,hasUserId:Boolean(n)}),n?(r=null===(u=null===window||void 0===window?void 0:window.sessionStorage)||void 0===u?void 0:u.getItem("martech_user_attributes"),console.log("checklog [getUserInsightsData] sessionStorage read",{hasCachedString:"string"==typeof r}),o=void 0,"string"==typeof r?(o=JSON.parse(r),console.log("checklog [getUserInsightsData] parsed session cache",{cachedAccountId:null==o?void 0:o.accountId})):console.log("checklog [getUserInsightsData] no cache string; skip parse"),n!==(null==o?void 0:o.accountId)?(console.log("checklog [getUserInsightsData] stale cache; clear martech",{currentUserId:n,cachedAccountId:null==o?void 0:o.accountId}),null===(l=null===window||void 0===window?void 0:window.sessionStorage)||void 0===l||l.removeItem("martech_user_attributes")):console.log("checklog [getUserInsightsData] cache matches current user"),[4,Ye(n)]):(console.log("checklog [getUserInsightsData] skip: no user id; clear cache"),null===(s=null===window||void 0===window?void 0:window.sessionStorage)||void 0===s||s.removeItem("martech_user_attributes"),[2,null]);case 1:return i=e.sent(),m(null==i?void 0:i.data)?(console.log("checklog [getUserInsightsData] empty API insights; null"),[2,null]):(console.log("checklog [getUserInsightsData] persist insights sessionStorage"),null===(c=null===window||void 0===window?void 0:window.sessionStorage)||void 0===c||c.setItem("martech_user_attributes",JSON.stringify(null==i?void 0:i.data)),[2,null==i?void 0:i.data]);case 2:return a=e.sent(),console.log("checklog [getUserInsightsData] error",a),[2,null];case 3:return[2]}}))}))},We=function(e){return Object.keys(e).forEach((function(t){e[t]="a_fare_price"===t||"a_ct_discount"===t||"supercoin_balance"===t||"supercoin_earned"===t||"supercoin_burnt"===t||"wallet_balance_used"===t||"convenience_fee"===t?Number(e[t]):""+e[t]})),e},ze=function(){try{if(N())return"";var e=b("ct_statsig_experiments")||"{}",t=e?JSON.parse(decodeURIComponent(e)):{};return Object.keys(t).map((function(e){return e&&t[e]?"".concat(e,":").concat(t[e]):""})).filter((function(e){return!!e})).join("|")}catch(e){return""}},Ke=function(t,n){var r;if(console.log("checklog [ravenSDKTrigger] start",{eventName:t,payloadKeyCount:Object.keys(null!=n?n:{}).length}),window&&window.ravenWebManager){console.log("checklog [ravenSDKTrigger] ravenWebManager present");var o=Ze(),i={page_name:o.pageName,u_utm_source:o.utmSource,domain:window.location.host,u_ab_key:ze(),platform:null===(r=T())||void 0===r?void 0:r.toLowerCase(),login_status:Ge()?"yes":"no"},a=We(n);console.log("checklog [ravenSDKTrigger] triggerRaven",{eventName:t});var s=window.ravenWebManager;null==s||s.triggerRaven(t,e.__assign(e.__assign({},i),a)),console.log("checklog [ravenSDKTrigger] triggerRaven invoked",{hadManager:Boolean(s)},null==s?void 0:s.triggerRaven)}else console.log("checklog [ravenSDKTrigger] skip: no window or ravenWebManager")},Ve=function(){if(window&&"undefined"!=typeof window){var e=h(window,["location","pathname"]);if("/"===e||"/flights"===e)return!0}return!1},Ze=function(){var e,t;if(window&&"undefined"!=typeof window){var n=window.location.pathname,r=null!==(e=y("service"))&&void 0!==e?e:"",o=null!==(t=y("utm_source"))&&void 0!==t?t:"organic",i=Ve()?"skippable_login":"account_login",a="air",s=n.includes("flights/itinerary")||r.includes("flights/itinerary")?"a_itinerary":"a_home";return r.includes("my-account")&&(a="uar",s="account"),r.includes("hotels")&&(a="hotel",s=r.includes("hotels/itinerary")?"h_itinerary":"h_home"),r.includes("bus")&&(a="bus",s=r.includes("bus/itinerary")?"b_itinerary":"b_home"),{loginForm:i,vertical:a,pageName:s,utmSource:o}}return{}},$e=function(e){var t,n,r,o,i,a,s,u,l;m(e)||(null===(t=null===window||void 0===window?void 0:window.sessionStorage)||void 0===t?void 0:t.getItem("martech_user_props_sent"))||(L()&&(null===(r=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===r?void 0:r.SEND_ATTRIBUTES)?(null===(o=window.webkit.messageHandlers.SEND_ATTRIBUTES)||void 0===o||o.postMessage({type:"GA",params:e}),null===(i=window.webkit.messageHandlers.SEND_ATTRIBUTES)||void 0===i||i.postMessage({type:"Clevertap",params:e}),null===(a=null===window||void 0===window?void 0:window.sessionStorage)||void 0===a||a.setItem("martech_user_props_sent","true")):C()&&(null===(s=null===window||void 0===window?void 0:window.MobileApp)||void 0===s?void 0:s.sendAttributes)?(window.MobileApp.sendAttributes("GA",JSON.stringify(e)),window.MobileApp.sendAttributes("Clevertap",JSON.stringify(e)),null===(u=null===window||void 0===window?void 0:window.sessionStorage)||void 0===u||u.setItem("martech_user_props_sent","true")):k()&&window.clevertap&&(window.clevertap.profile.push({Site:e}),null===(l=null===window||void 0===window?void 0:window.sessionStorage)||void 0===l||l.setItem("martech_user_props_sent","true")))},Qe=function(){function e(){this.STORAGE_KEY="appPushUTMAttributes",this.utmParamsToTrack=["utm_custom","traffic_source"]}return e.prototype.saveCurrentURLParams=function(){if("undefined"!=typeof window){var e=window.location.search.slice(1);e&&this.setStoredParams(e)}},e.prototype.getStoredParams=function(){if("undefined"==typeof window)return{};try{var e=sessionStorage.getItem(this.STORAGE_KEY);if(!e)return{};var t=JSON.parse(e).utmParams||"";if(!t)return{};var n=new URLSearchParams(t),r={};return n.forEach((function(e,t){r[t]=e})),r}catch(e){return console.error("Error parsing stored UTM params:",e),{}}},e.prototype.setStoredParams=function(e){if("undefined"!=typeof window){var t=new URLSearchParams(e),n=sessionStorage.getItem(this.STORAGE_KEY);if(n)try{var r=JSON.parse(n).utmParams||"";if(r){var o=new URLSearchParams(r);new URLSearchParams(e).forEach((function(e,t){o.set(t,e)})),t=o}}catch(e){console.error("Error merging existing UTM params:",e)}var i={utmParams:t.toString()};sessionStorage.setItem(this.STORAGE_KEY,JSON.stringify(i))}},e.prototype.getSpecificParams=function(e){var t={},n=this.getStoredParams();return Array.isArray(e)?(e.forEach((function(e){Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})),t):(console.warn("getSpecificParams expects an array of strings."),t)},e.prototype.clearStoredParams=function(){"undefined"!=typeof window&&sessionStorage.removeItem(this.STORAGE_KEY)},e.prototype.getUTMBasedParams=function(){return this.getSpecificParams(this.utmParamsToTrack)},e.prototype.setUTMParamsToTrack=function(e){this.utmParamsToTrack=e},e.prototype.getSpecificParamsFromURL=function(e){var t={};return e.forEach((function(e){var n;t[e]=null!==(n=new URLSearchParams(window.location.search).get(e))&&void 0!==n?n:""})),t},e}(),Xe=Object.freeze(new Qe);exports.BIZTRIP_ACCOUNT_HEADER_BACKGROUND=ce,exports.BIZTRIP_ACCOUNT_OPTIONS=de,exports.BIZTRIP_ACCOUNT_PILLS=ge,exports.BIZTRIP_ADMIN_URL=te,exports.BIZTRIP_APPROVALS_URL=ee,exports.BIZTRIP_BRAND_LOGO=ie,exports.BIZTRIP_DESKTOP_API_KEY=pe,exports.BIZTRIP_HOME_URL=Q,exports.BIZTRIP_HOVER_COLOR=ae,exports.BIZTRIP_LOB_DATA=le,exports.BIZTRIP_LOB_IMAGES=ue,exports.BIZTRIP_LOGO_URL=oe,exports.BIZTRIP_NAVBAR_OPTIONS=se,exports.BIZTRIP_PROFILE_URL=ne,exports.BIZTRIP_SAVED_PAYMENT_URL=re,exports.BIZTRIP_SUPPORT_CONFIG=ve,exports.BIZTRIP_TRIPS_URL=X,exports.CLEARTIP_HOME_URL=$,exports.MULTI_SPACE=/\s\s+/g,exports.autoReadOtp=function(){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,C()?Fe():Me()]}))}))},exports.batchRavenEvent=function(e,t){"undefined"!=typeof window&&"function"==typeof window.requestIdleCallback?requestIdleCallback((function(){Ke(e,t)})):setTimeout((function(){Ke(e,t)}),0)},exports.buildFlightsCardRavenPayload=Re,exports.buildHotelCardRavenPayload=Pe,exports.constructHotelImage=function(e){return(null==e?void 0:e.trim())?e.startsWith("https")?e:"https://rukmini-ct.flixcart.com/w_208,h_240,fl_progressive,e_sharpen:80,q_auto,c_fill/ct-hotel-images/places/hotels".concat(e):n.DEFAULT_IMAGE_URL},exports.createAPIRequest=B,exports.createGetRequest=H,exports.createPostOrPutRequest=j,exports.createRecentSearchCardRavenPayload=function(t,r,o,i){return e.__assign(e.__assign(e.__assign(e.__assign({},r),{action_name:t,card_number:null==o?void 0:o.id}),(null==o?void 0:o.type)===n.HOTEL_FUNNEL_JOURNEY?Pe(o,i):{}),(null==o?void 0:o.type)===n.AIR_FUNNEL_JOURNEY?Re(o,i):{})},exports.extractQueryParamsAsObj=function(e){try{var t=new URL(e),n=new URLSearchParams(t.search),r={};return n.forEach((function(e,t){r[t]=e})),r}catch(e){return{}}},exports.fetchBiztripEmployeeDetails=Ee,exports.fetchBiztripOnboarding=ye,exports.fetchBiztripProfile=Se,exports.fetchRecentSearchesData=function(t,n,r,o,i){return void 0===r&&(r=5e3),void 0===o&&(o={}),void 0===i&&(i={}),e.__awaiter(void 0,void 0,void 0,(function(){var a,s,u,l,c,d,v,p;return e.__generator(this,(function(g){switch(g.label){case 0:a=[{usecase:"FUNNEL_JOURNEY",content:[]}],g.label=1;case 1:return g.trys.push([1,3,,4]),s=null,u=new Promise((function(e){s=setTimeout((function(){e(a[0])}),r)})),l=be(n),c=Oe(t,n),d=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(r){switch(r.label){case 0:return[4,H("GET_CYS_RECENT_SEARCHES",o,{queryParams:e.__assign({usecases:l,size:c.toString()},i)})];case 1:return t=r.sent(),[2,null===(n=null==t?void 0:t.data)||void 0===n?void 0:n[0]]}}))}))},[4,Promise.race([d(),u])];case 2:return v=g.sent(),s&&clearTimeout(s),[2,v];case 3:return p=g.sent(),console.error("Error fetching recent searches",p),[2,a[0]];case 4:return[2]}}))}))},exports.formatBookZeroPaymentDueLabel=function(e){var t=new Date(e);if(Number.isNaN(t.getTime()))return"";var n=t.getDate(),r=t.toLocaleString("en-GB",{month:"short"}),o=t.toLocaleString("en-IN",{hour:"numeric",minute:"2-digit",hour12:!0}).toLowerCase();return"by ".concat(function(e){var t=e%10,n=e%100;return"".concat(e,1===t&&11!==n?"st":2===t&&12!==n?"nd":3===t&&13!==n?"rd":"th")}(n)," ").concat(r,", ").concat(o)},exports.formatBookZeroStayDateRange=function(e,t){var n=De(e),r=De(t);return n&&r?"".concat(xe(n)," - ").concat(xe(r)):""},exports.formatCurrency=function(e,t){void 0===t&&(t=!0);try{var n={currency:"INR",minimumFractionDigits:0};return t&&(n.style="currency"),"string"!=typeof e&&(e=null==e?void 0:e.toString()),e=e.replace(/,/g,""),parseInt(e,10).toLocaleString("en-IN",n)}catch(e){return""}},exports.formatDateForWithSlashes=A,exports.formatFullDateString=function(e,t,n){void 0===t&&(t="dd-mm-yyyy"),void 0===n&&(n="");try{var r=new Date(e),o=r.getFullYear(),i=String(r.getDate()).padStart(2,"0"),a=String(r.getMonth()+1).padStart(2,"0");return"yyyy-mm-dd"===t?"".concat(o,"-").concat(a,"-").concat(i):"".concat(i,"-").concat(a,"-").concat(o)}catch(e){return n}},exports.formatRemainingMsAsHoursCountdown=function(e){var t,n=(new Date(e).getTime()-(new Date).getTime())/36e5;if(n>0&&n<=24){var r=Math.max(1,Math.floor(n));t="".concat(r," hrs remaining to pay")}return t},exports.getApiDomain=f,exports.getAppAgent=P,exports.getAppAgentForHotelUnifiedHeader=R,exports.getAutoDetectedMobile=Ce,exports.getBiztripApiDomain=_,exports.getBiztripErrorMessage=me,exports.getCTStatsigExpForRaven=ze,exports.getCookie=b,exports.getCurrentPathName=S,exports.getCurrentUrl=w,exports.getDeviceModel=D,exports.getDevicePlatform=T,exports.getDimensionFromImageUrl=function(e){void 0===e&&(e="");var t=E(e)||0,n=I(e)||0;return{height:"".concat(t,"px"),width:"".concat(n,"px"),heightInNumber:t,widthInNumber:n}},exports.getEventNameByVertical=function(e,t){var r,o=null==e?void 0:e.toLowerCase(),i=((r={})[n.HOTEL_VERTICAL]="h_",r[n.AIR_VERTICAL]="a_",r[n.UAR_VERTICAL]="u_",r)[o]||"u_";return"".concat(i).concat(t)},exports.getFlightsTitleParts=function(e,t,r){var o=(null==e?void 0:e.split("_"))||[];return 2!==(null==o?void 0:o.length)?null:{origin:Ne(null==o?void 0:o[0],r),destination:Ne(null==o?void 0:o[1],r),isOneWay:(null==t?void 0:t.journeyType)===n.JOURNEY_TYPE_ONE_WAY}},exports.getFunnelJourneyType=be,exports.getFutureDateFromDays=function(e){try{var t=new Date;t.setDate(t.getDate()+e);var n=t.getDate(),r=t.toLocaleString("default",{month:"short"}),o=t.getFullYear();return"".concat(n," ").concat(r,", ").concat(o)}catch(e){return""}},exports.getHeightFromImgUrl=E,exports.getHotelCrossSellRecos=function(t,n,r,o,i,a,s,u,l){return void 0===r&&(r=450),void 0===o&&(o="Flyer Exclusive"),void 0===i&&(i="deal on hotels"),void 0===a&&(a="CTBEST - Code pre-applied for you."),void 0===s&&(s={}),void 0===u&&(u={}),void 0===l&&(l=!1),e.__awaiter(void 0,void 0,void 0,(function(){var c,d,v,p,g,_;return e.__generator(this,(function(f){switch(f.label){case 0:c=null!==(_=null===(g=qe())||void 0===g?void 0:g.userId)&&void 0!==_?_:"",d={couponCode:"",couponCallOut:"",couponCallOutPrefix:o,couponCallOutSuffix:i,offerCallOut:a,pageLandingUrl:n,knowMoreFlag:l},f.label=1;case 1:return f.trys.push([1,3,,4]),v=new Promise((function(e){setTimeout((function(){e(d)}),r)})),p=H("HOTEL_RECOMMENDATIONS",s,{queryParams:e.__assign({userId:c,vertical:t},u)},!1,{userBuckets:{"x-cross-sell":"true"},platform:R()}).then((function(e){return e.data})),[4,Promise.race([p,v])];case 2:return[2,f.sent()];case 3:return f.sent(),[2,d];case 4:return[2]}}))}))},exports.getJSVersion=x,exports.getLOBType=function(e){switch(e){case n.HOTEL_FUNNEL_JOURNEY:return"Hotels";case n.AIR_FUNNEL_JOURNEY:return"Flights";default:return""}},exports.getNestedValue=h,exports.getNoOfDaysFromToday=function(e){var t=new Date(e),n=new Date;n.setHours(12,0,0,0),t.setHours(12,0,0,0);var r=(t.getTime()-n.getTime())/864e5;return Math.round(r)},exports.getQueryParam=y,exports.getRavenEventProps=Ze,exports.getRecentSearchCardTravelDateText=function(e){var t=e||{},r=t.cardType,o=void 0===r?"":r,i=t.journeyType,a=void 0===i?"":i,s=t.travelDates,u=void 0===s?{}:s,l=Ae(null==u?void 0:u.start),c=Ae(null==u?void 0:u.end);return o===n.AIR_FUNNEL_JOURNEY&&a===n.JOURNEY_TYPE_ONE_WAY?l?function(e){try{var t=n.MONTH_NAMES[e.month];if(!t||!e.day||!e.year)return"";var r=String(e.year).slice(-2);return"".concat(e.day," ").concat(t," ").concat(r)}catch(e){return console.error("Error formatting travel date label:",e),""}}(l):"":l&&c?function(e,t){try{var r=n.MONTH_NAMES[e.month],o=n.MONTH_NAMES[t.month];if(!(r&&o&&e.day&&t.day))return"";var i=String(e.year).slice(-2),a=String(t.year).slice(-2);return e.month===t.month&&e.year===t.year?"".concat(e.day," - ").concat(t.day," ").concat(r," ").concat(i):e.year===t.year?"".concat(e.day," ").concat(r," - ").concat(t.day," ").concat(o," ").concat(i):"".concat(e.day," ").concat(r," ").concat(i," - ").concat(t.day," ").concat(o," ").concat(a)}catch(e){return console.error("Error formatting travel date range label:",e),""}}(l,c):""},exports.getSize=Oe,exports.getTravelDatesDayDifferenceForDx=Te,exports.getUserAuthValues=qe,exports.getUtmSourceEventData=function(e){var t,r,o,i=(null===(o=b(n.UTM_SOURCE))||void 0===o?void 0:o.toLowerCase())||"organic",a=null==e?void 0:e.toLowerCase();return(r={})[((t={})[n.HOTEL_VERTICAL]="h_utm_source",t[n.AIR_VERTICAL]="a_utm_source",t[n.UAR_VERTICAL]="u_utm_source",t)[a]||"u_utm_source"]=i,r},exports.getWidthFromImgUrl=I,exports.handleFKSSO=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){var n,r;return e.__generator(this,(function(e){switch(e.label){case 0:return L()?[2,Promise.reject()]:(n=S(),[4,Be(t,n,n)]);case 1:return r=e.sent(),C()?[2,je(r)]:[2,He(r)]}}))}))},exports.handleProfileFetch=function(t){return void 0===t&&(t=!0),e.__awaiter(void 0,void 0,void 0,(function(){var n;return e.__generator(this,(function(r){switch(r.label){case 0:return[4,e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,H("GET_PROFILE_DETAILS",{caller:f(),"app-agent":P()},{})];case 1:return[2,null==(t=e.sent())?void 0:t.data];case 2:return n=e.sent(),console.error("Failed to fetch user details. Error: ",n),[2,Promise.resolve(null)];case 3:return[2]}}))}))];case 1:return(n=r.sent())&&t&&function(e){var t,n,r,o,i,a,s,u;try{if(N()||!(null===window||void 0===window?void 0:window.clevertap)||m(e))return;var l={Identity:null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"",Gender:null!==(n=null==e?void 0:e.gender)&&void 0!==n?n:"",Email:null!==(r=null==e?void 0:e.username)&&void 0!==r?r:"",Phone:"".concat(null==e?void 0:e.countryCode).concat(null==e?void 0:e.mobile),"MSG-sms":!0,"MSG-push":!0,"MSG-email":!1,"MSG-whatsapp":!0};if(null===(o=null==e?void 0:e.travellerDetails)||void 0===o?void 0:o.length)for(var c=0;c<(null===(i=null==e?void 0:e.travellerDetails)||void 0===i?void 0:i.length);c++){var d=null==e?void 0:e.travellerDetails[c];if(d.isRegistered){var v=d.personalDetails.dateOfBirth;l.Name="".concat(d.personalDetails.firstName," ").concat(d.personalDetails.lastName),isNaN(v)||(l.DOB=new Date(v));break}}if(C()&&(null===window||void 0===window?void 0:window.CleverTap)){var p=M(l,"android");return void(null===window||void 0===window||window.CleverTap.onUserLogin(p))}if(L()&&(null===(s=null===(a=null===window||void 0===window?void 0:window.webkit)||void 0===a?void 0:a.messageHandlers)||void 0===s?void 0:s.clevertap))return p=M(l,"ios"),void window.webkit.messageHandlers.clevertap.postMessage(p);null===(u=null===window||void 0===window?void 0:window.clevertap)||void 0===u||u.onUserLogin.push({Site:l})}catch(e){console.log("Error pushing clevertap profile information. Error: ",e)}}(n),[2]}}))}))},exports.handlePushPrimerCTA=function(e){var t,n,r,o,i,a,s,u;C()&&"function"==typeof(null===(t=window.MobileApp)||void 0===t?void 0:t.handlePNPermission)?null===(n=window.MobileApp)||void 0===n||n.handlePNPermission(JSON.stringify({type:e})):L()&&(null===(o=null===(r=null===window||void 0===window?void 0:window.webkit)||void 0===r?void 0:r.messageHandlers)||void 0===o?void 0:o.HANDLE_PN_PERMISSION)&&(null===(u=null===(s=null===(a=null===(i=window.webkit)||void 0===i?void 0:i.messageHandlers)||void 0===a?void 0:a.HANDLE_PN_PERMISSION)||void 0===s?void 0:s.postMessage)||void 0===u||u.call(s,JSON.stringify({type:e})))},exports.isAirHomePage=Ve,exports.isAndroidApp=C,exports.isEmpty=m,exports.isFKSSOEnabled=function(){return k()||!L()&&U(5)},exports.isHTMLInputElement=function(e){return"object"==typeof e&&null!==e&&"value"in e&&e instanceof HTMLInputElement},exports.isIOSApp=L,exports.isJSVersionUpdated=U,exports.isNumeric=function(e){return/^[0-9]*$/.test(e)},exports.isPwa=k,exports.isServer=N,exports.isUserSignedIn=Ge,exports.isValidMobileNumber=function(e){return(null==e?void 0:e.length)===n.MOBILE_CONSTANTS.LENGTH&&/^\d{10}$/.test(e)},exports.mapBookZeroRavenEventActionName=function(e){switch(null==e?void 0:e.toLowerCase()){case"uar":return"u_ui_action";case"hotels":return"h_ui_action";default:return""}},exports.mapBookZeroRavenEventImpressionName=function(e){switch(null==e?void 0:e.toLowerCase()){case"uar":return"u_impression";case"hotels":return"h_impression";default:return""}},exports.parseTravelDate=Ae,exports.path=function(e,t){return e.reduce((function(e,t){return e&&e[t]?e[t]:null}),t)},exports.postBiztripLogout=Ie,exports.ravenSDKTrigger=Ke,exports.removeCardFromContentById=function(e,t){var n;return null!==(n=null==e?void 0:e.filter((function(e){return(null==e?void 0:e.id)!==t})))&&void 0!==n?n:[]},exports.removeRecentSearchCardViaApi=function(t,r,o){return e.__awaiter(void 0,void 0,void 0,(function(){var i,a;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),i=be(o),[4,j("REMOVE_CYS_RECENT_SEARCHES_CARD",n.RequestMethods.POST,{usecase:i,content:{id:t,type:r}})];case 1:return e.sent(),[3,3];case 2:return a=e.sent(),console.error("Error removing CYS card:",a),[3,3];case 3:return[2]}}))}))},exports.secondsToDateString=O,exports.sendEmailOtp=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,j("SEND_OTP",n.RequestMethods.POST,ke(t))]}))}))},exports.sendEventWithUserInsights=function(t,n,r){return e.__awaiter(void 0,void 0,void 0,(function(){var o,i,a,s,u,l,c,d,v,p,g,_,f,h,w,y,S,E,I,N;return e.__generator(this,(function(b){switch(b.label){case 0:return console.log("checklog [sendEventWithUserInsights] start",{eventName:t,fromArgument:void 0!==r,hasUserIdArg:Boolean(r)}),[4,Je(r)];case 1:return o=b.sent(),console.log("checklog [sendEventWithUserInsights] fetched insights",{hasInsights:!m(o)}),i=e.__assign(e.__assign({},n),{fk_loyalty_status:"na",fk_loyalty_end_dt:"na",ct_last_booking_dt:"na",ct_lifetime_booking:"na",fk_loyalty_start_dt:"na",ct_first_booking_dt:"na",myntra_loyalty_status:"na",ct_postmerger_booking:"na",ct_last_1year_booking:"na",myntra_loyalty_end_dt:"na",ct_2nd_last_booking_dt:"na",myntra_loyalty_start_dt:"na"}),m(o)?console.log("checklog [sendEventWithUserInsights] no insights; default attrs"):(console.log("checklog [sendEventWithUserInsights] insights ok; merge martech"),a=(null!==(u=null==o?void 0:o.loyaltyStatus)&&void 0!==u?u:[]).reduce((function(t,n){return e.__assign(e.__assign({},t),n)}),{}),s={ct_lifetime_booking:(null!==(c=null===(l=null==o?void 0:o.bookingStatus)||void 0===l?void 0:l.lifetimeBooking)&&void 0!==c?c:"na").toString(),ct_postmerger_booking:(null!==(v=null===(d=null==o?void 0:o.bookingStatus)||void 0===d?void 0:d.postmergerBooking)&&void 0!==v?v:"na").toString(),ct_last_1year_booking:(null!==(g=null===(p=null==o?void 0:o.bookingStatus)||void 0===p?void 0:p.lastOneYearBooking)&&void 0!==g?g:"na").toString(),ct_first_booking_dt:O(null===(_=null==o?void 0:o.bookingStatus)||void 0===_?void 0:_.firstbookingDate)||"na",ct_last_booking_dt:O(null===(f=null==o?void 0:o.bookingStatus)||void 0===f?void 0:f.lastbookingDate)||"na",ct_2nd_last_booking_dt:O(null===(h=null==o?void 0:o.bookingStatus)||void 0===h?void 0:h.secondLastbookingDate)||"na",fk_loyalty_status:(null===(w=null==a?void 0:a.fk)||void 0===w?void 0:w.program)||"na",myntra_loyalty_status:(null===(y=null==a?void 0:a.myntra)||void 0===y?void 0:y.program)||"na",fk_loyalty_end_dt:O(null===(S=null==a?void 0:a.fk)||void 0===S?void 0:S.loyaltyEndDate)||"",fk_loyalty_start_dt:O(null===(E=null==a?void 0:a.fk)||void 0===E?void 0:E.loyaltyStartDate)||"na",myntra_loyalty_start_dt:O(null===(I=null==a?void 0:a.myntra)||void 0===I?void 0:I.loyaltyStartDate)||"na",myntra_loyalty_end_dt:O(null===(N=null==a?void 0:a.myntra)||void 0===N?void 0:N.loyaltyEndDate)||"na"},i=e.__assign(e.__assign({},i),s),console.log("checklog [sendEventWithUserInsights] setMartechUserProperties"),$e(s)),console.log("checklog [sendEventWithUserInsights] ravenSDKTrigger",{eventName:t}),Ke(t,i),[2]}}))}))},exports.sendLoginOtp=function(t,r){return e.__awaiter(void 0,void 0,void 0,(function(){var o;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,j("SEND_OTP",n.RequestMethods.POST,{value:t,type:"MOBILE",action:"SIGNIN",countryCode:n.MOBILE_CONSTANTS.COUNTRY_CODE},{"ab-otp":"b",dvid_data:r})];case 1:return[2,null==(o=e.sent())?void 0:o.data]}}))}))},exports.setCookie=function(e){var t,n=e.cookieName,r=e.cookieValue,o=e.expiryInDay,i=e.expiryInHours,a=e.expiryInMinutes,s=new Date;o?(s.setTime(s.getTime()+24*o*60*60*1e3),t=s.toUTCString()):i?(s.setTime(s.getTime()+3600*i*1e3),t=s.toUTCString()):a?(s.setTime(s.getTime()+60*a*1e3),t=s.toUTCString()):t="",document.cookie="".concat(n,"=").concat(r,"; expires=").concat(t,"; path=/")},exports.setMartechUserProperties=$e,exports.shouldShowPushPrimer=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){return C()&&"function"==typeof(null===(t=window.MobileApp)||void 0===t?void 0:t.isPNPermissionEnabled)?[2,Promise.resolve(!(null===(n=window.MobileApp)||void 0===n?void 0:n.isPNPermissionEnabled()))]:L()?[2,new Promise((function(e,t){var n,r,o,i;window.pushNotifcationPermissionStatus=function(t){var n=JSON.parse(t),r=null==n?void 0:n.status;"boolean"==typeof r&&e(!r)};try{null===(i=null===(o=null===(r=null===(n=null===window||void 0===window?void 0:window.webkit)||void 0===n?void 0:n.messageHandlers)||void 0===r?void 0:r.IS_PN_PERMISSION_ENABLED)||void 0===o?void 0:o.postMessage)||void 0===i||i.call(o,"")}catch(t){e(!1)}}))]:[2,Promise.resolve(!1)]}))}))},exports.showMobileNumberHint=function(){var e;if("function"==typeof(null===(e=window.MobileApp)||void 0===e?void 0:e.onRequestMobileNumber)){var t;window.MobileApp.onRequestMobileNumber();var n=new Promise((function(e){t=e}));return window.sendSelectedMobileNumber=function(e){return t(Ce(e))},n}return Promise.resolve("")},exports.stringifyPayload=We,exports.transmorphProfileDetailsPayload=M,exports.triggerOTPListener=function(){var e;C()&&(null===(e=window.MobileApp)||void 0===e||e.onPageStart("OTP_SCREEN"))},exports.truncateText=Ne,exports.updateNativeAndroidOnSignIn=Le,exports.updateNativeIOSOnSignIn=Ue,exports.updateNativeOnLogin=function(){L()?Ue():C()&&Le()},exports.urlJoin=g,exports.useBiztripConfig=function(t){var n,r,i,l,c=this,d=t.initOnboardingCall,v=void 0!==d&&d,p=t.initProfileCall,g=void 0!==p&&p,_=t.initEmployeeDetailsCall,f=void 0!==_&&_,h=t.walletStatusArg,m=void 0===h?null:h,w=t.employeeRoleArg,y=void 0===w?null:w,S=t.orgIdArg,E=void 0===S?null:S,I=a.useState(!1),b=I[0],O=I[1],A=a.useState(!N()),T=A[0],P=A[1],R=a.useState(!N()),x=R[0],D=R[1],k=a.useState(!1),C=k[0],U=k[1],L=a.useState(null),M=L[0],F=L[1],B=a.useState(null),H=B[0],j=B[1],q=a.useState(null),G=q[0],Y=q[1],J=a.useState(null),W=J[0],z=J[1],K=a.useState(null),V=K[0],Z=K[1],$=a.useState(null),Q=$[0],X=$[1],ee=a.useState(null),te=ee[0],ne=ee[1],re=a.useState(!1),oe=re[0],pe=re[1],ge=a.useRef(!1),_e=a.useCallback((function(e){ne(e),pe(!0)}),[]);a.useEffect((function(){if(!N())return v&&e.__awaiter(c,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return P(!0),z(null),[4,ye()];case 1:return t=e.sent(),ge.current||(t.ok?F(t.data):(z(t.error),_e(t.error)),P(!1)),[2]}}))})),g&&e.__awaiter(c,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return D(!0),Z(null),[4,Se()];case 1:return t=e.sent(),ge.current||(t.ok?j(t.data):(Z(t.error),_e(t.error)),D(!1)),[2]}}))})),function(){ge.current=!0}}),[_e]);var fe=g?null===(r=null===(n=null==H?void 0:H.data)||void 0===n?void 0:n.org)||void 0===r?void 0:r.id:E;a.useEffect((function(){if(!N()&&fe){var t=!1;return f&&e.__awaiter(c,void 0,void 0,(function(){var n;return e.__generator(this,(function(e){switch(e.label){case 0:return U(!0),X(null),[4,Ee(fe)];case 1:return n=e.sent(),t||(n.ok?Y(n.data):(X(n.error),_e(n.error)),U(!1)),[2]}}))})),function(){t=!0}}}),[fe,_e]);var he=f?"ADMIN"===(null===(l=null===(i=null==G?void 0:G.data)||void 0===i?void 0:i.membership)||void 0===l?void 0:l.employeeRole):"ADMIN"===y,me=a.useCallback((function(){return e.__awaiter(c,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,Ie()];case 1:return!(t=e.sent()).success&&t.error&&_e(t.error),[2,{success:t.success}]}}))}))}),[_e]),we=a.useMemo((function(){return oe&&te?o.jsx(s.Toast,{text:te,show:oe,closeTimeout:3e3}):null}),[oe,te]);a.useEffect((function(){if(oe){var e=window.setTimeout((function(){pe(!1),ne(null)}),3e3);return function(){return window.clearTimeout(e)}}}),[oe,te]);var Ne=a.useMemo((function(){var e,t,n;return"INACTIVE"===(v?null===(n=null===(t=null===(e=null==M?void 0:M.data)||void 0===e?void 0:e.organisation)||void 0===t?void 0:t.wallet)||void 0===n?void 0:n.status:m)?[{text:"Unlock wallet",icon:o.jsx(u.WalletIcon,{width:16,height:16}),backgroundColor:"#FFFFFF",hoverBackgroundColor:"#F2F2F2",onClick:function(){O(!0)}}]:[]}),[v,M,m]);return{isOnboardingLoading:T,isProfileLoading:x,isEmployeeDetailsLoading:C,onboardingData:M,profileData:H,employeeDetailsData:G,onboardingError:W,profileError:V,employeeDetailsError:Q,isAdmin:he,handleLogout:me,biztripBrandLogo:ie,biztripHoverColor:ae,biztripNavOptions:se,biztripLOBImages:ue,biztripLOBData:le,biztripAccountHeaderBackground:ce,biztripAccountOptions:de,biztripSupportConfig:ve,errorToastElement:we,biztripAccountPills:Ne,showUnlockWalletModal:b,setShowUnlockWalletModal:O,fetchBiztripOnboarding:ye,fetchBiztripProfile:Se,fetchBiztripEmployeeDetails:Ee}},exports.utmParamManager=Xe,exports.validateEmailOtp=function(t,r){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,j("VALIDATE_OTP",n.RequestMethods.POST,ke(t,r))]}))}))},exports.validateOtp=function(t,r){return e.__awaiter(void 0,void 0,void 0,(function(){var o,i;return e.__generator(this,(function(a){switch(a.label){case 0:return[4,j("VALIDATE_OTP",n.RequestMethods.POST,{otp:r,value:t,type:"MOBILE",action:"SIGNIN",countryCode:"+91"},{"ab-otp":"b"})];case 1:return o=a.sent(),i=null==o?void 0:o.data,[2,e.__assign(e.__assign({},o),{signup:(null==i?void 0:i.action)===l.ValidateOTPAction.SIGNUP,action:null==i?void 0:i.action,status:null==o?void 0:o.status})]}}))}))};
|
|
2
2
|
//# sourceMappingURL=ct-platform-utils.cjs.js.map
|