Merge pull request #3338 from mmsharepoint:MMSPFx

New sample react-office-offer-creation
This commit is contained in:
Hugo Bernier 2023-01-12 08:39:00 -05:00 committed by GitHub
commit aa1cd15e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 54315 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{
"name": "SPFx 1.16.1",
"image": "docker.io/m365pnp/spfx:1.16.1",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4321,
35729
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
// Not needed for SPFx>= 1.12.1
// "5432": {
// "protocol": "https",
// "label": "Workbench",
// "onAutoForward": "silent"
// },
"35729": {
"protocol": "https",
"label": "LiveReload",
"onAutoForward": "silent",
"requireLocalPort": true
}
},
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node"
}

View File

@ -0,0 +1,33 @@
echo
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
npm install
## commands to create dev certificate and copy it to the root folder of the project
echo
echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert
# Convert the generated PEM certificate to a CER certificate
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
# Copy the PEM ecrtificate for non-Windows hosts
cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore
then
echo "# .CER Certificates" >> .gitignore
echo "*.cer" >> .gitignore
fi
## add *.pem to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.pem' ./.gitignore
then
echo "# .PEM Certificates" >> .gitignore
echo "*.pem" >> .gitignore
fi
echo
echo -e "\e[1;92mReady!\e[0m"
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

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/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: {}
}
]
};

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,21 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": false,
"nodeVersion": "16.19.0",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.4.1"
},
"version": "1.16.0",
"libraryName": "react-office-offer-creation",
"libraryId": "455fb406-a609-4036-aeb2-1cffabf48af0",
"environment": "spo",
"packageManager": "npm",
"solutionName": "react-office-offer-creation",
"solutionShortDescription": "react-office-offer-creation description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,120 @@
# Offer Creation
## Summary
This sample is a Teams personal Tab to act as a Microsoft 365 across application (Teams, Outlook, Office) to generate documents. It is realized with SharePoint Framework (SPFx).
App live in action inside Teams
![App live in action inside Teams](assets/16OfferCreationDemo_SPFx.gif)
Create Offer form with FluentUI controls
![Create Offer form with FluentUI controls](assets/15CreateOfferForm_FluentUI_SPFx.png)
Create Offer form with FluentUI controls opened in Microsoft 365
![Create Offer form with FluentUI controls opened in Microsoft 365](assets/22CreateOfferForm_FluentUI_SPFx_InM365.png)
Created Offer with filled metadata opened 1in Word
![Created Offer with filled metadata opened 1in Word](assets/23OfferInWord.png)
Configuration settings form to set Site Url (Offer location)
![Configuration settings form to set Site Url](assets/19TeamsSPFxConfigForm.png)
For further details see the author's [blog series](https://mmsharepoint.wordpress.com/2022/12/28/a-sharepoint-document-generator-as-microsoft-365-app-ii-spfx/)
## Compatibility
This sample is optimally compatible with the following environment configuration:
![SPFx 1.16.1](https://img.shields.io/badge/SPFx-1.16.1-green.svg)
![Node.js v16 | v14 | v12](https://img.shields.io/badge/Node.js-v16%20%7C%20v14%20%7C%20v12-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)
For more information about SPFx compatibility, please refer to <https://aka.ms/spfx-matrix>
## Applies to
* [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/m365devprogram)
## Version history
Version|Date|Author|Comments
-------|----|----|--------
1.0|Dec 28, 2022|[Markus Moeller](https://github.com/mmsharepoint) <https://twitter.com/moeller2_0>|Initial release
## Minimal Path to Awesome
* Clone this repository (or [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-office-offer-creation) then unzip it)
* From your command line, change your current directory to the directory containing this sample (`react-office-offer-creation`, located under `samples`)
* Create the content-type for your offers in a site / default document library of your choice
* With PnP-PowerShell for instance call the deploy script with your site URL as parameter
```bash
.\templates\deploy.ps1 -siteUrl <YourFullSiteUrl>
```
> This should put the same site URL to your tenant-property named 'CreateOfferSiteUrl'
* in the command line run:
* `npm install`
* `gulp serve`
* Now you can run the web part inside SharePoint.
* To use it as a Teams, Outlook, Microsoft 365 App as well:
* Bundle and Package the solution:
* `gulp bundle --ship`
* `gulp package-solution --ship`
* Upload the solution to your tenant's app catalog and "install" it tenant-wide
* Package the icons and your manifest from the solution's \teams folder in a ZIP
* Upload this ZIP as a custom solution or to your org's Teams' app catalog
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit <https://aka.ms/spfx-devcontainer> for further instructions.
## Features
* Using SharePoint Rest API to copy files and edit it's metadata
* [Extend Teams SPFx apps across Microsoft 365](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/office/overview?WT.mc_id=M365-MVP-5004617)
* [Use FluentUI Label, DatePicker, Dropdown, IDropdownOption, Spinner, TextField](https://developer.microsoft.com/en-us/fluentui#/?WT.mc_id=M365-MVP-5004617)
* [Use SharePoint tenant properties for org-wide SPFx app configurations](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/tenant-properties?tabs=sprest#getread-tenant-properties?WT.mc_id=M365-MVP-5004617)
* [Configure Microsoft Teams personal apps built using SharePoint Framework](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-configure-in-teams#configure-microsoft-teams-personal-apps-built-using-sharepoint-framework?WT.mc_id=M365-MVP-5004617)
## 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
## Help
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment.
You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20react-office-offer-creation%22) to see if anybody else is having the same issues.
You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=react-office-offer-creation) and see what the community is saying.
If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-office-offer-creation&template=bug-report.yml&sample=react-office-offer-creation&authors=@mmsharepoint&title=react-office-offer-creation%20-%20).
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-office-offer-creation&template=question.yml&sample=react-office-offer-creation&authors=@mmsharepoint&title=react-office-offer-creation%20-%20).
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-office-offer-creation&template=suggestion.yml&sample=react-office-offer-creation&authors=@mmsharepoint&title=react-office-offer-creation%20-%20).
## 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.**
<img src="https://pnptelemetry.azurewebsites.net/sp-dev-fx-webparts/samples/react-office-offer-creation" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,61 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-office-offer-creation",
"source": "pnp",
"title": "SharePoint document generator - Offer Creation (SPFx)",
"shortDescription": "This sample is a Teams personal Tab to act as a Microsoft 365 across application (Teams, Outlook, Office) to generate docuemnts.",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-office-offer-creation",
"longDescription": [
"This sample is a Teams personal Tab to act as a Microsoft 365 across application (Teams, Outlook, Office) to generate docuemnts. It is realized with SharePoint Framework (SPFx)."
],
"creationDateTime": "2023-01-05",
"updateDateTime": "2023-01-05",
"products": [
"SharePoint"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.16.1"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-office-offer-creation/assets/16OfferCreationDemo_SPFx.gif",
"alt": "App in action"
},
{
"type": "image",
"order": 101,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-office-offer-creation/assets/15CreateOfferForm_FluentUI_SPFx.png",
"alt": "Create Offer Form with FluentUI controls"
},
{
"type": "image",
"order": 102,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-office-offer-creation/assets/15CreateOfferForm_FluentUI_SPFx.png",
"alt": "Created Offer result with filled metadata opened in Word"
}
],
"authors": [
{
"gitHubAccount": "mmsharepoint",
"pictureUrl": "https://github.com/mmsharepoint.png",
"name": "Markus Moeller"
}
],
"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://learn.microsoft.com/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
}
]
}
]

