@sincpro/printer-expo 1.0.2 → 1.0.4

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.
@@ -1,54 +1,26 @@
1
1
  plugins {
2
- id 'com.android.library'
3
- id 'org.jetbrains.kotlin.android'
2
+ id 'com.android.library'
3
+ id 'expo-module-gradle-plugin'
4
4
  }
5
5
 
6
6
  group = 'sincpro.expo.printer'
7
- version = '0.1.0'
7
+ version = '1.0.4'
8
8
 
9
9
  android {
10
10
  namespace "sincpro.expo.printer"
11
- compileSdk 35
12
-
13
11
  defaultConfig {
14
- minSdk 21
15
- targetSdk 35
16
12
  versionCode 1
17
- versionName "0.1.0"
18
- }
19
-
20
- compileOptions {
21
- sourceCompatibility JavaVersion.VERSION_17
22
- targetCompatibility JavaVersion.VERSION_17
23
- }
24
-
25
- kotlinOptions {
26
- jvmTarget = '17'
27
- }
28
-
29
- lintOptions {
30
- abortOnError false
13
+ versionName "1.0.4"
31
14
  }
32
15
  }
33
16
 
34
17
  dependencies {
35
- // Sincpro Printer SDK (incluye Bixolon JARs + jniLibs embebidos)
36
- implementation files('libs/sincpro-printer-sdk.aar')
37
-
38
- // Bixolon PDF support (AAR no puede embeber otro AAR)
39
- implementation files('libs/pdf/Bixolon_pdf.aar')
40
-
41
- // Expo modules (provided by host app)
42
- compileOnly 'expo.modules:core:3.0.29'
18
+ // AAR locales - mismo nivel como test app
19
+ implementation files("${projectDir}/libs/sincpro-printer-sdk.aar")
20
+ implementation files("${projectDir}/libs/Bixolon_pdf.aar")
43
21
 
22
+ // Dependencias Android
44
23
  implementation 'androidx.core:core-ktx:1.12.0'
45
24
  implementation 'androidx.appcompat:appcompat:1.6.1'
46
25
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
47
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
48
- }
49
- repositories {
50
- mavenCentral()
51
- }
52
- kotlin {
53
- jvmToolchain(17)
54
26
  }
@@ -4,10 +4,17 @@ import android.content.Context
4
4
  import com.sincpro.printer.SincproPrinterSdk
5
5
  import com.sincpro.printer.domain.Alignment
6
6
  import com.sincpro.printer.domain.BarcodeType
7
+ import com.sincpro.printer.domain.CutterConfig
8
+ import com.sincpro.printer.domain.Density
7
9
  import com.sincpro.printer.domain.FontSize
8
10
  import com.sincpro.printer.domain.MediaConfig
11
+ import com.sincpro.printer.domain.MediaType
12
+ import com.sincpro.printer.domain.Orientation
13
+ import com.sincpro.printer.domain.PrinterConfig
9
14
  import com.sincpro.printer.domain.Receipt
10
15
  import com.sincpro.printer.domain.ReceiptLine
16
+ import com.sincpro.printer.domain.Speed
17
+ import expo.modules.kotlin.functions.Coroutine
11
18
  import expo.modules.kotlin.modules.Module
12
19
  import expo.modules.kotlin.modules.ModuleDefinition
13
20
 
