@pnp/cli-microsoft365-spfx-toolkit 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthServer = void 0;
4
4
  const http = require("http");
5
+ const fs = require("fs");
6
+ const path = require("path");
5
7
  const url = require("url");
6
8
  const Auth_1 = require("./Auth");
7
9
  const browserUtil_1 = require("./utils/browserUtil");
@@ -44,9 +46,27 @@ class AuthServer {
44
46
  const hasError = queryString.error !== undefined;
45
47
  let body = "";
46
48
  if (hasCode === true) {
47
- body = '<script type="text/JavaScript">setTimeout(function(){ window.location = "https://github.com/pnp/vscode-viva/wiki"; },10000);</script>';
48
- body += '<p><b>SPFx Toolkit VS Code Extension</b></p>';
49
- body += '<p>You may close this window or we will redirect you to the <a href="https://github.com/pnp/vscode-viva/wiki">SPFx Toolkit</a> documentation in 10 seconds.</p>';
49
+ const toolkitLogoImage = this.getAssetDataUri('logo-large.png');
50
+ const pnpLogoImage = this.getAssetDataUri('pnp-logo.png');
51
+ const toolkitLogoImageTag = toolkitLogoImage !== '' ? `<img class="logo-large" src="${toolkitLogoImage}" alt="SPFx Toolkit logo" />` : '';
52
+ const pnpLogoImageTag = pnpLogoImage !== '' ? `<img class="pnp-logo" src="${pnpLogoImage}" alt="PnP logo" />` : '';
53
+ body = `
54
+ <script type="text/JavaScript">
55
+ setTimeout(function(){ window.location = "https://spfxtoolkit.community.ms/"; }, 10000);
56
+ </script>
57
+ <div class="page">
58
+ <div class="card">
59
+ ${toolkitLogoImageTag}
60
+ <h1>Signed in to SPFx Toolkit</h1>
61
+ <p>You can close this window and return to VS Code.</p>
62
+ <p>This page will redirect you to the <a href="https://spfxtoolkit.community.ms/">SPFx Toolkit</a> documentation in a few seconds.</p>
63
+ <div class="community">
64
+ ${pnpLogoImageTag}
65
+ <p>This extension is supported by Microsoft 365 &amp; Power Platform Community.</p>
66
+ <p><a href="https://pnp.github.io/">Microsoft 365 &amp; Power Platform Community</a></p>
67
+ </div>
68
+ </div>
69
+ </div>`;
50
70
  this.resolve({
51
71
  code: queryString.code,
52
72
  redirectUri: this.generatedServerUrl
@@ -75,7 +95,75 @@ class AuthServer {
75
95
  this.reject(errorMessage);
76
96
  }
77
97
  response.writeHead(200, { 'Access-Control-Allow-Origin': '*', 'Content-Type': 'text/html' });
78
- response.write(`<html><head><title>SPFx Toolkit</title></head><body>${body}</body></html>`);
98
+ response.write(`<html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>SPFx Toolkit</title><style>
99
+ :root {
100
+ color-scheme: dark;
101
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
102
+ }
103
+ body {
104
+ margin: 0;
105
+ min-height: 100vh;
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ background: #1f1f1f;
110
+ color: #cccccc;
111
+ }
112
+ .page {
113
+ width: 100%;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ padding: 24px;
118
+ }
119
+ .card {
120
+ width: min(480px, 100%);
121
+ background: #252526;
122
+ border: 1px solid #3c3c3c;
123
+ border-radius: 8px;
124
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
125
+ padding: 32px;
126
+ text-align: center;
127
+ display: flex;
128
+ flex-direction: column;
129
+ }
130
+ .logo-large {
131
+ width: min(260px, 100%);
132
+ height: auto;
133
+ margin: 0 auto 20px;
134
+ }
135
+ h1 {
136
+ margin: 0 0 8px;
137
+ color: #ffffff;
138
+ font-size: 24px;
139
+ font-weight: 600;
140
+ }
141
+ p {
142
+ margin: 0 0 12px;
143
+ line-height: 1.5;
144
+ }
145
+ a {
146
+ color: #3794ff;
147
+ text-decoration: none;
148
+ }
149
+ a:hover {
150
+ text-decoration: underline;
151
+ }
152
+ .community {
153
+ margin-top: 20px;
154
+ padding-top: 16px;
155
+ border-top: 1px solid #3c3c3c;
156
+ }
157
+ .community p {
158
+ margin: 0 0 8px;
159
+ }
160
+ .pnp-logo {
161
+ width: 56px;
162
+ height: auto;
163
+ margin: 0 auto 8px;
164
+ display: block;
165
+ }
166
+ </style></head><body>${body}</body></html>`);
79
167
  response.end();
80
168
  this.httpServer.close();
81
169
  };
@@ -83,6 +171,17 @@ class AuthServer {
83
171
  get server() {
84
172
  return this.httpServer;
85
173
  }
174
+ getAssetDataUri(assetFileName) {
175
+ try {
176
+ const imagePath = path.join(__dirname, 'assets', assetFileName);
177
+ const imageBuffer = fs.readFileSync(imagePath);
178
+ const mimeType = path.extname(assetFileName).toLowerCase() === '.png' ? 'image/png' : 'application/octet-stream';
179
+ return `data:${mimeType};base64,${imageBuffer.toString('base64')}`;
180
+ }
181
+ catch (_a) {
182
+ return '';
183
+ }
184
+ }
86
185
  openUrl(url) {
87
186
  browserUtil_1.browserUtil.open(url)
88
187
  .then(_ => {
Binary file
Binary file
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
9
- "version": "1.12.0",
9
+ "version": "1.13.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-common": "^13.2.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365-spfx-toolkit",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "CommonJS version of CLI for Microsoft 365 for SPFx Toolkit",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",