@xapp/stentor-gbm 1.77.2 → 1.78.0
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.
- package/lib/Guards.d.ts +13 -0
- package/lib/Guards.js +23 -0
- package/lib/Guards.js.map +1 -0
- package/package.json +3 -3
package/lib/Guards.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! Copyright (c) 2022, XAPPmedia */
|
|
2
|
+
import { UserMessage } from "./models";
|
|
3
|
+
/**
|
|
4
|
+
* This is for the channel selector
|
|
5
|
+
*
|
|
6
|
+
* @param requestBody
|
|
7
|
+
*/
|
|
8
|
+
export declare function isGbmPayload(requestBody: UserMessage): requestBody is UserMessage;
|
|
9
|
+
/**
|
|
10
|
+
* This tells if it's a message for the bot
|
|
11
|
+
* @param requestBody
|
|
12
|
+
*/
|
|
13
|
+
export declare function isGbmMessage(requestBody: UserMessage): requestBody is UserMessage;
|
package/lib/Guards.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGbmMessage = exports.isGbmPayload = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This is for the channel selector
|
|
6
|
+
*
|
|
7
|
+
* @param requestBody
|
|
8
|
+
*/
|
|
9
|
+
function isGbmPayload(requestBody) {
|
|
10
|
+
return !!requestBody.secret && !!requestBody.clientToken // verification
|
|
11
|
+
|| !!requestBody.agent && !!requestBody.sendTime && !!requestBody.requestId; // message
|
|
12
|
+
}
|
|
13
|
+
exports.isGbmPayload = isGbmPayload;
|
|
14
|
+
/**
|
|
15
|
+
* This tells if it's a message for the bot
|
|
16
|
+
* @param requestBody
|
|
17
|
+
*/
|
|
18
|
+
function isGbmMessage(requestBody) {
|
|
19
|
+
return !!requestBody.message || !!requestBody.suggestionResponse
|
|
20
|
+
|| !!requestBody.userStatus && !!requestBody.userStatus.requestedLiveAgent; // message
|
|
21
|
+
}
|
|
22
|
+
exports.isGbmMessage = isGbmMessage;
|
|
23
|
+
//# sourceMappingURL=Guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Guards.js","sourceRoot":"","sources":["../src/Guards.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,SAAgB,YAAY,CAAC,WAAwB;IACjD,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,eAAe;WACnE,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,UAAU;AAC7F,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,WAAwB;IACjD,OAAO,CAAC,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC,WAAW,CAAC,kBAAkB;WAC3D,CAAC,CAAC,WAAW,CAAC,UAAU,IAAI,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,UAAU;AAC5F,CAAC;AAHD,oCAGC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.78.0",
|
|
8
8
|
"description": "Google Business Messages channel for stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"stentor-locales": "1.71.0",
|
|
33
33
|
"stentor-logger": "1.71.0",
|
|
34
34
|
"stentor-media": "1.71.0",
|
|
35
|
-
"stentor-models": "1.
|
|
35
|
+
"stentor-models": "1.72.0",
|
|
36
36
|
"stentor-request": "1.71.0",
|
|
37
37
|
"stentor-response": "1.71.0",
|
|
38
38
|
"stentor-utils": "1.71.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"clean": "rm -rf ./lib/*",
|
|
63
63
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "7ad5a86334ecb7ae383da1aef801375cb9af71af"
|
|
66
66
|
}
|