commt sales-orders sample

This commit is contained in:
João Mendes 2023-11-05 21:06:03 +00:00
parent 30d7ba054c
commit 6f21f2f12b
53 changed files with 35039 additions and 0 deletions

View File

@ -0,0 +1,352 @@
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/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: {}
}
]
};

34
samples/react-sales-orders/.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,24 @@
{
"@microsoft/generator-sharepoint": {
"whichFolder": "subdir",
"solutionName": "salesorders",
"environment": "spo",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart",
"template": "react",
"componentName": "salesorders",
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "16.18.1",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
},
"version": "1.18.0",
"libraryName": "salesorders",
"libraryId": "d0835894-052b-4728-8fa7-721ad33d4605",
"packageManager": "npm",
"solutionShortDescription": "salesorders description"
}
}

View File

@ -0,0 +1,78 @@
# SPFx (SharePoint Framework) App
## Summary
The SharePoint Framework (SPFx) is a page and web part model that provides full support for client-side SharePoint development, easy integration with SharePoint data, and extending Microsoft Teams. This project applies SPFx to Teams personal tab and group tab support.
## 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)
## Prerequisites
> - [Set up SharePoint Framework development environment](https://aka.ms/teamsfx-spfx-dev-environment-setup)
> - An Microsoft 365 account. Get your own free Microsoft 365 tenant from [Microsoft 365 developer program](https://developer.microsoft.com/en-us/microsoft-365/dev-program)
> - [Teams Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher or [TeamsFx CLI](https://aka.ms/teamsfx-cli)
## Solution
Solution|Author(s)
--------|---------
folder name | Author details (name, company, twitter alias with link)
## Version history
Version|Date|Comments
-------|----|--------
1.1|March 10, 2021|Update comment
1.0|January 29, 2021|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
1. Open the project with VSCode, click `Provision` in LIFECYCLE panel of Teams Toolkit extension.
Or you can use TeamsFx CLI with running this cmd under your project path:
`teamsfx provision`
It will provision an app in Teams App Studio. You may need to login with your Microsoft 365 tenant admin account.
2. Build and Deploy your SharePoint Package.
- Click `Deploy` in LIFECYCLE panel of Teams Toolkit extension, or run `Teams: Deploy` from command palette. This will generate a SharePoint package (*.sppkg) under sharepoint/solution folder.
Or you can use TeamsFx CLI with running this cmd under your project path:
`teamsfx deploy`
- After building the *.sppkg, the Teams Toolkit extension will upload and deploy it to your tenant App Catalog. Only tenant App Catalog site admin has permission to do it. You can create your test tenant following [Setup your Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant).
3. Go back to Teams Toolkit extension, click `Teams: Publish` in LIFECYCLE panel.
Or you can use TeamsFx CLI with running this cmd under your project path:
`teamsfx publish`
You will find your app in [Microsoft Teams admin center](https://admin.teams.microsoft.com/policies/manage-apps). Enter your app name in the search box. Click the item and select `Publish` in the Publishing status.
4. You may need to wait for a few minutes after publishing your teams app. And then login to Teams, and you will find your app in the `Apps - Built for {your-tenant-name}` category.
5. Click "Add" to use the app as a personal tab. Click "Add to a team" to use the app as a group tab.
## Debug
Start debugging the project by hitting the `F5` key in Visual Studio Code. Alternatively use the `Run and Debug Activity Panel` in Visual Studio Code and click the `Start Debugging` green arrow button.
- `Teams workbench` is the default debug configuration. Using this configuration, you can install the SPFx app within Teams context as a Teams app.
- `Hosted workbench`. You need to navigate to [launch.json](../.vscode/launch.json), replace `enter-your-SharePoint-site` with your SharePoint site, eg. `https://{your-tenant-name}.sharepoint.com/sites/{your-team-name}/_layouts/workbench.aspx`. You can also use root site if you haven't created one, eg. `https://{your-tenant-name}.sharepoint.com/_layouts/workbench.aspx`.
## 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,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"salesorders-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/salesorders/SalesordersWebPart.js",
"manifest": "./src/webparts/salesorders/SalesordersWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"SalesordersWebPartStrings": "lib/webparts/salesorders/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": "salesorders",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,46 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "salesorders-client-side-solution",
"id": "d0835894-052b-4728-8fa7-721ad33d4605",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "ExternalItem.Read.All"
}
],
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.18.0"
},
"metadata": {
"shortDescription": {
"default": "Sales Orders"
},
"longDescription": {
"default": "Sales Orders"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "salesorders app",
"description": "The feature that activates elements of the salesorders solution.",
"id": "534d165b-de00-4e80-b8b4-7056027e256a",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/salesorders.sppkg"
}
}

View File

@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

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://{tenantDomain}/_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-sales-orders/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'));

32564
samples/react-sales-orders/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
{
"name": "salesorders",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@fluentui/react": "^8.106.4",
"@fluentui/react-components": "^9.37.3",
"@fluentui/react-search-preview": "^0.1.30",
"@iconify/react": "^4.1.1",
"@microsoft/microsoft-graph-types": "^2.38.0",
"@microsoft/sp-component-base": "1.18.0",
"@microsoft/sp-core-library": "1.18.0",
"@microsoft/sp-lodash-subset": "1.18.0",
"@microsoft/sp-office-ui-fabric-core": "1.18.0",
"@microsoft/sp-property-pane": "1.18.0",
"@microsoft/sp-webpart-base": "1.18.0",
"date-fns": "^2.30.0",
"jotai": "^2.5.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/eslint-config-spfx": "1.18.0",
"@microsoft/eslint-plugin-spfx": "1.18.0",
"@microsoft/rush-stack-compiler-4.7": "0.1.0",
"@microsoft/sp-build-web": "1.18.0",
"@microsoft/sp-module-interfaces": "1.18.0",
"@rushstack/eslint-config": "2.5.1",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint": "8.7.0",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"typescript": "4.7.4"
}
}

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,5 @@
import { atom } from 'jotai';
import { IAppGlobalState } from '../models/IAppGlobalState';
export const appGlobalStateAtom = atom<IAppGlobalState>({} as IAppGlobalState);

View File

@ -0,0 +1,14 @@
import { Theme } from '@fluentui/react-components';
import { BaseComponentContext } from '@microsoft/sp-component-base';
import { EAppHostName } from '../constants/EAppHostname';
export interface ISalesordersProps {
title: string;
isDarkTheme: boolean;
hasTeamsContext: boolean;
theme: Theme | undefined;
themeString: string;
context: BaseComponentContext
appHostName: EAppHostName;
}

View File

@ -0,0 +1,34 @@
@import '~@fluentui/react/dist/sass/References.scss';
.salesorders {
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,40 @@
import * as React from 'react';
import { Provider } from 'jotai';
import {
FluentProvider,
teamsDarkTheme,
teamsHighContrastTheme,
teamsLightTheme,
tokens,
} from '@fluentui/react-components';
import { ISalesordersProps } from './ISalesordersProps';
import { SalesordersControl } from './SalesordersControls';
export const Salesorders: React.FunctionComponent<ISalesordersProps> = (props: React.PropsWithChildren<ISalesordersProps>) => {
const { themeString , } = props;
return (
<>
<FluentProvider
theme={
themeString === "dark"
? teamsDarkTheme
: themeString === "contrast"
? teamsHighContrastTheme
: {
...teamsLightTheme,
colorNeutralBackground3: "#eeeeee",
}
}
style={{ background: tokens.colorNeutralBackground3 }}
>
<Provider>
<SalesordersControl {...props} />
</Provider>
</FluentProvider>
</>
);
};

View File

@ -0,0 +1,173 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
import * as React from 'react';
import { useAtom } from 'jotai';
import {
Button,
InputOnChangeData,
Spinner,
Title3,
tokens,
} from '@fluentui/react-components';
import { SearchBox } from '@fluentui/react-search-preview';
import { Icon } from '@iconify/react';
import { appGlobalStateAtom } from '../atoms/appGlobalStateAtom';
import { useGraphAPI } from '../hooks/useGraphAPI';
import { ICustomer } from '../models/ICustomer';
import { IMenuItem } from '../models/IMenuItem';
import { IOrder } from '../models/IOrder';
import { CompanyInfo } from './companyInfo/CompanyInfo';
import { CustomersGrid } from './customersGrid/CustomersGrid';
import { ISalesordersProps } from './ISalesordersProps';
import { Left } from './left/Left';
import { Menu } from './menu/Menu';
import { NoOrders } from './noOrders/NoOrders';
import { OrdersGrid } from './ordersGrid/OrdersGrid';
import { Right } from './right/Right';
import { StatusOrdersInfo } from './statusOrdersInfo/StatusOrdersInfo';
import { useSalesordersStyles } from './useSalesordersStyles';
export const SalesordersControl: React.FunctionComponent<ISalesordersProps> = (
props: React.PropsWithChildren<ISalesordersProps>
) => {
const { context } = props;
const [appglobalState, setAppglobalState] = useAtom(appGlobalStateAtom);
const styles = useSalesordersStyles();
const divContainer = React.useRef<HTMLDivElement>(null);
const [selectedItem, setSelectedItem] = React.useState<IMenuItem>({
id: 1,
title: "Orders",
description: "Manage orders",
icon: "map:grocery-or-supermarket",
});
const { searchOrders, getCustomers } = useGraphAPI(context);
const [orders, setOrders] = React.useState<IOrder[]>([]);
const [searchText, setSearchText] = React.useState<string>("");
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const [customers, setCustomers] = React.useState<ICustomer[]>([]);
React.useEffect(() => {
setAppglobalState({ ...appglobalState, ...props });
// bug,gridtemplateareas is not reconized as CSS property
if (divContainer.current) {
divContainer.current.setAttribute("style", "grid-template-areas: 'left right right right';");
}
setIsLoading(true);
}, [props]);
React.useEffect(() => {
(async () => {
const orders = await searchOrders(searchText);
const customers = await getCustomers(searchText);
setCustomers(customers);
setOrders(orders );
setIsLoading(false);
})();
}, [searchText]);
const totalOrders = React.useMemo(() => {
return orders.length;
}, [orders]);
const totalDelivered = React.useMemo(() => {
return orders.filter((order) => order.status === "Shipped").length;
}, [orders]);
const totalPeding = React.useMemo(() => {
return orders.filter((order) => order.status === "New").length;
}, [orders]);
const totalProcessing = React.useMemo(() => {
return orders.filter((order) => order.status === "In-Process").length;
}, [orders]);
const Header = React.useCallback((props: { title: string }): JSX.Element => {
const { title } = props;
return (
<>
<Title3>{title}</Title3>
</>
);
}, []);
const hasOrders = React.useMemo(() => {
return orders.length > 0;
}, [orders]);
const renderSelectedContent = React.useCallback(() => {
switch (selectedItem.id) {
case 1:
return (
<>
<StatusOrdersInfo
totalOrders={totalOrders}
totalDelivered={totalDelivered}
pendingOrders={totalPeding}
processingOrders={totalProcessing}
/>
<OrdersGrid items={orders} />
</>
);
case 2:
return <CustomersGrid items={customers} />;
default:
return <div>Orders</div>;
}
}, [orders, selectedItem, customers, totalOrders, totalDelivered, totalPeding, totalProcessing]);
const title = React.useMemo(() => {
switch (selectedItem.id) {
case 1:
return "Sales Orders";
case 2:
return "Customers";
default:
return "Sales Orders";
}
}, [selectedItem]);
return (
<>
<main className={styles.mainContainer}>
<div className={styles.contentContainer} ref={divContainer}>
<Left>
<CompanyInfo />
<Menu currentItem={selectedItem as IMenuItem} onItemClick={(item) => setSelectedItem(item)} />
</Left>
<Right>
<div className={styles.headerAndSearchContainer}>
<Header title={title} />
<SearchBox
placeholder="Search by order number, customer name..."
style={{ fontSize: tokens.fontSizeBase200, width: 300 }}
onChange={(ev: React.ChangeEvent<HTMLInputElement>, data: InputOnChangeData) => {
if (data.value.trim().length > 2) {
setSearchText(data.value);
}
}}
dismiss={
<Button
onClick={() => setSearchText("")}
appearance="transparent"
icon={<Icon icon="fluent:dismiss-20-regular" />}
/>
}
/>
</div>
{isLoading ? (
<div style={{ paddingTop: 60 }}>
<Spinner />
</div>
) : (
<>{!hasOrders ? <NoOrders /> : renderSelectedContent()}</>
)}
</Right>
</div>
</main>
</>
);
};

View File

@ -0,0 +1,22 @@
import * as React from 'react';
import { Subtitle1 } from '@fluentui/react-components';
import { Icon } from '@iconify/react';
import { useCompanyInfoStyles } from './useCompanyInfoStyles';
export interface ICompanyInfoProps {}
export const CompanyInfo: React.FunctionComponent<ICompanyInfoProps> = (
props: React.PropsWithChildren<ICompanyInfoProps>
) => {
const styles = useCompanyInfoStyles();
return (
<>
<div className={styles.infoContainer}>
<Icon icon="mdi:company" width={36} height={36} />
<Subtitle1 className={styles.headerTitle}>{"My Company"}</Subtitle1>
</div>
</>
);
};

View File

@ -0,0 +1,29 @@
import {
makeStyles,
shorthands,
} from '@fluentui/react-components';
export const useCompanyInfoStyles = makeStyles({
infoContainer: {
display: "flex",
flexDirection: "row",
justifyContent: "start",
alignItems: "center",
columnGap: "20px",
paddingTop: "20px",
paddingBottom: "80px",
},
headerTitle: {
display: "-webkit-box",
"-webkit-line-clamp": "1",
"-webkit-box-orient": "vertical",
...shorthands.overflow("hidden"),
textAlign: "start",
textOverflow: "ellipsis",
},
itemDescription: {
paddingLeft: "45px",
},
});

View File

@ -0,0 +1,259 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import * as React from 'react';
import {
Avatar,
Badge,
createTableColumn,
DataGrid,
DataGridBody,
DataGridCell,
DataGridHeader,
DataGridHeaderCell,
DataGridProps,
DataGridRow,
Link,
TableCellLayout,
TableColumnDefinition,
tokens,
} from '@fluentui/react-components';
import { ICustomer } from '../../models/ICustomer';
const columns: TableColumnDefinition<ICustomer>[] = [
createTableColumn<ICustomer>({
columnId: "code",
compare: (a, b) => {
return a.customerCode < b.customerCode ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Id</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.customerCode}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "customer",
compare: (a, b) => {
return a.customerName.localeCompare(b.customerName);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Customer</span>;
},
renderCell: (item) => {
return (
<TableCellLayout appearance="primary" truncate media={<Avatar name={item.customerName} color="colorful" />}>
{item.customerName}
</TableCellLayout>
);
},
}),
createTableColumn<ICustomer>({
columnId: "state",
compare: (a, b) => {
return a.customerState.localeCompare(b.customerState);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 600 }}>State</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.customerState}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "country",
compare: (a, b) => {
return a.customerCountry.localeCompare(b.customerCountry);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 600 }}>Country</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.customerCountry}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "email",
compare: (a, b) => {
return a.customerEmail.localeCompare(b.customerEmail);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Email</span>;
},
renderCell: (item) => {
return (
<TableCellLayout truncate>
<Link href={`mailto:${item.customerEmail}`}>{item.customerEmail} </Link>
</TableCellLayout>
);
},
}),
createTableColumn<ICustomer>({
columnId: "totalOrders",
compare: (a, b) => {
return a.totalOrders < b.totalOrders ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Total Orders</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>$ {item.totalOrders}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "lastOrder",
compare: (a, b) => {
return a.lastOrder < b.lastOrder ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Last Order</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.lastOrder}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "lastOrderDate",
compare: (a, b) => {
return a.lastOrderDate.localeCompare(b.lastOrderDate);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Last Order date</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.lastOrderDate}</TableCellLayout>;
},
}),
createTableColumn<ICustomer>({
columnId: "lastOrderTotal",
compare: (a, b) => {
return a.lastOrderTotal < b.lastOrderTotal ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Last Order Total</span>;
},
renderCell: (item) => {
return (
<TableCellLayout truncate>
<span style={{ color: tokens.colorBrandForeground1 }}>{item.lastOrderTotal}</span>
</TableCellLayout>
);
},
}),
createTableColumn<ICustomer>({
columnId: "status",
compare: (a, b) => {
return a.lastOrderStatus.localeCompare(b.lastOrderStatus);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Status</span>;
},
renderCell: (item) => {
const getColor = (status: string) => {
switch (status) {
case "In-Process":
return "severe";
case "Shipped":
return "success";
case "New":
return "warning";
default:
return "brand";
}
};
return (
<TableCellLayout
truncate
media={
<Badge appearance="filled" color={getColor(item.lastOrderStatus)}>
{item.lastOrderStatus}
</Badge>
}
/>
);
},
}),
];
const columnSizingOptions = {
code: {
minWidth: 50,
defaultWidth: 50,
idealWidth: 50,
maxWidth: 50,
},
customer: {
defaultWidth: 180,
minWidth: 120,
idealWidth: 180,
},
email: {
defaultWidth: 180,
minWidth: 120,
idealWidth: 180,
},
state: {
defaultWidth: 50,
minWidth: 50,
idealWidth: 50,
},
country: {
defaultWidth: 50,
minWidth: 50,
idealWidth: 50,
},
totalOrders: {
defaultWidth: 60,
minWidth: 60,
idealWidth: 60,
},
};
interface ICustomersGridProps {
items: ICustomer[];
}
export const CustomersGrid: React.FunctionComponent<ICustomersGridProps> = (
props: React.PropsWithChildren<ICustomersGridProps>
) => {
const { items } = props;
const [sortState, setSortState] = React.useState<Parameters<NonNullable<DataGridProps["onSortChange"]>>[1]>({
sortColumn: "customer",
sortDirection: "ascending",
});
const onSortChange = React.useCallback((e, nextSortState) => {
setSortState(nextSortState);
}, []);
return (
<div style={{ paddingTop: 30 }}>
<DataGrid
items={items}
columns={columns}
sortable
sortState={sortState}
onSortChange={onSortChange}
resizableColumns
columnSizingOptions={columnSizingOptions}
size="medium"
>
<DataGridHeader>
<DataGridRow>
{({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
</DataGridRow>
</DataGridHeader>
<DataGridBody<ICustomer>>
{({ item, rowId }) => (
<DataGridRow<ICustomer> key={rowId}>
{({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
</DataGridRow>
)}
</DataGridBody>
</DataGrid>
</div>
);
};

View File

@ -0,0 +1,55 @@
import {
makeStyles,
shorthands,
tokens,
} from '@fluentui/react-components';
export const useCustomerGridStyles = makeStyles({
root: {
/* backgroundColor: tokens.colorNeutralBackground2, */
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
fontFamily: `${tokens.fontFamilyBase} !important`,
...shorthands.flex("1"),
...shorthands.padding("20px"),
...shorthands.gap("20px"),
minWidth: "380px",
},
wrapper: {
...shorthands.padding("10px"),
},
gradientOverlay: {
position: "absolute",
top: "0",
left: "0",
width: "100%",
height: "100%",
...shorthands.borderRadius("8px"),
},
titleStyles: {
paddingLeft: "20px",
paddingRight: "20px",
},
emailColumnStyles: {
display: "-webkit-box",
"-webkit-line-clamp": "1",
"-webkit-box-orient": "vertical",
...shorthands.overflow("hidden"),
textAlign: "start",
textOverflow: "ellipsis",
},
divider: {
width: "100%",
height: "1px",
backgroundColor: tokens.colorNeutralStroke1,
...shorthands.margin("20px 0px"),
},
});

View File

@ -0,0 +1,20 @@
import * as React from 'react';
import { useLeftStyles } from './useLeftStyles';
export interface ILeftProps {}
export const Left: React.FunctionComponent<ILeftProps> = (props: React.PropsWithChildren<ILeftProps>) => {
const { children } = props;
const styles = useLeftStyles();
return (
<>
<div
className={styles.leftContainer}
style={{ background: "linear-gradient(122.54deg, rgba(19, 29, 255, 0.2) 0%, rgba(97, 217, 149, 0.2) 100%)" }}
>
{children}
</div>
</>
);
};

View File

@ -0,0 +1,17 @@
import {
makeStyles,
shorthands,
} from '@fluentui/react-components';
export const useLeftStyles = makeStyles({
leftContainer : {
...shorthands.gridArea("left"),
display: "flex",
flexDirection: "column",
rowGap: "20px",
...shorthands.padding("20px"),
},
});

View File

@ -0,0 +1,45 @@
import * as React from 'react';
import { IMenuItem } from '../../models/IMenuItem';
import { MenuItem } from './MenuItem';
import { useMenuStyles } from './useMenuStyles';
export interface IMenuProps {
currentItem: IMenuItem;
onItemClick: (item: IMenuItem) => void;
}
const menuItems:IMenuItem[] = [
{
id : 1,
title: "Orders",
description: "Manage orders",
icon: "map:grocery-or-supermarket" ,
},
{
id: 2,
title: "Customers",
description: "Manage customers",
icon: "mingcute:user-2-line" ,
}
];
export const Menu: React.FunctionComponent<IMenuProps> = (props: React.PropsWithChildren<IMenuProps>) => {
const { currentItem, onItemClick } = props;
const styles = useMenuStyles();
return (
<>
<div className={styles.mainContainer}>
{menuItems.map((item, index) => {
const isCurrentItem = item.id === currentItem.id;
return (
<MenuItem key={index} item={item} isCurrentItem={isCurrentItem} onItemClick={() => onItemClick(item)} />
);
})}
</div>
</>
);
};

View File

@ -0,0 +1,50 @@
import * as React from 'react';
import {
Body1Strong,
Caption1,
mergeClasses,
tokens,
} from '@fluentui/react-components';
import { Icon } from '@iconify/react';
import { IMenuItem } from '../../models/IMenuItem';
import { useMenuStyles } from './useMenuStyles';
export interface IStepItemProps {
item: IMenuItem;
isCurrentItem: boolean;
onItemClick: () => void;
}
export const MenuItem: React.FunctionComponent<IStepItemProps> = (props: React.PropsWithChildren<IStepItemProps>) => {
const { item, isCurrentItem, onItemClick } = props;
const { icon, title, description } = item;
const styles = useMenuStyles();
const color = isCurrentItem ? tokens.colorBrandForeground1 : tokens.colorNeutralStrokeAccessible;
const ItemInfo = (props: { title: string; description: string; icon: JSX.Element; }):JSX.Element => {
const { title, description, icon } = props;
return (
<div className={styles.itemContainer}>
<div className={styles.itemTitle}>
{icon}
<Body1Strong className={styles.headerTitle} style={{ color: color }}>{title}</Body1Strong>
</div>
<Caption1 className={mergeClasses(styles.headerDescription, styles.itemDescription)}>
{description}
</Caption1>
</div>
)
};
return (
<>
<div style={{color: color}} className={mergeClasses(styles.menuItem)} onClick={() => onItemClick()}>
<ItemInfo title={title} description={description as string} icon={<Icon icon={`${icon}`} width={24} height={24} color={color}/> } />
</div>
</>
);
};

View File

@ -0,0 +1,90 @@
import {
makeStyles,
shorthands,
tokens,
} from '@fluentui/react-components';
export const useMenuStyles = makeStyles({
mainContainer: {
display: "flex",
flexDirection: "column",
justifyContent: "flex-start",
rowGap: "30px",
width: "100%",
backgroundColor: "transparent",
overflowY: "auto",
overflowX: "hidden",
"scrollbar-color": tokens.colorNeutralBackground1,
"scrollbar-width": "thin",
"::-webkit-scrollbar-thumb": {
backgroundColor: tokens?.colorBrandStroke2,
...shorthands.borderRadius("10px"),
...shorthands.borderWidth("1px"),
},
"::-webkit-scrollbar": {
height: "10px",
width: "7px",
},
},
gradientOverlay: {
position: "absolute",
top: "0",
left: "0",
width: "100%",
height: "100%",
...shorthands.borderRadius("8px"),
},
headerContainer:{
marginLeft: "auto",
marginRight: "auto",
maxWidth: "1106px",
width: '100%',
},
menuItem:{
display: "flex",
flexDirection: "column",
justifyContent: "start",
},
headerTitle: {
display: "-webkit-box",
"-webkit-line-clamp": "1",
"-webkit-box-orient": "vertical",
...shorthands.overflow("hidden"),
textAlign: "start",
textOverflow: "ellipsis",
},
headerDescription: {
...shorthands.overflow("hidden"),
display: "-webkit-box",
"-webkit-line-clamp": "4",
"-webkit-box-orient": "vertical",
textAlign: "start",
textOverflow: "ellipsis",
},
itemContainer: {
display: "flex",
flexDirection: "column",
justifyContent: "start",
alignItems: "start",
cursor: "pointer",
},
itemTitle: {
display: "flex",
flexDirection: "row",
justifyContent: "start",
alignItems: "start",
columnGap: "20px",
rowGap: "5px",
},
itemDescription: {
paddingLeft: "45px",
},
});

View File

@ -0,0 +1,23 @@
import * as React from 'react';
import {
Body2,
tokens,
} from '@fluentui/react-components';
import { Icon } from '@iconify/react';
import { useNoOrdersStyles } from './useNoOrdersStyles';
export interface INoOrdersProps {}
export const NoOrders: React.FunctionComponent<INoOrdersProps> = (props: React.PropsWithChildren<INoOrdersProps>) => {
const styles = useNoOrdersStyles();
return (
<>
<div className={styles.container}>
<Icon icon="fluent:cloud-database-20-regular" width={82} height={82} color={tokens.colorBrandForeground1} />
<Body2>No orders found</Body2>
</div>
</>
);
};

View File

@ -0,0 +1,14 @@
import { makeStyles } from '@fluentui/react-components';
export const useNoOrdersStyles = makeStyles({
container: {
display: "flex",
flexDirection: "column",
justifyContent: "start",
alignItems: "center",
columnGap: "20px",
rowGap: "20px",
paddingTop: "40px",
paddingBottom: "80px",
},
});

View File

@ -0,0 +1,221 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import * as React from 'react';
import {
Avatar,
Badge,
createTableColumn,
DataGrid,
DataGridBody,
DataGridCell,
DataGridHeader,
DataGridHeaderCell,
DataGridProps,
DataGridRow,
Link,
TableCellLayout,
TableColumnDefinition,
} from '@fluentui/react-components';
import { IOrder } from '../../models/IOrder';
const columns: TableColumnDefinition<IOrder>[] = [
createTableColumn<IOrder>({
columnId: "customer",
compare: (a, b) => {
return a.customer.localeCompare(b.customer);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Customer</span>;
},
renderCell: (item) => {
return (
<TableCellLayout appearance="primary" truncate media={<Avatar name={item.customer} color="colorful" />}>
{item.customer}
</TableCellLayout>
);
},
}),
createTableColumn<IOrder>({
columnId: "email",
compare: (a, b) => {
const customerEmailA = a?.custmoerEmail ?? "";
const customerEmailB = b?.custmoerEmail ?? "";
return customerEmailA.localeCompare(customerEmailB);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Email</span>;
},
renderCell: (item) => {
return (
<TableCellLayout truncate>
<Link href={`mailto:${item.custmoerEmail}`}>{item.custmoerEmail} </Link>
</TableCellLayout>
);
},
}),
createTableColumn<IOrder>({
columnId: "city",
compare: (a, b) => {
return a.city.localeCompare(b.city);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 600 }}>City</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.city} </TableCellLayout>;
},
}),
createTableColumn<IOrder>({
columnId: "order",
compare: (a, b) => {
return a.order < b.order ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 600 }}>Order</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.order} </TableCellLayout>;
},
}),
createTableColumn<IOrder>({
columnId: "total",
compare: (a, b) => {
return a.total < b.total ? -1 : 1;
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Total</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{` $ ${item.total} `} </TableCellLayout>;
},
}),
createTableColumn<IOrder>({
columnId: "orderDate",
compare: (a, b) => {
return a.orderDate.localeCompare(b.orderDate);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Order Date</span>;
},
renderCell: (item) => {
return <TableCellLayout truncate>{item.orderDate} </TableCellLayout>;
},
}),
createTableColumn<IOrder>({
columnId: "status",
compare: (a, b) => {
return a.status.localeCompare(b.status);
},
renderHeaderCell: () => {
return <span style={{ fontWeight: 700 }}>Status</span>;
},
renderCell: (item) => {
const getColor = (status: string) => {
switch (status) {
case "In-Process":
return "severe";
case "Shipped":
return "success";
case "New":
return "warning";
default:
return "brand";
}
};
return (
<TableCellLayout
truncate
media={
<Badge appearance="filled" color={getColor(item.status)}>
{item.status}
</Badge>
}
/>
);
},
}),
];
const columnSizingOptions = {
customer: {
defaultWidth: 180,
minWidth: 120,
idealWidth: 180,
},
email: {
defaultWidth: 200,
minWidth: 180,
idealWidth: 200,
},
city: {
defaultWidth: 100,
minWidth: 120,
idealWidth: 100,
},
order: {
defaultWidth: 70,
minWidth: 70,
idealWidth: 70,
},
total: {
defaultWidth:100,
minWidth: 100,
idealWidth: 100,
},
orderDate: {
defaultWidth: 100,
minWidth: 100,
idealWidth:120,
},
status: {
defaultWidth: 180,
minWidth: 120,
idealWidth: 180,
},
};
interface IOrdersGridProps {
items: IOrder[];
}
export const OrdersGrid: React.FunctionComponent<IOrdersGridProps> = (
props: React.PropsWithChildren<IOrdersGridProps>
) => {
const { items } = props;
const [sortState, setSortState] = React.useState<Parameters<NonNullable<DataGridProps["onSortChange"]>>[1]>({
sortColumn: "customer",
sortDirection: "ascending",
});
const onSortChange = React.useCallback((e, nextSortState) => {
setSortState(nextSortState);
}, []);
return (
<div style={{ paddingTop: 30 }}>
<DataGrid
items={items}
columns={columns}
sortable
sortState={sortState}
onSortChange={onSortChange}
columnSizingOptions={columnSizingOptions}
resizableColumns
>
<DataGridHeader>
<DataGridRow>
{({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
</DataGridRow>
</DataGridHeader>
<DataGridBody<IOrder>>
{({ item, rowId }) => (
<DataGridRow<IOrder> key={rowId}>
{({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
</DataGridRow>
)}
</DataGridBody>
</DataGrid>
</div>
);
};

View File

@ -0,0 +1,18 @@
import * as React from 'react';
import { useRightStyles } from './useRightStyles';
export interface ILeftProps {}
export const Right: React.FunctionComponent<ILeftProps> = (props: React.PropsWithChildren<ILeftProps>) => {
const { children } = props;
const styles = useRightStyles();
return (
<>
<div
className={styles.rightContainer}>
{children}
</div>
</>
);
};

View File

@ -0,0 +1,19 @@
import {
makeStyles,
shorthands,
} from '@fluentui/react-components';
export const useRightStyles = makeStyles({
rightContainer : {
...shorthands.gridArea("right"),
display: "flex",
flexDirection: "column",
columnGap: "20px",
rowGap: "20px",
...shorthands.padding("20px"),
},
});

View File

@ -0,0 +1,53 @@
import * as React from 'react';
import {
Body2,
Card,
CardHeader,
Title2,
tokens,
} from '@fluentui/react-components';
import { useStatusOrdersInfoStyles } from './useStatusOrdersInfoStyles';
export interface IStatusOrdersInfoProps {
totalOrders: number;
totalDelivered: number;
pendingOrders: number;
processingOrders: number;
}
export const StatusOrdersInfo: React.FunctionComponent<IStatusOrdersInfoProps> = (
props: React.PropsWithChildren<IStatusOrdersInfoProps>
) => {
const styles = useStatusOrdersInfoStyles();
const { totalOrders, totalDelivered, pendingOrders, processingOrders } = props;
return (
<>
<div >
<Card className={styles.card} appearance="outline">
<CardHeader
key={1}
header={<Title2 style={{ color: tokens.colorPaletteBlueBorderActive }}>{totalOrders}</Title2>}
description={<Body2>Total Orders</Body2>}
/>
<CardHeader
key={2}
header={<Title2 style={{ color: tokens.colorStatusSuccessForegroundInverted }}>{totalDelivered}</Title2>}
description={<Body2>Total Delivered</Body2>}
/>
<CardHeader
key={3}
header={<Title2 style={{ color: tokens.colorStatusDangerForegroundInverted }}>{pendingOrders}</Title2>}
description={<Body2>Pending Orders</Body2>}
/>
<CardHeader
key={4}
header={<Title2 style={{ color: tokens.colorPalettePeachBorderActive }}>{processingOrders}</Title2>}
description={<Body2>Processing orders</Body2>}
/>
</Card>
</div>
</>
);
};

View File

@ -0,0 +1,53 @@
import {
makeStyles,
shorthands,
tokens,
} from '@fluentui/react-components';
export const useStatusOrdersInfoStyles = makeStyles({
statusContainer: {
position: "relative",
width: "100%",
display: "grid",
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 200px), 1fr)",
gridColumnGap: "10px",
gridRowGap: "10px",
justifyContent: "center",
paddingLeft: "30px",
paddingRight: "30px",
},
card: {
/* backgroundColor: tokens.colorNeutralBackground2, */
paddingLeft: "30px",
paddingRight: "30px",
paddingTop: "20px",
paddingBottom: "20px",
fontFamily: `${tokens.fontFamilyBase}`,
display: "grid",
gridTemplateColumns: "repeat(auto-fit,minmax(min(100% ,200px),1fr))",
gridColumnGap: "10px",
gridRowGap: "10px",
...shorthands.gap("20px"),
},
gradientOverlay: {
position: "absolute",
top: "0",
left: "0",
width: "100%",
height: "100%",
...shorthands.borderRadius("8px"),
},
titleStyles: {
paddingLeft: "20px",
paddingRight: "20px",
},
cardBody: {
width: "100%",
height: "fit-content",
...shorthands.borderRadius("16px"),
},
});

View File

@ -0,0 +1,79 @@
import {
makeStyles,
shorthands,
tokens,
} from '@fluentui/react-components';
export const useSalesordersStyles = makeStyles({
mainContainer: {
width: "100%",
height: "100vh",
backgroundColor: tokens.colorNeutralBackground2,
overflowY: "auto",
overflowX: "hidden",
"scrollbar-color": tokens.colorNeutralBackground1,
"scrollbar-width": "thin",
"::-webkit-scrollbar-thumb": {
backgroundColor: tokens?.colorBrandStroke2,
...shorthands.borderRadius("10px"),
...shorthands.borderWidth("1px"),
},
"::-webkit-scrollbar": {
height: "10px",
width: "7px",
},
},
contentContainer: {
display: "grid",
gridTemplateColumns: "min(100%, 300px) 1fr 1fr 1fr",
gridTemplateRows: "1fr",
height: "100vh",
},
leftContainer : {
...shorthands.gridArea("left"),
display: "flex",
flexDirection: "column",
rowGap: "20px",
...shorthands.padding("20px"),
},
rightContainer : {
...shorthands.gridArea("right"),
display: "flex",
flexDirection: "column",
rowGap: "20px",
...shorthands.padding("20px"),
},
gradientOverlay: {
position: "absolute",
top: "0",
left: "0",
width: "100%",
height: "100%",
...shorthands.borderRadius("8px"),
},
headerContainer:{
marginLeft: "auto",
marginRight: "auto",
maxWidth: "1106px",
width: '100%',
},
imageTop:{
width: "100%", height: "300px" ,
[ `@media (max-width: 768px)`]: {
height: "400px",
},
},
headerAndSearchContainer:{
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
rowGap: "20px",
...shorthands.padding("20px 0px"),
} ,
});

View File

@ -0,0 +1,6 @@
export enum EAppHostName {
SharePoint = "SharePoint",
Teams = "Teams",
Outlook = "Outlook",
Office = "Office",
}

View File

@ -0,0 +1,175 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react';
import { SearchHit } from '@microsoft/microsoft-graph-types';
import { BaseComponentContext } from '@microsoft/sp-component-base';
import {
sortBy,
uniqBy,
} from '@microsoft/sp-lodash-subset';
import { ICustomer } from '../models/ICustomer';
import { IOrder } from '../models/IOrder';
interface IuseGraphAPI {
searchOrders: (searchText: string) => Promise<any>;
getCustomers: (searchText: string) => Promise<ICustomer[] | []>;
}
export const useGraphAPI = (context: BaseComponentContext): IuseGraphAPI => {
const graphClient = React.useMemo(async () => {
if (!context) return undefined;
return await context.msGraphClientFactory.getClient("3");
}, [context]);
const searchOrders = React.useCallback(
async (searchText: string): Promise<any> => {
if (!graphClient) return undefined;
const request = {
requests: [
{
entityTypes: ["externalItem"],
contentSources: ["/external/connections/ibmdb2lob"],
query: {
queryString: `${searchText}*`,
},
from: 0,
size: 100,
},
],
};
try {
const response = await (await graphClient)?.api(`search/query`).post(request);
const result: SearchHit[] = response?.value[0]?.hitsContainers[0]?.hits;
if (!result) return [];
const ordersList: IOrder[] = [];
for (const item of result) {
const { resource } = item;
if (resource) {
const { properties } = resource as any;
if (properties) {
const {
id,
custcode,
custname,
email,
state,
country,
orders,
orderdates,
ordertotals,
orderstatus,
} = properties as any;
if (!custname || !state || !country || !orders || !orderdates || !ordertotals || !orderstatus) continue;
for (let i = 0; i < orders.length; i++) {
const order: IOrder = {
customer: custname,
city: `${state} ${country}`,
order: orders[i],
total: ordertotals[i],
orderDate: orderdates[i],
status: orderstatus[i],
customerCode: custcode,
custmoerEmail: email,
customerState: state,
id: id,
};
ordersList.push(order);
}
}
}
}
/* setCacheValue(searchText, ordersList); */
console.log(ordersList);
return ordersList;
} catch (error) {
console.log("[searchOrders] error:", error);
throw new Error("Something went wrong when search Orders");
}
},
[graphClient]
);
const getCustomers = React.useCallback(async (searchText:string): Promise<ICustomer[] | []> => {
if (!graphClient) return [];
const request = {
requests: [
{
entityTypes: ["externalItem"],
contentSources: ["/external/connections/ibmdb2lob"],
query: {
queryString: `${searchText}*`,
},
from: 0,
size: 100,
},
],
};
try {
const response = await (await graphClient)?.api(`search/query`).post(request);
const result: SearchHit[] = response?.value[0]?.hitsContainers[0]?.hits;
const customersList: ICustomer[] = [];
for (const item of result) {
const { resource } = item;
if (resource) {
const { properties } = resource as any;
if (properties) {
const {
custcode,
custname,
email,
state,
country,
orders,
orderdates,
ordertotals,
orderstatus,
} = properties as any;
const customer: ICustomer = {
customerName: custname,
customerCode: custcode,
customerEmail: email,
customerState: state,
customerCountry: country,
lastOrder: orders[orders.length - 1],
totalOrders: orders.length,
lastOrderDate: orderdates[orderdates.length - 1],
lastOrderTotal: ordertotals[ordertotals.length - 1],
lastOrderStatus: orderstatus[orderstatus.length - 1],
};
customersList.push(customer);
}
}
}
const uniqueCustomers = uniqBy(customersList, "customerCode");
return sortBy(uniqueCustomers, "customerName");
} catch (error) {
console.log("[getCustomers] error:", error);
throw new Error("Something went wrong when getting customers");
}
}, [graphClient]);
return {
searchOrders,
getCustomers,
};
};

View File

@ -0,0 +1,40 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import addSeconds from 'date-fns/addSeconds';
import isAfter from 'date-fns/isAfter';
/* eslint-disable @typescript-eslint/explicit-function-return-type */
interface IStorage {
value: unknown;
expires?: Date;
}
const DEFAULT_EXPIRED_IN_SECONDS = 60 * 30; // 30 min
export const useCache = (cacheType: "local" | "session") => {
const setCacheValue = (key: string, newValue: unknown, expiredInSeconds?: number) => {
const expires = addSeconds(new Date(), expiredInSeconds ?? DEFAULT_EXPIRED_IN_SECONDS);
if (cacheType === "session") {
sessionStorage.setItem(key, JSON.stringify({ value: newValue, expires: expires.getTime() }));
} else {
localStorage.setItem(key, JSON.stringify({ value: newValue, expires: expires.getTime() }));
}
};
const getCacheValue = (key: string): any => {
let storage: IStorage = {} as IStorage;
if (cacheType === "session") {
storage = JSON.parse(sessionStorage.getItem(key) || "{}");
} else {
storage = JSON.parse(localStorage.getItem(key) || "{}");
}
// getting stored value
const { value, expires } = storage || ({} as IStorage);
if (expires && isAfter(new Date(expires as any), new Date())) {
return value;
}
return undefined;
};
return { getCacheValue, setCacheValue };
};

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,3 @@
import { ISalesordersProps } from "../components/ISalesordersProps";
export interface IAppGlobalState extends ISalesordersProps{
}

View File

@ -0,0 +1,12 @@
export interface ICustomer {
customerName: string;
customerCode: string;
customerEmail: string;
customerState: string;
customerCountry: string;
lastOrder: number
totalOrders: number;
lastOrderDate: string;
lastOrderTotal: number;
lastOrderStatus: string;
}

View File

@ -0,0 +1,7 @@
export interface IMenuItem {
id:number
title: string;
description?: string;
content?: string;
icon?: string;
}

View File

@ -0,0 +1,14 @@
export interface IOrder {
id?: string;
customer: string;
city: string;
order: number;
total: string;
orderDate: string;
status: string;
customerCode?: number;
custmoerEmail?: string;
customerState?: string;
}

View File

@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "750d6853-1282-450a-b080-37aef954d745",
"alias": "SalesordersWebPart",
"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": "salesorders" },
"description": { "default": "salesorders description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "salesorders"
}
}]
}

