beem-component 2.1.21 → 2.1.22
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.
|
@@ -446,14 +446,49 @@ const QuickReplyRender = _ref24 => {
|
|
|
446
446
|
isImg: true
|
|
447
447
|
}, /*#__PURE__*/_react.default.createElement(ConnectorRenderer, null));
|
|
448
448
|
};
|
|
449
|
-
const
|
|
449
|
+
const ImageRender = _ref25 => {
|
|
450
|
+
let {
|
|
451
|
+
type,
|
|
452
|
+
state,
|
|
453
|
+
rest,
|
|
454
|
+
isInteractive,
|
|
455
|
+
connector,
|
|
456
|
+
caption,
|
|
457
|
+
originalUrl
|
|
458
|
+
} = _ref25;
|
|
459
|
+
const renderers = {
|
|
460
|
+
dotgo_v3: () => {
|
|
461
|
+
var _caption$text;
|
|
462
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, originalUrl && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
463
|
+
state: state,
|
|
464
|
+
src: originalUrl
|
|
465
|
+
}, rest))), caption && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, caption === null || caption === void 0 || (_caption$text = caption.text) === null || _caption$text === void 0 ? void 0 : _caption$text.split('\n').map((line, idx) => /*#__PURE__*/_react.default.createElement("p", {
|
|
466
|
+
key: "body-line-".concat(idx)
|
|
467
|
+
}, line, /*#__PURE__*/_react.default.createElement("br", null)))));
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
const FallbackRenderer = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, originalUrl && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
471
|
+
state: state,
|
|
472
|
+
src: originalUrl
|
|
473
|
+
}, rest))), caption && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, caption === null || caption === void 0 ? void 0 : caption.split('\n').map((line, idx) => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
|
|
474
|
+
key: "content-line-".concat(idx)
|
|
475
|
+
}, line, /*#__PURE__*/_react.default.createElement("br", null))))));
|
|
476
|
+
const ConnectorRenderer = renderers[connector] || FallbackRenderer;
|
|
477
|
+
return /*#__PURE__*/_react.default.createElement(Messages, {
|
|
478
|
+
type: type,
|
|
479
|
+
state: state,
|
|
480
|
+
isInteractive: isInteractive,
|
|
481
|
+
isImg: true
|
|
482
|
+
}, /*#__PURE__*/_react.default.createElement(ConnectorRenderer, null));
|
|
483
|
+
};
|
|
484
|
+
const ProductDetailRender = _ref26 => {
|
|
450
485
|
let {
|
|
451
486
|
type,
|
|
452
487
|
state,
|
|
453
488
|
header,
|
|
454
489
|
body,
|
|
455
490
|
isInteractive
|
|
456
|
-
} =
|
|
491
|
+
} = _ref26;
|
|
457
492
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Messages, {
|
|
458
493
|
type: type,
|
|
459
494
|
state: state,
|
|
@@ -462,7 +497,7 @@ const ProductDetailRender = _ref25 => {
|
|
|
462
497
|
state: state
|
|
463
498
|
}, /*#__PURE__*/_react.default.createElement(_ShoppingCartOutlined.default, null), "Catalog")));
|
|
464
499
|
};
|
|
465
|
-
const ListReplyRender =
|
|
500
|
+
const ListReplyRender = _ref27 => {
|
|
466
501
|
let {
|
|
467
502
|
title,
|
|
468
503
|
body,
|
|
@@ -474,7 +509,7 @@ const ListReplyRender = _ref26 => {
|
|
|
474
509
|
header,
|
|
475
510
|
action,
|
|
476
511
|
footer
|
|
477
|
-
} =
|
|
512
|
+
} = _ref27;
|
|
478
513
|
const renderers = {
|
|
479
514
|
dotgo_v3: () => {
|
|
480
515
|
var _header$header$type3, _body$text2;
|
|
@@ -498,7 +533,7 @@ const ListReplyRender = _ref26 => {
|
|
|
498
533
|
isInteractive: isInteractive
|
|
499
534
|
}, /*#__PURE__*/_react.default.createElement(ConnectorRenderer, null)));
|
|
500
535
|
};
|
|
501
|
-
const OrderRender =
|
|
536
|
+
const OrderRender = _ref28 => {
|
|
502
537
|
let {
|
|
503
538
|
amount,
|
|
504
539
|
type,
|
|
@@ -507,14 +542,14 @@ const OrderRender = _ref27 => {
|
|
|
507
542
|
product_items,
|
|
508
543
|
connector,
|
|
509
544
|
isInteractive
|
|
510
|
-
} =
|
|
545
|
+
} = _ref28;
|
|
511
546
|
const renderers = {
|
|
512
|
-
dotgo_v3:
|
|
547
|
+
dotgo_v3: _ref29 => {
|
|
513
548
|
let {
|
|
514
549
|
displayItems,
|
|
515
550
|
sumQuantities,
|
|
516
551
|
setDisplayItems
|
|
517
|
-
} =
|
|
552
|
+
} = _ref29;
|
|
518
553
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(OrderBody, {
|
|
519
554
|
state: state
|
|
520
555
|
}, /*#__PURE__*/_react.default.createElement(CartContent, {
|
|
@@ -544,12 +579,12 @@ const OrderRender = _ref27 => {
|
|
|
544
579
|
}, /*#__PURE__*/_react.default.createElement("p", null, displayItems ? 'HIDE' : 'SHOW', " CART ITEMS")));
|
|
545
580
|
}
|
|
546
581
|
};
|
|
547
|
-
const FallbackRenderer =
|
|
582
|
+
const FallbackRenderer = _ref30 => {
|
|
548
583
|
let {
|
|
549
584
|
sumQuantities,
|
|
550
585
|
displayItems,
|
|
551
586
|
setDisplayItems
|
|
552
|
-
} =
|
|
587
|
+
} = _ref30;
|
|
553
588
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(OrderBody, {
|
|
554
589
|
state: state
|
|
555
590
|
}, /*#__PURE__*/_react.default.createElement(CartContent, {
|
|
@@ -596,7 +631,7 @@ const OrderRender = _ref27 => {
|
|
|
596
631
|
items: items
|
|
597
632
|
})));
|
|
598
633
|
};
|
|
599
|
-
BmChat.Details =
|
|
634
|
+
BmChat.Details = _ref31 => {
|
|
600
635
|
var _children$message, _children$message2;
|
|
601
636
|
let {
|
|
602
637
|
children,
|
|
@@ -615,8 +650,8 @@ BmChat.Details = _ref30 => {
|
|
|
615
650
|
isInteractive,
|
|
616
651
|
type,
|
|
617
652
|
extension
|
|
618
|
-
} =
|
|
619
|
-
rest = _objectWithoutProperties(
|
|
653
|
+
} = _ref31,
|
|
654
|
+
rest = _objectWithoutProperties(_ref31, _excluded3);
|
|
620
655
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
621
656
|
state: state
|
|
622
657
|
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'inbound' && session && handleState({
|
|
@@ -655,6 +690,12 @@ BmChat.Details = _ref30 => {
|
|
|
655
690
|
type: type,
|
|
656
691
|
state: state,
|
|
657
692
|
connector: metadata.connector
|
|
693
|
+
})) : metadata.message.type === 'image' ? /*#__PURE__*/_react.default.createElement(ImageRender, _extends({
|
|
694
|
+
isInteractive: true
|
|
695
|
+
}, metadata.message, {
|
|
696
|
+
type: type,
|
|
697
|
+
state: state,
|
|
698
|
+
connector: metadata === null || metadata === void 0 ? void 0 : metadata.connector
|
|
658
699
|
})) : /*#__PURE__*/_react.default.createElement(Messages, {
|
|
659
700
|
metadata: metadata,
|
|
660
701
|
state: state
|
|
@@ -675,6 +716,10 @@ BmChat.Details = _ref30 => {
|
|
|
675
716
|
type: type,
|
|
676
717
|
state: state,
|
|
677
718
|
connector: children === null || children === void 0 ? void 0 : children.connector
|
|
719
|
+
})), children.message.type === 'image' && /*#__PURE__*/_react.default.createElement(ImageRender, _extends({}, children.message, {
|
|
720
|
+
type: type,
|
|
721
|
+
state: state,
|
|
722
|
+
connector: children === null || children === void 0 ? void 0 : children.connector
|
|
678
723
|
}))) : type === 'pdf' ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactPdf.Document, {
|
|
679
724
|
file: {
|
|
680
725
|
url: "".concat(file)
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -600,6 +600,72 @@ const Chat = () => {
|
|
|
600
600
|
statusCode: 3,
|
|
601
601
|
},
|
|
602
602
|
},
|
|
603
|
+
{
|
|
604
|
+
id: 109370,
|
|
605
|
+
message:
|
|
606
|
+
'{ "dotgoV2": { "type": "image", "caption": "To register for AzamTV MAX, you need to download the AzamTV MAX App from Google Play Store or Apple App Store. \\n\\nOnce you have downloaded the App, follow these steps to register: \\n1. Open the App and click on REGISTER. \\n2. Enter your mobile number. \\n3. Enter the OTP sent to your mobile number. \\n4. Enter your details (Name, Surname, Email, Password) \\n5. Click on REGISTER. \\n\\nDo you need any further assistance?", "originalUrl": "https://imgur.com/JyXrxLv.png", "previewUrl": "https://imgur.com/JyXrxLv.png" }}',
|
|
607
|
+
time: '2025-10-06T10:53:38.000Z',
|
|
608
|
+
direction: 'outbound',
|
|
609
|
+
message_type: 'interactive',
|
|
610
|
+
messageId: '121302f4-50ca-48c3-a32a-2d570064a000',
|
|
611
|
+
is_live_agent: 0,
|
|
612
|
+
is_deleted: 0,
|
|
613
|
+
is_comment: 0,
|
|
614
|
+
channel: 'whatsapp',
|
|
615
|
+
sent_to_vendor: 1,
|
|
616
|
+
replyMessageId: null,
|
|
617
|
+
agent_name: null,
|
|
618
|
+
df_agent_name: null,
|
|
619
|
+
resolve_time: null,
|
|
620
|
+
metadata: null,
|
|
621
|
+
statusDetails: {
|
|
622
|
+
statusCode: 3,
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: 109414,
|
|
627
|
+
message: 'Reply',
|
|
628
|
+
time: '2025-10-06T11:31:15.000Z',
|
|
629
|
+
direction: 'inbound',
|
|
630
|
+
message_type: 'text',
|
|
631
|
+
messageId: null,
|
|
632
|
+
is_live_agent: 0,
|
|
633
|
+
is_deleted: 0,
|
|
634
|
+
is_comment: 0,
|
|
635
|
+
channel: 'whatsapp',
|
|
636
|
+
sent_to_vendor: 1,
|
|
637
|
+
replyMessageId: '121302f4-50ca-48c3-a32a-2d570064a000',
|
|
638
|
+
agent_name: null,
|
|
639
|
+
df_agent_name: null,
|
|
640
|
+
resolve_time: null,
|
|
641
|
+
metadata: {
|
|
642
|
+
id: '121302f4-50ca-48c3-a32a-2d570064a000',
|
|
643
|
+
prev_message:
|
|
644
|
+
'{ "dotgoV2": { "type": "image", "caption": "To register for AzamTV MAX, you need to download the AzamTV MAX App from Google Play Store or Apple App Store. \\n\\nOnce you have downloaded the App, follow these steps to register: \\n1. Open the App and click on REGISTER. \\n2. Enter your mobile number. \\n3. Enter the OTP sent to your mobile number. \\n4. Enter your details (Name, Surname, Email, Password) \\n5. Click on REGISTER. \\n\\nDo you need any further assistance?", "originalUrl": "https://imgur.com/JyXrxLv.png", "previewUrl": "https://imgur.com/JyXrxLv.png" }}',
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
id: 109469,
|
|
649
|
+
message: 'Image reply',
|
|
650
|
+
time: '2025-10-06T11:38:34.000Z',
|
|
651
|
+
direction: 'inbound',
|
|
652
|
+
message_type: 'text',
|
|
653
|
+
messageId: null,
|
|
654
|
+
is_live_agent: 1,
|
|
655
|
+
is_deleted: 0,
|
|
656
|
+
is_comment: 0,
|
|
657
|
+
channel: 'whatsapp',
|
|
658
|
+
sent_to_vendor: 1,
|
|
659
|
+
replyMessageId: null,
|
|
660
|
+
agent_name: null,
|
|
661
|
+
df_agent_name: null,
|
|
662
|
+
resolve_time: null,
|
|
663
|
+
metadata: {
|
|
664
|
+
id: 'wamid.HBgMMjU1Njg3MzQ5NTgxFQIAEhgUM0E1NTVGOThBMzk0NTM1OTgyQTMA',
|
|
665
|
+
prev_message:
|
|
666
|
+
'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/081c00de-cc02-44f2-bd91-5cf3a5a73d09.jpeg',
|
|
667
|
+
},
|
|
668
|
+
},
|
|
603
669
|
];
|
|
604
670
|
const isJson = (itemOg) => {
|
|
605
671
|
let item = itemOg;
|
|
@@ -517,6 +517,68 @@ const QuickReplyRender = ({
|
|
|
517
517
|
</Messages>
|
|
518
518
|
);
|
|
519
519
|
};
|
|
520
|
+
const ImageRender = ({
|
|
521
|
+
type,
|
|
522
|
+
state,
|
|
523
|
+
rest,
|
|
524
|
+
isInteractive,
|
|
525
|
+
connector,
|
|
526
|
+
caption,
|
|
527
|
+
originalUrl,
|
|
528
|
+
}) => {
|
|
529
|
+
const renderers = {
|
|
530
|
+
dotgo_v3: () => (
|
|
531
|
+
<>
|
|
532
|
+
{originalUrl && (
|
|
533
|
+
<>
|
|
534
|
+
<BmImageChat state={state} src={originalUrl} {...rest} />
|
|
535
|
+
</>
|
|
536
|
+
)}
|
|
537
|
+
|
|
538
|
+
{caption && (
|
|
539
|
+
<>
|
|
540
|
+
{caption?.text?.split('\n').map((line, idx) => (
|
|
541
|
+
<p key={`body-line-${idx}`}>
|
|
542
|
+
{line}
|
|
543
|
+
<br />
|
|
544
|
+
</p>
|
|
545
|
+
))}
|
|
546
|
+
</>
|
|
547
|
+
)}
|
|
548
|
+
</>
|
|
549
|
+
),
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
const FallbackRenderer = () => (
|
|
553
|
+
<>
|
|
554
|
+
{originalUrl && (
|
|
555
|
+
<div>
|
|
556
|
+
<BmImageChat state={state} src={originalUrl} {...rest} />
|
|
557
|
+
</div>
|
|
558
|
+
)}
|
|
559
|
+
|
|
560
|
+
{caption && (
|
|
561
|
+
<>
|
|
562
|
+
{caption?.split('\n').map((line, idx) => (
|
|
563
|
+
<div>
|
|
564
|
+
<p key={`content-line-${idx}`}>
|
|
565
|
+
{line}
|
|
566
|
+
<br />
|
|
567
|
+
</p>
|
|
568
|
+
</div>
|
|
569
|
+
))}
|
|
570
|
+
</>
|
|
571
|
+
)}
|
|
572
|
+
</>
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
const ConnectorRenderer = renderers[connector] || FallbackRenderer;
|
|
576
|
+
return (
|
|
577
|
+
<Messages type={type} state={state} isInteractive={isInteractive} isImg>
|
|
578
|
+
<ConnectorRenderer />
|
|
579
|
+
</Messages>
|
|
580
|
+
);
|
|
581
|
+
};
|
|
520
582
|
const ProductDetailRender = ({ type, state, header, body, isInteractive }) => {
|
|
521
583
|
return (
|
|
522
584
|
<>
|
|
@@ -820,6 +882,14 @@ BmChat.Details = ({
|
|
|
820
882
|
state={state}
|
|
821
883
|
connector={metadata.connector}
|
|
822
884
|
/>
|
|
885
|
+
) : metadata.message.type === 'image' ? (
|
|
886
|
+
<ImageRender
|
|
887
|
+
isInteractive
|
|
888
|
+
{...metadata.message}
|
|
889
|
+
type={type}
|
|
890
|
+
state={state}
|
|
891
|
+
connector={metadata?.connector}
|
|
892
|
+
/>
|
|
823
893
|
) : (
|
|
824
894
|
<Messages metadata={metadata} state={state}>
|
|
825
895
|
{metadata.message.text}
|
|
@@ -865,6 +935,14 @@ BmChat.Details = ({
|
|
|
865
935
|
connector={children?.connector}
|
|
866
936
|
/>
|
|
867
937
|
)}
|
|
938
|
+
{children.message.type === 'image' && (
|
|
939
|
+
<ImageRender
|
|
940
|
+
{...children.message}
|
|
941
|
+
type={type}
|
|
942
|
+
state={state}
|
|
943
|
+
connector={children?.connector}
|
|
944
|
+
/>
|
|
945
|
+
)}
|
|
868
946
|
</>
|
|
869
947
|
) : type === 'pdf' ? (
|
|
870
948
|
<>
|