@janiscommerce/app-tracking-shift 1.4.0-beta.2 → 1.4.0-beta.3

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 (2) hide show
  1. package/lib/Shift.js +31 -0
  2. package/package.json +1 -1
package/lib/Shift.js CHANGED
@@ -575,12 +575,24 @@ class Shift {
575
575
  }
576
576
  }
577
577
 
578
+ /**
579
+ * @private
580
+ * Send the work logs to the staff MS
581
+ * @param {Array} workLogs => Array of work logs
582
+ */
583
+
578
584
  async _sendWorkLogs(workLogs = []) {
579
585
  const formattedWorkLogs = ShiftWorklogs.formatForJanis(workLogs);
580
586
 
581
587
  await ShiftWorklogs.batch(formattedWorkLogs);
582
588
  }
583
589
 
590
+ /**
591
+ * @private
592
+ * Save the offline work logs to the storage
593
+ * @param {Array} workLogs => Array of work logs
594
+ */
595
+
584
596
  _saveOffLineWorkLogs(workLogs) {
585
597
  workLogs = isArray(workLogs) ? workLogs : [workLogs];
586
598
 
@@ -598,14 +610,32 @@ class Shift {
598
610
  });
599
611
  }
600
612
 
613
+ /**
614
+ * @private
615
+ * Get the offline work logs from the storage
616
+ * @returns {Array} workLogs => Array of work logs
617
+ */
618
+
601
619
  _getOffLineWorkLogs() {
602
620
  return OfflineData.get();
603
621
  }
604
622
 
623
+ /**
624
+ * @private
625
+ * Check if the work log should be paused
626
+ * @param {string} workLogReferenceId => Reference ID related to the work log
627
+ * @returns {boolean} true if the work log should be paused, false otherwise
628
+ */
629
+
605
630
  _hasToPause(workLogReferenceId) {
606
631
  return workLogReferenceId && !EXCLUDED_WORKLOG_TYPES.includes(workLogReferenceId);
607
632
  }
608
633
 
634
+ /**
635
+ * @private
636
+ * Delete the shift data from the storage
637
+ */
638
+
609
639
  _deleteShiftData() {
610
640
  Storage.remove(SHIFT_ID);
611
641
  Storage.remove(SHIFT_STATUS);
@@ -637,6 +667,7 @@ class Shift {
637
667
  }
638
668
 
639
669
  /**
670
+ * @private
640
671
  * Throw an error if the user does not have staff authorization
641
672
  * @throws {Error} error
642
673
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janiscommerce/app-tracking-shift",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.0-beta.3",
4
4
  "main": "lib/index.js",
5
5
  "module": "lib/index.js",
6
6
  "exports": {