Skip to content

Commit

Permalink
lock file
Browse files Browse the repository at this point in the history
  • Loading branch information
nirgur committed Sep 16, 2024
2 parents 38d0b67 + 92105aa commit 132355d
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 82 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/release-next-react-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release - React SDK next

on:
push:
branches:
- main

env:
NODE_VERSION: 18.10.0
PNPM_VERSION: 8
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
release:
name: Release Next
runs-on: ubuntu-latest
steps:
- name: Check if should run
id: 'check'
run: |
if [[ $(nx show projects --affected --plain | grep -q "react-sdk") ]]; then
echo "run=true" >> $GITHUB_OUTPUT
else
echo "run=false" >> $GITHUB_OUTPUT
fi
- name: Get token
if: steps.check.outputs.run == 'true'
id: get_token
uses: tibdex/github-app-token@v2
with:
private_key: ${{ secrets.RELEASE_APP_PEM }}
app_id: ${{ secrets.RELEASE_APP_ID }}
- name: Checkout code
if: steps.check.outputs.run == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
# persist-credentials: false
token: ${{ steps.get_token.outputs.token }}
ref: ${{ github.ref }}
- name: Run git config
if: steps.check.outputs.run == 'true'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Setup Node
if: steps.check.outputs.run == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- name: Setup PNPM
if: steps.check.outputs.run == 'true'
uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- name: Install dependencies
if: steps.check.outputs.run == 'true'
run: pnpm install --frozen-lockfile --ignore-scripts
env:
CI: true
- name: Build
if: steps.check.outputs.run == 'true'
run: npm run version:ci
env:
CI: true
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
- name: Run pnpm publish
if: steps.check.outputs.run == 'true'
run: |
pnpm --filter "@descope/react-sdk" exec npm version "0.0.0-next-$(git rev-parse HEAD)" --git-tag-version=false
pnpm --filter "@descope/react-sdk" publish --access=public --no-git-checks --tag=next
env:
CI: true
NODE_AUTH_TOKEN: ${{ secrets.CI_NPM_REGISTRY }}
6 changes: 3 additions & 3 deletions packages/libs/sdk-component-drivers/src/AppsListDriver.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { BaseDriver } from './BaseDriver';

type Data = { name: string, icon: string, url: string }[];
type Data = { name: string; icon: string; url: string }[];

