Merge pull request #3124 from pnp/mgwojciech-react-query

React-query samples of Mgwojciech reviewed and ready for merge
This commit is contained in:
Paolo Pialorsi 2022-11-08 19:13:51 +01:00 committed by GitHub
commit 9ed273e508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 25919 additions and 1311 deletions

8
samples/.yo-rc.json Normal file
View File

@ -0,0 +1,8 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": true,
"isCreatingSolution": true,
"environment": "spo",
"whichFolder": "subdir"
}
}

View File

@ -3,7 +3,7 @@
"name": "pnp-sp-dev-spfx-web-parts-react-graph-auto-batching",
"title": "Graph auto batching",
"source": "pnp",
"shortDescription": "This same shows how to abstract batching graph requests",
"shortDescription": "This sample shows how to abstract batching graph requests",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-auto-batching",
"longDescription": [
"This sample shows how to abstract batching Graph requests"

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
import { IPropertyPaneConfiguration } from '@microsoft/sp-property-pane';
import { BaseAdaptiveCardExtension } from '@microsoft/sp-adaptive-card-extension-base';
import { CardView } from './cardView/CardView';
import { QuickView } from './quickView/QuickView';
import { ProfileCardPropertyPane } from './ProfileCardPropertyPane';
import { BatchGraphClient } from '../../dal/http/BatchGraphClient';
import { SPFxHttpClient } from '../../dal/http/SPFxHttpClient';
@ -22,7 +21,6 @@ export interface IProfileCardAdaptiveCardExtensionState {
}
const CARD_VIEW_REGISTRY_ID: string = 'ProfileCard_CARD_VIEW';
export const QUICK_VIEW_REGISTRY_ID: string = 'ProfileCard_QUICK_VIEW';
export default class ProfileCardAdaptiveCardExtension extends BaseAdaptiveCardExtension<
IProfileCardAdaptiveCardExtensionProps,
@ -33,7 +31,7 @@ export default class ProfileCardAdaptiveCardExtension extends BaseAdaptiveCardEx
public async onInit(): Promise<void> {
let client = await this.context.aadHttpClientFactory.getClient('https://graph.microsoft.com');
this.httpClient = new BatchGraphClient(new SPFxHttpClient(client));
let userQuery = this.properties.userId ? `/users/${this.properties.userId}` : "/me"
let userQuery = this.properties.userId ? `/users/${this.properties.userId}` : "/me";
const [userInfoRequest, userPhotoRequest, presenceInfo] = await Promise.all([this.httpClient.get(userQuery),
this.httpClient.get(userQuery+ "/photo/$value"),
this.httpClient.get(userQuery+ "/presence")]);
@ -46,7 +44,6 @@ export default class ProfileCardAdaptiveCardExtension extends BaseAdaptiveCardEx
};
this.cardNavigator.register(CARD_VIEW_REGISTRY_ID, () => new CardView());
this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID, () => new QuickView());
return Promise.resolve();
}

View File

@ -6,9 +6,7 @@ define([], function() {
"TitleFieldLabel": "Card Title",
"IconPropertyFieldLabel": "Card Icon",
"Title": "Adaptive Card Extension",
"SubTitle": "Quick View",
"Description": "Create your SPFx Adaptive Card Extension solution!",
"PrimaryText": "SPFx Adaptive Card Extension",
"QuickViewButton": "Quick View"
}
});

View File

