@qr-platform/qr-code.js 0.11.9 → 0.20.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.
- package/LICENSE.md +32 -42
- package/README.md +12 -56
- package/docs/advanced-examples.md +4 -28
- package/docs/api-reference-guide.md +3 -11
- package/docs/commercial-use.md +67 -0
- package/docs/documentation.md +32 -322
- package/docs/examples.md +2 -7
- package/docs/typescript-types-definitions.md +2 -19
- package/docs/usage-guide.md +5 -36
- package/lib/browser.d.ts +1 -2
- package/lib/browser.js +3 -3
- package/lib/core/qr-code-js.d.ts +0 -1
- package/lib/core/qr-svg.d.ts +0 -1
- package/lib/esm.js +3 -3
- package/lib/index.d.ts +0 -34
- package/lib/index.js +1 -1
- package/lib/node/browser.d.ts +1 -2
- package/lib/node/core/qr-code-js.d.ts +0 -1
- package/lib/node/core/qr-svg.d.ts +0 -1
- package/lib/node/index.d.ts +0 -34
- package/lib/node/node.d.ts +0 -17
- package/lib/node/plugins/QRBorderPlugin.d.ts +1 -2
- package/lib/node.d.ts +0 -17
- package/lib/node.js +1 -1
- package/lib/plugins/QRBorderPlugin.d.ts +1 -2
- package/package.json +1 -1
- package/docs/license-management.md +0 -492
- package/lib/license/LicenseManager.d.ts +0 -69
- package/lib/license/LicenseManagerNode.d.ts +0 -64
- package/lib/node/license/LicenseManager.d.ts +0 -69
- package/lib/node/license/LicenseManagerNode.d.ts +0 -64
package/LICENSE.md
CHANGED
|
@@ -1,77 +1,67 @@
|
|
|
1
1
|
# QRCode.js Library - License Terms and Conditions
|
|
2
|
+
**Effective Date: May 30, 2025**
|
|
2
3
|
|
|
3
|
-
**
|
|
4
|
+
**IMPORTANT**: PLEASE READ THESE TERMS AND CONDITIONS CAREFULLY BEFORE USING THE QRCode.js LIBRARY. BY DOWNLOADING, INSTALLING, OR USING THE QRCode.js LIBRARY ARTIFACT (THE "SOFTWARE"), YOU ("USER") AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE AGREEMENT. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE THE SOFTWARE.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
This Software is licensed, not sold, by QR-Platform ("Licensor") for use only under the terms of this license. The source code for the Software is proprietary and confidential, and is only provided to holders of a valid Commercial License as specified herein. Licensor reserves all rights not expressly granted to User.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
## 1. Definitions
|
|
9
|
+
- **Non-Commercial Use**: Use of the Software for personal, educational, or charitable purposes, where the primary intention is not to generate revenue or profit.
|
|
10
|
+
- **Open-Source Project**: A project that is licensed under an Open Source Initiative (OSI)-approved open-source license, and where the source code is publicly available.
|
|
11
|
+
- **Commercial Use**: Use of the Software as integrated into a User Application where the User Application is intended to generate revenue or profit, and/or the User Application is not an Open-Source Project.
|
|
12
|
+
- **Competitive Product or Service**: Any software, product, or service that directly competes with or offers similar functionality to QR-Platform's services, including but not limited to QR code generation, customization, or management tools.
|
|
10
13
|
|
|
14
|
+
## 2. License Grant
|
|
11
15
|
Subject to the terms and conditions of this Agreement, Licensor grants User a limited, non-exclusive, non-transferable, non-sublicensable, revocable license to:
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
* **b) Premium Tier Usage:** Use the "Premium Features" of the Software, **only if and for the duration** User has purchased and holds a valid, separate **Commercial License** from Licensor. The terms of the Commercial License will supplement this agreement and specifically govern the use of Premium Features.
|
|
17
|
+
a) **For Non-Commercial Use and use in Open-Source Projects**: Install and use the Software artifact, including all features, solely as integrated into User's applications ("User Applications"), provided that the use does not violate the restrictions in Section 3. For Open-Source Projects, User must include a notice in the project's documentation or README file stating that the project uses the QRCode.js Library and providing a link to this license.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
b) **For Commercial Use**: Upon purchasing a valid Commercial License from Licensor, install and use the Software artifact, including all features, solely as integrated into User Applications, provided that the use does not violate the restrictions in Section 3. The Commercial License also includes access to the complete source code of the Software and full support as specified in the Commercial License Agreement. To purchase a Commercial License, please visit: www.qr-platform.com/qr-code.js#license or contact us at: support@qr-platform.com or qr.platform.com@gmail.com.
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
## 3. Restrictions on Use
|
|
22
|
+
User agrees not to:
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
2. **Scan Validation (`validateScanning` method)**: The functionality provided by the `validateScanning()` method, which may utilize canvas-based analysis, to verify QR code scannability and decode its content.
|
|
24
|
+
a) Reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code or underlying algorithms of the Software, except to the extent that such activity is expressly permitted by applicable law.
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
b) Modify, adapt, translate, or create derivative works based on the Software artifact itself.
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
To purchase a Commercial License, please visit: **[www.qr-platform.com/qr-code-js#license](https://www.qr-platform.com/qr-code-js#license)**
|
|
27
|
-
Or contact us at: **contact@qr-platform.com**
|
|
28
|
+
c) Rent, lease, loan, sublicense, sell, or distribute the Software as a standalone product. User MAY distribute the Software solely when integrated as an inseparable part of User Applications, subject to the terms herein.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
**Licensor reserves the right, at its sole discretion, to designate additional features or functionalities of the Software as 'Premium Features' at any time and without prior notice. Any features so designated will subsequently require a valid Commercial License for their use under the terms of this Agreement and the applicable Commercial License Agreement.**
|
|
30
|
+
d) Remove, alter, or obscure any copyright, trademark, or other proprietary notices on or in the Software.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
e) Use the Software for Commercial Use without a valid Commercial License.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
* a) Reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code or underlying algorithms of the Software.
|
|
36
|
-
* b) Modify, adapt, translate, or create derivative works based on the Software artifact itself.
|
|
37
|
-
* c) Rent, lease, loan, sublicense, sell, or distribute the Software as a standalone product. User MAY distribute the Software solely when integrated as an inseparable part of User Applications, subject to the terms herein.
|
|
38
|
-
* d) Remove, alter, or obscure any copyright, trademark, or other proprietary notices on or in the Software.
|
|
39
|
-
* e) Use the Premium Features without a valid Commercial License.
|
|
40
|
-
* f) Use the Software for any illegal purpose or in violation of any applicable laws.
|
|
34
|
+
f) Use the Software for any illegal purpose or in violation of any applicable laws.
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
g) Use the Software, or its source code to develop, market, or distribute a software library or a standalone commercial product/service whose primary purpose is QR code generation, customization, or management that is sold or offered in direct competition with the QRCode.js Library itself or with QR-Platform's primary commercial services. This restriction does not prevent the integration of the Software into broader User Applications (including Open-Source Projects under Section 2a) that may include QR code functionality as part of a larger feature set, provided such User Applications are not being sold, positioned or marketed primarily as a direct replacement for QR-Platform's core offerings and services.
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
### 3.1 Visible Copyright Notice Requirement
|
|
39
|
+
Users who are granted a license under Section 2a (Non-Commercial Use and use in Open-Source Projects) must display a visible copyright notice in any User Application that incorporates the Software. The copyright notice must include the following wording: "QRCode.js by QR-Platform" and a link to either the GitHub repository at https://github.com/qr-platform/qr-code.js or the QR-Platform website at https://www.qr-platform.com/qr-code.js. The notice must be displayed in a manner that is easily accessible to end-users of the User Application.
|
|
46
40
|
|
|
47
|
-
##
|
|
41
|
+
## 4. Support
|
|
42
|
+
- **For Non-Commercial Use and use in Open-Source Projects**: Users may seek support via community channels (e.g., GitHub Issues) on a best-effort basis. Licensor provides no guaranteed response time or resolution for these users.
|
|
43
|
+
- **For Commercial Use**: Users holding a valid Commercial License are entitled to full support as specified in the Commercial License Agreement. This includes access to software source code, direct support channels, priority response times, and assistance with integration and troubleshooting.
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
## 5. Intellectual Property
|
|
46
|
+
The Software is protected by copyright and other intellectual property laws and treaties. Licensor retains all right, title, and interest in and to the Software, including all copyrights, patents, trade secrets, trademarks, and other intellectual property rights. This license grants User limited rights to use the Software artifact and, for Commercial License holders, access to the source code under the terms of the Commercial License Agreement. No ownership rights are transferred.
|
|
50
47
|
|
|
51
48
|
## 6. Disclaimer of Warranty
|
|
52
|
-
|
|
53
49
|
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR DISCLAIMS ALL WARRANTIES AND CONDITIONS, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. LICENSOR DOES NOT WARRANT THAT THE SOFTWARE WILL MEET USER'S REQUIREMENTS, OPERATE WITHOUT INTERRUPTION, OR BE ERROR-FREE.
|
|
54
50
|
|
|
55
51
|
## 7. Limitation of Liability
|
|
56
|
-
|
|
57
52
|
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL LICENSOR OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, CONSEQUENTIAL, PUNITIVE, OR EXEMPLARY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL LICENSOR'S TOTAL LIABILITY TO USER FOR ALL DAMAGES EXCEED THE AMOUNT PAID BY USER FOR A COMMERCIAL LICENSE TO THE SOFTWARE, IF ANY, OR USD $50.00, WHICHEVER IS GREATER.
|
|
58
53
|
|
|
59
54
|
## 8. Term and Termination
|
|
60
|
-
|
|
61
|
-
This License Agreement is effective until terminated. User's rights under this license will terminate automatically without notice from Licensor if User fails to comply with any term(s) of this license. Upon termination, User shall cease all use of the Software and destroy all copies, full or partial, of the Software artifact. Sections 3, 5, 6, 7, 9, and 11 shall survive any termination.
|
|
55
|
+
This License Agreement is effective until terminated. User's rights under this license will terminate automatically without notice from Licensor if User fails to comply with any term(s) of this license. Upon termination, User shall cease all use of the Software and destroy all copies, full or partial, of the Software artifact. Sections 1 (Definitions), 3 (Restrictions on Use, including 3.1), 5 (Intellectual Property), 6 (Disclaimer of Warranty), 7 (Limitation of Liability), 8 (this Term and Termination section, regarding survival), 9 (Governing Law), and 10 (Entire Agreement) shall survive any termination.
|
|
62
56
|
|
|
63
57
|
## 9. Governing Law
|
|
64
|
-
|
|
65
|
-
This License Agreement shall be governed by and construed in accordance with the laws of **[Your State, e.g., the State of California]**, USA, without regard to its conflict of law principles. User agrees that any disputes arising under this Agreement shall be subject to the exclusive jurisdiction of the state and federal courts located in **[Your County and State, e.g., Santa Clara County, California]**.
|
|
58
|
+
This License Agreement shall be governed by and construed in accordance with the laws of the State of Maryland, US, without regard to its conflict of law principles. User agrees that any disputes arising under this Agreement shall be subject to the exclusive jurisdiction of the state and federal courts located in Baltimore County, Maryland.
|
|
66
59
|
|
|
67
60
|
## 10. Entire Agreement
|
|
68
|
-
|
|
69
61
|
This Agreement, together with the terms of any valid Commercial License obtained by User (if applicable), constitutes the entire agreement between User and Licensor relating to the Software and supersedes all prior or contemporaneous understandings regarding such subject matter. No amendment to or modification of this Agreement will be binding unless in writing and signed by Licensor.
|
|
70
62
|
|
|
71
63
|
## 11. Contact Information
|
|
64
|
+
For questions regarding this license or to inquire about Commercial Licensing, please contact QR-Platform at support@qr-platform.com or qr.platform.com@gmail.com.
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
**Legal Disclaimer:** This license template is provided for informational purposes only and does not constitute legal advice. QR-Platform strongly recommends consulting with a qualified legal professional to ensure this license agreement is suitable for your specific needs and complies with all applicable laws and regulations.
|
|
66
|
+
## Legal Disclaimer
|
|
67
|
+
This license template is provided for informational purposes only and does not constitute legal advice. QR-Platform strongly recommends consulting with a qualified legal professional to ensure this license agreement is suitable for your specific needs and complies with all applicable laws, especially concerning Section 3g.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ QRCode.js is a professional JavaScript/TypeScript library for creating customize
|
|
|
15
15
|
* **Highly Customizable:** Control dot shapes, colors, sizes, corner styles, and background.
|
|
16
16
|
* **Gradients:** Apply linear or radial gradients to dots, corners, and backgrounds.
|
|
17
17
|
* **Image Embedding:** Embed logos or other images in the center, as an overlay, or as a background. Control image precedence with global `QRCodeJs.setImage()` or builder `useImage()`, both supporting an `override` option.
|
|
18
|
-
* **Borders
|
|
18
|
+
* **Borders:** Add basic borders or advanced, customizable borders with text/images. Control text precedence with `QRCodeJs.setText()` or builder `useText()`, both supporting an `override` option.
|
|
19
19
|
* **Flexible Border Configuration:** Set global border defaults (`setBorder`/`setBorderId`) or use the builder pattern (`useBorder`/`useBorderId`) for instance-specific borders.
|
|
20
20
|
* **Templates & Styles**: Use predefined templates and styles, or create your own for consistent branding. Apply them globally with `QRCodeJs.setTemplate()` / `QRCodeJs.setStyle()` or per-instance with the builder's `useTemplate()` / `useStyle()`.
|
|
21
21
|
* **Comprehensive Configuration:**
|
|
@@ -26,7 +26,7 @@ QRCode.js is a professional JavaScript/TypeScript library for creating customize
|
|
|
26
26
|
* **TypeScript Support:** Fully typed for a better development experience.
|
|
27
27
|
* **Node.js Compatible:** Works seamlessly in server-side environments.
|
|
28
28
|
* **Responsive:** Option to make SVG output responsive to container size.
|
|
29
|
-
* **Scan Validation
|
|
29
|
+
* **Scan Validation:** Verify the scannability of generated QR codes.
|
|
30
30
|
|
|
31
31
|
## 🚀 Installation
|
|
32
32
|
|
|
@@ -108,7 +108,7 @@ qrCode.serialize().then(svgString => {
|
|
|
108
108
|
| `backgroundOptions` | Background style (color, roundness, gradient). | `{ color: '#f0f0f0', round: 0.2 }` |
|
|
109
109
|
| `image` | URL/Buffer/Blob of image to embed. | `'logo.png'` |
|
|
110
110
|
| `imageOptions` | Options for the embedded image (size, margin). | `{ imageSize: 0.3, margin: 2 }` |
|
|
111
|
-
| `borderOptions` |
|
|
111
|
+
| `borderOptions` | Options for decorative borders. | `{ hasBorder: true, thickness: 20, ... }` |
|
|
112
112
|
| `SettingsOptions` | Comprehensive object for `setSettings`/`useSettings`. | `{ templateId: '...', data: '...', ...}` |
|
|
113
113
|
|
|
114
114
|
#### For a full list of options and detailed explanations of `SettingsOptions`, `setData`, `setOptions`, and their builder counterparts, see the [API Reference Guide](https://qr-platform.github.io/qr-code.js/docs/api-reference-guide.html) and [Usage Guide](https://qr-platform.github.io/qr-code.js/docs/usage-guide.html).
|
|
@@ -148,7 +148,6 @@ qrCode.serialize().then(svgString => {
|
|
|
148
148
|
**Key Differences:**
|
|
149
149
|
* Import from `@qr-platform/qr-code.js/node`.
|
|
150
150
|
* Methods requiring a DOM like `append()` or `download()` are not available. Use `serialize()` to get the SVG string.
|
|
151
|
-
* License activation (if needed) persists only in memory per session. See [License Management](https://qr-platform.github.io/qr-code.js/docs/license-management.html) for details.
|
|
152
151
|
* **Peer Dependencies:** You must install the required `peerDependencies` for Node.js functionality.
|
|
153
152
|
|
|
154
153
|
Install automatically using npx:
|
|
@@ -160,59 +159,16 @@ qrCode.serialize().then(svgString => {
|
|
|
160
159
|
npm i @xmldom/xmldom @undecaf/zbar-wasm image-size jose jimp @resvg/resvg-js file-type
|
|
161
160
|
````
|
|
162
161
|
|
|
163
|
-
## 🔑 License Management (Free vs. Premium)
|
|
164
|
-
|
|
165
|
-
QRCode.js offers both free and premium features.
|
|
166
|
-
|
|
167
|
-
* **Free Version:**
|
|
168
|
-
* All core generation and styling features (dots, corners, background, gradients, image embedding).
|
|
169
|
-
* Basic border styling (`borderOptions.hasBorder`, `thickness`, `color`, `radius`).
|
|
170
|
-
* **Limitation:** Borders created in the free version will automatically display "QR-Platform" branding text in the bottom border. This cannot be removed or customized without a license.
|
|
171
|
-
|
|
172
|
-
* **Premium Version (Requires License):**
|
|
173
|
-
* **Advanced Borders:** No branding, custom text/images on any side, inner/outer borders, full styling control.
|
|
174
|
-
* **Scan Validation:** Access to the `validateScanning()` method.
|
|
175
|
-
|
|
176
|
-
**Activating a License:**
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
// Activate BEFORE creating QRCodeJs instances
|
|
180
|
-
// Using a license key (fetches token from backend)
|
|
181
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
182
|
-
|
|
183
|
-
// Or using a pre-fetched JWT token
|
|
184
|
-
await QRCodeJs.token('YOUR-JWT-TOKEN');
|
|
185
|
-
|
|
186
|
-
// Check license status
|
|
187
|
-
const licenseDetails = QRCodeJs.getLicenseDetails();
|
|
188
|
-
if (licenseDetails) {
|
|
189
|
-
console.log('License active. Plan:', licenseDetails.plan);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Now create instances with premium features enabled
|
|
193
|
-
const qrPremium = new QRCodeJs({
|
|
194
|
-
data: 'Premium QR Code',
|
|
195
|
-
borderOptions: {
|
|
196
|
-
hasBorder: true,
|
|
197
|
-
thickness: 30,
|
|
198
|
-
decorations: {
|
|
199
|
-
bottom: { enableText: true, value: 'My Custom Text' } // No branding!
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
##### For full details on activation, persistence, configuration, and backend implementation, see the [License Management Guide](https://qr-platform.github.io/qr-code.js/docs/license-management.html).
|
|
206
|
-
|
|
207
162
|
## 📚 Documentation
|
|
208
163
|
|
|
209
|
-
* **[Full Documentation](./docs/documentation.md
|
|
210
|
-
* **[API Reference](./docs/api-reference-guide.md
|
|
211
|
-
* **[Usage Guide](./docs/usage-guide.md
|
|
212
|
-
* **[Basic Examples](./docs/examples.md
|
|
213
|
-
* **[Advanced Examples](./docs/advanced-examples.md
|
|
214
|
-
|
|
164
|
+
* **[Full Documentation](./docs/documentation.md)**: The main guide covering all features, options, and concepts.
|
|
165
|
+
* **[API Reference](./docs/api-reference-guide.md)**: Detailed reference for all classes, methods, and types.
|
|
166
|
+
* **[Usage Guide](./docs/usage-guide.md)**: Practical examples and explanations for common use cases.
|
|
167
|
+
* **[Basic Examples](./docs/examples.md)**: Simple examples to get started quickly.
|
|
168
|
+
* **[Advanced Examples](./docs/advanced-examples.md)**: Demonstrations of complex configurations and feature combinations, including `setSettings` and `useSettings`.
|
|
169
|
+
|
|
170
|
+
## 📜 License and Support
|
|
215
171
|
|
|
216
|
-
|
|
172
|
+
QRCode.js by QR-Platform is **free** for personal projects, open-source projects, or general non-commercial use. For commercial use, a license is required.
|
|
217
173
|
|
|
218
|
-
|
|
174
|
+
See the full license at LICENSE.md for more information. For commercial licenses, including full source code and support, contact qr.platform.com@gmail.com.
|
|
@@ -519,16 +519,13 @@ QRCodeJs.setOptions(null); // This clears the override as well
|
|
|
519
519
|
|
|
520
520
|
---
|
|
521
521
|
|
|
522
|
-
### Border Options and Decorations
|
|
522
|
+
### Border Options and Decorations
|
|
523
523
|
|
|
524
|
-
Uses premium border features for advanced styling and text. Requires a license.
|
|
525
524
|
|
|
526
525
|
**Example 1: Using Text Override Option**
|
|
527
526
|
|
|
528
527
|
```typescript
|
|
529
528
|
|
|
530
|
-
// Ensure license is activated first
|
|
531
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
532
529
|
|
|
533
530
|
// Setting global text with override that will take precedence
|
|
534
531
|
// even over text specified in instance options
|
|
@@ -596,8 +593,6 @@ QRCodeJs.setText(null);
|
|
|
596
593
|
**Example 2: Elaborate Border with Multiple Decorations**
|
|
597
594
|
|
|
598
595
|
```typescript
|
|
599
|
-
// Ensure license is activated first
|
|
600
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
601
596
|
|
|
602
597
|
const qrBorderElaborate = new QRCodeJs({
|
|
603
598
|
data: 'https://example.com/border-elaborate',
|
|
@@ -709,7 +704,6 @@ qrBuilderExampleWithBuild.update({ data: 'https://example.com/builder-pattern-ad
|
|
|
709
704
|
Demonstrates using the class instance pattern (`setTemplate`, `setStyle`) to combine base settings with specific styles for a complex result.
|
|
710
705
|
|
|
711
706
|
```typescript
|
|
712
|
-
|
|
713
707
|
// Define a base template (could be predefined like 'dots' or 'rounded')
|
|
714
708
|
const baseTemplate = {
|
|
715
709
|
qrOptions: { errorCorrectionLevel: 'Q' },
|
|
@@ -746,7 +740,6 @@ const qrBuilderExample = new QRCodeJs({ data: 'https://example.com/class-instanc
|
|
|
746
740
|
This example shows how to set global defaults for a template, style, and border configuration. Subsequent `QRCodeJs` instances will inherit these settings unless overridden during instantiation.
|
|
747
741
|
|
|
748
742
|
```typescript
|
|
749
|
-
|
|
750
743
|
// 1. Define and set global defaults
|
|
751
744
|
const globalTemplate = { backgroundOptions: { color: '#E8F5E9' } }; // Light Green background
|
|
752
745
|
const globalStyle = { dotsOptions: { type: 'classy', color: '#1B5E20' } }; // Dark Green classy dots
|
|
@@ -786,7 +779,6 @@ qrGlobalCombinedOverride.append(document.getElementById('global-combined-overrid
|
|
|
786
779
|
This example demonstrates chaining builder methods to combine a template, style, and border configuration for a single instance without affecting global defaults.
|
|
787
780
|
|
|
788
781
|
```typescript
|
|
789
|
-
|
|
790
782
|
// 1. Define components (optional, could be predefined names or IDs)
|
|
791
783
|
const baseTpl = { qrOptions: { errorCorrectionLevel: 'M' }, margin: 5 };
|
|
792
784
|
const dotsStyle = { dotsOptions: { type: 'dots', color: '#01579B' } }; // Light Blue dots
|
|
@@ -811,14 +803,9 @@ qrBuilderCombined.append(document.getElementById('builder-combined-container'));
|
|
|
811
803
|
```
|
|
812
804
|
---
|
|
813
805
|
|
|
814
|
-
### Scan Validation
|
|
815
|
-
|
|
816
|
-
Validate if the generated QR code is scannable using the built-in validator. This requires a premium license.
|
|
806
|
+
### Scan Validation
|
|
817
807
|
|
|
818
808
|
```typescript
|
|
819
|
-
// Ensure license is activated first
|
|
820
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
821
|
-
|
|
822
809
|
const qrCodeToValidate = new QRCodeJs({
|
|
823
810
|
data: 'Complex data string that might be hard to scan due to density or styling choices',
|
|
824
811
|
qrOptions: { errorCorrectionLevel: 'L' }, // Lower error correction can make scanning harder
|
|
@@ -877,7 +864,7 @@ createAndValidate();
|
|
|
877
864
|
|
|
878
865
|
---
|
|
879
866
|
|
|
880
|
-
### Node.js Static Validation Methods
|
|
867
|
+
### Node.js Static Validation Methods
|
|
881
868
|
|
|
882
869
|
QRCode.js provides static validation methods specifically for Node.js environments to validate existing QR codes from image data or SVG strings.
|
|
883
870
|
|
|
@@ -888,8 +875,6 @@ QRCode.js provides static validation methods specifically for Node.js environmen
|
|
|
888
875
|
import { QRCodeJs } from '@qr-platform/qr-code.js/node';
|
|
889
876
|
import fs from 'fs';
|
|
890
877
|
|
|
891
|
-
// Ensure license is activated first
|
|
892
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
893
878
|
|
|
894
879
|
async function validateQRFromImage() {
|
|
895
880
|
try {
|
|
@@ -919,8 +904,6 @@ validateQRFromImage();
|
|
|
919
904
|
// Node.js import
|
|
920
905
|
import { QRCodeJs } from '@qr-platform/qr-code.js/node';
|
|
921
906
|
|
|
922
|
-
// Ensure license is activated first
|
|
923
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
924
907
|
|
|
925
908
|
async function validateQRFromSVG() {
|
|
926
909
|
try {
|
|
@@ -958,8 +941,6 @@ import { QRCodeJs } from '@qr-platform/qr-code.js/node';
|
|
|
958
941
|
import fs from 'fs';
|
|
959
942
|
import path from 'path';
|
|
960
943
|
|
|
961
|
-
// Ensure license is activated first
|
|
962
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
963
944
|
|
|
964
945
|
async function batchValidateQRCodes() {
|
|
965
946
|
const qrDirectory = 'path/to/qr-codes/';
|
|
@@ -1018,9 +999,6 @@ batchValidateQRCodes();
|
|
|
1018
999
|
```typescript
|
|
1019
1000
|
import { QRCodeJs } from '@qr-platform/qr-code.js/node';
|
|
1020
1001
|
|
|
1021
|
-
// Ensure license is activated first
|
|
1022
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
1023
|
-
|
|
1024
1002
|
async function validateWithRetry(imageData, maxRetries = 3) {
|
|
1025
1003
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
1026
1004
|
try {
|
|
@@ -1078,8 +1056,6 @@ import { QRCodeJs } from '@qr-platform/qr-code.js/node';
|
|
|
1078
1056
|
const app = express();
|
|
1079
1057
|
const upload = multer({ memory: true });
|
|
1080
1058
|
|
|
1081
|
-
// Ensure license is activated on server startup
|
|
1082
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
1083
1059
|
|
|
1084
1060
|
// API endpoint for QR code validation
|
|
1085
1061
|
app.post('/api/validate-qr', upload.single('qrImage'), async (req, res) => {
|
|
@@ -1141,4 +1117,4 @@ app.post('/api/validate-qr-svg', express.text({ type: 'image/svg+xml' }), async
|
|
|
1141
1117
|
app.listen(3000, () => {
|
|
1142
1118
|
console.log('QR validation API server running on port 3000');
|
|
1143
1119
|
});
|
|
1144
|
-
```
|
|
1120
|
+
```
|
|
@@ -59,7 +59,7 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
59
59
|
| `imageOptions.fill` | `object` | `{...}` | Fill `color` or `gradient`. |
|
|
60
60
|
| `imageOptions.fill.color` | `string` | `'rgba(255,255,255,1)'` | Fill color.
|
|
61
61
|
| `imageOptions.fill.gradient` | `Gradient` object | `undefined` | Apply a gradient fill to the QR code. See [Gradient options](#gradientoptions) for configuration details.
|
|
62
|
-
| `borderOptions` | `BorderOptions` object | `undefined` | Options for adding decorative borders. Can be configured globally via `QRCodeJs.setBorder()`/`setBorderId()` or per-instance via the builder pattern (`useBorder()`/`useBorderId()`). See below for sub-options.
|
|
62
|
+
| `borderOptions` | `BorderOptions` object | `undefined` | Options for adding decorative borders. Can be configured globally via `QRCodeJs.setBorder()`/`setBorderId()` or per-instance via the builder pattern (`useBorder()`/`useBorderId()`). See below for sub-options. |
|
|
63
63
|
|
|
64
64
|
---
|
|
65
65
|
|
|
@@ -76,7 +76,6 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
76
76
|
|
|
77
77
|
### Additional Notes
|
|
78
78
|
- The `data` option is the only required option for generating a QR code.
|
|
79
|
-
- Premium features like `borderOptions` and `validateScanning` require a valid license to use.
|
|
80
79
|
|
|
81
80
|
---
|
|
82
81
|
|
|
@@ -116,14 +115,8 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
116
115
|
| `useName` | `name: string` | Assigns a name to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
|
|
117
116
|
| `useDescription` | `description: string` | Assigns a description to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
|
|
118
117
|
| `useMetadata` | `metadata: Record<string, any>` | Attaches custom metadata to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
|
|
119
|
-
| `validateScanning` | `validatorId?: string, debug?: boolean` |
|
|
118
|
+
| `validateScanning` | `validatorId?: string, debug?: boolean` | Validates that the QR code is scannable. Returns `Promise<ScanValidatorResponse>`. |
|
|
120
119
|
| `getTemplates` | | Returns helper functions for looking up predefined templates, styles, text, and borders. |
|
|
121
|
-
| `initializeIfNeeded` | | Initializes the license manager if needed (usually called automatically by `.license()`). Returns `Promise<boolean>`. |
|
|
122
|
-
| `getLicenseDetails` | | Returns decoded license information if a license is active. |
|
|
123
|
-
| `license` | `licenseKey: string` | Activates a license using a license key. Returns `Promise<ValidationResult>`. |
|
|
124
|
-
| `token` | `token: string | null` | Activates a license using a pre-fetched token. Returns `Promise<ValidationResult>`. |
|
|
125
|
-
| `configureLicenseFetcher` | `fetcher: (licenseKey: string) => Promise<string>` | Sets a custom function for fetching license tokens. |
|
|
126
|
-
| `setLicenseUrl` | `url: string` | Sets the URL endpoint for license validation. Returns `typeof QRCodeJs`. |
|
|
127
120
|
| `validateImageData` | `imageData: ImageDataLike` | **(Node.js Static)** Validate scannability from raw image data. Returns `Promise<ScanValidatorResponse>`. |
|
|
128
121
|
| `validateSvg` | `svgSource: string` | **(Node.js Static)** Validate scannability from SVG string. Returns `Promise<ScanValidatorResponse>`. |
|
|
129
122
|
| `setId` | `id: string` | Sets an identifier for the QR code instance. Returns `this`. |
|
|
@@ -141,7 +134,6 @@ qrCode.append(document.getElementById('qr-container'));
|
|
|
141
134
|
<a id="borderoptions"></a>
|
|
142
135
|
### borderOptions Options
|
|
143
136
|
|
|
144
|
-
The `borderOptions` object is a premium feature that allows you to add decorative borders around the QR code. This options can be used to customize the borders, including the color, thickness, text and corner rounding. If used without a license, the library will automatically add "QR-Platform" branding text in the bottom border.
|
|
145
137
|
|
|
146
138
|
| Sub-option | Type | Default | Description |
|
|
147
139
|
| :-------------------- | :------------------------------------- | :------------- | :-------------------------------------------------------------------------- |
|
|
@@ -339,4 +331,4 @@ const qr3 = QRCodeJs.useTemplate('basic')
|
|
|
339
331
|
| `useDescription` | `description: string` | Assigns a description to the QR code instance being built. Returns `this`. |
|
|
340
332
|
| `useMetadata` | `metadata: Record<string, any>` | Attaches custom metadata to the QR code instance being built. Returns `this`. |
|
|
341
333
|
| `options` | `options: RecursivePartial<Options>` | Merges the provided `Options` into the current configuration and creates and returns the final `QRCodeJs` instance. |
|
|
342
|
-
| `build` | - | Creates and returns the final `QRCodeJs` instance based on the accumulated configuration. |
|
|
334
|
+
| `build` | - | Creates and returns the final `QRCodeJs` instance based on the accumulated configuration. |
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Using QRCode.js in Commercial Applications
|
|
2
|
+
|
|
3
|
+
This page explains how you can use the QRCode.js library in your commercial projects, based on our official license terms. Our goal is to make it clear what's possible and what's required when you're building applications intended to generate revenue or that are not open-source.
|
|
4
|
+
|
|
5
|
+
## What is Considered Commercial Use?
|
|
6
|
+
|
|
7
|
+
According to our license (Section 1), "Commercial Use" means:
|
|
8
|
+
|
|
9
|
+
1. Using the QRCode.js library as part of an application or service that is intended to generate revenue or profit.
|
|
10
|
+
2. Using the QRCode.js library in an application that is *not* an Open-Source Project (even if it doesn't directly generate revenue).
|
|
11
|
+
|
|
12
|
+
If your project falls into either of these categories, you are engaging in Commercial Use and you must purchase a valid Commercial License from QR-Platform.
|
|
13
|
+
|
|
14
|
+
## Requirement: A Valid Commercial License
|
|
15
|
+
|
|
16
|
+
**To use QRCode.js in any commercial application, you MUST purchase a valid Commercial License from QR-Platform.**
|
|
17
|
+
|
|
18
|
+
This is a key requirement (Section 2b and 3e of the license). Using the library for commercial purposes without this license is a violation of the terms and conditions.
|
|
19
|
+
|
|
20
|
+
## Benefits of a Commercial License
|
|
21
|
+
|
|
22
|
+
Purchasing a Commercial License grants you several key benefits (Section 2b and Section 4):
|
|
23
|
+
|
|
24
|
+
* **Full Rights for Commercial Integration:** You can legally install and use all features of the QRCode.js library artifact within your commercial applications.
|
|
25
|
+
* **Access to Source Code:** The Commercial License includes access to the complete source code of the QRCode.js library.
|
|
26
|
+
* **Full Support:** You are entitled to full support from the QR-Platform team. This includes direct support channels, priority response times, and assistance with integration and troubleshooting.
|
|
27
|
+
|
|
28
|
+
## Commercial License Fee
|
|
29
|
+
|
|
30
|
+
The standard Commercial License fee for QRCode.js is **$999 per year**. This annual fee grants you the rights and benefits outlined above for the duration of your subscription.
|
|
31
|
+
|
|
32
|
+
For **Enterprise Licensing**, which may include additional services such as dedicated training, integration assistance, or custom feature development, the fee may be higher. Please contact us directly to discuss your specific enterprise requirements and for a tailored quote.
|
|
33
|
+
|
|
34
|
+
## How to Get a Commercial License
|
|
35
|
+
|
|
36
|
+
You can obtain a Commercial License by:
|
|
37
|
+
|
|
38
|
+
1. Visiting our official licensing page: [www.qr-platform.com/qr-code.js#license](http://www.qr-platform.com/qr-code.js#license)
|
|
39
|
+
2. Contacting us directly via email: [support@qr-platform.com](mailto:support@qr-platform.com) or [qr.platform.com@gmail.com](mailto:qr.platform.com@gmail.com)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Key Restrictions to Keep in Mind for Commercial Use
|
|
43
|
+
|
|
44
|
+
Even with a Commercial License, there are a few important restrictions (Section 3):
|
|
45
|
+
|
|
46
|
+
* **No Standalone Resale or Distribution:** You cannot sell, rent, lease, or distribute the QRCode.js library itself as a standalone product. It must be integrated as an inseparable part of your larger application.
|
|
47
|
+
* **No Reverse Engineering (of the artifact):** You cannot attempt to reverse engineer, decompile, or disassemble the provided software artifact. (Note: The Commercial License *does* grant you access to the source code, which you can then use and modify as per your license agreement).
|
|
48
|
+
* **Proprietary Notices:** You must not remove or alter any copyright or proprietary notices included in the Software.
|
|
49
|
+
* **No Competing Products:**
|
|
50
|
+
* You **cannot** use the QRCode.js library or its source code to develop, market, or distribute a software library or a standalone commercial product/service whose main purpose is QR code generation, customization, or management if that product directly competes with the QRCode.js library itself or with QR-Platform's primary commercial services.
|
|
51
|
+
* **However**, this **does not prevent** you from integrating QRCode.js into broader commercial applications that include QR code functionality as part of a larger feature set. The key is that your application should not be positioned or marketed primarily as a direct replacement for QR-Platform's core offerings.
|
|
52
|
+
|
|
53
|
+
## Integrating into Your Commercial Application
|
|
54
|
+
|
|
55
|
+
Once you have a valid Commercial License, you can integrate the QRCode.js library (including its artifact and, as provided, its source code) into your commercial "User Applications."
|
|
56
|
+
|
|
57
|
+
## Questions?
|
|
58
|
+
|
|
59
|
+
If you have any questions about using QRCode.js in your commercial project, or if you're unsure whether your use case requires a Commercial License, please don't hesitate to contact us:
|
|
60
|
+
|
|
61
|
+
* Email: [support@qr-platform.com](mailto:support@qr-platform.com) or [qr.platform.com@gmail.com](mailto:qr.platform.com@gmail.com)
|
|
62
|
+
|
|
63
|
+
We're here to help you understand the licensing and ensure you can use QRCode.js successfully and legally in your commercial endeavors.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
**Disclaimer:** This document provides a plain English summary for convenience. The full [QRCode.js Library - License Terms and Conditions](https://github.com/qr-platform/qr-code.js/blob/main/LICENSE.md) is the legally binding document. Please refer to it for complete details.
|