@a-cube-io/ereceipts-js-sdk 2.2.1 → 2.2.2

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.d.ts CHANGED
@@ -453,6 +453,10 @@ interface PEMStatusOfflineRequest {
453
453
  timestamp: string;
454
454
  reason: string;
455
455
  }
456
+ interface PEMInactivityPeriodInput {
457
+ startAt: string;
458
+ endAt: string;
459
+ }
456
460
 
457
461
  interface PemData {
458
462
  version: string;
@@ -483,7 +487,7 @@ interface IPointOfSaleRepository {
483
487
  findAll(params?: PointOfSaleListParams): Promise<Page<PointOfSale>>;
484
488
  activate(serialNumber: string, input: ActivationRequest): Promise<void>;
485
489
  closeJournal(serialNumber: string): Promise<void>;
486
- createInactivity(serialNumber: string): Promise<void>;
490
+ createInactivityPeriod(serialNumber: string, input: PEMInactivityPeriodInput): Promise<void>;
487
491
  communicateOffline(serialNumber: string, input: PEMStatusOfflineRequest): Promise<void>;
488
492
  downloadData(serialNumber: string): Promise<ArrayBuffer>;
489
493
  }
@@ -1491,12 +1495,17 @@ interface PEMStatusOfflineRequestApiInput {
1491
1495
  timestamp: string;
1492
1496
  reason: string;
1493
1497
  }
1498
+ interface PEMInactivityInputApiInput {
1499
+ start_at: string;
1500
+ end_at: string;
1501
+ }
1494
1502
  declare class PointOfSaleMapper {
1495
1503
  static toActivationApiInput(input: ActivationRequest): ActivationRequestApiInput;
1496
1504
  static toOfflineApiInput(input: PEMStatusOfflineRequest): PEMStatusOfflineRequestApiInput;
1497
1505
  static fromApiOutput(output: PointOfSaleApiOutput): PointOfSale;
1498
1506
  static fromDetailedApiOutput(output: PointOfSaleDetailedApiOutput): PointOfSaleDetailed;
1499
1507
  static pageFromApi(response: Page<PointOfSaleApiOutput>): Page<PointOfSale>;
1508
+ static toInactivityApiInput(input: PEMInactivityPeriodInput): PEMInactivityInputApiInput;
1500
1509
  }
1501
1510
 
1502
1511
  interface SupplierApiOutput {
@@ -1810,4 +1819,4 @@ declare function loadPlatformAdapters(options?: PlatformAdapterOptions): Platfor
1810
1819
  declare function createACubeMTLSConfig(baseUrl: string, timeout?: number, autoInitialize?: boolean, forcePort444?: boolean): MTLSAdapterConfig;
1811
1820
 
1812
1821
  export { ACubeSDK, ACubeSDKError, AddressMapper, AppStateService, AuthenticationService, CashRegisterMapper, CashierMapper, CertificateService, CertificateValidator, ConfigManager, DAILY_REPORT_STATUS_OPTIONS, DailyReportMapper, EXEMPT_VAT_CODES, GOOD_OR_SERVICE_OPTIONS, GoodOrServiceSchema, JournalMapper, MTLSError, MTLSErrorType, MerchantMapper, NOTIFICATION_CODES, NOTIFICATION_LEVELS, NOTIFICATION_SCOPES, NOTIFICATION_SOURCES, NOTIFICATION_TYPES, NotificationMapper, NotificationService, PEM_STATUS_OPTIONS, PEM_TYPE_OPTIONS, PemMapper, PointOfSaleMapper, RECEIPT_PROOF_TYPE_OPTIONS, RECEIPT_READY, RECEIPT_SENT, RECEIPT_SORT_ASCENDING, RECEIPT_SORT_DESCENDING, ReceiptMapper, ReceiptProofTypeSchema, SDKManager, STANDARD_VAT_RATES, SupplierMapper, TelemetryMapper, TelemetryService, VAT_RATE_CODES, VAT_RATE_CODE_OPTIONS, VatRateCodeSchema, createACubeMTLSConfig, createACubeSDK, createPrefixedLogger, createACubeSDK as default, extractRoles, hasAnyRole, hasRole, isTokenExpired, loadPlatformAdapters, logger, parseJwt };
1813
- export type { ActivationRequest, ActivationRequestApiInput, Address, AddressApiOutput, AppMode, AppState, AuthConfig, AuthCredentials$1 as AuthCredentials, CashRegister, CashRegisterApiOutput, CashRegisterCreateApiInput, CashRegisterCreateInput, CashRegisterDetailed, CashRegisterDetailedApiOutput, CashRegisterListParams, CashRegisterUpdateApiInput, CashRegisterUpdateInput, Cashier, CashierApiOutput, CashierCreateApiInput, CashierCreateInput, CashierListParams, CashierStatus, CertificateData, CertificateInfo, DailyReport, DailyReportApiOutput, DailyReportStatus, DailyReportsParams, Domain, Environment, GoodOrService, GoodOrServiceType, HttpRequestConfig, HttpResponse, IAuthHandler, ICashRegisterRepository, ICashierRepository, ICertificatePort, IDailyReportRepository, IHttpPort, IJournalRepository, IMTLSAdapter, IMTLSAdapterFactory, IMTLSPort, IMerchantRepository, INetworkPort, INotificationRepository, IPemRepository, IPointOfSaleRepository, IReceiptRepository, ISecureStoragePort, IStoragePort, ISupplierRepository, ITelemetryRepository, ITokenStoragePort, JWTPayload, Journal, JournalApiOutput, JournalCloseInput, JournalStatus, JournalsParams, LdJsonPage, LotteryApiOutput, LotterySecretRequestApiOutput, LotterySecretRequestInfo, LotteryTelemetry, MTLSConnectionConfig, MTLSRequestConfig, MTLSResponse, ManagedServices, Merchant, MerchantApiOutput, MerchantCreateApiInput, MerchantCreateInput, MerchantUpdateApiInput, MerchantUpdateInput, MerchantsParams, MessageApiOutput, MessageInfo, Notification, NotificationApiOutput, NotificationCode, NotificationCommunicationRestored, NotificationCommunicationRestoredApiOutput, NotificationEvents, NotificationLevel, NotificationListParams, NotificationMf2Unreachable, NotificationMf2UnreachableApiOutput, NotificationPageApiOutput, NotificationPayloadBlockAt, NotificationScope, NotificationServiceConfig, NotificationSource, NotificationStatusOffline, NotificationStatusOfflineApiOutput, NotificationStatusOnline, NotificationStatusOnlineApiOutput, NotificationSyncState, NotificationType, PEMStatus, PEMStatusOfflineRequest, PEMStatusOfflineRequestApiInput, Page, PemCertificates, PemCertificatesApiOutput, PemCreateApiInput, PemCreateApiOutput, PemCreateInput, PemCreateOutput, PemData, PendingReceipts, PendingReceiptsApiOutput, PlatformAdapters, PointOfSale, PointOfSaleApiOutput, PointOfSaleDetailed, PointOfSaleDetailedApiOutput, PointOfSaleListParams, PointOfSaleMf2, PointOfSaleMf2ApiOutput, PointOfSaleType, Receipt, ReceiptApiInput, ReceiptApiOutput, ReceiptDetails, ReceiptDetailsApiOutput, ReceiptInput, ReceiptItem, ReceiptItemApiInput, ReceiptListParams, ReceiptProofType, ReceiptProofTypeType, ReceiptReturnApiInput, ReceiptReturnInput, ReceiptReturnItem, ReceiptSortOrder, ReceiptStatus, ReceiptType, ReturnViaDifferentDeviceApiInput, ReturnViaDifferentDeviceInput, ReturnWithProofApiInput, ReturnWithProofInput, ReturnableReceiptItem, ReturnableReceiptItemApiOutput, SDKConfig, SDKEvents, SDKManagerConfig, SDKManagerEvents, SoftwareVersionStatus, StoredCertificate, Supplier, SupplierApiOutput, SupplierCreateApiInput, SupplierCreateInput, SupplierUpdateApiInput, SupplierUpdateInput, SuppliersParams, Telemetry, TelemetryApiOutput, TelemetryMerchant, TelemetryMerchantApiOutput, TelemetryOperations, TelemetryServiceConfig, TelemetrySoftware, TelemetrySoftwareApiOutput, TelemetrySoftwareVersion, TelemetrySoftwareVersionApiOutput, TelemetryState, TelemetrySupplier, TelemetrySupplierApiOutput, TransmissionAttemptApiOutput, TransmissionAttemptInfo, User$1 as User, UserRole, UserRoles, VatRateCode, VatRateCodeType, VoidReceiptApiInput, VoidReceiptInput, VoidViaDifferentDeviceApiInput, VoidViaDifferentDeviceInput, VoidWithProofApiInput, VoidWithProofInput, WarningState };
1822
+ export type { ActivationRequest, ActivationRequestApiInput, Address, AddressApiOutput, AppMode, AppState, AuthConfig, AuthCredentials$1 as AuthCredentials, CashRegister, CashRegisterApiOutput, CashRegisterCreateApiInput, CashRegisterCreateInput, CashRegisterDetailed, CashRegisterDetailedApiOutput, CashRegisterListParams, CashRegisterUpdateApiInput, CashRegisterUpdateInput, Cashier, CashierApiOutput, CashierCreateApiInput, CashierCreateInput, CashierListParams, CashierStatus, CertificateData, CertificateInfo, DailyReport, DailyReportApiOutput, DailyReportStatus, DailyReportsParams, Domain, Environment, GoodOrService, GoodOrServiceType, HttpRequestConfig, HttpResponse, IAuthHandler, ICashRegisterRepository, ICashierRepository, ICertificatePort, IDailyReportRepository, IHttpPort, IJournalRepository, IMTLSAdapter, IMTLSAdapterFactory, IMTLSPort, IMerchantRepository, INetworkPort, INotificationRepository, IPemRepository, IPointOfSaleRepository, IReceiptRepository, ISecureStoragePort, IStoragePort, ISupplierRepository, ITelemetryRepository, ITokenStoragePort, JWTPayload, Journal, JournalApiOutput, JournalCloseInput, JournalStatus, JournalsParams, LdJsonPage, LotteryApiOutput, LotterySecretRequestApiOutput, LotterySecretRequestInfo, LotteryTelemetry, MTLSConnectionConfig, MTLSRequestConfig, MTLSResponse, ManagedServices, Merchant, MerchantApiOutput, MerchantCreateApiInput, MerchantCreateInput, MerchantUpdateApiInput, MerchantUpdateInput, MerchantsParams, MessageApiOutput, MessageInfo, Notification, NotificationApiOutput, NotificationCode, NotificationCommunicationRestored, NotificationCommunicationRestoredApiOutput, NotificationEvents, NotificationLevel, NotificationListParams, NotificationMf2Unreachable, NotificationMf2UnreachableApiOutput, NotificationPageApiOutput, NotificationPayloadBlockAt, NotificationScope, NotificationServiceConfig, NotificationSource, NotificationStatusOffline, NotificationStatusOfflineApiOutput, NotificationStatusOnline, NotificationStatusOnlineApiOutput, NotificationSyncState, NotificationType, PEMInactivityInputApiInput, PEMInactivityPeriodInput, PEMStatus, PEMStatusOfflineRequest, PEMStatusOfflineRequestApiInput, Page, PemCertificates, PemCertificatesApiOutput, PemCreateApiInput, PemCreateApiOutput, PemCreateInput, PemCreateOutput, PemData, PendingReceipts, PendingReceiptsApiOutput, PlatformAdapters, PointOfSale, PointOfSaleApiOutput, PointOfSaleDetailed, PointOfSaleDetailedApiOutput, PointOfSaleListParams, PointOfSaleMf2, PointOfSaleMf2ApiOutput, PointOfSaleType, Receipt, ReceiptApiInput, ReceiptApiOutput, ReceiptDetails, ReceiptDetailsApiOutput, ReceiptInput, ReceiptItem, ReceiptItemApiInput, ReceiptListParams, ReceiptProofType, ReceiptProofTypeType, ReceiptReturnApiInput, ReceiptReturnInput, ReceiptReturnItem, ReceiptSortOrder, ReceiptStatus, ReceiptType, ReturnViaDifferentDeviceApiInput, ReturnViaDifferentDeviceInput, ReturnWithProofApiInput, ReturnWithProofInput, ReturnableReceiptItem, ReturnableReceiptItemApiOutput, SDKConfig, SDKEvents, SDKManagerConfig, SDKManagerEvents, SoftwareVersionStatus, StoredCertificate, Supplier, SupplierApiOutput, SupplierCreateApiInput, SupplierCreateInput, SupplierUpdateApiInput, SupplierUpdateInput, SuppliersParams, Telemetry, TelemetryApiOutput, TelemetryMerchant, TelemetryMerchantApiOutput, TelemetryOperations, TelemetryServiceConfig, TelemetrySoftware, TelemetrySoftwareApiOutput, TelemetrySoftwareVersion, TelemetrySoftwareVersionApiOutput, TelemetryState, TelemetrySupplier, TelemetrySupplierApiOutput, TransmissionAttemptApiOutput, TransmissionAttemptInfo, User$1 as User, UserRole, UserRoles, VatRateCode, VatRateCodeType, VoidReceiptApiInput, VoidReceiptInput, VoidViaDifferentDeviceApiInput, VoidViaDifferentDeviceInput, VoidWithProofApiInput, VoidWithProofInput, WarningState };
package/dist/index.esm.js CHANGED
@@ -2511,6 +2511,12 @@ class AuthStrategy {
2511
2511
  return { mode: 'jwt', usePort444: false };
2512
2512
  }
2513
2513
  if (userRole === 'CASHIER') {
2514
+ if (url.includes('/inactivity-period')) {
2515
+ if (platform === 'mobile') {
2516
+ return { mode: 'mtls', usePort444: true };
2517
+ }
2518
+ return { mode: 'jwt', usePort444: true };
2519
+ }
2514
2520
  if (!isReceiptEndpoint) {
2515
2521
  return { mode: 'jwt', usePort444: false };
2516
2522
  }
@@ -4773,6 +4779,12 @@ class PointOfSaleMapper {
4773
4779
  pages: response.pages,
4774
4780
  };
4775
4781
  }
4782
+ static toInactivityApiInput(input) {
4783
+ return {
4784
+ start_at: input.startAt,
4785
+ end_at: input.endAt,
4786
+ };
4787
+ }
4776
4788
  }
4777
4789
 
4778
4790
  // this repository is used for MF1 endpoints
@@ -4801,8 +4813,9 @@ class PointOfSaleRepositoryImpl {
4801
4813
  async closeJournal(serialNumber) {
4802
4814
  await this.http.post(`/mf1/pems/${serialNumber}/close`);
4803
4815
  }
4804
- async createInactivity(serialNumber) {
4805
- await this.http.post(`/mf1/pems/${serialNumber}/inactivity`);
4816
+ async createInactivityPeriod(serialNumber, input) {
4817
+ const apiInput = PointOfSaleMapper.toInactivityApiInput(input);
4818
+ await this.http.post(`/mf1/pems/${serialNumber}/inactivity-period`, apiInput);
4806
4819
  }
4807
4820
  async communicateOffline(serialNumber, input) {
4808
4821
  const apiInput = PointOfSaleMapper.toOfflineApiInput(input);