@ -5,10 +5,8 @@ declare interface IProfileCardAdaptiveCardExtensionStrings {
TitleFieldLabel: string;
IconPropertyFieldLabel: string;
Title: string;
SubTitle: string;
Description: string;
PrimaryText: string;
QuickViewButton: string;
}
declare module 'ProfileCardAdaptiveCardExtensionStrings' {

View File

@ -1,27 +0,0 @@
import { ISPFxAdaptiveCard, BaseAdaptiveCardView } from '@microsoft/sp-adaptive-card-extension-base';
import * as strings from 'ProfileCardAdaptiveCardExtensionStrings';
import { IProfileCardAdaptiveCardExtensionProps, IProfileCardAdaptiveCardExtensionState } from '../ProfileCardAdaptiveCardExtension';
export interface IQuickViewData {
subTitle: string;
title: string;
description: string;
}
export class QuickView extends BaseAdaptiveCardView<
IProfileCardAdaptiveCardExtensionProps,
IProfileCardAdaptiveCardExtensionState,
IQuickViewData
> {
public get data(): IQuickViewData {
return {
subTitle: strings.SubTitle,
title: strings.Title,
description: this.properties.description
};
}
public get template(): ISPFxAdaptiveCard {
return require('./template/QuickViewTemplate.json');
}
}

View File

@ -1,33 +0,0 @@
{
"schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "${title}"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "${subTitle}",
"wrap": true
}
]
}
]
},
{
"type": "TextBlock",
"text": "${description}",
"wrap": true
}
]
}

View File

@ -40,7 +40,7 @@ export function UserCard(props: IUserCardProps){
tertiaryText={user.presence}
presence={StringUtilities.getPresence(user.presence)}
size={PersonaSize.size100}
imageAlt="Annie Lindqvist, status is blocked"
imageAlt={user.displayName}
/>
);
}

View File

