Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mocha.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
require("ts-node").register({
transpileOnly: true,
ignore: ["node_modules\/(?!@paperbits)"],
compilerOptions: {
"module": "commonjs"
"module": "commonjs",
"rootDir": ".",
"incremental": false,
"composite": false,
"sourceMap": false
}
});
16,062 changes: 9,939 additions & 6,123 deletions package-lock.json

Large diffs are not rendered by default.

158 changes: 77 additions & 81 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,116 +29,112 @@
"lint:fix": "eslint src/**/*.ts --fix"
},
"devDependencies": {
"@azure/identity": "^4.0.1",
"@azure/storage-blob": "^12.16.0",
"@playwright/test": "1.40.1",
"@types/chai": "^4.3.6",
"@types/google-maps": "^3.2.3",
"@types/jsdom": "^20.0.1",
"@types/knockout": "^3.4.73",
"@types/knockout.mapping": "^2.0.38",
"@types/knockout.validation": "0.0.40",
"@types/mime": "^3.0.1",
"@types/mocha": "10.0.1",
"@types/node": "^20.6.2",
"@types/react": "^18.0.27",
"@types/sinon": "^10.0.13",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"autoprefixer": "^10.4.15",
"@azure/identity": "^4.13.1",
"@azure/storage-blob": "^12.32.0",
"@playwright/test": "1.61.0",
"@types/chai": "^5.2.3",
"@types/google-maps": "^4.0.0",
"@types/jsdom": "^28.0.3",
"@types/mime": "^4.0.0",
"@types/mocha": "10.0.10",
"@types/node": "^25.9.3",
"@types/react": "^19.2.17",
"@types/sinon": "^21.0.1",
"@typescript-eslint/eslint-plugin": "^8.61.1",
"@typescript-eslint/parser": "^8.61.1",
"autoprefixer": "^10.5.0",
"buffer": "^6.0.3",
"chai": "^4.3.8",
"chai": "^6.2.2",
"clean-webpack-plugin": "4.0.0",
"compression-webpack-plugin": "^11.1.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"eslint": "^8.43.0",
"fake-indexeddb": "^5.0.2",
"compression-webpack-plugin": "^12.0.0",
"copy-webpack-plugin": "^14.0.0",
"css-loader": "^7.1.4",
"eslint": "^10.5.0",
"fake-indexeddb": "^6.2.5",
"file-loader": "^6.2.0",
"html-loader": "^4.2.0",
"html-loader": "^5.1.0",
"ifdef-loader": "^2.3.2",
"jsdom": "^20.0.3",
"mini-css-extract-plugin": "^2.7.6",
"mocha": "^10.2.0",
"jsdom": "^29.1.1",
"mini-css-extract-plugin": "^2.10.2",
"mocha": "^11.7.6",
"path": "^0.12.7",
"playwright": "1.40.1",
"postcss-loader": "^7.3.3",
"playwright": "1.61.0",
"postcss-loader": "^8.2.1",
"querystring-es3": "^0.2.1",
"raw-loader": "^4.0.2",
"sass": "1.67.0",
"sass-loader": "13.3.2",
"sinon": "^20.0.0",
"sass": "1.101.0",
"sass-loader": "17.0.0",
"sinon": "^22.0.0",
"stream-browserify": "^3.0.0",
"style-loader": "^3.3.3",
"terser-webpack-plugin": "^5.3.9",
"ts-loader": "^9.5.2",
"style-loader": "^4.0.0",
"terser-webpack-plugin": "^5.6.1",
"ts-loader": "^9.6.1",
"ts-node": "10.9.2",
"typescript": "^4.9.5",
"webpack": "5.88.2",
"webpack-cli": "5.1.4",
"webpack-dev-server": "4.15.1",
"webpack-merge": "5.9.0"
"typescript": "^6.0.3",
"webpack": "5.107.2",
"webpack-cli": "7.0.3",
"webpack-dev-server": "5.2.5",
"webpack-merge": "6.0.1"
},
"dependencies": {
"@azure/api-management-custom-widgets-scaffolder": "^1.0.0-beta.4",
"@azure/api-management-custom-widgets-tools": "^1.0.0-beta.2",
"@azure/msal-browser": "^2.37.1",
"@braintree/sanitize-url": "6.0.4",
"@fluentui/font-icons-mdl2": "^8.5.9",
"@fluentui/react": "^8.117.7",
"@fluentui/react-charting": "^5.22.5",
"@fluentui/react-components": "^9.49.0",
"@fluentui/react-icons": "^2.0.237",
"@microsoft/applicationinsights-web": "^3.0.2",
"@monaco-editor/loader": "^1.3.3",
"@monaco-editor/react": "^4.6.0",
"@azure/msal-browser": "^5.14.0",
"@braintree/sanitize-url": "7.1.2",
"@fluentui/font-icons-mdl2": "^8.5.73",
"@fluentui/react": "^8.125.6",
"@fluentui/react-charting": "^5.25.10",
"@fluentui/react-components": "^9.74.1",
"@fluentui/react-icons": "^2.0.330",
"@microsoft/applicationinsights-web": "^3.4.1",
"@monaco-editor/loader": "^1.7.0",
"@monaco-editor/react": "^4.7.0",
"@paperbits/azure": "0.1.661",
"@paperbits/common": "0.1.661",
"@paperbits/core": "0.1.661",
"@paperbits/forms": "0.1.661",
"@paperbits/react": "1.0.10",
"@paperbits/react": "1.0.13",
"@paperbits/styles": "0.1.661",
"@webcomponents/custom-elements": "1.6.0",
"@webcomponents/shadydom": "^1.11.0",
"client-oauth2": "4.3.3",
"codemirror": "^6.0.1",
"core-js": "^3.32.2",
"d3": "7.8.5",
"codemirror": "^6.0.2",
"core-js": "^3.49.0",
"d3": "7.9.0",
"file-saver": "^2.0.5",
"google-maps": "^4.3.3",
"graphql": "^15.5.0",
"graphql-config": "^4.3.6",
"graphql-language-service": "3.1.6",
"graphql": "^17.0.1",
"graphql-language-service": "5.5.2",
"html-truncate": "1.2.2",
"idb-keyval": "^6.2.1",
"js-beautify": "^1.14.9",
"knockout": "^3.5.1",
"idb-keyval": "^6.2.5",
"js-beautify": "^1.15.4",
"knockout": "^3.5.3",
"knockout-mapping": "^2.6.0",
"knockout.validation": "^2.0.4",
"liquidjs": "^10.9.2",
"liquidjs": "^10.27.0",
"lunr": "^2.3.9",
"mime": "^3.0.0",
"moment": "^2.29.4",
"monaco-editor": "^0.29.1",
"mime": "^4.1.0",
"moment": "^2.30.1",
"monaco-editor": "^0.55.1",
"msal": "^1.4.18",
"nuka-carousel": "^7.0.0",
"prettier": "^2.8.8",
"prismjs": "^1.29.0",
"react": "^18.2.0",
"react-cropper": "^2.3.2",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"react-toastify": "^9.1.3",
"rehype-raw": "^6.1.1",
"rehype-sanitize": "^5.0.1",
"rehype-stringify": "^9.0.3",
"nuka-carousel": "^8.2.0",
"prettier": "^3.8.4",
"prismjs": "^1.30.0",
"react": "^19.2.7",
"react-cropper": "^2.3.3",
"react-dom": "^19.2.7",
"react-markdown": "^10.1.0",
"react-syntax-highlighter": "^16.1.1",
"react-toastify": "^11.1.0",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"rehype-stringify": "^10.0.1",
"rehype-truncate": "^1.2.2",
"remark": "^14.0.3",
"remark-gfm": "^3.0.1",
"remark-parse": "^10.0.2",
"remark-rehype": "^10.1.0",
"saxen": "^8.1.2",
"remark": "^15.0.1",
"remark-gfm": "^4.0.1",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.1.2",
"saxen": "^11.0.2",
"topojson-client": "^3.1.0"
}
}
4 changes: 2 additions & 2 deletions src/admin/media/nonImageDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CopyableTextField } from '../utils/components/copyableTextField';
import { REQUIRED, UNIQUE_REQUIRED, URL_REQUIRED, validateField } from '../utils/validator';
import { reservedPermalinks } from '../../constants';
import { MimeTypes } from '@paperbits/common';
import { getType } from "mime";
import mime from "mime";

