Skip to content

Commit

Permalink
Merge pull request #80 from Staffbase/dependabot/npm_and_yarn/samples…
Browse files Browse the repository at this point in the history
…/weather-forecast/npm-updates-6e8dd4eff6
  • Loading branch information
Ninerian authored Jun 28, 2024
2 parents 2c9c3be + 5ad1354 commit f9bae75
Show file tree
Hide file tree
Showing 11 changed files with 1,440 additions and 2,582 deletions.
4 changes: 3 additions & 1 deletion samples/weather-forecast/dev/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
* limitations under the License.
*/

import { ExternalBlockDefinition } from "widget-sdk";
import { ExternalBlockDefinition } from "@staffbase/widget-sdk";
import { configurationSchema, uiSchema } from "../src/configuration-schema";
import React, { FC } from "react";
import Form from "@rjsf/material-ui";
import validator from "@rjsf/validator-ajv8";

const updateWidget = (data: Record<string, string>) => {
const el = document.querySelector("#preview > :first-child");
Expand Down Expand Up @@ -78,6 +79,7 @@ const Config: FC<Props> = ({ blockDefinition }) => {
<Form
schema={configurationSchema}
uiSchema={uiSchema}
validator={validator}
onSubmit={(e) => {
updateWidget(e.formData);
}}
Expand Down
3 changes: 3 additions & 0 deletions samples/weather-forecast/dev/widget-api-mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import {
getUserInformationByExternalId,
} from "./user";

import getIntegration from "./integrations";

const apiMock: WidgetApi = {
getIntegration,
getLegacyAppTheme,
getUserInformation,
getUserList,
Expand Down
40 changes: 40 additions & 0 deletions samples/weather-forecast/dev/widget-api-mock/integrations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*!
* Copyright 2024, Staffbase GmbH and contributors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

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

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

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

return {
status: IntegrationStates.AVAILABLE,
enabledFeatures: ["foo"],
supportedFeatures: ["foo"],
token: {
accessToken: "fooToken",
accessTokenExpiresAt: expireDate,
},
signIn: () => {
console.log("Sign in");
},
};
};
3 changes: 2 additions & 1 deletion samples/weather-forecast/dev/widget-api-mock/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from "@staffbase/widget-sdk";

const user: SBUserProfile = {
id: "5c35e4feea2d15e6ffa8251d",
firstName: "Lucy",
lastName: "Liu",
};
Expand All @@ -33,7 +34,7 @@ export const getUserInformationByExternalId = async (
export const getUserList = async (
_query: UserListRequestQuery
): Promise<UserListResponse> => ({
data: [{ id: "5c35e4feea2d15e6ffa8251d", ...user }],
data: [{ ...user, id: "5c35e4feea2d15e6ffa8251d" }],
offset: 0,
limit: 1,
total: 1,
Expand Down
54 changes: 28 additions & 26 deletions samples/weather-forecast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,32 @@
"author": "",
"license": "ISC",
"dependencies": {
"@staffbase/widget-sdk": "^3.3.3",
"acorn": "^8.4.1",
"@staffbase/widget-sdk": "^3.12.8",
"acorn": "^8.12.0",
"axios": "0.21.1",
"date-fns": "^2.23.0",
"dayjs": "1.10.6",
"openweather-apis": "4.4.2",
"dayjs": "1.11.11",
"openweather-apis": "4.5.0",
"react": "^17.0.2",
"react-cool-dimensions": "^2.0.7",
"react-dom": "^17.0.2",
"react-query": "3.21.1",
"regenerator-runtime": "0.13.9"
"react-query": "3.39.3",
"regenerator-runtime": "0.14.1"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-object-rest-spread": "^7.14.7",
"@babel/core": "^7.24.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@rjsf/core": "^3.0.0",
"@rjsf/material-ui": "^3.0.0",
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@rjsf/core": "5.18.4",
"@rjsf/utils": "5.18.4",
"@rjsf/material-ui": "5.18.4",
"@rjsf/validator-ajv8": "^5.18.4",
"@svgr/webpack": "6.5.1",
"@testing-library/dom": "8.2.0",
"@testing-library/jest-dom": "5.14.1",
Expand All @@ -50,33 +52,33 @@
"@types/node": "16.7.10",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/webpack": "5.28.0",
"@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",
"@ungap/custom-elements": "1.0.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.17.1",
"core-js": "3.37.1",
"eslint": "7.32.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.6.1",
"minimal-polyfills": "2.2.1",
"js-base64": "3.7.7",
"minimal-polyfills": "2.2.3",
"prettier": "2.3.2",
"react-svg-loader": "^3.0.3",
"ts-loader": "^9.2.5",
"ts-node": "10.2.1",
"typescript": "4.4.2",
"ts-loader": "^9.5.1",
"ts-node": "10.9.2",
"typescript": "^4.4.2",
"url-loader": "^4.1.1",
"webpack": "^5.51.1",
"webpack": "^5.92.1",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.10.0"
},
"jest": {
"setupFilesAfterEnv": [
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/configuration-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* limitations under the License.
*/

import { UiSchema } from "@rjsf/core";
import { UiSchema } from "@rjsf/utils";
import { JSONSchema7 } from "json-schema";

/**
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
BlockDefinition,
ExternalBlockDefinition,
BaseBlock,
} from "widget-sdk";
} from "@staffbase/widget-sdk";
import { WeatherForecastProps, WeatherForecast } from "./weather-forecast";
import { configurationSchema, uiSchema } from "./configuration-schema";
import pkg from "../package.json";
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/views/weatherView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { isSameDay } from "date-fns";
import React, { FunctionComponent, useState } from "react";
import { BlockAttributes } from "widget-sdk";
import { BlockAttributes } from "@staffbase/widget-sdk";
import useCity from "../api/useCity";
import useWeather from "../api/useWeather";
import { ErrorBox } from "../components/ErrorBox";
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/weather-forecast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import React, { ReactElement } from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { WeatherView } from "./views/weatherView";
import { BlockAttributes } from "widget-sdk";
import { BlockAttributes } from "@staffbase/widget-sdk";

const queryClient = new QueryClient({
defaultOptions: {
Expand Down
9 changes: 2 additions & 7 deletions samples/weather-forecast/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
"resolveJsonModule": true,
"baseUrl": "src",
"rootDir": ".",
"paths": {
"widget-sdk": ["../node_modules/@staffbase/widget-sdk"]
},
"typeRoots": [
"./typings",
"node_modules/@types"
]
"paths": {},
"typeRoots": ["./typings", "node_modules/@types"]
},
"include": ["src/**/*", "src/custom.d.ts"],
"exclude": ["node_modules", "dist"]
Expand Down
Loading

0 comments on commit f9bae75

Please sign in to comment.