@ -0,0 +1,378 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'ecmaVersion': 2018,
'sourceType': 'module'
},
rules: {
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/no-new-null': 1,
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/hoist-jest-mock': 1,
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
'@rushstack/security/no-unsafe-regexp': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/adjacent-overload-signatures': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
'@typescript-eslint/ban-types': [
1,
{
'extendDefaults': false,
'types': {
'String': {
'message': 'Use \'string\' instead',
'fixWith': 'string'
},
'Boolean': {
'message': 'Use \'boolean\' instead',
'fixWith': 'boolean'
},
'Number': {
'message': 'Use \'number\' instead',
'fixWith': 'number'
},
'Object': {
'message': 'Use \'object\' instead, or else define a proper TypeScript type:'
},
'Symbol': {
'message': 'Use \'symbol\' instead',
'fixWith': 'symbol'
},
'Function': {
'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
}
}
}
],
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
// Even if the compiler may be able to infer a type, this inference will be unavailable
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
// but writing code is a much less important activity than reading it.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/explicit-function-return-type': [
1,
{
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
'allowHigherOrderFunctions': false
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
// Set to 1 (warning) or 2 (error) to enable.
'@typescript-eslint/explicit-member-accessibility': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-array-constructor': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
// This rule should be suppressed only in very special cases such as JSON.stringify()
// where the type really can be anything. Even if the type is flexible, another type
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
'@typescript-eslint/no-explicit-any': 1,
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
// or else return the object to a caller (who assumes this responsibility). Unterminated
// promise chains are a serious issue. Besides causing errors to be silently ignored,
// they can also cause a NodeJS process to terminate unexpectedly.
'@typescript-eslint/no-floating-promises': 2,
// RATIONALE: Catches a common coding mistake.
'@typescript-eslint/no-for-in-array': 2,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-misused-new': 2,
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
// optimizations. If you are declaring loose functions/variables, it's better to make them
// static members of a class, since classes support property getters and their private
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
// class name tends to produce more discoverable APIs: for example, search+replacing
// the function "reverse()" is likely to return many false matches, whereas if we always
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
// to decompose your code into separate NPM packages, which ensures that component
// dependencies are tracked more conscientiously.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-namespace': [
1,
{
'allowDeclarations': false,
'allowDefinitionFiles': false
}
],
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
// code easier to write, but arguably sacrifices readability: In the notes for
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
// a class's design, so we wouldn't want to bury them in a constructor signature
// just to save some typing.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-parameter-properties': 0,
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
// may impact performance.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-unused-vars': [
1,
{
'vars': 'all',
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
// that are overriding a base class method or implementing an interface.
'args': 'none'
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-use-before-define': [
2,
{
'functions': false,
'classes': true,
'variables': true,
'enums': true,
'typedefs': true
}
],
// Disallows require statements except in import statements.
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
'@typescript-eslint/no-var-requires': 'error',
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/prefer-namespace-keyword': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-inferrable-types': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
'@typescript-eslint/no-empty-interface': 0,
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
'accessor-pairs': 1,
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
'dot-notation': [
1,
{
'allowPattern': '^_'
}
],
// RATIONALE: Catches code that is likely to be incorrect
'eqeqeq': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'for-direction': 1,
// RATIONALE: Catches a common coding mistake.
'guard-for-in': 2,
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
// to split up your code.
'max-lines': ['warn', { max: 2000 }],
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-async-promise-executor': 2,
// RATIONALE: Deprecated language feature.
'no-caller': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-compare-neg-zero': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-cond-assign': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-constant-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-control-regex': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-debugger': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-delete-var': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-duplicate-case': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-character-class': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-pattern': 1,
// RATIONALE: Eval is a security concern and a performance concern.
'no-eval': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-ex-assign': 2,
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
// If two different libraries (or two versions of the same library) both try to modify
// a type, only one of them can win. Polyfills are acceptable because they implement
// a standardized interoperable contract, but polyfills are generally coded in plain
// JavaScript.
'no-extend-native': 1,
// Disallow unnecessary labels
'no-extra-label': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-fallthrough': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-func-assign': 1,
// RATIONALE: Catches a common coding mistake.
'no-implied-eval': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-invalid-regexp': 2,
// RATIONALE: Catches a common coding mistake.
'no-label-var': 2,
// RATIONALE: Eliminates redundant code.
'no-lone-blocks': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-misleading-character-class': 2,
// RATIONALE: Catches a common coding mistake.
'no-multi-str': 2,
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
// or else implies that the constructor is doing nontrivial computations, which is often
// a poor class design.
'no-new': 1,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-func': 2,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-object': 2,
// RATIONALE: Obsolete notation.
'no-new-wrappers': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-octal': 2,
// RATIONALE: Catches code that is likely to be incorrect
'no-octal-escape': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-regex-spaces': 2,
// RATIONALE: Catches a common coding mistake.
'no-return-assign': 2,
// RATIONALE: Security risk.
'no-script-url': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-self-assign': 2,
// RATIONALE: Catches a common coding mistake.
'no-self-compare': 2,
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
// commas to create compound expressions. In general code is more readable if each
// step is split onto a separate line. This also makes it easier to set breakpoints
// in the debugger.
'no-sequences': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-shadow-restricted-names': 2,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-sparse-arrays': 2,
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
// such flexibility adds pointless complexity, by requiring every catch block to test
// the type of the object that it receives. Whereas if catch blocks can always assume
// that their object implements the "Error" contract, then the code is simpler, and
// we generally get useful additional information like a call stack.
'no-throw-literal': 2,
// RATIONALE: Catches a common coding mistake.
'no-unmodified-loop-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unsafe-finally': 2,
// RATIONALE: Catches a common coding mistake.
'no-unused-expressions': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unused-labels': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-useless-catch': 1,
// RATIONALE: Avoids a potential performance problem.
'no-useless-concat': 1,
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
// Always use "let" or "const" instead.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'no-var': 2,
// RATIONALE: Generally not needed in modern code.
'no-void': 1,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-with': 2,
// RATIONALE: Makes logic easier to understand, since constants always have a known value
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
'prefer-const': 1,
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
'promise/param-names': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-atomic-updates': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-yield': 1,
// "Use strict" is redundant when using the TypeScript compiler.
'strict': [
2,
'never'
],
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'use-isnan': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
// Set to 1 (warning) or 2 (error) to enable.
// Rationale to disable: !!{}
'no-extra-boolean-cast': 0,
// ====================================================================
// @microsoft/eslint-plugin-spfx
// ====================================================================
'@microsoft/spfx/import-requires-chunk-name': 1,
'@microsoft/spfx/no-require-ensure': 2,
'@microsoft/spfx/pair-react-dom-render-unmount': 1
}
},
{
// For unit tests, we can be a little bit less strict. The settings below revise the
// defaults specified in the extended configurations, as well as above.
files: [
// Test files
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
// Facebook convention
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
// Microsoft convention
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {
'no-new': 0,
'class-name': 0,
'export-name': 0,
forin: 0,
'label-position': 0,
'member-access': 2,
'no-arg': 0,
'no-console': 0,
'no-construct': 0,
'no-duplicate-variable': 2,
'no-eval': 0,
'no-function-expression': 2,
'no-internal-module': 2,
'no-shadowed-variable': 2,
'no-switch-case-fall-through': 2,
'no-unnecessary-semicolons': 2,
'no-unused-expression': 2,
'no-with-statement': 2,
semicolon: 2,
'trailing-comma': 0,
typedef: 0,
'typedef-whitespace': 0,
'use-named-parameter': 2,
'variable-name': 0,
whitespace: 0
}
}
]
};

