@embedreach/components 0.3.35 → 0.3.37
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 +3604 -3173
- package/dist/chunks/sandbox-loading-screen.js +327 -36
- package/dist/index.umd.js +9 -9
- package/dist/styles.css +2 -2
- package/package.json +1 -1
|
@@ -20702,8 +20702,13 @@ const PLATFORM_ID_MAPPING = {
|
|
|
20702
20702
|
// Renterra platform IDs
|
|
20703
20703
|
"0195c8e3-2185-7323-a3f5-0be8f1395240": "renterra",
|
|
20704
20704
|
// Renterra dev
|
|
20705
|
-
"4277dfb9-7535-4206-962d-3f29ad143d8a": "renterra"
|
|
20705
|
+
"4277dfb9-7535-4206-962d-3f29ad143d8a": "renterra",
|
|
20706
20706
|
// Renterra prod
|
|
20707
|
+
// Policylift platform IDs
|
|
20708
|
+
"01993333-cdb4-7f52-bfa1-be205ae084f0": "policylift",
|
|
20709
|
+
// Policylift prod
|
|
20710
|
+
"01993335-40d5-7a8d-9067-018ae047753c": "policylift"
|
|
20711
|
+
// Policylift staging
|
|
20707
20712
|
};
|
|
20708
20713
|
const getPlatformConfigKey = (platformId) => {
|
|
20709
20714
|
if (!platformId) return "default";
|
|
@@ -20747,6 +20752,25 @@ const defaultPlatformConfigs = {
|
|
|
20747
20752
|
"Tampa, FL",
|
|
20748
20753
|
"Evanston, IL"
|
|
20749
20754
|
]
|
|
20755
|
+
},
|
|
20756
|
+
policylift: {
|
|
20757
|
+
id: "policylift",
|
|
20758
|
+
name: "Policylift",
|
|
20759
|
+
brandColors: ["#1e40af", "#059669", "#dc2626", "#7c2d12"],
|
|
20760
|
+
locationNames: [
|
|
20761
|
+
"Austin, Texas",
|
|
20762
|
+
"Dallas, Texas",
|
|
20763
|
+
"Houston, Texas",
|
|
20764
|
+
"San Antonio, Texas",
|
|
20765
|
+
"El Paso, Texas"
|
|
20766
|
+
],
|
|
20767
|
+
locationAreas: [
|
|
20768
|
+
"Austin, TX",
|
|
20769
|
+
"Dallas, TX",
|
|
20770
|
+
"Houston, TX",
|
|
20771
|
+
"San Antonio, TX",
|
|
20772
|
+
"El Paso, TX"
|
|
20773
|
+
]
|
|
20750
20774
|
}
|
|
20751
20775
|
};
|
|
20752
20776
|
const getPlatformConfig = (platformId) => {
|
|
@@ -21017,6 +21041,39 @@ const businessConfigs = {
|
|
|
21017
21041
|
},
|
|
21018
21042
|
logoUrl: "https://static.vecteezy.com/system/resources/previews/043/794/103/non_2x/heavy-equipment-rental-and-service-logo-design-vector.jpg"
|
|
21019
21043
|
}
|
|
21044
|
+
},
|
|
21045
|
+
policylift: {
|
|
21046
|
+
name: "Texas Insurance Brokers",
|
|
21047
|
+
website: "https://www.texas-insurance.com/",
|
|
21048
|
+
tagline: "Trusted Texas insurance with 24+ years of experience",
|
|
21049
|
+
locations: [
|
|
21050
|
+
{
|
|
21051
|
+
addressLine1: "Fort Worth",
|
|
21052
|
+
addressLine2: "",
|
|
21053
|
+
locality: "Fort Worth",
|
|
21054
|
+
district: "TX",
|
|
21055
|
+
postalCode: "76102",
|
|
21056
|
+
countryCode: "US"
|
|
21057
|
+
}
|
|
21058
|
+
],
|
|
21059
|
+
branding: {
|
|
21060
|
+
brandName: "Texas Insurance Brokers",
|
|
21061
|
+
primaryColor: "#1e40af",
|
|
21062
|
+
secondaryColors: ["#dc2626", "#059669", "#7c2d12"],
|
|
21063
|
+
brandTagline: "Trusted Texas insurance with 24+ years of experience",
|
|
21064
|
+
brandPersonality: {
|
|
21065
|
+
tone: "professional",
|
|
21066
|
+
voice: "trustworthy",
|
|
21067
|
+
values: ["trust", "experience", "local expertise"]
|
|
21068
|
+
},
|
|
21069
|
+
colorPalette: {
|
|
21070
|
+
primary: "#1e40af",
|
|
21071
|
+
accent: ["#dc2626", "#059669", "#7c2d12"],
|
|
21072
|
+
background: ["#dbeafe", "#f0fdf4", "#fef2f2"],
|
|
21073
|
+
text: ["#1e3a8a", "#166534", "#991b1b"]
|
|
21074
|
+
},
|
|
21075
|
+
logoUrl: "https://static.vecteezy.com/system/resources/previews/043/794/103/non_2x/heavy-equipment-rental-and-service-logo-design-vector.jpg"
|
|
21076
|
+
}
|
|
21020
21077
|
}
|
|
21021
21078
|
};
|
|
21022
21079
|
const getBusinessConfig = (platformId) => {
|
|
@@ -21416,6 +21473,84 @@ const createWebPresenceContentFactory = (platformConfig, businessConfig) => {
|
|
|
21416
21473
|
]
|
|
21417
21474
|
}
|
|
21418
21475
|
);
|
|
21476
|
+
} else if (platformConfig.id === "policylift") {
|
|
21477
|
+
baseAdGroups.push(
|
|
21478
|
+
{
|
|
21479
|
+
ad: {
|
|
21480
|
+
headlines: [
|
|
21481
|
+
"Texas Auto Insurance",
|
|
21482
|
+
"Fort Worth Car Coverage",
|
|
21483
|
+
"Get Quote Today",
|
|
21484
|
+
"24+ Years Experience",
|
|
21485
|
+
"Fast Same-Day Service",
|
|
21486
|
+
"Affordable Texas Rates"
|
|
21487
|
+
],
|
|
21488
|
+
descriptions: [
|
|
21489
|
+
"Trusted Texas auto insurance with 24+ years of experience. Get competitive rates and fast service.",
|
|
21490
|
+
"Protect your vehicle with customized coverage from Texas Insurance Brokers. Call now!"
|
|
21491
|
+
]
|
|
21492
|
+
},
|
|
21493
|
+
adUrl: "https://www.texas-insurance.com/sub-coverage-lines/personal-auto",
|
|
21494
|
+
theme: "Texas Auto Insurance",
|
|
21495
|
+
keywords: [
|
|
21496
|
+
"texas auto insurance quotes",
|
|
21497
|
+
"fort worth car insurance",
|
|
21498
|
+
"texas vehicle insurance",
|
|
21499
|
+
"auto insurance texas",
|
|
21500
|
+
"car insurance fort worth"
|
|
21501
|
+
]
|
|
21502
|
+
},
|
|
21503
|
+
{
|
|
21504
|
+
ad: {
|
|
21505
|
+
headlines: [
|
|
21506
|
+
"Texas Home Insurance",
|
|
21507
|
+
"Homeowners Coverage TX",
|
|
21508
|
+
"Protect Your Home Now",
|
|
21509
|
+
"Personalized Policies",
|
|
21510
|
+
"Expert Texas Service",
|
|
21511
|
+
"Peace of Mind Coverage"
|
|
21512
|
+
],
|
|
21513
|
+
descriptions: [
|
|
21514
|
+
"Comprehensive homeowners insurance tailored for Texas families. Expert local service you can trust.",
|
|
21515
|
+
"Safeguard your Texas home with customized coverage. Get your free quote from local experts today."
|
|
21516
|
+
]
|
|
21517
|
+
},
|
|
21518
|
+
adUrl: "https://www.texas-insurance.com/sub-coverage-lines/homeowners-insurance",
|
|
21519
|
+
theme: "Texas Home Insurance",
|
|
21520
|
+
keywords: [
|
|
21521
|
+
"texas homeowners insurance",
|
|
21522
|
+
"home insurance texas",
|
|
21523
|
+
"texas property insurance",
|
|
21524
|
+
"homeowners coverage texas",
|
|
21525
|
+
"texas home protection"
|
|
21526
|
+
]
|
|
21527
|
+
},
|
|
21528
|
+
{
|
|
21529
|
+
ad: {
|
|
21530
|
+
headlines: [
|
|
21531
|
+
"Texas Business Insurance",
|
|
21532
|
+
"Commercial Coverage TX",
|
|
21533
|
+
"Protect Your Business",
|
|
21534
|
+
"General Liability Included",
|
|
21535
|
+
"Texas Business Experts",
|
|
21536
|
+
"Comprehensive Protection"
|
|
21537
|
+
],
|
|
21538
|
+
descriptions: [
|
|
21539
|
+
"Complete commercial insurance solutions for Texas businesses. Workers comp, liability, and more.",
|
|
21540
|
+
"Protect your Texas business with expert commercial coverage. Get competitive rates and local service."
|
|
21541
|
+
]
|
|
21542
|
+
},
|
|
21543
|
+
adUrl: "https://www.texas-insurance.com/coverage-lines/coverage-line-10",
|
|
21544
|
+
theme: "Texas Business Insurance",
|
|
21545
|
+
keywords: [
|
|
21546
|
+
"texas business insurance",
|
|
21547
|
+
"commercial insurance texas",
|
|
21548
|
+
"texas liability insurance",
|
|
21549
|
+
"business coverage texas",
|
|
21550
|
+
"texas workers compensation"
|
|
21551
|
+
]
|
|
21552
|
+
}
|
|
21553
|
+
);
|
|
21419
21554
|
} else {
|
|
21420
21555
|
baseAdGroups.push(
|
|
21421
21556
|
{
|
|
@@ -21479,7 +21614,7 @@ const createSandboxMeasureAndAcquireData = (platformId, businessId) => {
|
|
|
21479
21614
|
const platformConfigKey = getPlatformConfigKey(platformId);
|
|
21480
21615
|
const platformConfig = {
|
|
21481
21616
|
id: platformConfigKey,
|
|
21482
|
-
name: platformConfigKey === "goose" ? "Paws Pet Hotel" : platformConfigKey === "renterra" ? "Tomers Rentals" : "Default",
|
|
21617
|
+
name: platformConfigKey === "goose" ? "Paws Pet Hotel" : platformConfigKey === "renterra" ? "Tomers Rentals" : platformConfigKey === "policylift" ? "Policylift" : "Default",
|
|
21483
21618
|
brandColors: [],
|
|
21484
21619
|
locationNames: [],
|
|
21485
21620
|
locationAreas: []
|
|
@@ -21672,6 +21807,21 @@ const renterraPlatformData = {
|
|
|
21672
21807
|
...renterraMeasureAndAcquireData,
|
|
21673
21808
|
reputationData: renterraReputationData
|
|
21674
21809
|
};
|
|
21810
|
+
const policyliftPlatformId = "01993333-cdb4-7f52-bfa1-be205ae084f0";
|
|
21811
|
+
const policyliftBusinessId = defaultPlatformData.businessesMe.id;
|
|
21812
|
+
const policyliftMeasureAndAcquireData = createSandboxMeasureAndAcquireData(
|
|
21813
|
+
policyliftPlatformId,
|
|
21814
|
+
policyliftBusinessId
|
|
21815
|
+
);
|
|
21816
|
+
const policyliftReputationData = createSandboxReputationData(
|
|
21817
|
+
policyliftPlatformId,
|
|
21818
|
+
policyliftBusinessId
|
|
21819
|
+
);
|
|
21820
|
+
const policyliftPlatformData = {
|
|
21821
|
+
// Use factory-generated data
|
|
21822
|
+
...policyliftMeasureAndAcquireData,
|
|
21823
|
+
reputationData: policyliftReputationData
|
|
21824
|
+
};
|
|
21675
21825
|
const sandboxDataStore = {
|
|
21676
21826
|
// Goose dev platform ID
|
|
21677
21827
|
"01958180-06a0-7681-8064-6834e166d2e4": goosePlatformData,
|
|
@@ -21681,6 +21831,10 @@ const sandboxDataStore = {
|
|
|
21681
21831
|
"0195c8e3-2185-7323-a3f5-0be8f1395240": renterraPlatformData,
|
|
21682
21832
|
// Renterra prod platform ID
|
|
21683
21833
|
"4277dfb9-7535-4206-962d-3f29ad143d8a": renterraPlatformData,
|
|
21834
|
+
// Policylift prod platform ID
|
|
21835
|
+
"01993333-cdb4-7f52-bfa1-be205ae084f0": policyliftPlatformData,
|
|
21836
|
+
// Policylift staging platform ID
|
|
21837
|
+
"01993335-40d5-7a8d-9067-018ae047753c": policyliftPlatformData,
|
|
21684
21838
|
// Default fallback if platform ID isn't mapped
|
|
21685
21839
|
default: defaultPlatformData
|
|
21686
21840
|
};
|
|
@@ -24435,17 +24589,18 @@ const createPhoneNumberFactory = (agentId, number) => {
|
|
|
24435
24589
|
return {
|
|
24436
24590
|
id: f.string.uuid(),
|
|
24437
24591
|
agentId,
|
|
24438
|
-
|
|
24439
|
-
|
|
24592
|
+
businessId: "mock-business-id",
|
|
24593
|
+
phoneNumber: generatedNumber,
|
|
24594
|
+
forwardingType: "none",
|
|
24440
24595
|
createdAt: f.date.past().toISOString(),
|
|
24441
24596
|
updatedAt: f.date.recent().toISOString()
|
|
24442
24597
|
};
|
|
24443
24598
|
};
|
|
24444
24599
|
const createCallFactory = (agentId) => {
|
|
24445
24600
|
const createdAt = f.date.recent();
|
|
24446
|
-
const
|
|
24601
|
+
const startedAt = f.date.between({ from: createdAt, to: /* @__PURE__ */ new Date() });
|
|
24447
24602
|
const duration = f.number.int({ min: 30, max: 1800 });
|
|
24448
|
-
const endedAt = new Date(
|
|
24603
|
+
const endedAt = new Date(startedAt.getTime() + duration * 1e3);
|
|
24449
24604
|
const summaries = [
|
|
24450
24605
|
"Customer inquired about business hours and services offered. Provided information about our operating schedule and explained our consultation process.",
|
|
24451
24606
|
"Client called to schedule an appointment for next week. Confirmed availability and provided pricing information for the requested service.",
|
|
@@ -24459,15 +24614,22 @@ const createCallFactory = (agentId) => {
|
|
|
24459
24614
|
return {
|
|
24460
24615
|
id: f.string.uuid(),
|
|
24461
24616
|
agentId,
|
|
24617
|
+
callType: "phone_call",
|
|
24618
|
+
callStatus: "completed",
|
|
24462
24619
|
fromNumber: generatePlainPhoneNumber(),
|
|
24463
|
-
|
|
24464
|
-
|
|
24620
|
+
toNumber: generatePlainPhoneNumber(),
|
|
24621
|
+
direction: "inbound",
|
|
24622
|
+
startedAt: startedAt.toISOString(),
|
|
24623
|
+
endedAt: endedAt.toISOString(),
|
|
24624
|
+
durationSecs: duration,
|
|
24625
|
+
sentiment: f.datatype.boolean({ probability: 0.7 }) ? "positive" : "negative",
|
|
24626
|
+
successful: f.datatype.boolean({ probability: 0.8 }),
|
|
24627
|
+
blockedReason: null,
|
|
24628
|
+
transcript: null,
|
|
24629
|
+
summary: f.helpers.arrayElement(summaries),
|
|
24465
24630
|
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
24631
|
createdAt: createdAt.toISOString(),
|
|
24469
|
-
|
|
24470
|
-
endedAt: endedAt.toISOString()
|
|
24632
|
+
updatedAt: createdAt.toISOString()
|
|
24471
24633
|
};
|
|
24472
24634
|
};
|
|
24473
24635
|
const knowledgeStore = /* @__PURE__ */ new Map();
|
|
@@ -24479,6 +24641,7 @@ const mockStore = {
|
|
|
24479
24641
|
phoneNumbers: [],
|
|
24480
24642
|
testCalls: [],
|
|
24481
24643
|
forwardingTests: [],
|
|
24644
|
+
agentKnowledge: {},
|
|
24482
24645
|
calls: []
|
|
24483
24646
|
};
|
|
24484
24647
|
const getOrCreateAgent = (businessId) => {
|
|
@@ -24514,17 +24677,131 @@ const voiceHandlers = [
|
|
|
24514
24677
|
return HttpResponse.json({
|
|
24515
24678
|
success: true,
|
|
24516
24679
|
message: "Success (Sandbox)",
|
|
24517
|
-
data:
|
|
24680
|
+
data: {
|
|
24681
|
+
results: [agent],
|
|
24682
|
+
pagination: {
|
|
24683
|
+
hasNextPage: false,
|
|
24684
|
+
cursor: null
|
|
24685
|
+
}
|
|
24686
|
+
}
|
|
24518
24687
|
});
|
|
24519
24688
|
}),
|
|
24689
|
+
// Create voice agent
|
|
24690
|
+
http.post(`${HOSTNAME}/api/voice/agents`, async () => {
|
|
24691
|
+
const businessId = "mock-business-id";
|
|
24692
|
+
const existingAgent = mockStore.agents.find(
|
|
24693
|
+
(a2) => a2.businessId === businessId
|
|
24694
|
+
);
|
|
24695
|
+
if (existingAgent) {
|
|
24696
|
+
return HttpResponse.json(
|
|
24697
|
+
{
|
|
24698
|
+
success: false,
|
|
24699
|
+
message: "Agent already exists for this business (Sandbox)"
|
|
24700
|
+
},
|
|
24701
|
+
{ status: 409 }
|
|
24702
|
+
);
|
|
24703
|
+
}
|
|
24704
|
+
const agent = createVoiceAgentFactory(businessId);
|
|
24705
|
+
mockStore.agents.push(agent);
|
|
24706
|
+
mockStore.agentKnowledge[agent.id] = [];
|
|
24707
|
+
return HttpResponse.json(
|
|
24708
|
+
{
|
|
24709
|
+
success: true,
|
|
24710
|
+
message: "Agent created (Sandbox)",
|
|
24711
|
+
data: agent
|
|
24712
|
+
},
|
|
24713
|
+
{ status: 201 }
|
|
24714
|
+
);
|
|
24715
|
+
}),
|
|
24716
|
+
// Get knowledge items for an agent
|
|
24717
|
+
http.get(
|
|
24718
|
+
`${HOSTNAME}/api/voice/agents/:agentId/knowledge`,
|
|
24719
|
+
async ({ params, request }) => {
|
|
24720
|
+
const agentId = typeof params.agentId === "string" ? params.agentId : Array.isArray(params.agentId) ? params.agentId[0] : "";
|
|
24721
|
+
const agent = mockStore.agents.find((a2) => a2.id === agentId);
|
|
24722
|
+
if (!agent) {
|
|
24723
|
+
return HttpResponse.json(
|
|
24724
|
+
{
|
|
24725
|
+
success: false,
|
|
24726
|
+
message: `Agent with ID ${agentId} not found (Sandbox)`
|
|
24727
|
+
},
|
|
24728
|
+
{ status: 404 }
|
|
24729
|
+
);
|
|
24730
|
+
}
|
|
24731
|
+
const url = new URL(request.url);
|
|
24732
|
+
const cursor = url.searchParams.get("cursor") || void 0;
|
|
24733
|
+
const limitParam = url.searchParams.get("limit");
|
|
24734
|
+
const limit = limitParam ? Number.parseInt(limitParam, 10) : void 0;
|
|
24735
|
+
const knowledgeItems = mockStore.agentKnowledge[agentId] || [];
|
|
24736
|
+
const startIndex = cursor ? Number.parseInt(cursor, 10) : 0;
|
|
24737
|
+
const endIndex = limit ? startIndex + limit : knowledgeItems.length;
|
|
24738
|
+
const paginatedItems = knowledgeItems.slice(startIndex, endIndex);
|
|
24739
|
+
const hasNextPage = endIndex < knowledgeItems.length;
|
|
24740
|
+
return HttpResponse.json({
|
|
24741
|
+
success: true,
|
|
24742
|
+
message: "Success (Sandbox)",
|
|
24743
|
+
data: {
|
|
24744
|
+
data: paginatedItems,
|
|
24745
|
+
pagination: {
|
|
24746
|
+
hasNextPage,
|
|
24747
|
+
cursor: hasNextPage ? endIndex.toString() : void 0
|
|
24748
|
+
}
|
|
24749
|
+
}
|
|
24750
|
+
});
|
|
24751
|
+
}
|
|
24752
|
+
),
|
|
24753
|
+
// Apply knowledge to an agent
|
|
24754
|
+
http.post(
|
|
24755
|
+
`${HOSTNAME}/api/voice/agents/:agentId/knowledge`,
|
|
24756
|
+
async ({ params, request }) => {
|
|
24757
|
+
const agentId = typeof params.agentId === "string" ? params.agentId : Array.isArray(params.agentId) ? params.agentId[0] : "";
|
|
24758
|
+
const agent = mockStore.agents.find((a2) => a2.id === agentId);
|
|
24759
|
+
if (!agent) {
|
|
24760
|
+
return HttpResponse.json(
|
|
24761
|
+
{
|
|
24762
|
+
success: false,
|
|
24763
|
+
message: `Agent with ID ${agentId} not found (Sandbox)`
|
|
24764
|
+
},
|
|
24765
|
+
{ status: 404 }
|
|
24766
|
+
);
|
|
24767
|
+
}
|
|
24768
|
+
const body = await request.json();
|
|
24769
|
+
const requests = Array.isArray(body) ? body : [body];
|
|
24770
|
+
const knowledgeItems = requests.map((req) => ({
|
|
24771
|
+
id: crypto.randomUUID(),
|
|
24772
|
+
agentId,
|
|
24773
|
+
title: req.title,
|
|
24774
|
+
content: req.content,
|
|
24775
|
+
websiteScanId: void 0,
|
|
24776
|
+
deactivatedAt: null,
|
|
24777
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24778
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
24779
|
+
}));
|
|
24780
|
+
if (!mockStore.agentKnowledge[agentId]) {
|
|
24781
|
+
mockStore.agentKnowledge[agentId] = [];
|
|
24782
|
+
}
|
|
24783
|
+
mockStore.agentKnowledge[agentId].push(...knowledgeItems);
|
|
24784
|
+
return HttpResponse.json(
|
|
24785
|
+
{
|
|
24786
|
+
success: true,
|
|
24787
|
+
message: "Knowledge applied (Sandbox)",
|
|
24788
|
+
data: knowledgeItems
|
|
24789
|
+
},
|
|
24790
|
+
{ status: 201 }
|
|
24791
|
+
);
|
|
24792
|
+
}
|
|
24793
|
+
),
|
|
24520
24794
|
// Get knowledge items from webscan-knowledge (business-scoped)
|
|
24521
24795
|
http.get(`${HOSTNAME}/api/webscan-knowledge`, async () => {
|
|
24522
24796
|
return HttpResponse.json({
|
|
24523
24797
|
success: true,
|
|
24524
24798
|
message: "Success (Sandbox)",
|
|
24525
24799
|
data: {
|
|
24526
|
-
|
|
24527
|
-
|
|
24800
|
+
results: mockStore.knowledgeItems,
|
|
24801
|
+
pagination: {
|
|
24802
|
+
hasNextPage: false,
|
|
24803
|
+
cursor: null
|
|
24804
|
+
}
|
|
24528
24805
|
}
|
|
24529
24806
|
});
|
|
24530
24807
|
}),
|
|
@@ -24871,7 +25148,13 @@ const voiceHandlers = [
|
|
|
24871
25148
|
return HttpResponse.json({
|
|
24872
25149
|
success: true,
|
|
24873
25150
|
message: "Success (Sandbox)",
|
|
24874
|
-
data:
|
|
25151
|
+
data: {
|
|
25152
|
+
results: phoneNumbers,
|
|
25153
|
+
pagination: {
|
|
25154
|
+
hasNextPage: false,
|
|
25155
|
+
cursor: null
|
|
25156
|
+
}
|
|
25157
|
+
}
|
|
24875
25158
|
});
|
|
24876
25159
|
}
|
|
24877
25160
|
),
|
|
@@ -25001,28 +25284,36 @@ const voiceHandlers = [
|
|
|
25001
25284
|
}
|
|
25002
25285
|
),
|
|
25003
25286
|
// Get calls for an agent
|
|
25004
|
-
http.get(
|
|
25005
|
-
|
|
25006
|
-
|
|
25007
|
-
|
|
25008
|
-
|
|
25009
|
-
|
|
25010
|
-
|
|
25011
|
-
|
|
25012
|
-
|
|
25013
|
-
|
|
25287
|
+
http.get(
|
|
25288
|
+
`${HOSTNAME}/api/voice/agents/:agentId/calls`,
|
|
25289
|
+
({ params, request }) => {
|
|
25290
|
+
const agentId = params.agentId;
|
|
25291
|
+
const url = new URL(request.url);
|
|
25292
|
+
const cursor = url.searchParams.get("cursor");
|
|
25293
|
+
const limitParam = url.searchParams.get("limit");
|
|
25294
|
+
const limit = limitParam ? parseInt(limitParam, 10) : void 0;
|
|
25295
|
+
const agentCalls = mockStore.calls.filter((c2) => c2.agentId === agentId);
|
|
25296
|
+
agentCalls.sort(
|
|
25297
|
+
(a2, b2) => new Date(b2.createdAt).getTime() - new Date(a2.createdAt).getTime()
|
|
25014
25298
|
);
|
|
25299
|
+
const startIndex = cursor ? parseInt(cursor, 10) : 0;
|
|
25300
|
+
const endIndex = limit ? Math.min(startIndex + limit, agentCalls.length) : agentCalls.length;
|
|
25301
|
+
const paginatedCalls = agentCalls.slice(startIndex, endIndex);
|
|
25302
|
+
const hasNextPage = endIndex < agentCalls.length;
|
|
25303
|
+
const nextCursor = hasNextPage ? endIndex.toString() : void 0;
|
|
25304
|
+
return HttpResponse.json({
|
|
25305
|
+
success: true,
|
|
25306
|
+
message: "Success (Sandbox)",
|
|
25307
|
+
data: {
|
|
25308
|
+
results: paginatedCalls,
|
|
25309
|
+
pagination: {
|
|
25310
|
+
hasNextPage,
|
|
25311
|
+
cursor: nextCursor
|
|
25312
|
+
}
|
|
25313
|
+
}
|
|
25314
|
+
});
|
|
25015
25315
|
}
|
|
25016
|
-
|
|
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
|
|
25024
|
-
});
|
|
25025
|
-
})
|
|
25316
|
+
)
|
|
25026
25317
|
];
|
|
25027
25318
|
const getHandlersByFeatures = (features) => {
|
|
25028
25319
|
const allHandlers = [];
|