Skip to content

Commit

Permalink
chore: update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
maximizeIT committed Jul 13, 2024
1 parent eb69eb5 commit a3a0811
Show file tree
Hide file tree
Showing 13 changed files with 756 additions and 536 deletions.
1 change: 1 addition & 0 deletions samples/weather-forecast/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{
"useBuiltIns": "usage",
"corejs": 3,
"targets": "> 0.25%, not dead, not ie < 11"
}
],
"@babel/preset-react",
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
"prettier"
],
rules: {
"no-unused-vars": "off",
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ $ yarn install

## Building the form for configuration

This project uses [react-jsonschema-form](https://rjsf-team.github.io/react-jsonschema-form/) for configuring the widget properties. For more information consult their [documentation](https://react-jsonschema-form.readthedocs.io/en/latest/)
This project uses [react-jsonschema-form](https://rjsf-team.github.io/react-jsonschema-form/) for configuring the widget properties. For more information consult their [documentation](https://rjsf-team.github.io/react-jsonschema-form/docs/)
8 changes: 4 additions & 4 deletions samples/weather-forecast/dev/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FakeBaseClass extends window.HTMLElement implements BaseBlock {
}

public parseConfig<T extends Record<string, unknown>>(
attributes: T
attributes: T,
): Record<string, string> {
return prepareAttributes(attributes);
}
Expand All @@ -69,14 +69,14 @@ window.defineBlock = function (externalBlockDefinition) {
const customElementName = externalBlockDefinition.blockDefinition.name;
const CustomElementClass = externalBlockDefinition.blockDefinition.factory(
FakeBaseClass,
WidgetApiMock
WidgetApiMock,
);
window.customElements.define(customElementName, CustomElementClass);

ReactDOM.render(
React.createElement(Config, {
blockDefinition: externalBlockDefinition.blockDefinition,
}),
document.getElementById("config")
document.getElementById("config"),
);
window.customElements.define(customElementName, CustomElementClass);
};
4 changes: 2 additions & 2 deletions samples/weather-forecast/dev/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ const Config: FC<Props> = ({ blockDefinition }) => {
aria-label={blockDefinition.label}
style={{
background: "rgb(247, 247, 247)",
cursor: "pointer",
height: "96px",
flex: "0 0 20%",
borderRadius: "3px",
padding: "0px",
margin: "0px",
margin: "5px 0px 0px 0px",
display: "flex",
alignItems: "center",
justifyContent: "center",
Expand All @@ -57,6 +56,7 @@ const Config: FC<Props> = ({ blockDefinition }) => {
height="28"
src={blockDefinition.iconUrl}
style={{ maxWidth: "80px" }}
alt={blockDefinition.label}
/>
<div
aria-hidden="true"
Expand Down
4 changes: 2 additions & 2 deletions samples/weather-forecast/dev/widget-api-mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import {
getUserInformationByExternalId,
} from "./user";

import getIntegration from "./integrations";
import getIntegration from "./integrations"

const apiMock: WidgetApi = {
getIntegration,
getLegacyAppTheme,
getUserInformation,
getUserList,
getUserInformationByExternalId,
getIntegration
};

export default apiMock;
40 changes: 16 additions & 24 deletions samples/weather-forecast/dev/widget-api-mock/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,22 @@
* limitations under the License.
*/

import {
IntegrationInformation,
IntegrationStates,
IntegrationType,
} from "@staffbase/widget-sdk";
import {IntegrationInformation, IntegrationStates, IntegrationType} from '@staffbase/widget-sdk'

export default async (
_type: IntegrationType
): Promise<IntegrationInformation> => {
const date = new Date();
const expireDate = new Date();
export default async (_type: IntegrationType): Promise<IntegrationInformation> => {
const date = new Date();
const expireDate = new Date();

expireDate.setDate(date.getDate() + 1);
expireDate.setDate(date.getDate() + 1);

return {
status: IntegrationStates.AVAILABLE,
enabledFeatures: ["foo"],
supportedFeatures: ["foo"],
token: {
accessToken: "fooToken",
accessTokenExpiresAt: expireDate,
},
signIn: () => {
console.log("Sign in");
},
};
};
return {
status: IntegrationStates.AVAILABLE,
enabledFeatures: ['foo'],
supportedFeatures: ['foo'],
token: {
accessToken: "fooToken",
accessTokenExpiresAt: expireDate
},
signIn: () => { console.log('Sign in') }
}
}
5 changes: 1 addition & 4 deletions samples/weather-forecast/dev/widget-api-mock/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ export const getUserInformationByExternalId = async (
export const getUserList = async (
_query: UserListRequestQuery
): Promise<UserListResponse> => ({
data: [
user,
{ id: "5e43c6feca2d15e6afa8231d", firstName: "Tony", lastName: "Stark" },
],
data: [user, {id: "5e43c6feca2d15e6afa8231d", firstName: "Tony", lastName: "Stark"}],
offset: 0,
limit: 1,
total: 1,
Expand Down
31 changes: 16 additions & 15 deletions samples/weather-forecast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staffbase/weather-forecast",
"version": "1.0.0",
"version": "1.0.1",
"description": "",
"scripts": {
"start": "webpack serve --open --config webpack.dev.ts",
Expand Down Expand Up @@ -39,45 +39,46 @@
"@babel/preset-typescript": "^7.24.7",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@rjsf/core": "5.18.5",
"@rjsf/material-ui": "5.18.5",
"@rjsf/utils": "5.18.5",
"@rjsf/validator-ajv8": "^5.18.4",
"@rjsf/core": "5.19.1",
"@rjsf/material-ui": "5.19.1",
"@rjsf/utils": "5.19.1",
"@rjsf/validator-ajv8": "^5.19.1",
"@svgr/webpack": "6.5.1",
"@testing-library/dom": "8.2.0",
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "12.0.0",
"@testing-library/dom": "8.11.1",
"@testing-library/jest-dom": "5.15.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "7.0.2",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/jest": "^29.5.12",
"@types/json-schema": "^7.0.15",
"@types/node": "16.11.9",
"@types/react": "^17.0.36",
"@types/react-dom": "^17.0.11",
"@types/testing-library__jest-dom": "^5.14.9",
"@types/webpack": "5.28.5",
"@types/webpack-dev-server": "4.1.0",
"@typescript-eslint/eslint-plugin": "4.30.0",
"@typescript-eslint/parser": "4.30.0",
"@types/webpack-dev-server": "4.7.2",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
"@ungap/custom-elements": "1.3.0",
"babel-eslint": "10.1.0",
"babel-loader": "^8.2.2",
"copy-webpack-plugin": "^9.0.1",
"core-js": "3.37.1",
"eslint": "7.32.0",
"eslint": "8.3.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"file-loader": "^6.2.0",
"jest": "27.1.0",
"jest-json-schema": "^5.0.0",
"js-base64": "3.7.7",
"minimal-polyfills": "2.2.3",
"prettier": "2.3.2",
"react-svg-loader": "^3.0.3",
"ts-loader": "^9.5.1",
"ts-node": "10.9.2",
"typescript": "4.5.2",
"url-loader": "^4.1.1",
"webpack": "^5.91.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0",
"webpack-dev-server": "^4.5.0",
"webpack-merge": "^5.10.0"
},
"jest": {
Expand Down
4 changes: 2 additions & 2 deletions samples/weather-forecast/src/configuration-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { JSONSchema7 } from "json-schema";

/**
* schema used for generation of the configuration dialog
* see https://react-jsonschema-form.readthedocs.io/en/latest/ for documentation
* see https://rjsf-team.github.io/react-jsonschema-form/docs/ for documentation
*/
export const configurationSchema: JSONSchema7 = {
properties: {
Expand Down Expand Up @@ -45,7 +45,7 @@ export const configurationSchema: JSONSchema7 = {

/**
* schema to add more customization to the form's look and feel
* @see https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/
* @see https://rjsf-team.github.io/react-jsonschema-form/docs/api-reference/uiSchema
*/
export const uiSchema: UiSchema = {
location: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
*/

declare module "*.svg" {
const content: any;
export default content;
const content: string;
export default content;
}
6 changes: 4 additions & 2 deletions samples/weather-forecast/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"resolveJsonModule": true,
"baseUrl": "src",
"rootDir": ".",
"paths": {},
"paths": {
"widget-sdk": ["./node_modules/@staffbase/widget-sdk"]
},
"typeRoots": ["./typings", "node_modules/@types"]
},
"include": ["src/**/*", "src/custom.d.ts"],
"include": ["src/*"],
"exclude": ["node_modules", "dist"]
}
Loading

0 comments on commit a3a0811

Please sign in to comment.