34
samples/react-react-query/.gitignore vendored Normal file
View File

@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts

View File

@ -0,0 +1,16 @@
!dist
config
gulpfile.js
release
src
temp
tsconfig.json
tslint.json
*.log
.yo-rc.json
.vscode

View File

@ -0,0 +1,16 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"version": "1.15.2",
"libraryName": "react-react-query",
"libraryId": "0fa98b42-4f79-4e63-a028-9caa0de6b755",
"environment": "spo",
"packageManager": "npm",
"solutionName": "react-react-query",
"solutionShortDescription": "react-react-query description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,66 @@
# react-react-query
## Summary
This sample shows how to use react query library and react hooks with SPFx. Main focus is on contextually centralized MS Graph Client to avoid calls duplication.
## Used SharePoint Framework Version
![version](https://img.shields.io/badge/version-1.15-green.svg)
## Applies to
- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)
## Prerequisites
> MS SPO Extensibility Principal should be provisioned and access to MS Graph API with User.Read should be granted before running this sample.
## Solution
| Solution | Author(s) |
| ----------- | ------------------------------------------------------- |
| react-react-query | Marcin Wojciechowski [@mgwojciech](https://twitter.com/mgwojciech) |
## Version history
| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | October, 19 | Initial release |
## Disclaimer
**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
---
## Minimal Path to Awesome
- Clone this repository
- Ensure that you are at the solution folder
- in the command-line run:
- **npm install**
- **gulp serve**
> Include any additional steps as needed.
## Features
The idea of this sample is simple. Quite often in our solutions we need to use data from one endpoint in multiple places. I think the most common scenario might be displaying current user info.
One of the most popular libraries to handle http requests in React is [react-query](https://react-query-v3.tanstack.com/). This library simplifies http calls by providing easy to use react hook.
You can see, that although we are rendering user four times, there is only one batched request to MS Graph API. Note, I implemented three different user components to test nesting case as well as using the same hook in different component.
Additional benefit of such approach is better isolation from SPFx itself. Not only it would be easier to move this solution from SPFx to simple React project (should You need to expose similar functionality outside of SharePoint context), but it improved testability of the solution. I added two tests to the solution: User.test.tsx - which mocks whole context and UserMockHook which benefits from the fact, that we can mock only useUserQuery hook.
## References
- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Building for Microsoft teams](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-overview)
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
- [Publish SharePoint Framework applications to the Marketplace](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview)
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development

View File

@ -0,0 +1,50 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-react-query",
"title": "React Query Microsoft Graph",
"source": "pnp",
"shortDescription": "This sample shows how you can query Microsoft Graph from React in SharePoint Framework",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-graph-auto-batching",
"longDescription": [
"This sample shows how you can query Microsoft Graph from React in SharePoint Framework"
],
"creationDateTime": "2022-10-18",
"updateDateTime": "2022-10-18",
"products": [
"SharePoint"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.15.2"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/gh-pages/img/_nopreview.png",
"alt": "No preview available"
}
],
"authors": [
{
"gitHubAccount": "mgwojciech",
"pictureUrl": "https://github.com/mgwojciech.png",
"name": "Marcin Wojciechowski",
"company": "Valo"
}
],
"references": [
{
"name": "Build your first SharePoint client-side web part",
"description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.",
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
}
]
}
]

