@passgage/sdk-react-native 1.0.14 → 1.0.15

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/dist/index.js CHANGED
@@ -1173,14 +1173,14 @@ var enteranceFlow = async (data, options) => {
1173
1173
  }
1174
1174
  };
1175
1175
  }
1176
- if (!options.skipRepetitiveCheck && !checkRepetitiveRead(isQrCode ? qrCode : nfcCode)) {
1176
+ if (!options?.skipRepetitiveCheck && !checkRepetitiveRead(isQrCode ? qrCode : nfcCode)) {
1177
1177
  return {
1178
1178
  success: false,
1179
1179
  message: "QR code was recently scanned. Please wait before scanning again.",
1180
1180
  error: { code: "REPETITIVE_READ" }
1181
1181
  };
1182
1182
  }
1183
- if (!options.skipLocationCheck) {
1183
+ if (!options?.skipLocationCheck) {
1184
1184
  const locationValidation = validateLocation(device, location ?? void 0);
1185
1185
  if (!locationValidation.valid) {
1186
1186
  return {
@@ -1201,9 +1201,7 @@ var enteranceFlow = async (data, options) => {
1201
1201
  const enteranceResIot = await QRAccessService.triggerIoTDevice(device.id);
1202
1202
  if (enteranceResIot.success) {
1203
1203
  try {
1204
- const enteranceQrRes = await QRAccessService.createEntranceFromQR(
1205
- onlineRequestBody
1206
- );
1204
+ const enteranceQrRes = await QRAccessService.createEntranceFromQR(onlineRequestBody);
1207
1205
  if (enteranceQrRes.success) {
1208
1206
  addQrReadRecord(qrCode);
1209
1207
  return {
@@ -1237,9 +1235,7 @@ var enteranceFlow = async (data, options) => {
1237
1235
  }
1238
1236
  } else {
1239
1237
  try {
1240
- const enteranceQrRes = await QRAccessService.createEntranceFromQR(
1241
- onlineRequestBody
1242
- );
1238
+ const enteranceQrRes = await QRAccessService.createEntranceFromQR(onlineRequestBody);
1243
1239
  addQrReadRecord(qrCode);
1244
1240
  return {
1245
1241
  success: !!enteranceQrRes?.success,
@@ -1495,7 +1491,7 @@ var usePassgageQRScanner = (payload) => {
1495
1491
  if (!qrDevice) {
1496
1492
  qrDevice = qrDevices.find((item) => item.qr_code_id === qrCode);
1497
1493
  if (!qrDevice) {
1498
- payload.onError?.(
1494
+ payload?.onError?.(
1499
1495
  error ?? { message: "QR Device not found", success: false }
1500
1496
  );
1501
1497
  return;
@@ -1507,12 +1503,12 @@ var usePassgageQRScanner = (payload) => {
1507
1503
  qrCode,
1508
1504
  isQrCode: true
1509
1505
  },
1510
- payload.options
1506
+ payload?.options
1511
1507
  );
1512
1508
  if (!result.success) {
1513
- payload.onError?.(result);
1509
+ payload?.onError?.(result);
1514
1510
  } else {
1515
- payload.onSuccess?.(result.entrance);
1511
+ payload?.onSuccess?.(result.entrance);
1516
1512
  }
1517
1513
  } catch (err) {
1518
1514
  const errorObj = {
@@ -1521,7 +1517,7 @@ var usePassgageQRScanner = (payload) => {
1521
1517
  error: { code: "QR_SCAN_FAILED" }
1522
1518
  };
1523
1519
  setError(errorObj);
1524
- payload.onError?.(errorObj);
1520
+ payload?.onError?.(errorObj);
1525
1521
  } finally {
1526
1522
  setIsLoading(false);
1527
1523
  }
@@ -1590,17 +1586,17 @@ function usePassgageNFCScanner(payload) {
1590
1586
  nfcCode,
1591
1587
  isQrCode: false
1592
1588
  },
1593
- payload.options
1589
+ payload?.options
1594
1590
  );
1595
1591
  if (!result.success) {
1596
1592
  throw new Error(result.message);
1597
1593
  }
1598
- payload.onSuccess?.(result.entrance);
1594
+ payload?.onSuccess?.(result.entrance);
1599
1595
  stopScanning();
1600
1596
  } catch (err) {
1601
1597
  const error2 = err;
1602
1598
  setError(error2);
1603
- payload.onError?.(error2);
1599
+ payload?.onError?.(error2);
1604
1600
  stopScanning();
1605
1601
  }
1606
1602
  };
package/dist/index.mjs CHANGED
@@ -1143,14 +1143,14 @@ var enteranceFlow = async (data, options) => {
1143
1143
  }
1144
1144
  };
1145
1145
  }
1146
- if (!options.skipRepetitiveCheck && !checkRepetitiveRead(isQrCode ? qrCode : nfcCode)) {
1146
+ if (!options?.skipRepetitiveCheck && !checkRepetitiveRead(isQrCode ? qrCode : nfcCode)) {
1147
1147
  return {
1148
1148
  success: false,
1149
1149
  message: "QR code was recently scanned. Please wait before scanning again.",
1150
1150
  error: { code: "REPETITIVE_READ" }
1151
1151
  };
1152
1152
  }
1153
- if (!options.skipLocationCheck) {
1153
+ if (!options?.skipLocationCheck) {
1154
1154
  const locationValidation = validateLocation(device, location ?? void 0);
1155
1155
  if (!locationValidation.valid) {
1156
1156
  return {
@@ -1171,9 +1171,7 @@ var enteranceFlow = async (data, options) => {
1171
1171
  const enteranceResIot = await QRAccessService.triggerIoTDevice(device.id);
1172
1172
  if (enteranceResIot.success) {
1173
1173
  try {
1174
- const enteranceQrRes = await QRAccessService.createEntranceFromQR(
1175
- onlineRequestBody
1176
- );
1174
+ const enteranceQrRes = await QRAccessService.createEntranceFromQR(onlineRequestBody);
1177
1175
  if (enteranceQrRes.success) {
1178
1176
  addQrReadRecord(qrCode);
1179
1177
  return {
@@ -1207,9 +1205,7 @@ var enteranceFlow = async (data, options) => {
1207
1205
  }
1208
1206
  } else {
1209
1207
  try {
1210
- const enteranceQrRes = await QRAccessService.createEntranceFromQR(
1211
- onlineRequestBody
1212
- );
1208
+ const enteranceQrRes = await QRAccessService.createEntranceFromQR(onlineRequestBody);
1213
1209
  addQrReadRecord(qrCode);
1214
1210
  return {
1215
1211
  success: !!enteranceQrRes?.success,
@@ -1465,7 +1461,7 @@ var usePassgageQRScanner = (payload) => {
1465
1461
  if (!qrDevice) {
1466
1462
  qrDevice = qrDevices.find((item) => item.qr_code_id === qrCode);
1467
1463
  if (!qrDevice) {
1468
- payload.onError?.(
1464
+ payload?.onError?.(
1469
1465
  error ?? { message: "QR Device not found", success: false }
1470
1466
  );
1471
1467
  return;
@@ -1477,12 +1473,12 @@ var usePassgageQRScanner = (payload) => {
1477
1473
  qrCode,
1478
1474
  isQrCode: true
1479
1475
  },
1480
- payload.options
1476
+ payload?.options
1481
1477
  );
1482
1478
  if (!result.success) {
1483
- payload.onError?.(result);
1479
+ payload?.onError?.(result);
1484
1480
  } else {
1485
- payload.onSuccess?.(result.entrance);
1481
+ payload?.onSuccess?.(result.entrance);
1486
1482
  }
1487
1483
  } catch (err) {
1488
1484
  const errorObj = {
@@ -1491,7 +1487,7 @@ var usePassgageQRScanner = (payload) => {
1491
1487
  error: { code: "QR_SCAN_FAILED" }
1492
1488
  };
1493
1489
  setError(errorObj);
1494
- payload.onError?.(errorObj);
1490
+ payload?.onError?.(errorObj);
1495
1491
  } finally {
1496
1492
  setIsLoading(false);
1497
1493
  }
@@ -1560,17 +1556,17 @@ function usePassgageNFCScanner(payload) {
1560
1556
  nfcCode,
1561
1557
  isQrCode: false
1562
1558
  },
1563
- payload.options
1559
+ payload?.options
1564
1560
  );
1565
1561
  if (!result.success) {
1566
1562
  throw new Error(result.message);
1567
1563
  }
1568
- payload.onSuccess?.(result.entrance);
1564
+ payload?.onSuccess?.(result.entrance);
1569
1565
  stopScanning();
1570
1566
  } catch (err) {
1571
1567
  const error2 = err;
1572
1568
  setError(error2);
1573
- payload.onError?.(error2);
1569
+ payload?.onError?.(error2);
1574
1570
  stopScanning();
1575
1571
  }
1576
1572
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@passgage/sdk-react-native",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Passgage Access SDK - React Native wrapper with components and hooks",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",