@sincpro/printer-expo 0.1.2 → 1.0.1

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.
Files changed (72) hide show
  1. package/README.md +589 -415
  2. package/android/.editorconfig +20 -0
  3. package/android/README.md +103 -0
  4. package/android/build.gradle +36 -34
  5. package/android/libs/pdf/Bixolon_pdf.aar +0 -0
  6. package/android/libs/{jniLibs/x86_64/libbxl_common.so → sincpro-printer-sdk.aar} +0 -0
  7. package/android/src/main/java/sincpro/expo/printer/entrypoint/PrinterModule.kt +387 -0
  8. package/build/SincproPrinter.d.ts +191 -0
  9. package/build/SincproPrinter.d.ts.map +1 -0
  10. package/build/SincproPrinter.js +120 -0
  11. package/build/SincproPrinter.js.map +1 -0
  12. package/build/index.d.ts +11 -3
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js +13 -3
  15. package/build/index.js.map +1 -1
  16. package/build/types/bluetooth.types.d.ts +19 -0
  17. package/build/types/bluetooth.types.d.ts.map +1 -0
  18. package/build/types/bluetooth.types.js +5 -0
  19. package/build/types/bluetooth.types.js.map +1 -0
  20. package/build/types/index.d.ts +7 -0
  21. package/build/types/index.d.ts.map +1 -0
  22. package/build/types/index.js +7 -0
  23. package/build/types/index.js.map +1 -0
  24. package/build/types/printer.types.d.ts +118 -0
  25. package/build/types/printer.types.d.ts.map +1 -0
  26. package/build/types/printer.types.js +5 -0
  27. package/build/types/printer.types.js.map +1 -0
  28. package/build/types/receipt.types.d.ts +96 -0
  29. package/build/types/receipt.types.d.ts.map +1 -0
  30. package/build/types/receipt.types.js +5 -0
  31. package/build/types/receipt.types.js.map +1 -0
  32. package/expo-module.config.json +2 -5
  33. package/package.json +6 -7
  34. package/android/libs/BixolonLabelPrinterLibrary_V2.0.9.jar +0 -0
  35. package/android/libs/jniLibs/arm64-v8a/libbxl_common.so +0 -0
  36. package/android/libs/jniLibs/armeabi-v7a/libbxl_common.so +0 -0
  37. package/android/libs/jniLibs/x86/libbxl_common.so +0 -0
  38. package/android/libs/libcommon_V1.4.0.jar +0 -0
  39. package/android/src/main/java/expo/sincpro/ExpoBixolonModule.kt +0 -271
  40. package/android/src/main/java/expo/sincpro/bixolon/BixolonQRPrinter.kt +0 -423
  41. package/android/src/main/java/expo/sincpro/managers/BluetoothManager.kt +0 -139
  42. package/android/src/main/java/expo/sincpro/managers/ConnectionManager.kt +0 -124
  43. package/android/src/main/java/expo/sincpro/managers/PermissionManager.kt +0 -122
  44. package/android/src/main/java/expo/sincpro/managers/PrinterManager.kt +0 -396
  45. package/android/src/main/jniLibs/arm64-v8a/libbxl_common.so +0 -0
  46. package/android/src/main/jniLibs/armeabi-v7a/libbxl_common.so +0 -0
  47. package/android/src/main/jniLibs/x86/libbxl_common.so +0 -0
  48. package/android/src/main/jniLibs/x86_64/libbxl_common.so +0 -0
  49. package/build/BixolonPrinter.d.ts +0 -4
  50. package/build/BixolonPrinter.d.ts.map +0 -1
  51. package/build/BixolonPrinter.js +0 -12
  52. package/build/BixolonPrinter.js.map +0 -1
  53. package/build/ExpoBixolon.types.d.ts +0 -45
  54. package/build/ExpoBixolon.types.d.ts.map +0 -1
  55. package/build/ExpoBixolon.types.js +0 -2
  56. package/build/ExpoBixolon.types.js.map +0 -1
  57. package/build/ExpoBixolonModule.d.ts +0 -24
  58. package/build/ExpoBixolonModule.d.ts.map +0 -1
  59. package/build/ExpoBixolonModule.js +0 -3
  60. package/build/ExpoBixolonModule.js.map +0 -1
  61. package/build/QrCodePrinter.d.ts +0 -45
  62. package/build/QrCodePrinter.d.ts.map +0 -1
  63. package/build/QrCodePrinter.js +0 -118
  64. package/build/QrCodePrinter.js.map +0 -1
  65. package/ios/ExpoBixolon.podspec +0 -29
  66. package/ios/ExpoBixolonModule.swift +0 -33
  67. package/ios/ExpoBixolonView.swift +0 -36
  68. package/src/BixolonPrinter.ts +0 -16
  69. package/src/ExpoBixolon.types.ts +0 -60
  70. package/src/ExpoBixolonModule.ts +0 -38
  71. package/src/QrCodePrinter.ts +0 -201
  72. package/src/index.ts +0 -3
@@ -1,122 +0,0 @@
1
- package expo.sincpro.managers
2
-
3
- import android.app.Activity
4
- import android.content.Context
5
- import android.content.pm.PackageManager
6
- import android.os.Build
7
- import android.util.Log
8
- import androidx.core.app.ActivityCompat
9
- import androidx.core.content.ContextCompat
10
-
11
- class PermissionManager(private val context: Context) {
12
- private val TAG = "PermissionManager"
13
-
14
- fun requestBluetoothPermissions(currentActivity: Activity?): Boolean {
15
- try {
16
- Log.d(TAG, "Requesting Bluetooth permissions")
17
-
18
- if (currentActivity == null) {
19
- Log.w(TAG, "No current activity available for permission request")
20
- return false
21
- }
22
-
23
- val permissions = mutableListOf<String>()
24
-
25
- if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
26
- permissions.add(android.Manifest.permission.ACCESS_FINE_LOCATION)
27
- }
28
-
29
- if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
30
- permissions.add(android.Manifest.permission.ACCESS_COARSE_LOCATION)
31
- }
32
-
33
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
34
- if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.BLUETOOTH_SCAN) != PackageManager.PERMISSION_GRANTED) {
35
- permissions.add(android.Manifest.permission.BLUETOOTH_SCAN)
36
- }
37
- if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
38
- permissions.add(android.Manifest.permission.BLUETOOTH_CONNECT)
39
- }
40
- }
41
-
42
- if (permissions.isEmpty()) {
43
- Log.d(TAG, "All permissions already granted")
44
- return true
45
- }
46
-
47
- Log.d(TAG, "Requesting permissions: ${permissions.joinToString()}")
48
-
49
- ActivityCompat.requestPermissions(
50
- currentActivity,
51
- permissions.toTypedArray(),
52
- 1001
53
- )
54
-
55
- return true
56
-
57
- } catch (e: Exception) {
58
- Log.e(TAG, "Error requesting Bluetooth permissions: ${e.message}")
59
- return false
60
- }
61
- }
62
-
63
- fun checkBluetoothPermissions(): Map<String, Boolean> {
64
- try {
65
- Log.d(TAG, "Checking Bluetooth permissions")
66
-
67
- val results = mutableMapOf<String, Boolean>()
68
-
69
- results["ACCESS_FINE_LOCATION"] = ContextCompat.checkSelfPermission(
70
- context,
71
- android.Manifest.permission.ACCESS_FINE_LOCATION
72
- ) == PackageManager.PERMISSION_GRANTED
73
-
74
- results["ACCESS_COARSE_LOCATION"] = ContextCompat.checkSelfPermission(
75
- context,
76
- android.Manifest.permission.ACCESS_COARSE_LOCATION
77
- ) == PackageManager.PERMISSION_GRANTED
78
-
79
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
80
- results["BLUETOOTH_SCAN"] = ContextCompat.checkSelfPermission(
81
- context,
82
- android.Manifest.permission.BLUETOOTH_SCAN
83
- ) == PackageManager.PERMISSION_GRANTED
84
-
85
- results["BLUETOOTH_CONNECT"] = ContextCompat.checkSelfPermission(
86
- context,
87
- android.Manifest.permission.BLUETOOTH_CONNECT
88
- ) == PackageManager.PERMISSION_GRANTED
89
- }
90
-
91
- return results
92
-
93
- } catch (e: Exception) {
94
- Log.e(TAG, "Error checking Bluetooth permissions: ${e.message}")
95
- throw e
96
- }
97
- }
98
-
99
- fun hasRequiredPermissions(): Boolean {
100
- val hasLocationPermission = ContextCompat.checkSelfPermission(
101
- context,
102
- android.Manifest.permission.ACCESS_FINE_LOCATION
103
- ) == PackageManager.PERMISSION_GRANTED
104
-
105
- var hasBluetoothPermissions = true
106
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
107
- val hasScanPermission = ContextCompat.checkSelfPermission(
108
- context,
109
- android.Manifest.permission.BLUETOOTH_SCAN
110
- ) == PackageManager.PERMISSION_GRANTED
111
-
112
- val hasConnectPermission = ContextCompat.checkSelfPermission(
113
- context,
114
- android.Manifest.permission.BLUETOOTH_CONNECT
115
- ) == PackageManager.PERMISSION_GRANTED
116
-
117
- hasBluetoothPermissions = hasScanPermission && hasConnectPermission
118
- }
119
-
120
- return hasLocationPermission && hasBluetoothPermissions
121
- }
122
- }
@@ -1,396 +0,0 @@
1
- package expo.sincpro.managers
2
-
3
- import android.util.Log
4
- import expo.sincpro.bixolon.BixolonQRPrinter
5
-
6
- class PrinterManager(private val bixolonQRPrinter: BixolonQRPrinter) {
7
- private val TAG = "PrinterManager"
8
-
9
- fun printPlainText(text: String): Boolean {
10
- try {
11
- Log.d(TAG, "Printing plain text using Bixolon SDK")
12
-
13
- val finalText = if (text.isNotEmpty()) {
14
- text
15
- } else {
16
- "Texto vacío"
17
- }
18
-
19
- bixolonQRPrinter.initializeForNewPrint()
20
-
21
- bixolonQRPrinter.beginTransactionPrint()
22
-
23
- val lines = finalText.split("\n")
24
- var yPosition = 50
25
-
26
- for (line in lines) {
27
- if (line.isNotEmpty()) {
28
- bixolonQRPrinter.drawText(
29
- line,
30
- 50, yPosition,
31
- BixolonQRPrinter.FONT_SIZE_10,
32
- 1, 1, 0,
33
- BixolonQRPrinter.ROTATION_NONE,
34
- false, false,
35
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
36
- )
37
- yPosition += 30
38
- } else {
39
- yPosition += 15
40
- }
41
- }
42
-
43
- bixolonQRPrinter.print(1, 1)
44
-
45
- bixolonQRPrinter.endTransactionPrint()
46
-
47
- Log.d(TAG, "Plain text printed successfully using Bixolon SDK")
48
- Log.d(TAG, " Content: $finalText")
49
- Log.d(TAG, " Lines printed: ${lines.size}")
50
-
51
- return true
52
-
53
- } catch (e: Exception) {
54
- Log.e(TAG, "Error printing plain text: ${e.message}")
55
- throw e
56
- }
57
- }
58
-
59
- fun printInvoice(invoiceText: String): Boolean {
60
- try {
61
- Log.d(TAG, "Printing invoice using Bixolon SDK")
62
-
63
- val finalText = if (invoiceText.isNotEmpty()) {
64
- invoiceText
65
- } else {
66
- "Factura vacía"
67
- }
68
-
69
- bixolonQRPrinter.initializeForNewPrint()
70
-
71
- bixolonQRPrinter.beginTransactionPrint()
72
-
73
- val lines = finalText.split("\n")
74
- var yPosition = 50
75
-
76
- for (line in lines) {
77
- if (line.isNotEmpty()) {
78
- bixolonQRPrinter.drawText(
79
- line,
80
- 50, yPosition,
81
- BixolonQRPrinter.FONT_SIZE_10,
82
- 1, 1, 0,
83
- BixolonQRPrinter.ROTATION_NONE,
84
- false, false,
85
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
86
- )
87
- yPosition += 30
88
- } else {
89
- yPosition += 15
90
- }
91
- }
92
-
93
- bixolonQRPrinter.print(1, 1)
94
-
95
- bixolonQRPrinter.endTransactionPrint()
96
-
97
- Log.d(TAG, "Invoice printed successfully using Bixolon SDK")
98
- Log.d(TAG, " Content: $finalText")
99
- Log.d(TAG, " Lines printed: ${lines.size}")
100
- return true
101
-
102
- } catch (e: Exception) {
103
- Log.e(TAG, "Error printing invoice: ${e.message}")
104
- throw e
105
- }
106
- }
107
-
108
- fun printQRCode(text: String, size: Int): Boolean {
109
- try {
110
- Log.d(TAG, "Printing QR code for text: $text using Bixolon SDK")
111
-
112
- bixolonQRPrinter.initializeForNewPrint()
113
-
114
- bixolonQRPrinter.beginTransactionPrint()
115
-
116
- bixolonQRPrinter.drawQrCode(
117
- text,
118
- 100,
119
- 50,
120
- BixolonQRPrinter.QR_CODE_MODEL2,
121
- BixolonQRPrinter.ECC_LEVEL_7,
122
- Math.min(size, 3),
123
- BixolonQRPrinter.ROTATION_NONE
124
- )
125
-
126
- bixolonQRPrinter.print(1, 1)
127
-
128
- bixolonQRPrinter.endTransactionPrint()
129
-
130
- Log.d(TAG, "QR code printed successfully using Bixolon SDK")
131
- Log.d(TAG, " Content: $text")
132
- Log.d(TAG, " Size: $size")
133
-
134
- return true
135
-
136
- } catch (e: Exception) {
137
- Log.e(TAG, "Error printing QR code: ${e.message}")
138
- throw e
139
- }
140
- }
141
-
142
- fun printQRCodeAdvanced(data: String, size: Int): Boolean {
143
- try {
144
- Log.d(TAG, "Printing advanced QR code for data: $data")
145
-
146
- val success = bixolonQRPrinter.printQRCode(data, size)
147
-
148
- if (success) {
149
- Log.d(TAG, "QR code printed successfully with Bixolon library")
150
- return true
151
- } else {
152
- Log.e(TAG, "Failed to print QR code with Bixolon library")
153
- return false
154
- }
155
-
156
- } catch (e: Exception) {
157
- Log.e(TAG, "Error printing QR code: ${e.message}")
158
- throw e
159
- }
160
- }
161
-
162
- fun printFormattedText(text: String, fontSize: Int = BixolonQRPrinter.FONT_SIZE_10): Boolean {
163
- try {
164
- Log.d(TAG, "Printing formatted text using Bixolon SDK")
165
- Log.d(TAG, "Full text to print: $text")
166
-
167
- val finalText = if (text.isNotEmpty()) {
168
- text
169
- } else {
170
- "Texto vacío"
171
- }
172
-
173
- bixolonQRPrinter.initializeForNewPrint()
174
-
175
- bixolonQRPrinter.beginTransactionPrint()
176
-
177
- val lines = finalText.split("\n")
178
- Log.d(TAG, "Total lines to print: ${lines.size}")
179
- var yPosition = 50
180
- var lineCount = 0
181
-
182
- for (line in lines) {
183
- lineCount++
184
- Log.d(TAG, "Printing line $lineCount: '$line'")
185
-
186
- if (line.isNotEmpty()) {
187
- val maxLineLength = 32
188
- if (line.length > maxLineLength) {
189
- val words = line.split(" ")
190
- var currentLine = ""
191
-
192
- for (word in words) {
193
- if ((currentLine + word).length <= maxLineLength) {
194
- currentLine += if (currentLine.isEmpty()) word else " $word"
195
- } else {
196
- if (currentLine.isNotEmpty()) {
197
- Log.d(TAG, "Printing wrapped line: '$currentLine'")
198
- bixolonQRPrinter.drawText(
199
- currentLine,
200
- 50, yPosition,
201
- fontSize,
202
- 1, 1, 0,
203
- BixolonQRPrinter.ROTATION_NONE,
204
- false, false,
205
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
206
- )
207
- yPosition += 30
208
- }
209
- currentLine = word
210
- }
211
- }
212
-
213
- if (currentLine.isNotEmpty()) {
214
- Log.d(TAG, "Printing final wrapped line: '$currentLine'")
215
- bixolonQRPrinter.drawText(
216
- currentLine,
217
- 50, yPosition,
218
- fontSize,
219
- 1, 1, 0,
220
- BixolonQRPrinter.ROTATION_NONE,
221
- false, false,
222
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
223
- )
224
- yPosition += 30
225
- }
226
- } else {
227
- Log.d(TAG, "Printing normal line: '$line'")
228
- bixolonQRPrinter.drawText(
229
- line,
230
- 50, yPosition,
231
- fontSize,
232
- 1, 1, 0,
233
- BixolonQRPrinter.ROTATION_NONE,
234
- false, false,
235
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
236
- )
237
- yPosition += 30
238
- }
239
- } else {
240
- Log.d(TAG, "Skipping empty line")
241
- yPosition += 15
242
- }
243
- }
244
-
245
- Log.d(TAG, "Calling print() with ${lineCount} lines")
246
- bixolonQRPrinter.print(1, 1)
247
-
248
- bixolonQRPrinter.endTransactionPrint()
249
-
250
- Log.d(TAG, "Formatted text printed successfully using Bixolon SDK")
251
- Log.d(TAG, " Total lines processed: $lineCount")
252
- Log.d(TAG, " Final Y position: $yPosition")
253
-
254
- return true
255
-
256
- } catch (e: Exception) {
257
- Log.e(TAG, "Error printing formatted text: ${e.message}")
258
- Log.e(TAG, "Stack trace: ${e.stackTrace.joinToString("\n")}")
259
- throw e
260
- }
261
- }
262
-
263
- fun printTextSimple(text: String): Boolean {
264
- try {
265
- Log.d(TAG, "Printing simple text using Bixolon SDK")
266
- Log.d(TAG, "Full text to print: $text")
267
-
268
- val finalText = if (text.isNotEmpty()) {
269
- text
270
- } else {
271
- "Texto vacío"
272
- }
273
-
274
- bixolonQRPrinter.initializeForNewPrint()
275
-
276
- bixolonQRPrinter.beginTransactionPrint()
277
-
278
- val lines = finalText.split("\n")
279
- Log.d(TAG, "Total lines to print: ${lines.size}")
280
- var yPosition = 50
281
-
282
- for ((index, line) in lines.withIndex()) {
283
- Log.d(TAG, "Printing line ${index + 1}: '$line'")
284
-
285
- if (line.isNotEmpty()) {
286
- bixolonQRPrinter.drawText(
287
- line,
288
- 50, yPosition,
289
- BixolonQRPrinter.FONT_SIZE_10,
290
- 1, 1, 0,
291
- BixolonQRPrinter.ROTATION_NONE,
292
- false, false,
293
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
294
- )
295
- yPosition += 25
296
- } else {
297
- yPosition += 10
298
- }
299
-
300
- if ((index + 1) % 10 == 0) {
301
- Log.d(TAG, "Adding extra spacing at line ${index + 1}")
302
- yPosition += 20
303
- }
304
- }
305
-
306
- Log.d(TAG, "Adding final spacing")
307
- yPosition += 50
308
-
309
- Log.d(TAG, "Calling print() with ${lines.size} lines")
310
- bixolonQRPrinter.print(1, 1)
311
-
312
- bixolonQRPrinter.endTransactionPrint()
313
-
314
- Log.d(TAG, "Simple text printed successfully using Bixolon SDK")
315
- Log.d(TAG, " Total lines processed: ${lines.size}")
316
- Log.d(TAG, " Final Y position: $yPosition")
317
-
318
- return true
319
-
320
- } catch (e: Exception) {
321
- Log.e(TAG, "Error printing simple text: ${e.message}")
322
- Log.e(TAG, "Stack trace: ${e.stackTrace.joinToString("\n")}")
323
- throw e
324
- }
325
- }
326
-
327
- fun printTextInPages(text: String): Boolean {
328
- try {
329
- Log.d(TAG, "Printing text in pages using Bixolon SDK")
330
- Log.d(TAG, "Full text to print: $text")
331
-
332
- val finalText = if (text.isNotEmpty()) {
333
- text
334
- } else {
335
- "Texto vacío"
336
- }
337
-
338
- val lines = finalText.split("\n")
339
- Log.d(TAG, "Total lines to print: ${lines.size}")
340
-
341
- val linesPerPage = 8
342
- val totalPages = (lines.size + linesPerPage - 1) / linesPerPage
343
-
344
- for (page in 0 until totalPages) {
345
- Log.d(TAG, "Printing page ${page + 1} of $totalPages")
346
-
347
- bixolonQRPrinter.initializeForNewPrint()
348
- bixolonQRPrinter.beginTransactionPrint()
349
-
350
- val startIndex = page * linesPerPage
351
- val endIndex = minOf(startIndex + linesPerPage, lines.size)
352
- var yPosition = 50
353
-
354
- for (i in startIndex until endIndex) {
355
- val line = lines[i]
356
- Log.d(TAG, "Printing line ${i + 1} on page ${page + 1}: '$line'")
357
-
358
- if (line.isNotEmpty()) {
359
- bixolonQRPrinter.drawText(
360
- line,
361
- 50, yPosition,
362
- BixolonQRPrinter.FONT_SIZE_10,
363
- 1, 1, 0,
364
- BixolonQRPrinter.ROTATION_NONE,
365
- false, false,
366
- BixolonQRPrinter.TEXT_ALIGNMENT_LEFT
367
- )
368
- yPosition += 30
369
- } else {
370
- yPosition += 15
371
- }
372
- }
373
-
374
- Log.d(TAG, "Adding page spacing for page ${page + 1}")
375
- yPosition += 50
376
-
377
- bixolonQRPrinter.print(1, 1)
378
- bixolonQRPrinter.endTransactionPrint()
379
-
380
- Log.d(TAG, "Page ${page + 1} printed successfully")
381
- }
382
-
383
- Log.d(TAG, "All pages printed successfully using Bixolon SDK")
384
- Log.d(TAG, " Total pages: $totalPages")
385
- Log.d(TAG, " Total lines: ${lines.size}")
386
-
387
- return true
388
-
389
- } catch (e: Exception) {
390
- Log.e(TAG, "Error printing text in pages: ${e.message}")
391
- Log.e(TAG, "Stack trace: ${e.stackTrace.joinToString("\n")}")
392
- throw e
393
- }
394
- }
395
-
396
- }
@@ -1,4 +0,0 @@
1
- import type { BixolonPrinterInterface } from './ExpoBixolon.types';
2
- export declare const BixolonPrinter: BixolonPrinterInterface;
3
- export default BixolonPrinter;
4
- //# sourceMappingURL=BixolonPrinter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BixolonPrinter.d.ts","sourceRoot":"","sources":["../src/BixolonPrinter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAWnE,eAAO,MAAM,cAAc,EAAE,uBAA2C,CAAC;AAEzE,eAAe,cAAc,CAAC"}
@@ -1,12 +0,0 @@
1
- import { NativeEventEmitter } from 'react-native';
2
- import ExpoBixolonModule from './ExpoBixolonModule';
3
- const eventEmitter = new NativeEventEmitter(ExpoBixolonModule);
4
- if (!eventEmitter.addListener) {
5
- eventEmitter.addListener = () => ({ remove: () => { } });
6
- }
7
- if (!eventEmitter.removeAllListeners) {
8
- eventEmitter.removeAllListeners = () => { };
9
- }
10
- export const BixolonPrinter = ExpoBixolonModule;
11
- export default BixolonPrinter;
12
- //# sourceMappingURL=BixolonPrinter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BixolonPrinter.js","sourceRoot":"","sources":["../src/BixolonPrinter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAGpD,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,iBAAwB,CAAC,CAAC;AAEtE,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC7B,YAAoB,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC;AACD,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;IACpC,YAAoB,CAAC,kBAAkB,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA4B,iBAAiB,CAAC;AAEzE,eAAe,cAAc,CAAC","sourcesContent":["import { NativeEventEmitter } from 'react-native';\nimport ExpoBixolonModule from './ExpoBixolonModule';\nimport type { BixolonPrinterInterface } from './ExpoBixolon.types';\n\nconst eventEmitter = new NativeEventEmitter(ExpoBixolonModule as any);\n\nif (!eventEmitter.addListener) {\n (eventEmitter as any).addListener = () => ({ remove: () => {} });\n}\nif (!eventEmitter.removeAllListeners) {\n (eventEmitter as any).removeAllListeners = () => {};\n}\n\nexport const BixolonPrinter: BixolonPrinterInterface = ExpoBixolonModule;\n\nexport default BixolonPrinter;\n"]}
@@ -1,45 +0,0 @@
1
- export interface BluetoothDevice {
2
- name: string;
3
- address: string;
4
- type: 'CLASSIC' | 'LE' | 'DUAL' | 'UNKNOWN';
5
- isPrinter: boolean;
6
- }
7
- export interface BluetoothPermissions {
8
- ACCESS_FINE_LOCATION: boolean;
9
- ACCESS_COARSE_LOCATION: boolean;
10
- BLUETOOTH_SCAN?: boolean;
11
- BLUETOOTH_CONNECT?: boolean;
12
- }
13
- export interface InvoiceItem {
14
- description: string;
15
- quantity: number;
16
- price: number;
17
- }
18
- export interface BixolonPrinterInterface {
19
- initializePrinter(): Promise<boolean>;
20
- connectPrinter(interfaceType: string, address: string, port: number): Promise<boolean>;
21
- disconnectPrinter(): Promise<boolean>;
22
- executeCommand(command: string): Promise<boolean>;
23
- testPlainText(text: string): Promise<boolean>;
24
- printInvoice(invoiceText: string): Promise<boolean>;
25
- printQRCode(text: string, size?: number): Promise<boolean>;
26
- printQRCodeAdvanced(data: string, horizontalPosition: number, verticalPosition: number, model: string, eccLevel: string, size: number, rotation: string): Promise<boolean>;
27
- printFormattedText(text: string, fontSize?: number): Promise<boolean>;
28
- printTextSimple(text: string): Promise<boolean>;
29
- printTextInPages(text: string): Promise<boolean>;
30
- requestBluetoothPermissions(): Promise<boolean>;
31
- checkBluetoothPermissions(): Promise<BluetoothPermissions>;
32
- discoverBluetoothDevices(): Promise<BluetoothDevice[]>;
33
- startBluetoothDiscovery(): Promise<boolean>;
34
- stopBluetoothDiscovery(): Promise<boolean>;
35
- isBluetoothEnabled(): Promise<boolean>;
36
- }
37
- export type ExpoBixolonModuleEvents = {
38
- onBluetoothDeviceDiscovered: (device: BluetoothDevice) => void;
39
- onBluetoothDiscoveryStarted: () => void;
40
- onBluetoothDiscoveryStopped: () => void;
41
- onPrinterConnected: () => void;
42
- onPrinterDisconnected: () => void;
43
- onPrintComplete: (success: boolean) => void;
44
- };
45
- //# sourceMappingURL=ExpoBixolon.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoBixolon.types.d.ts","sourceRoot":"","sources":["../src/ExpoBixolon.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvF,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAElD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9C,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjD,2BAA2B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,yBAAyB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC3D,wBAAwB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACvD,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,2BAA2B,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/D,2BAA2B,EAAE,MAAM,IAAI,CAAC;IACxC,2BAA2B,EAAE,MAAM,IAAI,CAAC;IACxC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7C,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ExpoBixolon.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoBixolon.types.js","sourceRoot":"","sources":["../src/ExpoBixolon.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface BluetoothDevice {\n name: string;\n address: string;\n type: 'CLASSIC' | 'LE' | 'DUAL' | 'UNKNOWN';\n isPrinter: boolean;\n}\n\nexport interface BluetoothPermissions {\n ACCESS_FINE_LOCATION: boolean;\n ACCESS_COARSE_LOCATION: boolean;\n BLUETOOTH_SCAN?: boolean;\n BLUETOOTH_CONNECT?: boolean;\n}\n\nexport interface InvoiceItem {\n description: string;\n quantity: number;\n price: number;\n}\n\nexport interface BixolonPrinterInterface {\n initializePrinter(): Promise<boolean>;\n connectPrinter(interfaceType: string, address: string, port: number): Promise<boolean>;\n disconnectPrinter(): Promise<boolean>;\n executeCommand(command: string): Promise<boolean>;\n\n testPlainText(text: string): Promise<boolean>;\n\n printInvoice(invoiceText: string): Promise<boolean>;\n\n printQRCode(text: string, size?: number): Promise<boolean>;\n printQRCodeAdvanced(\n data: string,\n horizontalPosition: number,\n verticalPosition: number,\n model: string,\n eccLevel: string,\n size: number,\n rotation: string\n ): Promise<boolean>;\n printFormattedText(text: string, fontSize?: number): Promise<boolean>;\n printTextSimple(text: string): Promise<boolean>;\n printTextInPages(text: string): Promise<boolean>;\n\n requestBluetoothPermissions(): Promise<boolean>;\n checkBluetoothPermissions(): Promise<BluetoothPermissions>;\n discoverBluetoothDevices(): Promise<BluetoothDevice[]>;\n startBluetoothDiscovery(): Promise<boolean>;\n stopBluetoothDiscovery(): Promise<boolean>;\n isBluetoothEnabled(): Promise<boolean>;\n}\n\nexport type ExpoBixolonModuleEvents = {\n onBluetoothDeviceDiscovered: (device: BluetoothDevice) => void;\n onBluetoothDiscoveryStarted: () => void;\n onBluetoothDiscoveryStopped: () => void;\n onPrinterConnected: () => void;\n onPrinterDisconnected: () => void;\n onPrintComplete: (success: boolean) => void;\n};\n"]}
@@ -1,24 +0,0 @@
1
- import { NativeModule } from 'expo';
2
- import { ExpoBixolonModuleEvents, BixolonPrinterInterface } from './ExpoBixolon.types';
3
- declare class ExpoBixolonModule extends NativeModule<ExpoBixolonModuleEvents> implements BixolonPrinterInterface {
4
- printQRCode(text: string, size?: number): Promise<boolean>;
5
- printQRCodeAdvanced(data: string, horizontalPosition: number, verticalPosition: number, model: string, eccLevel: string, size: number, rotation: string): Promise<boolean>;
6
- printFormattedText(text: string, fontSize?: number): Promise<boolean>;
7
- printTextSimple(text: string): Promise<boolean>;
8
- printTextInPages(text: string): Promise<boolean>;
9
- initializePrinter(): Promise<boolean>;
10
- connectPrinter(interfaceType: string, address: string, port: number): Promise<boolean>;
11
- disconnectPrinter(): Promise<boolean>;
12
- executeCommand(command: string): Promise<boolean>;
13
- testPlainText(text: string): Promise<boolean>;
14
- printInvoice(invoiceText: string): Promise<boolean>;
15
- requestBluetoothPermissions(): Promise<boolean>;
16
- checkBluetoothPermissions(): Promise<any>;
17
- discoverBluetoothDevices(): Promise<any[]>;
18
- startBluetoothDiscovery(): Promise<boolean>;
19
- stopBluetoothDiscovery(): Promise<boolean>;
20
- isBluetoothEnabled(): Promise<boolean>;
21
- }
22
- declare const _default: ExpoBixolonModule;
23
- export default _default;
24
- //# sourceMappingURL=ExpoBixolonModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoBixolonModule.d.ts","sourceRoot":"","sources":["../src/ExpoBixolonModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,OAAO,OAAO,iBACZ,SAAQ,YAAY,CAAC,uBAAuB,CAC5C,YAAW,uBAAuB;IAElC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAC1D,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IACnB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACrE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAC/C,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAChD,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IACrC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IACtF,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IACrC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAEjD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAE7C,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAEnD,2BAA2B,IAAI,OAAO,CAAC,OAAO,CAAC;IAC/C,yBAAyB,IAAI,OAAO,CAAC,GAAG,CAAC;IACzC,wBAAwB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IAC3C,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC;IAC1C,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;CACvC;;AAED,wBAAqE"}
@@ -1,3 +0,0 @@
1
- import { requireNativeModule } from 'expo';
2
- export default requireNativeModule('ExpoBixolon');
3
- //# sourceMappingURL=ExpoBixolonModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpoBixolonModule.js","sourceRoot":"","sources":["../src/ExpoBixolonModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAqCzD,eAAe,mBAAmB,CAAoB,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\nimport { ExpoBixolonModuleEvents, BixolonPrinterInterface } from './ExpoBixolon.types';\n\ndeclare class ExpoBixolonModule\n extends NativeModule<ExpoBixolonModuleEvents>\n implements BixolonPrinterInterface\n{\n printQRCode(text: string, size?: number): Promise<boolean>;\n printQRCodeAdvanced(\n data: string,\n horizontalPosition: number,\n verticalPosition: number,\n model: string,\n eccLevel: string,\n size: number,\n rotation: string\n ): Promise<boolean>;\n printFormattedText(text: string, fontSize?: number): Promise<boolean>;\n printTextSimple(text: string): Promise<boolean>;\n printTextInPages(text: string): Promise<boolean>;\n initializePrinter(): Promise<boolean>;\n connectPrinter(interfaceType: string, address: string, port: number): Promise<boolean>;\n disconnectPrinter(): Promise<boolean>;\n executeCommand(command: string): Promise<boolean>;\n\n testPlainText(text: string): Promise<boolean>;\n\n printInvoice(invoiceText: string): Promise<boolean>;\n\n requestBluetoothPermissions(): Promise<boolean>;\n checkBluetoothPermissions(): Promise<any>;\n discoverBluetoothDevices(): Promise<any[]>;\n startBluetoothDiscovery(): Promise<boolean>;\n stopBluetoothDiscovery(): Promise<boolean>;\n isBluetoothEnabled(): Promise<boolean>;\n}\n\nexport default requireNativeModule<ExpoBixolonModule>('ExpoBixolon');\n"]}