View File

@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"react-query-sample-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/reactQuerySample/ReactQuerySampleWebPart.js",
"manifest": "./src/webparts/reactQuerySample/ReactQuerySampleWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"ReactQuerySampleWebPartStrings": "lib/webparts/reactQuerySample/loc/{locale}.js"
}
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-react-query",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,40 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "react-react-query-client-side-solution",
"id": "0fa98b42-4f79-4e63-a028-9caa0de6b755",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.15.2"
},
"metadata": {
"shortDescription": {
"default": "react-react-query description"
},
"longDescription": {
"default": "react-react-query description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "react-react-query Feature",
"description": "The feature that activates elements of the react-react-query solution.",
"id": "21ffcdab-d436-482a-a916-de1db97e4ee2",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/react-react-query.sppkg"
}
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

16
samples/react-react-query/gulpfile.js vendored Normal file
View File

@ -0,0 +1,16 @@
'use strict';
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

23516
samples/react-react-query/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
{
"name": "react-react-query",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.15.2",
"@microsoft/sp-lodash-subset": "1.15.2",
"@microsoft/sp-office-ui-fabric-core": "1.15.2",
"@microsoft/sp-property-pane": "1.15.2",
"@microsoft/sp-webpart-base": "1.15.2",
"mgwdev-m365-helpers": "0.0.13",
"office-ui-fabric-react": "7.185.7",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-query": "^3.39.2",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/eslint-config-spfx": "1.15.2",
"@microsoft/eslint-plugin-spfx": "1.15.2",
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "1.15.2",
"@microsoft/sp-module-interfaces": "1.15.2",
"@rushstack/eslint-config": "2.5.1",
"@testing-library/react": "^12.1.2",
"@types/jest": "^29.2.0",
"@types/react": "16.9.51",
"@types/react-dom": "16.9.8",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.2.0",
"jest-environment-jsdom": "^29.2.0",
"ts-jest": "^29.0.3",
"typescript": "4.5.5"
},
"jest": {
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"testEnvironment": "jsdom",
"testRegex": "(/__tests__/.*|(\\.|/)(test))\\.(ts?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
],
"transformIgnorePatterns": [
"node_modules/(?!(@microsoft/*|@microsoft/sp-http|))"
]
}
}

View File

@ -0,0 +1,22 @@
import { Persona, PersonaSize, Spinner, Text } from "office-ui-fabric-react";
import * as React from "react";
import { useUserQuery } from "../queries/SampleQueries";
import { StringUtilities } from "../utils/StringUtilities";
export function AnotherUser(): React.ReactElement {
const { isLoading, isError, data, error } = useUserQuery();
if (isLoading) {
return <Spinner />;
}
if (isError) {
return <Text>{error}</Text>;
}
return <Persona
text={data.displayName}
tertiaryText={data.presence.availability}
secondaryText={data.jobTitle}
presence={StringUtilities.getPresence(data.presence.availability)}
size={PersonaSize.size100}
imageUrl={`data:image/png;base64,${data.photo.replace("\"", "").replace("\"", "")}`} />;
}

View File

@ -0,0 +1,8 @@
import * as React from "react";
import { User } from "./User";
export function ComponentWithNestedUser(): React.ReactElement {
return <div>
<div><User /></div>
</div>
}

View File

