bibot 1.0.21 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/component/Avatar.d.ts +1 -0
- package/dist/component/Icons.d.ts +4 -1
- package/dist/index.js +46 -55
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +46 -55
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
@@ -3517,64 +3517,49 @@ var getRemoteClientChatBubbleConfig = function getRemoteClientChatBubbleConfig(p
|
|
3517
3517
|
return Promise.reject(e);
|
3518
3518
|
}
|
3519
3519
|
};
|
3520
|
+
var handleRetries = function handleRetries(data, attempt) {
|
3521
|
+
try {
|
3522
|
+
var maxAttempts = 30;
|
3523
|
+
var delay = 10000;
|
3524
|
+
if (attempt >= maxAttempts) {
|
3525
|
+
return Promise.resolve("Sorry this is taking longer than usual. Please try again later");
|
3526
|
+
}
|
3527
|
+
return Promise.resolve(new Promise(function (resolve) {
|
3528
|
+
return setTimeout(resolve, delay);
|
3529
|
+
})).then(function () {
|
3530
|
+
return _catch(function () {
|
3531
|
+
return Promise.resolve(askTimedOutBiBot(_extends({}, data, {
|
3532
|
+
tries: attempt + 1
|
3533
|
+
}))).then(function (message) {
|
3534
|
+
if (message === defaultSlacker) {
|
3535
|
+
return Promise.resolve(handleRetries(data, attempt + 1));
|
3536
|
+
} else {
|
3537
|
+
return message;
|
3538
|
+
}
|
3539
|
+
});
|
3540
|
+
}, function (error) {
|
3541
|
+
return error.message;
|
3542
|
+
});
|
3543
|
+
});
|
3544
|
+
} catch (e) {
|
3545
|
+
return Promise.reject(e);
|
3546
|
+
}
|
3547
|
+
};
|
3520
3548
|
var askBiBot = function askBiBot(data) {
|
3521
3549
|
try {
|
3522
3550
|
return Promise.resolve(_catch(function () {
|
3523
3551
|
var path = "" + domain.inference + resources.q;
|
3524
3552
|
return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
|
3525
3553
|
if (response.data.message === defaultSlacker) {
|
3526
|
-
return
|
3527
|
-
return Promise.resolve(new Promise(function (resolve) {
|
3528
|
-
return setTimeout(resolve, 6000);
|
3529
|
-
})).then(function () {
|
3530
|
-
return Promise.resolve(askTimedOutBiBot(_extends({}, data, {
|
3531
|
-
tries: 2
|
3532
|
-
})));
|
3533
|
-
});
|
3534
|
-
}, function (error2) {
|
3535
|
-
if (error2.code === 'ECONNABORTED' || error2.message.includes('Endpoint request timed out')) {
|
3536
|
-
return _catch(function () {
|
3537
|
-
return Promise.resolve(new Promise(function (resolve) {
|
3538
|
-
return setTimeout(resolve, 6000);
|
3539
|
-
})).then(function () {
|
3540
|
-
return Promise.resolve(askTimedOutBiBot(_extends({}, data, {
|
3541
|
-
tries: 3
|
3542
|
-
})));
|
3543
|
-
});
|
3544
|
-
}, function (error3) {
|
3545
|
-
return error3.message;
|
3546
|
-
});
|
3547
|
-
} else {
|
3548
|
-
return error2.message;
|
3549
|
-
}
|
3550
|
-
});
|
3554
|
+
return Promise.resolve(handleRetries(data, 1));
|
3551
3555
|
} else {
|
3552
3556
|
return response.data.message;
|
3553
3557
|
}
|
3554
3558
|
});
|
3555
3559
|
}, function (error1) {
|
3560
|
+
console.log('This is the error1 from the endpoint on the 1st try:', error1);
|
3556
3561
|
console.log(error1.message);
|
3557
|
-
|
3558
|
-
return _catch(function () {
|
3559
|
-
return Promise.resolve(askTimedOutBiBot(_extends({}, data, {
|
3560
|
-
tries: 2
|
3561
|
-
})));
|
3562
|
-
}, function (error2) {
|
3563
|
-
if (error2.code === 'ECONNABORTED' || error2.message.includes('Endpoint request timed out')) {
|
3564
|
-
return _catch(function () {
|
3565
|
-
return Promise.resolve(askTimedOutBiBot(_extends({}, data, {
|
3566
|
-
tries: 3
|
3567
|
-
})));
|
3568
|
-
}, function (error3) {
|
3569
|
-
return error3.message;
|
3570
|
-
});
|
3571
|
-
} else {
|
3572
|
-
return error2.message;
|
3573
|
-
}
|
3574
|
-
});
|
3575
|
-
} else {
|
3576
|
-
return error1.message;
|
3577
|
-
}
|
3562
|
+
return error1.message;
|
3578
3563
|
}));
|
3579
3564
|
} catch (e) {
|
3580
3565
|
return Promise.reject(e);
|
@@ -3596,7 +3581,7 @@ var askTimedOutBiBot = function askTimedOutBiBot(data) {
|
|
3596
3581
|
return Promise.reject(e);
|
3597
3582
|
}
|
3598
3583
|
};
|
3599
|
-
var defaultSlacker = "
|
3584
|
+
var defaultSlacker = "BiBot_Retry_Later";
|
3600
3585
|
var pluginAxiosInstance = createPluginAxiosInstance();
|
3601
3586
|
|
3602
3587
|
var useBiBotChatBot = function useBiBotChatBot(_ref) {
|
@@ -3741,7 +3726,8 @@ var useBiBotChatBot = function useBiBotChatBot(_ref) {
|
|
3741
3726
|
|
3742
3727
|
var styles = {"chat-bubble":"_31at8","chat-toggle":"_1tkAI","chat-window":"_2vdWr","chat-header":"_1ngBE","message-list":"_27MrF","message":"_3XbXj","user":"_3l8QX","bot":"_1MqZg","loader":"_3mrL1","l5":"_25GkQ","input-area":"_6V_kl","loading-bubbles":"_1XTQS","bubble":"_32ZvK","bounce":"_V8DEW"};
|
3743
3728
|
|
3744
|
-
function SendMessageIcon() {
|
3729
|
+
function SendMessageIcon(_ref) {
|
3730
|
+
var color = _ref.color;
|
3745
3731
|
return React__default.createElement("svg", {
|
3746
3732
|
xmlns: 'http://www.w3.org/2000/svg',
|
3747
3733
|
className: 'icon icon-tabler icon-tabler-send-2',
|
@@ -3749,7 +3735,7 @@ function SendMessageIcon() {
|
|
3749
3735
|
height: '24',
|
3750
3736
|
viewBox: '0 0 24 24',
|
3751
3737
|
"stroke-width": '1.5',
|
3752
|
-
stroke:
|
3738
|
+
stroke: color,
|
3753
3739
|
fill: 'none',
|
3754
3740
|
"stroke-linecap": 'round',
|
3755
3741
|
"stroke-linejoin": 'round'
|
@@ -3846,7 +3832,8 @@ var Avatar = function Avatar(_ref) {
|
|
3846
3832
|
var source = _ref.source,
|
3847
3833
|
height = _ref.height,
|
3848
3834
|
width = _ref.width,
|
3849
|
-
indicator = _ref.indicator
|
3835
|
+
indicator = _ref.indicator,
|
3836
|
+
borderColor = _ref.borderColor;
|
3850
3837
|
return React__default.createElement("div", {
|
3851
3838
|
style: {
|
3852
3839
|
width: width
|
@@ -3854,7 +3841,7 @@ var Avatar = function Avatar(_ref) {
|
|
3854
3841
|
}, React__default.createElement("div", {
|
3855
3842
|
style: {
|
3856
3843
|
backgroundColor: 'transparent',
|
3857
|
-
border:
|
3844
|
+
border: "1px solid " + borderColor,
|
3858
3845
|
height: height,
|
3859
3846
|
width: width,
|
3860
3847
|
borderRadius: '50%',
|
@@ -3951,7 +3938,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
3951
3938
|
style: {
|
3952
3939
|
backgroundColor: '#dfdfdf',
|
3953
3940
|
position: 'absolute',
|
3954
|
-
bottom: '
|
3941
|
+
bottom: '60px',
|
3955
3942
|
right: '25px',
|
3956
3943
|
width: 350,
|
3957
3944
|
height: 500,
|
@@ -3981,6 +3968,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
3981
3968
|
fontWeight: 'bold'
|
3982
3969
|
}
|
3983
3970
|
}, createElement(Avatar, {
|
3971
|
+
borderColor: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
|
3984
3972
|
indicator: isOnline ? 'green' : '#dedede',
|
3985
3973
|
width: '40px',
|
3986
3974
|
height: '40px',
|
@@ -4040,6 +4028,7 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
4040
4028
|
display: 'flex'
|
4041
4029
|
}
|
4042
4030
|
}, createElement(Avatar, {
|
4031
|
+
borderColor: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color,
|
4043
4032
|
width: '20px',
|
4044
4033
|
height: '20px',
|
4045
4034
|
source: chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.logo_url
|
@@ -4074,11 +4063,11 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
4074
4063
|
style: {
|
4075
4064
|
display: 'flex',
|
4076
4065
|
alignItems: 'center',
|
4077
|
-
borderTop: '1px solid #
|
4066
|
+
borderTop: '1px solid #b6b6b6',
|
4078
4067
|
padding: 10,
|
4079
4068
|
borderBottomLeftRadius: 8,
|
4080
4069
|
borderBottomRightRadius: 8,
|
4081
|
-
backgroundColor: '#
|
4070
|
+
backgroundColor: '#dedede'
|
4082
4071
|
}
|
4083
4072
|
}, createElement("input", {
|
4084
4073
|
style: {
|
@@ -4105,7 +4094,9 @@ var ChatBubbleBiBot = function ChatBubbleBiBot(_ref2) {
|
|
4105
4094
|
cursor: 'pointer'
|
4106
4095
|
},
|
4107
4096
|
onClick: sendInputInquiry
|
4108
|
-
}, createElement(SendMessageIcon,
|
4097
|
+
}, createElement(SendMessageIcon, {
|
4098
|
+
color: isLoading ? '#fff' : chatBubbleConfig === null || chatBubbleConfig === void 0 ? void 0 : chatBubbleConfig.color
|
4099
|
+
})))), createElement("button", {
|
4109
4100
|
onClick: toggleChat,
|
4110
4101
|
className: styles['chat-toggle'],
|
4111
4102
|
style: {
|