mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
feat: Support card message postback event as widget event (#11133)
Fixes https://github.com/chatwoot/chatwoot/issues/5956 Fixes https://github.com/chatwoot/chatwoot/issues/1895
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getContrastingTextColor } from '@chatwoot/utils';
|
||||
import { IFrameHelper } from 'widget/helpers/utils';
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
props: {
|
||||
@@ -22,7 +24,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
// Do postback here
|
||||
if (this.action.type === 'postback') {
|
||||
// Send message to parent iframe
|
||||
if (IFrameHelper.isIFrame()) {
|
||||
IFrameHelper.sendMessage({
|
||||
event: 'postback',
|
||||
data: { payload: this.action.payload },
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user