@ -0,0 +1,22 @@
import { Persona, PersonaSize, Spinner, Text } from "office-ui-fabric-react";
import * as React from "react";
import { useUserQuery } from "../queries/SampleQueries";
import { StringUtilities } from "../utils/StringUtilities";
export function User(): React.ReactElement {
const { isLoading, isError, data, error } = useUserQuery();
if (isLoading) {
return <Spinner />;
}
if (isError) {
return <Text>{error}</Text>;
}
return <Persona
text={data.displayName}
tertiaryText={data.presence.availability}
secondaryText={data.jobTitle}
presence={StringUtilities.getPresence(data.presence.availability)}
size={PersonaSize.size100}
imageUrl={`data:image/png;base64,${data.photo.replace("\"", "").replace("\"", "")}`} />;
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,33 @@
import { IHttpClient } from "mgwdev-m365-helpers";
import { QueryClient, QueryClientProvider } from "react-query";
import * as React from "react";
interface IAppContext {
graphClient: IHttpClient;
queryClient?: QueryClient;
}
const queryClient: QueryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 30,
cacheTime: 1000 * 5 * 1,
retry: 1,
},
},
});
export const AppContext = React.createContext<IAppContext>({
graphClient: null,
queryClient: null,
});
export function ContextProvider(props: {
children: React.ReactNode,
graphClient: IHttpClient,
queryClient?: QueryClient
}): React.ReactElement {
return <AppContext.Provider value={props}>
<QueryClientProvider client={props.queryClient || queryClient}>
{props.children}</QueryClientProvider>
</AppContext.Provider>
}

View File

@ -0,0 +1,8 @@
import { IHttpClient } from "mgwdev-m365-helpers";
import { useContext } from "react";
import { AppContext } from "./ContextProvider";
export function useGraphClient(): IHttpClient {
const { graphClient } = useContext(AppContext);
return graphClient;
}

View File

@ -0,0 +1,25 @@
import { useQuery, UseQueryResult } from "react-query";
import { useGraphClient } from "../infrastructure/UseHttpClient";
export interface IUser {
displayName: string;
jobTitle: string;
presence: { availability: string };
photo: string;
}
export function useUserQuery(userId?: string): UseQueryResult<IUser> {
const graphClient = useGraphClient();
return useQuery(userId ? `user${userId}` : 'me', async () => {
const query = userId ? `users/${userId}` : "me"
const [me, photo, presence] = await Promise.all([
graphClient.get(`https://graph.microsoft.com/v1.0/${query}`).then(r => r.json()),
graphClient.get(`https://graph.microsoft.com/v1.0/${query}/photo/$value`).then(r => r.text()),
graphClient.get(`https://graph.microsoft.com/v1.0/${query}/presence`).then(r => r.json()),
]);
return {
...me,
photo,
presence
}
});
}

View File

@ -0,0 +1,32 @@
import { PersonaPresence } from "office-ui-fabric-react";
export class StringUtilities {
public static getInitials(fullName: string): string {
if (!fullName) {
return "";
}
let initials = "";
const names = fullName.split(" ");
for (let i = 0; i < names.length && i < 2; i++) {
const name = names[i];
if (name) {
initials += name.charAt(0);
}
}
return initials.toUpperCase();
}
public static getPresence(presenceString: string): PersonaPresence{
switch (presenceString) {
case "":
return PersonaPresence.none;
case "Available":
return PersonaPresence.online;
case "Away":
return PersonaPresence.away;
case "Busy":
return PersonaPresence.busy;
default:
return PersonaPresence.offline;
}
}
}

View File

@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "112b63b5-c2a0-4b47-b9f0-f28a82772bd3",
"alias": "ReactQuerySampleWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Advanced
"group": { "default": "Advanced" },
"title": { "default": "React Query sample" },
"description": { "default": "React Query sample description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "React Query sample"
}
}]
}

View File

