@vraksha/bottender 1.6.1-beta.6 → 1.6.1-beta.8
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/dist/helpers.d.ts +3 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +17 -6
- package/dist/helpers.js.map +1 -1
- package/package.json +1 -1
package/dist/helpers.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export type ChannelContextType = {
|
|
|
16
16
|
[Channel.Whatsapp]: WhatsappContext;
|
|
17
17
|
[Channel.WhatsappBusiness]: WhatsappBusinessContext;
|
|
18
18
|
};
|
|
19
|
-
type PlatformAction<
|
|
20
|
-
export declare function withPlatformAction<C extends Channel, Result = void>(platform: C, platformAction:
|
|
21
|
-
export declare function withComposePlatformActions<Result = void>(
|
|
19
|
+
type PlatformAction<Result = void> = (ctx: Context<any, any>) => Promise<Result>;
|
|
20
|
+
export declare function withPlatformAction<C extends Channel, Result = void>(platform: C, platformAction: (ctx: ChannelContextType[C]) => Promise<Result>): Record<C, PlatformAction<Result>>;
|
|
21
|
+
export declare function withComposePlatformActions<Result = void>(channelActions: Partial<Record<Channel, PlatformAction<Result>>>, fallbackAction: PlatformAction<Result>): (context: Context<any, any>) => Promise<Result>;
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAC5D,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,eAAe,MAAM,4BAA4B,CAAC;AACzD,OAAO,uBAAuB,MAAM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AAK,CAAC,EAAE,YAAY,CAAC;IAC9B,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;IACpC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;CACvD,CAAC;AAIF,KAAK,cAAc,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEjF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,OAAO,EAAE,MAAM,GAAG,IAAI,EACjE,QAAQ,EAAE,CAAC,EACX,cAAc,EAAE,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GAC9D,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAGnC;AAED,wBAAgB,0BAA0B,CAAC,MAAM,GAAG,IAAI,EACtD,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAChE,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,GACrC,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CASjD"}
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.withComposePlatformActions = exports.withPlatformAction = void 0;
|
|
4
13
|
const types_1 = require("./types");
|
|
@@ -6,12 +15,14 @@ function withPlatformAction(platform, platformAction) {
|
|
|
6
15
|
return { [platform]: platformAction };
|
|
7
16
|
}
|
|
8
17
|
exports.withPlatformAction = withPlatformAction;
|
|
9
|
-
function withComposePlatformActions(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
function withComposePlatformActions(channelActions, fallbackAction) {
|
|
19
|
+
return (context) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const channelAction = channelActions[context.platform] || fallbackAction;
|
|
21
|
+
if (!channelAction) {
|
|
22
|
+
throw new Error(`No action found for channel: ${context.platform}`);
|
|
23
|
+
}
|
|
24
|
+
return channelAction(context);
|
|
25
|
+
});
|
|
15
26
|
}
|
|
16
27
|
exports.withComposePlatformActions = withComposePlatformActions;
|
|
17
28
|
//# sourceMappingURL=helpers.js.map
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,mCAAkC;AAiBlC,SAAgB,kBAAkB,CAChC,QAAW,EACX,cAA+D;IAG/D,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAS,CAAA;AAC9C,CAAC;AAND,gDAMC;AAED,SAAgB,0BAA0B,CACxC,cAAgE,EAChE,cAAsC;IAEpC,OAAO,CAAO,OAA0B,EAAE,EAAE;QACxC,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,QAAmB,CAAC,IAAI,cAAc,CAAC;QACpF,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,gCAAgC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;SACvE;QAED,OAAO,aAAa,CAAC,OAAc,CAAC,CAAC;IACzC,CAAC,CAAA,CAAA;AACL,CAAC;AAZD,gEAYC"}
|
package/package.json
CHANGED