@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/docs/documentation.md
CHANGED
|
@@ -533,20 +533,14 @@ Gradients can be applied to multiple elements: `dotsOptions`, `cornersSquareOpti
|
|
|
533
533
|
|
|
534
534
|
## Borders
|
|
535
535
|
|
|
536
|
-
|
|
536
|
+
QRCode.js provides border features:
|
|
537
537
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
- **Premium Version Borders** (requires license):
|
|
546
|
-
- No QR-Platform branding (can use custom text or no text)
|
|
547
|
-
- Full control over all sides of the border
|
|
548
|
-
- Advanced border features (inner borders, outer borders, custom text)
|
|
549
|
-
- Fine-grained control over border appearance
|
|
538
|
+
- Basic border styling like color and thickness is supported
|
|
539
|
+
- Full control over all sides of the border
|
|
540
|
+
- Advanced border features (inner borders, outer borders, custom text)
|
|
541
|
+
- Fine-grained control over border appearance
|
|
542
|
+
- Inner and outer borders can be styled independently
|
|
543
|
+
- Decorative text and images can be added to each side of the border
|
|
550
544
|
|
|
551
545
|
### `borderOptions`
|
|
552
546
|
|
|
@@ -598,7 +592,7 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
598
592
|
}
|
|
599
593
|
```
|
|
600
594
|
|
|
601
|
-
#### `noBorderThickness`
|
|
595
|
+
#### `noBorderThickness`
|
|
602
596
|
|
|
603
597
|
- **Purpose**: Thickness to use for a border side if its decoration is disabled (e.g., text is not shown). Useful for maintaining alignment.
|
|
604
598
|
- **Type**: `number`
|
|
@@ -610,7 +604,7 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
610
604
|
}
|
|
611
605
|
```
|
|
612
606
|
|
|
613
|
-
#### `background`
|
|
607
|
+
#### `background`
|
|
614
608
|
|
|
615
609
|
- **Purpose**: Background color specifically for the border area itself.
|
|
616
610
|
- **Type**: `string` (CSS color, hex, rgb, rgba)
|
|
@@ -622,7 +616,7 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
622
616
|
}
|
|
623
617
|
```
|
|
624
618
|
|
|
625
|
-
#### `inner`
|
|
619
|
+
#### `inner`
|
|
626
620
|
|
|
627
621
|
- **Purpose**: Options for scaling/offsetting the inner content area
|
|
628
622
|
- **Type**: `object`
|
|
@@ -643,7 +637,7 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
643
637
|
}
|
|
644
638
|
```
|
|
645
639
|
|
|
646
|
-
#### `borderOuter`
|
|
640
|
+
#### `borderOuter`
|
|
647
641
|
|
|
648
642
|
- **Purpose**: Options for an additional border outside the main one
|
|
649
643
|
- **Type**: `object`
|
|
@@ -660,7 +654,7 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
660
654
|
}
|
|
661
655
|
```
|
|
662
656
|
|
|
663
|
-
#### `borderInner`
|
|
657
|
+
#### `borderInner`
|
|
664
658
|
|
|
665
659
|
- **Purpose**: Options for an additional border inside the main one
|
|
666
660
|
- **Type**: `object`
|
|
@@ -677,12 +671,11 @@ Options for adding decorative borders around the QR code. Borders can be configu
|
|
|
677
671
|
}
|
|
678
672
|
```
|
|
679
673
|
|
|
680
|
-
#### `decorations`
|
|
674
|
+
#### `decorations`
|
|
681
675
|
|
|
682
676
|
- **Purpose**: Add text or images to specific sides of the border
|
|
683
677
|
- **Type**: `object`
|
|
684
678
|
- **Properties**: Configuration for each side (`top`, `right`, `bottom`, `left`)
|
|
685
|
-
- **Note**: In the free version, the bottom border will always display "QR-Platform" branding regardless of your settings
|
|
686
679
|
- **Example**:
|
|
687
680
|
```typescript
|
|
688
681
|
borderOptions: {
|
|
@@ -720,12 +713,9 @@ Each decoration object can have these properties:
|
|
|
720
713
|
- `value`: Text content or image URL
|
|
721
714
|
- `style`: Style options for text (font, size, color, etc.)
|
|
722
715
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
#### Free Version (with QR-Platform branding)
|
|
716
|
+
#### Example Usage of Borders
|
|
726
717
|
|
|
727
718
|
```typescript
|
|
728
|
-
// Free version border - will show "QR-Platform" in bottom border
|
|
729
719
|
const qrCode = new QRCodeJs({
|
|
730
720
|
data: 'https://example.com',
|
|
731
721
|
borderOptions: {
|
|
@@ -737,12 +727,8 @@ const qrCode = new QRCodeJs({
|
|
|
737
727
|
});
|
|
738
728
|
```
|
|
739
729
|
|
|
740
|
-
#### Premium Version (license required)
|
|
741
730
|
|
|
742
731
|
```typescript
|
|
743
|
-
// First activate license
|
|
744
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
745
|
-
|
|
746
732
|
// Then create QR code with custom border text
|
|
747
733
|
const qrCode = new QRCodeJs({
|
|
748
734
|
data: 'https://example.com',
|
|
@@ -755,7 +741,7 @@ const qrCode = new QRCodeJs({
|
|
|
755
741
|
bottom: {
|
|
756
742
|
enableText: true,
|
|
757
743
|
type: 'text',
|
|
758
|
-
value: '
|
|
744
|
+
value: 'Scan Me',
|
|
759
745
|
style: {
|
|
760
746
|
fontFace: 'Arial',
|
|
761
747
|
fontSize: 24,
|
|
@@ -767,26 +753,7 @@ const qrCode = new QRCodeJs({
|
|
|
767
753
|
});
|
|
768
754
|
```
|
|
769
755
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
When attempting to use premium border features without a license, the library will:
|
|
773
|
-
|
|
774
|
-
1. Not throw errors, but gracefully fall back to the free version behavior
|
|
775
|
-
2. Display "QR-Platform" branding in the bottom border regardless of your `decorations` settings
|
|
776
|
-
3. Ignore certain premium-only properties like `inner`, `borderOuter`, and `borderInner`
|
|
777
|
-
|
|
778
|
-
To check if your license is active and premium features are available:
|
|
779
|
-
|
|
780
|
-
```typescript
|
|
781
|
-
// Check detailed license information
|
|
782
|
-
const licenseDetails = QRCodeJs.getLicenseDetails();
|
|
783
|
-
if (licenseDetails) {
|
|
784
|
-
console.log('License plan:', licenseDetails.plan);
|
|
785
|
-
console.log('License expires:', new Date(licenseDetails.exp * 1000));
|
|
786
|
-
}
|
|
787
|
-
```
|
|
788
|
-
|
|
789
|
-
## Border Text Methods (Premium Feature)
|
|
756
|
+
## Border Text Methods
|
|
790
757
|
|
|
791
758
|
QRCode.js provides dedicated methods for managing text on QR code borders, allowing for convenient text configuration across all sides.
|
|
792
759
|
|
|
@@ -926,8 +893,6 @@ This is particularly useful when you need to ensure specific text appears regard
|
|
|
926
893
|
### Example: Combining Text Methods with Border Options
|
|
927
894
|
|
|
928
895
|
```typescript
|
|
929
|
-
// First activate license (required for custom border text)
|
|
930
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
931
896
|
|
|
932
897
|
// Set global default for all QR codes
|
|
933
898
|
QRCodeJs.setText({
|
|
@@ -976,9 +941,7 @@ QRCodeJs.useText('empty-text-options').options({
|
|
|
976
941
|
});
|
|
977
942
|
```
|
|
978
943
|
|
|
979
|
-
## Scan Validation
|
|
980
|
-
|
|
981
|
-
> **Note**: This is a Premium Feature requiring a license.
|
|
944
|
+
## Scan Validation
|
|
982
945
|
|
|
983
946
|
The QRCode.js library offers functionality to validate that generated QR codes are scannable.
|
|
984
947
|
|
|
@@ -986,9 +949,6 @@ The QRCode.js library offers functionality to validate that generated QR codes a
|
|
|
986
949
|
|
|
987
950
|
- **Purpose**: Verify the generated QR code is scannable
|
|
988
951
|
- **Returns**: `Promise<ScanValidatorResponse>` resolving to a validation result object (`{ isValid: boolean, decodedText?: string, message?: string }`)
|
|
989
|
-
- **Parameters**:
|
|
990
|
-
- `validatorId` (`string`, optional, default: `'zbar'`): The ID of the validator engine to use. Currently only `'zbar'` is supported in the public release.
|
|
991
|
-
- `debug` (`boolean`, optional, default: `false`): Enables debug logging for the validation process.
|
|
992
952
|
- **Example**:
|
|
993
953
|
```typescript
|
|
994
954
|
const qrCode = new QRCodeJs({
|
|
@@ -1049,162 +1009,16 @@ qrCode.serialize().then(svgString => {
|
|
|
1049
1009
|
npm i @xmldom/xmldom @undecaf/zbar-wasm image-size jose jimp @resvg/resvg-js file-type
|
|
1050
1010
|
```
|
|
1051
1011
|
- **No Canvas/Download**: Methods relying on browser APIs like `append()`, `download()`, or internal canvas generation are not available or behave differently in the Node.js version.
|
|
1052
|
-
- **License Management**: Use the static methods described in the [License Management](#license-management) section.
|
|
1053
|
-
- **Border Branding**: Similar to the browser version, Node.js will add "QR-Platform" branding to borders in the free version. To remove this, you'll need to activate a license.
|
|
1054
|
-
|
|
1055
|
-
## License Management
|
|
1056
|
-
|
|
1057
|
-
QRCode.js provides a comprehensive licensing system for premium features like advanced border controls and scan validation.
|
|
1058
|
-
|
|
1059
|
-
### Free vs. Premium Features
|
|
1060
|
-
|
|
1061
|
-
- **Free Features**: Basic QR code generation, styling options (colors, shapes, dot types), image embedding, basic borders (with QR-Platform branding)
|
|
1062
|
-
- **Premium Features**:
|
|
1063
|
-
- Advanced border customization (without branding)
|
|
1064
|
-
- Custom border text
|
|
1065
|
-
- Inner and outer borders
|
|
1066
|
-
- Scan validation tools
|
|
1067
|
-
- Full control over border sides and styling
|
|
1068
|
-
|
|
1069
|
-
### Border Limitations in Free Version
|
|
1070
|
-
|
|
1071
|
-
When using the basic border features in the free version, the library will automatically add "QR-Platform" branding text in the bottom border. This branded text cannot be removed or modified without a valid license. With a premium license, you gain full control over border text and can use borders without any branding.
|
|
1072
|
-
|
|
1073
|
-
### Activation Timing
|
|
1074
|
-
|
|
1075
|
-
- **Purpose**: Determines when license activation should occur
|
|
1076
|
-
- **Important**: License activation must be completed *before* you create any `QRCodeJs` instances
|
|
1077
|
-
- **Reason**: The constructor checks the license status at the time of creation
|
|
1078
|
-
- **Rule**: Activate first, then instantiate
|
|
1079
|
-
|
|
1080
|
-
### Initialization
|
|
1081
|
-
|
|
1082
|
-
- **Purpose**: Sets up the license manager
|
|
1083
|
-
- **Behavior**: Initializes automatically when you call `.license()` (or otherwise attempt activation) or check the status
|
|
1084
|
-
- **Manual Method**: `QRCodeJs.initializeIfNeeded()` (rarely needed because `.license()` runs it automatically)
|
|
1085
|
-
- **Example**:
|
|
1086
|
-
```typescript
|
|
1087
|
-
async function initializeOnLoad() {
|
|
1088
|
-
const isActive = await QRCodeJs.initializeIfNeeded();
|
|
1089
|
-
console.log('License active after init:', isActive);
|
|
1090
|
-
}
|
|
1091
|
-
```
|
|
1092
|
-
|
|
1093
|
-
### Persistence
|
|
1094
|
-
|
|
1095
|
-
#### Browser Environment
|
|
1096
|
-
- **Storage**: `localStorage` under the key `QRCodeJsLicense`
|
|
1097
|
-
- **Persistence**: License persists across page loads and sessions until token expiration
|
|
1098
|
-
- **Content Stored**: Both JWT and license key (if used for activation)
|
|
1099
|
-
|
|
1100
|
-
#### Node.js Environment
|
|
1101
|
-
- **Storage**: In-memory only (no persistent storage)
|
|
1102
|
-
- **Persistence**: Requires reactivation when the application restarts
|
|
1103
|
-
- **Alternative**: Manage token storage externally
|
|
1104
1012
|
|
|
1105
|
-
### Activation Methods
|
|
1106
1013
|
|
|
1107
|
-
####
|
|
1014
|
+
#### QRCode.js provides a comprehensive system for generating QR codes with advanced features:
|
|
1108
1015
|
|
|
1109
|
-
-
|
|
1110
|
-
-
|
|
1111
|
-
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
4. Library validates JWT signature and expiration date
|
|
1116
|
-
5. If valid, token and key are stored
|
|
1117
|
-
- **Example** (async/await):
|
|
1118
|
-
```typescript
|
|
1119
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
1120
|
-
const qrInstance = new QRCodeJs({
|
|
1121
|
-
data: 'https://example.com',
|
|
1122
|
-
borderOptions: {
|
|
1123
|
-
hasBorder: true,
|
|
1124
|
-
decorations: {
|
|
1125
|
-
bottom: {
|
|
1126
|
-
enableText: true,
|
|
1127
|
-
value: 'CUSTOM TEXT' // Works because license is active
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
```
|
|
1133
|
-
|
|
1134
|
-
#### Using a Pre-fetched Token (`QRCodeJs.token()`)
|
|
1135
|
-
|
|
1136
|
-
- **Purpose**: Activate license using a pre-fetched JWT token
|
|
1137
|
-
- **Type**: `function(jwtToken: string | null): Promise<ValidationResult>`
|
|
1138
|
-
- **Process**:
|
|
1139
|
-
1. Calls `QRCodeJs.token('YOUR-JWT-STRING')`
|
|
1140
|
-
2. Library validates JWT signature and expiration date
|
|
1141
|
-
3. If valid, token is stored
|
|
1142
|
-
- **Example** (async/await):
|
|
1143
|
-
```typescript
|
|
1144
|
-
await QRCodeJs.token(token);
|
|
1145
|
-
const qrInstance = new QRCodeJs({
|
|
1146
|
-
data: 'https://example.com',
|
|
1147
|
-
borderOptions: {
|
|
1148
|
-
hasBorder: true,
|
|
1149
|
-
borderOuter: { // Premium feature works with license
|
|
1150
|
-
color: '#002683',
|
|
1151
|
-
thickness: 10
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
});
|
|
1155
|
-
```
|
|
1156
|
-
|
|
1157
|
-
### Checking License Status
|
|
1158
|
-
|
|
1159
|
-
#### Getting License Details
|
|
1160
|
-
|
|
1161
|
-
- **Purpose**: Retrieve current license information
|
|
1162
|
-
- **Type**: `function(): DecodedLicenseToken | null`
|
|
1163
|
-
- **Returns**: Decoded token object if license is active, otherwise `null`
|
|
1164
|
-
- **Example**:
|
|
1165
|
-
```typescript
|
|
1166
|
-
const licenseDetails = QRCodeJs.getLicenseDetails();
|
|
1167
|
-
if (licenseDetails) {
|
|
1168
|
-
console.log('License active. Plan:', licenseDetails.plan);
|
|
1169
|
-
console.log('Domains:', licenseDetails.domains);
|
|
1170
|
-
console.log('Expires:', new Date(licenseDetails.exp * 1000));
|
|
1171
|
-
} else {
|
|
1172
|
-
console.log('License not active or expired.');
|
|
1173
|
-
}
|
|
1174
|
-
```
|
|
1175
|
-
|
|
1176
|
-
### Configuration
|
|
1177
|
-
|
|
1178
|
-
#### Setting License URL
|
|
1179
|
-
|
|
1180
|
-
- **Purpose**: Configure the endpoint for license key validation
|
|
1181
|
-
- **Type**: `function(url: string): typeof QRCodeJs`
|
|
1182
|
-
- **Default**: `/api/get-token`
|
|
1183
|
-
- **Important**: Must be called before `QRCodeJs.license()`
|
|
1184
|
-
- **Example**:
|
|
1185
|
-
```typescript
|
|
1186
|
-
QRCodeJs.setLicenseUrl('https://my-api.com/licenses/get-token');
|
|
1187
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
1188
|
-
```
|
|
1189
|
-
|
|
1190
|
-
#### Custom License Fetcher
|
|
1191
|
-
|
|
1192
|
-
- **Purpose**: Implement custom token fetching logic
|
|
1193
|
-
- **Type**: `function(fetcherFn: (licenseKey: string) => Promise<string>): void`
|
|
1194
|
-
- **Use Cases**: Custom headers, authentication, or request format
|
|
1195
|
-
- **Example**:
|
|
1196
|
-
```typescript
|
|
1197
|
-
QRCodeJs.configureLicenseFetcher(async (key) => {
|
|
1198
|
-
const response = await fetch('/my/custom/endpoint', {
|
|
1199
|
-
method: 'POST',
|
|
1200
|
-
headers: { 'Authorization': 'Bearer ' + getAuthToken() },
|
|
1201
|
-
body: JSON.stringify({ licKey: key })
|
|
1202
|
-
});
|
|
1203
|
-
if (!response.ok) throw new Error('Fetch failed');
|
|
1204
|
-
const data = await response.json();
|
|
1205
|
-
return data.token;
|
|
1206
|
-
});
|
|
1207
|
-
```
|
|
1016
|
+
- QR code generation, styling options (colors, shapes, dot types), image embedding and borders
|
|
1017
|
+
- Advanced border customization
|
|
1018
|
+
- Custom border text
|
|
1019
|
+
- Inner and outer borders
|
|
1020
|
+
- Scan validation tools
|
|
1021
|
+
- Full control over border sides and styling
|
|
1208
1022
|
|
|
1209
1023
|
## Centralized Configuration with Settings (`SettingsOptions`, `setSettings`, `useSettings`)
|
|
1210
1024
|
|
|
@@ -1462,7 +1276,7 @@ const qrCode = new QRCodeJs({
|
|
|
1462
1276
|
});
|
|
1463
1277
|
```
|
|
1464
1278
|
|
|
1465
|
-
### QR Code with
|
|
1279
|
+
### QR Code with Border
|
|
1466
1280
|
|
|
1467
1281
|
```typescript
|
|
1468
1282
|
const qrCode = new QRCodeJs({
|
|
@@ -1476,17 +1290,12 @@ const qrCode = new QRCodeJs({
|
|
|
1476
1290
|
thickness: 50,
|
|
1477
1291
|
color: '#002683',
|
|
1478
1292
|
radius: '5%'
|
|
1479
|
-
// Note: Bottom border will automatically show "QR-Platform" text
|
|
1480
|
-
// This cannot be changed in the free version
|
|
1481
1293
|
}
|
|
1482
1294
|
});
|
|
1483
1295
|
```
|
|
1484
1296
|
|
|
1485
|
-
### QR Code with Premium Border Features (requires license)
|
|
1486
1297
|
|
|
1487
1298
|
```typescript
|
|
1488
|
-
// Must activate license before creating QR code
|
|
1489
|
-
await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
1490
1299
|
|
|
1491
1300
|
const qrCode = new QRCodeJs({
|
|
1492
1301
|
data: 'https://example.com',
|
|
@@ -1509,7 +1318,6 @@ const qrCode = new QRCodeJs({
|
|
|
1509
1318
|
thickness: 50,
|
|
1510
1319
|
color: '#002683',
|
|
1511
1320
|
radius: '40%',
|
|
1512
|
-
// Premium feature: custom border text (no branding)
|
|
1513
1321
|
decorations: {
|
|
1514
1322
|
top: {
|
|
1515
1323
|
enableText: true,
|
|
@@ -1526,7 +1334,6 @@ const qrCode = new QRCodeJs({
|
|
|
1526
1334
|
bottom: {
|
|
1527
1335
|
enableText: true,
|
|
1528
1336
|
type: 'text',
|
|
1529
|
-
value: 'CUSTOM BOTTOM TEXT', // With license this replaces "QR-Platform"
|
|
1530
1337
|
style: {
|
|
1531
1338
|
fontFace: 'Arial',
|
|
1532
1339
|
fontSize: 20,
|
|
@@ -1534,7 +1341,6 @@ const qrCode = new QRCodeJs({
|
|
|
1534
1341
|
}
|
|
1535
1342
|
}
|
|
1536
1343
|
},
|
|
1537
|
-
// Premium feature: additional borders
|
|
1538
1344
|
borderOuter: {
|
|
1539
1345
|
color: '#001255',
|
|
1540
1346
|
thickness: 10
|
|
@@ -1694,7 +1500,7 @@ Updates the QR code with new options.
|
|
|
1694
1500
|
qrCode.update(options?: RecursivePartial<Options>): void
|
|
1695
1501
|
```
|
|
1696
1502
|
|
|
1697
|
-
#### `validateScanning()`
|
|
1503
|
+
#### `validateScanning()`
|
|
1698
1504
|
|
|
1699
1505
|
Validates that the QR code is scannable.
|
|
1700
1506
|
|
|
@@ -1726,56 +1532,6 @@ qrCode.getSettings(): SettingsOptions & { options: Options }
|
|
|
1726
1532
|
|
|
1727
1533
|
These methods are called directly on the `QRCodeJs` class (e.g., `QRCodeJs.setTemplate()`).
|
|
1728
1534
|
|
|
1729
|
-
#### License Management
|
|
1730
|
-
|
|
1731
|
-
#### `initializeIfNeeded()`
|
|
1732
|
-
|
|
1733
|
-
Initializes the license manager if needed. Typically this runs automatically when calling `.license()`, but you can call it manually in unusual scenarios.
|
|
1734
|
-
|
|
1735
|
-
```typescript
|
|
1736
|
-
QRCodeJs.initializeIfNeeded(): Promise<boolean>
|
|
1737
|
-
```
|
|
1738
|
-
|
|
1739
|
-
#### `getLicenseDetails()`
|
|
1740
|
-
|
|
1741
|
-
Returns the decoded token object if a valid license is active.
|
|
1742
|
-
|
|
1743
|
-
```typescript
|
|
1744
|
-
QRCodeJs.getLicenseDetails(): DecodedLicenseToken | null
|
|
1745
|
-
```
|
|
1746
|
-
|
|
1747
|
-
#### `license()`
|
|
1748
|
-
|
|
1749
|
-
Activates a license using a license key.
|
|
1750
|
-
|
|
1751
|
-
```typescript
|
|
1752
|
-
QRCodeJs.license(licenseKey: string): Promise<ValidationResult>
|
|
1753
|
-
```
|
|
1754
|
-
|
|
1755
|
-
#### `token()`
|
|
1756
|
-
|
|
1757
|
-
Activates a license using a pre-fetched JWT token.
|
|
1758
|
-
|
|
1759
|
-
```typescript
|
|
1760
|
-
QRCodeJs.token(token: string | null): Promise<ValidationResult>
|
|
1761
|
-
```
|
|
1762
|
-
|
|
1763
|
-
#### `configureLicenseFetcher()`
|
|
1764
|
-
|
|
1765
|
-
Configures a custom function for fetching license tokens.
|
|
1766
|
-
|
|
1767
|
-
```typescript
|
|
1768
|
-
QRCodeJs.configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void
|
|
1769
|
-
```
|
|
1770
|
-
|
|
1771
|
-
#### `setLicenseUrl()`
|
|
1772
|
-
|
|
1773
|
-
Sets the URL endpoint for license key validation.
|
|
1774
|
-
|
|
1775
|
-
```typescript
|
|
1776
|
-
QRCodeJs.setLicenseUrl(url: string): void
|
|
1777
|
-
```
|
|
1778
|
-
|
|
1779
1535
|
#### Configuration Defaults & Builder Initiators
|
|
1780
1536
|
|
|
1781
1537
|
The following static methods are available on the `QRCodeJs` class.
|
|
@@ -1902,57 +1658,6 @@ const qrBuildDirectly = QRCodeJs.useTemplate({
|
|
|
1902
1658
|
qrBuildDirectly.append(document.getElementById('qr-container-4'));
|
|
1903
1659
|
```
|
|
1904
1660
|
|
|
1905
|
-
## FAQ
|
|
1906
|
-
|
|
1907
|
-
### General Questions
|
|
1908
|
-
|
|
1909
|
-
#### Can I use SVG output?
|
|
1910
|
-
Yes, set `type: 'svg'` and use the `.svg` property.
|
|
1911
|
-
|
|
1912
|
-
#### Can I use QRCode.js for free without a license?
|
|
1913
|
-
|
|
1914
|
-
Yes, QRCode.js can be used for free without a license key. This allows you to create full-featured, styled QR codes with all the basic features including custom dot styles, colors, shapes, and image embedding. The only limitations are on advanced border features and scan validation.
|
|
1915
|
-
|
|
1916
|
-
#### Can I use border features in the free version?
|
|
1917
|
-
|
|
1918
|
-
Yes, you can use basic border features in the free version, but the library will automatically add "QR-Platform" branding text in the bottom border of your QR code. This branding cannot be removed or customized in the free version.
|
|
1919
|
-
|
|
1920
|
-
#### Does the QR-Platform branding affect the scannability of the QR code?
|
|
1921
|
-
|
|
1922
|
-
No, the QR-Platform branding only appears in the border area, which is outside the actual QR code area. It does not affect the scannability or functionality of the QR code itself. However, it does affect the visual appearance of your QR code.
|
|
1923
|
-
|
|
1924
|
-
### Do you provide support for licensed users?
|
|
1925
|
-
Yes, we do provide support for licensed users. If you have any questions or need assistance, please contact us at support@qr-platform.com.
|
|
1926
|
-
|
|
1927
|
-
### What is QR-Platform?
|
|
1928
|
-
QR-Platform is a powerful and comprehensive solution for managing and deploying QR codes, it enables businesses to effortlessly Create, Store, Manage, and Deploy Beautiful, Stylish, and Fully Customizable QR codes. QRCode.js library license is included free of charge with all paid QR-Platform plans, offering seamless integration and powerful customization capabilities for businesses of any size.
|
|
1929
|
-
|
|
1930
|
-
#### Can I modify or remove the QR-Platform branding in the free version?
|
|
1931
|
-
|
|
1932
|
-
No, the QR-Platform branding in the bottom border is automatically added when using border features in the free version and cannot be modified or removed. This is a limitation of the free version. Purchasing a license allows you to remove the branding and fully customize your border text.
|
|
1933
|
-
|
|
1934
|
-
#### Can I make the QR-Platform branding less noticeable without a license?
|
|
1935
|
-
|
|
1936
|
-
While you cannot remove the branding, you can somewhat reduce its visual impact by:
|
|
1937
|
-
- Using colors that create less contrast with the text
|
|
1938
|
-
- Using thinner borders
|
|
1939
|
-
- Using a small border radius to make the overall design less attention-grabbing
|
|
1940
|
-
|
|
1941
|
-
However, the branding will still be present, and these approaches might reduce the aesthetic appeal of your QR code.
|
|
1942
|
-
|
|
1943
|
-
#### What happens if I try to use premium border features without a license?
|
|
1944
|
-
|
|
1945
|
-
The library will not throw errors but will instead gracefully fall back to the free version behavior. It will ignore premium-only properties like `inner`, `borderOuter`, and `borderInner`, and will still display the QR-Platform branding in the bottom border.
|
|
1946
|
-
|
|
1947
|
-
#### Do I need to activate the license on every page load?
|
|
1948
|
-
|
|
1949
|
-
- **Browser**: No, license persists in `localStorage` until expiration
|
|
1950
|
-
- **Node.js**: Yes, unless token is managed externally
|
|
1951
|
-
|
|
1952
|
-
#### What happens if the license expires?
|
|
1953
|
-
|
|
1954
|
-
`getLicenseDetails()` returns `null`; you'll need to renew with `license()` or `token()`.
|
|
1955
|
-
|
|
1956
1661
|
## TypeScript Types
|
|
1957
1662
|
|
|
1958
1663
|
### Main Options Interface
|
|
@@ -2018,7 +1723,6 @@ interface Options {
|
|
|
2018
1723
|
};
|
|
2019
1724
|
};
|
|
2020
1725
|
|
|
2021
|
-
// Borders (Basic features in free version, advanced in premium)
|
|
2022
1726
|
borderOptions?: {
|
|
2023
1727
|
hasBorder: boolean; // Master switch to enable/disable borders
|
|
2024
1728
|
thickness: number; // Thickness of the main border in pixels
|
|
@@ -2636,3 +2340,9 @@ class QRDatabaseManager {
|
|
|
2636
2340
|
```
|
|
2637
2341
|
|
|
2638
2342
|
This comprehensive metadata management system enables enterprise-level QR code organization, tracking, and governance while maintaining flexibility for various use cases and integration requirements.
|
|
2343
|
+
|
|
2344
|
+
## License and Support
|
|
2345
|
+
|
|
2346
|
+
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.
|
|
2347
|
+
|
|
2348
|
+
See the full license at [LICENSE.md](https://github.com/qr-platform/qr-code.js/blob/main/LICENSE.md) for more information. For commercial licenses, including full source code and support, contact [qr.platform.com@gmail.com](mailto:qr.platform.com@gmail.com).
|
package/docs/examples.md
CHANGED
|
@@ -738,13 +738,9 @@ const qrBuiltWithBorderId = QRCodeJs.useBorderId('border-id-example') // Assumes
|
|
|
738
738
|
qrBuiltWithBorderId.append(document.getElementById('builder-border-id-container'));
|
|
739
739
|
```
|
|
740
740
|
|
|
741
|
-
**Example: Using Text in Borders with Override Option
|
|
741
|
+
**Example: Using Text in Borders with Override Option**
|
|
742
742
|
|
|
743
743
|
```javascript
|
|
744
|
-
// Ensure license is activated first for premium border features
|
|
745
|
-
// await QRCodeJs.license('YOUR-LICENSE-KEY');
|
|
746
|
-
|
|
747
|
-
// Setting text that will override any text specified in borderOptions
|
|
748
744
|
QRCodeJs.setText({
|
|
749
745
|
topValue: 'TOP PRIORITY TEXT',
|
|
750
746
|
bottomValue: 'BOTTOM PRIORITY TEXT'
|
|
@@ -794,8 +790,7 @@ qrBuilderWithTextOverride.append(document.getElementById('builder-text-override-
|
|
|
794
790
|
|
|
795
791
|
// Reset global text when done
|
|
796
792
|
QRCodeJs.setText(null);
|
|
797
|
-
|
|
798
|
-
*For custom border text and advanced features like inner/outer borders, a [Premium License](./license-management) is required.*
|
|
793
|
+
``
|
|
799
794
|
|
|
800
795
|
---
|
|
801
796
|
|
|
@@ -63,7 +63,7 @@ interface Options {
|
|
|
63
63
|
/** Options for the embedded image. */
|
|
64
64
|
imageOptions: ImageOptions;
|
|
65
65
|
|
|
66
|
-
/** Options for adding decorative borders
|
|
66
|
+
/** Options for adding decorative borders. */
|
|
67
67
|
borderOptions?: BorderOptions;
|
|
68
68
|
}
|
|
69
69
|
```
|
|
@@ -182,7 +182,7 @@ interface ImageOptions {
|
|
|
182
182
|
}
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
### BorderOptions
|
|
185
|
+
### BorderOptions
|
|
186
186
|
|
|
187
187
|
Options for adding decorative borders.
|
|
188
188
|
|
|
@@ -502,23 +502,6 @@ interface QRInstanceMetadata {
|
|
|
502
502
|
}
|
|
503
503
|
```
|
|
504
504
|
|
|
505
|
-
### ValidationResult
|
|
506
|
-
|
|
507
|
-
Interface for license validation results.
|
|
508
|
-
|
|
509
|
-
```typescript
|
|
510
|
-
interface ValidationResult {
|
|
511
|
-
/** Whether the license validation was successful. */
|
|
512
|
-
success: boolean;
|
|
513
|
-
|
|
514
|
-
/** Error message if validation failed. */
|
|
515
|
-
error?: string;
|
|
516
|
-
|
|
517
|
-
/** Additional validation details. */
|
|
518
|
-
details?: Record<string, any>;
|
|
519
|
-
}
|
|
520
|
-
```
|
|
521
|
-
|
|
522
505
|
### StyleOptions and TextOptions
|
|
523
506
|
|
|
524
507
|
Additional type definitions for style and text configurations.
|