@ -0,0 +1,104 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { IReadonlyTheme } from '@microsoft/sp-component-base';
import * as strings from 'ReactQuerySampleWebPartStrings';
import ReactQuerySample from './components/ReactQuerySample';
import { IReactQuerySampleProps } from './components/IReactQuerySampleProps';
import { BatchGraphClient, IHttpClient, SPFxGraphHttpClient } from 'mgwdev-m365-helpers';
import { ContextProvider } from '../../infrastructure/ContextProvider';
export interface IReactQuerySampleWebPartProps {
description: string;
}
export default class ReactQuerySampleWebPart extends BaseClientSideWebPart<IReactQuerySampleWebPartProps> {
private _isDarkTheme: boolean = false;
private _environmentMessage: string = '';
protected graphClient: IHttpClient;
public render(): void {
const element: React.ReactElement<IReactQuerySampleProps> = React.createElement(
ReactQuerySample,
{
description: this.properties.description,
isDarkTheme: this._isDarkTheme,
environmentMessage: this._environmentMessage,
hasTeamsContext: !!this.context.sdks.microsoftTeams,
userDisplayName: this.context.pageContext.user.displayName,
graphClient: this.graphClient
}
);
const appContext = ContextProvider({ children: element, graphClient: this.graphClient})
ReactDom.render(appContext, this.domElement);
}
protected async onInit(): Promise<void> {
this._environmentMessage = this._getEnvironmentMessage();
this.graphClient = new BatchGraphClient(new SPFxGraphHttpClient(await this.context.aadHttpClientFactory.getClient("https://graph.microsoft.com")))
return await super.onInit();
}
private _getEnvironmentMessage(): string {
if (!!this.context.sdks.microsoftTeams) { // running in Teams
return this.context.isServedFromLocalhost ? strings.AppLocalEnvironmentTeams : strings.AppTeamsTabEnvironment;
}
return this.context.isServedFromLocalhost ? strings.AppLocalEnvironmentSharePoint : strings.AppSharePointEnvironment;
}
protected onThemeChanged(currentTheme: IReadonlyTheme | undefined): void {
if (!currentTheme) {
return;
}
this._isDarkTheme = !!currentTheme.isInverted;
const {
semanticColors
} = currentTheme;
if (semanticColors) {
this.domElement.style.setProperty('--bodyText', semanticColors.bodyText || null);
this.domElement.style.setProperty('--link', semanticColors.link || null);
this.domElement.style.setProperty('--linkHovered', semanticColors.linkHovered || null);
}
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField('description', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,10 @@
import { IHttpClient } from "mgwdev-m365-helpers";
export interface IReactQuerySampleProps {
description: string;
isDarkTheme: boolean;
environmentMessage: string;
hasTeamsContext: boolean;
userDisplayName: string;
graphClient: IHttpClient;
}

View File

@ -0,0 +1,34 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
.reactQuerySample {
overflow: hidden;
padding: 1em;
color: "[theme:bodyText, default: #323130]";
color: var(--bodyText);
&.teams {
font-family: $ms-font-family-fallbacks;
}
}
.welcome {
text-align: center;
}
.welcomeImage {
width: 100%;
max-width: 420px;
}
.links {
a {
text-decoration: none;
color: "[theme:link, default:#03787c]";
color: var(--link); // note: CSS Custom Properties support is limited to modern browsers only
&:hover {
text-decoration: underline;
color: "[theme:linkHovered, default: #014446]";
color: var(--linkHovered); // note: CSS Custom Properties support is limited to modern browsers only
}
}
}

View File

@ -0,0 +1,30 @@
import * as React from 'react';
import styles from './ReactQuerySample.module.scss';
import { IReactQuerySampleProps } from './IReactQuerySampleProps';
import { escape } from '@microsoft/sp-lodash-subset';
import { User } from '../../../components/User';
import { ComponentWithNestedUser } from '../../../components/ComponentWithNestedUser';
import { AnotherUser } from '../../../components/AnotherUser';
export default function ReactQuerySample(props: IReactQuerySampleProps): React.ReactElement {
return (
<section className={`${styles.reactQuerySample} ${props.hasTeamsContext ? styles.teams : ''}`}>
<div className={styles.welcome}>
<img alt="" src={props.isDarkTheme ? require('../assets/welcome-dark.png') : require('../assets/welcome-light.png')} className={styles.welcomeImage} />
<h2>Well done, {escape(props.userDisplayName)}!</h2>
<div>{props.environmentMessage}</div>
<div>Web part property value: <strong>{escape(props.description)}</strong></div>
</div>
<div>
<h3>Welcome to SharePoint Framework!</h3>
<p>
The SharePoint Framework (SPFx) is a extensibility model for Microsoft Viva, Microsoft Teams and SharePoint. It&#39;s the easiest way to extend Microsoft 365 with automatic Single Sign On, automatic hosting and industry standard tooling.
</p>
<User />
<User />
<AnotherUser />
<ComponentWithNestedUser />
</div>
</section>
);
}

View File

@ -0,0 +1,11 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field",
"AppLocalEnvironmentSharePoint": "The app is running on your local environment as SharePoint web part",
"AppLocalEnvironmentTeams": "The app is running on your local environment as Microsoft Teams app",
"AppSharePointEnvironment": "The app is running on SharePoint page",
"AppTeamsTabEnvironment": "The app is running in Microsoft Teams"
}
});

