@embedreach/components 0.3.34 → 0.3.36

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.
@@ -18699,6 +18699,38 @@ function bypass(input, init) {
18699
18699
  return requestClone;
18700
18700
  }
18701
18701
  checkGlobals();
18702
+ let getRandomValues;
18703
+ const rnds8 = new Uint8Array(16);
18704
+ function rng() {
18705
+ if (!getRandomValues) {
18706
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
18707
+ if (!getRandomValues) {
18708
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
18709
+ }
18710
+ }
18711
+ return getRandomValues(rnds8);
18712
+ }
18713
+ const byteToHex = [];
18714
+ for (let i2 = 0; i2 < 256; ++i2) {
18715
+ byteToHex.push((i2 + 256).toString(16).slice(1));
18716
+ }
18717
+ function unsafeStringify(arr, offset = 0) {
18718
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
18719
+ }
18720
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
18721
+ const native = {
18722
+ randomUUID
18723
+ };
18724
+ function v4(options, buf, offset) {
18725
+ if (native.randomUUID && !buf && !options) {
18726
+ return native.randomUUID();
18727
+ }
18728
+ options = options || {};
18729
+ const rnds = options.random || (options.rng || rng)();
18730
+ rnds[6] = rnds[6] & 15 | 64;
18731
+ rnds[8] = rnds[8] & 63 | 128;
18732
+ return unsafeStringify(rnds);
18733
+ }
18702
18734
  var e = [{ name: "Aegean Airlines", iataCode: "A3" }, { name: "Aeroflot", iataCode: "SU" }, { name: "Aerolineas Argentinas", iataCode: "AR" }, { name: "Aeromexico", iataCode: "AM" }, { name: "Air Algerie", iataCode: "AH" }, { name: "Air Arabia", iataCode: "G9" }, { name: "Air Canada", iataCode: "AC" }, { name: "Air China", iataCode: "CA" }, { name: "Air Europa", iataCode: "UX" }, { name: "Air France", iataCode: "AF" }, { name: "Air India", iataCode: "AI" }, { name: "Air Mauritius", iataCode: "MK" }, { name: "Air New Zealand", iataCode: "NZ" }, { name: "Air Niugini", iataCode: "PX" }, { name: "Air Tahiti", iataCode: "VT" }, { name: "Air Tahiti Nui", iataCode: "TN" }, { name: "Air Transat", iataCode: "TS" }, { name: "AirAsia X", iataCode: "D7" }, { name: "AirAsia", iataCode: "AK" }, { name: "Aircalin", iataCode: "SB" }, { name: "Alaska Airlines", iataCode: "AS" }, { name: "Alitalia", iataCode: "AZ" }, { name: "All Nippon Airways", iataCode: "NH" }, { name: "Allegiant Air", iataCode: "G4" }, { name: "American Airlines", iataCode: "AA" }, { name: "Asiana Airlines", iataCode: "OZ" }, { name: "Avianca", iataCode: "AV" }, { name: "Azul Linhas Aereas Brasileiras", iataCode: "AD" }, { name: "Azur Air", iataCode: "ZF" }, { name: "Beijing Capital Airlines", iataCode: "JD" }, { name: "Boliviana de Aviacion", iataCode: "OB" }, { name: "British Airways", iataCode: "BA" }, { name: "Cathay Pacific", iataCode: "CX" }, { name: "Cebu Pacific Air", iataCode: "5J" }, { name: "China Airlines", iataCode: "CI" }, { name: "China Eastern Airlines", iataCode: "MU" }, { name: "China Southern Airlines", iataCode: "CZ" }, { name: "Condor", iataCode: "DE" }, { name: "Copa Airlines", iataCode: "CM" }, { name: "Delta Air Lines", iataCode: "DL" }, { name: "Easyfly", iataCode: "VE" }, { name: "EasyJet", iataCode: "U2" }, { name: "EcoJet", iataCode: "8J" }, { name: "Egyptair", iataCode: "MS" }, { name: "El Al", iataCode: "LY" }, { name: "Emirates Airlines", iataCode: "EK" }, { name: "Ethiopian Airlines", iataCode: "ET" }, { name: "Etihad Airways", iataCode: "EY" }, { name: "EVA Air", iataCode: "BR" }, { name: "Fiji Airways", iataCode: "FJ" }, { name: "Finnair", iataCode: "AY" }, { name: "Flybondi", iataCode: "FO" }, { name: "Flydubai", iataCode: "FZ" }, { name: "FlySafair", iataCode: "FA" }, { name: "Frontier Airlines", iataCode: "F9" }, { name: "Garuda Indonesia", iataCode: "GA" }, { name: "Go First", iataCode: "G8" }, { name: "Gol Linhas Aereas Inteligentes", iataCode: "G3" }, { name: "Hainan Airlines", iataCode: "HU" }, { name: "Hawaiian Airlines", iataCode: "HA" }, { name: "IndiGo Airlines", iataCode: "6E" }, { name: "Japan Airlines", iataCode: "JL" }, { name: "Jeju Air", iataCode: "7C" }, { name: "Jet2", iataCode: "LS" }, { name: "JetBlue Airways", iataCode: "B6" }, { name: "JetSMART", iataCode: "JA" }, { name: "Juneyao Airlines", iataCode: "HO" }, { name: "Kenya Airways", iataCode: "KQ" }, { name: "KLM Royal Dutch Airlines", iataCode: "KL" }, { name: "Korean Air", iataCode: "KE" }, { name: "Kulula.com", iataCode: "MN" }, { name: "LATAM Airlines", iataCode: "LA" }, { name: "Lion Air", iataCode: "JT" }, { name: "LOT Polish Airlines", iataCode: "LO" }, { name: "Lufthansa", iataCode: "LH" }, { name: "Libyan Airlines", iataCode: "LN" }, { name: "Linea Aerea Amaszonas", iataCode: "Z8" }, { name: "Malaysia Airlines", iataCode: "MH" }, { name: "Nordwind Airlines", iataCode: "N4" }, { name: "Norwegian Air Shuttle", iataCode: "DY" }, { name: "Oman Air", iataCode: "WY" }, { name: "Pakistan International Airlines", iataCode: "PK" }, { name: "Pegasus Airlines", iataCode: "PC" }, { name: "Philippine Airlines", iataCode: "PR" }, { name: "Qantas Group", iataCode: "QF" }, { name: "Qatar Airways", iataCode: "QR" }, { name: "Republic Airways", iataCode: "YX" }, { name: "Royal Air Maroc", iataCode: "AT" }, { name: "Ryanair", iataCode: "FR" }, { name: "S7 Airlines", iataCode: "S7" }, { name: "SAS", iataCode: "SK" }, { name: "Satena", iataCode: "9R" }, { name: "Saudia", iataCode: "SV" }, { name: "Shandong Airlines", iataCode: "SC" }, { name: "Sichuan Airlines", iataCode: "3U" }, { name: "Singapore Airlines", iataCode: "SQ" }, { name: "Sky Airline", iataCode: "H2" }, { name: "SkyWest Airlines", iataCode: "OO" }, { name: "South African Airways", iataCode: "SA" }, { name: "Southwest Airlines", iataCode: "WN" }, { name: "SpiceJet", iataCode: "SG" }, { name: "Spirit Airlines", iataCode: "NK" }, { name: "Spring Airlines", iataCode: "9S" }, { name: "SriLankan Airlines", iataCode: "UL" }, { name: "Star Peru", iataCode: "2I" }, { name: "Sun Country Airlines", iataCode: "SY" }, { name: "SunExpress", iataCode: "XQ" }, { name: "TAP Air Portugal", iataCode: "TP" }, { name: "Thai AirAsia", iataCode: "FD" }, { name: "Thai Airways", iataCode: "TG" }, { name: "TUI Airways", iataCode: "BY" }, { name: "Tunisair", iataCode: "TU" }, { name: "Turkish Airlines", iataCode: "TK" }, { name: "Ukraine International", iataCode: "PS" }, { name: "United Airlines", iataCode: "UA" }, { name: "Ural Airlines", iataCode: "U6" }, { name: "VietJet Air", iataCode: "VJ" }, { name: "Vietnam Airlines", iataCode: "VN" }, { name: "Virgin Atlantic Airways", iataCode: "VS" }, { name: "Virgin Australia", iataCode: "VA" }, { name: "VivaAerobus", iataCode: "VB" }, { name: "VOEPASS Linhas Aereas", iataCode: "2Z" }, { name: "Volaris", iataCode: "Y4" }, { name: "WestJet", iataCode: "WS" }, { name: "Wingo", iataCode: "P5" }, { name: "Wizz Air", iataCode: "W6" }];
