Skip to content

Commit

Permalink
Merge pull request #19 from Doist/scottl/update-core-in-react
Browse files Browse the repository at this point in the history
chore: Updates core package usage in react package
  • Loading branch information
scottlovegrove authored Jul 21, 2022
2 parents 1207574 + 87f61d5 commit b0a0a09
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/ui-extensions-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@doist/ui-extensions-react",
"version": "3.1.6",
"version": "3.2.0",
"author": "Doist",
"license": "MIT",
"main": "dist/index.js",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"peerDependencies": {
"@doist/reactist": "^12.0.0",
"@doist/ui-extensions-core": "^3.1.4",
"@doist/ui-extensions-core": "^3.2.1",
"adaptivecards": "^2.9.0",
"react": ">=17"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ describe('useAdaptiveCardsConnection tests', () => {
const expected = 'hello'
getProcessRequestMock().mockImplementationOnce(() => {
return Promise.resolve({
card: {},
bridge: {
bridgeActionType: 'composer.append',
text: expected,
},
bridges: [
{
bridgeActionType: 'composer.append',
text: expected,
},
],
} as DoistCardResponse)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,20 @@ export function useAdaptiveCardsConnection({
token,
)

const { card, bridge, bridges } = response
const { card, bridges } = response

if (bridges) {
bridges.forEach((bridge: DoistCardBridge) => {
const callback = bridgeActionCallbacks[bridge.bridgeActionType]
callback?.(bridge)
})
} else if (bridge) {
const callback = bridgeActionCallbacks[bridge.bridgeActionType]
callback?.(bridge)
}

if (card) {
setCardData(card)
}

if (!card && !bridge) {
if (!card && !bridges) {
setError(
createError(version, new Error('No card or bridge data returned'), request),
)
Expand Down

0 comments on commit b0a0a09

Please sign in to comment.