Skip to content

Commit 357f479

Browse files
committed
Merge branch 'master' into feature/local-styles
2 parents 52ecd36 + 6c21786 commit 357f479

File tree

11 files changed

+595
-656
lines changed

11 files changed

+595
-656
lines changed

package-lock.json

Lines changed: 392 additions & 624 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apim-developer-portal",
3-
"version": "2.22.0",
3+
"version": "2.23.0",
44
"description": "API management developer portal",
55
"author": "Microsoft",
66
"license": "MIT",
@@ -37,10 +37,10 @@
3737
"@types/knockout.validation": "0.0.38",
3838
"@types/mime": "^3.0.1",
3939
"@types/mocha": "10.0.1",
40-
"@types/node": "^18.15.0",
40+
"@types/node": "^18.15.3",
4141
"@types/puppeteer": "5.4.7",
42-
"@typescript-eslint/eslint-plugin": "^5.54.1",
43-
"@typescript-eslint/parser": "^5.54.1",
42+
"@typescript-eslint/eslint-plugin": "^5.55.0",
43+
"@typescript-eslint/parser": "^5.55.0",
4444
"autoprefixer": "^10.4.14",
4545
"buffer": "^6.0.3",
4646
"chai": "^4.3.7",
@@ -54,21 +54,21 @@
5454
"mocha": "^10.2.0",
5555
"path": "^0.12.7",
5656
"postcss-loader": "^7.0.2",
57-
"puppeteer": "19.7.4",
57+
"puppeteer": "19.7.5",
5858
"querystring-es3": "^0.2.1",
5959
"raw-loader": "^4.0.2",
60-
"sass": "^1.59.1",
60+
"sass": "^1.59.3",
6161
"sass-loader": "^13.2.0",
6262
"stream-browserify": "^3.0.0",
63-
"style-loader": "^3.3.1",
63+
"style-loader": "^3.3.2",
6464
"terser-webpack-plugin": "^5.3.7",
6565
"ts-loader": "^9.4.2",
6666
"ts-node": "10.9.1",
6767
"typescript": "^4.9.5",
6868
"url-loader": "^4.1.1",
6969
"webpack": "5.76.1",
7070
"webpack-cli": "5.0.1",
71-
"webpack-dev-server": "4.11.1",
71+
"webpack-dev-server": "4.12.0",
7272
"webpack-merge": "5.8.0"
7373
},
7474
"dependencies": {
@@ -78,17 +78,17 @@
7878
"@braintree/sanitize-url": "6.0.2",
7979
"@microsoft/applicationinsights-web": "^2.8.11",
8080
"@monaco-editor/loader": "^1.3.2",
81-
"@paperbits/azure": "0.1.569",
82-
"@paperbits/common": "0.1.569",
83-
"@paperbits/core": "0.1.569",
84-
"@paperbits/forms": "0.1.569",
85-
"@paperbits/prosemirror": "0.1.569",
86-
"@paperbits/styles": "0.1.569",
81+
"@paperbits/azure": "0.1.580",
82+
"@paperbits/common": "0.1.580",
83+
"@paperbits/core": "0.1.580",
84+
"@paperbits/forms": "0.1.580",
85+
"@paperbits/prosemirror": "0.1.580",
86+
"@paperbits/styles": "0.1.580",
8787
"@webcomponents/custom-elements": "1.5.1",
8888
"@webcomponents/shadydom": "^1.10.0",
8989
"client-oauth2": "4.3.3",
9090
"codemirror": "^5.65.5",
91-
"core-js": "^3.29.0",
91+
"core-js": "^3.29.1",
9292
"d3": "7.8.2",
9393
"file-saver": "^2.0.5",
9494
"google-maps": "^4.3.3",
@@ -100,7 +100,7 @@
100100
"knockout": "^3.5.1",
101101
"knockout-mapping": "^2.6.0",
102102
"knockout.validation": "^2.0.4",
103-
"liquidjs": "^9.42.1",
103+
"liquidjs": "^10.6.1",
104104
"lunr": "^2.3.9",
105105
"mime": "^3.0.0",
106106
"moment": "^2.29.4",
@@ -117,6 +117,6 @@
117117
"remark-rehype": "^10.1.0",
118118
"saxen": "^8.1.2",
119119
"topojson-client": "^3.1.0",
120-
"truncate-html": "^1.0.4"
120+
"html-truncate": "1.2.2"
121121
}
122122
}

src/components/staticSettingsProvider.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import * as Objects from "@paperbits/common/objects";
12
import { ISettingsProvider } from "@paperbits/common/configuration";
23

