No tópico abaixo foi questionado sobre definir contato, mas foi informado que não é possível considerando que o método withAuth
usado primeiramente é o GUEST
e não DEV_AUTH
Seria possível usar a implementação abaixo:
/*jshint esversion: 6 */
(function () {
//window.onload = function () {
var blipClient = undefined;
blipClient = new BlipChat()
.withAppKey('KEY')
.withButton({"color":"#3a183d"})
.withEventHandler(BlipChat.ENTER_EVENT, function () {
console.log('BLiPChat Event Enter');
if (browsingContext.Common.Shopper.IsAuthenticated) {
console.log('LinxCore IsAuthenticated');
blipClient.sendCommand({
id: '1',
to: '[email protected]',
method: 'set',
uri: '/contacts',
type: 'application/vnd.lime.contact+json',
resource: {
name: browsingContext.Common.Shopper.Name,
fullName: browsingContext.Common.Shopper.Name + ' ' + browsingContext.Common.Shopper.SurName,
gender: browsingContext.Common.Customer.Gender,
email: browsingContext.Common.Shopper.Email,
phoneNumber: browsingContext.Common.Customer.ExtendedProperties.Phone.Value,
extras: {
CustomerID: browsingContext.Common.Customer.CustomerID
}
}
});
}
})
//.withoutHistory()
;
blipClient.build();
//};
})();
Foi utilizado as seguintes documentações:
BLiP Chat - Widget - Send Command
Extensions - API Reference - Contacts
Apresentou o erro no console
Uncaught (in promise) Error: Cannot send in the 'authenticating' state
at e.t.sendCommand (lime.min.js:1)
at t.value (blip-sdk.js:474)
at Function.e.processCommand (CommandProcessor.ts:26)
at Function.e.get (AccountCommandProcessor.ts:8)
at a.<anonymous> (App.vue?eb80:223)
at WebView.vue?8e5b:27
at Object.next (WebView.vue?8e5b:27)
at WebView.vue?8e5b:27
at new Promise (<anonymous>)
at ga (WebView.vue?8e5b:27)
at a.setupThread (App.vue?eb80:223)
at a.<anonymous> (App.vue?eb80:343)
at WebView.vue?8e5b:27
at Object.next (WebView.vue?8e5b:27)
at t (WebView.vue?8e5b:27)