essa função executa normalmente no vscode mas no blip nao funciona
function run(token) {
var base64Url = token.split('.').1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(
atob(base64)
.split('')
.map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join('')
);
const payload = JSON.parse(jsonPayload);
const currentTime = Math.floor(Date.now() / 1000);
return payload.exp < currentTime;
}
Erro :
{
"id": "fb749eeb-e9bb-4f33-8c2f-41902034c72a",
"inputActions": s
{
"order": 0,
"type": "TrackContactsJourney",
"parsedSettings": {
"previousStateId": "a97ddd64-3c9b-4279-bd6a-3913e982c9b0",
"previousStateName": "Reset Contact Variables",
"stateId": "fb749eeb-e9bb-4f33-8c2f-41902034c72a",
"stateName": "Token is Expired ?"
},
"continueOrError": false,
"timestamp": "2024-10-22T19:11:47.0111026+00:00",
"elapsedMilliseconds": 3,
"warning": null,
"error": null
},
{
"order": 0,
"type": "SetVariable",
"parsedSettings": {
"variable": "flowOrigin",
"value": "fb749eeb-e9bb-4f33-8c2f-41902034c72a"
},
"continueOrError": false,
"timestamp": "2024-10-22T19:11:47.0150077+00:00",
"elapsedMilliseconds": 4,
"warning": null,
"error": null
},
{
"order": 0,
"type": "SetVariable",
"parsedSettings": {
"variable": "flowOriginName",
"value": "Token is Expired ?"
},
"continueOrError": false,
"timestamp": "2024-10-22T19:11:47.0193499+00:00",
"elapsedMilliseconds": 5,
"warning": null,
"error": null
},
{
"order": 0,
"type": "ExecuteScript",
"parsedSettings": {
"function": "run",
"source": "function run(token) {\n\tvar base64Url = token.split('.')'1];\n\tvar base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n\tvar jsonPayload = decodeURIComponent(\n\t\tatob(base64)\n\t\t\t.split('')\n\t\t\t.map(function (c) {\n\t\t\t\treturn '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n\t\t\t})\n\t\t\t.join('')\n\t);\n\tconst payload = JSON.parse(jsonPayload);\n\tconst currentTime = Math.floor(Date.now() / 1000);\n\treturn payload.exp < currentTime;\n}",
"inputVariables": s
"contact.extras.userToken"
],
"outputVariable": "tokenIsExpired",
"LocalTimeZoneEnabled": false
},
"continueOrError": false,
"timestamp": "2024-10-22T19:11:47.0250183+00:00",
"elapsedMilliseconds": 26,
"warning": null,
"error": "Internal Server Error"
}
],
"outputActions": s],
"outputs": s],
"extensionData": {
"name": "Token is Expired ?"
},
"timestamp": "2024-10-22T19:11:47.0070862+00:00",
"elapsedMilliseconds": 44,
"warning": null,
"error": "Internal Server Error"
}
token :
Bearer eyJraWQiOiJLckl0VVNxVmhnUWFZcFcwS3pJWnlkRGtoU0tRM1wveVV5bFNrWEw5N2tQUT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIyYXZuZWI2dW4ybWNobm45NWRnYTU5NmMzYSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiY3JlZGl0XC9hZG1pbiIsImF1dGhfdGltZSI6MTcyOTYwNDU0OCwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMi5hbWF6b25hd3MuY29tXC91cy1lYXN0LTJfYjEwSExadEtUIiwiZXhwIjoxNzI5NjA4MTQ4LCJpYXQiOjE3Mjk2MDQ1NDgsInZlcnNpb24iOjIsImp0aSI6IjNmM2ZjNzgxLTNhMTUtNDJiZi04NzU2LWQ1Y2U3OWQzNWM1NiIsImNsaWVudF9pZCI6IjJhdm5lYjZ1bjJtY2hubjk1ZGdhNTk2YzNhIn0.CZ82R05X0jc1RsUqMsH0NsDMTpD7MBo1MpO4gMFzomDZDfDqWtTD7G7KAv_xqmypK3jrcBwl7SXK6qnFaXm70xtfOsz7QM1NQDshmqpplIdnnihg3qJgJU-aLC75pu8NIQSCbwZ_ZdXMDEQUtNt602EaDlA3D1N3DpmDzwgFEVvTBl1GtDFPg7xZwBhPtn43GIyz-dx57a0TOMAqBbivY-fGalriVm2e22xugvy8plhTqT_aZ4Fn4JZ1WuB0YgrvBCI40PHnCE1p9O5waY-MiGclkmGKvg9giWsfHyEaoLzUOvChaWwqb-JYC7OwOkHIp6RzybccD_O0q4pUDq6A9Q