@@ -58,7 +65,7 @@ class PrinterModule : Module() {
58
65
  // CONNECTION API
59
66
  // ============================================================
60
67
 
61
- AsyncFunction("connectBluetooth") { address: String, timeoutMs: Double? ->
68
+ AsyncFunction("connectBluetooth") Coroutine { address: String, timeoutMs: Double? ->
62
69
  sdk.bixolon.connectivity
63
70
  .connectBluetooth(
64
71
  address = address,
@@ -66,7 +73,7 @@ class PrinterModule : Module() {
66
73
  ).getOrThrow()
67
74
  }
68
75
 
69
- AsyncFunction("connectWifi") { ip: String, port: Int?, timeoutMs: Double? ->
76
+ AsyncFunction("connectWifi") Coroutine { ip: String, port: Int?, timeoutMs: Double? ->
70
77
  sdk.bixolon.connectivity
71
78
  .connectWifi(
72
79
  ip = ip,
@@ -75,13 +82,13 @@ class PrinterModule : Module() {
75
82
  ).getOrThrow()
76
83
  }
77
84
 
78
- AsyncFunction("connectUsb") {
85
+ AsyncFunction("connectUsb") Coroutine {
79
86
  sdk.bixolon.connectivity
80
87
  .connectUsb()
81
88
  .getOrThrow()
82
89
  }
83
90
 
84
- AsyncFunction("disconnect") {
91
+ AsyncFunction("disconnect") Coroutine {
85
92
  sdk.bixolon.connectivity
86
93
  .disconnect()
87
94
  .getOrThrow()
@@ -91,7 +98,7 @@ class PrinterModule : Module() {
91
98
  sdk.bixolon.connectivity.isConnected()
92
99
  }
93
100
 
94
- AsyncFunction("getStatus") {
101
+ AsyncFunction("getStatus") Coroutine {
95
102
  val status =
96
103
  sdk.bixolon.connectivity
97
104
  .getStatus()
@@ -106,7 +113,7 @@ class PrinterModule : Module() {
106
113
  )
107
114
  }
108
115
 
109
- AsyncFunction("getInfo") {
116
+ AsyncFunction("getInfo") Coroutine {
110
117
  val info =
111
118
  sdk.bixolon.connectivity
112
119
  .getInfo()
@@ -114,7 +121,7 @@ class PrinterModule : Module() {
114
121
  mapOf(
115
122
  "model" to info.model,
116
123
  "firmware" to info.firmware,
117
- "serial" to info.serial,
124
+ "serial" to info.serialNumber,
118
125
  "dpi" to info.dpi,
119
126
  )
120
127
  }
@@ -123,11 +130,47 @@ class PrinterModule : Module() {
123
130
  sdk.bixolon.connectivity.getDpi()
124
131
  }
125
132
 
133
+ // ============================================================
134
+ // CONFIGURATION API
135
+ // ============================================================
136
+
137
+ /**
138
+ * Set and apply printer configuration
139
+ * - Sets as default for future connections
140
+ * - If connected, applies immediately to printer
141
+ */
142
+ AsyncFunction("setConfig") Coroutine { config: Map<String, Any?> ->
143
+ val printerConfig = parsePrinterConfig(config)
144
+ sdk.bixolon.connectivity.setDefaultConfig(printerConfig)
145
+ // Apply immediately if connected
146
+ if (sdk.bixolon.connectivity.isConnected()) {
147
+ sdk.bixolon.connectivity
148
+ .applyConfig(printerConfig)
149
+ .getOrThrow()
150
+ }
151
+ }
152
+
153
+ Function("getConfig") {
154
+ val config = sdk.bixolon.connectivity.getDefaultConfig()
155
+ mapOf(
156
+ "marginLeft" to config.marginLeft,
157
+ "marginTop" to config.marginTop,
158
+ "density" to config.density.name.lowercase(),
159
+ "speed" to config.speed.name.lowercase(),
160
+ "orientation" to config.orientation.name.lowercase(),
161
+ "autoCutter" to
162
+ mapOf(
163
+ "enabled" to config.autoCutter.enabled,
164
+ "fullCut" to config.autoCutter.fullCut,
165
+ ),
166
+ )
167
+ }
168
+
126
169
  // ============================================================
127
170
  // PRINT API - Text
128
171
  // ============================================================
129
172
 
130
- AsyncFunction("printText") { text: String, options: Map<String, Any?>? ->
173
+ AsyncFunction("printText") Coroutine { text: String, options: Map<String, Any?>? ->
131
174
  val fontSize = parseFontSize(options?.get("fontSize") as? String)
132
175
  val alignment = parseAlignment(options?.get("alignment") as? String)
133
176
  val bold = options?.get("bold") as? Boolean ?: false
@@ -138,7 +181,7 @@ class PrinterModule : Module() {
138
181
  .getOrThrow()
139
182
  }
140
183
 
141
- AsyncFunction("printTexts") { texts: List<String>, options: Map<String, Any?>? ->
184
+ AsyncFunction("printTexts") Coroutine { texts: List<String>, options: Map<String, Any?>? ->
142
185
  val fontSize = parseFontSize(options?.get("fontSize") as? String)
143
186
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
144
187
 
@@ -151,7 +194,7 @@ class PrinterModule : Module() {
151
194
  // PRINT API - QR & Barcode
152
195
  // ============================================================
153
196
 
154
- AsyncFunction("printQR") { data: String, options: Map<String, Any?>? ->
197
+ AsyncFunction("printQR") Coroutine { data: String, options: Map<String, Any?>? ->
155
198
  val size = (options?.get("size") as? Number)?.toInt() ?: 5
156
199
  val alignment = parseAlignment(options?.get("alignment") as? String)
157
200
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
@@ -161,7 +204,7 @@ class PrinterModule : Module() {
161
204
  .getOrThrow()
162
205
  }
163
206
 
164
- AsyncFunction("printBarcode") { data: String, options: Map<String, Any?>? ->
207
+ AsyncFunction("printBarcode") Coroutine { data: String, options: Map<String, Any?>? ->
165
208
  val type = parseBarcodeType(options?.get("type") as? String)
166
209
  val height = (options?.get("height") as? Number)?.toInt() ?: 60
167
210
  val alignment = parseAlignment(options?.get("alignment") as? String)
@@ -176,7 +219,7 @@ class PrinterModule : Module() {
176
219
  // PRINT API - Images & PDF
177
220
  // ============================================================
178
221
 
179
- AsyncFunction("printImageBase64") { base64Data: String, options: Map<String, Any?>? ->
222
+ AsyncFunction("printImageBase64") Coroutine { base64Data: String, options: Map<String, Any?>? ->
180
223
  val alignment = parseAlignment(options?.get("alignment") as? String)
181
224
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
182
225
 
@@ -185,7 +228,7 @@ class PrinterModule : Module() {
185
228
  .getOrThrow()
186
229
  }
187
230
 
188
- AsyncFunction("printPdfBase64") { base64Data: String, options: Map<String, Any?>? ->
231
+ AsyncFunction("printPdfBase64") Coroutine { base64Data: String, options: Map<String, Any?>? ->
189
232
  val page = (options?.get("page") as? Number)?.toInt() ?: 1
190
233
  val alignment = parseAlignment(options?.get("alignment") as? String)
191
234
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
@@ -203,7 +246,7 @@ class PrinterModule : Module() {
203
246
  // PRINT API - Receipt (High Level)
204
247
  // ============================================================
205
248
 
206
- AsyncFunction("printReceipt") { receiptData: Map<String, Any?>, options: Map<String, Any?>? ->
249
+ AsyncFunction("printReceipt") Coroutine { receiptData: Map<String, Any?>, options: Map<String, Any?>? ->
207
250
  val receipt = parseReceipt(receiptData)
208
251
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
209
252
  val copies = (options?.get("copies") as? Number)?.toInt() ?: 1
@@ -217,7 +260,7 @@ class PrinterModule : Module() {
217
260
  // PRINT API - Columns (Key-Value style)
218
261
  // ============================================================
219
262
 
220
- AsyncFunction("printKeyValue") { key: String, value: String, options: Map<String, Any?>? ->
263
+ AsyncFunction("printKeyValue") Coroutine { key: String, value: String, options: Map<String, Any?>? ->
221
264
  val fontSize = parseFontSize(options?.get("fontSize") as? String)
222
265
  val bold = options?.get("bold") as? Boolean ?: false
223
266
  val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
@@ -269,15 +312,84 @@ class PrinterModule : Module() {
269
312
  if (preset != null) {
270
313
  return when (preset) {
271
314
  "continuous58mm" -> MediaConfig.continuous58mm()
315
+ "continuous72mm" -> MediaConfig.continuous72mm()
272
316
  "continuous80mm" -> MediaConfig.continuous80mm()
273
317
  else -> MediaConfig.continuous80mm()
274
318
  }
275
319
  }
276
320
 
321
+ // Custom width in mm (converts to dots automatically)
322
+ val widthMm = (data["widthMm"] as? Number)?.toInt()
323
+ if (widthMm != null) {
324
+ val heightMm = (data["heightMm"] as? Number)?.toInt() ?: 0
325
+ val type = parseMediaType(data["type"] as? String)
326
+ val gapMm = (data["gapMm"] as? Number)?.toInt() ?: 0
327
+
328
+ return when (type) {
329
+ MediaType.CONTINUOUS -> MediaConfig.continuous(widthMm)
330
+ MediaType.GAP -> MediaConfig.label(widthMm, heightMm, gapMm)
331
+ MediaType.BLACK_MARK -> MediaConfig.blackMark(widthMm, heightMm, gapMm)
332
+ }
333
+ }
334
+
335
+ // Direct dots configuration
277
336
  val widthDots = (data["widthDots"] as? Number)?.toInt() ?: 640
278
337
  val heightDots = (data["heightDots"] as? Number)?.toInt() ?: 0
338
+ val type = parseMediaType(data["type"] as? String)
339
+ val gapDots = (data["gapDots"] as? Number)?.toInt() ?: 0
340
+
341
+ return MediaConfig(widthDots, heightDots, type, gapDots)
342
+ }
343
+
344
+ private fun parseMediaType(value: String?): MediaType =
345
+ when (value?.lowercase()) {
346
+ "continuous" -> MediaType.CONTINUOUS
347
+ "gap", "label" -> MediaType.GAP
348
+ "black_mark", "blackmark" -> MediaType.BLACK_MARK
349
+ else -> MediaType.CONTINUOUS
350
+ }
351
+
352
+ private fun parsePrinterConfig(data: Map<String, Any?>): PrinterConfig {
353
+ val marginLeft = (data["marginLeft"] as? Number)?.toInt() ?: 0
354
+ val marginTop = (data["marginTop"] as? Number)?.toInt() ?: 0
355
+ val density = parseDensity(data["density"] as? String)
356
+ val speed = parseSpeed(data["speed"] as? String)
357
+ val orientation = parseOrientation(data["orientation"] as? String)
358
+ val autoCutter = parseCutterConfig(data["autoCutter"] as? Map<String, Any?>)
359
+
360
+ return PrinterConfig(marginLeft, marginTop, density, speed, orientation, autoCutter)
361
+ }
362
+
363
+ private fun parseDensity(value: String?): Density =
364
+ when (value?.lowercase()) {
365
+ "light" -> Density.LIGHT
366
+ "medium" -> Density.MEDIUM
367
+ "dark" -> Density.DARK
368
+ "extra_dark", "extradark" -> Density.EXTRA_DARK
369
+ else -> Density.MEDIUM
370
+ }
371
+
372
+ private fun parseSpeed(value: String?): Speed =
373
+ when (value?.lowercase()) {
374
+ "slow" -> Speed.SLOW
375
+ "medium" -> Speed.MEDIUM
376
+ "fast" -> Speed.FAST
377
+ "extra_fast", "extrafast" -> Speed.EXTRA_FAST
378
+ else -> Speed.MEDIUM
379
+ }
380
+
381
+ private fun parseOrientation(value: String?): Orientation =
382
+ when (value?.lowercase()) {
383
+ "top_to_bottom", "toptobottom" -> Orientation.TOP_TO_BOTTOM
384
+ "bottom_to_top", "bottomtotop" -> Orientation.BOTTOM_TO_TOP
385
+ else -> Orientation.TOP_TO_BOTTOM
386
+ }
279
387
 
280
- return MediaConfig(widthDots, heightDots)
388
+ private fun parseCutterConfig(data: Map<String, Any?>?): CutterConfig {
389
+ if (data == null) return CutterConfig.DISABLED
390
+ val enabled = data["enabled"] as? Boolean ?: false
391
+ val fullCut = data["fullCut"] as? Boolean ?: true
392
+ return CutterConfig(enabled, fullCut)
281
393
  }
282
394
 
283
395
  private fun parseReceipt(data: Map<String, Any?>): Receipt {
@@ -1,4 +1,4 @@
1
- import type { BluetoothDevice, PairedPrinter, PrinterStatus, PrinterInfo, PrintTextOptions, PrintTextsOptions, PrintQROptions, PrintBarcodeOptions, PrintImageOptions, PrintPdfOptions, PrintKeyValueOptions, PrintReceiptOptions, Receipt } from './types';
1
+ import type { BluetoothDevice, PairedPrinter, PrinterStatus, PrinterInfo, PrinterConfig, PrintTextOptions, PrintTextsOptions, PrintQROptions, PrintBarcodeOptions, PrintImageOptions, PrintPdfOptions, PrintKeyValueOptions, PrintReceiptOptions, Receipt } from './types';
2
2
  /**
3
3
  * Bluetooth API for device discovery
4
4
  */
@@ -54,6 +54,30 @@ export declare const connection: {
54
54
  */
55
55
  getDpi: () => number;
56
56
  };
57
+ /**
58
+ * Configuration API for printer settings
59
+ */
60
+ export declare const config: {
61
+ /**
62
+ * Set printer configuration (margins, density, speed, cutter)
63
+ * This sets the default config and applies it immediately if connected
64
+ * @example
65
+ * ```ts
66
+ * await config.set({
67
+ * marginLeft: 10,
68
+ * marginTop: 5,
69
+ * density: 'dark',
70
+ * speed: 'fast',
71
+ * autoCutter: { enabled: true, fullCut: true }
72
+ * });
73
+ * ```
74
+ */
75
+ set: (printerConfig: PrinterConfig) => Promise<void>;
76
+ /**
77
+ * Get current printer configuration
78
+ */
79
+ get: () => PrinterConfig;
80
+ };
57
81
  /**
58
82
  * Print API for all printing operations
59
83
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SincproPrinter.d.ts","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,OAAO,EACR,MAAM,SAAS,CAAC;AA8CjB;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;4BACmB,eAAe,EAAE;IAEvC;;OAEG;6BACoB,aAAa,EAAE;CACvC,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;;;OAIG;gCACyB,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAGtE;;;;;OAKG;sBACe,MAAM,SAAS,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;IAG3E;;OAEG;sBACa,OAAO,CAAC,IAAI,CAAC;IAE7B;;OAEG;sBACa,OAAO,CAAC,IAAI,CAAC;IAE7B;;OAEG;uBACc,OAAO;IAExB;;OAEG;qBACY,OAAO,CAAC,aAAa,CAAC;IAErC;;OAE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MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;QAGtE;;;;;WAKG;0BACe,MAAM,SAAS,MAAM,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;QAG3E;;WAEG;0BACa,OAAO,CAAC,IAAI,CAAC;QAE7B;;WAEG;0BACa,OAAO,CAAC,IAAI,CAAC;QAE7B;;WAEG;2BACc,OAAO;QAExB;;WAEG;yBACY,OAAO,CAAC,aAAa,CAAC;QAErC;;WAEG;uBACU,OAAO,CAAC,WAAW,CAAC;QAEjC;;WAEG;sBACS,MAAM;;;QAyClB;;WAEG;qBACU,MAAM,YAAY,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;QAG/D;;WAEG;uBACY,MAAM,EAAE,YAAY,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGpE;;WAEG;mBACQ,MAAM,YAAY,cAAc,KAAG,OAAO,CAAC,IAAI,CAAC;QAG3D;;WAEG;wBACa,MAAM,YAAY,mBAAmB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGrE;;WAEG;kCACuB,MAAM,YAAY,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAAC;QAG7E;;WAEG;gCACqB,MAAM,YAAY,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;QAGzE;;WAEG;sCAC2B,MAAM,KAAG,MAAM;QAE7C;;WAEG;2BACgB,OAAO,YAAY,mBAAmB,KAAG,OAAO,CAAC,IAAI,CAAC;QAGzE;;WAEG;wBACa,MAAM,SAAS,MAAM,YAAY,oBAAoB,KAAG,OAAO,CAAC,IAAI,CAAC;;CAetF,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -62,6 +62,33 @@ export const connection = {
62
62
  getDpi: () => NativeModule.getDpi(),
63
63
  };
64
64
  // ============================================================
65
+ // CONFIGURATION API
66
+ // ============================================================
67
+ /**
68
+ * Configuration API for printer settings
69
+ */
70
+ export const config = {
71
+ /**
72
+ * Set printer configuration (margins, density, speed, cutter)
73
+ * This sets the default config and applies it immediately if connected
74
+ * @example
75
+ * ```ts
76
+ * await config.set({
77
+ * marginLeft: 10,
78
+ * marginTop: 5,
79
+ * density: 'dark',
80
+ * speed: 'fast',
81
+ * autoCutter: { enabled: true, fullCut: true }
82
+ * });
83
+ * ```
84
+ */
85
+ set: (printerConfig) => NativeModule.setConfig(printerConfig),
86
+ /**
87
+ * Get current printer configuration
88
+ */
89
+ get: () => NativeModule.getConfig(),
90
+ };
91
+ // ============================================================
65
92
  // PRINT API
66
93
  // ============================================================
67
94
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SincproPrinter.js","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAuDxD,MAAM,YAAY,GAAG,mBAAmB,CAA6B,gBAAgB,CAAC,CAAC;AAEvF,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,gBAAgB,EAAE,GAAsB,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE;IAE1E;;OAEG;IACH,iBAAiB,EAAE,GAAoB,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE;CAC3E,CAAC;AAEF,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,OAAe,EAAE,SAAkB,EAAiB,EAAE,CACvE,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC;IAEnD;;;;;OAKG;IACH,WAAW,EAAE,CAAC,EAAU,EAAE,IAAa,EAAE,SAAkB,EAAiB,EAAE,CAC5E,YAAY,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;IAE/C;;OAEG;IACH,UAAU,EAAE,GAAkB,EAAE,CAA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,EAAE,OAAO,CAAC;IAElD;;OAEG;IACH,eAAe,EAAE,CAAC,UAAkB,EAAU,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,UAAU,CAAC;IAEzF;;OAEG;IACH,OAAO,EAAE,CAAC,OAAgB,EAAE,OAA6B,EAAiB,EAAE,CAC1E,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,OAA8B,EAAiB,EAAE,CACtF,YAAY,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC;CAClD,CAAC;AAEF,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,SAAS;IACT,UAAU;IACV,KAAK;CACN,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport type {\n BluetoothDevice,\n PairedPrinter,\n PrinterStatus,\n PrinterInfo,\n PrintTextOptions,\n PrintTextsOptions,\n PrintQROptions,\n PrintBarcodeOptions,\n PrintImageOptions,\n PrintPdfOptions,\n PrintKeyValueOptions,\n PrintReceiptOptions,\n Receipt,\n} from './types';\n\n/**\n * Native module interface matching PrinterModule.kt\n */\ninterface SincproPrinterNativeModule {\n // Bluetooth\n getPairedDevices(): BluetoothDevice[];\n getPairedPrinters(): PairedPrinter[];\n\n // Connection\n connectBluetooth(address: string, timeoutMs?: number): Promise<void>;\n connectWifi(ip: string, port?: number, timeoutMs?: number): Promise<void>;\n connectUsb(): Promise<void>;\n disconnect(): Promise<void>;\n isConnected(): boolean;\n getStatus(): Promise<PrinterStatus>;\n getInfo(): Promise<PrinterInfo>;\n getDpi(): number;\n\n // Print - Text\n printText(text: string, options?: PrintTextOptions): Promise<void>;\n printTexts(texts: string[], options?: PrintTextsOptions): Promise<void>;\n\n // Print - QR & Barcode\n printQR(data: string, options?: PrintQROptions): Promise<void>;\n printBarcode(data: string, options?: PrintBarcodeOptions): Promise<void>;\n\n // Print - Images & PDF\n printImageBase64(base64Data: string, options?: PrintImageOptions): Promise<void>;\n printPdfBase64(base64Data: string, options?: PrintPdfOptions): Promise<void>;\n getPdfPageCount(base64Data: string): number;\n\n // Print - Receipt\n printReceipt(receipt: Receipt, options?: PrintReceiptOptions): Promise<void>;\n\n // Print - Key-Value\n printKeyValue(key: string, value: string, options?: PrintKeyValueOptions): Promise<void>;\n}\n\nconst NativeModule = requireNativeModule<SincproPrinterNativeModule>('SincproPrinter');\n\n// ============================================================\n// BLUETOOTH API\n// ============================================================\n\n/**\n * Bluetooth API for device discovery\n */\nexport const bluetooth = {\n /**\n * Get all paired/bonded Bluetooth devices\n */\n getPairedDevices: (): BluetoothDevice[] => NativeModule.getPairedDevices(),\n\n /**\n * Get paired devices that are printers\n */\n getPairedPrinters: (): PairedPrinter[] => NativeModule.getPairedPrinters(),\n};\n\n// ============================================================\n// CONNECTION API\n// ============================================================\n\n/**\n * Connection API for printer connectivity\n */\nexport const connection = {\n /**\n * Connect to printer via Bluetooth\n * @param address MAC address (e.g., \"00:11:22:33:44:55\")\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectBluetooth: (address: string, timeoutMs?: number): Promise<void> =>\n NativeModule.connectBluetooth(address, timeoutMs),\n\n /**\n * Connect to printer via WiFi\n * @param ip IP address (e.g., \"192.168.1.100\")\n * @param port TCP port (default: 9100)\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectWifi: (ip: string, port?: number, timeoutMs?: number): Promise<void> =>\n NativeModule.connectWifi(ip, port, timeoutMs),\n\n /**\n * Connect to printer via USB\n */\n connectUsb: (): Promise<void> => NativeModule.connectUsb(),\n\n /**\n * Disconnect from current printer\n */\n disconnect: (): Promise<void> => NativeModule.disconnect(),\n\n /**\n * Check if currently connected\n */\n isConnected: (): boolean => NativeModule.isConnected(),\n\n /**\n * Get printer status (paper, cover, errors)\n */\n getStatus: (): Promise<PrinterStatus> => NativeModule.getStatus(),\n\n /**\n * Get printer info (model, firmware, serial)\n */\n getInfo: (): Promise<PrinterInfo> => NativeModule.getInfo(),\n\n /**\n * Get printer DPI\n */\n getDpi: (): number => NativeModule.getDpi(),\n};\n\n// ============================================================\n// PRINT API\n// ============================================================\n\n/**\n * Print API for all printing operations\n */\nexport const print = {\n /**\n * Print a single line of text\n */\n text: (text: string, options?: PrintTextOptions): Promise<void> =>\n NativeModule.printText(text, options),\n\n /**\n * Print multiple lines of text\n */\n texts: (texts: string[], options?: PrintTextsOptions): Promise<void> =>\n NativeModule.printTexts(texts, options),\n\n /**\n * Print a QR code\n */\n qr: (data: string, options?: PrintQROptions): Promise<void> =>\n NativeModule.printQR(data, options),\n\n /**\n * Print a barcode\n */\n barcode: (data: string, options?: PrintBarcodeOptions): Promise<void> =>\n NativeModule.printBarcode(data, options),\n\n /**\n * Print an image from base64\n */\n imageBase64: (base64Data: string, options?: PrintImageOptions): Promise<void> =>\n NativeModule.printImageBase64(base64Data, options),\n\n /**\n * Print a PDF page from base64\n */\n pdfBase64: (base64Data: string, options?: PrintPdfOptions): Promise<void> =>\n NativeModule.printPdfBase64(base64Data, options),\n\n /**\n * Get page count from a PDF (base64)\n */\n getPdfPageCount: (base64Data: string): number => NativeModule.getPdfPageCount(base64Data),\n\n /**\n * Print a complete receipt with header, body, footer\n */\n receipt: (receipt: Receipt, options?: PrintReceiptOptions): Promise<void> =>\n NativeModule.printReceipt(receipt, options),\n\n /**\n * Print a key-value pair (two columns)\n */\n keyValue: (key: string, value: string, options?: PrintKeyValueOptions): Promise<void> =>\n NativeModule.printKeyValue(key, value, options),\n};\n\n// ============================================================\n// DEFAULT EXPORT\n// ============================================================\n\n/**\n * Sincpro Printer SDK for Expo\n */\nconst SincproPrinter = {\n bluetooth,\n connection,\n print,\n};\n\nexport default SincproPrinter;\n"]}
1
+ {"version":3,"file":"SincproPrinter.js","sourceRoot":"","sources":["../src/SincproPrinter.ts"],"names":[],"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EG;IACH,OAAO,EAAE,CAAC,OAAgB,EAAE,OAA6B,EAAiB,EAAE,CAC1E,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;IAE7C;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAW,EAAE,KAAa,EAAE,OAA8B,EAAiB,EAAE,CACtF,YAAY,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC;CAClD,CAAC;AAEF,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,SAAS;IACT,UAAU;IACV,KAAK;CACN,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\nimport type {\n BluetoothDevice,\n PairedPrinter,\n PrinterStatus,\n PrinterInfo,\n PrinterConfig,\n PrintTextOptions,\n PrintTextsOptions,\n PrintQROptions,\n PrintBarcodeOptions,\n PrintImageOptions,\n PrintPdfOptions,\n PrintKeyValueOptions,\n PrintReceiptOptions,\n Receipt,\n} from './types';\n\n/**\n * Native module interface matching PrinterModule.kt\n */\ninterface SincproPrinterNativeModule {\n // Bluetooth\n getPairedDevices(): BluetoothDevice[];\n getPairedPrinters(): PairedPrinter[];\n\n // Connection\n connectBluetooth(address: string, timeoutMs?: number): Promise<void>;\n connectWifi(ip: string, port?: number, timeoutMs?: number): Promise<void>;\n connectUsb(): Promise<void>;\n disconnect(): Promise<void>;\n isConnected(): boolean;\n getStatus(): Promise<PrinterStatus>;\n getInfo(): Promise<PrinterInfo>;\n getDpi(): number;\n\n // Configuration\n setConfig(config: PrinterConfig): Promise<void>;\n getConfig(): PrinterConfig;\n\n // Print - Text\n printText(text: string, options?: PrintTextOptions): Promise<void>;\n printTexts(texts: string[], options?: PrintTextsOptions): Promise<void>;\n\n // Print - QR & Barcode\n printQR(data: string, options?: PrintQROptions): Promise<void>;\n printBarcode(data: string, options?: PrintBarcodeOptions): Promise<void>;\n\n // Print - Images & PDF\n printImageBase64(base64Data: string, options?: PrintImageOptions): Promise<void>;\n printPdfBase64(base64Data: string, options?: PrintPdfOptions): Promise<void>;\n getPdfPageCount(base64Data: string): number;\n\n // Print - Receipt\n printReceipt(receipt: Receipt, options?: PrintReceiptOptions): Promise<void>;\n\n // Print - Key-Value\n printKeyValue(key: string, value: string, options?: PrintKeyValueOptions): Promise<void>;\n}\n\nconst NativeModule = requireNativeModule<SincproPrinterNativeModule>('SincproPrinter');\n\n// ============================================================\n// BLUETOOTH API\n// ============================================================\n\n/**\n * Bluetooth API for device discovery\n */\nexport const bluetooth = {\n /**\n * Get all paired/bonded Bluetooth devices\n */\n getPairedDevices: (): BluetoothDevice[] => NativeModule.getPairedDevices(),\n\n /**\n * Get paired devices that are printers\n */\n getPairedPrinters: (): PairedPrinter[] => NativeModule.getPairedPrinters(),\n};\n\n// ============================================================\n// CONNECTION API\n// ============================================================\n\n/**\n * Connection API for printer connectivity\n */\nexport const connection = {\n /**\n * Connect to printer via Bluetooth\n * @param address MAC address (e.g., \"00:11:22:33:44:55\")\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectBluetooth: (address: string, timeoutMs?: number): Promise<void> =>\n NativeModule.connectBluetooth(address, timeoutMs),\n\n /**\n * Connect to printer via WiFi\n * @param ip IP address (e.g., \"192.168.1.100\")\n * @param port TCP port (default: 9100)\n * @param timeoutMs Connection timeout in milliseconds (default: 10000)\n */\n connectWifi: (ip: string, port?: number, timeoutMs?: number): Promise<void> =>\n NativeModule.connectWifi(ip, port, timeoutMs),\n\n /**\n * Connect to printer via USB\n */\n connectUsb: (): Promise<void> => NativeModule.connectUsb(),\n\n /**\n * Disconnect from current printer\n */\n disconnect: (): Promise<void> => NativeModule.disconnect(),\n\n /**\n * Check if currently connected\n */\n isConnected: (): boolean => NativeModule.isConnected(),\n\n /**\n * Get printer status (paper, cover, errors)\n */\n getStatus: (): Promise<PrinterStatus> => NativeModule.getStatus(),\n\n /**\n * Get printer info (model, firmware, serial)\n */\n getInfo: (): Promise<PrinterInfo> => NativeModule.getInfo(),\n\n /**\n * Get printer DPI\n */\n getDpi: (): number => NativeModule.getDpi(),\n};\n\n// ============================================================\n// CONFIGURATION API\n// ============================================================\n\n/**\n * Configuration API for printer settings\n */\nexport const config = {\n /**\n * Set printer configuration (margins, density, speed, cutter)\n * This sets the default config and applies it immediately if connected\n * @example\n * ```ts\n * await config.set({\n * marginLeft: 10,\n * marginTop: 5,\n * density: 'dark',\n * speed: 'fast',\n * autoCutter: { enabled: true, fullCut: true }\n * });\n * ```\n */\n set: (printerConfig: PrinterConfig): Promise<void> => NativeModule.setConfig(printerConfig),\n\n /**\n * Get current printer configuration\n */\n get: (): PrinterConfig => NativeModule.getConfig(),\n};\n\n// ============================================================\n// PRINT API\n// ============================================================\n\n/**\n * Print API for all printing operations\n */\nexport const print = {\n /**\n * Print a single line of text\n */\n text: (text: string, options?: PrintTextOptions): Promise<void> =>\n NativeModule.printText(text, options),\n\n /**\n * Print multiple lines of text\n */\n texts: (texts: string[], options?: PrintTextsOptions): Promise<void> =>\n NativeModule.printTexts(texts, options),\n\n /**\n * Print a QR code\n */\n qr: (data: string, options?: PrintQROptions): Promise<void> =>\n NativeModule.printQR(data, options),\n\n /**\n * Print a barcode\n */\n barcode: (data: string, options?: PrintBarcodeOptions): Promise<void> =>\n NativeModule.printBarcode(data, options),\n\n /**\n * Print an image from base64\n */\n imageBase64: (base64Data: string, options?: PrintImageOptions): Promise<void> =>\n NativeModule.printImageBase64(base64Data, options),\n\n /**\n * Print a PDF page from base64\n */\n pdfBase64: (base64Data: string, options?: PrintPdfOptions): Promise<void> =>\n NativeModule.printPdfBase64(base64Data, options),\n\n /**\n * Get page count from a PDF (base64)\n */\n getPdfPageCount: (base64Data: string): number => NativeModule.getPdfPageCount(base64Data),\n\n /**\n * Print a complete receipt with header, body, footer\n */\n receipt: (receipt: Receipt, options?: PrintReceiptOptions): Promise<void> =>\n NativeModule.printReceipt(receipt, options),\n\n /**\n * Print a key-value pair (two columns)\n */\n keyValue: (key: string, value: string, options?: PrintKeyValueOptions): Promise<void> =>\n NativeModule.printKeyValue(key, value, options),\n};\n\n// ============================================================\n// DEFAULT EXPORT\n// ============================================================\n\n/**\n * Sincpro Printer SDK for Expo\n */\nconst SincproPrinter = {\n bluetooth,\n connection,\n print,\n};\n\nexport default SincproPrinter;\n"]}
package/build/index.d.ts CHANGED
@@ -7,6 +7,6 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  export { default } from './SincproPrinter';
10
- export { bluetooth, connection, print } from './SincproPrinter';
10
+ export { bluetooth, connection, config, print } from './SincproPrinter';
11
11
  export * from './types';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGhE,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGxE,cAAc,SAAS,CAAC"}
package/build/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
  // Main module export
10
10
  export { default } from './SincproPrinter';
11
- export { bluetooth, connection, print } from './SincproPrinter';
11
+ export { bluetooth, connection, config, print } from './SincproPrinter';
12
12
  // Type exports
13
13
  export * from './types';
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEhE,eAAe;AACf,cAAc,SAAS,CAAC","sourcesContent":["/**\n * @sincpro/printer-expo\n *\n * Expo module for Bluetooth/WiFi/USB thermal printers.\n * Supports Bixolon label printers.\n *\n * @packageDocumentation\n */\n\n// Main module export\nexport { default } from './SincproPrinter';\nexport { bluetooth, connection, print } from './SincproPrinter';\n\n// Type exports\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAqB;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAExE,eAAe;AACf,cAAc,SAAS,CAAC","sourcesContent":["/**\n * @sincpro/printer-expo\n *\n * Expo module for Bluetooth/WiFi/USB thermal printers.\n * Supports Bixolon label printers.\n *\n * @packageDocumentation\n */\n\n// Main module export\nexport { default } from './SincproPrinter';\nexport { bluetooth, connection, config, print } from './SincproPrinter';\n\n// Type exports\nexport * from './types';\n"]}
@@ -29,17 +29,69 @@ export interface PrinterInfo {
29
29
  * Media configuration
30
30
  */
31
31
  export interface MediaConfig {
32
- /** Use preset instead of manual widthDots/heightDots */
32
+ /** Use preset instead of manual configuration */
33
33
  preset?: MediaPreset;
34
- /** Width in dots (ignored if preset is set) */
34
+ /** Custom width in millimeters (auto-converts to dots) */
35
+ widthMm?: number;
36
+ /** Custom height in millimeters (for labels) */
37
+ heightMm?: number;
38
+ /** Gap/mark size in millimeters */
39
+ gapMm?: number;
40
+ /** Width in dots (use widthMm for easier configuration) */
35
41
  widthDots?: number;
36
- /** Height in dots (ignored if preset is set) */
42
+ /** Height in dots (use heightMm for easier configuration) */
37
43
  heightDots?: number;
44
+ /** Gap in dots */
45
+ gapDots?: number;
46
+ /** Media type */
47
+ type?: MediaType;
38
48
  }
39
49
  /**
40
50
  * Media presets
41
51
  */
42
- export type MediaPreset = 'continuous58mm' | 'continuous80mm';
52
+ export type MediaPreset = 'continuous58mm' | 'continuous72mm' | 'continuous80mm';
53
+ /**
54
+ * Media type for labels and continuous paper
55
+ */
56
+ export type MediaType = 'continuous' | 'gap' | 'label' | 'black_mark';
57
+ /**
58
+ * Printer configuration (global settings)
59
+ */
60
+ export interface PrinterConfig {
61
+ /** Left margin in dots */
62
+ marginLeft?: number;
63
+ /** Top margin in dots */
64
+ marginTop?: number;
65
+ /** Print density */
66
+ density?: PrintDensity;
67
+ /** Print speed */
68
+ speed?: PrintSpeed;
69
+ /** Print orientation */
70
+ orientation?: PrintOrientation;
71
+ /** Auto cutter configuration */
72
+ autoCutter?: CutterConfig;
73
+ }
74
+ /**
75
+ * Print density levels
76
+ */
77
+ export type PrintDensity = 'light' | 'medium' | 'dark' | 'extra_dark';
78
+ /**
79
+ * Print speed levels
80
+ */
81
+ export type PrintSpeed = 'slow' | 'medium' | 'fast' | 'extra_fast';
82
+ /**
83
+ * Print orientation
84
+ */
85
+ export type PrintOrientation = 'top_to_bottom' | 'bottom_to_top';
86
+ /**
87
+ * Auto cutter configuration
88
+ */
89
+ export interface CutterConfig {
90
+ /** Enable auto cutter */
91
+ enabled: boolean;
92
+ /** Full cut (true) or partial cut (false) */
93
+ fullCut?: boolean;
94
+ }
43
95
  /**
44
96
  * Font size options
45
97
  */
@@ -1 +1 @@
1
- {"version":3,"file":"printer.types.d.ts","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EA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AED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"printer.types.d.ts","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,eAA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AAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"printer.types.js","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Printer types for @sincpro/printer-expo\n */\n\n/**\n * Printer status from getStatus()\n */\nexport interface PrinterStatus {\n connectionState: ConnectionState;\n hasPaper: boolean;\n isCoverOpen: boolean;\n isOverheated: boolean;\n hasError: boolean;\n errorMessage: string | null;\n}\n\n/**\n * Connection state\n */\nexport type ConnectionState = 'DISCONNECTED' | 'CONNECTING' | 'CONNECTED' | 'ERROR';\n\n/**\n * Printer info from getInfo()\n */\nexport interface PrinterInfo {\n model: string;\n firmware: string;\n serial: string;\n dpi: number;\n}\n\n/**\n * Media configuration\n */\nexport interface MediaConfig {\n /** Use preset instead of manual widthDots/heightDots */\n preset?: MediaPreset;\n /** Width in dots (ignored if preset is set) */\n widthDots?: number;\n /** Height in dots (ignored if preset is set) */\n heightDots?: number;\n}\n\n/**\n * Media presets\n */\nexport type MediaPreset = 'continuous58mm' | 'continuous80mm';\n\n/**\n * Font size options\n */\nexport type FontSize = 'small' | 'medium' | 'large' | 'xlarge';\n\n/**\n * Alignment options\n */\nexport type Alignment = 'left' | 'center' | 'right';\n\n/**\n * Barcode types\n */\nexport type BarcodeType =\n | 'CODE128'\n | 'CODE39'\n | 'EAN13'\n | 'EAN8'\n | 'UPCA'\n | 'UPCE'\n | 'CODE93'\n | 'CODABAR';\n\n/**\n * Print text options\n */\nexport interface PrintTextOptions {\n fontSize?: FontSize;\n alignment?: Alignment;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print texts options (multiple lines)\n */\nexport interface PrintTextsOptions {\n fontSize?: FontSize;\n media?: MediaConfig;\n}\n\n/**\n * Print QR options\n */\nexport interface PrintQROptions {\n size?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print barcode options\n */\nexport interface PrintBarcodeOptions {\n type?: BarcodeType;\n height?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print image options\n */\nexport interface PrintImageOptions {\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print PDF options\n */\nexport interface PrintPdfOptions {\n page?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print key-value options\n */\nexport interface PrintKeyValueOptions {\n fontSize?: FontSize;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print receipt options\n */\nexport interface PrintReceiptOptions {\n media?: MediaConfig;\n copies?: number;\n}\n"]}
1
+ {"version":3,"file":"printer.types.js","sourceRoot":"","sources":["../../src/types/printer.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Printer types for @sincpro/printer-expo\n */\n\n/**\n * Printer status from getStatus()\n */\nexport interface PrinterStatus {\n connectionState: ConnectionState;\n hasPaper: boolean;\n isCoverOpen: boolean;\n isOverheated: boolean;\n hasError: boolean;\n errorMessage: string | null;\n}\n\n/**\n * Connection state\n */\nexport type ConnectionState = 'DISCONNECTED' | 'CONNECTING' | 'CONNECTED' | 'ERROR';\n\n/**\n * Printer info from getInfo()\n */\nexport interface PrinterInfo {\n model: string;\n firmware: string;\n serial: string;\n dpi: number;\n}\n\n/**\n * Media configuration\n */\nexport interface MediaConfig {\n /** Use preset instead of manual configuration */\n preset?: MediaPreset;\n \n /** Custom width in millimeters (auto-converts to dots) */\n widthMm?: number;\n /** Custom height in millimeters (for labels) */\n heightMm?: number;\n /** Gap/mark size in millimeters */\n gapMm?: number;\n \n /** Width in dots (use widthMm for easier configuration) */\n widthDots?: number;\n /** Height in dots (use heightMm for easier configuration) */\n heightDots?: number;\n /** Gap in dots */\n gapDots?: number;\n \n /** Media type */\n type?: MediaType;\n}\n\n/**\n * Media presets\n */\nexport type MediaPreset = 'continuous58mm' | 'continuous72mm' | 'continuous80mm';\n\n/**\n * Media type for labels and continuous paper\n */\nexport type MediaType = 'continuous' | 'gap' | 'label' | 'black_mark';\n\n/**\n * Printer configuration (global settings)\n */\nexport interface PrinterConfig {\n /** Left margin in dots */\n marginLeft?: number;\n /** Top margin in dots */\n marginTop?: number;\n /** Print density */\n density?: PrintDensity;\n /** Print speed */\n speed?: PrintSpeed;\n /** Print orientation */\n orientation?: PrintOrientation;\n /** Auto cutter configuration */\n autoCutter?: CutterConfig;\n}\n\n/**\n * Print density levels\n */\nexport type PrintDensity = 'light' | 'medium' | 'dark' | 'extra_dark';\n\n/**\n * Print speed levels\n */\nexport type PrintSpeed = 'slow' | 'medium' | 'fast' | 'extra_fast';\n\n/**\n * Print orientation\n */\nexport type PrintOrientation = 'top_to_bottom' | 'bottom_to_top';\n\n/**\n * Auto cutter configuration\n */\nexport interface CutterConfig {\n /** Enable auto cutter */\n enabled: boolean;\n /** Full cut (true) or partial cut (false) */\n fullCut?: boolean;\n}\n\n/**\n * Font size options\n */\nexport type FontSize = 'small' | 'medium' | 'large' | 'xlarge';\n\n/**\n * Alignment options\n */\nexport type Alignment = 'left' | 'center' | 'right';\n\n/**\n * Barcode types\n */\nexport type BarcodeType =\n | 'CODE128'\n | 'CODE39'\n | 'EAN13'\n | 'EAN8'\n | 'UPCA'\n | 'UPCE'\n | 'CODE93'\n | 'CODABAR';\n\n/**\n * Print text options\n */\nexport interface PrintTextOptions {\n fontSize?: FontSize;\n alignment?: Alignment;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print texts options (multiple lines)\n */\nexport interface PrintTextsOptions {\n fontSize?: FontSize;\n media?: MediaConfig;\n}\n\n/**\n * Print QR options\n */\nexport interface PrintQROptions {\n size?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print barcode options\n */\nexport interface PrintBarcodeOptions {\n type?: BarcodeType;\n height?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print image options\n */\nexport interface PrintImageOptions {\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print PDF options\n */\nexport interface PrintPdfOptions {\n page?: number;\n alignment?: Alignment;\n media?: MediaConfig;\n}\n\n/**\n * Print key-value options\n */\nexport interface PrintKeyValueOptions {\n fontSize?: FontSize;\n bold?: boolean;\n media?: MediaConfig;\n}\n\n/**\n * Print receipt options\n */\nexport interface PrintReceiptOptions {\n media?: MediaConfig;\n copies?: number;\n}\n"]}
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "platforms": ["android"],
3
3
  "android": {
4
- "modules": ["sincpro.expo.printer.entrypoint.PrinterModule"]
4
+ "modules": ["sincpro.expo.printer.entrypoint.PrinterModule"],
5
+ "gradleAarProjects": [
6
+ {
7
+ "name": "sincpro-printer-sdk",
8
+ "aarFilePath": "android/libs/sincpro-printer-sdk.aar"
9
+ },
10
+ {
11
+ "name": "bixolon-pdf",
12
+ "aarFilePath": "android/libs/pdf/Bixolon_pdf.aar"
13
+ }
14
+ ]
5
15
  }
6
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/printer-expo",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Expo module for controlling Bixolon thermal printers with Bluetooth connectivity",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",