-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement mobile Intercom using vuex store (#3424)
* Intercom mobile implemented using vuex store * changelog * Lint * Mutations * Fix test * Intercom store module testing * Better code coverage * Cleanup * Fix * Cleanup * Mock capacitor-intercom * Cleanup
- Loading branch information
Showing
13 changed files
with
118 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[Added] [#3423](https://github.com/cosmos/lunie/issues/3423) Implement mobile Intercom using vuex store @mariopino |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import config from "src/../config" | ||
import { Intercom } from "capacitor-intercom" | ||
|
||
let intercom = null | ||
/* istanbul ignore next */ | ||
if (config.mobileApp) { | ||
intercom = new Intercom() | ||
intercom.registerIdentifiedUser({ | ||
userId: `lunie-app-${Math.floor(Math.random() * 10000 + 1).toString()}` | ||
}) | ||
} | ||
|
||
export default () => { | ||
return { | ||
state: { | ||
intercom | ||
}, | ||
actions: { | ||
displayMessenger({ state }) { | ||
state.intercom.displayMessenger() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import recoverModule from "src/vuex/modules/intercom.js" | ||
jest.mock(`capacitor-intercom`, () => ({})) | ||
|
||
describe(`Module: Intercom`, () => { | ||
let module, state, actions, node | ||
|
||
const intercom = { | ||
displayMessenger: jest.fn() | ||
} | ||
|
||
const spydisplayMessenger = jest.spyOn(intercom, "displayMessenger") | ||
|
||
beforeEach(() => { | ||
node = {} | ||
module = recoverModule({ node }) | ||
actions = module.actions | ||
state = { intercom } | ||
}) | ||
|
||
describe(`actions`, () => { | ||
it(`should display Intercom Messenger`, async () => { | ||
await actions.displayMessenger({ state }) | ||
expect(spydisplayMessenger).toHaveBeenCalled() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters