@qr-platform/qr-code.js 0.10.7 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @qr-platform/qr-code-js
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Release a minor version with new features.
8
+
3
9
  ## 0.10.7
4
10
 
5
11
  ### Patch Changes
@@ -193,7 +199,7 @@
193
199
 
194
200
  ### Patch Changes
195
201
 
196
- - 20a46bc: Outter border qr offset added
202
+ - 20a46bc: Outer border qr offset added
197
203
 
198
204
  ## 0.7.2
199
205
 
@@ -265,7 +271,7 @@
265
271
 
266
272
  ### Patch Changes
267
273
 
268
- - 69696df: Outter and Inner decorative borders improvements
274
+ - 69696df: Outer and Inner decorative borders improvements
269
275
 
270
276
  ## 0.0.10
271
277
 
@@ -109,8 +109,20 @@ qrCode.append(document.getElementById('qr-container'));
109
109
  | `useImage` | `imageUrl: string \| DataURL, overrideOpts?: MethodOverrideOptions` | Initiates a builder pattern pre-configured with an image URL. If `overrideOpts.override` is `true`, this image will take precedence over any image set in the final `.options()` call or by other non-overriding builder methods. Returns `QRCodeBuilder`. |
110
110
  | `useData` | `data: string, overrideOpts?: MethodOverrideOptions` | Applies a data string to the current builder configuration. If `overrideOpts.override` is `true`, this data will take precedence over data provided in the final `.options()` call or by other non-overriding builder methods. Returns `QRCodeBuilder`. |
111
111
  | `useOptions` | `options: RecursivePartial<Options>, overrideOpts?: MethodOverrideOptions` | Applies a partial options object to the current builder configuration. If `overrideOpts.override` is `true`, these options take higher precedence over options provided in the final `.options()` call or by other non-overriding builder methods for the properties they cover. Returns `QRCodeBuilder`. |
112
- | `useSettings` | `settings: SettingsOptions` | Applies a comprehensive `SettingsOptions` object as a new baseline for the builder chain. This will **reset** any configurations previously applied to *that builder instance* via methods like `useTemplate()`, `useStyle()`, `useData()`, `useOptions()`, etc. Subsequent builder methods will modify this new baseline. Returns `QRCodeBuilder`. |
113
- | `validateScanning` | `validatorId?: string, debug?: boolean` | **(Premium method)** Validates that the QR code is scannable. Returns `Promise<ScanValidatorResponse>`. |
112
+ | `useSettings` | `settings: SettingsOptions` | Applies a comprehensive `SettingsOptions` object as a new baseline for the builder chain. This will **reset** any configurations previously applied to *that builder instance* via methods like `useTemplate()`, `useStyle()`, `useData()`, `useOptions()`, etc. Subsequent builder methods will modify this new baseline. Returns `QRCodeBuilder`. |
113
+ | `useId` | `id: string` | Assigns an identifier to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
114
+ | `useName` | `name: string` | Assigns a name to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
115
+ | `useDescription` | `description: string` | Assigns a description to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
116
+ | `useMetadata` | `metadata: Record<string, any>` | Attaches custom metadata to the QR code instance within the builder chain. Returns `QRCodeBuilder`. |
117
+ | `validateScanning` | `validatorId?: string, debug?: boolean` | **(Premium method)** Validates that the QR code is scannable. Returns `Promise<ScanValidatorResponse>`. |
118
+ | `getTemplates` | | Returns helper functions for looking up predefined templates, styles, text, and borders. |
119
+ | `initializeIfNeeded` | | Initializes the license manager if needed (usually called automatically by `.license()`). Returns `Promise<boolean>`. |
120
+ | `getLicenseDetails` | | Returns decoded license information if a license is active. |
121
+ | `license` | `licenseKey: string` | Activates a license using a license key. Returns `Promise<ValidationResult>`. |
122
+ | `token` | `token: string | null` | Activates a license using a pre-fetched token. Returns `Promise<ValidationResult>`. |
123
+ | `configureLicenseFetcher` | `fetcher: (licenseKey: string) => Promise<string>` | Sets a custom function for fetching license tokens. |
124
+ | `setLicenseUrl` | `url: string` | Sets the URL endpoint for license validation. Returns `typeof QRCodeJs`. |
125
+ | `validateImageData` | `imageData: ImageDataLike` | **(Node.js)** Validate scannability from raw image data. Returns `Promise<ScanValidatorResponse>`. |
114
126
 
115
127
  ---
116
128
 
@@ -1078,8 +1078,8 @@ When using the basic border features in the free version, the library will autom
1078
1078
  ### Initialization
1079
1079
 
1080
1080
  - **Purpose**: Sets up the license manager
1081
- - **Behavior**: Initializes automatically when you first attempt activation or check the status
1082
- - **Manual Method**: `QRCodeJs.initializeIfNeeded()`
1081
+ - **Behavior**: Initializes automatically when you call `.license()` (or otherwise attempt activation) or check the status
1082
+ - **Manual Method**: `QRCodeJs.initializeIfNeeded()` (rarely needed because `.license()` runs it automatically)
1083
1083
  - **Example**:
1084
1084
  ```typescript
1085
1085
  async function initializeOnLoad() {
@@ -1700,6 +1700,23 @@ qrCode.validateScanning(
1700
1700
  ): Promise<ScanValidatorResponse>
1701
1701
  ```
1702
1702
 