View File

@ -0,0 +1,27 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"offer-creation-sp-fx-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/offerCreationSpFx/OfferCreationSpFxWebPart.js",
"manifest": "./src/webparts/offerCreationSpFx/OfferCreationSpFxWebPart.manifest.json"
}
]
},
"create-offer-settings-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/createOfferSettings/CreateOfferSettingsWebPart.js",
"manifest": "./src/webparts/createOfferSettings/CreateOfferSettingsWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"OfferCreationSpFxWebPartStrings": "lib/webparts/offerCreationSpFx/loc/{locale}.js",
"CreateOfferSettingsWebPartStrings": "lib/webparts/createOfferSettings/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-office-offer-creation",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,46 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "react-office-offer-creation-client-side-solution",
"id": "455fb406-a609-4036-aeb2-1cffabf48af0",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "Markus Moeller",
"websiteUrl": "https://mmsharepoint.wordpress.com",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.16.0"
},
"metadata": {
"shortDescription": {
"default": "react-office-offer-creation description"
},
"longDescription": {
"default": "react-office-offer-creation description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"webApiPermissionRequests": [
{
"resource": "Microsoft Graph",
"scope": "Files.ReadWrite"
}
],
"features": [
{
"title": "react-office-offer-creation Feature",
"description": "The feature that activates elements of the react-office-offer-creation solution.",
"id": "bd29483e-6ddd-4475-95f0-6aaf5e345e5d",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/react-office-offer-creation.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 -->"
}

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'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
{
"name": "react-office-offer-creation",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"tslib": "2.3.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"office-ui-fabric-react": "^7.199.1",
"@microsoft/sp-core-library": "1.16.1",
"@microsoft/sp-property-pane": "1.16.1",
"@microsoft/sp-webpart-base": "1.16.1",
"@microsoft/sp-lodash-subset": "1.16.1",
"@microsoft/sp-office-ui-fabric-core": "1.16.1"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@rushstack/eslint-config": "2.5.1",
"@microsoft/eslint-plugin-spfx": "1.16.0",
"@microsoft/eslint-config-spfx": "1.16.0",
"@microsoft/sp-build-web": "1.16.0",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"gulp": "4.0.2",
"typescript": "4.5.5",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"eslint-plugin-react-hooks": "4.3.0",
"@microsoft/sp-module-interfaces": "1.16.1"
}
}

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,7 @@
export interface IOffer {
title: string;
description: string;
date: string;
price: number;
vat: number;
}

View File

@ -0,0 +1,54 @@
import { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";
import { MSGraphClientFactory, MSGraphClientV3 } from "@microsoft/sp-http";
export default class GraphService {
private msGraphClientFactory: MSGraphClientFactory;
public static readonly serviceKey: ServiceKey<GraphService> =
ServiceKey.create<GraphService>('react-office-create-offer-config', GraphService);
constructor(serviceScope: ServiceScope) {
serviceScope.whenFinished(async () => {
this.msGraphClientFactory = serviceScope.consume(MSGraphClientFactory.serviceKey);
});
}
public async getPersonalSiteUrl(): Promise<string> {
const downloadUrl = await this.getDownloadUrl();
const siteUrl = await this.getSiteUrl(downloadUrl);
return siteUrl;
}
public async storePersonalSiteUrl(siteUrl: string): Promise<void> {
const settings = { siteUrl: siteUrl };
return this.msGraphClientFactory.getClient('3').then((client: MSGraphClientV3) => {
client
.api('/me/drive/special/approot:/createOffer/settings.json:/content')
.header('content-type', 'text/plain')
.put(JSON.stringify(settings));
return Promise.resolve();
});
}
private async getDownloadUrl(): Promise<string> {
const client: MSGraphClientV3 = await this.msGraphClientFactory.getClient('3');
const response = await client
.api('/me/drive/special/approot:/createOffer/settings.json:/?select=@microsoft.graph.downloadUrl')
.get();
console.log(response);
const downloadUrl: string = response['@microsoft.graph.downloadUrl'];
return Promise.resolve(downloadUrl);
}
private async getSiteUrl(downloadUrl: string): Promise<string> {
return fetch(downloadUrl)
.then(async (response) => {
const httpResp = await response.json();
return httpResp.siteUrl;
})
.catch(error => {
console.log(error);
return "";
});
}
}

View File

@ -0,0 +1,142 @@
import { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";
import { SPHttpClient, ISPHttpClientOptions } from '@microsoft/sp-http';
import { IOffer } from "../model/IOffer";
import GraphService from "./GraphService";
export interface ISPService {
createOffer(offer: IOffer, siteUrl: string, siteDomain: string): Promise<string>;
}
interface IFile {
data: ArrayBuffer,
name: string;
size: number;
}
interface IFileItem {
id: string;
type: string;
}
export class SPService implements ISPService {
public static readonly serviceKey: ServiceKey<SPService> =
ServiceKey.create<SPService>('react-office-create-offer', SPService);
private _spHttpClient: SPHttpClient;
private graphServiceInstance: GraphService;
private teamSiteUrl: string;
private teamSiteDomain: string;
private teamSiteRelativeUrl: string;
constructor(serviceScope: ServiceScope) {
serviceScope.whenFinished(() => {
this._spHttpClient = serviceScope.consume(SPHttpClient.serviceKey);
this.graphServiceInstance = serviceScope.consume(GraphService.serviceKey);
});
}
public async createOffer(offer: IOffer, siteDomain: string, siteUrl: string): Promise<string> {
if (siteUrl !== '') { // Run and configured in SharePoint
this.teamSiteUrl = siteUrl;
}
else { // Running in M365 (Teams, Office, Outlook)
const personalSiteUrl = await this.graphServiceInstance.getPersonalSiteUrl();
if (personalSiteUrl !== '') { // Configured personally
this.teamSiteUrl = personalSiteUrl;
}
else { // Configured tenant-wide
this.teamSiteUrl = await this.getSiteUrl(`https://${siteDomain}`);
}
}
if (this.teamSiteUrl !== '') {
this.teamSiteDomain = siteDomain;
this.teamSiteRelativeUrl = this.teamSiteUrl.split(this.teamSiteDomain)[1];
const tmplFile = await this.loadTemplate(offer);
const newFileRelativeUrl: string = await this.createOfferFile(tmplFile);
const newFileUrl = `https://${this.teamSiteDomain}${newFileRelativeUrl}`;
const fileListItemInfo = await this.getFileListItem(tmplFile.name);
await this.updateFileListItem(fileListItemInfo.id, fileListItemInfo.type, offer);
return Promise.resolve(newFileUrl);
}
return Promise.reject();
}
private async getSiteUrl(tenantUrl: string): Promise<string> {
const requestUrl: string = `${tenantUrl}/_api/SP_TenantSettings_Current`;
const response = await this._spHttpClient.get(requestUrl, SPHttpClient.configurations.v1);
const jsonResp = await response.json();
const appCatalogUrl: string = jsonResp.CorporateCatalogUrl;
if (appCatalogUrl && appCatalogUrl.length > 8) {
const apprequestUrl: string = `${appCatalogUrl}/_api/web/GetStorageEntity('CreateOfferSiteUrl')`;
const appResponse = await this._spHttpClient.get(apprequestUrl, SPHttpClient.configurations.v1);
const jsonAppResp = await appResponse.json();
const siteUrl: string = jsonAppResp.Value;
return siteUrl;
}
return "";
}
private async loadTemplate (offer: IOffer): Promise<IFile> {
const requestUrl: string = `${this.teamSiteUrl}/_api/web/GetFileByServerRelativeUrl('${this.teamSiteRelativeUrl}/_cts/Offering/Offering.dotx')/OpenBinaryStream()`;
const response = await this._spHttpClient.get(requestUrl, SPHttpClient.configurations.v1);
const fileBlob = await response.arrayBuffer();
const respFile = { data: fileBlob, name: `${offer.title}.docx`, size: fileBlob.byteLength };
return respFile;
}
private async createOfferFile(tmplFile: IFile): Promise<string> {
const uploadUrl = `${this.teamSiteUrl}/_api/web/GetFolderByServerRelativeUrl('${this.teamSiteRelativeUrl}/Shared Documents')/files/add(overwrite=true,url='${tmplFile.name}')` ;
const spOpts : ISPHttpClientOptions = {
headers: {
"Accept": "application/json",
"Content-Length": tmplFile.size.toString(),
"Content-Type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
},
body: tmplFile.data
};
const response = await this._spHttpClient.post(uploadUrl, SPHttpClient.configurations.v1, spOpts);
const jsonResp = await response.json();
return jsonResp.ServerRelativeUrl;
}
private async getFileListItem(fileName: string): Promise<IFileItem> {
const requestUrl = `${this.teamSiteUrl}/_api/web/GetFileByServerRelativeUrl('${this.teamSiteRelativeUrl}/Shared Documents/${fileName}')/ListItemAllFields`;
const response = await this._spHttpClient.get(requestUrl, SPHttpClient.configurations.v1);
const jsonResp = await response.json();
const itemID = jsonResp.ID;
return { id: itemID, type: jsonResp["@odata.type"].replace('#', '') };
}
private async updateFileListItem(itemID: string, itemType: string, offer: IOffer): Promise<void> {
const requestUrl = `${this.teamSiteUrl}/_api/web/lists/GetByTitle('Documents')/items(${itemID})`;
const spOpts : ISPHttpClientOptions = {
headers: {
"Content-Type": "application/json;odata=verbose",
"Accept": "application/json;odata=verbose",
"odata-version": "3.0",
"If-Match": "*",
"X-HTTP-Method": "MERGE"
},
body: JSON.stringify({
"__metadata": {
"type": itemType
},
"Title": offer.title,
"OfferingDescription": offer.description,
"OfferingVAT": offer.vat,
"OfferingNetPrice": offer.price,
"OfferingDate": offer.date
})
};
const response = await this._spHttpClient.post(requestUrl, SPHttpClient.configurations.v1, spOpts);
if (response.status === 204) {
return Promise.resolve();
}
else {
return Promise.reject();
}
}
}

View File

@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "ceead84d-216c-4bb1-8f33-7b838c46b2e1",
"alias": "CreateOfferSettingsWebPart",
"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": [],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Advanced
"group": { "default": "Advanced" },
"title": { "default": "Create Offer Settings" },
"description": { "default": "Create Offer Settings description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "Create Offer Settings"
}
}]
}

