@embedreach/components 0.3.42 → 0.3.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
- import { C as ChannelAccountTypeEnum, R as ReachClientEnum, H as H3 } from "./index.js";
3
+ import { C as ChannelAccountTypeEnum, z as z$2, R as ReachClientEnum, H as H3 } from "./index.js";
4
4
  var POSITIONALS_EXP$1 = /(%?)(%([sdijo]))/g;
5
5
  function serializePositional$1(positional, flag) {
6
6
  switch (flag) {
@@ -22729,6 +22729,8 @@ const generateReputationResponsesData = ({
22729
22729
  startDate,
22730
22730
  endDate,
22731
22731
  locationIds,
22732
+ reviewSource,
22733
+ sentiment,
22732
22734
  cursor,
22733
22735
  limit,
22734
22736
  searchTerm
@@ -22759,6 +22761,21 @@ const generateReputationResponsesData = ({
22759
22761
  (response) => response.locationId && locationIds.includes(response.locationId)
22760
22762
  );
22761
22763
  }
22764
+ if (reviewSource) {
22765
+ const sources = reviewSource.split(",").filter(Boolean);
22766
+ filteredResponses = filteredResponses.filter(
22767
+ (response) => sources.includes(response.reviewSource)
22768
+ );
22769
+ }
22770
+ if (sentiment) {
22771
+ filteredResponses = filteredResponses.filter((response) => {
22772
+ const calculatedSentiment = calculateSentiment(
22773
+ response.reviewSource,
22774
+ response.rating
22775
+ );
22776
+ return calculatedSentiment === sentiment;
22777
+ });
22778
+ }
22762
22779
  if (searchTerm && searchTerm.length >= 3) {
22763
22780
  const searchLower = searchTerm.toLowerCase();
22764
22781
  filteredResponses = filteredResponses.filter((response) => {
@@ -22792,6 +22809,18 @@ const generateReputationResponsesData = ({
22792
22809
  total: filteredResponses.length
22793
22810
  };
22794
22811
  };
22812
+ function calculateSentiment(reviewSource, rating) {
22813
+ if (reviewSource === "google_business_profile") {
22814
+ if (rating >= 4) return "positive";
22815
+ if (rating === 3) return "neutral";
22816
+ return "negative";
22817
+ } else if (reviewSource === "internal_feedback") {
22818
+ if (rating >= 9) return "positive";
22819
+ if (rating >= 7) return "neutral";
22820
+ return "negative";
22821
+ }
22822
+ return "neutral";
22823
+ }
22795
22824
  function generateResponsePool(platformConfig, platformData, startDate, endDate, totalCount) {
22796
22825
  const responses = [];
22797
22826
  const partnerLocations = platformData.reputationData?.partnerLocations || [];
@@ -24200,6 +24229,8 @@ const reputationHandlers = [
24200
24229
  const startDate = url.searchParams.get("start_date");
24201
24230
  const endDate = url.searchParams.get("end_date");
24202
24231
  const locationIds = url.searchParams.getAll("location_ids");
24232
+ const reviewSource = url.searchParams.get("review_source");
24233
+ const sentiment = url.searchParams.get("sentiment");
24203
24234
  const cursor = url.searchParams.get("cursor");
24204
24235
  const limit = parseInt(url.searchParams.get("limit") || "25", 10);
24205
24236
  const searchTerm = url.searchParams.get("search_term");
@@ -24219,11 +24250,14 @@ const reputationHandlers = [
24219
24250
  error2
24220
24251
  );
24221
24252
  }
24253
+ const reviewSourceParam = reviewSource || null;
24222
24254
  const responsesData = generateReputationResponsesData({
24223
24255
  platformData,
24224
24256
  startDate,
24225
24257
  endDate,
24226
24258
  locationIds,
24259
+ reviewSource: reviewSourceParam,
24260
+ sentiment: sentiment || null,
24227
24261
  cursor,
24228
24262
  limit,
24229
24263
  searchTerm
@@ -24495,6 +24529,27 @@ const reputationHandlers = [
24495
24529
  }
24496
24530
  )
24497
24531
  ];
24532
+ var VoiceForwardingTestStatusEnum;
24533
+ (function(VoiceForwardingTestStatusEnum2) {
24534
+ VoiceForwardingTestStatusEnum2["PENDING"] = "pending";
24535
+ VoiceForwardingTestStatusEnum2["PASSED"] = "passed";
24536
+ VoiceForwardingTestStatusEnum2["ERROR"] = "error";
24537
+ VoiceForwardingTestStatusEnum2["CANCELLED"] = "cancelled";
24538
+ })(VoiceForwardingTestStatusEnum || (VoiceForwardingTestStatusEnum = {}));
24539
+ const voiceForwardingTestStatusSchema = z$2.enum([
24540
+ "pending",
24541
+ "passed",
24542
+ "error",
24543
+ "cancelled"
24544
+ ]);
24545
+ z$2.object({
24546
+ id: z$2.string().uuid(),
24547
+ phoneNumberId: z$2.string().uuid(),
24548
+ status: voiceForwardingTestStatusSchema,
24549
+ message: z$2.string().optional(),
24550
+ createdAt: z$2.string(),
24551
+ completedAt: z$2.string().optional()
24552
+ });
24498
24553
  const generatePlainPhoneNumber = () => {
24499
24554
  const areaCode = f.number.int({ min: 200, max: 999 });
24500
24555
  const centralOffice = f.number.int({ min: 200, max: 999 });
@@ -25183,12 +25238,12 @@ const voiceHandlers = [
25183
25238
  ),
25184
25239
  // Update phone number
25185
25240
  http.put(
25186
- `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId`,
25241
+ `${HOSTNAME}/api/voice/phone-numbers/:phoneNumberId`,
25187
25242
  async ({ params, request }) => {
25188
- const { agentId, phoneNumberId } = params;
25243
+ const { phoneNumberId } = params;
25189
25244
  const body = await request.json();
25190
25245
  const phoneNumberIndex = mockStore.phoneNumbers.findIndex(
25191
- (pn) => pn.id === phoneNumberId && pn.agentId === agentId
25246
+ (pn) => pn.id === phoneNumberId
25192
25247
  );
25193
25248
  if (phoneNumberIndex === -1) {
25194
25249
  return HttpResponse.json(
@@ -25210,64 +25265,57 @@ const voiceHandlers = [
25210
25265
  }
25211
25266
  ),
25212
25267
  // Start forwarding test
25213
- http.post(
25214
- `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests`,
25215
- async ({ params }) => {
25216
- const agentId = params.agentId;
25217
- const phoneNumberId = params.phoneNumberId;
25218
- const test = {
25219
- id: `forwarding-test-${Date.now()}`,
25220
- agentId,
25221
- phoneNumberId,
25222
- status: "in-progress",
25223
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
25224
- };
25225
- mockStore.forwardingTests.push(test);
25226
- setTimeout(() => {
25227
- const testIndex = mockStore.forwardingTests.findIndex(
25228
- (t2) => t2.id === test.id
25229
- );
25230
- if (testIndex !== -1 && mockStore.forwardingTests[testIndex].status === "in-progress") {
25231
- mockStore.forwardingTests[testIndex] = {
25232
- ...mockStore.forwardingTests[testIndex],
25233
- status: "success",
25234
- message: "Call was successfully forwarded to your number",
25235
- completedAt: (/* @__PURE__ */ new Date()).toISOString()
25236
- };
25237
- }
25238
- }, 15e3);
25239
- return HttpResponse.json({
25240
- success: true,
25241
- message: "Forwarding test started (Sandbox)",
25242
- data: test
25243
- });
25244
- }
25245
- ),
25246
- // Get forwarding test status
25247
- http.get(
25248
- `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId`,
25249
- ({ params }) => {
25250
- const { testId } = params;
25251
- const test = mockStore.forwardingTests.find((t2) => t2.id === testId);
25252
- if (!test) {
25253
- return HttpResponse.json(
25254
- {
25255
- success: false,
25256
- message: `Forwarding test with ID ${testId} not found (Sandbox)`
25257
- },
25258
- { status: 404 }
25259
- );
25268
+ http.post(`${HOSTNAME}/api/voice/forwarding-tests`, async ({ request }) => {
25269
+ const body = await request.json();
25270
+ const phoneNumberId = body.phoneNumberId;
25271
+ const test = {
25272
+ id: `forwarding-test-${Date.now()}`,
25273
+ phoneNumberId,
25274
+ status: VoiceForwardingTestStatusEnum.PENDING,
25275
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
25276
+ };
25277
+ mockStore.forwardingTests.push(test);
25278
+ setTimeout(() => {
25279
+ const testIndex = mockStore.forwardingTests.findIndex(
25280
+ (t2) => t2.id === test.id
25281
+ );
25282
+ if (testIndex !== -1 && mockStore.forwardingTests[testIndex].status === VoiceForwardingTestStatusEnum.PENDING) {
25283
+ mockStore.forwardingTests[testIndex] = {
25284
+ ...mockStore.forwardingTests[testIndex],
25285
+ status: VoiceForwardingTestStatusEnum.PASSED,
25286
+ message: "Call was successfully forwarded to your number",
25287
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
25288
+ };
25260
25289
  }
25261
- return HttpResponse.json({
25262
- success: true,
25263
- message: "Success (Sandbox)",
25264
- data: test
25265
- });
25290
+ }, 15e3);
25291
+ return HttpResponse.json({
25292
+ success: true,
25293
+ message: "Forwarding test started (Sandbox)",
25294
+ data: test
25295
+ });
25296
+ }),
25297
+ // Get forwarding test status
25298
+ http.get(`${HOSTNAME}/api/voice/forwarding-tests/:testId`, ({ params }) => {
25299
+ const { testId } = params;
25300
+ const test = mockStore.forwardingTests.find((t2) => t2.id === testId);
25301
+ if (!test) {
25302
+ return HttpResponse.json(
25303
+ {
25304
+ success: false,
25305
+ message: `Forwarding test with ID ${testId} not found (Sandbox)`
25306
+ },
25307
+ { status: 404 }
25308
+ );
25266
25309
  }
25267
- ),
25310
+ return HttpResponse.json({
25311
+ success: true,
25312
+ message: "Success (Sandbox)",
25313
+ data: test
25314
+ });
25315
+ }),
25268
25316
  // Cancel forwarding test
25269
25317
  http.post(
25270
- `${HOSTNAME}/api/voice/agents/:agentId/phone-numbers/:phoneNumberId/forwarding-tests/:testId/cancel`,
25318
+ `${HOSTNAME}/api/voice/forwarding-tests/:testId/cancel`,
25271
25319
  ({ params }) => {
25272
25320
  const { testId } = params;
25273
25321
  const testIndex = mockStore.forwardingTests.findIndex(
package/dist/index.d.ts CHANGED
@@ -51,12 +51,14 @@ declare interface CreateAutomationModalProps {
51
51
  *
52
52
  * @param args.estimatedEmailRecipients - The estimated number of email recipients
53
53
  * @param args.estimatedSmsRecipients - The estimated number of sms recipients
54
+ * @param args.scheduleSendAt - The scheduled send time as an ISO date string, or null if not set
54
55
  *
55
56
  * @returns true if the automation should be scheduled, string otherwise that will be displayed to the user in a toast notification
56
57
  */
57
58
  onBeforeSchedule?: (args: {
58
59
  estimatedEmailRecipients: number;
59
60
  estimatedSmsRecipients: number;
61
+ scheduleSendAt: string | null;
60
62
  }) => Promise<true | string>;
61
63
  /**
62
64
  * Optional text and hyperlink to display for
@@ -294,7 +296,7 @@ declare interface SMSSetupBusinessFormRef {
294
296
  declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
295
297
  type: z.ZodLiteral<SmsRegistrationApplicationType>;
296
298
  tollFreeNumber: z.ZodString;
297
- company: z.ZodObject<{
299
+ company: z.ZodEffects<z.ZodObject<{
298
300
  name: z.ZodString;
299
301
  address1: z.ZodString;
300
302
  address2: z.ZodOptional<z.ZodString>;
@@ -302,6 +304,8 @@ declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
302
304
  stateProvince: z.ZodString;
303
305
  zipCode: z.ZodString;
304
306
  country: z.ZodString;
307
+ businessRegistrationNumber: z.ZodOptional<z.ZodString>;
308
+ businessType: z.ZodOptional<z.ZodEnum<["SOLE_PROPRIETOR"]>>;
305
309
  }, "strip", z.ZodTypeAny, {
306
310
  name: string;
307
311
  country: string;
@@ -310,6 +314,8 @@ declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
310
314
  stateProvince: string;
311
315
  zipCode: string;
312
316
  address2?: string | undefined;
317
+ businessRegistrationNumber?: string | undefined;
318
+ businessType?: "SOLE_PROPRIETOR" | undefined;
313
319
  }, {
314
320
  name: string;
315
321
  country: string;
@@ -318,6 +324,28 @@ declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
318
324
  stateProvince: string;
319
325
  zipCode: string;
320
326
  address2?: string | undefined;
327
+ businessRegistrationNumber?: string | undefined;
328
+ businessType?: "SOLE_PROPRIETOR" | undefined;
329
+ }>, {
330
+ name: string;
331
+ country: string;
332
+ address1: string;
333
+ city: string;
334
+ stateProvince: string;
335
+ zipCode: string;
336
+ address2?: string | undefined;
337
+ businessRegistrationNumber?: string | undefined;
338
+ businessType?: "SOLE_PROPRIETOR" | undefined;
339
+ }, {
340
+ name: string;
341
+ country: string;
342
+ address1: string;
343
+ city: string;
344
+ stateProvince: string;
345
+ zipCode: string;
346
+ address2?: string | undefined;
347
+ businessRegistrationNumber?: string | undefined;
348
+ businessType?: "SOLE_PROPRIETOR" | undefined;
321
349
  }>;
322
350
  contact: z.ZodObject<{
323
351
  firstName: z.ZodString;
@@ -359,6 +387,8 @@ declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
359
387
  stateProvince: string;
360
388
  zipCode: string;
361
389
  address2?: string | undefined;
390
+ businessRegistrationNumber?: string | undefined;
391
+ businessType?: "SOLE_PROPRIETOR" | undefined;
362
392
  };
363
393
  contact: {
364
394
  email: string;
@@ -383,6 +413,8 @@ declare const SMSSetupBusinessFormSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
383
413
  stateProvince: string;
384
414
  zipCode: string;
385
415
  address2?: string | undefined;
416
+ businessRegistrationNumber?: string | undefined;
417
+ businessType?: "SOLE_PROPRIETOR" | undefined;
386
418
  };
387
419
  contact: {
388
420
  email: string;
@@ -447,12 +479,14 @@ export declare type ViewAutomationProps = {
447
479
  *
448
480
  * @param args.estimatedEmailRecipients - The estimated number of email recipients
449
481
  * @param args.estimatedSmsRecipients - The estimated number of sms recipients
482
+ * @param args.scheduleSendAt - The scheduled send time as an ISO date string, or null if not set
450
483
  *
451
484
  * @returns true if the automation should be scheduled, string otherwise that will be displayed to the user in a toast notification
452
485
  */
453
486
  onBeforeSchedule?: (args: {
454
487
  estimatedEmailRecipients: number;
455
488
  estimatedSmsRecipients: number;
489
+ scheduleSendAt: string | null;
456
490
  }) => Promise<true | string>;
457
491
  /**
458
492
  * Optional boolean to hide features