34
export class StaticSettingsProvider implements ISettingsProvider {
45
constructor(private readonly configuration: Object) { }
56

6-
public getSetting<T>(name: string): Promise<T> {
7-
return this.configuration[name];
7+
public getSetting<T>(path: string): Promise<T> {
8+
return Objects.getObjectAt(path, this.configuration);
89
}
910

10-
public async setSetting<T>(name: string, value: T): Promise<void> {
11-
this.configuration[name] = value;
11+
public async setSetting<T>(path: string, value: T): Promise<void> {
12+
Objects.setValue(path, this.configuration, value);
13+
this.configuration[path] = value;
1214
}
1315

1416
public async getSettings<T>(): Promise<T> {

src/config.design.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
"managementApiUrl": "https://<service-name>.management.azure-api.net",
44
"managementApiAccessToken": "SharedAccessSignature ...",
55
"backendUrl": "https://<service-name>.developer.azure-api.net",
6-
"useHipCaptcha": false
6+
"useHipCaptcha": false,
7+
"integration": {
8+
"googleFonts": {
9+
"apiKey": "<Google API Key>"
10+
}
11+
}
712
}

src/errors/unhandledErrorHandler.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ export class UnhandledErrorHandler {
88
}
99

1010
public handlerError(event: ErrorEvent): void {
11-
this.logger.trackError(event.error);
11+
event.preventDefault();
12+
event.stopPropagation();
13+
this.logger.trackError(event.error).catch((error) => {
14+
console.error(`Unable to log error: ${event.error} \n Logger issue -> `, error);
15+
});
1216
}
1317

1418
public handlerPromiseRejection(event: PromiseRejectionEvent): void {
15-
this.logger.trackError(event.reason);
19+
event.preventDefault();
20+
event.stopPropagation();
21+
this.logger.trackError(event.reason).catch((error) => {
22+
console.error(`Unable to log Promise Rejection: ${event.reason} \n Logger issue -> `, error);
23+
});
1624
}
1725
}

src/libraries/block-snippets.json

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@
4848
"key": "blocks/new-popup-template",
4949
"title": "New popup template",
5050
"type": "popup"
51+
},
52+
"heading-block-1": {
53+
"type": "layout-section",
54+
"key": "blocks/heading-block-1",
55+
"title": "Feature block 5",
56+
"description": "",
57+
"contentKey": "files/heading-block-1",
58+
"imports": [
59+
"styles/colors/semi-trsp-lt-bg",
60+
"styles/components/button/no-border",
61+
"popups/main-menu-popup",
62+
"files/main-menu-popup"
63+
]
5164
}
5265
},
5366
"popups": {
@@ -1581,6 +1594,146 @@
15811594
}
15821595
]
15831596
},
1597+
"heading-block-1": {
1598+
"type": "layout-section",
1599+
"styles": {
1600+
"instance": {
1601+
"key": "awgovjdnwn"
1602+
}
1603+
},
1604+
"nodes": [
1605+
{
1606+
"type": "grid",
1607+
"nodes": [
1608+
{
1609+
"type": "grid-cell",
1610+
"nodes": [
1611+
{
1612+
"type": "picture",
1613+
"width": 80,
1614+
"height": 80,
1615+
"caption": "Logo",
1616+
"styles": {
1617+
"appearance": "components/picture/default"
1618+
},
1619+
"hyperlink": {
1620+
"target": "_self",
1621+
"targetKey": "pages/e0987ca1-f458-b546-7697-7be594b35583"
1622+
}
1623+
},
1624+
{
1625+
"type": "menu",
1626+
"navigationItemKey": "main",
1627+
"layout": "horizontal",
1628+
"styles": {
1629+
"appearance": "components/menu/default",
1630+
"instance": {
1631+
"display": {
1632+
"md": "inline-block",
1633+
"xs": "none"
1634+
}
1635+
}
1636+
},
1637+
"roles": null
1638+
},
1639+
{
1640+
"type": "button",
1641+
"label": "",
1642+
"styles": {
1643+
"appearance": "components/button/no-border",
1644+
"instance": {
1645+
"display": {
1646+
"xs": "inline-block",
1647+
"md": "none"
1648+
}
1649+
}
1650+
},
1651+
"roles": null,
1652+
"hyperlink": {
1653+
"target": "_popup",
1654+
"targetKey": "popups/main-menu-popup"
1655+
}
1656+
}
1657+
],
1658+
"role": "article",
1659+
"styles": {
1660+
"instance": {
1661+
"grid-cell": {
1662+
"xs": {
1663+
"position": {
1664+
"col": 1,
1665+
"row": 1
1666+
},
1667+
"span": {
1668+
"cols": 1,
1669+
"rows": 1
1670+
},
1671+
"alignment": {
1672+
"vertical": "center",
1673+
"horizontal": "between"
1674+
}
1675+
},
1676+
"xl": {
1677+
"alignment": {
1678+
"vertical": "center",
1679+
"horizontal": "between"
1680+
}
1681+
},
1682+
"md": {
1683+
"alignment": {
1684+
"vertical": "center",
1685+
"horizontal": "between"
1686+
}
1687+
},
1688+
"lg": {
1689+
"alignment": {
1690+
"vertical": "center",
1691+
"horizontal": "between"
1692+
}
1693+
}
1694+
},
1695+
"padding": {
1696+
"xs": {
1697+
"top": 10,
1698+
"bottom": 10,
1699+
"left": 10,
1700+
"right": 10
1701+
}
1702+
}
1703+
}
1704+
}
1705+
}
1706+
],
1707+
"styles": {
1708+
"instance": {
1709+
"margin": {
1710+
"xs": {
1711+
"top": 20,
1712+
"left": "auto",
1713+
"right": "auto",
1714+
"bottom": 20
1715+
}
1716+
},
1717+
"size": {
1718+
"lg": {
1719+
"maxWidth": 1140
1720+
}
1721+
},
1722+
"grid": {
1723+
"xs": {
1724+
"rows": [
1725+
"auto"
1726+
],
1727+
"cols": [
1728+
"1fr"
1729+
]
1730+
}
1731+
}
1732+
}
1733+
}
1734+
}
1735+
]
1736+
},
15841737
"main-menu-popup": {
15851738
"type": "popup",
15861739
"backdrop": false,

src/models/console/consoleOperation.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,14 @@ export class ConsoleOperation {
110110
}
111111

112112
let requestUrl = this.urlTemplate;
113-
const parameters = this.templateParameters().concat(this.request.queryParameters());
113+
let parameters = this.templateParameters().concat(this.request.queryParameters());
114+
115+
const wildcardName = "{*}"
116+
requestUrl = requestUrl.replace("*", wildcardName);
114117

115118
parameters.forEach(parameter => {
116119
if (parameter.value()) {
117-
const parameterPlaceholder = parameter.name() !== "*" ? `{${parameter.name()}}` : "*";
120+
const parameterPlaceholder = `{${parameter.name()}}`;
118121

119122
if (requestUrl.indexOf(parameterPlaceholder) > -1) {
120123
requestUrl = requestUrl.replace(parameterPlaceholder,
@@ -132,7 +135,8 @@ export class ConsoleOperation {
132135
if (this.api.apiVersionSet && this.api.apiVersionSet.versioningScheme === "Query") {
133136
requestUrl = this.addParam(requestUrl, this.api.apiVersionSet.versionQueryName, this.api.apiVersion);
134137
}
135-
requestUrl = requestUrl.replace("/*", "");
138+
139+
requestUrl = requestUrl.replace(wildcardName, "");
136140

137141
return `${this.api.path}${versionPath}${requestUrl}`;
138142
}

src/persistence/mapiObjectStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export class MapiObjectStorage implements IObjectStorage {
393393
const isLocalized = localizedContentTypes.includes(contentType);
394394
const localeSearchPrefix = isLocalized ? `${selectedLocale}/` : "";
395395

396-
if (key === "popups" || key === "locales") {
396+
if (key === "locales") {
397397
return {
398398
value: []
399399
};

src/services/markdownService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import remarkRehype from "remark-rehype";
55
import rehypeRaw from "rehype-raw";
66
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
77
import rehypeStringify from "rehype-stringify";
8-
import * as truncateHtml from "truncate-html";
8+
import * as truncate from "html-truncate";
99

1010
/**
1111
* A service to process markdown input.
@@ -29,7 +29,7 @@ export class MarkdownService {
2929
})
3030
.use(rehypeStringify)
3131
.process(markdown, (err: any, html: any) => {
32-
processedHtml = truncateHtml.default(html, { length: length, reserveLastWord: true });
32+
processedHtml = truncate(html.value, length, {truncateLastWord: false});
3333
});
3434

3535
return processedHtml;

src/startup.design.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as ko from "knockout";
33
import { InversifyInjector } from "@paperbits/common/injection";
44
import { OfflineModule } from "@paperbits/common/persistence/offline.module";
55
import { CoreDesignModule } from "@paperbits/core/core.design.module";
6-
import { PopupDesignModule } from "@paperbits/core/popup";
76
import { FormsDesignModule } from "@paperbits/forms/forms.design.module";
87
import { ProseMirrorModule } from "@paperbits/prosemirror/prosemirror.module";
98
import { StylesDesignModule } from "@paperbits/styles/styles.design.module";
@@ -18,7 +17,6 @@ injector.bindToCollection("autostart", SessionExpirationErrorHandler);
1817
injector.bindModule(new CoreDesignModule());
1918
injector.bindModule(new StylesDesignModule());
2019
injector.bindModule(new ProseMirrorModule());
21-
injector.bindModule(new PopupDesignModule());
2220
injector.bindModule(new FormsDesignModule());
2321
injector.bindModule(new ApimDesignModule());
2422
injector.bindModule(new OfflineModule({ autosave: false }));

0 commit comments

Comments
 (0)