Skip to content

Commit

Permalink
Reexport API functions (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos committed May 6, 2024
1 parent 487033c commit 6c90407
Show file tree
Hide file tree
Showing 19 changed files with 12,896 additions and 21,546 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ or the [example folder](examples) for full code examples.

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

> [!TIP]
> If you are using Next.js, head over to the [Plug Next.js](https://github.com/croct-tech/plug-next) library for a more
> integrated experience.
This guide assumes you're already familiar with some key concepts and tools around Croct, like
Contextual Query Language (CQL) and the playground. If you're not,
[this 15-minute quickstart](https://croct.link/plug-js/quick-start) that will give you a hands-on overview of
Expand Down
34,139 changes: 12,878 additions & 21,261 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
"@croct/plug": "^0.13.4",
"@croct/sdk": "^0.14.0"
"@croct/plug": "^0.14.0",
"@croct/sdk": "^0.15.2"
},
"devDependencies": {
"@babel/core": "^7.20.2",
Expand All @@ -61,7 +61,7 @@
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"babel-loader": "^9.1.0",
"eslint": "^9.0.0",
"eslint": "^8.57.0",
"jest": "^29.0.0",
"jest-environment-jsdom": "^29.0.0",
"jest-environment-node": "^29.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/CroctProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '@testing-library/jest-dom/extend-expect';
import {render} from '@testing-library/react';
import {Plug} from '@croct/plug';
import {croct} from './ssr-polyfills';
Expand Down
1 change: 1 addition & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@croct/plug/api';
61 changes: 0 additions & 61 deletions src/api/evaluate.test.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/api/evaluate.ts

This file was deleted.

144 changes: 0 additions & 144 deletions src/api/fetchContent.test.ts

This file was deleted.

48 changes: 0 additions & 48 deletions src/api/fetchContent.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/api/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Personalization/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FunctionComponent, ReactElement, Suspense} from 'react';
import {Story, Meta} from '@storybook/react/types-6-0';
import {StoryFn as Story, Meta} from '@storybook/react';
import {Personalization, PersonalizationProps} from './index';

export default {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Personalization/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import {ReactElement, Fragment} from 'react';
import {JsonValue} from '@croct/plug/sdk/json';
import {UseEvaluationOptions, useEvaluation} from '../../hooks';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Slot/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FunctionComponent, ReactElement, Suspense} from 'react';
import {Story, Meta} from '@storybook/react/types-6-0';
import {StoryFn as Story, Meta} from '@storybook/react';
import {Slot, SlotProps} from './index';

export default {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Slot/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import {Fragment, ReactElement, ReactNode} from 'react';
import {SlotContent, VersionedSlotId, VersionedSlotMap} from '@croct/plug/slot';
import {JsonObject} from '@croct/plug/sdk/json';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useContent.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FunctionComponent, ReactElement, Suspense} from 'react';
import {Story, Meta} from '@storybook/react/types-6-0';
import {StoryFn as Story, Meta} from '@storybook/react';
import {UseContentOptions, useContent} from './useContent';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useEvaluation.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FunctionComponent, ReactElement, Suspense} from 'react';
import {Story, Meta} from '@storybook/react/types-6-0';
import {StoryFn as Story, Meta} from '@storybook/react';
import {UseEvaluationOptions, useEvaluation} from './useEvaluation';

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useEvaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {isSsr} from '../ssr-polyfills';
function cleanEvaluationOptions(options: EvaluationOptions): EvaluationOptions {
const result: EvaluationOptions = {};

for (const [key, value] of Object.entries(options)) {
for (const [key, value] of Object.entries(options) as Array<[keyof EvaluationOptions, any]>) {
if (value !== undefined) {
result[key] = value;
}
Expand Down
1 change: 1 addition & 0 deletions src/ssr-polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import csrPlug, {Plug} from '@croct/plug';

export function isSsr(): boolean {
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain -- The window can be undefined.
return typeof window === 'undefined'
|| typeof window.document === 'undefined'
|| typeof window.document.createElement === 'undefined';
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 6c90407

Please sign in to comment.