View File

@ -0,0 +1,134 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import * as strings from 'SalesordersWebPartStrings';
import { Theme } from '@fluentui/react-components';
import { IReadonlyTheme } from '@microsoft/sp-component-base';
import { Version } from '@microsoft/sp-core-library';
import {
type IPropertyPaneConfiguration,
PropertyPaneTextField,
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { ISalesordersProps } from '../../components/ISalesordersProps';
import { Salesorders } from '../../components/Salesorders';
import { EAppHostName } from '../../constants/EAppHostname';
export interface ISalesordersWebPartProps {
title: string;
}
export default class SalesordersWebPart extends BaseClientSideWebPart<ISalesordersWebPartProps> {
private _isDarkTheme: boolean = false;
private _theme: Theme | undefined;
private _themeString: string = "";
private _appHostName: EAppHostName = EAppHostName.SharePoint;
private _applyTheme = (theme: string): void => {
this.context.domElement.setAttribute("data-theme", theme);
document.body.setAttribute("data-theme", theme);
if (theme === "dark") {
this._themeString = "dark";
}
if (theme === "default") {
this._themeString = "default";
}
if (theme === "contrast") {
this._themeString = "contrast";
}
this.render();
};
protected get disableReactivePropertyChanges(): boolean {
return true;
}
public render(): void {
const element: React.ReactElement<ISalesordersProps> = React.createElement(
Salesorders,
{
isDarkTheme: this._isDarkTheme,
theme: this._theme,
themeString: this._themeString,
hasTeamsContext: !!this.context.sdks.microsoftTeams,
title: this.properties.title,
context: this.context,
appHostName: this._appHostName,
}
);
ReactDom.render(element, this.domElement);
}
protected async onInit(): Promise<void> {
if (this.context.sdks.microsoftTeams) {
// in teams ?
const teamsContext = await this.context.sdks.microsoftTeams?.teamsJs.app.getContext();
switch (teamsContext.app.host.name.toLowerCase()) {
case "teams":
case "teamsModern":
this._appHostName = EAppHostName.Teams;
break;
case "office":
this._appHostName = EAppHostName.Office;
break;
case "outlook":
this._appHostName = EAppHostName.Outlook;
break;
default:
throw new Error(`[contentFlow_onInit]: Err:'Unknown app host name'`);
}
this._applyTheme(teamsContext.app.theme || "default");
this.context.sdks.microsoftTeams.teamsJs.app.registerOnThemeChangeHandler(this._applyTheme);
}
return Promise.resolve();
}
protected onThemeChanged(currentTheme: IReadonlyTheme | undefined): void {
if (!currentTheme) {
return;
}
this._theme = currentTheme as Theme;
this._isDarkTheme = !!currentTheme.isInverted;
}
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('title', {
label: strings.DescriptionFieldLabel
})
]
}
]
}
]
};
}
}

View File

@ -0,0 +1,16 @@
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",
"AppLocalEnvironmentOffice": "The app is running on your local environment in office.com",
"AppLocalEnvironmentOutlook": "The app is running on your local environment in Outlook",
"AppSharePointEnvironment": "The app is running on SharePoint page",
"AppTeamsTabEnvironment": "The app is running in Microsoft Teams",
"AppOfficeEnvironment": "The app is running in office.com",
"AppOutlookEnvironment": "The app is running in Outlook",
"UnknownEnvironment": "The app is running in an unknown environment"
}
});

View File

@ -0,0 +1,19 @@
declare interface ISalesordersWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
AppLocalEnvironmentSharePoint: string;
AppLocalEnvironmentTeams: string;
AppLocalEnvironmentOffice: string;
AppLocalEnvironmentOutlook: string;
AppSharePointEnvironment: string;
AppTeamsTabEnvironment: string;
AppOfficeEnvironment: string;
AppOutlookEnvironment: string;
UnknownEnvironment: string;
}
declare module 'SalesordersWebPartStrings' {
const strings: ISalesordersWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View File

@ -0,0 +1,35 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.7/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,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}