18703
18735
  var a = [{ name: "Aerospatiale/BAC Concorde", iataTypeCode: "SSC" }, { name: "Airbus A300", iataTypeCode: "AB3" }, { name: "Airbus A310", iataTypeCode: "310" }, { name: "Airbus A310-200", iataTypeCode: "312" }, { name: "Airbus A310-300", iataTypeCode: "313" }, { name: "Airbus A318", iataTypeCode: "318" }, { name: "Airbus A319", iataTypeCode: "319" }, { name: "Airbus A319neo", iataTypeCode: "31N" }, { name: "Airbus A320", iataTypeCode: "320" }, { name: "Airbus A320neo", iataTypeCode: "32N" }, { name: "Airbus A321", iataTypeCode: "321" }, { name: "Airbus A321neo", iataTypeCode: "32Q" }, { name: "Airbus A330", iataTypeCode: "330" }, { name: "Airbus A330-200", iataTypeCode: "332" }, { name: "Airbus A330-300", iataTypeCode: "333" }, { name: "Airbus A330-800neo", iataTypeCode: "338" }, { name: "Airbus A330-900neo", iataTypeCode: "339" }, { name: "Airbus A340", iataTypeCode: "340" }, { name: "Airbus A340-200", iataTypeCode: "342" }, { name: "Airbus A340-300", iataTypeCode: "343" }, { name: "Airbus A340-500", iataTypeCode: "345" }, { name: "Airbus A340-600", iataTypeCode: "346" }, { name: "Airbus A350", iataTypeCode: "350" }, { name: "Airbus A350-900", iataTypeCode: "359" }, { name: "Airbus A350-1000", iataTypeCode: "351" }, { name: "Airbus A380", iataTypeCode: "380" }, { name: "Airbus A380-800", iataTypeCode: "388" }, { name: "Antonov An-12", iataTypeCode: "ANF" }, { name: "Antonov An-24", iataTypeCode: "AN4" }, { name: "Antonov An-26", iataTypeCode: "A26" }, { name: "Antonov An-28", iataTypeCode: "A28" }, { name: "Antonov An-30", iataTypeCode: "A30" }, { name: "Antonov An-32", iataTypeCode: "A32" }, { name: "Antonov An-72", iataTypeCode: "AN7" }, { name: "Antonov An-124 Ruslan", iataTypeCode: "A4F" }, { name: "Antonov An-140", iataTypeCode: "A40" }, { name: "Antonov An-148", iataTypeCode: "A81" }, { name: "Antonov An-158", iataTypeCode: "A58" }, { name: "Antonov An-225 Mriya", iataTypeCode: "A5F" }, { name: "Boeing 707", iataTypeCode: "703" }, { name: "Boeing 717", iataTypeCode: "717" }, { name: "Boeing 720B", iataTypeCode: "B72" }, { name: "Boeing 727", iataTypeCode: "727" }, { name: "Boeing 727-100", iataTypeCode: "721" }, { name: "Boeing 727-200", iataTypeCode: "722" }, { name: "Boeing 737 MAX 7", iataTypeCode: "7M7" }, { name: "Boeing 737 MAX 8", iataTypeCode: "7M8" }, { name: "Boeing 737 MAX 9", iataTypeCode: "7M9" }, { name: "Boeing 737 MAX 10", iataTypeCode: "7MJ" }, { name: "Boeing 737", iataTypeCode: "737" }, { name: "Boeing 737-100", iataTypeCode: "731" }, { name: "Boeing 737-200", iataTypeCode: "732" }, { name: "Boeing 737-300", iataTypeCode: "733" }, { name: "Boeing 737-400", iataTypeCode: "734" }, { name: "Boeing 737-500", iataTypeCode: "735" }, { name: "Boeing 737-600", iataTypeCode: "736" }, { name: "Boeing 737-700", iataTypeCode: "73G" }, { name: "Boeing 737-800", iataTypeCode: "738" }, { name: "Boeing 737-900", iataTypeCode: "739" }, { name: "Boeing 747", iataTypeCode: "747" }, { name: "Boeing 747-100", iataTypeCode: "741" }, { name: "Boeing 747-200", iataTypeCode: "742" }, { name: "Boeing 747-300", iataTypeCode: "743" }, { name: "Boeing 747-400", iataTypeCode: "744" }, { name: "Boeing 747-400D", iataTypeCode: "74J" }, { name: "Boeing 747-8", iataTypeCode: "748" }, { name: "Boeing 747SP", iataTypeCode: "74L" }, { name: "Boeing 747SR", iataTypeCode: "74R" }, { name: "Boeing 757", iataTypeCode: "757" }, { name: "Boeing 757-200", iataTypeCode: "752" }, { name: "Boeing 757-300", iataTypeCode: "753" }, { name: "Boeing 767", iataTypeCode: "767" }, { name: "Boeing 767-200", iataTypeCode: "762" }, { name: "Boeing 767-300", iataTypeCode: "763" }, { name: "Boeing 767-400", iataTypeCode: "764" }, { name: "Boeing 777", iataTypeCode: "777" }, { name: "Boeing 777-200", iataTypeCode: "772" }, { name: "Boeing 777-200LR", iataTypeCode: "77L" }, { name: "Boeing 777-300", iataTypeCode: "773" }, { name: "Boeing 777-300ER", iataTypeCode: "77W" }, { name: "Boeing 787", iataTypeCode: "787" }, { name: "Boeing 787-8", iataTypeCode: "788" }, { name: "Boeing 787-9", iataTypeCode: "789" }, { name: "Boeing 787-10", iataTypeCode: "781" }, { name: "Canadair Challenger", iataTypeCode: "CCJ" }, { name: "Canadair CL-44", iataTypeCode: "CL4" }, { name: "Canadair Regional Jet 100", iataTypeCode: "CR1" }, { name: "Canadair Regional Jet 200", iataTypeCode: "CR2" }, { name: "Canadair Regional Jet 700", iataTypeCode: "CR7" }, { name: "Canadair Regional Jet 705", iataTypeCode: "CRA" }, { name: "Canadair Regional Jet 900", iataTypeCode: "CR9" }, { name: "Canadair Regional Jet 1000", iataTypeCode: "CRK" }, { name: "De Havilland Canada DHC-2 Beaver", iataTypeCode: "DHP" }, { name: "De Havilland Canada DHC-2 Turbo-Beaver", iataTypeCode: "DHR" }, { name: "De Havilland Canada DHC-3 Otter", iataTypeCode: "DHL" }, { name: "De Havilland Canada DHC-4 Caribou", iataTypeCode: "DHC" }, { name: "De Havilland Canada DHC-6 Twin Otter", iataTypeCode: "DHT" }, { name: "De Havilland Canada DHC-7 Dash 7", iataTypeCode: "DH7" }, { name: "De Havilland Canada DHC-8-100 Dash 8 / 8Q", iataTypeCode: "DH1" }, { name: "De Havilland Canada DHC-8-200 Dash 8 / 8Q", iataTypeCode: "DH2" }, { name: "De Havilland Canada DHC-8-300 Dash 8 / 8Q", iataTypeCode: "DH3" }, { name: "De Havilland Canada DHC-8-400 Dash 8Q", iataTypeCode: "DH4" }, { name: "De Havilland DH.104 Dove", iataTypeCode: "DHD" }, { name: "De Havilland DH.114 Heron", iataTypeCode: "DHH" }, { name: "Douglas DC-3", iataTypeCode: "D3F" }, { name: "Douglas DC-6", iataTypeCode: "D6F" }, { name: "Douglas DC-8-50", iataTypeCode: "D8T" }, { name: "Douglas DC-8-62", iataTypeCode: "D8L" }, { name: "Douglas DC-8-72", iataTypeCode: "D8Q" }, { name: "Douglas DC-9-10", iataTypeCode: "D91" }, { name: "Douglas DC-9-20", iataTypeCode: "D92" }, { name: "Douglas DC-9-30", iataTypeCode: "D93" }, { name: "Douglas DC-9-40", iataTypeCode: "D94" }, { name: "Douglas DC-9-50", iataTypeCode: "D95" }, { name: "Douglas DC-10", iataTypeCode: "D10" }, { name: "Douglas DC-10-10", iataTypeCode: "D1X" }, { name: "Douglas DC-10-30", iataTypeCode: "D1Y" }, { name: "Embraer 170", iataTypeCode: "E70" }, { name: "Embraer 175", iataTypeCode: "E75" }, { name: "Embraer 190", iataTypeCode: "E90" }, { name: "Embraer 195", iataTypeCode: "E95" }, { name: "Embraer E190-E2", iataTypeCode: "290" }, { name: "Embraer E195-E2", iataTypeCode: "295" }, { name: "Embraer EMB.110 Bandeirante", iataTypeCode: "EMB" }, { name: "Embraer EMB.120 Brasilia", iataTypeCode: "EM2" }, { name: "Embraer Legacy 600", iataTypeCode: "ER3" }, { name: "Embraer Phenom 100", iataTypeCode: "EP1" }, { name: "Embraer Phenom 300", iataTypeCode: "EP3" }, { name: "Embraer RJ135", iataTypeCode: "ER3" }, { name: "Embraer RJ140", iataTypeCode: "ERD" }, { name: "Embraer RJ145 Amazon", iataTypeCode: "ER4" }, { name: "Ilyushin IL18", iataTypeCode: "IL8" }, { name: "Ilyushin IL62", iataTypeCode: "IL6" }, { name: "Ilyushin IL76", iataTypeCode: "IL7" }, { name: "Ilyushin IL86", iataTypeCode: "ILW" }, { name: "Ilyushin IL96-300", iataTypeCode: "I93" }, { name: "Ilyushin IL114", iataTypeCode: "I14" }, { name: "Lockheed L-182 / 282 / 382 (L-100) Hercules", iataTypeCode: "LOH" }, { name: "Lockheed L-188 Electra", iataTypeCode: "LOE" }, { name: "Lockheed L-1011 Tristar", iataTypeCode: "L10" }, { name: "Lockheed L-1049 Super Constellation", iataTypeCode: "L49" }, { name: "McDonnell Douglas MD11", iataTypeCode: "M11" }, { name: "McDonnell Douglas MD80", iataTypeCode: "M80" }, { name: "McDonnell Douglas MD81", iataTypeCode: "M81" }, { name: "McDonnell Douglas MD82", iataTypeCode: "M82" }, { name: "McDonnell Douglas MD83", iataTypeCode: "M83" }, { name: "McDonnell Douglas MD87", iataTypeCode: "M87" }, { name: "McDonnell Douglas MD88", iataTypeCode: "M88" }, { name: "McDonnell Douglas MD90", iataTypeCode: "M90" }, { name: "Sukhoi Superjet 100-95", iataTypeCode: "SU9" }, { name: "Tupolev Tu-134", iataTypeCode: "TU3" }, { name: "Tupolev Tu-154", iataTypeCode: "TU5" }, { name: "Tupolev Tu-204", iataTypeCode: "T20" }, { name: "Yakovlev Yak-40", iataTypeCode: "YK4" }, { name: "Yakovlev Yak-42", iataTypeCode: "YK2" }];
