Skip to content

Commit 6c90407

Browse files
authored
Reexport API functions (#474)
1 parent 487033c commit 6c90407

19 files changed

+12896
-21546
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ or the [example folder](examples) for full code examples.
3434

3535
The following steps will walk you through installing the library and integrating it into your application.
3636

37+
> [!TIP]
38+
> If you are using Next.js, head over to the [Plug Next.js](https://github.com/croct-tech/plug-next) library for a more
39+
> integrated experience.
40+
3741
This guide assumes you're already familiar with some key concepts and tools around Croct, like
3842
Contextual Query Language (CQL) and the playground. If you're not,
3943
[this 15-minute quickstart](https://croct.link/plug-js/quick-start) that will give you a hands-on overview of

package-lock.json

+12,878-21,261
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
3838
},
3939
"dependencies": {
40-
"@croct/plug": "^0.13.4",
41-
"@croct/sdk": "^0.14.0"
40+
"@croct/plug": "^0.14.0",
41+
"@croct/sdk": "^0.15.2"
4242
},
4343
"devDependencies": {
4444
"@babel/core": "^7.20.2",
@@ -61,7 +61,7 @@
6161
"@typescript-eslint/eslint-plugin": "^7.0.0",
6262
"@typescript-eslint/parser": "^7.0.0",
6363
"babel-loader": "^9.1.0",
64-
"eslint": "^9.0.0",
64+
"eslint": "^8.57.0",
6565
"jest": "^29.0.0",
6666
"jest-environment-jsdom": "^29.0.0",
6767
"jest-environment-node": "^29.0.0",

src/CroctProvider.test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@testing-library/jest-dom/extend-expect';
21
import {render} from '@testing-library/react';
32
import {Plug} from '@croct/plug';
43
import {croct} from './ssr-polyfills';

src/api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@croct/plug/api';

src/api/evaluate.test.ts

-61
This file was deleted.

src/api/evaluate.ts

-20
This file was deleted.

src/api/fetchContent.test.ts

-144
This file was deleted.

src/api/fetchContent.ts

-48
This file was deleted.

src/api/index.ts

-2
This file was deleted.

src/components/Personalization/index.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, ReactElement, Suspense} from 'react';
2-
import {Story, Meta} from '@storybook/react/types-6-0';
2+
import {StoryFn as Story, Meta} from '@storybook/react';
33
import {Personalization, PersonalizationProps} from './index';
44

55
export default {

src/components/Personalization/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import {ReactElement, Fragment} from 'react';
24
import {JsonValue} from '@croct/plug/sdk/json';
35
import {UseEvaluationOptions, useEvaluation} from '../../hooks';

src/components/Slot/index.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, ReactElement, Suspense} from 'react';
2-
import {Story, Meta} from '@storybook/react/types-6-0';
2+
import {StoryFn as Story, Meta} from '@storybook/react';
33
import {Slot, SlotProps} from './index';
44

55
export default {

src/components/Slot/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import {Fragment, ReactElement, ReactNode} from 'react';
24
import {SlotContent, VersionedSlotId, VersionedSlotMap} from '@croct/plug/slot';
35
import {JsonObject} from '@croct/plug/sdk/json';

src/hooks/useContent.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, ReactElement, Suspense} from 'react';
2-
import {Story, Meta} from '@storybook/react/types-6-0';
2+
import {StoryFn as Story, Meta} from '@storybook/react';
33
import {UseContentOptions, useContent} from './useContent';
44

55
export default {

src/hooks/useEvaluation.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, ReactElement, Suspense} from 'react';
2-
import {Story, Meta} from '@storybook/react/types-6-0';
2+
import {StoryFn as Story, Meta} from '@storybook/react';
33
import {UseEvaluationOptions, useEvaluation} from './useEvaluation';
44

55
export default {

src/hooks/useEvaluation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {isSsr} from '../ssr-polyfills';
77
function cleanEvaluationOptions(options: EvaluationOptions): EvaluationOptions {
88
const result: EvaluationOptions = {};
99

10-
for (const [key, value] of Object.entries(options)) {
10+
for (const [key, value] of Object.entries(options) as Array<[keyof EvaluationOptions, any]>) {
1111
if (value !== undefined) {
1212
result[key] = value;
1313
}

src/ssr-polyfills.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import csrPlug, {Plug} from '@croct/plug';
22

33
export function isSsr(): boolean {
4+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- The window can be undefined.
45
return typeof window === 'undefined'
56
|| typeof window.document === 'undefined'
67
|| typeof window.document.createElement === 'undefined';

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"noImplicitThis": true,
1717
"noImplicitAny": true,
1818
"strictNullChecks": true,
19-
"suppressImplicitAnyIndexErrors": true,
2019
"noUnusedLocals": true,
2120
"noUnusedParameters": true,
2221
"allowSyntheticDefaultImports": true,

0 commit comments

Comments
 (0)