View File

@ -0,0 +1,80 @@
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 'CreateOfferSettingsWebPartStrings';
import { CreateOfferSettings } from './components/CreateOfferSettings';
import { ICreateOfferSettingsProps } from './components/ICreateOfferSettingsProps';
export interface ICreateOfferSettingsWebPartProps {
description: string;
}
export default class CreateOfferSettingsWebPart extends BaseClientSideWebPart<ICreateOfferSettingsWebPartProps> {
private _isDarkTheme: boolean = false;
public render(): void {
const element: React.ReactElement<ICreateOfferSettingsProps> = React.createElement(
CreateOfferSettings,
{
serviceScope: this.context.serviceScope,
isDarkTheme: this._isDarkTheme,
hasTeamsContext: !!this.context.sdks.microsoftTeams
}
);
ReactDom.render(element, this.domElement);
}
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,31 @@
@import '~@fluentui/react/dist/sass/References.scss';
.createOfferSettings {
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;
}
.form {
@include ms-Grid-row;
}
.formField {
margin-bottom: 6px;
@include ms-Grid-col;
@include ms-md12;
@include ms-lg8;
@include ms-xl6;
}

View File

@ -0,0 +1,58 @@
import * as React from 'react';
import { useCallback, useState, useEffect } from "react";
import styles from './CreateOfferSettings.module.scss';
import { ICreateOfferSettingsProps } from './ICreateOfferSettingsProps';
import { TextField } from '@fluentui/react/lib/TextField';
import { PrimaryButton } from 'office-ui-fabric-react';
import GraphService from '../../../services/GraphService';
export const CreateOfferSettings: React.FC<ICreateOfferSettingsProps> = (props) => {
const [siteUrl, setSiteUrl] = useState<string>();
const storeData = useCallback(() => {
const graphServiceInstance = props.serviceScope.consume(GraphService.serviceKey);
graphServiceInstance.storePersonalSiteUrl(siteUrl)
.catch((error) => {
console.log(error);
});
}, [siteUrl]);
useEffect((): void => {
const graphServiceInstance = props.serviceScope.consume(GraphService.serviceKey);
graphServiceInstance.getPersonalSiteUrl()
.then(response => {
setSiteUrl(response);
})
.catch((error) => {
console.log(error);
});
}, []);
return (
<section className={`${styles.createOfferSettings} ${props.hasTeamsContext ? styles.teams : ''}`}>
<div className={styles.form}>
<div className={`${styles.welcome} ${styles.formField}`}>
<h2>Configuration</h2>
</div>
</div>
<div className={styles.form}>
<div className={styles.formField}>
<TextField label="Offer Site Url"
value={siteUrl}
type="text"
onChange={(e, data) => {
if (data) {
setSiteUrl(data);
}
}} />
</div>
</div>
<div className={styles.form}>
<div className={styles.formField}>
<PrimaryButton text='Save' onClick={storeData} />
</div>
</div>
</section>
);
}

View File

@ -0,0 +1,7 @@
import { ServiceScope } from "@microsoft/sp-core-library";
export interface ICreateOfferSettingsProps {
serviceScope: ServiceScope;
isDarkTheme: boolean;
hasTeamsContext: boolean;
}

View File

@ -0,0 +1,15 @@
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"
}
});