18704
18736
  var r = [{ name: "Adelaide International Airport", iataCode: "ADL" }, { name: "Adolfo Suarez Madrid-Barajas Airport", iataCode: "MAD" }, { name: "Aeroparque Jorge Newbery Airport", iataCode: "AEP" }, { name: "Afonso Pena International Airport", iataCode: "CWB" }, { name: "Alfonso Bonilla Aragon International Airport", iataCode: "CLO" }, { name: "Amsterdam Airport Schiphol", iataCode: "AMS" }, { name: "Arturo Merino Benitez International Airport", iataCode: "SCL" }, { name: "Auckland International Airport", iataCode: "AKL" }, { name: "Beijing Capital International Airport", iataCode: "PEK" }, { name: "Belem Val de Cans International Airport", iataCode: "BEL" }, { name: "Belo Horizonte Tancredo Neves International Airport", iataCode: "CNF" }, { name: "Berlin-Tegel Airport", iataCode: "TXL" }, { name: "Bole International Airport", iataCode: "ADD" }, { name: "Brasilia-Presidente Juscelino Kubitschek International Airport", iataCode: "BSB" }, { name: "Brisbane International Airport", iataCode: "BNE" }, { name: "Brussels Airport", iataCode: "BRU" }, { name: "Cairns Airport", iataCode: "CNS" }, { name: "Cairo International Airport", iataCode: "CAI" }, { name: "Canberra Airport", iataCode: "CBR" }, { name: "Capetown International Airport", iataCode: "CPT" }, { name: "Charles de Gaulle International Airport", iataCode: "CDG" }, { name: "Charlotte Douglas International Airport", iataCode: "CLT" }, { name: "Chengdu Shuangliu International Airport", iataCode: "CTU" }, { name: "Chhatrapati Shivaji International Airport", iataCode: "BOM" }, { name: "Chicago O'Hare International Airport", iataCode: "ORD" }, { name: "Chongqing Jiangbei International Airport", iataCode: "CKG" }, { name: "Christchurch International Airport", iataCode: "CHC" }, { name: "Copenhagen Kastrup Airport", iataCode: "CPH" }, { name: "Dallas Fort Worth International Airport", iataCode: "DFW" }, { name: "Daniel K. Inouye International Airport", iataCode: "HNL" }, { name: "Denver International Airport", iataCode: "DEN" }, { name: "Don Mueang International Airport", iataCode: "DMK" }, { name: "Dubai International Airport", iataCode: "DXB" }, { name: "Dublin Airport", iataCode: "DUB" }, { name: "Dusseldorf Airport", iataCode: "DUS" }, { name: "El Dorado International Airport", iataCode: "BOG" }, { name: "Eleftherios Venizelos International Airport", iataCode: "ATH" }, { name: "Faa'a International Airport", iataCode: "PPT" }, { name: "Fort Lauderdale Hollywood International Airport", iataCode: "FLL" }, { name: "Fortaleza Pinto Martins International Airport", iataCode: "FOR" }, { name: "Frankfurt am Main Airport", iataCode: "FRA" }, { name: "George Bush Intercontinental Houston Airport", iataCode: "IAH" }, { name: "Gold Coast Airport", iataCode: "OOL" }, { name: "Guarulhos - Governador Andre Franco Montoro International Airport", iataCode: "GRU" }, { name: "Hartsfield-Jackson Atlanta International Airport", iataCode: "ATL" }, { name: "Helsinki Vantaa Airport", iataCode: "HEL" }, { name: "Hobart International Airport", iataCode: "HBA" }, { name: "Hong Kong International Airport", iataCode: "HKG" }, { name: "Houari Boumediene Airport", iataCode: "ALG" }, { name: "Hurgada International Airport", iataCode: "HRG" }, { name: "Incheon International Airport", iataCode: "ICN" }, { name: "Indira Gandhi International Airport", iataCode: "DEL" }, { name: "Istanbul Airport", iataCode: "IST" }, { name: "Jacksons International Airport", iataCode: "POM" }, { name: "Jeju International Airport", iataCode: "CJU" }, { name: "John F Kennedy International Airport", iataCode: "JFK" }, { name: "Jorge Chavez International Airport", iataCode: "LIM" }, { name: "Jose Maria Cordova International Airport", iataCode: "MDE" }, { name: "Josep Tarradellas Barcelona-El Prat Airport", iataCode: "BCN" }, { name: "Kahului Airport", iataCode: "OGG" }, { name: "King Abdulaziz International Airport", iataCode: "JED" }, { name: "Kuala Lumpur International Airport", iataCode: "KUL" }, { name: "Kunming Changshui International Airport", iataCode: "KMG" }, { name: "La Tontouta International Airport", iataCode: "NOU" }, { name: "Leonardo da Vinci-Fiumicino Airport", iataCode: "FCO" }, { name: "London Heathrow Airport", iataCode: "LHR" }, { name: "Los Angeles International Airport", iataCode: "LAX" }, { name: "McCarran International Airport", iataCode: "LAS" }, { name: "Melbourne International Airport", iataCode: "MEL" }, { name: "Mexico City International Airport", iataCode: "MEX" }, { name: "Miami International Airport", iataCode: "MIA" }, { name: "Ministro Pistarini International Airport", iataCode: "EZE" }, { name: "Minneapolis-St Paul International/Wold-Chamberlain Airport", iataCode: "MSP" }, { name: "Mohammed V International Airport", iataCode: "CMN" }, { name: "Moscow Domodedovo Airport", iataCode: "DME" }, { name: "Munich Airport", iataCode: "MUC" }, { name: "Murtala Muhammed International Airport", iataCode: "LOS" }, { name: "Nadi International Airport", iataCode: "NAN" }, { name: "Nairobi Jomo Kenyatta International Airport", iataCode: "NBO" }, { name: "Narita International Airport", iataCode: "NRT" }, { name: "Newark Liberty International Airport", iataCode: "EWR" }, { name: "Ninoy Aquino International Airport", iataCode: "MNL" }, { name: "Noumea Magenta Airport", iataCode: "GEA" }, { name: "O. R. Tambo International Airport", iataCode: "JNB" }, { name: "Orlando International Airport", iataCode: "MCO" }, { name: "Oslo Lufthavn", iataCode: "OSL" }, { name: "Perth Airport", iataCode: "PER" }, { name: "Phoenix Sky Harbor International Airport", iataCode: "PHX" }, { name: "Recife Guararapes-Gilberto Freyre International Airport", iataCode: "REC" }, { name: "Rio de Janeiro Galeao International Airport", iataCode: "GIG" }, { name: "Salgado Filho International Airport", iataCode: "POA" }, { name: "Salvador Deputado Luis Eduardo Magalhaes International Airport", iataCode: "SSA" }, { name: "San Francisco International Airport", iataCode: "SFO" }, { name: "Santos Dumont Airport", iataCode: "SDU" }, { name: "Sao Paulo-Congonhas Airport", iataCode: "CGH" }, { name: "Seattle Tacoma International Airport", iataCode: "SEA" }, { name: "Shanghai Hongqiao International Airport", iataCode: "SHA" }, { name: "Shanghai Pudong International Airport", iataCode: "PVG" }, { name: "Shenzhen Bao'an International Airport", iataCode: "SZX" }, { name: "Sheremetyevo International Airport", iataCode: "SVO" }, { name: "Singapore Changi Airport", iataCode: "SIN" }, { name: "Soekarno-Hatta International Airport", iataCode: "CGK" }, { name: 'Stockholm-Arlanda Airport"', iataCode: "ARN" }, { name: "Suvarnabhumi Airport", iataCode: "BKK" }, { name: "Sydney Kingsford Smith International Airport", iataCode: "SYD" }, { name: "Taiwan Taoyuan International Airport", iataCode: "TPE" }, { name: "Tan Son Nhat International Airport", iataCode: "SGN" }, { name: "Tokyo Haneda International Airport", iataCode: "HND" }, { name: "Toronto Pearson International Airport", iataCode: "YYZ" }, { name: "Tunis Carthage International Airport", iataCode: "TUN" }, { name: "Vancouver International Airport", iataCode: "YVR" }, { name: "Vienna International Airport", iataCode: "VIE" }, { name: "Viracopos International Airport", iataCode: "VCP" }, { name: "Vnukovo International Airport", iataCode: "VKO" }, { name: "Wellington International Airport", iataCode: "WLG" }, { name: "Xi'an Xianyang International Airport", iataCode: "XIY" }, { name: "Zhukovsky International Airport", iataCode: "ZIA" }, { name: "Zurich Airport", iataCode: "ZRH" }];
