@salutejs/scenario
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -48,8 +48,22 @@ "use strict"; | ||
return { | ||
appendBubble: function (bubble) { | ||
appendBubble: function (bubble, options) { | ||
if (options === void 0) { options = {}; } | ||
if (message.messageName !== types_1.NLPResponseType.ANSWER_TO_USER) { | ||
throw new Error('Wrong message type'); | ||
} | ||
message.payload.items.push({ bubble: { text: bubble, expand_policy: 'auto_expand' } }); | ||
var expand_policy = options.expand_policy, markdown = options.markdown; | ||
message.payload.items.push({ | ||
bubble: { | ||
text: bubble, | ||
expand_policy: expand_policy || 'auto_expand', | ||
markdown: typeof markdown === 'undefined' ? false : markdown, | ||
}, | ||
}); | ||
}, | ||
appendCard: function (card) { | ||
if (message.messageName !== types_1.NLPResponseType.ANSWER_TO_USER) { | ||
throw new Error('Wrong message type'); | ||
} | ||
message.payload.items.push({ card: card }); | ||
}, | ||
appendCommand: function (command) { | ||
@@ -97,3 +111,3 @@ if (message.messageName !== types_1.NLPResponseType.ANSWER_TO_USER) { | ||
runApp({ systemName: 'payment_app' }, { | ||
invoice_id: invoiceId, | ||
invoice_id: invoiceId.toString(), | ||
app_info: { | ||
@@ -100,0 +114,0 @@ projectId: req.payload.app_info.projectId, |
@@ -27,3 +27,4 @@ import { IntentsDict, SaluteRequest } from '@salutejs/types'; | ||
action: (expected: R['serverAction']['type']) => (req: R) => boolean; | ||
regexp: (re: RegExp) => (req: R) => boolean; | ||
}; | ||
//# sourceMappingURL=matchers.d.ts.map |
@@ -47,2 +47,13 @@ "use strict"; | ||
}; }; | ||
var regexp = function (re) { return function (req) { | ||
var _a; | ||
var result = re.exec((_a = req.message) === null || _a === void 0 ? void 0 : _a.original_text); | ||
if (result === null) { | ||
return false; | ||
} | ||
if (result.groups) { | ||
Object.assign(req.variables, result.groups); | ||
} | ||
return true; | ||
}; }; | ||
var match = function () { | ||
@@ -61,4 +72,4 @@ var matchers = []; | ||
}; | ||
return { match: match, intent: intent, text: text, state: state, selectItem: selectItem, selectItems: selectItems, action: action }; | ||
return { match: match, intent: intent, text: text, state: state, selectItem: selectItem, selectItems: selectItems, action: action, regexp: regexp }; | ||
} | ||
exports.createMatchers = createMatchers; |
@@ -15,3 +15,3 @@ "use strict"; | ||
'Content-Type': 'application/json', | ||
Authorization: "Bearer " + process.env.PAYMENT_TOKEN, | ||
Authorization: "Bearer " + process.env.SMARTPAY_TOKEN, | ||
}, | ||
@@ -18,0 +18,0 @@ method: method || 'get', |
@@ -296,7 +296,7 @@ /** Тип оплаты счета */ | ||
/** Код ответа */ | ||
code: number; | ||
code?: number; | ||
/** Блок, содержащий описание ошибки / ответа */ | ||
error: PaymentError; | ||
/** ID зарегистрированной оплаты */ | ||
invoice_id: string; | ||
invoice_id?: number; | ||
} | ||
@@ -303,0 +303,0 @@ export declare enum PayDialogStatuses { |
{ | ||
"name": "@salutejs/scenario", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Tiny helpers to make scenario for Salute family", | ||
@@ -35,6 +35,6 @@ "author": "SberDevices Frontend Team <sberdevices.frontend@gmail.com>", | ||
"dependencies": { | ||
"@salutejs/types": "0.3.0", | ||
"@salutejs/types": "0.4.0", | ||
"node-fetch": "2.6.1" | ||
}, | ||
"gitHead": "2553b4888e6c6c9aa67b74de7e2e6b6a6859c433" | ||
"gitHead": "38c3e2badbb38a4d31bbe64341bb2faf77e385f2" | ||
} |
@@ -105,3 +105,3 @@ # @salutejs/scenario | ||
Чтобы оплата работала, необходимо добавить переменную PAYMENT_TOKEN в environment. | ||
Чтобы оплата работала, необходимо добавить переменную `SMARTPAEY_TOKEN` в environment. | ||
@@ -115,3 +115,3 @@ ### Инициация диалога оплаты | ||
```ts | ||
import { createInvoice } from '@salutejs/payments'; | ||
import { createInvoice } from '@salutejs/scenario'; | ||
import { SaluteHandler } from '@salutejs/types'; | ||
@@ -118,0 +118,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
157731
1469
+ Added@salutejs/types@0.4.0(transitive)
- Removed@salutejs/types@0.3.0(transitive)
Updated@salutejs/types@0.4.0