Upgraded to latest AdaptiveCards

This commit is contained in:
Hugo Bernier 2020-08-24 23:10:55 -04:00
parent b5f0257a2e
commit ec01cea5bf
6 changed files with 131 additions and 23 deletions

View File

@ -5,7 +5,7 @@
"title": "Adaptive Card Viewer",
"iconPath": "assets/adaptive-cards.png",
"id": "9b520d32-ce30-4ffa-bf38-5d888e65c782",
"version": "1.0.0.0",
"version": "2.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false
},

View File

@ -1099,6 +1099,11 @@
"@microsoft/node-core-library": "3.15.1"
}
},
"@microsoft/recognizers-text-data-types-timex-expression": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@microsoft/recognizers-text-data-types-timex-expression/-/recognizers-text-data-types-timex-expression-1.1.4.tgz",
"integrity": "sha512-2vICaEJfV9EpaDKs5P1PLAEs+WpNqrtpkl7CLsmc5gKmxgpQtsojG4tk6km5JRKg1mYuLV5ZzJ/65oOEeyTMvQ=="
},
"@microsoft/rush-lib": {
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@microsoft/rush-lib/-/rush-lib-5.15.1.tgz",
@ -2470,6 +2475,11 @@
"integrity": "sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ==",
"dev": true
},
"@types/atob-lite": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/atob-lite/-/atob-lite-2.0.0.tgz",
"integrity": "sha512-7bjymPR7Ffa1/L3HskkaxMgTQDtwFObbISzHm9g3T12VyD89IiHS3BBVojlQHyZRiIilzdh0WT1gwwgyyBtLGQ=="
},
"@types/chai": {
"version": "3.4.34",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-3.4.34.tgz",
@ -2572,6 +2582,11 @@
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.117.tgz",
"integrity": "sha512-xyf2m6tRbz8qQKcxYZa7PA4SllYcay+eh25DN3jmNYY6gSTL7Htc/bttVdkqj2wfJGbeWlQiX8pIyJpKU+tubw=="
},
"@types/lru-cache": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.0.tgz",
"integrity": "sha512-RaE0B+14ToE4l6UqdarKPnXwVDuigfFv+5j9Dze/Nqr23yyuqdNvzcZi3xB+3Agvi5R4EOgAksfv3lXX4vBt9w=="
},
"@types/merge2": {
"version": "0.3.29",
"resolved": "https://registry.npmjs.org/@types/merge2/-/merge2-0.3.29.tgz",
@ -2599,6 +2614,14 @@
"integrity": "sha1-jBiPbjTC58Px0BJ9kI1aNuWmDck=",
"dev": true
},
"@types/moment-timezone": {
"version": "0.5.30",
"resolved": "https://registry.npmjs.org/@types/moment-timezone/-/moment-timezone-0.5.30.tgz",
"integrity": "sha512-aDVfCsjYnAQaV/E9Qc24C5Njx1CoDjXsEgkxtp9NyXDpYu4CCbmclb6QhWloS9UTU/8YROUEEdEkWI0D7DxnKg==",
"requires": {
"moment-timezone": "*"
}
},
"@types/mz": {
"version": "0.0.32",
"resolved": "https://registry.npmjs.org/@types/mz/-/mz-0.0.32.tgz",
@ -2881,6 +2904,11 @@
"@types/node": "*"
}
},
"@types/xmldom": {
"version": "0.1.30",
"resolved": "https://registry.npmjs.org/@types/xmldom/-/xmldom-0.1.30.tgz",
"integrity": "sha512-edqgAFXMEtVvaBZ3YnhamvmrHjoYpuxETmnb0lbTZmf/dXpAsO9ZKotUO4K2rn2SIZBDFCMOuA7fOe0H6dRZcA=="
},
"@types/yargs": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-0.0.34.tgz",
@ -3344,10 +3372,55 @@
"resolved": "https://registry.npmjs.org/adal-angular/-/adal-angular-1.0.16.tgz",
"integrity": "sha1-4rwxvHEqr/ugU6pN1GvITrXSCQ8="
},
"adaptive-expressions": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/adaptive-expressions/-/adaptive-expressions-4.10.1.tgz",
"integrity": "sha512-E3VJN71HdftBzUDRFqSiwXPNq3jJkiCQBmLQRRyxHy+LDuWXrfSJhtlnvAyIViKpshYIaRXGO5bnnm1kelZpIw==",
"requires": {
"@microsoft/recognizers-text-data-types-timex-expression": "1.1.4",
"@types/atob-lite": "^2.0.0",
"@types/lru-cache": "^5.1.0",
"@types/moment-timezone": "^0.5.13",
"@types/xmldom": "^0.1.29",
"antlr4ts": "0.5.0-alpha.3",
"atob-lite": "^2.0.0",
"big-integer": "^1.6.48",
"jspath": "^0.4.0",
"lodash": "^4.17.19",
"lru-cache": "^5.1.1",
"moment": "^2.25.1",
"moment-timezone": "^0.5.28"
},
"dependencies": {
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
"lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
"integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
"requires": {
"yallist": "^3.0.2"
}
},
"moment": {
"version": "2.27.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz",
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ=="
},
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
}
}
},
"adaptivecards": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/adaptivecards/-/adaptivecards-1.2.5.tgz",
"integrity": "sha512-Rj+QK0qtBOfLGy3ClXylKxL4ze/a6mtPiJL7Ctjyc1Uso9O1x/LAAu49F36ZQbgAa8vWkKW91RKcwBBOxk3HDg=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/adaptivecards/-/adaptivecards-1.2.6.tgz",
"integrity": "sha512-/l34rvdRzQ20QdGLk+awRUotexu3N4Ih3O0qR8cM+2wWe0pggvWhmFdwVFmM+YgIS5pWtl2u7XAJynUaFIQAIw=="
},
"adaptivecards-fabric": {
"version": "1.0.4",
@ -3355,9 +3428,12 @@
"integrity": "sha512-ovjp0f6xfzEBdTXVpBwNTovxjM3S7q/aJe39F58Ybe1+AO+warRFdpIT5v1HcxBwYoDsnllwo9U9Ne52TcL96A=="
},
"adaptivecards-templating": {
"version": "0.1.1-alpha.1",
"resolved": "https://registry.npmjs.org/adaptivecards-templating/-/adaptivecards-templating-0.1.1-alpha.1.tgz",
"integrity": "sha512-pK34y5tcqmtcUZaaEK1EgrTLJX8yq6RYc2hp3x/IsLdDZm6pFGWliYD8pAQnJdyvblpxV82XTnAMhnBw0HUi7A=="
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/adaptivecards-templating/-/adaptivecards-templating-1.1.0.tgz",
"integrity": "sha512-yaEJibT/DAg/184tJyphDAs3EUY2XCSAs753TPrrOl3VJ5E367XQoG/ywTnfOZsAiz6Jf/HGBYTv55hFXVN0KQ==",
"requires": {
"adaptive-expressions": "^4.9.2"
}
},
"agent-base": {
"version": "4.3.0",
@ -3482,6 +3558,11 @@
"integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=",
"dev": true
},
"antlr4ts": {
"version": "0.5.0-alpha.3",
"resolved": "https://registry.npmjs.org/antlr4ts/-/antlr4ts-0.5.0-alpha.3.tgz",
"integrity": "sha512-La89tKkGcHFIVuruv4Bm1esc3zLmES2NOTEwwNS1pudz+zx/0FNqQeUu9p48i9/QHKPVqjN87LB+q3buTg7oDQ=="
},
"any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
@ -3846,6 +3927,11 @@
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true
},
"atob-lite": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
"integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY="
},
"autoprefixer": {
"version": "9.1.5",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.1.5.tgz",
@ -4262,6 +4348,11 @@
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
"dev": true
},
"big-integer": {
"version": "1.6.48",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz",
"integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w=="
},
"big.js": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz",
@ -7348,7 +7439,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -7765,7 +7857,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -7821,6 +7914,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -7864,12 +7958,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@ -11729,6 +11825,11 @@
"integrity": "sha1-XAxWhRBxYOcv50ib3eoLRMK8Z70=",
"dev": true
},
"jspath": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/jspath/-/jspath-0.4.0.tgz",
"integrity": "sha512-2/R8wkot8NCXrppBT/onp+4mcAUAZqtPxsW6aSJU3hrFAVqKqtFYcat2XJZ7inN4RtATUxfv0UQSYOmvJKiIGA=="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -12562,6 +12663,14 @@
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"moment-timezone": {
"version": "0.5.31",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz",
"integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==",
"requires": {
"moment": ">= 2.9.0"
}
},
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "react-adaptivecards-hooks",
"version": "0.0.1",
"version": "2.0.0",
"private": true,
"main": "lib/index.js",
"engines": {
@ -24,9 +24,9 @@
"@types/react": "16.8.8",
"@types/react-dom": "16.8.3",
"@types/webpack-env": "1.13.1",
"adaptivecards": "^1.2.5",
"adaptivecards": "^1.2.6",
"adaptivecards-fabric": "^1.0.4",
"adaptivecards-templating": "^0.1.1-alpha.1",
"adaptivecards-templating": "1.1.0",
"markdown-it": "^10.0.0",
"office-ui-fabric-react": "6.189.2",
"react": "16.8.5",

View File

@ -69,7 +69,7 @@ export class AdaptiveCard extends React.Component<IAdaptiveCardProps, IAdaptiveC
}
let errors: Array<IValidationError> = [];
let card: {};
let card: any;
if (this.props.data && this.props.useTemplating) {
// Define a template payload
@ -77,16 +77,18 @@ export class AdaptiveCard extends React.Component<IAdaptiveCardProps, IAdaptiveC
try {
templatePayload = JSON.parse(this.props.template);
} catch (error) {
this._errorHandler(strings.TemplateJsonError + error);
console.error("Something went wrong with the template", error);
this._errorHandler(strings.TemplatingJsonError + error);
return;
}
// Create a Template instance from the template payload
var template = new ACData.Template(templatePayload);
// Create a data binding context, and set its $root property to the
// data object to bind the template to
var context = new ACData.EvaluationContext();
var context: any = {
"$root":{}
};
try {
context.$root = JSON.parse(this.props.data);
} catch (error) {

View File

@ -68,10 +68,6 @@ export default class AdaptiveCardViewerWebPart extends BaseClientSideWebPart <IA
return Version.parse('1.0');
}
protected get disableReactivePropertyChanges(): boolean {
return true;
}
/**
* Instead of always loading the property field code editor every time the web part is loaded,
* we load it dynamically only when we need to display the property pane.

View File

@ -36,6 +36,7 @@ declare interface IAdaptiveCardViewerWebPartStrings {
AdaptiveTemplatingEnd: string;
TemplateJsonError: string;
DataJsonError: string;
TemplatingJsonError: string;
}
declare module 'AdaptiveCardViewerWebPartStrings' {