View File

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

View File

@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "570b5f8e-de6f-4c82-9892-3d9f24897aa4",
"alias": "OfferCreationSpFxWebPart",
"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": "Offer Creation (SPFx)" },
"description": { "default": "Offer Creation (SPFx) description" },
"officeFabricIconFontName": "Page",
"properties": {
"siteUrl": ""
}
}]
}

View File

@ -0,0 +1,106 @@
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 'OfferCreationSpFxWebPartStrings';
import { OfferCreationSpFx } from './components/OfferCreationSpFx';
import { IOfferCreationSpFxProps } from './components/IOfferCreationSpFxProps';
export interface IOfferCreationSpFxWebPartProps {
siteUrl: string;
}
export default class OfferCreationSpFxWebPart extends BaseClientSideWebPart<IOfferCreationSpFxWebPartProps> {
private _isDarkTheme: boolean = false;
private teamSiteDomain: string = '';
public render(): void {
const element: React.ReactElement<IOfferCreationSpFxProps> = React.createElement(
OfferCreationSpFx,
{
siteUrl: this.properties.siteUrl,
serviceScope: this.context.serviceScope,
isDarkTheme: this._isDarkTheme,
teamSiteDomain: this.teamSiteDomain,
hasTeamsContext: !!this.context.sdks.microsoftTeams,
userDisplayName: this.context.pageContext.user.displayName
}
);
ReactDom.render(element, this.domElement);
}
protected onInit(): Promise<void> {
return this.getTeamSiteDomain().then(domain => {
this.teamSiteDomain = domain;
console.log(domain);
});
}
private getTeamSiteDomain(): Promise<string> {
if (!!this.context.sdks.microsoftTeams) { // running in Teams, office.com or Outlook
return this.context.sdks.microsoftTeams.teamsJs.app.getContext()
.then(context => {
return context.sharePointSite.teamSiteDomain;
});
}
else { // Running in SharePoint
}
const uri = new URL(this.context.pageContext.site.absoluteUrl);
return Promise.resolve(uri.host);
}
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('siteUrl', {
label: strings.SiteUrlFieldLabel
})
]
}
]
}
]
};
}
}

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,6 @@
import{ IOffer } from '../../../model/IOffer';
export interface IOfferCreationFormProps {
offerCreated: boolean;
createOffer: (offer: IOffer) => void;
}

