@forgeroute/ui 0.5.22 → 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.
- package/fesm2022/forgeroute-ui-column-filter.mjs +2 -2
- package/fesm2022/forgeroute-ui-column-filter.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-combobox.mjs +26 -8
- package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Bado7tzi.mjs → forgeroute-ui-core-ui-labels.es-Dzvm992V.mjs} +9 -6
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Bado7tzi.mjs.map → forgeroute-ui-core-ui-labels.es-Dzvm992V.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui-core.mjs +9 -6
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +2 -0
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs +37 -24
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +28 -14
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-combobox.d.ts +10 -0
- package/types/forgeroute-ui-core.d.ts +12 -9
- package/types/forgeroute-ui-payments.d.ts +1 -1
- package/types/forgeroute-ui-square.d.ts +33 -20
- package/types/forgeroute-ui-stripe.d.ts +25 -16
|
@@ -3115,7 +3115,7 @@ function readerErrorInfo(error) {
|
|
|
3115
3115
|
message: pick(isString, body?.message, e?.message) ?? "",
|
|
3116
3116
|
paymentId: pick(isString, e?.paymentId, body?.paymentId),
|
|
3117
3117
|
terminal: pick(isObject, e?.terminal, body?.terminal),
|
|
3118
|
-
...pick(isString, e?.pairingCode, body?.pairingCode) ? { pairingCode: pick(isString, e?.pairingCode, body?.pairingCode) } : {},
|
|
3118
|
+
...safePairingCode(pick(isString, e?.pairingCode, body?.pairingCode)) ? { pairingCode: safePairingCode(pick(isString, e?.pairingCode, body?.pairingCode)) } : {},
|
|
3119
3119
|
...cents("amountCents"),
|
|
3120
3120
|
...cents("feeCents"),
|
|
3121
3121
|
...cents("platformFeeCents"),
|
|
@@ -3255,6 +3255,11 @@ function isSafeReceiptUrl(url) {
|
|
|
3255
3255
|
return false;
|
|
3256
3256
|
}
|
|
3257
3257
|
}
|
|
3258
|
+
function safePairingCode(value) {
|
|
3259
|
+
if (typeof value !== "string") return null;
|
|
3260
|
+
const code = value.trim();
|
|
3261
|
+
return /^[A-Za-z0-9-]{3,32}$/.test(code) ? code : null;
|
|
3262
|
+
}
|
|
3258
3263
|
function formatElapsed(ms) {
|
|
3259
3264
|
const total = Math.max(0, Math.floor((Number.isFinite(ms) ? ms : 0) / 1e3));
|
|
3260
3265
|
const m = Math.floor(total / 60);
|
|
@@ -3932,17 +3937,15 @@ var SquareTerminalStatusComponent = class SquareTerminalStatusComponent {
|
|
|
3932
3937
|
<p class="srs-text" data-testid="reader-status-text">{{ text() }}</p>
|
|
3933
3938
|
<div class="srs-actions">
|
|
3934
3939
|
@if (state() === 'no_reader' || state() === 'unsupported_only') {
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
}
|
|
3938
|
-
<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>
|
|
3939
3942
|
}
|
|
3940
3943
|
@if (state() === 'merchant_not_ready' || attention()) {
|
|
3941
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>
|
|
3942
3945
|
}
|
|
3943
|
-
@if (state() === 'reader_pairing' && !hideConnect()) {
|
|
3944
|
-
<!--
|
|
3945
|
-
<ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.
|
|
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>
|
|
3946
3949
|
}
|
|
3947
3950
|
@if (state() === 'reader_offline' || state() === 'reader_pairing' || state() === 'checking' || state() === 'attention') {
|
|
3948
3951
|
<ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
|
|
@@ -4071,17 +4074,15 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4071
4074
|
<p class="srs-text" data-testid="reader-status-text">{{ text() }}</p>
|
|
4072
4075
|
<div class="srs-actions">
|
|
4073
4076
|
@if (state() === 'no_reader' || state() === 'unsupported_only') {
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
}
|
|
4077
|
-
<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>
|
|
4078
4079
|
}
|
|
4079
4080
|
@if (state() === 'merchant_not_ready' || attention()) {
|
|
4080
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>
|
|
4081
4082
|
}
|
|
4082
|
-
@if (state() === 'reader_pairing' && !hideConnect()) {
|
|
4083
|
-
<!--
|
|
4084
|
-
<ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('squareTerminal.status.
|
|
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>
|
|
4085
4086
|
}
|
|
4086
4087
|
@if (state() === 'reader_offline' || state() === 'reader_pairing' || state() === 'checking' || state() === 'attention') {
|
|
4087
4088
|
<ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
|
|
@@ -4189,7 +4190,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4189
4190
|
const SQUARE_TERMINAL_NO_READER_STATES = [
|
|
4190
4191
|
"no_reader",
|
|
4191
4192
|
"unsupported_only",
|
|
4192
|
-
"merchant_not_ready"
|
|
4193
|
+
"merchant_not_ready",
|
|
4194
|
+
"reader_offline",
|
|
4195
|
+
"reader_pairing"
|
|
4193
4196
|
];
|
|
4194
4197
|
var SquareTerminalPaymentComponent = class SquareTerminalPaymentComponent {
|
|
4195
4198
|
constructor() {
|
|
@@ -7080,8 +7083,11 @@ function squareTerminalBannerConfig(config) {
|
|
|
7080
7083
|
const SQUARE_TERMINAL_BANNER_STATES = [
|
|
7081
7084
|
"no_reader",
|
|
7082
7085
|
"unsupported_only",
|
|
7083
|
-
"merchant_not_ready"
|
|
7086
|
+
"merchant_not_ready",
|
|
7087
|
+
"reader_offline",
|
|
7088
|
+
"reader_pairing"
|
|
7084
7089
|
];
|
|
7090
|
+
const SQUARE_TERMINAL_NOT_CONNECTED_STATES = ["reader_offline", "reader_pairing"];
|
|
7085
7091
|
var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
|
|
7086
7092
|
constructor() {
|
|
7087
7093
|
this.labels = inject(UiLabelsService);
|
|
@@ -7108,8 +7114,9 @@ var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
|
|
|
7108
7114
|
return c && !this.failed() && !this.offline() && SQUARE_TERMINAL_BANNER_STATES.includes(c.readiness.state) ? c.readiness : null;
|
|
7109
7115
|
}, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
7110
7116
|
this.shownState = computed(() => this.shown()?.state ?? "none", ...ngDevMode ? [{ debugName: "shownState" }] : /* istanbul ignore next */ []);
|
|
7111
|
-
this.
|
|
7112
|
-
this.
|
|
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 */ []);
|
|
7113
7120
|
this.destroyRef.onDestroy(() => {
|
|
7114
7121
|
this.destroyed = true;
|
|
7115
7122
|
});
|
|
@@ -7284,9 +7291,12 @@ var SquareTerminalBannerComponent = class SquareTerminalBannerComponent {
|
|
|
7284
7291
|
<span class="srb-actions">
|
|
7285
7292
|
@if (r.state === 'merchant_not_ready') {
|
|
7286
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>
|
|
7287
7297
|
} @else {
|
|
7288
|
-
|
|
7289
|
-
<ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(
|
|
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>
|
|
7290
7300
|
}
|
|
7291
7301
|
</span>
|
|
7292
7302
|
}
|
|
@@ -7370,9 +7380,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
7370
7380
|
<span class="srb-actions">
|
|
7371
7381
|
@if (r.state === 'merchant_not_ready') {
|
|
7372
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>
|
|
7373
7386
|
} @else {
|
|
7374
|
-
|
|
7375
|
-
<ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(
|
|
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>
|
|
7376
7389
|
}
|
|
7377
7390
|
</span>
|
|
7378
7391
|
}
|
|
@@ -8326,7 +8339,7 @@ var SquareTerminalPairingComponent = class SquareTerminalPairingComponent {
|
|
|
8326
8339
|
...location ? { locationId: location } : {}
|
|
8327
8340
|
}));
|
|
8328
8341
|
if (this.destroyed || run !== this.run) return;
|
|
8329
|
-
const code =
|
|
8342
|
+
const code = safePairingCode(reader?.pairingCode) ?? "";
|
|
8330
8343
|
if (!reader || typeof reader.id !== "string" || !code) throw Object.assign(/* @__PURE__ */ new Error("no pairing code"), { code: "no_pairing_code" });
|
|
8331
8344
|
this.registered = {
|
|
8332
8345
|
id: reader.id,
|