Skip to content

Commit

Permalink
Merge pull request #129 from aplijobs/fix/newConv
Browse files Browse the repository at this point in the history
Fix | enforce event trigger
  • Loading branch information
cmm-apli authored Mar 12, 2024
2 parents d265334 + 979c465 commit c074777
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/javascript/widget/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

<script>
import configMixin from '../mixins/configMixin';
import {
setCustomAttributes,
} from 'widget/api/conversation';
import TeamAvailability from 'widget/components/TeamAvailability';
import { mapGetters, mapActions } from 'vuex';
import routerMixin from 'widget/mixins/routerMixin';
Expand Down Expand Up @@ -46,10 +49,15 @@ export default {
...mapActions('conversation', [
'clearConversations',
]),
startConversation() {
async startConversation() {
const ref = new URLSearchParams(window.location.search).get('referral');
if (ref) {
this.clearConversations();
try {
await setCustomAttributes({"ref": ref});
this.clearConversations();
} catch (e) {
// Ignore error
}
} else if (this.preChatFormEnabled && !this.conversationSize) {
return this.replaceRoute('prechat-form');
}
Expand Down

0 comments on commit c074777

Please sign in to comment.