@forgeroute/ui 0.5.23 → 0.5.24

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.
@@ -3937,17 +3937,15 @@ var SquareTerminalStatusComponent = class SquareTerminalStatusComponent {
3937
3937
  <p class="srs-text" data-testid="reader-status-text">{{ text() }}</p>
3938
3938
  <div class="srs-actions">
3939
3939
  @if (state() === 'no_reader' || state() === 'unsupported_only') {
3940
- @if (!hideConnect()) {
3941
- <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
3942
- }
3943
- <ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t(hardwareShopAvailable() ? 'squareTerminal.status.get' : 'squareTerminal.status.getInfo') }}</ui-button>
3940
+ <!-- no Terminal yet: the ONLY action is how to get one -->
3941
+ <ui-button variant="primary" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t('squareTerminal.status.getInfo') }}</ui-button>
3944
3942
  }
3945
3943
  @if (state() === 'merchant_not_ready' || attention()) {
3946
3944
  <ui-button variant="primary" size="sm" data-testid="reader-status-setup" (click)="openSetup.emit()">{{ labels.t(reconnect() || attention() ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
3947
3945
  }
3948
- @if (state() === 'reader_pairing' && !hideConnect()) {
3949
- <!-- the code on the Terminal expired or was lost: connecting again gives a new code (the service answers the same code for a repeat inside 60 seconds) -->
3950
- <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
3946
+ @if ((state() === 'reader_pairing' || state() === 'reader_offline') && !hideConnect()) {
3947
+ <!-- a Terminal exists but is not connected (its code expired or was lost, or it is offline): connecting again gives a new code (the service answers the same code for a repeat inside 60 seconds) -->
3948
+ <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connectYours') }}</ui-button>
3951
3949
  }
3952
3950
  @if (state() === 'reader_offline' || state() === 'reader_pairing' || state() === 'checking' || state() === 'attention') {
3953
3951
  <ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
@@ -4076,17 +4074,15 @@ i0.ɵɵngDeclareClassMetadata({
4076
4074
  <p class="srs-text" data-testid="reader-status-text">{{ text() }}</p>
4077
4075
  <div class="srs-actions">
4078
4076
  @if (state() === 'no_reader' || state() === 'unsupported_only') {
4079
- @if (!hideConnect()) {
4080
- <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
4081
- }
4082
- <ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t(hardwareShopAvailable() ? 'squareTerminal.status.get' : 'squareTerminal.status.getInfo') }}</ui-button>
4077
+ <!-- no Terminal yet: the ONLY action is how to get one -->
4078
+ <ui-button variant="primary" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t('squareTerminal.status.getInfo') }}</ui-button>
4083
4079
  }
4084
4080
  @if (state() === 'merchant_not_ready' || attention()) {
4085
4081
  <ui-button variant="primary" size="sm" data-testid="reader-status-setup" (click)="openSetup.emit()">{{ labels.t(reconnect() || attention() ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
4086
4082
  }
4087
- @if (state() === 'reader_pairing' && !hideConnect()) {
4088
- <!-- the code on the Terminal expired or was lost: connecting again gives a new code (the service answers the same code for a repeat inside 60 seconds) -->
4089
- <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
4083
+ @if ((state() === 'reader_pairing' || state() === 'reader_offline') && !hideConnect()) {
4084
+ <!-- a Terminal exists but is not connected (its code expired or was lost, or it is offline): connecting again gives a new code (the service answers the same code for a repeat inside 60 seconds) -->
4085
+ <ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.connectYours') }}</ui-button>
4090
4086
  }
4091
4087
  @if (state() === 'reader_offline' || state() === 'reader_pairing' || state() === 'checking' || state() === 'attention') {
4092
4088
  <ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
@@ -4194,7 +4190,9 @@ i0.ɵɵngDeclareClassMetadata({
4194
4190
  const SQUARE_TERMINAL_NO_READER_STATES = [
4195
4191
  "no_reader",
4196
4192
  "unsupported_only",
4197
- "merchant_not_ready"
4193
+ "merchant_not_ready",
4194
+ "reader_offline",
4195
+ "reader_pairing"
4198
4196
  ];
4199
4197
  var SquareTerminalPaymentComponent = class SquareTerminalPaymentComponent {
4200
4198
  constructor() {
@@ -7085,8 +7083,11 @@ function squareTerminalBannerConfig(config) {
7085
7083
  const SQUARE_TERMINAL_BANNER_STATES = [
7086
7084
  "no_reader",
7087
7085
  "unsupported_only",
7088
- "merchant_not_ready"
7086
+ "merchant_not_ready",
7087
+ "reader_offline",
7088
+ "reader_pairing"
7089
7089
  ];
7090
+ const SQUARE_TERMINAL_NOT_CONNECTED_STATES = ["reader_offline", "reader_pairing"];
7090
7091
  var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
7091
7092
  constructor() {
7092
7093
  this.labels = inject(UiLabelsService);
@@ -7113,8 +7114,9 @@ var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
7113
7114
  return c && !this.failed() && !this.offline() && SQUARE_TERMINAL_BANNER_STATES.includes(c.readiness.state) ? c.readiness : null;
7114
7115
  }, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
7115
7116
  this.shownState = computed(() => this.shown()?.state ?? "none", ...ngDevMode ? [{ debugName: "shownState" }] : /* istanbul ignore next */ []);
7116
- this.reasonKey = computed(() => readerBannerReasonKey(this.shown()?.reason), ...ngDevMode ? [{ debugName: "reasonKey" }] : /* istanbul ignore next */ []);
7117
- this.message = computed(() => this.labels.t(this.reasonKey() ?? (this.shown()?.state === "merchant_not_ready" ? "squareTerminal.banner.setupFirst" : "squareTerminal.banner.getReader")), ...ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []);
7117
+ this.notConnected = computed(() => SQUARE_TERMINAL_NOT_CONNECTED_STATES.includes(this.shown()?.state), ...ngDevMode ? [{ debugName: "notConnected" }] : /* istanbul ignore next */ []);
7118
+ this.reasonKey = computed(() => this.notConnected() ? null : readerBannerReasonKey(this.shown()?.reason), ...ngDevMode ? [{ debugName: "reasonKey" }] : /* istanbul ignore next */ []);
7119
+ this.message = computed(() => this.labels.t(this.reasonKey() ?? (this.notConnected() ? "squareTerminal.banner.notConnected" : this.shown()?.state === "merchant_not_ready" ? "squareTerminal.banner.setupFirst" : "squareTerminal.banner.getReader")), ...ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []);
7118
7120
  this.destroyRef.onDestroy(() => {
7119
7121
  this.destroyed = true;
7120
7122
  });
@@ -7289,9 +7291,12 @@ var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
7289
7291
  <span class="srb-actions">
7290
7292
  @if (r.state === 'merchant_not_ready') {
7291
7293
  <ui-button variant="link" size="sm" data-testid="reader-banner-setup" (click)="setup.emit()">{{ labels.t(r.reason === 'reconnect_required' ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
7294
+ } @else if (notConnected()) {
7295
+ <!-- a Terminal exists but is not connected (offline, or its pairing code was not entered yet): the ONLY action is to connect it -->
7296
+ <ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('squareTerminal.status.connectYours') }}</ui-button>
7292
7297
  } @else {
7293
- <ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
7294
- <ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(hardwareShopAvailable() ? 'squareTerminal.status.get' : 'squareTerminal.status.getInfo') }}</ui-button>
7298
+ <!-- no Terminal yet: the ONLY action is how to get one (pairing a Terminal the seller already owns lives in the host's Terminals screen, never in this banner) -->
7299
+ <ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t('squareTerminal.status.getInfo') }}</ui-button>
7295
7300
  }
7296
7301
  </span>
7297
7302
  }
@@ -7375,9 +7380,12 @@ i0.ɵɵngDeclareClassMetadata({
7375
7380
  <span class="srb-actions">
7376
7381
  @if (r.state === 'merchant_not_ready') {
7377
7382
  <ui-button variant="link" size="sm" data-testid="reader-banner-setup" (click)="setup.emit()">{{ labels.t(r.reason === 'reconnect_required' ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
7383
+ } @else if (notConnected()) {
7384
+ <!-- a Terminal exists but is not connected (offline, or its pairing code was not entered yet): the ONLY action is to connect it -->
7385
+ <ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('squareTerminal.status.connectYours') }}</ui-button>
7378
7386
  } @else {
7379
- <ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('squareTerminal.status.connect') }}</ui-button>
7380
- <ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(hardwareShopAvailable() ? 'squareTerminal.status.get' : 'squareTerminal.status.getInfo') }}</ui-button>
7387
+ <!-- no Terminal yet: the ONLY action is how to get one (pairing a Terminal the seller already owns lives in the host's Terminals screen, never in this banner) -->
7388
+ <ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t('squareTerminal.status.getInfo') }}</ui-button>
7381
7389
  }
7382
7390
  </span>
7383
7391
  }