interface NonImageDetailsModalState {
mediaItem: MediaContract,
Expand Down Expand Up @@ -44,7 +44,7 @@ export class NonImageDetailsModal extends React.Component<NonImageDetailsModalPr
const newStateMediaItem: MediaContract = { ...this.state.mediaItem, [field]: newValue };

if (field === 'downloadUrl') {
const newMimeType: string = getType(newValue);
const newMimeType: string = mime.getType(newValue);
if (newMimeType) {
newStateMediaItem.mimeType = newMimeType;
}
Expand Down
30 changes: 19 additions & 11 deletions src/admin/onboardingModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Carousel, { ControlProps } from 'nuka-carousel';
import { Carousel, SlideHandle } from 'nuka-carousel';
import { DefaultButton, IconButton, Image, ImageFit, Link, Modal, PrimaryButton, Stack, Text } from '@fluentui/react';

interface OnboardingModalState {
Expand Down Expand Up @@ -39,6 +39,8 @@ const modalSlides = [
];

export class OnboardingModal extends React.Component<OnboardingModalProps, OnboardingModalState> {
private readonly carouselRef = React.createRef<SlideHandle>();

constructor(props: OnboardingModalProps) {
super(props);

Expand All @@ -47,18 +49,18 @@ export class OnboardingModal extends React.Component<OnboardingModalProps, Onboa
}
}

renderPrevButton = (props: ControlProps): JSX.Element => (
renderPrevButton = (): JSX.Element => (
<DefaultButton
text="Previous"
onClick={() => props.previousSlide()}
styles={{ root: { display: props.previousDisabled ? 'none' : 'block' } }}
onClick={() => this.carouselRef.current?.goBack()}
styles={{ root: { display: this.state.currentSlide === 0 ? 'none' : 'block' } }}
/>
)

renderNextButton = (props: ControlProps): JSX.Element => (
renderNextButton = (): JSX.Element => (
<PrimaryButton
text={props.currentSlide === modalSlides.length - 1 ? 'Close' : 'Next' }
onClick={() => props.currentSlide === modalSlides.length - 1 ? this.props.onDismiss() : props.nextSlide()}
text={this.state.currentSlide === modalSlides.length - 1 ? 'Close' : 'Next' }
onClick={() => this.state.currentSlide === modalSlides.length - 1 ? this.props.onDismiss() : this.carouselRef.current?.goForward()}
/>
)

Expand All @@ -76,10 +78,12 @@ export class OnboardingModal extends React.Component<OnboardingModalProps, Onboa
onClick={this.props.onDismiss}
/>
<Carousel
slideIndex={this.state.currentSlide}
defaultControlsConfig={{ pagingDotsClassName: 'carousel-dot', pagingDotsContainerClassName: 'carousel-dots-container' }}
renderCenterLeftControls={(props: ControlProps) => this.renderPrevButton(props)}
renderCenterRightControls={(props: ControlProps) => this.renderNextButton(props)}
ref={this.carouselRef}
showArrows={false}
showDots
wrapMode="nowrap"
className="onboarding-carousel"
afterSlide={(index: number) => this.setState({ currentSlide: index })}
>
{modalSlides.map(slide => (
<div key={slide.header}>
Expand All @@ -96,6 +100,10 @@ export class OnboardingModal extends React.Component<OnboardingModalProps, Onboa
</div>
))}
</Carousel>
<Stack horizontal horizontalAlign="space-between" className="onboarding-modal-controls">
{this.renderPrevButton()}
{this.renderNextButton()}
</Stack>
</>
</Modal>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/authentication/accessTokenRefresher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IApiClient } from "../clients";
import { expect } from 'chai';
import { SinonFakeTimers, useFakeTimers, stub } from 'sinon';
import * as crypto from 'crypto';
import * as moment from "moment";
import moment from "moment";

describe('AccessTokenRefresher', () => {
let settingsProvider: ISettingsProvider;
Expand Down
3 changes: 1 addition & 2 deletions src/authentication/armAuthenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ export class ArmAuthenticator implements IAuthenticator {
redirectUri: redirectUri
},
cache: {
cacheLocation: "sessionStorage", // This configures where your cache will be stored
storeAuthStateInCookie: false // Set this to "true" if you are having issues on IE11 or Edge
cacheLocation: "sessionStorage" // This configures where your cache will be stored
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/authentication/staticAuthenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class StaticAuthenticator implements IAuthenticator {
* The ARM token injected acquired in build-time. It's used in on local development only.
* TODO: Static authenticator is used in production publishing, therefore it's safer to introduce dedicated implementation.
*/
if (!ARM_TOKEN) {
if (typeof ARM_TOKEN === "undefined" || !ARM_TOKEN) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/bindingHandlers/copyToClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ko from "knockout";
ko.bindingHandlers["copyToClipboard"] = {
init: (element: HTMLElement, valueAccessor: () => (string | (() => Promise<string>))): void => {
const copyToClipboard = async () => {
const unwrappedValue = ko.unwrap(valueAccessor());
const unwrappedValue: string | (() => Promise<string>) = ko.unwrap(valueAccessor() as any);
const text = typeof unwrappedValue === "string"
? unwrappedValue as string
: await (unwrappedValue as (() => Promise<string>))();
Expand Down
15 changes: 8 additions & 7 deletions src/clients/mapiClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ interface Validity {

describe("Mapi Client", async () => {

const sessionStorageValues = new Map<string, string>();
global.sessionStorage = {
_values: new Map<string, string>(),
length: global.sessionStorage._values.size,
_values: sessionStorageValues,
get length() { return sessionStorageValues.size; },
key: (index: number) => { return null; },
getItem: (key: string) => { return global.sessionStorage._values.get(key); },
setItem: (key: string, value: string) => { global.sessionStorage._values.set(key, value); },
removeItem: (key: string) => { global.sessionStorage._values.delete(key); },
clear: () => { global.sessionStorage._values.clear(); }
}
getItem: (key: string) => { return sessionStorageValues.get(key); },
setItem: (key: string, value: string) => { sessionStorageValues.set(key, value); },
removeItem: (key: string) => { sessionStorageValues.delete(key); },
clear: () => { sessionStorageValues.clear(); }
} as any;

const settingsProvider = new StaticSettingsProvider({
managementApiUrl: "https://contoso.management.azure-api.net",
Expand Down
2 changes: 1 addition & 1 deletion src/components/content/content.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import template from "./content.html";
import * as moment from "moment";
import moment from "moment";
import * as Constants from "../../constants";
import { ViewManager, View } from "@paperbits/common/ui";
import { Component } from "@paperbits/common/ko/decorators";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,17 +460,17 @@ export class GraphqlConsole {
private buildTree(content: string): void {
const schema = GraphQL.buildSchema(content);

this.operationNodes.query(new GraphQLOutputTreeNode(GraphqlTypes.query, <GraphQL.GraphQLField<any, any>>{
this.operationNodes.query(new GraphQLOutputTreeNode(GraphqlTypes.query, <GraphQL.GraphQLField<any, any>><unknown>{
type: schema.getQueryType(),
args: []
}, () => this.generateDocument(), null));

this.operationNodes.mutation(new GraphQLOutputTreeNode(GraphqlTypes.mutation, <GraphQL.GraphQLField<any, any>>{
this.operationNodes.mutation(new GraphQLOutputTreeNode(GraphqlTypes.mutation, <GraphQL.GraphQLField<any, any>><unknown>{
type: schema.getMutationType(),
args: []
}, () => this.generateDocument(), null));

this.operationNodes.subscription(new GraphQLOutputTreeNode(GraphqlTypes.subscription, <GraphQL.GraphQLField<any, any>>{
this.operationNodes.subscription(new GraphQLOutputTreeNode(GraphqlTypes.subscription, <GraphQL.GraphQLField<any, any>><unknown>{
type: schema.getSubscriptionType(),
args: []
}, () => this.generateDocument(), null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class GraphDocService {
return;
}
this.content(graphQLSchema.graphQLSchema);
const schema = GraphQL.buildSchema(this.content(), { commentDescriptions: true });
const schema = GraphQL.buildSchema(this.content());

this.docGraphs.query(schema.getQueryType()?.getFields());
this.docGraphs.mutation(schema.getMutationType()?.getFields());
Expand Down
Loading
Loading