Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: housekeeping #82

Merged
merged 22 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 18 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
2 changes: 1 addition & 1 deletion .github/workflows/autodev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
autodev:
uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@dont-check-private-key
uses: Staffbase/gha-workflows/.github/workflows/template_autodev.yml@v5.3.0
with:
comments: true
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [published]

env:
NODE_VERSION: 16
NODE_VERSION: 20
DEPLOYMENT_KIND: widget
DEPLOYMENT_TARGET: weather
DEPLOYMENT_STATIC_FILES: staffbase.user-profile-client.min.js
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: CI Tests
env:
NODE_VERSION: 14
NODE_VERSION: 20
on:
push:
paths-ignore:
- '**.md'

jobs:
executing-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/dev/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down Expand Up @@ -47,7 +47,7 @@
const { name, value: attribute } = attr;
if (attribute) {
const key = name as keyof T;
acc[key] = fromDataUri<any>(attribute);

Check warning on line 50 in samples/weather-forecast/dev/bootstrap.ts

View workflow job for this annotation

GitHub Actions / executing-tests

Unexpected any. Specify a different type
}

return acc;
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/dev/config.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/dev/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/dev/utils/DataUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/dev/widget-api-mock/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
15 changes: 13 additions & 2 deletions samples/weather-forecast/dev/widget-api-mock/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand All @@ -19,8 +19,16 @@ import {

const user: SBUserProfile = {
id: "5c35e4feea2d15e6ffa8251d",
externalID: "abc123",
primaryEmail: "lucy.liu@company.com",
primaryUsername: "lucy.liu",
firstName: "Lucy",
lastName: "Liu",
phoneNumber: "09124456",
publicEmailAddress: "lucy.liu@company.com",
location: "New York",
position: "Sales Representative",
department: "Sales",
};

export const getUserInformation = async (
Expand All @@ -34,7 +42,10 @@ export const getUserInformationByExternalId = async (
export const getUserList = async (
_query: UserListRequestQuery
): Promise<UserListResponse> => ({
data: [{ ...user, id: "5c35e4feea2d15e6ffa8251d" }],
data: [
user,
{ id: "5e43c6feca2d15e6afa8231d", firstName: "Tony", lastName: "Stark" },
],
offset: 0,
limit: 1,
total: 1,
Expand Down
12 changes: 6 additions & 6 deletions samples/weather-forecast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@rjsf/core": "5.18.5",
"@rjsf/utils": "5.18.5",
"@rjsf/material-ui": "5.18.5",
"@rjsf/utils": "5.18.5",
"@rjsf/validator-ajv8": "^5.18.4",
"@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/react-hooks": "7.0.2",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/node": "16.7.10",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/node": "16.11.9",
"@types/react": "^17.0.36",
"@types/react-dom": "^17.0.11",
"@types/webpack": "5.28.5",
"@types/webpack-dev-server": "4.1.0",
"@typescript-eslint/eslint-plugin": "4.30.0",
Expand All @@ -73,9 +73,9 @@
"react-svg-loader": "^3.0.3",
"ts-loader": "^9.5.1",
"ts-node": "10.9.2",
"typescript": "^4.4.2",
"typescript": "4.5.2",
"url-loader": "^4.1.1",
"webpack": "^5.92.1",
"webpack": "^5.91.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0",
"webpack-merge": "^5.10.0"
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/mockData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/openGeoApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/openWeatherMapApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/useCity.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/useCity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
6 changes: 3 additions & 3 deletions samples/weather-forecast/src/api/useWeather.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down Expand Up @@ -38,7 +38,7 @@ setLogger({
});

describe("useWeather", () => {
const endpoint = "https://api.openweathermap.org/data/2.5/onecall";
const endpoint = "https://api.openweathermap.org/data/3.0/onecall";
afterEach(() => {
queryClient.clear();
});
Expand Down Expand Up @@ -104,7 +104,7 @@ describe("useWeather", () => {
});

expect(result.current.error).toEqual(
new TypeError("Cannot read property 'map' of undefined")
new TypeError("Cannot read properties of undefined (reading 'map')")
);
expect(log).toHaveBeenCalledTimes(1);
});
Expand Down
4 changes: 2 additions & 2 deletions samples/weather-forecast/src/api/useWeather.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down Expand Up @@ -89,7 +89,7 @@ type ForecastOptions = {
const getWeather = async ({
queryKey: [, options],
}: QueryFunctionContext<[string, ForecastOptions]>) => {
const endpoint = "https://api.openweathermap.org/data/2.5/onecall";
const endpoint = "https://api.openweathermap.org/data/3.0/onecall";
const {
units = "standard",
lang = options.lang ?? "en",
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/api/weatherIcon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
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
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand All @@ -12,6 +12,6 @@
*/

declare module "*.svg" {
const content: any;

Check warning on line 15 in samples/weather-forecast/src/custom.d.ts

View workflow job for this annotation

GitHub Actions / executing-tests

Unexpected any. Specify a different type
export default content;
}
10 changes: 5 additions & 5 deletions samples/weather-forecast/src/date.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand All @@ -15,19 +15,19 @@ import { dateFormat, timeFormat } from "./date";

const deLocale = "de";
const frLocale = "fr";
const date = new Date(2021, 3, 22, 0, 0);
const date = new Date(2024, 3, 22, 0, 0);

describe("dateFormat()", () => {
it("should format the date for DE", () => {
expect(dateFormat(date, deLocale)).toBe("Donnerstag, 22.04.2021");
expect(dateFormat(date, deLocale)).toBe("Montag, 22.04.2024");
});

it("should format the date for fallback as US", () => {
expect(dateFormat(date)).toBe("Thursday, 04/22/2021");
expect(dateFormat(date)).toBe("Monday, 04/22/2024");
});

it("should format the date for US when the lang is not supported", () => {
expect(dateFormat(date, frLocale)).toBe("Thursday, 04/22/2021");
expect(dateFormat(date, frLocale)).toBe("Monday, 04/22/2024");
});
});

Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/date.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/dev.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
2 changes: 1 addition & 1 deletion samples/weather-forecast/src/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright 2021, Staffbase GmbH and contributors.
* 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
Expand Down
Loading
Loading