@reservamos/browser-analytics 1.0.12 → 1.0.13

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.
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { AnonymousProfile, GetRecommendedSeatsPayload, GetRecommendedSeatsResponse, GetRecommendedTripsPayload, RecommendedPlacesResponse, RecommendedSeatsPayload, RecommendedSeatsResponse, RecommendedTripsResponse } from '@reservamos/js-api-client/core';
3
+ import { AnonymousProfile, CreateFrequentPassengersResponse, FrequentPassengersResponse, GetRecommendedSeatsPayload, GetRecommendedSeatsResponse, GetRecommendedTripsPayload, RecommendedPlacesResponse, RecommendedSeatsPayload, RecommendedSeatsResponse, RecommendedTripsResponse } from '@reservamos/js-api-client/core';
4
4
  import { z } from 'zod';
5
5
 
6
6
  declare const customEventSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[
@@ -991,6 +991,60 @@ declare const CreateAnonymousProfileSchema: z.ZodEffects<z.ZodObject<{
991
991
  }>;
992
992
  export type CreateAnonymousProfileProps = z.infer<typeof CreateAnonymousProfileSchema>;
993
993
  declare function createAnonymousProfile(payload: CreateAnonymousProfileProps): Promise<AnonymousProfile | undefined>;
994
+ declare const CreateFrequentPassengersSchema: z.ZodObject<{
995
+ passengers: z.ZodArray<z.ZodObject<{
996
+ id: z.ZodNumber;
997
+ first_name: z.ZodString;
998
+ last_name: z.ZodString;
999
+ second_last_name: z.ZodString;
1000
+ category: z.ZodString;
1001
+ bus_category: z.ZodString;
1002
+ gender: z.ZodString;
1003
+ email: z.ZodString;
1004
+ }, "strip", z.ZodTypeAny, {
1005
+ id: number;
1006
+ email: string;
1007
+ first_name: string;
1008
+ last_name: string;
1009
+ second_last_name: string;
1010
+ category: string;
1011
+ bus_category: string;
1012
+ gender: string;
1013
+ }, {
1014
+ id: number;
1015
+ email: string;
1016
+ first_name: string;
1017
+ last_name: string;
1018
+ second_last_name: string;
1019
+ category: string;
1020
+ bus_category: string;
1021
+ gender: string;
1022
+ }>, "many">;
1023
+ }, "strip", z.ZodTypeAny, {
1024
+ passengers: {
1025
+ id: number;
1026
+ email: string;
1027
+ first_name: string;
1028
+ last_name: string;
1029
+ second_last_name: string;
1030
+ category: string;
1031
+ bus_category: string;
1032
+ gender: string;
1033
+ }[];
1034
+ }, {
1035
+ passengers: {
1036
+ id: number;
1037
+ email: string;
1038
+ first_name: string;
1039
+ last_name: string;
1040
+ second_last_name: string;
1041
+ category: string;
1042
+ bus_category: string;
1043
+ gender: string;
1044
+ }[];
1045
+ }>;
1046
+ export type CreateFrequentPassengersSchemaProps = z.infer<typeof CreateFrequentPassengersSchema>;
1047
+ declare function createFrequentPassengers(payload: CreateFrequentPassengersSchemaProps): Promise<CreateFrequentPassengersResponse>;
994
1048
  declare const CreateRecommendedSeatsSchema: z.ZodObject<{
995
1049
  bus_type: z.ZodString;
996
1050
  selected_seats: z.ZodString;
@@ -1185,6 +1239,7 @@ declare const InitConfigSchema: z.ZodObject<{
1185
1239
  export type InitConfig = z.infer<typeof InitConfigSchema>;
1186
1240
  declare function init(config: InitConfig): Promise<void>;
1187
1241
  declare function isTrackerReady(): boolean;
1242
+ declare function getFrequentPassengers(): Promise<FrequentPassengersResponse>;
1188
1243
  declare function getRecommendedPlaces(): Promise<RecommendedPlacesResponse>;
1189
1244
  declare const analytics: {
1190
1245
  init: typeof init;
@@ -1202,6 +1257,8 @@ declare const analytics: {
1202
1257
  createRecommendedSeats: typeof createRecommendedSeats;
1203
1258
  getRecommendedSeats: typeof createRecommendedSeats$1;
1204
1259
  getRecommendedTrips: typeof getRecommendedTrips;
1260
+ createFrequentPassengers: typeof createFrequentPassengers;
1261
+ getFrequentPassengers: typeof getFrequentPassengers;
1205
1262
  };
1206
1263
  track: {
1207
1264
  search: typeof trackSearch$1;
@@ -3982,19 +3982,19 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
3982
3982
  var e = new Error(message);
3983
3983
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3984
3984
  };
3985
- function r$3(e, t3) {
3985
+ function r$2(e, t3) {
3986
3986
  return function(e2, t4) {
3987
3987
  return Object.prototype.hasOwnProperty.call(e2, t4);
3988
3988
  }(e, t3) ? e[t3] : void 0;
3989
3989
  }
3990
3990
  function o$1(e, t3, n2, r2) {
3991
- var o2, i = document, a2 = "securitypolicyviolation", u2 = function(t4) {
3991
+ var o2, i = document, a2 = "securitypolicyviolation", u3 = function(t4) {
3992
3992
  var n3 = new URL(e, location.href), r3 = t4.blockedURI;
3993
3993
  r3 !== n3.href && r3 !== n3.protocol.slice(0, -1) && r3 !== n3.origin || (o2 = t4, R2());
3994
3994
  };
3995
- i.addEventListener(a2, u2);
3995
+ i.addEventListener(a2, u3);
3996
3996
  var R2 = function() {
3997
- return i.removeEventListener(a2, u2);
3997
+ return i.removeEventListener(a2, u3);
3998
3998
  };
3999
3999
  return Promise.resolve().then(t3).then(function(e2) {
4000
4000
  return R2(), e2;
@@ -4010,7 +4010,7 @@ function o$1(e, t3, n2, r2) {
4010
4010
  });
4011
4011
  });
4012
4012
  }
4013
- var i$3 = { default: "endpoint" }, a$3 = { default: "tlsEndpoint" }, u$1 = "Client timeout", R = "Network connection error", c$3 = "Network request aborted", s$4 = "Response cannot be parsed", f$1 = "Blocked by CSP", l$2 = "The endpoint parameter is not a valid URL";
4013
+ var i$3 = { default: "endpoint" }, a$2 = { default: "tlsEndpoint" }, u$2 = "Client timeout", R = "Network connection error", c$3 = "Network request aborted", s$3 = "Response cannot be parsed", f$2 = "Blocked by CSP", l$2 = "The endpoint parameter is not a valid URL";
4014
4014
  function E$1(e) {
4015
4015
  for (var t3 = "", n2 = 0; n2 < e.length; ++n2) if (n2 > 0) {
4016
4016
  var r2 = e[n2].toLowerCase();
@@ -4018,9 +4018,9 @@ function E$1(e) {
4018
4018
  } else t3 += e[n2].toUpperCase();
4019
4019
  return t3;
4020
4020
  }
4021
- var d$2 = /* @__PURE__ */ E$1("WrongRegion"), p$1 = /* @__PURE__ */ E$1("SubscriptionNotActive"), v = /* @__PURE__ */ E$1("UnsupportedVersion"), _$1 = /* @__PURE__ */ E$1("InstallationMethodRestricted"), O = /* @__PURE__ */ E$1("HostnameRestricted"), h = /* @__PURE__ */ E$1("IntegrationFailed"), I = "API key required", N = "API key not found", T = "API key expired", m$1 = "Request cannot be parsed", w$1 = "Request failed", A = "Request failed to process", P = "Too many requests, rate limit exceeded", y$1 = "Not available for this origin", D = "Not available with restricted header", S = I, g = N, L = T, U = "3.11.1", b = "Failed to load the JS script of the agent", C$1 = "9319";
4021
+ var d$2 = /* @__PURE__ */ E$1("WrongRegion"), p$1 = /* @__PURE__ */ E$1("SubscriptionNotActive"), v = /* @__PURE__ */ E$1("UnsupportedVersion"), _$1 = /* @__PURE__ */ E$1("InstallationMethodRestricted"), O = /* @__PURE__ */ E$1("HostnameRestricted"), h = /* @__PURE__ */ E$1("IntegrationFailed"), I = "API key required", N = "API key not found", T = "API key expired", m$1 = "Request cannot be parsed", w$1 = "Request failed", A = "Request failed to process", P = "Too many requests, rate limit exceeded", y$2 = "Not available for this origin", D = "Not available with restricted header", S = I, g = N, L = T, U = "3.11.1", b = "Failed to load the JS script of the agent", C$1 = "9319";
4022
4022
  function M(t3, n2) {
4023
- var r2, o2, i, a2, u2, R2, c2 = [], s2 = (r2 = function(t4) {
4023
+ var r2, o2, i, a2, u3, R2, c2 = [], s2 = (r2 = function(t4) {
4024
4024
  var n3 = __spreadArray([], t4, true);
4025
4025
  return { current: function() {
4026
4026
  return n3[0];
@@ -4030,15 +4030,15 @@ function M(t3, n2) {
4030
4030
  }, exclude: function() {
4031
4031
  n3.shift();
4032
4032
  } };
4033
- }(t3), a2 = 100, u2 = 3e3, R2 = 0, o2 = function() {
4034
- return Math.random() * Math.min(u2, a2 * Math.pow(2, R2++));
4033
+ }(t3), a2 = 100, u3 = 3e3, R2 = 0, o2 = function() {
4034
+ return Math.random() * Math.min(u3, a2 * Math.pow(2, R2++));
4035
4035
  }, i = /* @__PURE__ */ new Set(), [r2.current(), function(e, t4) {
4036
4036
  var n3, a3 = t4 instanceof Error ? t4.message : "";
4037
- if (a3 === f$1 || a3 === l$2) r2.exclude(), n3 = 0;
4037
+ if (a3 === f$2 || a3 === l$2) r2.exclude(), n3 = 0;
4038
4038
  else if (a3 === C$1) r2.exclude();
4039
4039
  else if (a3 === b) {
4040
- var u3 = Date.now() - e.getTime() < 50, R3 = r2.current();
4041
- R3 && u3 && !i.has(R3) && (i.add(R3), n3 = 0), r2.postpone();
4040
+ var u4 = Date.now() - e.getTime() < 50, R3 = r2.current();
4041
+ R3 && u4 && !i.has(R3) && (i.add(R3), n3 = 0), r2.postpone();
4042
4042
  } else r2.postpone();
4043
4043
  var c3 = r2.current();
4044
4044
  return void 0 === c3 ? void 0 : [c3, null != n3 ? n3 : e.getTime() + o2() - Date.now()];
@@ -4070,7 +4070,7 @@ var K = "https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js", B
4070
4070
  function F(e) {
4071
4071
  var o2;
4072
4072
  e.scriptUrlPattern;
4073
- var i = e.token, a2 = e.apiKey, u2 = void 0 === a2 ? i : a2, R2 = __rest$1(e, ["scriptUrlPattern", "token", "apiKey"]), c2 = null !== (o2 = r$3(e, "scriptUrlPattern")) && void 0 !== o2 ? o2 : K, s2 = function() {
4073
+ var i = e.token, a2 = e.apiKey, u3 = void 0 === a2 ? i : a2, R2 = __rest$1(e, ["scriptUrlPattern", "token", "apiKey"]), c2 = null !== (o2 = r$2(e, "scriptUrlPattern")) && void 0 !== o2 ? o2 : K, s2 = function() {
4074
4074
  var e2 = [], t3 = function() {
4075
4075
  e2.push({ time: /* @__PURE__ */ new Date(), state: document.visibilityState });
4076
4076
  }, n2 = function(e3, t4, n3, r2) {
@@ -4081,7 +4081,7 @@ function F(e) {
4081
4081
  return t3(), [e2, n2];
4082
4082
  }(), f2 = s2[0], l2 = s2[1];
4083
4083
  return Promise.resolve().then(function() {
4084
- if (!u2 || "string" != typeof u2) throw new Error(I);
4084
+ if (!u3 || "string" != typeof u3) throw new Error(I);
4085
4085
  var e2 = function(e3, t3) {
4086
4086
  return (Array.isArray(e3) ? e3 : [e3]).map(function(e4) {
4087
4087
  return function(e5, t4) {
@@ -4091,7 +4091,7 @@ function F(e) {
4091
4091
  });
4092
4092
  }(String(e4), t3);
4093
4093
  });
4094
- }(c2, u2);
4094
+ }(c2, u3);
4095
4095
  return M(e2, V);
4096
4096
  }).catch(function(e2) {
4097
4097
  throw l2(), function(e3) {
@@ -4127,7 +4127,7 @@ function V(e) {
4127
4127
  });
4128
4128
  }(e);
4129
4129
  }, function() {
4130
- throw new Error(f$1);
4130
+ throw new Error(f$2);
4131
4131
  }).then(k);
4132
4132
  }
4133
4133
  function k() {
@@ -4138,19 +4138,19 @@ function k() {
4138
4138
  }(e, t3), "function" != typeof (null == n2 ? void 0 : n2.load)) throw new Error(C$1);
4139
4139
  return n2;
4140
4140
  }
4141
- var G = { load: F, defaultScriptUrlPattern: B, ERROR_SCRIPT_LOAD_FAIL: b, ERROR_API_KEY_EXPIRED: T, ERROR_API_KEY_INVALID: N, ERROR_API_KEY_MISSING: I, ERROR_BAD_REQUEST_FORMAT: m$1, ERROR_BAD_RESPONSE_FORMAT: s$4, ERROR_CLIENT_TIMEOUT: u$1, ERROR_CSP_BLOCK: f$1, ERROR_FORBIDDEN_ENDPOINT: O, ERROR_FORBIDDEN_HEADER: D, ERROR_FORBIDDEN_ORIGIN: y$1, ERROR_GENERAL_SERVER_FAILURE: w$1, ERROR_INSTALLATION_METHOD_RESTRICTED: _$1, ERROR_INTEGRATION_FAILURE: h, ERROR_INVALID_ENDPOINT: l$2, ERROR_NETWORK_ABORT: c$3, ERROR_NETWORK_CONNECTION: R, ERROR_RATE_LIMIT: P, ERROR_SERVER_TIMEOUT: A, ERROR_SUBSCRIPTION_NOT_ACTIVE: p$1, ERROR_TOKEN_EXPIRED: L, ERROR_TOKEN_INVALID: g, ERROR_TOKEN_MISSING: S, ERROR_UNSUPPORTED_VERSION: v, ERROR_WRONG_REGION: d$2, defaultEndpoint: i$3, defaultTlsEndpoint: a$3 };
4141
+ var G = { load: F, defaultScriptUrlPattern: B, ERROR_SCRIPT_LOAD_FAIL: b, ERROR_API_KEY_EXPIRED: T, ERROR_API_KEY_INVALID: N, ERROR_API_KEY_MISSING: I, ERROR_BAD_REQUEST_FORMAT: m$1, ERROR_BAD_RESPONSE_FORMAT: s$3, ERROR_CLIENT_TIMEOUT: u$2, ERROR_CSP_BLOCK: f$2, ERROR_FORBIDDEN_ENDPOINT: O, ERROR_FORBIDDEN_HEADER: D, ERROR_FORBIDDEN_ORIGIN: y$2, ERROR_GENERAL_SERVER_FAILURE: w$1, ERROR_INSTALLATION_METHOD_RESTRICTED: _$1, ERROR_INTEGRATION_FAILURE: h, ERROR_INVALID_ENDPOINT: l$2, ERROR_NETWORK_ABORT: c$3, ERROR_NETWORK_CONNECTION: R, ERROR_RATE_LIMIT: P, ERROR_SERVER_TIMEOUT: A, ERROR_SUBSCRIPTION_NOT_ACTIVE: p$1, ERROR_TOKEN_EXPIRED: L, ERROR_TOKEN_INVALID: g, ERROR_TOKEN_MISSING: S, ERROR_UNSUPPORTED_VERSION: v, ERROR_WRONG_REGION: d$2, defaultEndpoint: i$3, defaultTlsEndpoint: a$2 };
4142
4142
  const FingerprintJSPro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4143
4143
  __proto__: null,
4144
4144
  ERROR_API_KEY_EXPIRED: T,
4145
4145
  ERROR_API_KEY_INVALID: N,
4146
4146
  ERROR_API_KEY_MISSING: I,
4147
4147
  ERROR_BAD_REQUEST_FORMAT: m$1,
4148
- ERROR_BAD_RESPONSE_FORMAT: s$4,
4149
- ERROR_CLIENT_TIMEOUT: u$1,
4150
- ERROR_CSP_BLOCK: f$1,
4148
+ ERROR_BAD_RESPONSE_FORMAT: s$3,
4149
+ ERROR_CLIENT_TIMEOUT: u$2,
4150
+ ERROR_CSP_BLOCK: f$2,
4151
4151
  ERROR_FORBIDDEN_ENDPOINT: O,
4152
4152
  ERROR_FORBIDDEN_HEADER: D,
4153
- ERROR_FORBIDDEN_ORIGIN: y$1,
4153
+ ERROR_FORBIDDEN_ORIGIN: y$2,
4154
4154
  ERROR_GENERAL_SERVER_FAILURE: w$1,
4155
4155
  ERROR_INSTALLATION_METHOD_RESTRICTED: _$1,
4156
4156
  ERROR_INTEGRATION_FAILURE: h,
@@ -4169,7 +4169,7 @@ const FingerprintJSPro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
4169
4169
  default: G,
4170
4170
  defaultEndpoint: i$3,
4171
4171
  defaultScriptUrlPattern: B,
4172
- defaultTlsEndpoint: a$3,
4172
+ defaultTlsEndpoint: a$2,
4173
4173
  load: F
4174
4174
  }, Symbol.toStringTag, { value: "Module" }));
4175
4175
  const CACHE_KEY_PREFIX = "@fpjs@client@";
@@ -4619,7 +4619,7 @@ const fingerprintService = {
4619
4619
  isFingerprintReady,
4620
4620
  getCachedFingerprint
4621
4621
  };
4622
- const r$2 = {
4622
+ const r$1 = {
4623
4623
  sandbox: {
4624
4624
  search: "https://search.resertravel.com/api",
4625
4625
  purchase: "https://purchases.resertravel.com/api",
@@ -4630,26 +4630,26 @@ const r$2 = {
4630
4630
  purchase: "https://compras.reservamos.mx/api",
4631
4631
  core: ""
4632
4632
  }
4633
- }, s$3 = "sandbox", a$2 = "v2", t$3 = "v1", n$2 = {
4634
- env: s$3,
4633
+ }, s$2 = "sandbox", a$1 = "v2", t$3 = "v1", n$1 = {
4634
+ env: s$2,
4635
4635
  headers: {},
4636
- searchUrl: r$2[s$3].search,
4637
- purchaseUrl: r$2[s$3].purchase,
4638
- coreUrl: r$2[s$3].core,
4639
- version: a$2,
4636
+ searchUrl: r$1[s$2].search,
4637
+ purchaseUrl: r$1[s$2].purchase,
4638
+ coreUrl: r$1[s$2].core,
4639
+ version: a$1,
4640
4640
  coreVersion: t$3,
4641
4641
  apiKey: void 0,
4642
4642
  userAuthToken: void 0,
4643
4643
  withCredentials: false
4644
4644
  };
4645
- let c$2 = Object.assign({}, n$2);
4645
+ let c$2 = Object.assign({}, n$1);
4646
4646
  const o = {
4647
4647
  // UNAUTHORIZED
4648
4648
  1: {
4649
4649
  code: 200,
4650
4650
  message: "Operación no autorizada"
4651
4651
  }
4652
- }, s$2 = {
4652
+ }, s$1 = {
4653
4653
  // INCORRECT_PARAMS
4654
4654
  3: {
4655
4655
  code: 300,
@@ -4660,7 +4660,7 @@ const o = {
4660
4660
  code: 301,
4661
4661
  message: "Fecha inválida"
4662
4662
  }
4663
- }, r$1 = {
4663
+ }, r = {
4664
4664
  // NONEXISTENT_TRIP
4665
4665
  10: {
4666
4666
  code: 400,
@@ -4681,7 +4681,7 @@ const o = {
4681
4681
  code: 60,
4682
4682
  message: "Tarifa no disponible"
4683
4683
  }
4684
- }, n$1 = (e) => ({
4684
+ }, n = (e) => ({
4685
4685
  // INVALID_DISCOUNT
4686
4686
  11: {
4687
4687
  code: 500,
@@ -4692,7 +4692,7 @@ const o = {
4692
4692
  code: 501,
4693
4693
  message: e
4694
4694
  }
4695
- }), a$1 = {
4695
+ }), a = {
4696
4696
  // unavailable_student
4697
4697
  23: {
4698
4698
  code: 60,
@@ -4740,10 +4740,10 @@ const o = {
4740
4740
  }
4741
4741
  }, i$2 = (e) => ({
4742
4742
  ...o,
4743
- ...s$2,
4744
- ...r$1,
4745
- ...n$1(e),
4746
- ...a$1,
4743
+ ...s$1,
4744
+ ...r,
4745
+ ...n(e),
4746
+ ...a,
4747
4747
  ...d$1,
4748
4748
  ...c$1(e)
4749
4749
  });
@@ -4777,7 +4777,7 @@ function w(e) {
4777
4777
  } else
4778
4778
  return e;
4779
4779
  }
4780
- function y(...e) {
4780
+ function y$1(...e) {
4781
4781
  const r2 = Object.keys(Object.assign({}, ...e)).reduce(
4782
4782
  (n2, o2) => ({
4783
4783
  ...n2,
@@ -4793,17 +4793,17 @@ function c(e, t3 = {}, r2 = {}, n2) {
4793
4793
  withCredentials: a2,
4794
4794
  userAuthToken: s2,
4795
4795
  headers: d2
4796
- } = c$2, u2 = {
4796
+ } = c$2, u3 = {
4797
4797
  Accept: "application/json",
4798
4798
  Authorization: `Token token=${r2.apiKey || o2}`,
4799
4799
  "Content-Type": "application/json"
4800
4800
  };
4801
- return s2 && (u2.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`), t3.headers = y(d2, u2), t3.credentials = a2 ? "include" : "omit", typeof t3.body != "string" && (t3.body = JSON.stringify(t3.body)), fetch(e, t3).then(l$1).then(w).catch(n2);
4801
+ return s2 && (u3.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`), t3.headers = y$1(d2, u3), t3.credentials = a2 ? "include" : "omit", typeof t3.body != "string" && (t3.body = JSON.stringify(t3.body)), fetch(e, t3).then(l$1).then(w).catch(n2);
4802
4802
  }
4803
4803
  function E(e, t3 = {}, r2) {
4804
4804
  return c(e, t3, {}, r2);
4805
4805
  }
4806
- class u {
4806
+ let u$1 = class u {
4807
4807
  constructor({
4808
4808
  url: e,
4809
4809
  watch: i,
@@ -4842,7 +4842,7 @@ class u {
4842
4842
  executeEachCall(e, i) {
4843
4843
  this.eachCall instanceof Function && this.eachCall({ status: e, payload: i }) && this.abort();
4844
4844
  }
4845
- }
4845
+ };
4846
4846
  function C({
4847
4847
  apiName: d2,
4848
4848
  defaultApiVersion: r2
@@ -4859,13 +4859,13 @@ function C({
4859
4859
  function p2(e) {
4860
4860
  c2 = e;
4861
4861
  }
4862
- function u$12() {
4862
+ function u3() {
4863
4863
  if (!o2)
4864
4864
  throw new Error(`Base URL is not set for ${d2} API.`);
4865
4865
  }
4866
4866
  const h2 = { body: {} };
4867
4867
  async function $(e, t3 = h2) {
4868
- u$12();
4868
+ u3();
4869
4869
  const { body: s2, headers: n2 = {}, apiVersion: i = r2 } = t3, l2 = `${o2}/${i}/${e}`, b2 = {
4870
4870
  ...a2,
4871
4871
  ...n2,
@@ -4878,7 +4878,7 @@ function C({
4878
4878
  })).json();
4879
4879
  }
4880
4880
  async function y2(e, t3 = {}) {
4881
- u$12();
4881
+ u3();
4882
4882
  const { headers: s2 = {}, apiVersion: n2 = r2 } = t3, i = `${o2}/${n2}/${e}`;
4883
4883
  return (await fetch(i, { headers: s2 })).json();
4884
4884
  }
@@ -4889,7 +4889,7 @@ function C({
4889
4889
  expect: t3.expect,
4890
4890
  eachCall: t3.onEachResponse
4891
4891
  };
4892
- return new u(n2);
4892
+ return new u$1(n2);
4893
4893
  }
4894
4894
  return {
4895
4895
  get: y2,
@@ -4903,20 +4903,6 @@ const t$1 = C({
4903
4903
  apiName: "Core",
4904
4904
  defaultApiVersion: "v1"
4905
4905
  });
4906
- async function r(e) {
4907
- return t$1.get(
4908
- `passengers/${e}`
4909
- );
4910
- }
4911
- async function n(e) {
4912
- return t$1.post("passengers", {
4913
- body: e
4914
- });
4915
- }
4916
- const a = {
4917
- getFrequentPassengers: r,
4918
- createFrequentPassengers: n
4919
- };
4920
4906
  async function t2(o2) {
4921
4907
  const { data: e } = await t$1.post(
4922
4908
  "anonymous_profiles/identify",
@@ -4926,55 +4912,66 @@ async function t2(o2) {
4926
4912
  );
4927
4913
  return e;
4928
4914
  }
4929
- const s$1 = {
4915
+ const s = {
4930
4916
  createAnonymousProfile: t2
4931
4917
  };
4932
- function d({
4918
+ function i$1({
4933
4919
  searchId: e,
4934
- userIdentifier: t3
4920
+ userIdentifier: n2
4935
4921
  }) {
4936
4922
  return t$1.get(
4937
- `trip_recommendations/${e}/${t3}`
4923
+ `trip_recommendations/${e}/${n2}`
4938
4924
  );
4939
4925
  }
4940
- function i$1(e) {
4926
+ function d(e) {
4941
4927
  return t$1.post("seat_recommendations", {
4942
4928
  body: e
4943
4929
  });
4944
4930
  }
4945
- function m({
4931
+ function p({
4946
4932
  distinct_id: e,
4947
- ...t3
4933
+ ...n2
4948
4934
  }) {
4949
4935
  return t$1.post(`seat_recommendations/${e}`, {
4950
- body: t3
4936
+ body: n2
4951
4937
  });
4952
4938
  }
4953
- function p(e, t3) {
4954
- const { start: s2, onEachResponse: c2 } = t3, r2 = `profiles/${e}`, a2 = {
4939
+ function m(e, n2) {
4940
+ const { start: s2, onEachResponse: r2 } = n2, c2 = `profiles/${e}`, a2 = {
4955
4941
  watch: "state",
4956
4942
  expect: "finished",
4957
- onEachResponse: c2
4958
- }, n2 = t$1.poll(r2, a2);
4959
- return s2 && n2.start(), n2;
4943
+ onEachResponse: r2
4944
+ }, o2 = t$1.poll(c2, a2);
4945
+ return s2 && o2.start(), o2;
4960
4946
  }
4961
- async function l(e) {
4947
+ async function u2(e) {
4962
4948
  return t$1.post("profiles", {
4963
4949
  body: e
4964
4950
  });
4965
4951
  }
4966
- const f = {
4967
- getRecommendedTrips: d,
4968
- createRecommendedPlaces: l,
4969
- pollRecommendedPlaces: p,
4970
- createRecommendedSeats: i$1,
4971
- getRecommendedSeats: m
4952
+ async function f$1(e) {
4953
+ return t$1.post("passengers", {
4954
+ body: e
4955
+ });
4956
+ }
4957
+ async function l(e) {
4958
+ return t$1.get(
4959
+ `passengers/${e}`
4960
+ );
4961
+ }
4962
+ const y = {
4963
+ getRecommendedTrips: i$1,
4964
+ createRecommendedPlaces: u2,
4965
+ pollRecommendedPlaces: m,
4966
+ createRecommendedSeats: d,
4967
+ getRecommendedSeats: p,
4968
+ getFrequentPassengers: l,
4969
+ createFrequentPassengers: f$1
4972
4970
  };
4973
- const s = {
4971
+ const f = {
4974
4972
  setConfig: t$1.setConfig,
4975
- recommendations: f,
4976
- profiles: s$1,
4977
- preferences: a
4973
+ recommendations: y,
4974
+ profiles: s
4978
4975
  };
4979
4976
  let environment;
4980
4977
  const origin = window.location.origin;
@@ -13409,7 +13406,7 @@ function loadNoop(_src, onload) {
13409
13406
  onload();
13410
13407
  }
13411
13408
  var mixpanel = init_as_module(loadNoop);
13412
- const version = "1.0.12";
13409
+ const version = "1.0.13";
13413
13410
  const MIXPANEL_DISTINCT_ID_CACHE_KEY = "mp_distinct_id";
13414
13411
  function init$2(mixpanelToken, debug = false, proxyUrl) {
13415
13412
  return new Promise((resolve) => {
@@ -13835,7 +13832,7 @@ async function init$1(config) {
13835
13832
  console.error("Error initializing identification service:", error);
13836
13833
  }
13837
13834
  configService.setEnvironment(isSandbox ? "sandbox" : "prod");
13838
- s.setConfig(configService.getCoreAPIConfig());
13835
+ f.setConfig(configService.getCoreAPIConfig());
13839
13836
  onLoaded();
13840
13837
  }
13841
13838
  function isTrackerReady() {
@@ -14076,7 +14073,7 @@ async function createAnonymousProfile(payload) {
14076
14073
  identifiers.push({ key: "fingerprint", value: userFingerprintId });
14077
14074
  if (distinctId) identifiers.push({ key: "distinct_id", value: distinctId });
14078
14075
  const dataPayload = getAnonymousProfilePayload(payload, identifiers);
14079
- return await s.profiles.createAnonymousProfile(dataPayload);
14076
+ return await f.profiles.createAnonymousProfile(dataPayload);
14080
14077
  } catch (error) {
14081
14078
  console.error("Could not create anonymous profile:", error);
14082
14079
  return void 0;
@@ -14175,6 +14172,36 @@ const EVENT_NAME = "Purchase Canceled";
14175
14172
  function trackPurchaseCanceled(eventData, meta = {}) {
14176
14173
  trackEvent(EVENT_NAME, eventData, meta);
14177
14174
  }
14175
+ const FrequentPassengersSchema = z.object({
14176
+ id: z.number(),
14177
+ first_name: z.string(),
14178
+ last_name: z.string(),
14179
+ second_last_name: z.string(),
14180
+ category: z.string(),
14181
+ bus_category: z.string(),
14182
+ gender: z.string(),
14183
+ email: z.string()
14184
+ });
14185
+ const CreateFrequentPassengersSchema = z.object({
14186
+ passengers: z.array(FrequentPassengersSchema).min(1)
14187
+ });
14188
+ async function createFrequentPassengers(payload) {
14189
+ try {
14190
+ validatorService.validateProps(payload, CreateFrequentPassengersSchema);
14191
+ const distinctId = mixpanelService.getMixpanelDistinctId();
14192
+ const userFingerprintId = fingerprintService.getCachedFingerprint();
14193
+ if (!distinctId) {
14194
+ throw new Error("No distinct ID found");
14195
+ }
14196
+ return await f.recommendations.createFrequentPassengers({
14197
+ ...payload,
14198
+ distinct_id: distinctId,
14199
+ device_fingerprint: userFingerprintId || ""
14200
+ });
14201
+ } catch (error) {
14202
+ throw new Error(error instanceof Error ? error.message : String(error));
14203
+ }
14204
+ }
14178
14205
  const SeatSchema$1 = z.object({
14179
14206
  category: z.string(),
14180
14207
  number: z.string().optional(),
@@ -14197,7 +14224,7 @@ async function createRecommendedSeats$1(payload) {
14197
14224
  if (!distinctId) {
14198
14225
  throw new Error("No distinct ID found");
14199
14226
  }
14200
- return await s.recommendations.createRecommendedSeats({
14227
+ return await f.recommendations.createRecommendedSeats({
14201
14228
  ...payload,
14202
14229
  distinct_id: distinctId,
14203
14230
  device_fingerprint: userFingerprintId || ""
@@ -14207,6 +14234,17 @@ async function createRecommendedSeats$1(payload) {
14207
14234
  throw new Error(error instanceof Error ? error.message : String(error));
14208
14235
  }
14209
14236
  }
14237
+ async function getFrequentPassengers() {
14238
+ try {
14239
+ const distinctId = mixpanelService.getMixpanelDistinctId();
14240
+ if (!distinctId) {
14241
+ throw new Error("No distinct ID found");
14242
+ }
14243
+ return await f.recommendations.getFrequentPassengers(distinctId);
14244
+ } catch (error) {
14245
+ throw new Error(error instanceof Error ? error.message : String(error));
14246
+ }
14247
+ }
14210
14248
  const pollingRecommendedPlaces = async (response) => {
14211
14249
  return new Promise((resolve, reject) => {
14212
14250
  const { state, polling_id } = response;
@@ -14214,7 +14252,7 @@ const pollingRecommendedPlaces = async (response) => {
14214
14252
  resolve(response);
14215
14253
  return;
14216
14254
  }
14217
- s.recommendations.pollRecommendedPlaces(polling_id, {
14255
+ f.recommendations.pollRecommendedPlaces(polling_id, {
14218
14256
  start: true,
14219
14257
  watch: "state",
14220
14258
  expect: "finished",
@@ -14236,7 +14274,7 @@ async function getRecommendedPlaces() {
14236
14274
  if (!distinctId) {
14237
14275
  throw new Error("No distinct ID found");
14238
14276
  }
14239
- const response = await s.recommendations.createRecommendedPlaces({
14277
+ const response = await f.recommendations.createRecommendedPlaces({
14240
14278
  distinct_id: distinctId
14241
14279
  });
14242
14280
  if (!response) {
@@ -14265,7 +14303,7 @@ async function createRecommendedSeats(payload) {
14265
14303
  if (!distinctId) {
14266
14304
  throw new Error("No distinct ID found");
14267
14305
  }
14268
- return await s.recommendations.getRecommendedSeats({
14306
+ return await f.recommendations.getRecommendedSeats({
14269
14307
  ...payload,
14270
14308
  distinct_id: distinctId
14271
14309
  });
@@ -14284,7 +14322,7 @@ async function getRecommendedTrips({
14284
14322
  validatorService.validateProps({ searchId }, GetRecommendedTripsSchema);
14285
14323
  const identifier = fingerprintService.getCachedFingerprint() || mixpanelService.getMixpanelDistinctId();
14286
14324
  if (!identifier) throw new Error("No identifier id");
14287
- const response = await s.recommendations.getRecommendedTrips({
14325
+ const response = await f.recommendations.getRecommendedTrips({
14288
14326
  searchId,
14289
14327
  userIdentifier: String(identifier)
14290
14328
  });
@@ -14309,7 +14347,9 @@ const analytics = {
14309
14347
  getRecommendedPlaces,
14310
14348
  createRecommendedSeats: createRecommendedSeats$1,
14311
14349
  getRecommendedSeats: createRecommendedSeats,
14312
- getRecommendedTrips
14350
+ getRecommendedTrips,
14351
+ createFrequentPassengers,
14352
+ getFrequentPassengers
14313
14353
  },
14314
14354
  track: {
14315
14355
  search: trackSearch,