View File

@ -0,0 +1,10 @@
import { ServiceScope } from "@microsoft/sp-core-library";
export interface IOfferCreationSpFxProps {
siteUrl: string;
serviceScope: ServiceScope;
isDarkTheme: boolean;
teamSiteDomain: string;
hasTeamsContext: boolean;
userDisplayName: string;
}

View File

@ -0,0 +1,7 @@
.offerCreationForm {
max-width: 480px;
.formButton {
margin-top: 12px;
}
}

View File

@ -0,0 +1,106 @@
import * as React from "react";
import styles from './OfferCreationForm.module.scss';
import { PrimaryButton } from '@fluentui/react/lib/Button';
import { DatePicker } from '@fluentui/react/lib/DatePicker';
import { Dropdown, IDropdownOption } from '@fluentui/react/lib/Dropdown';
import { TextField } from '@fluentui/react/lib/TextField';
import { useState, useCallback } from "react";
import { IOfferCreationFormProps } from "./IOfferCreationFormProps";
import { IOffer } from "../../../model/IOffer";
export const OfferCreationForm: React.FC<IOfferCreationFormProps> = (props) => {
const [title, setTitle] = useState<string>();
const [date, setDate] = useState<Date>();
const [price, setPrice] = useState<string>();
const [vat, setVAT] = useState<number>();
const [selectedItem, setSelectedItem] = useState<IDropdownOption>();
const [description, setTDescription] = useState<string>();
const vatItems = [
{ key: '19', text: '19% (full)' },
{ key: '7', text: '7% (reduced)' }
];
const onOfferingDateChange = useCallback((date: Date): void => {
setDate(date);
}, []);
const onOfferingVATChange = useCallback((e: React.FormEvent<HTMLDivElement>, selectedOption: IDropdownOption): void => {
setSelectedItem(selectedOption);
switch (selectedOption.key) {
case "19":
setVAT(0.19);
break;
case "7":
setVAT(0.07);
break;
}
}, []);
const storeData = useCallback(() => {
const newOffer: IOffer = {
title: title ? title : '',
description: description ? description : '',
date: date ? date.toISOString() : '',
price: price ? parseFloat(price) : 0,
vat: vat ? vat : 0
};
props.createOffer(newOffer);
}, [title, description, date, price,vat]);
return (
<div className={styles.offerCreationForm}>
<div>
<TextField label="Title"
value={title}
type="text"
onChange={(e, data) => {
if (data) {
setTitle(data);
}
}} />
</div>
<div>
<DatePicker label="Offer Date" value={date} onSelectDate={onOfferingDateChange} />
</div>
<div>
<TextField label="Price"
value={price}
type="number"
step=".01"
onChange={(e, data) => {
if (data) {
const numPrice = parseFloat(data);
if (!isNaN(numPrice)) {
setPrice(numPrice.toString());
}
}
}} />
</div>
<div>
<Dropdown
label="VAT"
selectedKey={selectedItem ? selectedItem.key : undefined}
// eslint-disable-next-line react/jsx-no-bind
onChange={onOfferingVATChange}
placeholder="Select VAT"
options={vatItems}
/>
</div>
<div>
<TextField label="Description"
multiline rows={3}
resizable
value={description}
onChange={(e, data) => {
if (data) {
setTDescription(data);
}
}} />
</div>
<div className={styles.formButton}>
<PrimaryButton text="Create Offer" onClick={storeData} allowDisabledFocus />
</div>
</div>
);
}