export class AppsListDriver extends BaseDriver {
nodeName = 'descope-apps-list';

set data(data: Data) {
if(this.ele) this.ele.data = data;
if (this.ele) this.ele.data = data;
}

get data() {
return this.ele?.data
return this.ele?.data;
}

get ele() {
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/sdk-component-drivers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export * from './AvatarDriver';
export * from './UserAttributeDriver';
export * from './UserAuthMethodDriver';
export * from './FlowDriver';
export * from './AppsListDriver'
export * from './AppsListDriver';
7 changes: 3 additions & 4 deletions packages/sdks/core-js-sdk/src/httpClient/urlBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ export const urlBuilder = ({

// add query params if given
if (queryParams) {
url = `${url}?`;
const keys = Object.keys(queryParams);
keys.forEach((key: string, index: number) => {
url = `${url}${key}=${queryParams[key]}${
index === keys.length - 1 ? '' : '&'
}`;
url = `${url}${index === 0 ? '?' : ''}${key}=${encodeURIComponent(
queryParams[key],
)}${index === keys.length - 1 ? '' : '&'}`;
});
}

Expand Down
26 changes: 24 additions & 2 deletions packages/sdks/core-js-sdk/test/httpClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,36 @@ describe('httpClient', () => {
);
});

it('should call fetch without ? when calling "get" without params', () => {
httpClient.get('1/2/3', {
queryParams: {},
});

expect(mockFetch).toHaveBeenCalledWith(`http://descope.com/1/2/3`, {
body: undefined,
credentials: 'include',
headers: new Headers({
test: '123',
Authorization: 'Bearer 456',
...descopeHeaders,
}),
method: 'GET',
});
});

it('should call fetch with multiple params when calling "get"', () => {
httpClient.get('1/2/3', {
headers: { test2: '123' },
queryParams: { test2: '123', test3: '456', test4: '789' },
queryParams: {
test2: '123',
test3: '456',
test4: '789',
test5: `don't+forget+to@escape.urls`,
},
});

expect(mockFetch).toHaveBeenCalledWith(
'http://descope.com/1/2/3?test2=123&test3=456&test4=789',
`http://descope.com/1/2/3?test2=123&test3=456&test4=789&test5=don't%2Bforget%2Bto%40escape.urls`,
{
body: undefined,
credentials: 'include',
Expand Down
66 changes: 37 additions & 29 deletions packages/sdks/nextjs-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [0.2.8](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.7...nextjs-sdk-0.2.8) (2024-09-12)

### Dependency Updates

* `react-sdk` updated to version `2.0.74`
## [0.2.7](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.6...nextjs-sdk-0.2.7) (2024-09-11)

### Dependency Updates
Expand All @@ -19,83 +24,86 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/s

### Dependency Updates

* `react-sdk` updated to version `2.0.71`
- `react-sdk` updated to version `2.0.71`

## [0.2.4](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.3...nextjs-sdk-0.2.4) (2024-09-03)

### Dependency Updates

* `web-js-sdk` updated to version `1.16.4`
* `react-sdk` updated to version `2.0.70`
* `core-js-sdk` updated to version `2.24.4`
* `web-component` updated to version `3.24.1`
- `web-js-sdk` updated to version `1.16.4`
- `react-sdk` updated to version `2.0.70`
- `core-js-sdk` updated to version `2.24.4`
- `web-component` updated to version `3.24.1`

## [0.2.3](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.2...nextjs-sdk-0.2.3) (2024-09-02)

### Dependency Updates

* `react-sdk` updated to version `2.0.69`
* `web-component` updated to version `3.24.0`
- `react-sdk` updated to version `2.0.69`
- `web-component` updated to version `3.24.0`

### Bug Fixes

* issue 7532 RELEASE ([#788](https://github.com/descope/descope-js/issues/788)) ([635a053](https://github.com/descope/descope-js/commit/635a0532a23e7a5bf8f557a0400ddd1c64c81696))
- issue 7532 RELEASE ([#788](https://github.com/descope/descope-js/issues/788)) ([635a053](https://github.com/descope/descope-js/commit/635a0532a23e7a5bf8f557a0400ddd1c64c81696))

## [0.2.2](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.1...nextjs-sdk-0.2.2) (2024-08-20)

### Dependency Updates

* `web-js-sdk` updated to version `1.16.3`
* `react-sdk` updated to version `2.0.68`
* `core-js-sdk` updated to version `2.24.3`
* `web-component` updated to version `3.23.2`
- `web-js-sdk` updated to version `1.16.3`
- `react-sdk` updated to version `2.0.68`
- `core-js-sdk` updated to version `2.24.3`
- `web-component` updated to version `3.23.2`

## [0.2.1](https://github.com/descope/descope-js/compare/nextjs-sdk-0.2.0...nextjs-sdk-0.2.1) (2024-08-15)

### Dependency Updates

* `react-sdk` updated to version `2.0.67`
* `web-component` updated to version `3.23.1`
- `react-sdk` updated to version `2.0.67`
- `web-component` updated to version `3.23.1`

## [0.2.0](https://github.com/descope/descope-js/compare/nextjs-sdk-0.1.0...nextjs-sdk-0.2.0) (2024-08-14)

### Dependency Updates

* `web-js-sdk` updated to version `1.16.2`
* `react-sdk` updated to version `2.0.66`
* `core-js-sdk` updated to version `2.24.2`
* `web-component` updated to version `3.23.0`
- `web-js-sdk` updated to version `1.16.2`
- `react-sdk` updated to version `2.0.66`
- `core-js-sdk` updated to version `2.24.2`
- `web-component` updated to version `3.23.0`

### Features

* support multi style and style prop ([#744](https://github.com/descope/descope-js/issues/744)) ([7d153ec](https://github.com/descope/descope-js/commit/7d153ec7a447f038ee716746a85f1193e8a0f357))
- support multi style and style prop ([#744](https://github.com/descope/descope-js/issues/744)) ([7d153ec](https://github.com/descope/descope-js/commit/7d153ec7a447f038ee716746a85f1193e8a0f357))

## [0.1.0](https://github.com/descope/descope-js/compare/nextjs-sdk-0.0.23...nextjs-sdk-0.1.0) (2024-08-09)


### Features

* Added Private Routes to Next JS SDK ([#770](https://github.com/descope/descope-js/issues/770)) ([ccf6976](https://github.com/descope/descope-js/commit/ccf6976bc07f1ae8fb45bfbc9a5454cba788721f))
- Added Private Routes to Next JS SDK ([#770](https://github.com/descope/descope-js/issues/770)) ([ccf6976](https://github.com/descope/descope-js/commit/ccf6976bc07f1ae8fb45bfbc9a5454cba788721f))

## [0.0.23](https://github.com/descope/descope-js/compare/nextjs-sdk-0.0.22...nextjs-sdk-0.0.23) (2024-08-08)

### Dependency Updates

* `react-sdk` updated to version `2.0.65`
* `web-component` updated to version `3.22.2`
- `react-sdk` updated to version `2.0.65`
- `web-component` updated to version `3.22.2`

### Bug Fixes

* polling when there is a fetch error RELEASE ([#776](https://github.com/descope/descope-js/issues/776)) ([0999164](https://github.com/descope/descope-js/commit/099916447bee3c5e3fe83e70bc01890e12485df2))
- polling when there is a fetch error RELEASE ([#776](https://github.com/descope/descope-js/issues/776)) ([0999164](https://github.com/descope/descope-js/commit/099916447bee3c5e3fe83e70bc01890e12485df2))

## [0.0.22](https://github.com/descope/descope-js/compare/nextjs-sdk-0.0.21...nextjs-sdk-0.0.22) (2024-08-07)

### Dependency Updates

* `web-js-sdk` updated to version `1.16.1`
* `react-sdk` updated to version `2.0.64`
* `core-js-sdk` updated to version `2.24.1`
* `web-component` updated to version `3.22.1`
- `web-js-sdk` updated to version `1.16.1`
- `react-sdk` updated to version `2.0.64`
- `core-js-sdk` updated to version `2.24.1`
- `web-component` updated to version `3.22.1`

### Bug Fixes

* Issue6274 RELEASE ([#774](https://github.com/descope/descope-js/issues/774)) ([1c4b646](https://github.com/descope/descope-js/commit/1c4b64687da48d62339ccb78c2e8fde04e46e8b5))
- Issue6274 RELEASE ([#774](https://github.com/descope/descope-js/issues/774)) ([1c4b646](https://github.com/descope/descope-js/commit/1c4b64687da48d62339ccb78c2e8fde04e46e8b5))

## [0.0.21](https://github.com/descope/descope-js/compare/nextjs-sdk-0.0.20...nextjs-sdk-0.0.21) (2024-08-04)

Expand Down
3 changes: 1 addition & 2 deletions packages/sdks/nextjs-sdk/examples/app-router/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { authMiddleware } from '@descope/nextjs-sdk/server';

export default authMiddleware({
projectId: process.env.NEXT_PUBLIC_DESCOPE_PROJECT_ID,
baseUrl: process.env.NEXT_PUBLIC_DESCOPE_BASE_URL,
baseStaticUrl: process.env.NEXT_PUBLIC_DESCOPE_BASE_STATIC_URL
baseUrl: process.env.NEXT_PUBLIC_DESCOPE_BASE_URL
});

export const config = {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdks/nextjs-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@descope/nextjs-sdk",
"version": "0.2.7",
"version": "0.2.8",
"description": "Descope NextJS SDK",
"author": "Descope Team <info@descope.com>",
"homepage": "https://github.com/descope/descope-js",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdks/nextjs-sdk/src/server/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const isPublicRoute = (req: NextRequest, options: MiddlewareOptions) => {
// Ensure publicRoutes and privateRoutes are arrays, defaulting to empty arrays if not defined
const publicRoutes = options.publicRoutes || [];
const privateRoutes = options.privateRoutes || [];

const isDefaultPublicRoute = Object.values(DEFAULT_PUBLIC_ROUTES).includes(
req.nextUrl.pathname
);
Expand Down
7 changes: 7 additions & 0 deletions packages/sdks/react-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [2.0.74](https://github.com/descope/descope-js/compare/react-sdk-2.0.73...react-sdk-2.0.74) (2024-09-12)


### Bug Fixes

* issue 6274 RELEASE ([#795](https://github.com/descope/descope-js/issues/795)) ([d5c4536](https://github.com/descope/descope-js/commit/d5c453623e78fc7c31b39345485cbdbea54b2422))

## [2.0.73](https://github.com/descope/descope-js/compare/react-sdk-2.0.72...react-sdk-2.0.73) (2024-09-11)

### Dependency Updates
Expand Down
2 changes: 2 additions & 0 deletions packages/sdks/react-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ See bellow for an `.env` file template with more information.

### Run Example

Note: Due to an issue with react-sdk tsconfig, you need to remove `"examples"` from the `exclude` field in the `tsconfig.json` file in the root of the project before running the example.

Run the following command in the root of the project to build and run the example:

```bash
Expand Down
4 changes: 2 additions & 2 deletions packages/sdks/react-sdk/examples/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { AuthProvider } from '../../src';
import App from './App';

const container = document.getElementById('root');
const root = createRoot(container);
const root = createRoot(container!);

root.render(
<BrowserRouter>
<AuthProvider
projectId={process.env.DESCOPE_PROJECT_ID}
projectId={process.env.DESCOPE_PROJECT_ID!}
baseUrl={process.env.DESCOPE_BASE_URL}
baseStaticUrl={process.env.DESCOPE_BASE_STATIC_URL}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/sdks/react-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@descope/react-sdk",
"version": "2.0.73",
"version": "2.0.74",
"description": "Descope React SDK",
"author": "Descope Team <info@descope.com>",
"homepage": "https://github.com/descope/descope-js",
Expand Down
1 change: 0 additions & 1 deletion packages/sdks/react-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"declarationDir": "dts",
"jsx": "react",
"noErrorTruncation": true,
"typeRoots": ["./node_modules/@types", "./node_modules/@types/react"]
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "build", "dist", "test", "examples"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const configContent = {
const apiPath = (prop: 'ssoApps', path: string) =>
`**/*${apiPaths[prop][path]}`;

const samlApps = mockSsoApps
.filter((app) => app.appType === SSOAppType.saml)
const samlApps = mockSsoApps.filter((app) => app.appType === SSOAppType.saml);

test.describe('widget', () => {
test.beforeEach(async ({ page }) => {
Expand Down Expand Up @@ -65,16 +64,14 @@ test.describe('widget', () => {

test('saml apps are in the list', async ({ page }) => {
for (const app of samlApps) {
await expect(
page.locator(`text=${app.name}`).first(),
).toBeVisible();
await expect(page.locator(`text=${app.name}`).first()).toBeVisible();
}
});
test('click app opens a new tab', async ({ page }) => {
const newTabPromise = page.waitForEvent("popup");
const newTabPromise = page.waitForEvent('popup');

const app = page.locator(`text=${samlApps[0].name}`).first()
await app.click()
const app = page.locator(`text=${samlApps[0].name}`).first();
await app.click();

const newTab = await newTabPromise;
await newTab.waitForLoadState();
Expand Down
Loading

0 comments on commit 132355d

Please sign in to comment.