@embedreach/components 0.3.33 → 0.3.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/index.js +13701 -12000
- package/dist/chunks/sandbox-loading-screen.js +908 -234
- package/dist/index.d.ts +2 -2
- package/dist/index.umd.js +12 -12
- package/dist/styles.css +2 -2
- package/package.json +1 -1
|
@@ -18681,7 +18681,56 @@ class HttpResponse extends FetchResponse$1 {
|
|
|
18681
18681
|
return new HttpResponse(body, normalizeResponseInit(init));
|
|
18682
18682
|
}
|
|
18683
18683
|
}
|
|
18684
|
+
function bypass(input, init) {
|
|
18685
|
+
const request = new Request(
|
|
18686
|
+
// If given a Request instance, clone it not to exhaust
|
|
18687
|
+
// the original request's body.
|
|
18688
|
+
input instanceof Request ? input.clone() : input,
|
|
18689
|
+
init
|
|
18690
|
+
);
|
|
18691
|
+
invariant$1(
|
|
18692
|
+
!request.bodyUsed,
|
|
18693
|
+
'Failed to create a bypassed request to "%s %s": given request instance already has its body read. Make sure to clone the intercepted request if you wish to read its body before bypassing it.',
|
|
18694
|
+
request.method,
|
|
18695
|
+
request.url
|
|
18696
|
+
);
|
|
18697
|
+
const requestClone = request.clone();
|
|
18698
|
+
requestClone.headers.append("accept", "msw/passthrough");
|
|
18699
|
+
return requestClone;
|
|
18700
|
+
}
|
|
18684
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
|
+
}
|
|
18685
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" }];
|
|
18686
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" }];
|
|
18687
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" }];
|
|
@@ -20831,8 +20880,6 @@ const createReputationConfigFactory = (platformConfig, businessId, partnerLocati
|
|
|
20831
20880
|
return {
|
|
20832
20881
|
id: f.string.uuid(),
|
|
20833
20882
|
businessId,
|
|
20834
|
-
locationMappings,
|
|
20835
|
-
// Backend provides this by reading from partner locations
|
|
20836
20883
|
emailChannelSenderId: null,
|
|
20837
20884
|
// Will be set when user configures
|
|
20838
20885
|
smsChannelSenderId: null,
|
|
@@ -21431,7 +21478,11 @@ const createWebPresenceContentFactory = (platformConfig, businessConfig) => {
|
|
|
21431
21478
|
const createSandboxMeasureAndAcquireData = (platformId, businessId) => {
|
|
21432
21479
|
const platformConfigKey = getPlatformConfigKey(platformId);
|
|
21433
21480
|
const platformConfig = {
|
|
21434
|
-
id: platformConfigKey
|
|
21481
|
+
id: platformConfigKey,
|
|
21482
|
+
name: platformConfigKey === "goose" ? "Paws Pet Hotel" : platformConfigKey === "renterra" ? "Tomers Rentals" : "Default",
|
|
21483
|
+
brandColors: [],
|
|
21484
|
+
locationNames: [],
|
|
21485
|
+
locationAreas: []
|
|
21435
21486
|
};
|
|
21436
21487
|
const businessConfig = getBusinessConfig(platformId);
|
|
21437
21488
|
const businessesMe = createBusinessDataFactory(
|
|
@@ -21675,38 +21726,6 @@ function parseDateRange(startDateString, endDateString, defaultDays = 30) {
|
|
|
21675
21726
|
endDate
|
|
21676
21727
|
};
|
|
21677
21728
|
}
|
|
21678
|
-
let getRandomValues;
|
|
21679
|
-
const rnds8 = new Uint8Array(16);
|
|
21680
|
-
function rng() {
|
|
21681
|
-
if (!getRandomValues) {
|
|
21682
|
-
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
21683
|
-
if (!getRandomValues) {
|
|
21684
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
21685
|
-
}
|
|
21686
|
-
}
|
|
21687
|
-
return getRandomValues(rnds8);
|
|
21688
|
-
}
|
|
21689
|
-
const byteToHex = [];
|
|
21690
|
-
for (let i2 = 0; i2 < 256; ++i2) {
|
|
21691
|
-
byteToHex.push((i2 + 256).toString(16).slice(1));
|
|
21692
|
-
}
|
|
21693
|
-
function unsafeStringify(arr, offset = 0) {
|
|
21694
|
-
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]];
|
|
21695
|
-
}
|
|
21696
|
-
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
21697
|
-
const native = {
|
|
21698
|
-
randomUUID
|
|
21699
|
-
};
|
|
21700
|
-
function v4(options, buf, offset) {
|
|
21701
|
-
if (native.randomUUID && true && !options) {
|
|
21702
|
-
return native.randomUUID();
|
|
21703
|
-
}
|
|
21704
|
-
options = options || {};
|
|
21705
|
-
const rnds = options.random || (options.rng || rng)();
|
|
21706
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
21707
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
21708
|
-
return unsafeStringify(rnds);
|
|
21709
|
-
}
|
|
21710
21729
|
function scaleChannelMetrics(channelMetrics, options) {
|
|
21711
21730
|
const {
|
|
21712
21731
|
requestedDays,
|
|
@@ -22083,12 +22102,16 @@ const setMSWSandboxPlatformId = (platformId) => {
|
|
|
22083
22102
|
);
|
|
22084
22103
|
};
|
|
22085
22104
|
const measureAndAcquireHandlers = [
|
|
22086
|
-
http.get(`${HOSTNAME}/api/businesses/me`, () => {
|
|
22087
|
-
const
|
|
22105
|
+
http.get(`${HOSTNAME}/api/businesses/me`, async ({ request }) => {
|
|
22106
|
+
const response = await fetch(bypass(request));
|
|
22107
|
+
const originalData = await response.json();
|
|
22088
22108
|
return HttpResponse.json({
|
|
22089
|
-
|
|
22090
|
-
|
|
22091
|
-
|
|
22109
|
+
...originalData,
|
|
22110
|
+
data: {
|
|
22111
|
+
...originalData.data,
|
|
22112
|
+
data_integration_completed_at: "2025-05-01T00:00:00.000Z",
|
|
22113
|
+
website_tracking_completed_at: "2025-05-01T00:00:00.000Z"
|
|
22114
|
+
}
|
|
22092
22115
|
});
|
|
22093
22116
|
}),
|
|
22094
22117
|
http.get(`${HOSTNAME}/api/ad-accounts`, () => {
|
|
@@ -22643,22 +22666,28 @@ function createGoogleReview(platformConfig, partnerLocations, startDate, endDate
|
|
|
22643
22666
|
]);
|
|
22644
22667
|
const reviewContent = generateReviewContent(platformConfig, rating);
|
|
22645
22668
|
const location2 = partnerLocations.length > 0 ? f.helpers.arrayElement(partnerLocations) : null;
|
|
22669
|
+
const createdAtDate = f.date.between({ from: startDate, to: endDate });
|
|
22646
22670
|
const hasReply = f.helpers.weightedArrayElement([
|
|
22647
22671
|
{ weight: 30, value: true },
|
|
22648
22672
|
// 30% have business replies
|
|
22649
22673
|
{ weight: 70, value: false }
|
|
22650
22674
|
]);
|
|
22651
|
-
const replyData = hasReply ? {
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22675
|
+
const replyData = hasReply ? (() => {
|
|
22676
|
+
const oneDayMs = 24 * 60 * 60 * 1e3;
|
|
22677
|
+
const replyWindowStartMs = Math.min(
|
|
22678
|
+
createdAtDate.getTime() + oneDayMs,
|
|
22679
|
+
endDate.getTime()
|
|
22680
|
+
);
|
|
22681
|
+
const reply_updated_at = replyWindowStartMs === endDate.getTime() ? new Date(replyWindowStartMs).toISOString() : f.date.between({
|
|
22682
|
+
from: new Date(replyWindowStartMs),
|
|
22659
22683
|
to: endDate
|
|
22660
|
-
}).toISOString()
|
|
22661
|
-
|
|
22684
|
+
}).toISOString();
|
|
22685
|
+
return {
|
|
22686
|
+
source: "google_business_profile",
|
|
22687
|
+
reply_comment: generateReplyContent(platformConfig, rating),
|
|
22688
|
+
reply_updated_at
|
|
22689
|
+
};
|
|
22690
|
+
})() : void 0;
|
|
22662
22691
|
const isLinked = f.helpers.weightedArrayElement([
|
|
22663
22692
|
{ weight: 30, value: true },
|
|
22664
22693
|
// 30% are linked
|
|
@@ -22674,14 +22703,15 @@ function createGoogleReview(platformConfig, partnerLocations, startDate, endDate
|
|
|
22674
22703
|
userName,
|
|
22675
22704
|
// userEmail: faker.internet.email(), // In real Google reviews, email might not be available
|
|
22676
22705
|
content: reviewContent,
|
|
22677
|
-
createdAt:
|
|
22706
|
+
createdAt: createdAtDate.toISOString(),
|
|
22678
22707
|
hasReply,
|
|
22679
22708
|
isResponded: false,
|
|
22680
22709
|
// Not applicable for Google reviews
|
|
22681
|
-
locationId: location2?.
|
|
22710
|
+
locationId: location2?.id || void 0,
|
|
22682
22711
|
...replyData ? { replies: replyData } : {},
|
|
22683
22712
|
partnerUserId: isLinked ? f.string.uuid() : void 0,
|
|
22684
|
-
reviewExternalId: f.string.alphanumeric(21)
|
|
22713
|
+
reviewExternalId: f.string.alphanumeric(21),
|
|
22714
|
+
reviewerImageUrl: f.image.url()
|
|
22685
22715
|
};
|
|
22686
22716
|
}
|
|
22687
22717
|
function createInternalFeedback(platformConfig, partnerLocations, startDate, endDate) {
|
|
@@ -22725,7 +22755,8 @@ function createInternalFeedback(platformConfig, partnerLocations, startDate, end
|
|
|
22725
22755
|
// 40% have customer responses
|
|
22726
22756
|
{ weight: 60, value: false }
|
|
22727
22757
|
]),
|
|
22728
|
-
locationId: location2?.
|
|
22758
|
+
locationId: location2?.id || void 0,
|
|
22759
|
+
reviewerImageUrl: f.image.url()
|
|
22729
22760
|
};
|
|
22730
22761
|
}
|
|
22731
22762
|
function generateReviewContent(platformConfig, rating) {
|
|
@@ -23292,7 +23323,8 @@ const generateAuditLogData = ({
|
|
|
23292
23323
|
cursor,
|
|
23293
23324
|
limit,
|
|
23294
23325
|
searchTerm,
|
|
23295
|
-
orderBy
|
|
23326
|
+
orderBy,
|
|
23327
|
+
directFeedbackEnabled = true
|
|
23296
23328
|
}) => {
|
|
23297
23329
|
const queryStartDate = startDate ? new Date(startDate) : new Date(Date.now() - 30 * 24 * 60 * 60 * 1e3);
|
|
23298
23330
|
const queryEndDate = endDate ? new Date(endDate) : /* @__PURE__ */ new Date();
|
|
@@ -23307,7 +23339,8 @@ const generateAuditLogData = ({
|
|
|
23307
23339
|
const allLogs = generateAuditLogPool(
|
|
23308
23340
|
queryStartDate,
|
|
23309
23341
|
queryEndDate,
|
|
23310
|
-
scaledLogCount
|
|
23342
|
+
scaledLogCount,
|
|
23343
|
+
directFeedbackEnabled
|
|
23311
23344
|
);
|
|
23312
23345
|
let filteredLogs = allLogs;
|
|
23313
23346
|
if (startDate || endDate) {
|
|
@@ -23346,10 +23379,10 @@ const generateAuditLogData = ({
|
|
|
23346
23379
|
nextCursor
|
|
23347
23380
|
};
|
|
23348
23381
|
};
|
|
23349
|
-
function generateAuditLogPool(startDate, endDate, count) {
|
|
23382
|
+
function generateAuditLogPool(startDate, endDate, count, directFeedbackEnabled) {
|
|
23350
23383
|
const logs = [];
|
|
23351
23384
|
const timeSpan = endDate.getTime() - startDate.getTime();
|
|
23352
|
-
|
|
23385
|
+
let eventSequences = [
|
|
23353
23386
|
// Private Feedback flow
|
|
23354
23387
|
{
|
|
23355
23388
|
type: "SURVEY_REQUEST",
|
|
@@ -23360,7 +23393,8 @@ function generateAuditLogPool(startDate, endDate, count) {
|
|
|
23360
23393
|
"Private feedback request delivered to customer",
|
|
23361
23394
|
"Customer opened private feedback request",
|
|
23362
23395
|
"Private feedback completed by customer"
|
|
23363
|
-
]
|
|
23396
|
+
],
|
|
23397
|
+
isDirectFeedback: true
|
|
23364
23398
|
},
|
|
23365
23399
|
// Google Review flow
|
|
23366
23400
|
{
|
|
@@ -23370,7 +23404,8 @@ function generateAuditLogPool(startDate, endDate, count) {
|
|
|
23370
23404
|
messages: [
|
|
23371
23405
|
"Google review request sent to",
|
|
23372
23406
|
"Google review request delivered to"
|
|
23373
|
-
]
|
|
23407
|
+
],
|
|
23408
|
+
isDirectFeedback: false
|
|
23374
23409
|
},
|
|
23375
23410
|
// Google review flow
|
|
23376
23411
|
{
|
|
@@ -23380,7 +23415,8 @@ function generateAuditLogPool(startDate, endDate, count) {
|
|
|
23380
23415
|
messages: [
|
|
23381
23416
|
"New Google review received from",
|
|
23382
23417
|
"Response sent to Google review from"
|
|
23383
|
-
]
|
|
23418
|
+
],
|
|
23419
|
+
isDirectFeedback: false
|
|
23384
23420
|
},
|
|
23385
23421
|
// Reminder flows
|
|
23386
23422
|
{
|
|
@@ -23390,7 +23426,8 @@ function generateAuditLogPool(startDate, endDate, count) {
|
|
|
23390
23426
|
messages: [
|
|
23391
23427
|
"Private feedback reminder sent to",
|
|
23392
23428
|
"Private feedback reminder delivered to"
|
|
23393
|
-
]
|
|
23429
|
+
],
|
|
23430
|
+
isDirectFeedback: true
|
|
23394
23431
|
},
|
|
23395
23432
|
{
|
|
23396
23433
|
type: "REVIEW_REMINDER",
|
|
@@ -23399,9 +23436,13 @@ function generateAuditLogPool(startDate, endDate, count) {
|
|
|
23399
23436
|
messages: [
|
|
23400
23437
|
"Google review reminder sent to",
|
|
23401
23438
|
"Google review reminder delivered to"
|
|
23402
|
-
]
|
|
23439
|
+
],
|
|
23440
|
+
isDirectFeedback: false
|
|
23403
23441
|
}
|
|
23404
23442
|
];
|
|
23443
|
+
if (!directFeedbackEnabled) {
|
|
23444
|
+
eventSequences = eventSequences.filter((seq) => !seq.isDirectFeedback);
|
|
23445
|
+
}
|
|
23405
23446
|
for (let i2 = 0; i2 < count; i2++) {
|
|
23406
23447
|
const sequence = f.helpers.arrayElement(eventSequences);
|
|
23407
23448
|
const statusIndex = f.number.int({
|
|
@@ -23750,7 +23791,7 @@ function calculateNPSBreakdown(totalResponses, targetNPS) {
|
|
|
23750
23791
|
passiveCount
|
|
23751
23792
|
};
|
|
23752
23793
|
}
|
|
23753
|
-
const mockStore = {
|
|
23794
|
+
const mockStore$1 = {
|
|
23754
23795
|
reputationConfig: null,
|
|
23755
23796
|
partnerLocations: null
|
|
23756
23797
|
};
|
|
@@ -23767,7 +23808,7 @@ const reputationHandlers = [
|
|
|
23767
23808
|
// Partner Locations
|
|
23768
23809
|
http.get(`${HOSTNAME}/api/partner-locations`, () => {
|
|
23769
23810
|
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
23770
|
-
const locations = mockStore.partnerLocations || platformData.reputationData?.partnerLocations || [];
|
|
23811
|
+
const locations = mockStore$1.partnerLocations || platformData.reputationData?.partnerLocations || [];
|
|
23771
23812
|
return HttpResponse.json({
|
|
23772
23813
|
success: true,
|
|
23773
23814
|
message: "Success (Sandbox)",
|
|
@@ -23783,12 +23824,12 @@ const reputationHandlers = [
|
|
|
23783
23824
|
const locationId = params.id;
|
|
23784
23825
|
const body = await request.json();
|
|
23785
23826
|
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
23786
|
-
if (!mockStore.partnerLocations) {
|
|
23787
|
-
mockStore.partnerLocations = [
|
|
23827
|
+
if (!mockStore$1.partnerLocations) {
|
|
23828
|
+
mockStore$1.partnerLocations = [
|
|
23788
23829
|
...platformData.reputationData?.partnerLocations || []
|
|
23789
23830
|
];
|
|
23790
23831
|
}
|
|
23791
|
-
const locationIndex = mockStore.partnerLocations.findIndex(
|
|
23832
|
+
const locationIndex = mockStore$1.partnerLocations.findIndex(
|
|
23792
23833
|
(loc) => loc.externalId === locationId
|
|
23793
23834
|
);
|
|
23794
23835
|
if (locationIndex === -1) {
|
|
@@ -23800,15 +23841,15 @@ const reputationHandlers = [
|
|
|
23800
23841
|
{ status: 404 }
|
|
23801
23842
|
);
|
|
23802
23843
|
}
|
|
23803
|
-
mockStore.partnerLocations[locationIndex] = {
|
|
23804
|
-
...mockStore.partnerLocations[locationIndex],
|
|
23844
|
+
mockStore$1.partnerLocations[locationIndex] = {
|
|
23845
|
+
...mockStore$1.partnerLocations[locationIndex],
|
|
23805
23846
|
googleBusinessProfilePlaceId: body.googleBusinessProfilePlaceId || null,
|
|
23806
23847
|
updatedAt: /* @__PURE__ */ new Date()
|
|
23807
23848
|
};
|
|
23808
23849
|
return HttpResponse.json({
|
|
23809
23850
|
success: true,
|
|
23810
23851
|
message: "Partner location updated successfully (Sandbox)",
|
|
23811
|
-
data: mockStore.partnerLocations[locationIndex]
|
|
23852
|
+
data: mockStore$1.partnerLocations[locationIndex]
|
|
23812
23853
|
});
|
|
23813
23854
|
}
|
|
23814
23855
|
),
|
|
@@ -23836,8 +23877,8 @@ const reputationHandlers = [
|
|
|
23836
23877
|
}),
|
|
23837
23878
|
// Reputation Config
|
|
23838
23879
|
http.get(`${HOSTNAME}/api/reputation/config`, () => {
|
|
23839
|
-
if (mockStore.reputationConfig) {
|
|
23840
|
-
const currentLocations = mockStore.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
|
|
23880
|
+
if (mockStore$1.reputationConfig) {
|
|
23881
|
+
const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
|
|
23841
23882
|
const locationMappings = {};
|
|
23842
23883
|
currentLocations.forEach((location2) => {
|
|
23843
23884
|
locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
|
|
@@ -23846,7 +23887,7 @@ const reputationHandlers = [
|
|
|
23846
23887
|
success: true,
|
|
23847
23888
|
message: "Success (Sandbox)",
|
|
23848
23889
|
data: {
|
|
23849
|
-
...mockStore.reputationConfig,
|
|
23890
|
+
...mockStore$1.reputationConfig,
|
|
23850
23891
|
locationMappings
|
|
23851
23892
|
// Always return current mappings from partner locations
|
|
23852
23893
|
}
|
|
@@ -23855,7 +23896,7 @@ const reputationHandlers = [
|
|
|
23855
23896
|
}
|
|
23856
23897
|
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
23857
23898
|
const initialConfig = platformData.reputationData?.reputationConfig || null;
|
|
23858
|
-
mockStore.reputationConfig = initialConfig;
|
|
23899
|
+
mockStore$1.reputationConfig = initialConfig;
|
|
23859
23900
|
const response = {
|
|
23860
23901
|
success: true,
|
|
23861
23902
|
message: "Success (Sandbox)",
|
|
@@ -23865,7 +23906,7 @@ const reputationHandlers = [
|
|
|
23865
23906
|
}),
|
|
23866
23907
|
http.post(`${HOSTNAME}/api/reputation/config`, async ({ request }) => {
|
|
23867
23908
|
const body = await request.json();
|
|
23868
|
-
const currentConfig = mockStore.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
|
|
23909
|
+
const currentConfig = mockStore$1.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
|
|
23869
23910
|
if (currentConfig) {
|
|
23870
23911
|
const updatedConfig = {
|
|
23871
23912
|
...currentConfig,
|
|
@@ -23876,9 +23917,9 @@ const reputationHandlers = [
|
|
|
23876
23917
|
completedOnboardingAt: body.completedOnboardingAt || currentConfig.completedOnboardingAt,
|
|
23877
23918
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
23878
23919
|
};
|
|
23879
|
-
mockStore.reputationConfig = updatedConfig;
|
|
23920
|
+
mockStore$1.reputationConfig = updatedConfig;
|
|
23880
23921
|
}
|
|
23881
|
-
const currentLocations = mockStore.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
|
|
23922
|
+
const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
|
|
23882
23923
|
const locationMappings = {};
|
|
23883
23924
|
currentLocations.forEach((location2) => {
|
|
23884
23925
|
locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
|
|
@@ -23887,7 +23928,7 @@ const reputationHandlers = [
|
|
|
23887
23928
|
success: true,
|
|
23888
23929
|
message: "Configuration updated successfully (Sandbox)",
|
|
23889
23930
|
data: {
|
|
23890
|
-
...mockStore.reputationConfig,
|
|
23931
|
+
...mockStore$1.reputationConfig,
|
|
23891
23932
|
locationMappings
|
|
23892
23933
|
// Include current mappings from partner locations
|
|
23893
23934
|
}
|
|
@@ -23990,27 +24031,8 @@ const reputationHandlers = [
|
|
|
23990
24031
|
data: platformData.reputationData?.gbpConnection || null
|
|
23991
24032
|
});
|
|
23992
24033
|
}),
|
|
23993
|
-
// Business Branding Update (used in preview step)
|
|
23994
|
-
http.put(`${HOSTNAME}/api/businesses/me`, async ({ request }) => {
|
|
23995
|
-
const body = await request.json();
|
|
23996
|
-
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
23997
|
-
const existingBusiness = platformData.businessesMe;
|
|
23998
|
-
const updatedBranding = {
|
|
23999
|
-
...existingBusiness?.branding,
|
|
24000
|
-
...body?.branding
|
|
24001
|
-
};
|
|
24002
|
-
return HttpResponse.json({
|
|
24003
|
-
success: true,
|
|
24004
|
-
message: "Branding updated successfully (Sandbox)",
|
|
24005
|
-
data: {
|
|
24006
|
-
...existingBusiness,
|
|
24007
|
-
name: body?.name || existingBusiness?.name || "Updated Brand",
|
|
24008
|
-
branding: updatedBranding
|
|
24009
|
-
}
|
|
24010
|
-
});
|
|
24011
|
-
}),
|
|
24012
24034
|
// Reputation Responses (unified reviews and internal feedback)
|
|
24013
|
-
http.get(`${HOSTNAME}/api/reputation/responses`, ({ request }) => {
|
|
24035
|
+
http.get(`${HOSTNAME}/api/reputation/responses`, async ({ request }) => {
|
|
24014
24036
|
const url = new URL(request.url);
|
|
24015
24037
|
const startDate = url.searchParams.get("start_date");
|
|
24016
24038
|
const endDate = url.searchParams.get("end_date");
|
|
@@ -24019,6 +24041,21 @@ const reputationHandlers = [
|
|
|
24019
24041
|
const limit = parseInt(url.searchParams.get("limit") || "25", 10);
|
|
24020
24042
|
const searchTerm = url.searchParams.get("search_term");
|
|
24021
24043
|
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
24044
|
+
let directFeedbackEnabled = false;
|
|
24045
|
+
try {
|
|
24046
|
+
const partnerResponse = await fetch(`${HOSTNAME}/api/partners/me`, {
|
|
24047
|
+
headers: request.headers
|
|
24048
|
+
});
|
|
24049
|
+
if (partnerResponse.ok) {
|
|
24050
|
+
const partnerData = await partnerResponse.json();
|
|
24051
|
+
directFeedbackEnabled = partnerData?.data?.feature_customizations?.reputation?.directFeedbackEnabled ?? false;
|
|
24052
|
+
}
|
|
24053
|
+
} catch (error2) {
|
|
24054
|
+
console.warn(
|
|
24055
|
+
"Failed to fetch partner data in MSW handler, using default directFeedbackEnabled=true",
|
|
24056
|
+
error2
|
|
24057
|
+
);
|
|
24058
|
+
}
|
|
24022
24059
|
const responsesData = generateReputationResponsesData({
|
|
24023
24060
|
platformData,
|
|
24024
24061
|
startDate,
|
|
@@ -24028,6 +24065,12 @@ const reputationHandlers = [
|
|
|
24028
24065
|
limit,
|
|
24029
24066
|
searchTerm
|
|
24030
24067
|
});
|
|
24068
|
+
if (!directFeedbackEnabled) {
|
|
24069
|
+
responsesData.data = responsesData.data.filter(
|
|
24070
|
+
(response) => response.source !== "internal"
|
|
24071
|
+
);
|
|
24072
|
+
responsesData.total = responsesData.data.length;
|
|
24073
|
+
}
|
|
24031
24074
|
return HttpResponse.json({
|
|
24032
24075
|
success: true,
|
|
24033
24076
|
message: "Success (Sandbox)",
|
|
@@ -24042,6 +24085,7 @@ const reputationHandlers = [
|
|
|
24042
24085
|
const locationIds = url.searchParams.get("location_ids");
|
|
24043
24086
|
const platformData = getSandboxDataForPlatform(currentSandboxPlatformId);
|
|
24044
24087
|
const queryParams = {
|
|
24088
|
+
platform: "google_business_profile",
|
|
24045
24089
|
start_date: startDate || void 0,
|
|
24046
24090
|
end_date: endDate || void 0,
|
|
24047
24091
|
location_ids: locationIds ? locationIds.split(",").filter(Boolean) : void 0
|
|
@@ -24140,7 +24184,7 @@ const reputationHandlers = [
|
|
|
24140
24184
|
});
|
|
24141
24185
|
}),
|
|
24142
24186
|
// Reputation Audit Logs
|
|
24143
|
-
http.get(`${HOSTNAME}/api/reputation/audit-logs`, ({ request }) => {
|
|
24187
|
+
http.get(`${HOSTNAME}/api/reputation/audit-logs`, async ({ request }) => {
|
|
24144
24188
|
const url = new URL(request.url);
|
|
24145
24189
|
const startDate = url.searchParams.get("start_date");
|
|
24146
24190
|
const endDate = url.searchParams.get("end_date");
|
|
@@ -24149,6 +24193,21 @@ const reputationHandlers = [
|
|
|
24149
24193
|
const limit = parseInt(url.searchParams.get("limit") || "25", 10);
|
|
24150
24194
|
const searchTerm = url.searchParams.get("search_term");
|
|
24151
24195
|
const orderBy = url.searchParams.get("order_by") || "timestamp";
|
|
24196
|
+
let directFeedbackEnabled = false;
|
|
24197
|
+
try {
|
|
24198
|
+
const partnerResponse = await fetch(`${HOSTNAME}/api/partners/me`, {
|
|
24199
|
+
headers: request.headers
|
|
24200
|
+
});
|
|
24201
|
+
if (partnerResponse.ok) {
|
|
24202
|
+
const partnerData = await partnerResponse.json();
|
|
24203
|
+
directFeedbackEnabled = partnerData?.data?.feature_customizations?.reputation?.directFeedbackEnabled ?? false;
|
|
24204
|
+
}
|
|
24205
|
+
} catch (error2) {
|
|
24206
|
+
console.warn(
|
|
24207
|
+
"Failed to fetch partner data in MSW handler, using default directFeedbackEnabled=true",
|
|
24208
|
+
error2
|
|
24209
|
+
);
|
|
24210
|
+
}
|
|
24152
24211
|
const auditLogResponse = generateAuditLogData({
|
|
24153
24212
|
startDate,
|
|
24154
24213
|
endDate,
|
|
@@ -24156,7 +24215,8 @@ const reputationHandlers = [
|
|
|
24156
24215
|
cursor,
|
|
24157
24216
|
limit,
|
|
24158
24217
|
searchTerm,
|
|
24159
|
-
orderBy
|
|
24218
|
+
orderBy,
|
|
24219
|
+
directFeedbackEnabled
|
|
24160
24220
|
});
|
|
24161
24221
|
return HttpResponse.json({
|
|
24162
24222
|
success: true,
|
|
@@ -24203,164 +24263,775 @@ const reputationHandlers = [
|
|
|
24203
24263
|
}
|
|
24204
24264
|
});
|
|
24205
24265
|
}),
|
|
24206
|
-
//
|
|
24207
|
-
http.
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
24211
|
-
|
|
24212
|
-
|
|
24213
|
-
|
|
24214
|
-
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
|
|
24229
|
-
|
|
24230
|
-
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
|
|
24237
|
-
|
|
24238
|
-
|
|
24239
|
-
|
|
24240
|
-
|
|
24241
|
-
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
|
|
24255
|
-
|
|
24256
|
-
|
|
24257
|
-
|
|
24258
|
-
|
|
24259
|
-
|
|
24260
|
-
|
|
24261
|
-
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24266
|
+
// Activate Automations
|
|
24267
|
+
http.post(`${HOSTNAME}/api/reputation/activate-automations`, () => {
|
|
24268
|
+
return HttpResponse.json({
|
|
24269
|
+
success: true,
|
|
24270
|
+
message: "Success (Sandbox)",
|
|
24271
|
+
data: {}
|
|
24272
|
+
});
|
|
24273
|
+
}),
|
|
24274
|
+
// Generate Review Response
|
|
24275
|
+
http.post(`${HOSTNAME}/api/reputation/reviews/generate-response`, () => {
|
|
24276
|
+
return HttpResponse.json({
|
|
24277
|
+
success: true,
|
|
24278
|
+
message: "Success (Sandbox)",
|
|
24279
|
+
data: {
|
|
24280
|
+
response: "This is a test response"
|
|
24281
|
+
}
|
|
24282
|
+
});
|
|
24283
|
+
}),
|
|
24284
|
+
// Post Review Reply - prevent actual replies in sandbox
|
|
24285
|
+
http.post(`${HOSTNAME}/api/reputation/reviews/reply`, () => {
|
|
24286
|
+
return HttpResponse.json({
|
|
24287
|
+
success: true,
|
|
24288
|
+
message: "Reply intercepted (Sandbox)",
|
|
24289
|
+
data: { success: true }
|
|
24290
|
+
});
|
|
24291
|
+
}),
|
|
24292
|
+
// Sync Google Reviews
|
|
24293
|
+
http.post(`${HOSTNAME}/api/reputation/sync-google-reviews`, () => {
|
|
24294
|
+
return HttpResponse.json({
|
|
24295
|
+
success: true,
|
|
24296
|
+
message: "Success (Sandbox)",
|
|
24297
|
+
data: {}
|
|
24298
|
+
});
|
|
24299
|
+
}),
|
|
24300
|
+
// finalize onboarding
|
|
24301
|
+
http.post(
|
|
24302
|
+
`${HOSTNAME}/api/reputation/finalize-onboarding`,
|
|
24303
|
+
async ({ request }) => {
|
|
24304
|
+
const body = await request.json();
|
|
24305
|
+
const currentConfig = mockStore$1.reputationConfig || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.reputationConfig;
|
|
24306
|
+
const updatedConfig = {
|
|
24307
|
+
...currentConfig || {},
|
|
24308
|
+
id: currentConfig?.id || "mock-reputation-config-id",
|
|
24309
|
+
businessId: currentConfig?.businessId || "mock-business-id",
|
|
24310
|
+
emailChannelSenderId: body.emailChannelSenderId || currentConfig?.emailChannelSenderId || null,
|
|
24311
|
+
smsChannelSenderId: body.smsChannelSenderId || currentConfig?.smsChannelSenderId || null,
|
|
24312
|
+
completedOnboardingAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24313
|
+
createdAt: currentConfig?.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
24314
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24315
|
+
};
|
|
24316
|
+
mockStore$1.reputationConfig = updatedConfig;
|
|
24317
|
+
const currentLocations = mockStore$1.partnerLocations || getSandboxDataForPlatform(currentSandboxPlatformId).reputationData?.partnerLocations || [];
|
|
24318
|
+
const locationMappings = {};
|
|
24319
|
+
currentLocations.forEach((location2) => {
|
|
24320
|
+
locationMappings[location2.externalId] = location2.googleBusinessProfilePlaceId || null;
|
|
24321
|
+
});
|
|
24322
|
+
const response = {
|
|
24323
|
+
success: true,
|
|
24324
|
+
message: "Configuration updated successfully (Sandbox)",
|
|
24325
|
+
data: {
|
|
24326
|
+
...mockStore$1.reputationConfig,
|
|
24327
|
+
locationMappings
|
|
24328
|
+
// Include current mappings from partner locations
|
|
24329
|
+
}
|
|
24330
|
+
};
|
|
24331
|
+
return HttpResponse.json(response);
|
|
24332
|
+
}
|
|
24333
|
+
)
|
|
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
|
+
number: generatedNumber,
|
|
24439
|
+
forwardingEnabled: false,
|
|
24440
|
+
createdAt: f.date.past().toISOString(),
|
|
24441
|
+
updatedAt: f.date.recent().toISOString()
|
|
24442
|
+
};
|
|
24443
|
+
};
|
|
24444
|
+
const createCallFactory = (agentId) => {
|
|
24445
|
+
const createdAt = f.date.recent();
|
|
24446
|
+
const answeredAt = f.date.between({ from: createdAt, to: /* @__PURE__ */ new Date() });
|
|
24447
|
+
const duration = f.number.int({ min: 30, max: 1800 });
|
|
24448
|
+
const endedAt = new Date(answeredAt.getTime() + duration * 1e3);
|
|
24449
|
+
const summaries = [
|
|
24450
|
+
"Customer inquired about business hours and services offered. Provided information about our operating schedule and explained our consultation process.",
|
|
24451
|
+
"Client called to schedule an appointment for next week. Confirmed availability and provided pricing information for the requested service.",
|
|
24452
|
+
"Customer had questions about our delivery options and return policy. Explained shipping costs and our satisfaction guarantee.",
|
|
24453
|
+
"Business inquiry about partnership opportunities. Shared information about our collaboration process and requested more details about their needs.",
|
|
24454
|
+
"Customer needed assistance with an existing order. Located their order details and provided status update with estimated delivery time.",
|
|
24455
|
+
"Prospective client called for pricing information. Provided detailed quote and explained our service packages and payment options.",
|
|
24456
|
+
"Customer reported a positive experience with our previous service and wanted to schedule a follow-up appointment.",
|
|
24457
|
+
"Inquiry about location and parking availability. Provided address details and information about nearby parking options."
|
|
24458
|
+
];
|
|
24459
|
+
return {
|
|
24460
|
+
id: f.string.uuid(),
|
|
24461
|
+
agentId,
|
|
24462
|
+
fromNumber: generatePlainPhoneNumber(),
|
|
24463
|
+
duration,
|
|
24464
|
+
location: `${f.location.city()}, ${f.location.state({ abbreviated: true })}`,
|
|
24465
|
+
recordingUrl: f.datatype.boolean({ probability: 0.8 }) ? `https://example.com/recording/${f.string.uuid()}.mp3` : void 0,
|
|
24466
|
+
aiSummary: f.helpers.arrayElement(summaries),
|
|
24467
|
+
status: "completed",
|
|
24468
|
+
createdAt: createdAt.toISOString(),
|
|
24469
|
+
answeredAt: answeredAt.toISOString(),
|
|
24470
|
+
endedAt: endedAt.toISOString()
|
|
24471
|
+
};
|
|
24472
|
+
};
|
|
24473
|
+
const knowledgeStore = /* @__PURE__ */ new Map();
|
|
24474
|
+
const mockStore = {
|
|
24475
|
+
agents: [],
|
|
24476
|
+
knowledgeItems: [],
|
|
24477
|
+
scans: [],
|
|
24478
|
+
scannedKnowledge: {},
|
|
24479
|
+
phoneNumbers: [],
|
|
24480
|
+
testCalls: [],
|
|
24481
|
+
forwardingTests: [],
|
|
24482
|
+
calls: []
|
|
24483
|
+
};
|
|
24484
|
+
const getOrCreateAgent = (businessId) => {
|
|
24485
|
+
let agent = mockStore.agents.find((a2) => a2.businessId === businessId);
|
|
24486
|
+
if (!agent) {
|
|
24487
|
+
agent = createVoiceAgentFactory(businessId);
|
|
24488
|
+
mockStore.agents.push(agent);
|
|
24489
|
+
const phoneNumber = createPhoneNumberFactory(agent.id);
|
|
24490
|
+
mockStore.phoneNumbers.push(phoneNumber);
|
|
24491
|
+
const initialKnowledge = [
|
|
24492
|
+
createKnowledgeFactory(agent.businessId),
|
|
24493
|
+
createKnowledgeFactory(agent.businessId)
|
|
24494
|
+
];
|
|
24495
|
+
mockStore.knowledgeItems.push(...initialKnowledge);
|
|
24496
|
+
initialKnowledge.forEach((item) => {
|
|
24497
|
+
knowledgeStore.set(item.id, item);
|
|
24498
|
+
});
|
|
24499
|
+
const initialCalls = [
|
|
24500
|
+
createCallFactory(agent.id),
|
|
24501
|
+
createCallFactory(agent.id),
|
|
24502
|
+
createCallFactory(agent.id),
|
|
24503
|
+
createCallFactory(agent.id),
|
|
24504
|
+
createCallFactory(agent.id)
|
|
24505
|
+
];
|
|
24506
|
+
mockStore.calls.push(...initialCalls);
|
|
24507
|
+
}
|
|
24508
|
+
return agent;
|
|
24509
|
+
};
|
|
24510
|
+
const voiceHandlers = [
|
|
24511
|
+
// Get voice agents
|
|
24512
|
+
http.get(`${HOSTNAME}/api/voice/agents`, async () => {
|
|
24513
|
+
const agent = getOrCreateAgent("mock-business-id");
|
|
24514
|
+
return HttpResponse.json({
|
|
24515
|
+
success: true,
|
|
24516
|
+
message: "Success (Sandbox)",
|
|
24517
|
+
data: [agent]
|
|
24518
|
+
});
|
|
24519
|
+
}),
|
|
24520
|
+
// Get knowledge items from webscan-knowledge (business-scoped)
|
|
24521
|
+
http.get(`${HOSTNAME}/api/webscan-knowledge`, async () => {
|
|
24522
|
+
return HttpResponse.json({
|
|
24523
|
+
success: true,
|
|
24524
|
+
message: "Success (Sandbox)",
|
|
24525
|
+
data: {
|
|
24526
|
+
items: mockStore.knowledgeItems,
|
|
24527
|
+
total: mockStore.knowledgeItems.length
|
|
24528
|
+
}
|
|
24529
|
+
});
|
|
24530
|
+
}),
|
|
24531
|
+
// Create knowledge item (business-scoped)
|
|
24532
|
+
http.post(`${HOSTNAME}/api/webscan-knowledge`, async ({ request }) => {
|
|
24533
|
+
const body = await request.json();
|
|
24534
|
+
const websiteScanId = body.website_scan_id ?? null;
|
|
24535
|
+
const existingKnowledge = mockStore.knowledgeItems.find(
|
|
24536
|
+
(item) => item.title === body.title && item.content === body.content && item.website_scan_id === websiteScanId
|
|
24537
|
+
);
|
|
24538
|
+
if (existingKnowledge) {
|
|
24539
|
+
knowledgeStore.set(existingKnowledge.id, existingKnowledge);
|
|
24540
|
+
return HttpResponse.json({
|
|
24541
|
+
success: true,
|
|
24542
|
+
message: "Duplicate knowledge skipped (Sandbox)",
|
|
24543
|
+
data: existingKnowledge
|
|
24544
|
+
});
|
|
24545
|
+
}
|
|
24546
|
+
const knowledge = {
|
|
24547
|
+
id: crypto.randomUUID(),
|
|
24548
|
+
website_scan_id: websiteScanId,
|
|
24549
|
+
business_id: "mock-business-id",
|
|
24550
|
+
title: body.title,
|
|
24551
|
+
content: body.content,
|
|
24552
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24553
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
24554
|
+
};
|
|
24555
|
+
mockStore.knowledgeItems.push(knowledge);
|
|
24556
|
+
knowledgeStore.set(knowledge.id, knowledge);
|
|
24557
|
+
if (websiteScanId && mockStore.scannedKnowledge[websiteScanId]) {
|
|
24558
|
+
const existingItems = mockStore.scannedKnowledge[websiteScanId];
|
|
24559
|
+
const existingIds = new Set(existingItems.map((item) => item.id));
|
|
24560
|
+
const contentKey = `${knowledge.title}|${knowledge.content}`;
|
|
24561
|
+
const existingContent = new Set(
|
|
24562
|
+
existingItems.map((item) => `${item.title}|${item.content}`)
|
|
24563
|
+
);
|
|
24564
|
+
if (!existingIds.has(knowledge.id) && !existingContent.has(contentKey)) {
|
|
24565
|
+
const scannedKnowledgeItem = {
|
|
24566
|
+
...knowledge,
|
|
24567
|
+
website_scan_id: websiteScanId
|
|
24568
|
+
};
|
|
24569
|
+
mockStore.scannedKnowledge[websiteScanId].push(scannedKnowledgeItem);
|
|
24570
|
+
}
|
|
24571
|
+
}
|
|
24572
|
+
return HttpResponse.json({
|
|
24573
|
+
success: true,
|
|
24574
|
+
message: "Knowledge item created (Sandbox)",
|
|
24575
|
+
data: knowledge
|
|
24576
|
+
});
|
|
24577
|
+
}),
|
|
24578
|
+
// Update knowledge item (business-scoped)
|
|
24579
|
+
http.put(
|
|
24580
|
+
`${HOSTNAME}/api/webscan-knowledge/:knowledgeId`,
|
|
24581
|
+
async ({ request, params }) => {
|
|
24582
|
+
const knowledgeId = typeof params.knowledgeId === "string" ? params.knowledgeId : Array.isArray(params.knowledgeId) ? params.knowledgeId[0] : "";
|
|
24583
|
+
const body = await request.json();
|
|
24584
|
+
const item = knowledgeStore.get(knowledgeId);
|
|
24585
|
+
if (!item) {
|
|
24586
|
+
return HttpResponse.json(
|
|
24587
|
+
{
|
|
24588
|
+
success: false,
|
|
24589
|
+
message: `Knowledge item with ID ${knowledgeId} not found (Sandbox)`
|
|
24292
24590
|
},
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
|
|
24591
|
+
{ status: 404 }
|
|
24592
|
+
);
|
|
24593
|
+
}
|
|
24594
|
+
const updatedItem = {
|
|
24595
|
+
...item,
|
|
24596
|
+
...body.title !== void 0 ? { title: body.title } : {},
|
|
24597
|
+
...body.content !== void 0 ? { content: body.content } : {},
|
|
24598
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
24599
|
+
};
|
|
24600
|
+
knowledgeStore.set(knowledgeId, updatedItem);
|
|
24601
|
+
const sourceIdx = mockStore.knowledgeItems.findIndex(
|
|
24602
|
+
(k2) => k2.id === knowledgeId
|
|
24603
|
+
);
|
|
24604
|
+
if (sourceIdx !== -1) {
|
|
24605
|
+
mockStore.knowledgeItems[sourceIdx] = {
|
|
24606
|
+
...mockStore.knowledgeItems[sourceIdx],
|
|
24607
|
+
...updatedItem
|
|
24608
|
+
};
|
|
24609
|
+
}
|
|
24610
|
+
for (const scanId in mockStore.scannedKnowledge) {
|
|
24611
|
+
const index = mockStore.scannedKnowledge[scanId].findIndex(
|
|
24612
|
+
(k2) => k2.id === knowledgeId
|
|
24613
|
+
);
|
|
24614
|
+
if (index !== -1) {
|
|
24615
|
+
mockStore.scannedKnowledge[scanId][index] = {
|
|
24616
|
+
...mockStore.scannedKnowledge[scanId][index],
|
|
24617
|
+
...updatedItem
|
|
24618
|
+
};
|
|
24619
|
+
break;
|
|
24302
24620
|
}
|
|
24303
|
-
}
|
|
24304
|
-
{
|
|
24305
|
-
|
|
24306
|
-
|
|
24307
|
-
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
|
|
24314
|
-
|
|
24315
|
-
|
|
24316
|
-
|
|
24317
|
-
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24621
|
+
}
|
|
24622
|
+
return HttpResponse.json({
|
|
24623
|
+
success: true,
|
|
24624
|
+
message: "Knowledge updated (Sandbox)",
|
|
24625
|
+
data: updatedItem
|
|
24626
|
+
});
|
|
24627
|
+
}
|
|
24628
|
+
),
|
|
24629
|
+
// Delete knowledge item (business-scoped)
|
|
24630
|
+
http.delete(
|
|
24631
|
+
`${HOSTNAME}/api/webscan-knowledge/:knowledgeId`,
|
|
24632
|
+
({ params }) => {
|
|
24633
|
+
const knowledgeId = typeof params.knowledgeId === "string" ? params.knowledgeId : Array.isArray(params.knowledgeId) ? params.knowledgeId[0] : "";
|
|
24634
|
+
const item = knowledgeStore.get(knowledgeId);
|
|
24635
|
+
if (!item) {
|
|
24636
|
+
return HttpResponse.json(
|
|
24637
|
+
{
|
|
24638
|
+
success: false,
|
|
24639
|
+
message: `Knowledge item with ID ${knowledgeId} not found (Sandbox)`
|
|
24321
24640
|
},
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24641
|
+
{ status: 404 }
|
|
24642
|
+
);
|
|
24643
|
+
}
|
|
24644
|
+
knowledgeStore.delete(knowledgeId);
|
|
24645
|
+
const knowledgeIndex = mockStore.knowledgeItems.findIndex(
|
|
24646
|
+
(k2) => k2.id === knowledgeId
|
|
24647
|
+
);
|
|
24648
|
+
if (knowledgeIndex !== -1) {
|
|
24649
|
+
mockStore.knowledgeItems.splice(knowledgeIndex, 1);
|
|
24650
|
+
}
|
|
24651
|
+
for (const scanId in mockStore.scannedKnowledge) {
|
|
24652
|
+
const index = mockStore.scannedKnowledge[scanId].findIndex(
|
|
24653
|
+
(k2) => k2.id === knowledgeId
|
|
24654
|
+
);
|
|
24655
|
+
if (index !== -1) {
|
|
24656
|
+
mockStore.scannedKnowledge[scanId].splice(index, 1);
|
|
24657
|
+
break;
|
|
24331
24658
|
}
|
|
24332
24659
|
}
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24660
|
+
return HttpResponse.json({
|
|
24661
|
+
success: true,
|
|
24662
|
+
message: "Knowledge deleted (Sandbox)",
|
|
24663
|
+
data: null
|
|
24664
|
+
});
|
|
24665
|
+
}
|
|
24666
|
+
),
|
|
24667
|
+
// Start website scan
|
|
24668
|
+
http.post(`${HOSTNAME}/api/webscans/`, async ({ request }) => {
|
|
24669
|
+
const body = await request.json();
|
|
24670
|
+
const agent = getOrCreateAgent("mock-business-id");
|
|
24671
|
+
const scan = createWebsiteScanFactory(
|
|
24672
|
+
agent.businessId,
|
|
24673
|
+
body.url,
|
|
24674
|
+
"in-progress"
|
|
24675
|
+
);
|
|
24676
|
+
mockStore.scans.push(scan);
|
|
24677
|
+
const scannedItems = generateScannedKnowledgeItems(
|
|
24678
|
+
agent.businessId,
|
|
24679
|
+
scan.id,
|
|
24680
|
+
8
|
|
24336
24681
|
);
|
|
24682
|
+
mockStore.scannedKnowledge[scan.id] = scannedItems;
|
|
24683
|
+
scannedItems.forEach((item) => {
|
|
24684
|
+
knowledgeStore.set(item.id, item);
|
|
24685
|
+
});
|
|
24686
|
+
setTimeout(() => {
|
|
24687
|
+
const scanIndex = mockStore.scans.findIndex((s2) => s2.id === scan.id);
|
|
24688
|
+
if (scanIndex !== -1) {
|
|
24689
|
+
mockStore.scans[scanIndex] = {
|
|
24690
|
+
...scan,
|
|
24691
|
+
status: "completed",
|
|
24692
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24693
|
+
};
|
|
24694
|
+
const knowledgeItems = scannedItems.map((item) => ({
|
|
24695
|
+
id: item.id,
|
|
24696
|
+
business_id: item.business_id,
|
|
24697
|
+
title: item.title,
|
|
24698
|
+
content: item.content,
|
|
24699
|
+
created_at: item.created_at,
|
|
24700
|
+
website_scan_id: item.website_scan_id,
|
|
24701
|
+
updated_at: item.updated_at
|
|
24702
|
+
}));
|
|
24703
|
+
knowledgeItems.forEach((item) => {
|
|
24704
|
+
knowledgeStore.set(item.id, item);
|
|
24705
|
+
});
|
|
24706
|
+
}
|
|
24707
|
+
}, 5e3);
|
|
24708
|
+
return HttpResponse.json({
|
|
24709
|
+
success: true,
|
|
24710
|
+
message: "Scan started (Sandbox)",
|
|
24711
|
+
data: scan
|
|
24712
|
+
});
|
|
24713
|
+
}),
|
|
24714
|
+
// Get scan status
|
|
24715
|
+
http.get(`${HOSTNAME}/api/webscans/:scanId`, ({ params }) => {
|
|
24716
|
+
const { scanId } = params;
|
|
24717
|
+
const scan = mockStore.scans.find((s2) => s2.id === scanId);
|
|
24718
|
+
if (!scan) {
|
|
24719
|
+
return HttpResponse.json(
|
|
24720
|
+
{
|
|
24721
|
+
success: false,
|
|
24722
|
+
message: `Scan with ID ${scanId} not found (Sandbox)`
|
|
24723
|
+
},
|
|
24724
|
+
{ status: 404 }
|
|
24725
|
+
);
|
|
24726
|
+
}
|
|
24337
24727
|
return HttpResponse.json({
|
|
24338
24728
|
success: true,
|
|
24339
24729
|
message: "Success (Sandbox)",
|
|
24340
|
-
data:
|
|
24730
|
+
data: scan
|
|
24341
24731
|
});
|
|
24342
24732
|
}),
|
|
24343
|
-
//
|
|
24344
|
-
http.post(
|
|
24733
|
+
// Cancel scan
|
|
24734
|
+
http.post(
|
|
24735
|
+
`${HOSTNAME}/api/webscans/:scanId/cancel`,
|
|
24736
|
+
async ({ request, params }) => {
|
|
24737
|
+
const { scanId } = params;
|
|
24738
|
+
const body = await request.json();
|
|
24739
|
+
const scanIndex = mockStore.scans.findIndex((s2) => s2.id === scanId);
|
|
24740
|
+
if (scanIndex === -1) {
|
|
24741
|
+
return HttpResponse.json(
|
|
24742
|
+
{
|
|
24743
|
+
success: false,
|
|
24744
|
+
message: `Scan with ID ${scanId} not found (Sandbox)`
|
|
24745
|
+
},
|
|
24746
|
+
{ status: 404 }
|
|
24747
|
+
);
|
|
24748
|
+
}
|
|
24749
|
+
const updatedScan = {
|
|
24750
|
+
...mockStore.scans[scanIndex],
|
|
24751
|
+
...body
|
|
24752
|
+
};
|
|
24753
|
+
mockStore.scans[scanIndex] = updatedScan;
|
|
24754
|
+
return HttpResponse.json({
|
|
24755
|
+
success: true,
|
|
24756
|
+
message: "Scan updated (Sandbox)",
|
|
24757
|
+
data: updatedScan
|
|
24758
|
+
});
|
|
24759
|
+
}
|
|
24760
|
+
),
|
|
24761
|
+
// Get scanned knowledge items
|
|
24762
|
+
http.get(`${HOSTNAME}/api/webscans/:scanId/knowledge`, ({ params }) => {
|
|
24763
|
+
const { scanId } = params;
|
|
24764
|
+
const scannedKnowledgeItems = mockStore.scannedKnowledge[scanId] || [];
|
|
24345
24765
|
return HttpResponse.json({
|
|
24346
24766
|
success: true,
|
|
24347
24767
|
message: "Success (Sandbox)",
|
|
24348
|
-
data:
|
|
24768
|
+
data: scannedKnowledgeItems
|
|
24349
24769
|
});
|
|
24350
24770
|
}),
|
|
24351
|
-
//
|
|
24352
|
-
http.
|
|
24771
|
+
// Get test call token
|
|
24772
|
+
http.get(`${HOSTNAME}/api/voice/agents/:agentId/test-call-token`, () => {
|
|
24773
|
+
const token = `test_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
24774
|
+
const expiresAt = new Date(Date.now() + 15 * 60 * 1e3).toISOString();
|
|
24353
24775
|
return HttpResponse.json({
|
|
24354
24776
|
success: true,
|
|
24355
24777
|
message: "Success (Sandbox)",
|
|
24356
|
-
data: {
|
|
24778
|
+
data: {
|
|
24779
|
+
token,
|
|
24780
|
+
expiresAt
|
|
24781
|
+
}
|
|
24782
|
+
});
|
|
24783
|
+
}),
|
|
24784
|
+
// Initiate test call
|
|
24785
|
+
http.post(
|
|
24786
|
+
`${HOSTNAME}/api/voice/agents/:agentId/test-calls`,
|
|
24787
|
+
async ({ params, request }) => {
|
|
24788
|
+
const agentId = params.agentId;
|
|
24789
|
+
const body = await request.json();
|
|
24790
|
+
const testCall = {
|
|
24791
|
+
id: `test-call-${Date.now()}`,
|
|
24792
|
+
agentId,
|
|
24793
|
+
token: body.token,
|
|
24794
|
+
status: "connecting",
|
|
24795
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24796
|
+
};
|
|
24797
|
+
mockStore.testCalls.push(testCall);
|
|
24798
|
+
setTimeout(() => {
|
|
24799
|
+
const callIndex = mockStore.testCalls.findIndex(
|
|
24800
|
+
(c2) => c2.id === testCall.id
|
|
24801
|
+
);
|
|
24802
|
+
if (callIndex !== -1) {
|
|
24803
|
+
mockStore.testCalls[callIndex].status = "connected";
|
|
24804
|
+
}
|
|
24805
|
+
}, 2e3);
|
|
24806
|
+
return HttpResponse.json({
|
|
24807
|
+
success: true,
|
|
24808
|
+
message: "Test call initiated (Sandbox)",
|
|
24809
|
+
data: testCall
|
|
24810
|
+
});
|
|
24811
|
+
}
|
|
24812
|
+
),
|
|
24813
|
+
// End test call
|
|
24814
|
+
http.post(
|
|
24815
|
+
`${HOSTNAME}/api/voice/agents/:agentId/test-calls/:callId/end`,
|
|
24816
|
+
({ params }) => {
|
|
24817
|
+
const { callId } = params;
|
|
24818
|
+
const callIndex = mockStore.testCalls.findIndex((c2) => c2.id === callId);
|
|
24819
|
+
if (callIndex === -1) {
|
|
24820
|
+
return HttpResponse.json(
|
|
24821
|
+
{
|
|
24822
|
+
success: false,
|
|
24823
|
+
message: `Test call with ID ${callId} not found (Sandbox)`
|
|
24824
|
+
},
|
|
24825
|
+
{ status: 404 }
|
|
24826
|
+
);
|
|
24827
|
+
}
|
|
24828
|
+
const call = mockStore.testCalls[callIndex];
|
|
24829
|
+
call.status = "ended";
|
|
24830
|
+
call.endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
24831
|
+
call.duration = Math.floor(
|
|
24832
|
+
(Date.now() - new Date(call.createdAt).getTime()) / 1e3
|
|
24833
|
+
);
|
|
24834
|
+
return HttpResponse.json({
|
|
24835
|
+
success: true,
|
|
24836
|
+
message: "Test call ended (Sandbox)",
|
|
24837
|
+
data: call
|
|
24838
|
+
});
|
|
24839
|
+
}
|
|
24840
|
+
),
|
|
24841
|
+
// Get test call status
|
|
24842
|
+
http.get(
|
|
24843
|
+
`${HOSTNAME}/api/voice/agents/:agentId/test-calls/:callId`,
|
|
24844
|
+
({ params }) => {
|
|
24845
|
+
const { callId } = params;
|
|
24846
|
+
const call = mockStore.testCalls.find((c2) => c2.id === callId);
|
|
24847
|
+
if (!call) {
|
|
24848
|
+
return HttpResponse.json(
|
|
24849
|
+
{
|
|
24850
|
+
success: false,
|
|
24851
|
+
message: `Test call with ID ${callId} not found (Sandbox)`
|
|
24852
|
+
},
|
|
24853
|
+
{ status: 404 }
|
|
24854
|
+
);
|
|
24855
|
+
}
|
|
24856
|
+
return HttpResponse.json({
|
|
24857
|
+
success: true,
|
|
24858
|
+
message: "Success (Sandbox)",
|
|
24859
|
+
data: call
|
|
24860
|
+
});
|
|
24861
|
+
}
|
|
24862
|
+
),
|
|
24863
|
+
// Get phone numbers for an agent
|
|
24864
|
+
http.get(
|
|
24865
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers`,
|
|
24866
|
+
({ params }) => {
|
|
24867
|
+
const { agentId } = params;
|
|
24868
|
+
const phoneNumbers = mockStore.phoneNumbers.filter(
|
|
24869
|
+
(pn) => pn.agentId === agentId
|
|
24870
|
+
);
|
|
24871
|
+
return HttpResponse.json({
|
|
24872
|
+
success: true,
|
|
24873
|
+
message: "Success (Sandbox)",
|
|
24874
|
+
data: phoneNumbers
|
|
24875
|
+
});
|
|
24876
|
+
}
|
|
24877
|
+
),
|
|
24878
|
+
// Create phone number for an agent
|
|
24879
|
+
http.post(
|
|
24880
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers`,
|
|
24881
|
+
({ params }) => {
|
|
24882
|
+
const { agentId } = params;
|
|
24883
|
+
const phoneNumber = createPhoneNumberFactory(agentId);
|
|
24884
|
+
mockStore.phoneNumbers.push(phoneNumber);
|
|
24885
|
+
return HttpResponse.json({
|
|
24886
|
+
success: true,
|
|
24887
|
+
message: "Phone number created (Sandbox)",
|
|
24888
|
+
data: phoneNumber
|
|
24889
|
+
});
|
|
24890
|
+
}
|
|
24891
|
+
),
|
|
24892
|
+
// Update phone number
|
|
24893
|
+
http.put(
|
|
24894
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId`,
|
|
24895
|
+
async ({ params, request }) => {
|
|
24896
|
+
const { agentId, phoneNumberId } = params;
|
|
24897
|
+
const body = await request.json();
|
|
24898
|
+
const phoneNumberIndex = mockStore.phoneNumbers.findIndex(
|
|
24899
|
+
(pn) => pn.id === phoneNumberId && pn.agentId === agentId
|
|
24900
|
+
);
|
|
24901
|
+
if (phoneNumberIndex === -1) {
|
|
24902
|
+
return HttpResponse.json(
|
|
24903
|
+
{ success: false, message: "Phone number not found" },
|
|
24904
|
+
{ status: 404 }
|
|
24905
|
+
);
|
|
24906
|
+
}
|
|
24907
|
+
const updatedPhoneNumber = {
|
|
24908
|
+
...mockStore.phoneNumbers[phoneNumberIndex],
|
|
24909
|
+
...body,
|
|
24910
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24911
|
+
};
|
|
24912
|
+
mockStore.phoneNumbers[phoneNumberIndex] = updatedPhoneNumber;
|
|
24913
|
+
return HttpResponse.json({
|
|
24914
|
+
success: true,
|
|
24915
|
+
message: "Phone number updated (Sandbox)",
|
|
24916
|
+
data: updatedPhoneNumber
|
|
24917
|
+
});
|
|
24918
|
+
}
|
|
24919
|
+
),
|
|
24920
|
+
// Start forwarding test
|
|
24921
|
+
http.post(
|
|
24922
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests`,
|
|
24923
|
+
async ({ params }) => {
|
|
24924
|
+
const agentId = params.agentId;
|
|
24925
|
+
const phoneNumberId = params.phoneNumberId;
|
|
24926
|
+
const test = {
|
|
24927
|
+
id: `forwarding-test-${Date.now()}`,
|
|
24928
|
+
agentId,
|
|
24929
|
+
phoneNumberId,
|
|
24930
|
+
status: "in-progress",
|
|
24931
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24932
|
+
};
|
|
24933
|
+
mockStore.forwardingTests.push(test);
|
|
24934
|
+
setTimeout(() => {
|
|
24935
|
+
const testIndex = mockStore.forwardingTests.findIndex(
|
|
24936
|
+
(t2) => t2.id === test.id
|
|
24937
|
+
);
|
|
24938
|
+
if (testIndex !== -1 && mockStore.forwardingTests[testIndex].status === "in-progress") {
|
|
24939
|
+
mockStore.forwardingTests[testIndex] = {
|
|
24940
|
+
...mockStore.forwardingTests[testIndex],
|
|
24941
|
+
status: "success",
|
|
24942
|
+
message: "Call was successfully forwarded to your number",
|
|
24943
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24944
|
+
};
|
|
24945
|
+
}
|
|
24946
|
+
}, 15e3);
|
|
24947
|
+
return HttpResponse.json({
|
|
24948
|
+
success: true,
|
|
24949
|
+
message: "Forwarding test started (Sandbox)",
|
|
24950
|
+
data: test
|
|
24951
|
+
});
|
|
24952
|
+
}
|
|
24953
|
+
),
|
|
24954
|
+
// Get forwarding test status
|
|
24955
|
+
http.get(
|
|
24956
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId`,
|
|
24957
|
+
({ params }) => {
|
|
24958
|
+
const { testId } = params;
|
|
24959
|
+
const test = mockStore.forwardingTests.find((t2) => t2.id === testId);
|
|
24960
|
+
if (!test) {
|
|
24961
|
+
return HttpResponse.json(
|
|
24962
|
+
{
|
|
24963
|
+
success: false,
|
|
24964
|
+
message: `Forwarding test with ID ${testId} not found (Sandbox)`
|
|
24965
|
+
},
|
|
24966
|
+
{ status: 404 }
|
|
24967
|
+
);
|
|
24968
|
+
}
|
|
24969
|
+
return HttpResponse.json({
|
|
24970
|
+
success: true,
|
|
24971
|
+
message: "Success (Sandbox)",
|
|
24972
|
+
data: test
|
|
24973
|
+
});
|
|
24974
|
+
}
|
|
24975
|
+
),
|
|
24976
|
+
// Cancel forwarding test
|
|
24977
|
+
http.post(
|
|
24978
|
+
`${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId/cancel`,
|
|
24979
|
+
({ params }) => {
|
|
24980
|
+
const { testId } = params;
|
|
24981
|
+
const testIndex = mockStore.forwardingTests.findIndex(
|
|
24982
|
+
(t2) => t2.id === testId
|
|
24983
|
+
);
|
|
24984
|
+
if (testIndex === -1) {
|
|
24985
|
+
return HttpResponse.json(
|
|
24986
|
+
{
|
|
24987
|
+
success: false,
|
|
24988
|
+
message: `Forwarding test with ID ${testId} not found (Sandbox)`
|
|
24989
|
+
},
|
|
24990
|
+
{ status: 404 }
|
|
24991
|
+
);
|
|
24992
|
+
}
|
|
24993
|
+
const test = mockStore.forwardingTests[testIndex];
|
|
24994
|
+
test.status = "cancelled";
|
|
24995
|
+
test.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
24996
|
+
return HttpResponse.json({
|
|
24997
|
+
success: true,
|
|
24998
|
+
message: "Forwarding test cancelled (Sandbox)",
|
|
24999
|
+
data: test
|
|
25000
|
+
});
|
|
25001
|
+
}
|
|
25002
|
+
),
|
|
25003
|
+
// Get calls for an agent
|
|
25004
|
+
http.get(`${HOSTNAME}/api/voice/calls`, ({ request }) => {
|
|
25005
|
+
const url = new URL(request.url);
|
|
25006
|
+
const agentId = url.searchParams.get("agentId");
|
|
25007
|
+
if (!agentId) {
|
|
25008
|
+
return HttpResponse.json(
|
|
25009
|
+
{
|
|
25010
|
+
success: false,
|
|
25011
|
+
message: "agentId query parameter is required (Sandbox)"
|
|
25012
|
+
},
|
|
25013
|
+
{ status: 400 }
|
|
25014
|
+
);
|
|
25015
|
+
}
|
|
25016
|
+
const agentCalls = mockStore.calls.filter((c2) => c2.agentId === agentId);
|
|
25017
|
+
agentCalls.sort(
|
|
25018
|
+
(a2, b2) => new Date(b2.createdAt).getTime() - new Date(a2.createdAt).getTime()
|
|
25019
|
+
);
|
|
25020
|
+
return HttpResponse.json({
|
|
25021
|
+
success: true,
|
|
25022
|
+
message: "Success (Sandbox)",
|
|
25023
|
+
data: agentCalls
|
|
24357
25024
|
});
|
|
24358
25025
|
})
|
|
24359
25026
|
];
|
|
24360
25027
|
const getHandlersByFeatures = (features) => {
|
|
24361
25028
|
const allHandlers = [];
|
|
24362
25029
|
if (features.includes("all")) {
|
|
24363
|
-
return [
|
|
25030
|
+
return [
|
|
25031
|
+
...measureAndAcquireHandlers,
|
|
25032
|
+
...reputationHandlers,
|
|
25033
|
+
...voiceHandlers
|
|
25034
|
+
];
|
|
24364
25035
|
}
|
|
24365
25036
|
if (features.includes("measure") || features.includes("acquire")) {
|
|
24366
25037
|
allHandlers.push(...measureAndAcquireHandlers);
|
|
@@ -24368,6 +25039,9 @@ const getHandlersByFeatures = (features) => {
|
|
|
24368
25039
|
if (features.includes("reputation")) {
|
|
24369
25040
|
allHandlers.push(...reputationHandlers);
|
|
24370
25041
|
}
|
|
25042
|
+
if (features.includes("voice")) {
|
|
25043
|
+
allHandlers.push(...voiceHandlers);
|
|
25044
|
+
}
|
|
24371
25045
|
return allHandlers;
|
|
24372
25046
|
};
|
|
24373
25047
|
getHandlersByFeatures(["all"]);
|