1703
+ #### Metadata Methods
1704
+
1705
+ These helper methods allow attaching or retrieving metadata on a QR code instance.
1706
+
1707
+ ```typescript
1708
+ qrCode.setId(id?: string): this
1709
+ qrCode.setName(name?: string): this
1710
+ qrCode.setDescription(description?: string): this
1711
+ qrCode.setMetadata(metadata?: Record<string, any>): this
1712
+
1713
+ qrCode.getId(): string | undefined
1714
+ qrCode.getName(): string | undefined
1715
+ qrCode.getDescription(): string | undefined
1716
+ qrCode.getMetadata(): Record<string, any> | undefined
1717
+ qrCode.getSettings(): SettingsOptions & { options: Options }
1718
+ ```
1719
+
1703
1720
  ### Static Methods
1704
1721
 
1705
1722
  These methods are called directly on the `QRCodeJs` class (e.g., `QRCodeJs.setTemplate()`).
@@ -1708,7 +1725,7 @@ These methods are called directly on the `QRCodeJs` class (e.g., `QRCodeJs.setTe
1708
1725
 
1709
1726
  #### `initializeIfNeeded()`
1710
1727
 
1711
- Initializes the license manager if needed.
1728
+ Initializes the license manager if needed. Typically this runs automatically when calling `.license()`, but you can call it manually in unusual scenarios.
1712
1729
 
1713
1730
  ```typescript
1714
1731
  QRCodeJs.initializeIfNeeded(): Promise<boolean>
@@ -44,8 +44,8 @@ When using the basic border features in the free version, the library will autom
44
44
  ### Initialization
45
45
 
46
46
  - **Purpose**: Sets up the license manager
47
- - **Behavior**: Initializes automatically when you first attempt activation or check the status
48
- - **Manual Method**: `QRCodeJs.initializeIfNeeded()`
47
+ - **Behavior**: Initializes automatically when you call `.license()` (or otherwise attempt activation) or check the status
48
+ - **Manual Method**: `QRCodeJs.initializeIfNeeded()` (rarely needed because `.license()` runs it automatically)
49
49
  - **Example**:
50
50
  ```typescript
51
51
  async function initializeOnLoad() {
@@ -413,7 +413,7 @@ async function activateWithTokenNode(token) {
413
413
 
414
414
  #### `initializeIfNeeded()`
415
415
 
416
- - **Purpose**: Initialize license manager if needed
416
+ - **Purpose**: Initialize the license manager if needed (normally handled automatically by `.license()`)
417
417
  - **Type**: `function(): Promise<boolean>`
418
418
  - **Returns**: Promise resolving to license status
419
419
 
@@ -600,15 +600,18 @@ const qrCode = QRCodeJs.useTemplate('dots') // Base: dots template (e.g.,
600
600
  qrCode.append(document.getElementById('builder-example-container'));
601
601
 
602
602
 
603
- ### Builder Pattern Methods (`useStyle`, `useBorder`, `useImage`, `useData`, `useOptions`, `useSettings`)
603
+ ### Builder Pattern Methods (`useTemplate`, `useStyle`, `useBorder`, `useImage`, `useData`, `useOptions`, `useSettings`)
604
604
 
605
- These methods are called on `QRCodeJs` to initiate a builder chain (e.g., `QRCodeJs.useStyle(...)`) or on an existing `QRCodeBuilder` instance (e.g., `builder.useStyle(...)`).
605
+ These methods are called on `QRCodeJs` to initiate a builder chain (e.g., `QRCodeJs.useTemplate(...)`) or on an existing `QRCodeBuilder` instance (e.g., `builder.useStyle(...)`).
606
606
 
607
+ - **`useTemplate(templateNameOrOptions)` / `useTemplateId(templateId)`**: Start the builder with a predefined template or template ID.
607
608
  - **`useStyle(styleNameOrOptions)` / `useStyleId(styleId)`**: Applies a style.
608
609
  - **`useBorder(borderNameOrOptions)` / `useBorderId(borderId)`**: Applies a border configuration.
610
+ - **`useText(textNameOrOptions, overrideOpts?)` / `useTextId(textId, overrideOpts?)`**: Sets border text with optional override precedence.
609
611
  - **`useImage(imageUrl, overrideOpts?)`**: Sets an image. `overrideOpts` ensures precedence over image in final `.options()`.
610
612
  - **`useData(data, overrideOpts?)`**: Sets the data. `overrideOpts` ensures precedence over data in final `.options()`.
611
613
  - **`useOptions(options, overrideOpts?)`**: Merges general options. `overrideOpts` ensures precedence for these specific options over final `.options()`.
614
+ - **`useId(id)`**, **`useName(name)`**, **`useDescription(description)`**, **`useMetadata(metadata)`**: Attach metadata to the QR code instance when the builder finalizes.
612
615
  - **`useSettings(settings)`**: Applies a comprehensive `SettingsOptions` object as a new baseline for the builder chain, **resetting** any configurations previously applied to *that builder instance* via other `use...` methods.
613
616
 
614
617
  You can chain these methods (e.g., `QRCodeJs.useTemplate(...).useStyle(...).useBorder(...).useImage(...)`) before finalizing with `.options(...)` or `.build()`. Options are merged progressively, with later calls overriding earlier ones for the same properties, unless an `override: true` was used.
@@ -79,7 +79,6 @@ export declare class QRCodeJs {
79
79
  * Sets the static style to be used as a base for new instances.
80
80
  * Accepts either a predefined style name or a StyleOptions object.
81
81
  * @param styleNameOrOptions - The name of the style or the StyleOptions object.
82
- * @param styleNameOrOptions - The name of the style or the StyleOptions object.
83
82
  * @returns The QRCodeJs class for chaining.
84
83
  */
85
84
  static setStyle(styleNameOrOptions: string | StyleOptions | null): typeof QRCodeJs;