View File

@ -0,0 +1,34 @@
@import '~@fluentui/react/dist/sass/References.scss';
.offerCreationSpFx {
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,39 @@
import * as React from 'react';
import { useState } from "react";
import styles from './OfferCreationSpFx.module.scss';
import { IOfferCreationSpFxProps } from './IOfferCreationSpFxProps';
import { OfferCreationForm } from "./OfferCreationForm";
import { IOffer } from '../../../model/IOffer';
import { Label } from '@fluentui/react/lib/Label';
import { Spinner, SpinnerSize } from '@fluentui/react/lib/Spinner';
import { SPService } from '../../../services/SPService';
export const OfferCreationSpFx: React.FC<IOfferCreationSpFxProps> = (props) => {
const [offerCreated, setOfferCreated] = useState<boolean>(false);
const [offerFileUrl, setOfferFileUrl] = useState<string>("");
const [showSpinner, setShowSpinner] = useState<boolean>(false);
const createOffer = (offer: IOffer): void => {
setShowSpinner(true);
const _customSPServiceInstance = props.serviceScope.consume(SPService.serviceKey);
_customSPServiceInstance.createOffer(offer, props.teamSiteDomain, props.siteUrl).then((resp: string) => {
setOfferCreated(true);
setShowSpinner(false);
setOfferFileUrl(resp);
})
.catch((error) => {
console.log(error);
setShowSpinner(false);
});
};
return (
<section className={`${styles.offerCreationSpFx} ${props.hasTeamsContext ? styles.teams : ''}`}>
<h2>Offer creation</h2>
<OfferCreationForm offerCreated={offerCreated} createOffer={createOffer} />
<div>{showSpinner && <Spinner label="Creating document" size={SpinnerSize.large} />}</div>
<div>{offerCreated && <Label>Your offer document is created and can be found <a href={offerFileUrl}>here</a></Label>}</div>
</section>
);
}

View File

@ -0,0 +1,15 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name",
"SiteUrlFieldLabel": "Offer Site Url",
"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"
}
});

View File