View File

@ -0,0 +1,14 @@
declare interface IReactQuerySampleWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
AppLocalEnvironmentSharePoint: string;
AppLocalEnvironmentTeams: string;
AppSharePointEnvironment: string;
AppTeamsTabEnvironment: string;
}
declare module 'ReactQuerySampleWebPartStrings' {
const strings: IReactQuerySampleWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View File

@ -0,0 +1,45 @@
/// <reference types="jest" />
import * as React from "react";
import { User } from "../../src/components/User"
import { ContextProvider } from "../../src/infrastructure/ContextProvider";
import { render, act, RenderResult } from "@testing-library/react";
describe("<User />", () => {
test("should render user", async () => {
let graphClient = {
get: () => Promise.resolve({
ok: true,
json: () => Promise.resolve({}),
text: () => Promise.resolve("")
})
}
//@ts-ignore
jest.spyOn(graphClient, "get").mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve({ displayName: "Test user", jobTitle: "Developer" })
});
//@ts-ignore
jest.spyOn(graphClient, "get").mockResolvedValueOnce({
ok: true,
text: () => Promise.resolve("")
});
//@ts-ignore
jest.spyOn(graphClient, "get").mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve({ availability: "Available" })
});
let context = ContextProvider({
children: <User />,
graphClient: graphClient as any,
});
let contextComponent: RenderResult;
await act(async () => {
contextComponent = await render(context);
let userDisplayName = await contextComponent.findAllByText("Test user");
let availability = await contextComponent.findAllByText("Available");
expect(userDisplayName.length).toBeGreaterThan(0);
expect(availability.length).toBeGreaterThan(0);
});
});
})

View File

@ -0,0 +1,38 @@
/// <reference types="jest" />
import * as React from "react";
import { User } from "../../src/components/User"
import { render, act, RenderResult } from "@testing-library/react";
import { UseQueryResult } from "react-query";
let userQueryMock: UseQueryResult<any>;
jest.mock("../../src/queries/SampleQueries", () => {
return {
useUserQuery: jest.fn(() => (userQueryMock))
}
})
describe("<User /> (mocked hook)", () => {
test("should render user", async () => {
userQueryMock = {
isLoading: false,
data: {
displayName: "Test user",
presence: { availability: "Available" },
jobTitle: "Developer",
photo: "mock-photo"
},
isError: false
} as UseQueryResult<any>
let userComponent: RenderResult;
await act(async () => {
userComponent = await render(<User />);
let userDisplayName = await userComponent.findAllByText("Test user");
let availability = await userComponent.findAllByText("Available");
expect(userDisplayName.length).toBeGreaterThan(0);
expect(availability.length).toBeGreaterThan(0);
});
});
})

View File

@ -0,0 +1,37 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}