@@ -21446,7 +21478,11 @@ const createWebPresenceContentFactory = (platformConfig, businessConfig) => {
21446
21478
  const createSandboxMeasureAndAcquireData = (platformId, businessId) => {
21447
21479
  const platformConfigKey = getPlatformConfigKey(platformId);
21448
21480
  const platformConfig = {
21449
- id: platformConfigKey
21481
+ id: platformConfigKey,
21482
+ name: platformConfigKey === "goose" ? "Paws Pet Hotel" : platformConfigKey === "renterra" ? "Tomers Rentals" : "Default",
21483
+ brandColors: [],
21484
+ locationNames: [],
21485
+ locationAreas: []
21450
21486
  };
21451
21487
  const businessConfig = getBusinessConfig(platformId);
21452
21488
  const businessesMe = createBusinessDataFactory(
@@ -21690,38 +21726,6 @@ function parseDateRange(startDateString, endDateString, defaultDays = 30) {
21690
21726
  endDate
21691
21727
  };
21692
21728
  }
21693
- let getRandomValues;
21694
- const rnds8 = new Uint8Array(16);
21695
- function rng() {
21696
- if (!getRandomValues) {
21697
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
21698
- if (!getRandomValues) {
21699
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
21700
- }
21701
- }
21702
- return getRandomValues(rnds8);
21703
- }
21704
- const byteToHex = [];
21705
- for (let i2 = 0; i2 < 256; ++i2) {
21706
- byteToHex.push((i2 + 256).toString(16).slice(1));
21707
- }
21708
- function unsafeStringify(arr, offset = 0) {
21709
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
21710
- }
21711
- const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
21712
- const native = {
21713
- randomUUID
21714
- };
21715
- function v4(options, buf, offset) {
21716
- if (native.randomUUID && true && !options) {
21717
- return native.randomUUID();
21718
- }
21719
- options = options || {};
21720
- const rnds = options.random || (options.rng || rng)();
21721
- rnds[6] = rnds[6] & 15 | 64;
21722
- rnds[8] = rnds[8] & 63 | 128;
21723
- return unsafeStringify(rnds);
21724
- }
21725
21729
  function scaleChannelMetrics(channelMetrics, options) {
21726
21730
  const {
21727
21731
  requestedDays,
@@ -23787,7 +23791,7 @@ function calculateNPSBreakdown(totalResponses, targetNPS) {
23787
23791
  passiveCount
23788
23792
  };
23789
23793
  }
23790
- const mockStore = {
23794
+ const mockStore$1 = {
23791
23795
  reputationConfig: null,
23792
23796
  partnerLocations: null
23793
23797
  };
@@ -23804,7 +23808,7 @@ const reputationHandlers = [
23804
23808
  // Partner Locations
23805
23809
  http.get(`${HOSTNAME}/api/partner-locations`, () => {
23806
23810
  const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
23807
- const locations = mockStore.partnerLocations || platformData.reputationData?.partnerLocations || [];
23811
+ const locations = mockStore$1.partnerLocations || platformData.reputationData?.partnerLocations || [];
23808
23812
  return HttpResponse.json({
23809
23813
  success: true,
23810
23814
  message: "Success (Sandbox)",
@@ -23820,12 +23824,12 @@ const reputationHandlers = [
23820
23824
  const locationId = params.id;
23821
23825
  const body = await request.json();
23822
23826
  const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
23823
- if (!mockStore.partnerLocations) {
23824
- mockStore.partnerLocations = [
23827
+ if (!mockStore$1.partnerLocations) {
23828
+ mockStore$1.partnerLocations = [
23825
23829
  ...platformData.reputationData?.partnerLocations || []
23826
23830
  ];
23827
23831
  }
23828
- const locationIndex = mockStore.partnerLocations.findIndex(
23832
+ const locationIndex = mockStore$1.partnerLocations.findIndex(
23829
23833
  (loc) => loc.externalId === locationId
23830
23834
  );
23831
23835
  if (locationIndex === -1) {
@@ -23837,15 +23841,15 @@ const reputationHandlers = [
23837
23841
  { status: 404 }
23838
23842
  );
23839
23843
  }
23840
- mockStore.partnerLocations[locationIndex] = {
23841
- ...mockStore.partnerLocations[locationIndex],
23844
+ mockStore$1.partnerLocations[locationIndex] = {
23845
+ ...mockStore$1.partnerLocations[locationIndex],
23842
23846
  googleBusinessProfilePlaceId: body.googleBusinessProfilePlaceId || null,
23843
23847
  updatedAt: /* @__PURE__ */ new Date()
23844
23848
  };
23845
23849
  return HttpResponse.json({
23846
23850
  success: true,
23847
23851
  message: "Partner location updated successfully (Sandbox)",
23848
- data: mockStore.partnerLocations[locationIndex]
23852
+ data: mockStore$1.partnerLocations[locationIndex]
23849
23853
  });
23850
23854
  }
23851
23855
  ),
@@ -23873,8 +23877,8 @@ const reputationHandlers = [
23873
23877
  }),
23874
23878
  // Reputation Config
23875
23879
  http.get(`${HOSTNAME}/api/reputation/config`, () => {
23876
- if (mockStore.reputationConfig) {
23877
- const currentLocations = mockStore.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
23880
+ if (mockStore$1.reputationConfig) {
23881
+ const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
23878
23882
  const locationMappings = {};
23879
23883
  currentLocations.forEach((location2) => {
23880
23884
  locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
@@ -23883,7 +23887,7 @@ const reputationHandlers = [
23883
23887
  success: true,
23884
23888
  message: "Success (Sandbox)",
23885
23889
  data: {
23886
- ...mockStore.reputationConfig,
23890
+ ...mockStore$1.reputationConfig,
23887
23891
  locationMappings
23888
23892
  // Always return current mappings from partner locations
23889
23893
  }
@@ -23892,7 +23896,7 @@ const reputationHandlers = [
23892
23896
  }
23893
23897
  const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
23894
23898
  const initialConfig = platformData.reputationData?.reputationConfig || null;
23895
- mockStore.reputationConfig = initialConfig;
23899
+ mockStore$1.reputationConfig = initialConfig;
23896
23900
  const response = {
23897
23901
  success: true,
23898
23902
  message: "Success (Sandbox)",
@@ -23902,7 +23906,7 @@ const reputationHandlers = [
23902
23906
  }),
23903
23907
  http.post(`${HOSTNAME}/api/reputation/config`, async ({ request }) => {
23904
23908
  const body = await request.json();
23905
- const currentConfig = mockStore.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
23909
+ const currentConfig = mockStore$1.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
23906
23910
  if (currentConfig) {
23907
23911
  const updatedConfig = {
23908
23912
  ...currentConfig,
@@ -23913,9 +23917,9 @@ const reputationHandlers = [
23913
23917
  completedOnboardingAt: body.completedOnboardingAt || currentConfig.completedOnboardingAt,
23914
23918
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
23915
23919
  };
23916
- mockStore.reputationConfig = updatedConfig;
23920
+ mockStore$1.reputationConfig = updatedConfig;
23917
23921
  }
23918
- const currentLocations = mockStore.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
23922
+ const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
23919
23923
  const locationMappings = {};
23920
23924
  currentLocations.forEach((location2) => {
23921
23925
  locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
@@ -23924,7 +23928,7 @@ const reputationHandlers = [
23924
23928
  success: true,
23925
23929
  message: "Configuration updated successfully (Sandbox)",
23926
23930
  data: {
23927
- ...mockStore.reputationConfig,
23931
+ ...mockStore$1.reputationConfig,
23928
23932
  locationMappings
23929
23933
  // Include current mappings from partner locations
23930
23934
  }
@@ -24081,6 +24085,7 @@ const reputationHandlers = [
24081
24085
  const locationIds = url.searchParams.get("location_ids");
24082
24086
  const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
24083
24087
  const queryParams = {
24088
+ platform: "google_business_profile",
24084
24089
  start_date: startDate || void 0,
24085
24090
  end_date: endDate || void 0,
24086
24091
  location_ids: locationIds ? locationIds.split(",").filter(Boolean) : void 0
@@ -24297,7 +24302,7 @@ const reputationHandlers = [
24297
24302
  `${HOSTNAME}/api/reputation/finalize-onboarding`,
24298
24303
  async ({ request }) => {
24299
24304
  const body = await request.json();
24300
- const currentConfig = mockStore.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
24305
+ const currentConfig = mockStore$1.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
24301
24306
  const updatedConfig = {
24302
24307
  ...currentConfig || {},
24303
24308
  id: currentConfig?.id || "mock-reputation-config-id",
@@ -24308,8 +24313,8 @@ const reputationHandlers = [
24308
24313
  createdAt: currentConfig?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
24309
24314
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
24310
24315
  };
24311
- mockStore.reputationConfig = updatedConfig;
24312
- const currentLocations = mockStore.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
24316
+ mockStore$1.reputationConfig = updatedConfig;
24317
+ const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
24313
24318
  const locationMappings = {};
24314
24319
  currentLocations.forEach((location2) => {
24315
24320
  locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
@@ -24318,7 +24323,7 @@ const reputationHandlers = [
24318
24323
  success: true,
24319
24324
  message: "Configuration updated successfully (Sandbox)",
24320
24325
  data: {
24321
- ...mockStore.reputationConfig,
24326
+ ...mockStore$1.reputationConfig,
24322
24327
  locationMappings
24323
24328
  // Include current mappings from partner locations
24324
24329
  }
@@ -24327,10 +24332,843 @@ const reputationHandlers = [
24327
24332
  }
24328
24333
  )
24329
24334
  ];
24335
+ const generatePlainPhoneNumber = () => {
24336
+ const areaCode = f.number.int({ min: 200, max: 999 });
24337
+ const centralOffice = f.number.int({ min: 200, max: 999 });
24338
+ const lineNumber = f.number.int({ min: 0, max: 9999 }).toString().padStart(4, "0");
24339
+ return `${areaCode}${centralOffice}${lineNumber}`;
24340
+ };
24341
+ const createVoiceAgentFactory = (businessId) => {
24342
+ return {
24343
+ id: f.string.uuid(),
24344
+ businessId,
24345
+ name: "Voice AI Agent",
24346
+ createdAt: f.date.past().toISOString(),
24347
+ updatedAt: f.date.recent().toISOString()
24348
+ };
24349
+ };
24350
+ const createKnowledgeFactory = (businessId) => {
24351
+ const titles = [
24352
+ "Business Hours",
24353
+ "Services Offered",
24354
+ "Contact Information",
24355
+ "Pricing Information",
24356
+ "Delivery Options",
24357
+ "Return Policy",
24358
+ "Location Details",
24359
+ "Special Offers"
24360
+ ];
24361
+ const contents = [
24362
+ "We are open Monday through Friday from 9am to 6pm.",
24363
+ "We offer professional services including consulting and support.",
24364
+ "You can reach us via phone or email for assistance.",
24365
+ "Our pricing is competitive and flexible based on your needs.",
24366
+ "We offer multiple delivery and shipping options to choose from.",
24367
+ "We have a 30-day return policy on all products.",
24368
+ "Our main location is in downtown and we have multiple branches.",
24369
+ "Check our website regularly for special offers and promotions."
24370
+ ];
24371
+ const titleIndex = f.number.int({ min: 0, max: titles.length - 1 });
24372
+ return {
24373
+ id: f.string.uuid(),
24374
+ business_id: businessId,
24375
+ title: titles[titleIndex],
24376
+ content: contents[titleIndex],
24377
+ created_at: f.date.past().toISOString(),
24378
+ updated_at: f.date.recent().toISOString(),
24379
+ website_scan_id: null
24380
+ };
24381
+ };
24382
+ const createWebsiteScanFactory = (businessId, url, status = "in-progress") => {
24383
+ const created = f.date.past().toISOString();
24384
+ const updated = f.date.recent().toISOString();
24385
+ const base = {
24386
+ id: f.string.uuid(),
24387
+ businessId,
24388
+ url,
24389
+ status,
24390
+ createdAt: created,
24391
+ updatedAt: updated
24392
+ };
24393
+ if (status === "failed") {
24394
+ return {
24395
+ ...base,
24396
+ errorMessage: "Unable to scan website. Please check the URL and try again."
24397
+ };
24398
+ }
24399
+ return base;
24400
+ };
24401
+ const generateScannedKnowledgeItems = (businessId, scanId, count = 8) => {
24402
+ const titles = [
24403
+ "Business Description",
24404
+ "Operating Hours",
24405
+ "Services & Products",
24406
+ "Contact Details",
24407
+ "Location Address",
24408
+ "Special Instructions",
24409
+ "Pricing Structure",
24410
+ "Frequently Asked Questions"
24411
+ ];
24412
+ const contents = [
24413
+ `We are a reputable business specializing in quality services and customer satisfaction. ${f.company.catchPhrase()}`,
24414
+ `Our business operates from ${f.number.int({ min: 8, max: 9 })}am to ${f.number.int({ min: 5, max: 8 })}pm, ${f.helpers.arrayElement(["Monday-Friday", "Monday-Saturday"])}.`,
24415
+ `We offer ${f.number.int({ min: 5, max: 15 })} main services: ${Array.from({ length: f.number.int({ min: 3, max: 5 }) }, () => f.commerce.productName()).join(", ")}.`,
24416
+ `Contact us at ${generatePlainPhoneNumber()} or ${f.internet.email()} for more information.`,
24417
+ `Located at ${f.location.streetAddress()}, ${f.location.city()}, ${f.location.state()}.`,
24418
+ `Appointments must be scheduled at least 24 hours in advance. Please bring a valid ID for verification when arriving on site.`,
24419
+ `Starting at $${f.number.int({ min: 20, max: 999 })}. Payment accepted via credit card, debit card, or cash on delivery.`,
24420
+ `Q: What is your refund policy? A: We offer full refunds within 30 days of purchase with original receipt. Q: Do you offer rush delivery? A: Yes, expedited shipping is available for an additional $25 fee.`
24421
+ ];
24422
+ const itemsToGenerate = Math.min(count, titles.length);
24423
+ return Array.from({ length: itemsToGenerate }, (_2, index) => ({
24424
+ id: f.string.uuid(),
24425
+ business_id: businessId,
24426
+ website_scan_id: scanId,
24427
+ title: titles[index],
24428
+ content: contents[index],
24429
+ created_at: f.date.past().toISOString(),
24430
+ updated_at: f.date.recent().toISOString()
24431
+ }));
24432
+ };
24433
+ const createPhoneNumberFactory = (agentId, number) => {
24434
+ const generatedNumber = generatePlainPhoneNumber();
24435
+ return {
24436
+ id: f.string.uuid(),
24437
+ agentId,
24438
+ businessId: "mock-business-id",
24439
+ phoneNumber: generatedNumber,
24440
+ forwardingType: "none",
24441
+ createdAt: f.date.past().toISOString(),
24442
+ updatedAt: f.date.recent().toISOString()
24443
+ };
24444
+ };
24445
+ const createCallFactory = (agentId) => {
24446
+ const createdAt = f.date.recent();
24447
+ const startedAt = f.date.between({ from: createdAt, to: /* @__PURE__ */ new Date() });
24448
+ const duration = f.number.int({ min: 30, max: 1800 });
24449
+ const endedAt = new Date(startedAt.getTime() + duration * 1e3);
24450
+ const summaries = [
24451
+ "Customer inquired about business hours and services offered. Provided information about our operating schedule and explained our consultation process.",
24452
+ "Client called to schedule an appointment for next week. Confirmed availability and provided pricing information for the requested service.",
24453
+ "Customer had questions about our delivery options and return policy. Explained shipping costs and our satisfaction guarantee.",
24454
+ "Business inquiry about partnership opportunities. Shared information about our collaboration process and requested more details about their needs.",
24455
+ "Customer needed assistance with an existing order. Located their order details and provided status update with estimated delivery time.",
24456
+ "Prospective client called for pricing information. Provided detailed quote and explained our service packages and payment options.",
24457
+ "Customer reported a positive experience with our previous service and wanted to schedule a follow-up appointment.",
24458
+ "Inquiry about location and parking availability. Provided address details and information about nearby parking options."
24459
+ ];
24460
+ return {
24461
+ id: f.string.uuid(),
24462
+ agentId,
24463
+ callType: "phone_call",
24464
+ callStatus: "completed",
24465
+ fromNumber: generatePlainPhoneNumber(),
24466
+ toNumber: generatePlainPhoneNumber(),
24467
+ direction: "inbound",
24468
+ startedAt: startedAt.toISOString(),
24469
+ endedAt: endedAt.toISOString(),
24470
+ durationSecs: duration,
24471
+ sentiment: f.datatype.boolean({ probability: 0.7 }) ? "positive" : "negative",
24472
+ successful: f.datatype.boolean({ probability: 0.8 }),
24473
+ blockedReason: null,
24474
+ transcript: null,
24475
+ summary: f.helpers.arrayElement(summaries),
24476
+ recordingUrl: f.datatype.boolean({ probability: 0.8 }) ? `https://example.com/recording/${f.string.uuid()}.mp3` : void 0,
24477
+ createdAt: createdAt.toISOString(),
24478
+ updatedAt: createdAt.toISOString()
24479
+ };
24480
+ };
24481
+ const knowledgeStore = /* @__PURE__ */ new Map();
24482
+ const mockStore = {
24483
+ agents: [],
24484
+ knowledgeItems: [],
24485
+ scans: [],
24486
+ scannedKnowledge: {},
24487
+ phoneNumbers: [],
24488
+ testCalls: [],
24489
+ forwardingTests: [],
24490
+ agentKnowledge: {},
24491
+ calls: []
24492
+ };
24493
+ const getOrCreateAgent = (businessId) => {
24494
+ let agent = mockStore.agents.find((a2) => a2.businessId === businessId);
24495
+ if (!agent) {
24496
+ agent = createVoiceAgentFactory(businessId);
24497
+ mockStore.agents.push(agent);
24498
+ const phoneNumber = createPhoneNumberFactory(agent.id);
24499
+ mockStore.phoneNumbers.push(phoneNumber);
24500
+ const initialKnowledge = [
24501
+ createKnowledgeFactory(agent.businessId),
24502
+ createKnowledgeFactory(agent.businessId)
24503
+ ];
24504
+ mockStore.knowledgeItems.push(...initialKnowledge);
24505
+ initialKnowledge.forEach((item) => {
24506
+ knowledgeStore.set(item.id, item);
24507
+ });
24508
+ const initialCalls = [
24509
+ createCallFactory(agent.id),
24510
+ createCallFactory(agent.id),
24511
+ createCallFactory(agent.id),
24512
+ createCallFactory(agent.id),
24513
+ createCallFactory(agent.id)
24514
+ ];
24515
+ mockStore.calls.push(...initialCalls);
24516
+ }
24517
+ return agent;
24518
+ };
24519
+ const voiceHandlers = [
24520
+ // Get voice agents
24521
+ http.get(`${HOSTNAME}/api/voice/agents`, async () => {
24522
+ const agent = getOrCreateAgent("mock-business-id");
24523
+ return HttpResponse.json({
24524
+ success: true,
24525
+ message: "Success (Sandbox)",
24526
+ data: {
24527
+ results: [agent],
24528
+ pagination: {
24529
+ hasNextPage: false,
24530
+ cursor: null
24531
+ }
24532
+ }
24533
+ });
24534
+ }),
24535
+ // Create voice agent
24536
+ http.post(`${HOSTNAME}/api/voice/agents`, async () => {
24537
+ const businessId = "mock-business-id";
24538
+ const existingAgent = mockStore.agents.find(
24539
+ (a2) => a2.businessId === businessId
24540
+ );
24541
+ if (existingAgent) {
24542
+ return HttpResponse.json(
24543
+ {
24544
+ success: false,
24545
+ message: "Agent already exists for this business (Sandbox)"
24546
+ },
24547
+ { status: 409 }
24548
+ );
24549
+ }
24550
+ const agent = createVoiceAgentFactory(businessId);
24551
+ mockStore.agents.push(agent);
24552
+ mockStore.agentKnowledge[agent.id] = [];
24553
+ return HttpResponse.json(
24554
+ {
24555
+ success: true,
24556
+ message: "Agent created (Sandbox)",
24557
+ data: agent
24558
+ },
24559
+ { status: 201 }
24560
+ );
24561
+ }),
24562
+ // Get knowledge items for an agent
24563
+ http.get(
24564
+ `${HOSTNAME}/api/voice/agents/:agentId/knowledge`,
24565
+ async ({ params, request }) => {
24566
+ const agentId = typeof params.agentId === "string" ? params.agentId : Array.isArray(params.agentId) ? params.agentId[0] : "";
24567
+ const agent = mockStore.agents.find((a2) => a2.id === agentId);
24568
+ if (!agent) {
24569
+ return HttpResponse.json(
24570
+ {
24571
+ success: false,
24572
+ message: `Agent with ID ${agentId} not found (Sandbox)`
24573
+ },
24574
+ { status: 404 }
24575
+ );
24576
+ }
24577
+ const url = new URL(request.url);
24578
+ const cursor = url.searchParams.get("cursor") || void 0;
24579
+ const limitParam = url.searchParams.get("limit");
24580
+ const limit = limitParam ? Number.parseInt(limitParam, 10) : void 0;
24581
+ const knowledgeItems = mockStore.agentKnowledge[agentId] || [];
24582
+ const startIndex = cursor ? Number.parseInt(cursor, 10) : 0;
24583
+ const endIndex = limit ? startIndex + limit : knowledgeItems.length;
24584
+ const paginatedItems = knowledgeItems.slice(startIndex, endIndex);
24585
+ const hasNextPage = endIndex < knowledgeItems.length;
24586
+ return HttpResponse.json({
24587
+ success: true,
24588
+ message: "Success (Sandbox)",
24589
+ data: {
24590
+ data: paginatedItems,
24591
+ pagination: {
24592
+ hasNextPage,
24593
+ cursor: hasNextPage ? endIndex.toString() : void 0
24594
+ }
24595
+ }
24596
+ });
24597
+ }
24598
+ ),
24599
+ // Apply knowledge to an agent
24600
+ http.post(
24601
+ `${HOSTNAME}/api/voice/agents/:agentId/knowledge`,
24602
+ async ({ params, request }) => {
24603
+ const agentId = typeof params.agentId === "string" ? params.agentId : Array.isArray(params.agentId) ? params.agentId[0] : "";
24604
+ const agent = mockStore.agents.find((a2) => a2.id === agentId);
24605
+ if (!agent) {
24606
+ return HttpResponse.json(
24607
+ {
24608
+ success: false,
24609
+ message: `Agent with ID ${agentId} not found (Sandbox)`
24610
+ },
24611
+ { status: 404 }
24612
+ );
24613
+ }
24614
+ const body = await request.json();
24615
+ const requests = Array.isArray(body) ? body : [body];
24616
+ const knowledgeItems = requests.map((req) => ({
24617
+ id: crypto.randomUUID(),
24618
+ agentId,
24619
+ title: req.title,
24620
+ content: req.content,
24621
+ websiteScanId: void 0,
24622
+ deactivatedAt: null,
24623
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
24624
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
24625
+ }));
24626
+ if (!mockStore.agentKnowledge[agentId]) {
24627
+ mockStore.agentKnowledge[agentId] = [];
24628
+ }
24629
+ mockStore.agentKnowledge[agentId].push(...knowledgeItems);
24630
+ return HttpResponse.json(
24631
+ {
24632
+ success: true,
24633
+ message: "Knowledge applied (Sandbox)",
24634
+ data: knowledgeItems
24635
+ },
24636
+ { status: 201 }
24637
+ );
24638
+ }
24639
+ ),
24640
+ // Get knowledge items from webscan-knowledge (business-scoped)
24641
+ http.get(`${HOSTNAME}/api/webscan-knowledge`, async () => {
24642
+ return HttpResponse.json({
24643
+ success: true,
24644
+ message: "Success (Sandbox)",
24645
+ data: {
24646
+ results: mockStore.knowledgeItems,
24647
+ pagination: {
24648
+ hasNextPage: false,
24649
+ cursor: null
24650
+ }
24651
+ }
24652
+ });
24653
+ }),
24654
+ // Create knowledge item (business-scoped)
24655
+ http.post(`${HOSTNAME}/api/webscan-knowledge`, async ({ request }) => {
24656
+ const body = await request.json();
24657
+ const websiteScanId = body.website_scan_id ?? null;
24658
+ const existingKnowledge = mockStore.knowledgeItems.find(
24659
+ (item) => item.title === body.title && item.content === body.content && item.website_scan_id === websiteScanId
24660
+ );
24661
+ if (existingKnowledge) {
24662
+ knowledgeStore.set(existingKnowledge.id, existingKnowledge);
24663
+ return HttpResponse.json({
24664
+ success: true,
24665
+ message: "Duplicate knowledge skipped (Sandbox)",
24666
+ data: existingKnowledge
24667
+ });
24668
+ }
24669
+ const knowledge = {
24670
+ id: crypto.randomUUID(),
24671
+ website_scan_id: websiteScanId,
24672
+ business_id: "mock-business-id",
24673
+ title: body.title,
24674
+ content: body.content,
24675
+ created_at: (/* @__PURE__ */ new Date()).toISOString(),
24676
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
24677
+ };
24678
+ mockStore.knowledgeItems.push(knowledge);
24679
+ knowledgeStore.set(knowledge.id, knowledge);
24680
+ if (websiteScanId && mockStore.scannedKnowledge[websiteScanId]) {
24681
+ const existingItems = mockStore.scannedKnowledge[websiteScanId];
24682
+ const existingIds = new Set(existingItems.map((item) => item.id));
24683
+ const contentKey = `${knowledge.title}|${knowledge.content}`;
24684
+ const existingContent = new Set(
24685
+ existingItems.map((item) => `${item.title}|${item.content}`)
24686
+ );
24687
+ if (!existingIds.has(knowledge.id) && !existingContent.has(contentKey)) {
24688
+ const scannedKnowledgeItem = {
24689
+ ...knowledge,
24690
+ website_scan_id: websiteScanId
24691
+ };
24692
+ mockStore.scannedKnowledge[websiteScanId].push(scannedKnowledgeItem);
24693
+ }
24694
+ }
24695
+ return HttpResponse.json({
24696
+ success: true,
24697
+ message: "Knowledge item created (Sandbox)",
24698
+ data: knowledge
24699
+ });
24700
+ }),
24701
+ // Update knowledge item (business-scoped)
24702
+ http.put(
24703
+ `${HOSTNAME}/api/webscan-knowledge/:knowledgeId`,
24704
+ async ({ request, params }) => {
24705
+ const knowledgeId = typeof params.knowledgeId === "string" ? params.knowledgeId : Array.isArray(params.knowledgeId) ? params.knowledgeId[0] : "";
24706
+ const body = await request.json();
24707
+ const item = knowledgeStore.get(knowledgeId);
24708
+ if (!item) {
24709
+ return HttpResponse.json(
24710
+ {
24711
+ success: false,
24712
+ message: `Knowledge item with ID ${knowledgeId} not found (Sandbox)`
24713
+ },
24714
+ { status: 404 }
24715
+ );
24716
+ }
24717
+ const updatedItem = {
24718
+ ...item,
24719
+ ...body.title !== void 0 ? { title: body.title } : {},
24720
+ ...body.content !== void 0 ? { content: body.content } : {},
24721
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
24722
+ };
24723
+ knowledgeStore.set(knowledgeId, updatedItem);
24724
+ const sourceIdx = mockStore.knowledgeItems.findIndex(
24725
+ (k2) => k2.id === knowledgeId
24726
+ );
24727
+ if (sourceIdx !== -1) {
24728
+ mockStore.knowledgeItems[sourceIdx] = {
24729
+ ...mockStore.knowledgeItems[sourceIdx],
24730
+ ...updatedItem
24731
+ };
24732
+ }
24733
+ for (const scanId in mockStore.scannedKnowledge) {
24734
+ const index = mockStore.scannedKnowledge[scanId].findIndex(
24735
+ (k2) => k2.id === knowledgeId
24736
+ );
24737
+ if (index !== -1) {
24738
+ mockStore.scannedKnowledge[scanId][index] = {
24739
+ ...mockStore.scannedKnowledge[scanId][index],
24740
+ ...updatedItem
24741
+ };
24742
+ break;
24743
+ }
24744
+ }
24745
+ return HttpResponse.json({
24746
+ success: true,
24747
+ message: "Knowledge updated (Sandbox)",
24748
+ data: updatedItem
24749
+ });
24750
+ }
24751
+ ),
24752
+ // Delete knowledge item (business-scoped)
24753
+ http.delete(
24754
+ `${HOSTNAME}/api/webscan-knowledge/:knowledgeId`,
24755
+ ({ params }) => {
24756
+ const knowledgeId = typeof params.knowledgeId === "string" ? params.knowledgeId : Array.isArray(params.knowledgeId) ? params.knowledgeId[0] : "";
24757
+ const item = knowledgeStore.get(knowledgeId);
24758
+ if (!item) {
24759
+ return HttpResponse.json(
24760
+ {
24761
+ success: false,
24762
+ message: `Knowledge item with ID ${knowledgeId} not found (Sandbox)`
24763
+ },
24764
+ { status: 404 }
24765
+ );
24766
+ }
24767
+ knowledgeStore.delete(knowledgeId);
24768
+ const knowledgeIndex = mockStore.knowledgeItems.findIndex(
24769
+ (k2) => k2.id === knowledgeId
24770
+ );
24771
+ if (knowledgeIndex !== -1) {
24772
+ mockStore.knowledgeItems.splice(knowledgeIndex, 1);
24773
+ }
24774
+ for (const scanId in mockStore.scannedKnowledge) {
24775
+ const index = mockStore.scannedKnowledge[scanId].findIndex(
24776
+ (k2) => k2.id === knowledgeId
24777
+ );
24778
+ if (index !== -1) {
24779
+ mockStore.scannedKnowledge[scanId].splice(index, 1);
24780
+ break;
24781
+ }
24782
+ }
24783
+ return HttpResponse.json({
24784
+ success: true,
24785
+ message: "Knowledge deleted (Sandbox)",
24786
+ data: null
24787
+ });
24788
+ }
24789
+ ),
24790
+ // Start website scan
24791
+ http.post(`${HOSTNAME}/api/webscans/`, async ({ request }) => {
24792
+ const body = await request.json();
24793
+ const agent = getOrCreateAgent("mock-business-id");
24794
+ const scan = createWebsiteScanFactory(
24795
+ agent.businessId,
24796
+ body.url,
24797
+ "in-progress"
24798
+ );
24799
+ mockStore.scans.push(scan);
24800
+ const scannedItems = generateScannedKnowledgeItems(
24801
+ agent.businessId,
24802
+ scan.id,
24803
+ 8
24804
+ );
24805
+ mockStore.scannedKnowledge[scan.id] = scannedItems;
24806
+ scannedItems.forEach((item) => {
24807
+ knowledgeStore.set(item.id, item);
24808
+ });
24809
+ setTimeout(() => {
24810
+ const scanIndex = mockStore.scans.findIndex((s2) => s2.id === scan.id);
24811
+ if (scanIndex !== -1) {
24812
+ mockStore.scans[scanIndex] = {
24813
+ ...scan,
24814
+ status: "completed",
24815
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
24816
+ };
24817
+ const knowledgeItems = scannedItems.map((item) => ({
24818
+ id: item.id,
24819
+ business_id: item.business_id,
24820
+ title: item.title,
24821
+ content: item.content,
24822
+ created_at: item.created_at,
24823
+ website_scan_id: item.website_scan_id,
24824
+ updated_at: item.updated_at
24825
+ }));
24826
+ knowledgeItems.forEach((item) => {
24827
+ knowledgeStore.set(item.id, item);
24828
+ });
24829
+ }
24830
+ }, 5e3);
24831
+ return HttpResponse.json({
24832
+ success: true,
24833
+ message: "Scan started (Sandbox)",
24834
+ data: scan
24835
+ });
24836
+ }),
24837
+ // Get scan status
24838
+ http.get(`${HOSTNAME}/api/webscans/:scanId`, ({ params }) => {
24839
+ const { scanId } = params;
24840
+ const scan = mockStore.scans.find((s2) => s2.id === scanId);
24841
+ if (!scan) {
24842
+ return HttpResponse.json(
24843
+ {
24844
+ success: false,
24845
+ message: `Scan with ID ${scanId} not found (Sandbox)`
24846
+ },
24847
+ { status: 404 }
24848
+ );
24849
+ }
24850
+ return HttpResponse.json({
24851
+ success: true,
24852
+ message: "Success (Sandbox)",
24853
+ data: scan
24854
+ });
24855
+ }),
24856
+ // Cancel scan
24857
+ http.post(
24858
+ `${HOSTNAME}/api/webscans/:scanId/cancel`,
24859
+ async ({ request, params }) => {
24860
+ const { scanId } = params;
24861
+ const body = await request.json();
24862
+ const scanIndex = mockStore.scans.findIndex((s2) => s2.id === scanId);
24863
+ if (scanIndex === -1) {
24864
+ return HttpResponse.json(
24865
+ {
24866
+ success: false,
24867
+ message: `Scan with ID ${scanId} not found (Sandbox)`
24868
+ },
24869
+ { status: 404 }
24870
+ );
24871
+ }
24872
+ const updatedScan = {
24873
+ ...mockStore.scans[scanIndex],
24874
+ ...body
24875
+ };
24876
+ mockStore.scans[scanIndex] = updatedScan;
24877
+ return HttpResponse.json({
24878
+ success: true,
24879
+ message: "Scan updated (Sandbox)",
24880
+ data: updatedScan
24881
+ });
24882
+ }
24883
+ ),
24884
+ // Get scanned knowledge items
24885
+ http.get(`${HOSTNAME}/api/webscans/:scanId/knowledge`, ({ params }) => {
24886
+ const { scanId } = params;
24887
+ const scannedKnowledgeItems = mockStore.scannedKnowledge[scanId] || [];
24888
+ return HttpResponse.json({
24889
+ success: true,
24890
+ message: "Success (Sandbox)",
24891
+ data: scannedKnowledgeItems
24892
+ });
24893
+ }),
24894
+ // Get test call token
24895
+ http.get(`${HOSTNAME}/api/voice/agents/:agentId/test-call-token`, () => {
24896
+ const token = `test_${Date.now()}_${Math.random().toString(36).substring(7)}`;
24897
+ const expiresAt = new Date(Date.now() + 15 * 60 * 1e3).toISOString();
24898
+ return HttpResponse.json({
24899
+ success: true,
24900
+ message: "Success (Sandbox)",
24901
+ data: {
24902
+ token,
24903
+ expiresAt
24904
+ }
24905
+ });
24906
+ }),
24907
+ // Initiate test call
24908
+ http.post(
24909
+ `${HOSTNAME}/api/voice/agents/:agentId/test-calls`,
24910
+ async ({ params, request }) => {
24911
+ const agentId = params.agentId;
24912
+ const body = await request.json();
24913
+ const testCall = {
24914
+ id: `test-call-${Date.now()}`,
24915
+ agentId,
24916
+ token: body.token,
24917
+ status: "connecting",
24918
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
24919
+ };
24920
+ mockStore.testCalls.push(testCall);
24921
+ setTimeout(() => {
24922
+ const callIndex = mockStore.testCalls.findIndex(
24923
+ (c2) => c2.id === testCall.id
24924
+ );
24925
+ if (callIndex !== -1) {
24926
+ mockStore.testCalls[callIndex].status = "connected";
24927
+ }
24928
+ }, 2e3);
24929
+ return HttpResponse.json({
24930
+ success: true,
24931
+ message: "Test call initiated (Sandbox)",
24932
+ data: testCall
24933
+ });
24934
+ }
24935
+ ),
24936
+ // End test call
24937
+ http.post(
24938
+ `${HOSTNAME}/api/voice/agents/:agentId/test-calls/:callId/end`,
24939
+ ({ params }) => {
24940
+ const { callId } = params;
24941
+ const callIndex = mockStore.testCalls.findIndex((c2) => c2.id === callId);
24942
+ if (callIndex === -1) {
24943
+ return HttpResponse.json(
24944
+ {
24945
+ success: false,
24946
+ message: `Test call with ID ${callId} not found (Sandbox)`
24947
+ },
24948
+ { status: 404 }
24949
+ );
24950
+ }
24951
+ const call = mockStore.testCalls[callIndex];
24952
+ call.status = "ended";
24953
+ call.endedAt = (/* @__PURE__ */ new Date()).toISOString();
24954
+ call.duration = Math.floor(
24955
+ (Date.now() - new Date(call.createdAt).getTime()) / 1e3
24956
+ );
24957
+ return HttpResponse.json({
24958
+ success: true,
24959
+ message: "Test call ended (Sandbox)",
24960
+ data: call
24961
+ });
24962
+ }
24963
+ ),
24964
+ // Get test call status
24965
+ http.get(
24966
+ `${HOSTNAME}/api/voice/agents/:agentId/test-calls/:callId`,
24967
+ ({ params }) => {
24968
+ const { callId } = params;
24969
+ const call = mockStore.testCalls.find((c2) => c2.id === callId);
24970
+ if (!call) {
24971
+ return HttpResponse.json(
24972
+ {
24973
+ success: false,
24974
+ message: `Test call with ID ${callId} not found (Sandbox)`
24975
+ },
24976
+ { status: 404 }
24977
+ );
24978
+ }
24979
+ return HttpResponse.json({
24980
+ success: true,
24981
+ message: "Success (Sandbox)",
24982
+ data: call
24983
+ });
24984
+ }
24985
+ ),
24986
+ // Get phone numbers for an agent
24987
+ http.get(
24988
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers`,
24989
+ ({ params }) => {
24990
+ const { agentId } = params;
24991
+ const phoneNumbers = mockStore.phoneNumbers.filter(
24992
+ (pn) => pn.agentId === agentId
24993
+ );
24994
+ return HttpResponse.json({
24995
+ success: true,
24996
+ message: "Success (Sandbox)",
24997
+ data: {
24998
+ results: phoneNumbers,
24999
+ pagination: {
25000
+ hasNextPage: false,
25001
+ cursor: null
25002
+ }
25003
+ }
25004
+ });
25005
+ }
25006
+ ),
25007
+ // Create phone number for an agent
25008
+ http.post(
25009
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers`,
25010
+ ({ params }) => {
25011
+ const { agentId } = params;
25012
+ const phoneNumber = createPhoneNumberFactory(agentId);
25013
+ mockStore.phoneNumbers.push(phoneNumber);
25014
+ return HttpResponse.json({
25015
+ success: true,
25016
+ message: "Phone number created (Sandbox)",
25017
+ data: phoneNumber
25018
+ });
25019
+ }
25020
+ ),
25021
+ // Update phone number
25022
+ http.put(
25023
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId`,
25024
+ async ({ params, request }) => {
25025
+ const { agentId, phoneNumberId } = params;
25026
+ const body = await request.json();
25027
+ const phoneNumberIndex = mockStore.phoneNumbers.findIndex(
25028
+ (pn) => pn.id === phoneNumberId && pn.agentId === agentId
25029
+ );
25030
+ if (phoneNumberIndex === -1) {
25031
+ return HttpResponse.json(
25032
+ { success: false, message: "Phone number not found" },
25033
+ { status: 404 }
25034
+ );
25035
+ }
25036
+ const updatedPhoneNumber = {
25037
+ ...mockStore.phoneNumbers[phoneNumberIndex],
25038
+ ...body,
25039
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
25040
+ };
25041
+ mockStore.phoneNumbers[phoneNumberIndex] = updatedPhoneNumber;
25042
+ return HttpResponse.json({
25043
+ success: true,
25044
+ message: "Phone number updated (Sandbox)",
25045
+ data: updatedPhoneNumber
25046
+ });
25047
+ }
25048
+ ),
25049
+ // Start forwarding test
25050
+ http.post(
25051
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests`,
25052
+ async ({ params }) => {
25053
+ const agentId = params.agentId;
25054
+ const phoneNumberId = params.phoneNumberId;
25055
+ const test = {
25056
+ id: `forwarding-test-${Date.now()}`,
25057
+ agentId,
25058
+ phoneNumberId,
25059
+ status: "in-progress",
25060
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
25061
+ };
25062
+ mockStore.forwardingTests.push(test);
25063
+ setTimeout(() => {
25064
+ const testIndex = mockStore.forwardingTests.findIndex(
25065
+ (t2) => t2.id === test.id
25066
+ );
25067
+ if (testIndex !== -1 && mockStore.forwardingTests[testIndex].status === "in-progress") {
25068
+ mockStore.forwardingTests[testIndex] = {
25069
+ ...mockStore.forwardingTests[testIndex],
25070
+ status: "success",
25071
+ message: "Call was successfully forwarded to your number",
25072
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
25073
+ };
25074
+ }
25075
+ }, 15e3);
25076
+ return HttpResponse.json({
25077
+ success: true,
25078
+ message: "Forwarding test started (Sandbox)",
25079
+ data: test
25080
+ });
25081
+ }
25082
+ ),
25083
+ // Get forwarding test status
25084
+ http.get(
25085
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId`,
25086
+ ({ params }) => {
25087
+ const { testId } = params;
25088
+ const test = mockStore.forwardingTests.find((t2) => t2.id === testId);
25089
+ if (!test) {
25090
+ return HttpResponse.json(
25091
+ {
25092
+ success: false,
25093
+ message: `Forwarding test with ID ${testId} not found (Sandbox)`
25094
+ },
25095
+ { status: 404 }
25096
+ );
25097
+ }
25098
+ return HttpResponse.json({
25099
+ success: true,
25100
+ message: "Success (Sandbox)",
25101
+ data: test
25102
+ });
25103
+ }
25104
+ ),
25105
+ // Cancel forwarding test
25106
+ http.post(
25107
+ `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId/cancel`,
25108
+ ({ params }) => {
25109
+ const { testId } = params;
25110
+ const testIndex = mockStore.forwardingTests.findIndex(
25111
+ (t2) => t2.id === testId
25112
+ );
25113
+ if (testIndex === -1) {
25114
+ return HttpResponse.json(
25115
+ {
25116
+ success: false,
25117
+ message: `Forwarding test with ID ${testId} not found (Sandbox)`
25118
+ },
25119
+ { status: 404 }
25120
+ );
25121
+ }
25122
+ const test = mockStore.forwardingTests[testIndex];
25123
+ test.status = "cancelled";
25124
+ test.completedAt = (/* @__PURE__ */ new Date()).toISOString();
25125
+ return HttpResponse.json({
25126
+ success: true,
25127
+ message: "Forwarding test cancelled (Sandbox)",
25128
+ data: test
25129
+ });
25130
+ }
25131
+ ),
25132
+ // Get calls for an agent
25133
+ http.get(
25134
+ `${HOSTNAME}/api/voice/agents/:agentId/calls`,
25135
+ ({ params, request }) => {
25136
+ const agentId = params.agentId;
25137
+ const url = new URL(request.url);
25138
+ const cursor = url.searchParams.get("cursor");
25139
+ const limitParam = url.searchParams.get("limit");
25140
+ const limit = limitParam ? parseInt(limitParam, 10) : void 0;
25141
+ const agentCalls = mockStore.calls.filter((c2) => c2.agentId === agentId);
25142
+ agentCalls.sort(
25143
+ (a2, b2) => new Date(b2.createdAt).getTime() - new Date(a2.createdAt).getTime()
25144
+ );
25145
+ const startIndex = cursor ? parseInt(cursor, 10) : 0;
25146
+ const endIndex = limit ? Math.min(startIndex + limit, agentCalls.length) : agentCalls.length;
25147
+ const paginatedCalls = agentCalls.slice(startIndex, endIndex);
25148
+ const hasNextPage = endIndex < agentCalls.length;
25149
+ const nextCursor = hasNextPage ? endIndex.toString() : void 0;
25150
+ return HttpResponse.json({
25151
+ success: true,
25152
+ message: "Success (Sandbox)",
25153
+ data: {
25154
+ results: paginatedCalls,
25155
+ pagination: {
25156
+ hasNextPage,
25157
+ cursor: nextCursor
25158
+ }
25159
+ }
25160
+ });
25161
+ }
25162
+ )
25163
+ ];
24330
25164
  const getHandlersByFeatures = (features) => {
24331
25165
  const allHandlers = [];
24332
25166
  if (features.includes("all")) {
24333
- return [...measureAndAcquireHandlers, ...reputationHandlers];
25167
+ return [
25168
+ ...measureAndAcquireHandlers,
25169
+ ...reputationHandlers,
25170
+ ...voiceHandlers
25171
+ ];
24334
25172
  }
24335
25173
  if (features.includes("measure") || features.includes("acquire")) {
24336
25174
  allHandlers.push(...measureAndAcquireHandlers);
@@ -24338,6 +25176,9 @@ const getHandlersByFeatures = (features) => {
24338
25176
  if (features.includes("reputation")) {
24339
25177
  allHandlers.push(...reputationHandlers);
24340
25178
  }
25179
+ if (features.includes("voice")) {
25180
+ allHandlers.push(...voiceHandlers);
25181
+ }
24341
25182
  return allHandlers;
24342
25183
  };
24343
25184
  getHandlersByFeatures(["all"]);