@ -0,0 +1,18 @@
declare interface IOfferCreationSpFxWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
SiteUrlFieldLabel: string;
AppLocalEnvironmentSharePoint: string;
AppLocalEnvironmentTeams: string;
AppLocalEnvironmentOffice: string;
AppLocalEnvironmentOutlook: string;
AppSharePointEnvironment: string;
AppTeamsTabEnvironment: string;
AppOfficeEnvironment: string;
AppOutlookEnvironment: string;
}
declare module 'OfferCreationSpFxWebPartStrings' {
const strings: IOfferCreationSpFxWebPartStrings;
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,62 @@
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.13/MicrosoftTeams.schema.json",
"manifestVersion": "1.13",
"id": "570b5f8e-de6f-4c82-9892-3d9f24897aa4",
"version": "1.0.0",
"packageName": "OfferCreationSpFxWebPart",
"developer": {
"name": "Markus Moeller",
"websiteUrl": "https://mmsharepoint.wordpress.com",
"privacyUrl": "https://mmsharepoint.wordpress.com",
"termsOfUseUrl": "https://mmsharepoint.wordpress.com"
},
"name": {
"short": "Offer Creation (SPFx)",
"full": "Offer Creation (SPFx)"
},
"description": {
"short": "A personal M365 app to create custom offer documents",
"full": "A personal Microsoft 365 app to create custom offer documents"
},
"icons": {
"outline": "570b5f8e-de6f-4c82-9892-3d9f24897aa4_outline.png",
"color": "570b5f8e-de6f-4c82-9892-3d9f24897aa4_color.png"
},
"accentColor": "#D85028",
"configurableTabs": [],
"staticTabs": [
{
"entityId": "108eec64-bd4b-4095-a02a-38ad1b2f848c",
"name": "Offer Creation",
"contentUrl": "https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/_layouts/15/teamshostedapp.aspx%3Fteams%26personal%26componentId=570b5f8e-de6f-4c82-9892-3d9f24897aa4%26forceLocale={locale}",
"scopes": [
"personal"
]
},
{
"entityId": "cae9f67e-64d1-42ce-9cc7-69b0c9efcfb4",
"name": "Settings",
"contentUrl": "https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/_layouts/15/teamshostedapp.aspx%3Fteams%26personal%26componentId=ceead84d-216c-4bb1-8f33-7b838c46b2e1%26forceLocale={locale}",
"scopes": [
"personal"
]
}
],
"bots": [],
"connectors": [],
"composeExtensions": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"{teamSiteDomain}"
],
"showLoadingIndicator": false,
"isFullScreen": false,
"webApplicationInfo": {
"resource": "https://{teamSiteDomain}",
"id": "00000003-0000-0ff1-ce00-000000000000"
}
}

View File

@ -0,0 +1,83 @@
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema https://raw.githubusercontent.com/pnp/PnP-Provisioning-Schema/master/PnP.ProvisioningSchema/ProvisioningSchema-2020-02.xsd">
<pnp:Preferences Generator="PnP.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null">
<pnp:Parameters>
<pnp:Parameter Key="DocumentsUrl">Shared Documents</pnp:Parameter>
<pnp:Parameter Key="DocumentsTitle">Documents</pnp:Parameter>
</pnp:Parameters>
</pnp:Preferences>
<pnp:Tenant>
<pnp:StorageEntities>
<pnp:StorageEntity Key="CreateOfferSiteUrl" Value="{hosturl}{sitecollection}" />
</pnp:StorageEntities>
</pnp:Tenant>
<pnp:Templates ID="CONTAINER-TEMPLATE-0EC4AF107C5C49A0BFED873E6CDAF0FC">
<pnp:ProvisioningTemplate ID="TEMPLATE-0EC4AF107C5C49A0BFED873E6CDAF0FC" Version="1" BaseSiteTemplate="GROUP#0" Scope="RootSite">
<pnp:SiteFields>
<Field ID="{58b34549-9623-4cdd-b60e-5fb87638f3c5}" Name="OfferingVAT" StaticName="OfferingVAT" DisplayName="Offering VAT" Type="Number" Percentage="TRUE" Decimals="1" Group="MM" />
<Field ID="{03f60e71-3844-448a-8629-3c6c8c7f603d}" Name="OfferingDescription" StaticName="OfferingDescription" DisplayName="Offering Description" Type="Note" NumLines="6" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" Group="MM" />
<Field ID="{8d00c581-8c5c-4703-955e-5cbfe59bafd5}" Name="OfferingDate" StaticName="OfferingDate" DisplayName="Offering Date" Type="DateTime" Format="DateOnly" Group="MM" FriendlyDisplayFormat="Disabled" />
<Field ID="{0331efb1-e3d0-4180-ac8d-d9ded4935e63}" Name="OfferingReviewer" StaticName="OfferingReviewer" Type="User" DisplayName="Offering Reviewer" List="UserInfo" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" Group="MM" />
<Field ID="{04724b89-1195-4437-ba6a-63ada783d1dc}" Name="OfferingReviewedDate" StaticName="OfferingReviewedDate" DisplayName="Reviewed On" Type="DateTime" Format="DateTime" Group="MM" />
<Field ID="{24bb4ff5-9a39-4423-8d4d-d9469af8afaa}" Name="OfferingNetPrice" StaticName="OfferingNetPrice" DisplayName="Offering Net Price" Type="Currency" Group="MM" />
<Field ID="{a80c4b46-1d74-4e11-a67c-dabd60717d94}" Name="OfferingSubmitter" StaticName="OfferingSubmitter" DisplayName="Offering Submitter" Type="User" List="UserInfo" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" Group="MM" />
<Field ID="{0c46d809-4a27-42a4-9c63-3251175b5340}" Name="SubmittedOn" StaticName="SubmittedOn" DisplayName="Submitted On" Type="DateTime" Format="DateTime" Group="MM" />
</pnp:SiteFields>
<pnp:ContentTypes>
<pnp:ContentType ID="0x0101003656A003937692408E62ADAA56A5AEEF" Name="Offering" Description="" Group="MM" NewFormUrl="" EditFormUrl="" DisplayFormUrl="">
<pnp:FieldRefs>
<pnp:FieldRef ID="c042a256-787d-4a6f-8a8a-cf6ab767f12d" Name="ContentType" UpdateChildren="true" />
<pnp:FieldRef ID="5f47e085-2150-41dc-b661-442f3027f552" Name="SelectFilename" UpdateChildren="true" />
<pnp:FieldRef ID="8553196d-ec8d-4564-9861-3dbe931050c8" Name="FileLeafRef" Required="true" UpdateChildren="true" />
<pnp:FieldRef ID="8c06beca-0777-48f7-91c7-6da68bc07b69" Name="Created" Hidden="true" UpdateChildren="true" />
<pnp:FieldRef ID="fa564e0f-0c70-4ab9-b863-0177e6ddd247" Name="Title" UpdateChildren="true" />
<pnp:FieldRef ID="28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f" Name="Modified" Hidden="true" UpdateChildren="true" />
<pnp:FieldRef ID="822c78e3-1ea9-4943-b449-57863ad33ca9" Name="Modified_x0020_By" UpdateChildren="true" />
<pnp:FieldRef ID="4dd7e525-8d6b-4cb4-9d3e-44ee25f973eb" Name="Created_x0020_By" UpdateChildren="true" />
<pnp:FieldRef ID="03f60e71-3844-448a-8629-3c6c8c7f603d" Name="OfferingDescription" UpdateChildren="true" />
<pnp:FieldRef ID="24bb4ff5-9a39-4423-8d4d-d9469af8afaa" Name="OfferingNetPrice" UpdateChildren="true" />
<pnp:FieldRef ID="58b34549-9623-4cdd-b60e-5fb87638f3c5" Name="OfferingVAT" UpdateChildren="true" />
<pnp:FieldRef ID="8d00c581-8c5c-4703-955e-5cbfe59bafd5" Name="OfferingDate" UpdateChildren="true" />
<pnp:FieldRef ID="0331efb1-e3d0-4180-ac8d-d9ded4935e63" Name="OfferingReviewer" UpdateChildren="true" />
<pnp:FieldRef ID="04724b89-1195-4437-ba6a-63ada783d1dc" Name="OfferingReviewedDate" UpdateChildren="true" />
<pnp:FieldRef ID="{a80c4b46-1d74-4e11-a67c-dabd60717d94}" Name="OfferingSubmitter" UpdateChildren="true" />
<pnp:FieldRef ID="{0c46d809-4a27-42a4-9c63-3251175b5340}" Name="SubmittedOn" UpdateChildren="true" />
</pnp:FieldRefs>
</pnp:ContentType>
</pnp:ContentTypes>
<pnp:Lists>
<pnp:ListInstance Title="{parameter:DocumentsTitle}" Description="" OnQuickLaunch="true" TemplateType="101" Url="{parameter:DocumentsUrl}" ContentTypesEnabled="true" EnableVersioning="true" MinorVersionLimit="0" MaxVersionLimit="500" DraftVersionVisibility="0" TemplateFeatureID="00bfea71-e717-4e80-aa17-d0c71b360101" EnableAttachments="false" ListExperience="NewExperience" ImageUrl="/_layouts/15/images/itdl.png?rev=45" IrmExpire="false" IrmReject="false" IsApplicationList="false" ValidationFormula="" ValidationMessage="">
<pnp:ContentTypeBindings>
<pnp:ContentTypeBinding ContentTypeID="0x0101003656A003937692408E62ADAA56A5AEEF" />
<pnp:ContentTypeBinding ContentTypeID="0x0101" Remove="true" />
</pnp:ContentTypeBindings>
<pnp:Views>
<View Name="{328B25FA-636E-4B5E-8831-78B302111024}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="All Documents" Url="{site}/Shared Documents/Forms/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/dlicon.png?rev=47">
<Query>
<OrderBy>
<FieldRef Name="FileLeafRef" />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name="DocIcon" />
<FieldRef Name="LinkFilename" />
<FieldRef Name="Modified" />
<FieldRef Name="Editor" />
<FieldRef Name="OfferingNetPrice" />
<FieldRef Name="OfferingVAT" />
</ViewFields>
<RowLimit Paged="TRUE">30</RowLimit>
<Aggregations Value="Off" />
<JSLink>clienttemplates.js</JSLink>
<ViewData />
</View>
</pnp:Views>
</pnp:ListInstance>
</pnp:Lists>
<pnp:Files>
<pnp:File Src="Offering.dotx" Folder="_cts/Offering/" Overwrite="true" />
</pnp:Files>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>

View File

@ -0,0 +1,13 @@
param (
[Parameter(Mandatory=$true)]
[string]$siteUrl)
Connect-PnPOnline -Url $siteUrl -Interactive
Set-PnPSite -NoScriptSite $false
Invoke-PnPSiteTemplate -Path ".\templates\Offerings.xml"
$ct = Get-PnPContentType -Identity "Offering"
Set-PnPContentType -Identity $ct -UpdateChildren
Set-PnPSite -NoScriptSite $true

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,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise",
"ES2021.String"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}