@forgeroute/ui 0.5.18 → 0.5.20
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-boards.mjs +2 -2
- package/fesm2022/forgeroute-ui-boards.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-chip.mjs +25 -6
- package/fesm2022/forgeroute-ui-chip.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Woi3az70.mjs → forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs} +37 -10
- package/fesm2022/forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-core.mjs +94 -19
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +217 -26
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +19 -2
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-more-menu.mjs +61 -8
- package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs +2 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +870 -57
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +815 -49
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +2 -6
- package/types/forgeroute-ui-chip.d.ts +11 -1
- package/types/forgeroute-ui-core.d.ts +65 -12
- package/types/forgeroute-ui-data-table-core.d.ts +60 -1
- package/types/forgeroute-ui-messaging.d.ts +15 -5
- package/types/forgeroute-ui-more-menu.d.ts +7 -0
- package/types/forgeroute-ui-payments.d.ts +332 -8
- package/types/forgeroute-ui-quickbooks.d.ts +2 -2
- package/types/forgeroute-ui-square.d.ts +1 -1
- package/types/forgeroute-ui-stripe.d.ts +293 -20
- package/types/forgeroute-ui-table-types.d.ts +29 -0
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Woi3az70.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, Injector, TemplateRef, ViewEncapsulation, afterNextRender, computed, contentChild, contentChildren, effect, forwardRef, inject, input, isDevMode, output, signal, untracked, viewChildren } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, InjectionToken, Injector, TemplateRef, ViewContainerRef, ViewEncapsulation, afterNextRender, computed, contentChild, contentChildren, effect, forwardRef, inject, input, isDevMode, output, reflectComponentType, signal, untracked, viewChildren } from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/forms";
|
|
4
4
|
import { FormsModule } from "@angular/forms";
|
|
5
5
|
import { CheckboxComponent } from "@forgeroute/ui/checkbox";
|
|
@@ -764,6 +764,14 @@ var PaymentCustomMethodComponent = class PaymentCustomMethodComponent extends Pa
|
|
|
764
764
|
label: this.label()
|
|
765
765
|
}], ...ngDevMode ? [{ debugName: "methods" }] : /* istanbul ignore next */ []);
|
|
766
766
|
this.template = computed(() => this.body(), ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
|
|
767
|
+
this.checkPendingFn = input(null, {
|
|
768
|
+
...ngDevMode ? { debugName: "checkPendingFn" } : /* istanbul ignore next */ {},
|
|
769
|
+
alias: "checkPending"
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
checkPending(info) {
|
|
773
|
+
const fn = this.checkPendingFn();
|
|
774
|
+
return fn ? fn(info) : { state: "checking" };
|
|
767
775
|
}
|
|
768
776
|
static {
|
|
769
777
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -796,6 +804,13 @@ var PaymentCustomMethodComponent = class PaymentCustomMethodComponent extends Pa
|
|
|
796
804
|
isSignal: true,
|
|
797
805
|
isRequired: true,
|
|
798
806
|
transformFunction: null
|
|
807
|
+
},
|
|
808
|
+
checkPendingFn: {
|
|
809
|
+
classPropertyName: "checkPendingFn",
|
|
810
|
+
publicName: "checkPending",
|
|
811
|
+
isSignal: true,
|
|
812
|
+
isRequired: false,
|
|
813
|
+
transformFunction: null
|
|
799
814
|
}
|
|
800
815
|
},
|
|
801
816
|
host: { styleAttribute: "display: none" },
|
|
@@ -857,10 +872,63 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
857
872
|
body: [{
|
|
858
873
|
type: i0.ContentChild,
|
|
859
874
|
args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
|
|
875
|
+
}],
|
|
876
|
+
checkPendingFn: [{
|
|
877
|
+
type: i0.Input,
|
|
878
|
+
args: [{
|
|
879
|
+
isSignal: true,
|
|
880
|
+
alias: "checkPending",
|
|
881
|
+
required: false
|
|
882
|
+
}]
|
|
860
883
|
}]
|
|
861
884
|
}
|
|
862
885
|
});
|
|
863
886
|
let nextId = 0;
|
|
887
|
+
var PspBannerHostDirective = class PspBannerHostDirective {
|
|
888
|
+
constructor() {
|
|
889
|
+
this.panel = inject(PaymentSidePanelComponent);
|
|
890
|
+
this.container = inject(ViewContainerRef);
|
|
891
|
+
}
|
|
892
|
+
ngOnInit() {
|
|
893
|
+
this.panel.attachBannerHost(this.container);
|
|
894
|
+
}
|
|
895
|
+
ngOnDestroy() {
|
|
896
|
+
this.panel.detachBannerHost(this.container);
|
|
897
|
+
}
|
|
898
|
+
static {
|
|
899
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
900
|
+
minVersion: "12.0.0",
|
|
901
|
+
version: "22.2.2",
|
|
902
|
+
ngImport: i0,
|
|
903
|
+
type: PspBannerHostDirective,
|
|
904
|
+
deps: [],
|
|
905
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
static {
|
|
909
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
910
|
+
minVersion: "14.0.0",
|
|
911
|
+
version: "22.2.2",
|
|
912
|
+
type: PspBannerHostDirective,
|
|
913
|
+
isStandalone: true,
|
|
914
|
+
selector: "[pspBannerHost]",
|
|
915
|
+
ngImport: i0
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
920
|
+
minVersion: "12.0.0",
|
|
921
|
+
version: "22.2.2",
|
|
922
|
+
ngImport: i0,
|
|
923
|
+
type: PspBannerHostDirective,
|
|
924
|
+
decorators: [{
|
|
925
|
+
type: Directive,
|
|
926
|
+
args: [{
|
|
927
|
+
selector: "[pspBannerHost]",
|
|
928
|
+
standalone: true
|
|
929
|
+
}]
|
|
930
|
+
}]
|
|
931
|
+
});
|
|
864
932
|
var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
865
933
|
kindOf(value) {
|
|
866
934
|
if (!value) return "none";
|
|
@@ -871,9 +939,11 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
871
939
|
constructor() {
|
|
872
940
|
this.labels = inject(UiLabelsService);
|
|
873
941
|
this.injector = inject(Injector);
|
|
942
|
+
this.destroyRef = inject(DestroyRef);
|
|
874
943
|
this.hostEl = inject(ElementRef);
|
|
875
944
|
this.ids = `psp-${nextId++}`;
|
|
876
945
|
this.customMode = ALLOCATION_CUSTOM;
|
|
946
|
+
this.destroyHook = inject(DestroyRef).onDestroy(() => this.onDestroyed());
|
|
877
947
|
this.open = input(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
878
948
|
this.titleInput = input(null, {
|
|
879
949
|
...ngDevMode ? { debugName: "titleInput" } : /* istanbul ignore next */ {},
|
|
@@ -910,7 +980,11 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
910
980
|
alias: "splitSubmitLabel"
|
|
911
981
|
});
|
|
912
982
|
this.splitSubmitLabel = computed(() => this.splitSubmitLabelInput() ?? this.labels.t("paymentSidePanel.splitSubmitLabel"), ...ngDevMode ? [{ debugName: "splitSubmitLabel" }] : /* istanbul ignore next */ []);
|
|
983
|
+
this.blocked = input(false, ...ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []);
|
|
984
|
+
this.blockedReason = input("", ...ngDevMode ? [{ debugName: "blockedReason" }] : /* istanbul ignore next */ []);
|
|
913
985
|
this.recordPayment = input(null, ...ngDevMode ? [{ debugName: "recordPayment" }] : /* istanbul ignore next */ []);
|
|
986
|
+
this.defaultMethod = input("", ...ngDevMode ? [{ debugName: "defaultMethod" }] : /* istanbul ignore next */ []);
|
|
987
|
+
this.readerBanner = input(null, ...ngDevMode ? [{ debugName: "readerBanner" }] : /* istanbul ignore next */ []);
|
|
914
988
|
this.listReaders = input(null, ...ngDevMode ? [{ debugName: "listReaders" }] : /* istanbul ignore next */ []);
|
|
915
989
|
this.startTerminalPayment = input(null, ...ngDevMode ? [{ debugName: "startTerminalPayment" }] : /* istanbul ignore next */ []);
|
|
916
990
|
this.terminalStatus = input(null, ...ngDevMode ? [{ debugName: "terminalStatus" }] : /* istanbul ignore next */ []);
|
|
@@ -933,11 +1007,20 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
933
1007
|
this.closed = output();
|
|
934
1008
|
this.recorded = output();
|
|
935
1009
|
this.outcome = output();
|
|
1010
|
+
this.busyChange = output();
|
|
1011
|
+
this.leftPending = output();
|
|
1012
|
+
this.readerConnect = output();
|
|
1013
|
+
this.readerOrder = output();
|
|
1014
|
+
this.readerSetup = output();
|
|
1015
|
+
this.readerState = output();
|
|
1016
|
+
this.lastReaderStateSignal = signal(null, ...ngDevMode ? [{ debugName: "lastReaderStateSignal" }] : /* istanbul ignore next */ []);
|
|
1017
|
+
this.lastReaderState = this.lastReaderStateSignal.asReadonly();
|
|
936
1018
|
this.plugins = contentChildren(PAYMENT_METHOD_PLUGIN, {
|
|
937
1019
|
...ngDevMode ? { debugName: "plugins" } : /* istanbul ignore next */ {},
|
|
938
1020
|
descendants: true
|
|
939
1021
|
});
|
|
940
1022
|
this.fields = viewChildren(UiFieldValidity, ...ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []);
|
|
1023
|
+
this.bannerHost = signal(void 0, ...ngDevMode ? [{ debugName: "bannerHost" }] : /* istanbul ignore next */ []);
|
|
941
1024
|
this.method = signal("", ...ngDevMode ? [{ debugName: "method" }] : /* istanbul ignore next */ []);
|
|
942
1025
|
this.amount = signal(null, ...ngDevMode ? [{ debugName: "amount" }] : /* istanbul ignore next */ []);
|
|
943
1026
|
this.receivedDate = signal("", ...ngDevMode ? [{ debugName: "receivedDate" }] : /* istanbul ignore next */ []);
|
|
@@ -959,7 +1042,22 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
959
1042
|
this.closeGuard = null;
|
|
960
1043
|
this.liveMethodValue = "";
|
|
961
1044
|
this.completed = false;
|
|
1045
|
+
this.held = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "held" }] : /* istanbul ignore next */ []);
|
|
1046
|
+
this.heldChecking = signal(false, ...ngDevMode ? [{ debugName: "heldChecking" }] : /* istanbul ignore next */ []);
|
|
1047
|
+
this.heldResult = signal("", ...ngDevMode ? [{ debugName: "heldResult" }] : /* istanbul ignore next */ []);
|
|
1048
|
+
this.heldInconclusive = signal(false, ...ngDevMode ? [{ debugName: "heldInconclusive" }] : /* istanbul ignore next */ []);
|
|
1049
|
+
this.heldCanRetryCancel = computed(() => !!this.held().get("terminal")?.cancelFailed && !!this.cancelTerminal(), ...ngDevMode ? [{ debugName: "heldCanRetryCancel" }] : /* istanbul ignore next */ []);
|
|
1050
|
+
this.recordsInFlight = 0;
|
|
1051
|
+
this.unrecordedInFlight = /* @__PURE__ */ new Set();
|
|
1052
|
+
this.recordingNow = /* @__PURE__ */ new Set();
|
|
1053
|
+
this.pluginEpoch = signal(0, ...ngDevMode ? [{ debugName: "pluginEpoch" }] : /* istanbul ignore next */ []);
|
|
1054
|
+
this.bannerRef = null;
|
|
1055
|
+
this.bannerHostUsed = null;
|
|
1056
|
+
this.bannerComponentUsed = null;
|
|
1057
|
+
this.bannerInputs = null;
|
|
1058
|
+
this.defaultMethodDone = false;
|
|
962
1059
|
this.verificationReported = false;
|
|
1060
|
+
this.takenReported = false;
|
|
963
1061
|
this.readers = signal([], ...ngDevMode ? [{ debugName: "readers" }] : /* istanbul ignore next */ []);
|
|
964
1062
|
this.readersLoaded = signal(false, ...ngDevMode ? [{ debugName: "readersLoaded" }] : /* istanbul ignore next */ []);
|
|
965
1063
|
this.loadingReaders = signal(false, ...ngDevMode ? [{ debugName: "loadingReaders" }] : /* istanbul ignore next */ []);
|
|
@@ -979,8 +1077,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
979
1077
|
this.successTimer = null;
|
|
980
1078
|
this.pendingTerminalResult = null;
|
|
981
1079
|
this.terminalContext = null;
|
|
982
|
-
this.busy = computed(() => this.pluginBusy() || this.terminalPhase() !== "idle" || this.sendingToReader() || this.retrying(), ...ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []);
|
|
1080
|
+
this.busy = computed(() => this.pluginBusy() || this.terminalPhase() !== "idle" || this.sendingToReader() || this.retrying() || !!this.retryIntentId() || this.submitting(), ...ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []);
|
|
1081
|
+
this.busyOut = computed(() => this.busy() || this.held().size > 0, ...ngDevMode ? [{ debugName: "busyOut" }] : /* istanbul ignore next */ []);
|
|
983
1082
|
this.locked = computed(() => this.busy() || this.submitting() || !!this.retryIntentId(), ...ngDevMode ? [{ debugName: "locked" }] : /* istanbul ignore next */ []);
|
|
1083
|
+
this.blockedText = computed(() => this.blockedReason().trim() || this.labels.t("paymentBlocked.default"), ...ngDevMode ? [{ debugName: "blockedText" }] : /* istanbul ignore next */ []);
|
|
1084
|
+
this.holding = computed(() => this.held().size > 0, ...ngDevMode ? [{ debugName: "holding" }] : /* istanbul ignore next */ []);
|
|
1085
|
+
this.heldText = computed(() => this.labels.t("paymentHeld.default"), ...ngDevMode ? [{ debugName: "heldText" }] : /* istanbul ignore next */ []);
|
|
1086
|
+
this.startBlocked = computed(() => this.blocked() || this.holding(), ...ngDevMode ? [{ debugName: "startBlocked" }] : /* istanbul ignore next */ []);
|
|
984
1087
|
this.dateMax = computed(() => this.maxDate() || this.today(), ...ngDevMode ? [{ debugName: "dateMax" }] : /* istanbul ignore next */ []);
|
|
985
1088
|
this.money = (value) => formatCurrency(value, {
|
|
986
1089
|
currency: this.currency(),
|
|
@@ -1058,6 +1161,9 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1058
1161
|
this.selectedReader = computed(() => this.readers().find((r) => r.id === this.readerId()) ?? null, ...ngDevMode ? [{ debugName: "selectedReader" }] : /* istanbul ignore next */ []);
|
|
1059
1162
|
this.canSendToReader = computed(() => !!this.readerId() && this.selectedReader()?.status === "online" && this.amountValid() && !!this.receivedDate() && !this.sendingToReader() && !this.hasInvalid(), ...ngDevMode ? [{ debugName: "canSendToReader" }] : /* istanbul ignore next */ []);
|
|
1060
1163
|
this.pluginTemplate = computed(() => this.liveMethods().get(this.method())?.plugin.template(), ...ngDevMode ? [{ debugName: "pluginTemplate" }] : /* istanbul ignore next */ []);
|
|
1164
|
+
this.bannerComponent = computed(() => this.readerBanner()?.component ?? this.plugins().find((p) => !!p.readerBannerComponent)?.readerBannerComponent ?? null, ...ngDevMode ? [{ debugName: "bannerComponent" }] : /* istanbul ignore next */ []);
|
|
1165
|
+
this.showTopBanner = computed(() => this.bannerMounted() && !this.exclusive(), ...ngDevMode ? [{ debugName: "showTopBanner" }] : /* istanbul ignore next */ []);
|
|
1166
|
+
this.bannerMounted = computed(() => this.open() && !!this.readerBanner() && !!this.bannerComponent(), ...ngDevMode ? [{ debugName: "bannerMounted" }] : /* istanbul ignore next */ []);
|
|
1061
1167
|
this.pluginContext = computed(() => ({ $implicit: this.buildContext() }), ...ngDevMode ? [{ debugName: "pluginContext" }] : /* istanbul ignore next */ []);
|
|
1062
1168
|
this.primaryLabel = computed(() => {
|
|
1063
1169
|
if (!this.open()) return "";
|
|
@@ -1069,9 +1175,11 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1069
1175
|
}, ...ngDevMode ? [{ debugName: "primaryLabel" }] : /* istanbul ignore next */ []);
|
|
1070
1176
|
this.primaryLoading = computed(() => this.kind() === "live" ? !!this.pluginPrimary()?.loading : this.submitting(), ...ngDevMode ? [{ debugName: "primaryLoading" }] : /* istanbul ignore next */ []);
|
|
1071
1177
|
this.primaryDisabled = computed(() => {
|
|
1072
|
-
if (this.kind() === "live") return !!this.pluginPrimary()?.disabled;
|
|
1178
|
+
if (this.kind() === "live") return this.startBlocked() && !this.exclusive() || !!this.pluginPrimary()?.disabled;
|
|
1179
|
+
if (this.startBlocked()) return true;
|
|
1073
1180
|
return this.submitting() || this.touched() && this.hasInvalid();
|
|
1074
1181
|
}, ...ngDevMode ? [{ debugName: "primaryDisabled" }] : /* istanbul ignore next */ []);
|
|
1182
|
+
this.lastBusy = false;
|
|
1075
1183
|
this.destroyed = false;
|
|
1076
1184
|
effect(() => {
|
|
1077
1185
|
const isOpen = this.open();
|
|
@@ -1102,10 +1210,120 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1102
1210
|
const visible = this.kind() === "terminal";
|
|
1103
1211
|
untracked(() => visible ? this.startTerminalSession() : this.stopReaderRefresh());
|
|
1104
1212
|
});
|
|
1105
|
-
|
|
1213
|
+
effect(() => {
|
|
1214
|
+
const wanted = this.defaultMethod();
|
|
1215
|
+
const list = this.methodList();
|
|
1216
|
+
const isOpen = this.open();
|
|
1217
|
+
untracked(() => {
|
|
1218
|
+
if (!isOpen || this.defaultMethodDone || !wanted || this.method()) return;
|
|
1219
|
+
if (!list.some((o) => o.value === wanted)) return;
|
|
1220
|
+
this.defaultMethodDone = true;
|
|
1221
|
+
this.method.set(wanted);
|
|
1222
|
+
});
|
|
1223
|
+
});
|
|
1224
|
+
effect(() => {
|
|
1225
|
+
const host = this.bannerHost();
|
|
1226
|
+
const config = this.readerBanner();
|
|
1227
|
+
const component = this.bannerComponent();
|
|
1228
|
+
const visible = this.showTopBanner();
|
|
1229
|
+
untracked(() => this.syncBanner(host, config, component, visible));
|
|
1230
|
+
});
|
|
1231
|
+
effect(() => {
|
|
1232
|
+
const kind = this.kind();
|
|
1233
|
+
const info = this.held().get("plugin");
|
|
1234
|
+
untracked(() => {
|
|
1235
|
+
if (kind !== "live" || !info || info.autoChecked || info.method !== this.method()) return;
|
|
1236
|
+
info.autoChecked = true;
|
|
1237
|
+
this.checkHeld(["plugin"]);
|
|
1238
|
+
});
|
|
1239
|
+
});
|
|
1240
|
+
effect(() => {
|
|
1241
|
+
const wanted = this.open() && !!this.readerBanner() && !this.bannerComponent();
|
|
1242
|
+
untracked(() => {
|
|
1243
|
+
if (wanted && isDevMode()) console.warn("ui-payment-side-panel: readerBanner is set but no banner component is available (render ui-payment-stripe-method in the panel or build the config with stripeReaderBannerConfig)");
|
|
1244
|
+
});
|
|
1245
|
+
});
|
|
1246
|
+
this.destroyRef.onDestroy(() => this.destroyBanner());
|
|
1247
|
+
effect(() => {
|
|
1248
|
+
const busy = this.busyOut();
|
|
1249
|
+
untracked(() => this.emitBusy(busy));
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
onDestroyed() {
|
|
1253
|
+
try {
|
|
1254
|
+
this.cleanup("destroyed");
|
|
1255
|
+
} finally {
|
|
1106
1256
|
this.destroyed = true;
|
|
1107
|
-
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
openKind() {
|
|
1260
|
+
if (this.submitting()) return "recording";
|
|
1261
|
+
if (this.retrying() || !!this.retryIntentId() || this.terminalPhase() === "confirming") return "unrecorded";
|
|
1262
|
+
if (this.sendingToReader() || this.terminalPhase() === "waiting") return "terminal";
|
|
1263
|
+
if (this.pluginBusy()) return "plugin";
|
|
1264
|
+
return null;
|
|
1265
|
+
}
|
|
1266
|
+
holdPending(reason, kind, extra) {
|
|
1267
|
+
const existing = this.held().get(kind);
|
|
1268
|
+
if (existing) {
|
|
1269
|
+
if (extra?.paymentIntentId && !existing.paymentIntentId) existing.paymentIntentId = extra.paymentIntentId;
|
|
1270
|
+
if (extra?.readerId && !existing.readerId) existing.readerId = extra.readerId;
|
|
1271
|
+
if (extra?.context) existing.context = extra.context;
|
|
1272
|
+
if (extra?.paymentAttemptKey && !existing.paymentAttemptKey) existing.paymentAttemptKey = extra.paymentAttemptKey;
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
const key = extra?.paymentAttemptKey ?? this.lastAttemptKey;
|
|
1276
|
+
const info = {
|
|
1277
|
+
reason,
|
|
1278
|
+
method: this.method(),
|
|
1279
|
+
since: Date.now(),
|
|
1280
|
+
cancelFailed: false,
|
|
1281
|
+
autoChecked: false,
|
|
1282
|
+
...key ? { paymentAttemptKey: key } : {},
|
|
1283
|
+
...extra?.paymentIntentId ? { paymentIntentId: extra.paymentIntentId } : {},
|
|
1284
|
+
...extra?.readerId ? { readerId: extra.readerId } : {},
|
|
1285
|
+
...extra?.context ? { context: extra.context } : {}
|
|
1286
|
+
};
|
|
1287
|
+
this.held.update((map) => {
|
|
1288
|
+
const next = new Map(map);
|
|
1289
|
+
next.set(kind, info);
|
|
1290
|
+
return next;
|
|
1108
1291
|
});
|
|
1292
|
+
this.heldInconclusive.set(false);
|
|
1293
|
+
this.heldResult.set("");
|
|
1294
|
+
try {
|
|
1295
|
+
this.leftPending.emit({
|
|
1296
|
+
reason,
|
|
1297
|
+
kind,
|
|
1298
|
+
method: this.method(),
|
|
1299
|
+
...key ? { paymentAttemptKey: key } : {},
|
|
1300
|
+
...extra?.paymentIntentId ? { paymentIntentId: extra.paymentIntentId } : {}
|
|
1301
|
+
});
|
|
1302
|
+
} catch {}
|
|
1303
|
+
}
|
|
1304
|
+
clearHeld(...kinds) {
|
|
1305
|
+
if (this.held().size === 0) return;
|
|
1306
|
+
this.held.update((map) => new Map([...map].filter(([k]) => kinds.length > 0 && !kinds.includes(k))));
|
|
1307
|
+
if (this.held().size === 0) {
|
|
1308
|
+
this.heldInconclusive.set(false);
|
|
1309
|
+
this.heldResult.set("");
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
releasePending() {
|
|
1313
|
+
this.unrecordedInFlight.clear();
|
|
1314
|
+
this.lastAttemptKey = void 0;
|
|
1315
|
+
this.clearHeld();
|
|
1316
|
+
}
|
|
1317
|
+
abandonPlugin(reason, paymentAttemptKey) {
|
|
1318
|
+
if (!this.pluginBusy()) return;
|
|
1319
|
+
this.holdPending(reason, "plugin", paymentAttemptKey ? { paymentAttemptKey } : void 0);
|
|
1320
|
+
this.pluginBusy.set(false);
|
|
1321
|
+
this.pluginEpoch.update((n) => n + 1);
|
|
1322
|
+
}
|
|
1323
|
+
emitBusy(busy) {
|
|
1324
|
+
if (busy === this.lastBusy || this.destroyed) return;
|
|
1325
|
+
this.lastBusy = busy;
|
|
1326
|
+
this.busyChange.emit(busy);
|
|
1109
1327
|
}
|
|
1110
1328
|
init() {
|
|
1111
1329
|
this.resetForm();
|
|
@@ -1118,7 +1336,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1118
1336
|
this.resetForm();
|
|
1119
1337
|
}
|
|
1120
1338
|
resetForm() {
|
|
1339
|
+
this.abandonPlugin("reset");
|
|
1340
|
+
this.reportTakenNotDone("reset");
|
|
1341
|
+
this.takenReported = false;
|
|
1121
1342
|
this.session++;
|
|
1343
|
+
this.pluginEpoch.update((n) => n + 1);
|
|
1344
|
+
this.lastAttemptKey = void 0;
|
|
1345
|
+
this.defaultMethodDone = false;
|
|
1122
1346
|
this.method.set("");
|
|
1123
1347
|
this.amount.set(null);
|
|
1124
1348
|
this.receivedDate.set(this.today());
|
|
@@ -1140,16 +1364,28 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1140
1364
|
this.verificationReported = false;
|
|
1141
1365
|
this.resetTerminal();
|
|
1142
1366
|
}
|
|
1143
|
-
dropPendingRetry() {
|
|
1367
|
+
dropPendingRetry(reason = "method-changed") {
|
|
1144
1368
|
const context = this.retryContext;
|
|
1145
1369
|
if (!this.retryIntentId() || !context) {
|
|
1146
1370
|
this.retryIntentId.set("");
|
|
1147
1371
|
this.retryContext = null;
|
|
1148
1372
|
return;
|
|
1149
1373
|
}
|
|
1374
|
+
const retrying = this.retrying();
|
|
1150
1375
|
this.retryIntentId.set("");
|
|
1151
1376
|
this.retryContext = null;
|
|
1152
|
-
if (
|
|
1377
|
+
if (retrying) {
|
|
1378
|
+
this.unrecordedInFlight.add(context.paymentIntentId);
|
|
1379
|
+
this.holdPending(reason, "unrecorded", {
|
|
1380
|
+
paymentIntentId: context.paymentIntentId,
|
|
1381
|
+
context
|
|
1382
|
+
});
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
this.holdPending(reason, "unrecorded", {
|
|
1386
|
+
paymentIntentId: context.paymentIntentId,
|
|
1387
|
+
context
|
|
1388
|
+
});
|
|
1153
1389
|
this.outcome.emit({
|
|
1154
1390
|
kind: "failed",
|
|
1155
1391
|
stage: "terminal",
|
|
@@ -1159,13 +1395,33 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1159
1395
|
})
|
|
1160
1396
|
});
|
|
1161
1397
|
}
|
|
1162
|
-
cleanup() {
|
|
1398
|
+
cleanup(reason = "closed") {
|
|
1163
1399
|
this.session++;
|
|
1164
|
-
this.
|
|
1400
|
+
const open = this.openKind();
|
|
1401
|
+
const takenContext = this.terminalContext ?? this.retryContext ?? void 0;
|
|
1402
|
+
const intentId = takenContext?.paymentIntentId;
|
|
1403
|
+
this.dropPendingRetry(reason);
|
|
1404
|
+
if (this.submitting()) this.holdPending(reason, "recording");
|
|
1405
|
+
this.abandonPlugin(reason);
|
|
1165
1406
|
this.runCancelHook();
|
|
1407
|
+
this.reportTakenNotDone(reason);
|
|
1408
|
+
if (this.sendingToReader()) this.holdPending(reason, "terminal");
|
|
1166
1409
|
this.sendingToReader.set(false);
|
|
1167
|
-
if (this.terminalPhase() === "confirming")
|
|
1410
|
+
if (this.terminalPhase() === "confirming") {
|
|
1411
|
+
if (intentId) this.unrecordedInFlight.add(intentId);
|
|
1412
|
+
this.holdPending(reason, "unrecorded", {
|
|
1413
|
+
paymentIntentId: intentId,
|
|
1414
|
+
context: takenContext
|
|
1415
|
+
});
|
|
1416
|
+
this.terminalPhase.set("idle");
|
|
1417
|
+
}
|
|
1168
1418
|
if (this.terminalPhase() === "waiting") {
|
|
1419
|
+
this.holdPending(reason, "terminal", {
|
|
1420
|
+
paymentIntentId: this.terminalContext?.paymentIntentId,
|
|
1421
|
+
readerId: this.readerId() || void 0,
|
|
1422
|
+
context: this.terminalContext ?? void 0
|
|
1423
|
+
});
|
|
1424
|
+
this.markCancelFailed();
|
|
1169
1425
|
if (this.readerId()) this.fireCancelReader(this.readerId());
|
|
1170
1426
|
this.terminalPhase.set("idle");
|
|
1171
1427
|
}
|
|
@@ -1176,6 +1432,21 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1176
1432
|
this.successTimer = null;
|
|
1177
1433
|
}
|
|
1178
1434
|
this.finishTerminal();
|
|
1435
|
+
if (open && this.held().size === 0) this.holdPending(reason, open, open === "terminal" || open === "unrecorded" ? { paymentIntentId: intentId } : void 0);
|
|
1436
|
+
}
|
|
1437
|
+
reportTakenNotDone(reason) {
|
|
1438
|
+
if (!this.exclusive() || this.completed || this.takenReported) return;
|
|
1439
|
+
this.takenReported = true;
|
|
1440
|
+
this.holdPending(reason, "unrecorded");
|
|
1441
|
+
try {
|
|
1442
|
+
this.outcome.emit({
|
|
1443
|
+
kind: "plugin",
|
|
1444
|
+
method: this.method(),
|
|
1445
|
+
code: "closed-before-done",
|
|
1446
|
+
message: this.labels.t("paymentHeld.closedBeforeDone"),
|
|
1447
|
+
...this.lastAttemptKey ? { attemptKey: this.lastAttemptKey } : {}
|
|
1448
|
+
});
|
|
1449
|
+
} catch {}
|
|
1179
1450
|
}
|
|
1180
1451
|
onClose() {
|
|
1181
1452
|
if (this.closeGuard) {
|
|
@@ -1187,7 +1458,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1187
1458
|
}
|
|
1188
1459
|
if (!allowed) return;
|
|
1189
1460
|
}
|
|
1190
|
-
this.cleanup();
|
|
1461
|
+
this.cleanup("closed");
|
|
1191
1462
|
this.closed.emit();
|
|
1192
1463
|
}
|
|
1193
1464
|
runCancelHook() {
|
|
@@ -1202,17 +1473,21 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1202
1473
|
const next = value ?? "";
|
|
1203
1474
|
if (next === this.method()) return;
|
|
1204
1475
|
this.runCancelHook();
|
|
1205
|
-
this.cancelTerminalIfWaiting();
|
|
1206
|
-
this.
|
|
1476
|
+
this.cancelTerminalIfWaiting("method-changed");
|
|
1477
|
+
this.abandonPlugin("method-changed");
|
|
1478
|
+
this.defaultMethodDone = true;
|
|
1479
|
+
this.reportTakenNotDone("method-changed");
|
|
1480
|
+
this.takenReported = false;
|
|
1207
1481
|
this.exclusive.set(false);
|
|
1208
1482
|
this.pluginPrimary.set(null);
|
|
1209
1483
|
this.terminalError.set("");
|
|
1210
|
-
this.dropPendingRetry();
|
|
1484
|
+
this.dropPendingRetry("method-changed");
|
|
1211
1485
|
this.submitError.set("");
|
|
1212
1486
|
this.reference.set("");
|
|
1213
1487
|
this.method.set(next);
|
|
1214
1488
|
}
|
|
1215
1489
|
selectSaved(saved) {
|
|
1490
|
+
if (this.blocked() || this.busy() || this.submitting() || this.retryIntentId()) return;
|
|
1216
1491
|
this.onMethodChange(saved.method);
|
|
1217
1492
|
this.reference.set(saved.last4);
|
|
1218
1493
|
}
|
|
@@ -1325,11 +1600,16 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1325
1600
|
};
|
|
1326
1601
|
}
|
|
1327
1602
|
onPrimary() {
|
|
1328
|
-
if (this.kind() === "live")
|
|
1329
|
-
|
|
1603
|
+
if (this.kind() === "live") {
|
|
1604
|
+
if (this.startBlocked() && !this.exclusive()) return;
|
|
1605
|
+
this.pluginPrimary()?.onClick();
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
if (this.startBlocked()) return;
|
|
1609
|
+
this.submit();
|
|
1330
1610
|
}
|
|
1331
1611
|
async submit() {
|
|
1332
|
-
if (this.submitting() || this.busy() || this.kind() === "live" || this.kind() === "terminal") return;
|
|
1612
|
+
if (this.startBlocked() || this.submitting() || this.busy() || this.kind() === "live" || this.kind() === "terminal") return;
|
|
1333
1613
|
this.touched.set(true);
|
|
1334
1614
|
if (this.hasInvalid()) return;
|
|
1335
1615
|
const payload = this.buildPayload();
|
|
@@ -1347,13 +1627,21 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1347
1627
|
this.submitting.set(true);
|
|
1348
1628
|
this.submitError.set("");
|
|
1349
1629
|
this.announcement.set(this.labels.t("paymentSidePanel.announceRecording"));
|
|
1630
|
+
const session = this.session;
|
|
1631
|
+
this.recordsInFlight++;
|
|
1350
1632
|
try {
|
|
1351
1633
|
await callHost(() => record(payload));
|
|
1352
1634
|
} catch (err) {
|
|
1635
|
+
this.recordsInFlight = Math.max(0, this.recordsInFlight - 1);
|
|
1636
|
+
if (session !== this.session) {
|
|
1637
|
+
if (this.recordsInFlight === 0) this.clearHeld("recording");
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1353
1640
|
const message = hostErrorMessage(err, this.labels.t("paymentSidePanel.recordFailed"));
|
|
1354
1641
|
this.dropPostedEntries(err, payload);
|
|
1355
1642
|
this.submitError.set(message);
|
|
1356
1643
|
this.submitting.set(false);
|
|
1644
|
+
this.clearHeld("recording");
|
|
1357
1645
|
this.outcome.emit({
|
|
1358
1646
|
kind: "failed",
|
|
1359
1647
|
stage: "record",
|
|
@@ -1361,7 +1649,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1361
1649
|
});
|
|
1362
1650
|
return;
|
|
1363
1651
|
}
|
|
1652
|
+
this.recordsInFlight = Math.max(0, this.recordsInFlight - 1);
|
|
1653
|
+
if (session !== this.session) {
|
|
1654
|
+
if (this.recordsInFlight === 0) this.clearHeld("recording");
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1364
1657
|
this.submitting.set(false);
|
|
1658
|
+
this.clearHeld("recording");
|
|
1365
1659
|
const result = {
|
|
1366
1660
|
type: payload.split ? "split" : "manual",
|
|
1367
1661
|
paymentMethod: payload.paymentMethod,
|
|
@@ -1390,6 +1684,8 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1390
1684
|
buildContext() {
|
|
1391
1685
|
const amount = this.amountValid() ? this.amount() : null;
|
|
1392
1686
|
const method = this.method();
|
|
1687
|
+
const epoch = this.pluginEpoch();
|
|
1688
|
+
const live = () => epoch === untracked(this.pluginEpoch) && !this.destroyed;
|
|
1393
1689
|
return {
|
|
1394
1690
|
method,
|
|
1395
1691
|
amount,
|
|
@@ -1397,27 +1693,59 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1397
1693
|
note: this.note().trim(),
|
|
1398
1694
|
allocation: this.allocationPayload(),
|
|
1399
1695
|
currency: this.currency(),
|
|
1696
|
+
blocked: this.startBlocked(),
|
|
1697
|
+
blockedReason: this.blocked() ? this.blockedText() : this.holding() ? this.heldText() : "",
|
|
1698
|
+
readerBanner: !!this.readerBanner() && !!this.bannerComponent(),
|
|
1400
1699
|
valid: !this.hasInvalid() && !!this.receivedDate() && amount != null,
|
|
1401
1700
|
validate: () => {
|
|
1701
|
+
if (!live()) return false;
|
|
1402
1702
|
this.touched.set(true);
|
|
1403
1703
|
return !this.hasInvalid() && !!this.receivedDate() && this.amountValid();
|
|
1404
1704
|
},
|
|
1405
1705
|
reset: () => {
|
|
1706
|
+
if (!live()) return;
|
|
1406
1707
|
this.runCancelHook();
|
|
1407
1708
|
this.init();
|
|
1408
1709
|
},
|
|
1409
|
-
complete: (result) =>
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1710
|
+
complete: (result) => {
|
|
1711
|
+
if (live()) this.completeFromPlugin(method, amount, result);
|
|
1712
|
+
},
|
|
1713
|
+
setBusy: (busy) => {
|
|
1714
|
+
if (!live()) return;
|
|
1715
|
+
this.pluginBusy.set(busy);
|
|
1716
|
+
if (!busy) {
|
|
1717
|
+
this.clearHeld("plugin");
|
|
1718
|
+
this.lastAttemptKey = void 0;
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
leavePending: (info) => {
|
|
1722
|
+
if (live()) this.abandonPlugin(info?.reason ?? "unmounted", info?.paymentAttemptKey);
|
|
1723
|
+
},
|
|
1724
|
+
flowOver: () => {
|
|
1725
|
+
if (!live()) return;
|
|
1726
|
+
this.pluginBusy.set(false);
|
|
1727
|
+
this.clearHeld("plugin");
|
|
1728
|
+
this.lastAttemptKey = void 0;
|
|
1729
|
+
},
|
|
1730
|
+
refreshReaderBanner: () => {
|
|
1731
|
+
if (live()) this.refreshReaderBanner();
|
|
1732
|
+
},
|
|
1733
|
+
setReaderMessage: () => {},
|
|
1734
|
+
setPrimary: (button) => {
|
|
1735
|
+
if (live()) this.pluginPrimary.set(button);
|
|
1736
|
+
},
|
|
1737
|
+
setExclusive: (on) => {
|
|
1738
|
+
if (live()) this.exclusive.set(on);
|
|
1739
|
+
},
|
|
1413
1740
|
onCancel: (fn) => {
|
|
1414
|
-
this.cancelHook = fn;
|
|
1741
|
+
if (live()) this.cancelHook = fn;
|
|
1415
1742
|
},
|
|
1416
1743
|
setCloseGuard: (fn) => {
|
|
1417
|
-
this.closeGuard = fn;
|
|
1744
|
+
if (live()) this.closeGuard = fn;
|
|
1418
1745
|
},
|
|
1419
1746
|
report: (code, extra) => {
|
|
1420
|
-
if (
|
|
1747
|
+
if (!live()) return;
|
|
1748
|
+
if (extra?.attemptKey && code !== "paid_elsewhere" && code !== "duplicate_suspected") this.lastAttemptKey = extra.attemptKey;
|
|
1421
1749
|
this.verificationReported = code === "verification";
|
|
1422
1750
|
this.outcome.emit({
|
|
1423
1751
|
kind: "plugin",
|
|
@@ -1429,7 +1757,9 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1429
1757
|
...extra?.paid ? { paid: extra.paid } : {}
|
|
1430
1758
|
});
|
|
1431
1759
|
},
|
|
1432
|
-
announce: (text) =>
|
|
1760
|
+
announce: (text) => {
|
|
1761
|
+
if (live()) this.announcement.set(text);
|
|
1762
|
+
}
|
|
1433
1763
|
};
|
|
1434
1764
|
}
|
|
1435
1765
|
completeFromPlugin(method, snapshotAmount, partial) {
|
|
@@ -1438,6 +1768,8 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1438
1768
|
this.cancelHook = null;
|
|
1439
1769
|
this.closeGuard = null;
|
|
1440
1770
|
this.pluginBusy.set(false);
|
|
1771
|
+
this.clearHeld("plugin");
|
|
1772
|
+
this.lastAttemptKey = void 0;
|
|
1441
1773
|
const result = {
|
|
1442
1774
|
type: partial?.type ?? "manual",
|
|
1443
1775
|
paymentMethod: partial?.paymentMethod ?? method,
|
|
@@ -1536,7 +1868,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1536
1868
|
}
|
|
1537
1869
|
async sendToReader() {
|
|
1538
1870
|
const start = this.startTerminalPayment();
|
|
1539
|
-
if (!start || this.sendingToReader() || this.terminalPhase() !== "idle") return;
|
|
1871
|
+
if (!start || this.startBlocked() || this.sendingToReader() || this.terminalPhase() !== "idle") return;
|
|
1540
1872
|
this.touched.set(true);
|
|
1541
1873
|
const base = this.terminalBase();
|
|
1542
1874
|
if (!base || this.hasInvalid() || this.selectedReader()?.status !== "online") return;
|
|
@@ -1610,7 +1942,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1610
1942
|
if (polls >= maxPolls) {
|
|
1611
1943
|
this.stopPolling();
|
|
1612
1944
|
const readerId = this.terminalContext?.readerId;
|
|
1613
|
-
|
|
1945
|
+
this.holdAndCancelReader(readerId, "timeout", this.terminalContext?.paymentIntentId, false, this.terminalContext ?? void 0);
|
|
1614
1946
|
this.endWaiting(terminalTimeoutText(this.terminalTimeoutMs()));
|
|
1615
1947
|
return;
|
|
1616
1948
|
}
|
|
@@ -1642,25 +1974,42 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1642
1974
|
paymentMethod: PAYMENT_METHOD.CARD_PRESENT,
|
|
1643
1975
|
amount: context.amount
|
|
1644
1976
|
};
|
|
1977
|
+
this.recordingNow.add(context.paymentIntentId);
|
|
1645
1978
|
try {
|
|
1646
1979
|
if (confirm) await callHost(() => confirm(context));
|
|
1647
1980
|
} catch (err) {
|
|
1981
|
+
this.recordingNow.delete(context.paymentIntentId);
|
|
1648
1982
|
const message = hostErrorMessage(err, this.labels.t("paymentSidePanel.succeededNotRecorded"));
|
|
1649
1983
|
this.outcome.emit({
|
|
1650
1984
|
kind: "failed",
|
|
1651
1985
|
stage: "terminal",
|
|
1652
1986
|
message
|
|
1653
1987
|
});
|
|
1654
|
-
if (session !== this.session)
|
|
1988
|
+
if (session !== this.session) {
|
|
1989
|
+
this.holdPending("closed", "unrecorded", {
|
|
1990
|
+
paymentIntentId: context.paymentIntentId,
|
|
1991
|
+
context
|
|
1992
|
+
});
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1655
1995
|
this.terminalPhase.set("idle");
|
|
1656
|
-
if (this.kind() !== "terminal")
|
|
1996
|
+
if (this.kind() !== "terminal") {
|
|
1997
|
+
this.unrecordedInFlight.add(context.paymentIntentId);
|
|
1998
|
+
this.holdPending("method-changed", "unrecorded", {
|
|
1999
|
+
paymentIntentId: context.paymentIntentId,
|
|
2000
|
+
context
|
|
2001
|
+
});
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
1657
2004
|
this.retryIntentId.set(context.paymentIntentId);
|
|
1658
2005
|
this.retryContext = context;
|
|
1659
2006
|
this.terminalError.set(message);
|
|
1660
2007
|
this.focusLater("[data-testid=\"psp-terminal-error-wrap\"]");
|
|
1661
2008
|
return;
|
|
1662
2009
|
}
|
|
2010
|
+
this.recordingNow.delete(context.paymentIntentId);
|
|
1663
2011
|
if (session !== this.session) {
|
|
2012
|
+
if (this.unrecordedInFlight.delete(context.paymentIntentId) && this.unrecordedInFlight.size === 0) this.clearHeld("unrecorded");
|
|
1664
2013
|
this.outcome.emit({
|
|
1665
2014
|
kind: "terminal-paid",
|
|
1666
2015
|
result
|
|
@@ -1670,6 +2019,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1670
2019
|
}
|
|
1671
2020
|
this.retryIntentId.set("");
|
|
1672
2021
|
this.retryContext = null;
|
|
2022
|
+
if (this.unrecordedInFlight.delete(context.paymentIntentId) && this.unrecordedInFlight.size === 0) this.clearHeld("unrecorded");
|
|
1673
2023
|
this.terminalPhase.set("success");
|
|
1674
2024
|
this.pendingTerminalResult = result;
|
|
1675
2025
|
const delay = this.terminalSuccessDelayMs();
|
|
@@ -1699,19 +2049,339 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1699
2049
|
});
|
|
1700
2050
|
this.recorded.emit(result);
|
|
1701
2051
|
}
|
|
1702
|
-
cancelTerminalPayment() {
|
|
2052
|
+
cancelTerminalPayment(reason = "canceled") {
|
|
1703
2053
|
const readerId = this.readerId();
|
|
2054
|
+
const intentId = this.terminalContext?.paymentIntentId;
|
|
2055
|
+
const context = this.terminalContext ?? void 0;
|
|
1704
2056
|
this.stopPolling();
|
|
1705
2057
|
this.terminalPhase.set("idle");
|
|
1706
2058
|
this.terminalContext = null;
|
|
1707
|
-
this.
|
|
1708
|
-
this.focusLater("[data-testid=\"psp-terminal-send\"] button");
|
|
1709
|
-
if (readerId) this.fireCancelReader(readerId);
|
|
2059
|
+
this.holdAndCancelReader(readerId, reason, intentId, true, context);
|
|
1710
2060
|
}
|
|
1711
|
-
cancelTerminalIfWaiting() {
|
|
1712
|
-
if (this.terminalPhase() === "waiting") this.cancelTerminalPayment();
|
|
2061
|
+
cancelTerminalIfWaiting(reason = "method-changed") {
|
|
2062
|
+
if (this.terminalPhase() === "waiting") this.cancelTerminalPayment(reason);
|
|
1713
2063
|
else this.stopPolling();
|
|
1714
2064
|
}
|
|
2065
|
+
holdAndCancelReader(readerId, reason, paymentIntentId, announce = false, context) {
|
|
2066
|
+
this.holdPending(reason, "terminal", {
|
|
2067
|
+
...paymentIntentId ? { paymentIntentId } : {},
|
|
2068
|
+
...readerId ? { readerId } : {},
|
|
2069
|
+
...context ? { context } : {}
|
|
2070
|
+
});
|
|
2071
|
+
const info = this.held().get("terminal");
|
|
2072
|
+
if (info && info.cancelFailed) {
|
|
2073
|
+
info.cancelFailed = false;
|
|
2074
|
+
this.held.update((map) => new Map(map));
|
|
2075
|
+
}
|
|
2076
|
+
const cancel = this.cancelTerminal();
|
|
2077
|
+
const session = this.session;
|
|
2078
|
+
if (!cancel || !readerId) {
|
|
2079
|
+
this.markCancelFailed();
|
|
2080
|
+
if (announce) this.terminalError.set(this.labels.t("paymentSidePanel.cancelUnconfirmed"));
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
callHost(() => cancel(readerId)).then(async () => {
|
|
2084
|
+
if (this.destroyed) return;
|
|
2085
|
+
const verdict = await this.readTerminalAfterCancel(paymentIntentId);
|
|
2086
|
+
if (this.destroyed) return;
|
|
2087
|
+
const held = this.held().get("terminal");
|
|
2088
|
+
if (verdict === "succeeded") {
|
|
2089
|
+
if (held) await this.recordTakenPayment(held);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
if (verdict === "checking") {
|
|
2093
|
+
if (held) held.cancelFailed = false;
|
|
2094
|
+
if (announce && session === this.session) {
|
|
2095
|
+
this.terminalError.set(this.labels.t("paymentSidePanel.cancelUnconfirmed"));
|
|
2096
|
+
this.focusLater("[data-testid=\"psp-terminal-error-wrap\"]");
|
|
2097
|
+
}
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
this.clearHeld("terminal");
|
|
2101
|
+
if (announce && session === this.session) {
|
|
2102
|
+
this.announcement.set(this.labels.t("paymentSidePanel.readerPaymentCancelled"));
|
|
2103
|
+
this.focusLater("[data-testid=\"psp-terminal-send\"] button");
|
|
2104
|
+
}
|
|
2105
|
+
}, () => {
|
|
2106
|
+
if (this.destroyed) return;
|
|
2107
|
+
this.markCancelFailed();
|
|
2108
|
+
if (session !== this.session) return;
|
|
2109
|
+
this.terminalError.set(this.labels.t("paymentSidePanel.cancelUnconfirmed"));
|
|
2110
|
+
this.focusLater("[data-testid=\"psp-terminal-error-wrap\"]");
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
markCancelFailed() {
|
|
2114
|
+
const info = this.held().get("terminal");
|
|
2115
|
+
if (info) {
|
|
2116
|
+
info.cancelFailed = true;
|
|
2117
|
+
this.held.update((map) => new Map(map));
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
async readTerminalAfterCancel(paymentIntentId) {
|
|
2121
|
+
const status = this.terminalStatus();
|
|
2122
|
+
if (!status || !paymentIntentId) return "over";
|
|
2123
|
+
try {
|
|
2124
|
+
return terminalVerdict((await callHost(() => status(paymentIntentId)))?.status ?? null) === "succeeded" ? "succeeded" : "over";
|
|
2125
|
+
} catch {
|
|
2126
|
+
return "checking";
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
async recordTakenPayment(info) {
|
|
2130
|
+
const context = info.context;
|
|
2131
|
+
const id = info.paymentIntentId ?? context?.paymentIntentId;
|
|
2132
|
+
this.holdPending(info.reason, "unrecorded", {
|
|
2133
|
+
...id ? { paymentIntentId: id } : {},
|
|
2134
|
+
...context ? { context } : {}
|
|
2135
|
+
});
|
|
2136
|
+
this.clearHeld("terminal");
|
|
2137
|
+
if (!context || !id) {
|
|
2138
|
+
this.outcome.emit({
|
|
2139
|
+
kind: "failed",
|
|
2140
|
+
stage: "terminal",
|
|
2141
|
+
message: this.labels.t("paymentSidePanel.terminalNotRecorded", {
|
|
2142
|
+
amount: this.money(this.terminalAmount()),
|
|
2143
|
+
id: id ?? ""
|
|
2144
|
+
})
|
|
2145
|
+
});
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2148
|
+
const confirm = this.confirmTerminalPayment();
|
|
2149
|
+
const result = {
|
|
2150
|
+
type: "manual",
|
|
2151
|
+
paymentMethod: PAYMENT_METHOD.CARD_PRESENT,
|
|
2152
|
+
amount: context.amount
|
|
2153
|
+
};
|
|
2154
|
+
const session = this.session;
|
|
2155
|
+
this.unrecordedInFlight.add(id);
|
|
2156
|
+
this.recordingNow.add(id);
|
|
2157
|
+
try {
|
|
2158
|
+
if (confirm) await callHost(() => confirm(context));
|
|
2159
|
+
} catch (err) {
|
|
2160
|
+
this.recordingNow.delete(id);
|
|
2161
|
+
if (this.destroyed) return;
|
|
2162
|
+
const message = hostErrorMessage(err, this.labels.t("paymentSidePanel.succeededNotRecorded"));
|
|
2163
|
+
this.outcome.emit({
|
|
2164
|
+
kind: "failed",
|
|
2165
|
+
stage: "terminal",
|
|
2166
|
+
message
|
|
2167
|
+
});
|
|
2168
|
+
if (session === this.session && this.kind() === "terminal") {
|
|
2169
|
+
this.retryIntentId.set(id);
|
|
2170
|
+
this.retryContext = context;
|
|
2171
|
+
this.terminalError.set(message);
|
|
2172
|
+
this.focusLater("[data-testid=\"psp-terminal-error-wrap\"]");
|
|
2173
|
+
}
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
this.recordingNow.delete(id);
|
|
2177
|
+
if (this.destroyed) return;
|
|
2178
|
+
this.unrecordedInFlight.delete(id);
|
|
2179
|
+
if (this.unrecordedInFlight.size === 0) this.clearHeld("unrecorded");
|
|
2180
|
+
this.announcement.set(this.labels.t("paymentSidePanel.announceRecorded"));
|
|
2181
|
+
this.outcome.emit({
|
|
2182
|
+
kind: "terminal-paid",
|
|
2183
|
+
result
|
|
2184
|
+
});
|
|
2185
|
+
this.recorded.emit(result);
|
|
2186
|
+
}
|
|
2187
|
+
async checkHeld(only) {
|
|
2188
|
+
if (this.heldChecking() || this.held().size === 0) return;
|
|
2189
|
+
this.heldChecking.set(true);
|
|
2190
|
+
this.heldResult.set("");
|
|
2191
|
+
const verdicts = [];
|
|
2192
|
+
try {
|
|
2193
|
+
for (const kind of [...this.held().keys()]) {
|
|
2194
|
+
if (only && !only.includes(kind)) continue;
|
|
2195
|
+
if (!this.held().has(kind)) continue;
|
|
2196
|
+
verdicts.push(await this.checkHeldKind(kind));
|
|
2197
|
+
if (this.destroyed) return;
|
|
2198
|
+
}
|
|
2199
|
+
} finally {
|
|
2200
|
+
if (!this.destroyed) this.heldChecking.set(false);
|
|
2201
|
+
}
|
|
2202
|
+
if (this.destroyed) return;
|
|
2203
|
+
if (this.held().size === 0) {
|
|
2204
|
+
this.heldResult.set("");
|
|
2205
|
+
this.announcement.set(this.labels.t(verdicts.includes("succeeded") ? "paymentHeld.succeeded" : "paymentHeld.released"));
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
if (verdicts.includes("checking")) {
|
|
2209
|
+
this.heldResult.set(this.labels.t("paymentHeld.inconclusive"));
|
|
2210
|
+
this.heldInconclusive.set(true);
|
|
2211
|
+
} else if (verdicts.includes("open")) {
|
|
2212
|
+
this.heldResult.set(this.labels.t("paymentHeld.stillOpen"));
|
|
2213
|
+
this.heldInconclusive.set(false);
|
|
2214
|
+
}
|
|
2215
|
+
this.announcement.set(this.heldResult());
|
|
2216
|
+
}
|
|
2217
|
+
async checkHeldKind(kind) {
|
|
2218
|
+
const info = this.held().get(kind);
|
|
2219
|
+
if (!info) return "over";
|
|
2220
|
+
switch (kind) {
|
|
2221
|
+
case "terminal": {
|
|
2222
|
+
const status = this.terminalStatus();
|
|
2223
|
+
const id = info.paymentIntentId;
|
|
2224
|
+
if (!status || !id) return "checking";
|
|
2225
|
+
let verdict;
|
|
2226
|
+
try {
|
|
2227
|
+
verdict = terminalVerdict((await callHost(() => status(id)))?.status ?? null);
|
|
2228
|
+
} catch {
|
|
2229
|
+
return "checking";
|
|
2230
|
+
}
|
|
2231
|
+
if (this.destroyed || !this.held().has("terminal")) return "over";
|
|
2232
|
+
if (verdict === "succeeded") {
|
|
2233
|
+
await this.recordTakenPayment(info);
|
|
2234
|
+
return "succeeded";
|
|
2235
|
+
}
|
|
2236
|
+
if (verdict === "canceled" || verdict === "declined") {
|
|
2237
|
+
this.clearHeld("terminal");
|
|
2238
|
+
return "over";
|
|
2239
|
+
}
|
|
2240
|
+
return "open";
|
|
2241
|
+
}
|
|
2242
|
+
case "unrecorded":
|
|
2243
|
+
if (this.recordingNow.size > 0) return "open";
|
|
2244
|
+
if (!info.context) return this.checkHeldPlugin(info, "unrecorded");
|
|
2245
|
+
await this.recordTakenPayment(info);
|
|
2246
|
+
return this.held().has("unrecorded") ? "checking" : "succeeded";
|
|
2247
|
+
case "recording":
|
|
2248
|
+
if (this.recordsInFlight > 0) return "open";
|
|
2249
|
+
this.clearHeld("recording");
|
|
2250
|
+
return "over";
|
|
2251
|
+
case "plugin": return this.checkHeldPlugin(info, "plugin");
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
async checkHeldPlugin(info, kind) {
|
|
2255
|
+
const plugin = this.liveMethods().get(info.method)?.plugin ?? this.plugins().find((p) => typeof p.checkPending === "function");
|
|
2256
|
+
if (!plugin || typeof plugin.checkPending !== "function") return "checking";
|
|
2257
|
+
let answer;
|
|
2258
|
+
try {
|
|
2259
|
+
answer = await callHost(() => plugin.checkPending({
|
|
2260
|
+
method: info.method,
|
|
2261
|
+
...info.paymentAttemptKey ? { paymentAttemptKey: info.paymentAttemptKey } : {},
|
|
2262
|
+
ageMs: Math.max(0, Date.now() - info.since)
|
|
2263
|
+
}));
|
|
2264
|
+
} catch {
|
|
2265
|
+
return "checking";
|
|
2266
|
+
}
|
|
2267
|
+
if (this.destroyed || !this.held().has(kind)) return "over";
|
|
2268
|
+
switch (answer?.state) {
|
|
2269
|
+
case "over":
|
|
2270
|
+
this.clearHeld(kind);
|
|
2271
|
+
this.lastAttemptKey = void 0;
|
|
2272
|
+
return "over";
|
|
2273
|
+
case "succeeded": {
|
|
2274
|
+
this.clearHeld(kind);
|
|
2275
|
+
this.lastAttemptKey = void 0;
|
|
2276
|
+
const result = {
|
|
2277
|
+
type: answer.result?.type ?? "manual",
|
|
2278
|
+
paymentMethod: answer.result?.paymentMethod ?? info.method,
|
|
2279
|
+
amount: answer.result?.amount ?? 0,
|
|
2280
|
+
...answer.result?.processor ? { processor: answer.result.processor } : {}
|
|
2281
|
+
};
|
|
2282
|
+
this.outcome.emit({
|
|
2283
|
+
kind: "plugin",
|
|
2284
|
+
method: info.method,
|
|
2285
|
+
code: "complete",
|
|
2286
|
+
result
|
|
2287
|
+
});
|
|
2288
|
+
this.recorded.emit(result);
|
|
2289
|
+
return "succeeded";
|
|
2290
|
+
}
|
|
2291
|
+
case "open": return "open";
|
|
2292
|
+
default: return "checking";
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
retryCancelHeld() {
|
|
2296
|
+
const info = this.held().get("terminal");
|
|
2297
|
+
if (!info || this.heldChecking()) return;
|
|
2298
|
+
this.heldResult.set("");
|
|
2299
|
+
this.holdAndCancelReader(info.readerId, "canceled", info.paymentIntentId, true, info.context);
|
|
2300
|
+
}
|
|
2301
|
+
releaseByUser() {
|
|
2302
|
+
if (this.held().size === 0) return;
|
|
2303
|
+
const method = this.method();
|
|
2304
|
+
this.releasePending();
|
|
2305
|
+
this.announcement.set(this.labels.t("paymentHeld.released"));
|
|
2306
|
+
try {
|
|
2307
|
+
this.outcome.emit({
|
|
2308
|
+
kind: "plugin",
|
|
2309
|
+
method,
|
|
2310
|
+
code: "hold_released_by_user",
|
|
2311
|
+
message: this.labels.t("paymentHeld.releasedByUser")
|
|
2312
|
+
});
|
|
2313
|
+
} catch {}
|
|
2314
|
+
}
|
|
2315
|
+
syncBanner(host, config, component, visible) {
|
|
2316
|
+
if (!host || !config || !component) {
|
|
2317
|
+
this.destroyBanner();
|
|
2318
|
+
return;
|
|
2319
|
+
}
|
|
2320
|
+
if (!this.bannerRef || this.bannerHostUsed !== host || this.bannerComponentUsed !== component) {
|
|
2321
|
+
this.destroyBanner();
|
|
2322
|
+
const ref = host.createComponent(component);
|
|
2323
|
+
this.bannerRef = ref;
|
|
2324
|
+
this.bannerHostUsed = host;
|
|
2325
|
+
this.bannerComponentUsed = component;
|
|
2326
|
+
let inputs = null;
|
|
2327
|
+
try {
|
|
2328
|
+
inputs = new Set((reflectComponentType(component)?.inputs ?? []).map((i) => i.templateName));
|
|
2329
|
+
} catch {
|
|
2330
|
+
inputs = null;
|
|
2331
|
+
}
|
|
2332
|
+
this.bannerInputs = inputs;
|
|
2333
|
+
const events = ref.instance;
|
|
2334
|
+
events.connect?.subscribe(() => this.readerConnect.emit());
|
|
2335
|
+
events.order?.subscribe(() => this.readerOrder.emit());
|
|
2336
|
+
events.setup?.subscribe(() => this.readerSetup.emit());
|
|
2337
|
+
ref.instance.stateChange?.subscribe((next) => {
|
|
2338
|
+
const prev = this.lastReaderStateSignal();
|
|
2339
|
+
if (prev && prev.state === next.state && prev.stale === next.stale && prev.at?.getTime() === next.at?.getTime()) return;
|
|
2340
|
+
this.lastReaderStateSignal.set(next);
|
|
2341
|
+
try {
|
|
2342
|
+
this.readerState.emit(next);
|
|
2343
|
+
} catch {}
|
|
2344
|
+
});
|
|
2345
|
+
}
|
|
2346
|
+
const ref = this.bannerRef;
|
|
2347
|
+
const set = (name, value) => {
|
|
2348
|
+
if (this.bannerInputs && !this.bannerInputs.has(name)) return;
|
|
2349
|
+
try {
|
|
2350
|
+
ref.setInput(name, value);
|
|
2351
|
+
} catch {}
|
|
2352
|
+
};
|
|
2353
|
+
set("paused", !visible);
|
|
2354
|
+
set("getReadiness", config.getReadiness);
|
|
2355
|
+
set("refreshKey", config.refreshKey ?? null);
|
|
2356
|
+
set("hardwareShopAvailable", config.hardwareShopAvailable ?? true);
|
|
2357
|
+
set("hideReady", config.hideReady ?? false);
|
|
2358
|
+
}
|
|
2359
|
+
attachBannerHost(host) {
|
|
2360
|
+
this.bannerHost.set(host);
|
|
2361
|
+
untracked(() => this.syncBanner(host, this.readerBanner(), this.bannerComponent(), this.showTopBanner()));
|
|
2362
|
+
}
|
|
2363
|
+
detachBannerHost(host) {
|
|
2364
|
+
if (this.bannerHostUsed === host) this.destroyBanner();
|
|
2365
|
+
if (this.bannerHost() === host) this.bannerHost.set(void 0);
|
|
2366
|
+
}
|
|
2367
|
+
async refreshReaderBanner() {
|
|
2368
|
+
const instance = this.bannerRef?.instance;
|
|
2369
|
+
if (!instance?.refresh) return;
|
|
2370
|
+
try {
|
|
2371
|
+
await instance.refresh();
|
|
2372
|
+
} catch {}
|
|
2373
|
+
}
|
|
2374
|
+
destroyBanner() {
|
|
2375
|
+
const ref = this.bannerRef;
|
|
2376
|
+
this.bannerRef = null;
|
|
2377
|
+
this.bannerHostUsed = null;
|
|
2378
|
+
this.bannerComponentUsed = null;
|
|
2379
|
+
this.bannerInputs = null;
|
|
2380
|
+
this.lastReaderStateSignal.set(null);
|
|
2381
|
+
if (ref) try {
|
|
2382
|
+
ref.destroy();
|
|
2383
|
+
} catch {}
|
|
2384
|
+
}
|
|
1715
2385
|
focusLater(selector) {
|
|
1716
2386
|
afterNextRender(() => this.hostEl.nativeElement.querySelector(selector)?.focus(), { injector: this.injector });
|
|
1717
2387
|
}
|
|
@@ -1850,6 +2520,20 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1850
2520
|
isRequired: false,
|
|
1851
2521
|
transformFunction: null
|
|
1852
2522
|
},
|
|
2523
|
+
blocked: {
|
|
2524
|
+
classPropertyName: "blocked",
|
|
2525
|
+
publicName: "blocked",
|
|
2526
|
+
isSignal: true,
|
|
2527
|
+
isRequired: false,
|
|
2528
|
+
transformFunction: null
|
|
2529
|
+
},
|
|
2530
|
+
blockedReason: {
|
|
2531
|
+
classPropertyName: "blockedReason",
|
|
2532
|
+
publicName: "blockedReason",
|
|
2533
|
+
isSignal: true,
|
|
2534
|
+
isRequired: false,
|
|
2535
|
+
transformFunction: null
|
|
2536
|
+
},
|
|
1853
2537
|
recordPayment: {
|
|
1854
2538
|
classPropertyName: "recordPayment",
|
|
1855
2539
|
publicName: "recordPayment",
|
|
@@ -1857,6 +2541,20 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1857
2541
|
isRequired: false,
|
|
1858
2542
|
transformFunction: null
|
|
1859
2543
|
},
|
|
2544
|
+
defaultMethod: {
|
|
2545
|
+
classPropertyName: "defaultMethod",
|
|
2546
|
+
publicName: "defaultMethod",
|
|
2547
|
+
isSignal: true,
|
|
2548
|
+
isRequired: false,
|
|
2549
|
+
transformFunction: null
|
|
2550
|
+
},
|
|
2551
|
+
readerBanner: {
|
|
2552
|
+
classPropertyName: "readerBanner",
|
|
2553
|
+
publicName: "readerBanner",
|
|
2554
|
+
isSignal: true,
|
|
2555
|
+
isRequired: false,
|
|
2556
|
+
transformFunction: null
|
|
2557
|
+
},
|
|
1860
2558
|
listReaders: {
|
|
1861
2559
|
classPropertyName: "listReaders",
|
|
1862
2560
|
publicName: "listReaders",
|
|
@@ -1938,7 +2636,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1938
2636
|
outputs: {
|
|
1939
2637
|
closed: "closed",
|
|
1940
2638
|
recorded: "recorded",
|
|
1941
|
-
outcome: "outcome"
|
|
2639
|
+
outcome: "outcome",
|
|
2640
|
+
busyChange: "busyChange",
|
|
2641
|
+
leftPending: "leftPending",
|
|
2642
|
+
readerConnect: "readerConnect",
|
|
2643
|
+
readerOrder: "readerOrder",
|
|
2644
|
+
readerSetup: "readerSetup",
|
|
2645
|
+
readerState: "readerState"
|
|
1942
2646
|
},
|
|
1943
2647
|
queries: [{
|
|
1944
2648
|
propertyName: "plugins",
|
|
@@ -1959,6 +2663,29 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1959
2663
|
@if (open()) {
|
|
1960
2664
|
<div class="psp-sr" role="status" aria-live="polite" aria-atomic="true" data-testid="psp-live">{{ announcement() }}</div>
|
|
1961
2665
|
<div class="psp" [attr.aria-busy]="busy() || submitting() ? 'true' : null">
|
|
2666
|
+
<!-- the card reader banner is the FIRST element of the body (above the method select and every field), whatever the method, plugin or state (it never moves); the plugin draws NO reader banner of its own while it is there (ctx.readerBanner), so there is exactly ONE banner per state -->
|
|
2667
|
+
@if (bannerMounted()) {
|
|
2668
|
+
<div class="psp-reader-banner" data-testid="psp-reader-banner" [hidden]="!showTopBanner()" [attr.aria-hidden]="showTopBanner() ? null : 'true'"><ng-container pspBannerHost /></div>
|
|
2669
|
+
}
|
|
2670
|
+
<!-- the region stays in the DOM so a screen reader announces the reason when it appears; the reason is text (a warning alert with its icon), never colour alone -->
|
|
2671
|
+
<div class="psp-blocked" role="status" aria-live="polite" data-testid="psp-blocked-status">
|
|
2672
|
+
@if (blocked() && !exclusive()) {
|
|
2673
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="psp-blocked">{{ blockedText() }}</ui-alert>
|
|
2674
|
+
}
|
|
2675
|
+
@if (holding() && !exclusive()) {
|
|
2676
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="psp-held">{{ heldText() }}</ui-alert>
|
|
2677
|
+
@if (heldResult()) { <p class="psp-held-result" data-testid="psp-held-result">{{ heldResult() }}</p> }
|
|
2678
|
+
<div class="psp-held-actions">
|
|
2679
|
+
<ui-button variant="secondary" size="sm" [loading]="heldChecking()" [disabled]="heldChecking()" data-testid="psp-held-check" (click)="checkHeld()">{{ labels.t('paymentHeld.check') }}</ui-button>
|
|
2680
|
+
@if (heldCanRetryCancel()) {
|
|
2681
|
+
<ui-button variant="secondary" size="sm" [disabled]="heldChecking()" data-testid="psp-held-retry-cancel" (click)="retryCancelHeld()">{{ labels.t('paymentHeld.retryCancel') }}</ui-button>
|
|
2682
|
+
}
|
|
2683
|
+
@if (heldInconclusive()) {
|
|
2684
|
+
<ui-button variant="ghost" size="sm" [disabled]="heldChecking()" data-testid="psp-held-release" (click)="releaseByUser()">{{ labels.t('paymentHeld.release') }}</ui-button>
|
|
2685
|
+
}
|
|
2686
|
+
</div>
|
|
2687
|
+
}
|
|
2688
|
+
</div>
|
|
1962
2689
|
@if (!exclusive()) {
|
|
1963
2690
|
@if (outstandingBalance() != null && outstandingBalance()! > 0) {
|
|
1964
2691
|
<ui-kpi-card class="psp-balance" data-testid="psp-balance" [label]="labels.t('paymentSidePanel.outstandingBalance')" [value]="money(outstandingBalance()!)" icon="alert-circle" color="red" valueColor="red" />
|
|
@@ -1986,7 +2713,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1986
2713
|
<span class="psp-saved-label" [id]="ids + '-saved'">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>
|
|
1987
2714
|
<ui-chip-group gap="sm" spaceAbove="none" spaceBelow="sm">
|
|
1988
2715
|
@for (saved of savedChips(); track saved.method + saved.last4) {
|
|
1989
|
-
<ui-chip size="sm" [label]="chipLabel(saved)" [active]="method() === saved.method && reference() === saved.last4" data-testid="psp-saved-chip" (select)="selectSaved(saved)" />
|
|
2716
|
+
<ui-chip size="sm" [label]="chipLabel(saved)" [active]="method() === saved.method && reference() === saved.last4" [disabled]="blocked() || busy() || submitting() || !!retryIntentId()" data-testid="psp-saved-chip" (select)="selectSaved(saved)" />
|
|
1990
2717
|
}
|
|
1991
2718
|
</ui-chip-group>
|
|
1992
2719
|
</div>
|
|
@@ -1995,9 +2722,9 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1995
2722
|
<ui-form-section>
|
|
1996
2723
|
<div class="psp-method-row">
|
|
1997
2724
|
<ui-select class="psp-method" [label]="labels.t('paymentSidePanel.paymentMethod')" [placeholder]="labels.t('paymentSidePanel.selectPaymentMethod')" [required]="methodRequired()" [options]="methodOptions()"
|
|
1998
|
-
[disabled]="busy() || submitting() || !!retryIntentId()" [showErrors]="touched()" [ngModel]="method()" (ngModelChange)="onMethodChange($event)" data-testid="psp-method" />
|
|
2725
|
+
[disabled]="busy() || submitting() || !!retryIntentId() || blocked()" [showErrors]="touched()" [ngModel]="method()" (ngModelChange)="onMethodChange($event)" data-testid="psp-method" />
|
|
1999
2726
|
@if (method()) {
|
|
2000
|
-
<ui-button variant="icon" size="sm" [disabled]="busy() || submitting() || !!retryIntentId()" [ariaLabel]="labels.t('paymentSidePanel.clearPaymentMethod')" data-testid="psp-method-clear" (click)="onMethodChange('')">
|
|
2727
|
+
<ui-button variant="icon" size="sm" [disabled]="busy() || submitting() || !!retryIntentId() || blocked()" [ariaLabel]="labels.t('paymentSidePanel.clearPaymentMethod')" data-testid="psp-method-clear" (click)="onMethodChange('')">
|
|
2001
2728
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>
|
|
2002
2729
|
</ui-button>
|
|
2003
2730
|
}
|
|
@@ -2082,7 +2809,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2082
2809
|
@if (retryIntentId()) {
|
|
2083
2810
|
<ui-button variant="primary" [loading]="retrying()" [disabled]="retrying()" data-testid="psp-terminal-retry" (click)="retryRecording()">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>
|
|
2084
2811
|
} @else {
|
|
2085
|
-
<ui-button variant="primary" [loading]="sendingToReader()" [disabled]="!canSendToReader()" data-testid="psp-terminal-send" (click)="sendToReader()">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>
|
|
2812
|
+
<ui-button variant="primary" [loading]="sendingToReader()" [disabled]="!canSendToReader() || startBlocked()" data-testid="psp-terminal-send" (click)="sendToReader()">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>
|
|
2086
2813
|
}
|
|
2087
2814
|
}
|
|
2088
2815
|
@case ('waiting') {
|
|
@@ -2112,8 +2839,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2112
2839
|
</ui-side-panel>
|
|
2113
2840
|
`,
|
|
2114
2841
|
isInline: true,
|
|
2115
|
-
styles: ["ui-payment-side-panel{display:contents}ui-payment-side-panel .psp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}ui-payment-side-panel .psp{--psp-sunken: var(--ui-psp-sunken, #f8fafc);--psp-border: var(--ui-psp-border, #e2e8f0);--psp-text: var(--ui-psp-text, #1e293b);--psp-muted: var(--ui-psp-muted, #475569);--psp-danger: var(--ui-psp-danger, #b91c1c);display:flex;flex-direction:column;gap:14px;color:var(--psp-text)}ui-payment-side-panel .psp-split{font-size:.8125rem}ui-payment-side-panel .psp-split-title{display:block;margin:12px 0 4px;font-weight:600}ui-payment-side-panel .psp-split-entry{display:flex;align-items:center;gap:8px;padding:4px 0;color:var(--psp-muted);border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-split-entry:last-child{border-bottom:none}ui-payment-side-panel .psp-split-entry>span:first-child{flex:1;min-width:0}ui-payment-side-panel .psp-muted{color:var(--psp-muted)}ui-payment-side-panel .psp-saved-label{display:block;font-size:.75rem;font-weight:600;color:var(--psp-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}ui-payment-side-panel .psp-method-row,ui-payment-side-panel .psp-reader-row{display:flex;align-items:flex-end;gap:8px}ui-payment-side-panel .psp-method,ui-payment-side-panel .psp-reader{flex:1;min-width:0}ui-payment-side-panel .psp-allocation{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--psp-border)}ui-payment-side-panel .psp-charges{max-height:260px;overflow-y:auto;border:1px solid var(--psp-border);border-radius:8px}ui-payment-side-panel .psp-charge{display:flex;flex-direction:column;gap:6px;padding:8px 12px;border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-charge:last-child{border-bottom:none}ui-payment-side-panel .psp-terminal{display:flex;flex-direction:column;gap:12px}ui-payment-side-panel .psp-waiting{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px 16px;background:var(--psp-sunken);border-radius:10px;text-align:center;font-size:.875rem;font-weight:500;color:var(--psp-muted)}ui-payment-side-panel .psp-plugin{min-width:0}ui-payment-side-panel .psp-terminal-error:focus{outline:none}\n"],
|
|
2842
|
+
styles: ["ui-payment-side-panel{display:contents}ui-payment-side-panel .psp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}ui-payment-side-panel .psp{--psp-sunken: var(--ui-psp-sunken, #f8fafc);--psp-border: var(--ui-psp-border, #e2e8f0);--psp-text: var(--ui-psp-text, #1e293b);--psp-muted: var(--ui-psp-muted, #475569);--psp-danger: var(--ui-psp-danger, #b91c1c);display:flex;flex-direction:column;gap:14px;color:var(--psp-text)}ui-payment-side-panel .psp-split{font-size:.8125rem}ui-payment-side-panel .psp-split-title{display:block;margin:12px 0 4px;font-weight:600}ui-payment-side-panel .psp-split-entry{display:flex;align-items:center;gap:8px;padding:4px 0;color:var(--psp-muted);border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-split-entry:last-child{border-bottom:none}ui-payment-side-panel .psp-split-entry>span:first-child{flex:1;min-width:0}ui-payment-side-panel .psp-muted{color:var(--psp-muted)}ui-payment-side-panel .psp-saved-label{display:block;font-size:.75rem;font-weight:600;color:var(--psp-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}ui-payment-side-panel .psp-method-row,ui-payment-side-panel .psp-reader-row{display:flex;align-items:flex-end;gap:8px}ui-payment-side-panel .psp-method,ui-payment-side-panel .psp-reader{flex:1;min-width:0}ui-payment-side-panel .psp-allocation{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--psp-border)}ui-payment-side-panel .psp-charges{max-height:260px;overflow-y:auto;border:1px solid var(--psp-border);border-radius:8px}ui-payment-side-panel .psp-charge{display:flex;flex-direction:column;gap:6px;padding:8px 12px;border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-charge:last-child{border-bottom:none}ui-payment-side-panel .psp-terminal{display:flex;flex-direction:column;gap:12px}ui-payment-side-panel .psp-waiting{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px 16px;background:var(--psp-sunken);border-radius:10px;text-align:center;font-size:.875rem;font-weight:500;color:var(--psp-muted)}ui-payment-side-panel .psp-plugin{min-width:0}ui-payment-side-panel .psp-blocked:empty{display:none}ui-payment-side-panel .psp-reader-banner{display:contents}ui-payment-side-panel .psp-reader-banner[hidden]{display:none}ui-payment-side-panel .psp-held-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}ui-payment-side-panel .psp-held-result{margin:8px 0 0;font-size:.8125rem;color:var(--psp-muted)}ui-payment-side-panel .psp-terminal-error:focus{outline:none}\n"],
|
|
2116
2843
|
dependencies: [
|
|
2844
|
+
{
|
|
2845
|
+
kind: "directive",
|
|
2846
|
+
type: PspBannerHostDirective,
|
|
2847
|
+
selector: "[pspBannerHost]"
|
|
2848
|
+
},
|
|
2117
2849
|
{
|
|
2118
2850
|
kind: "ngmodule",
|
|
2119
2851
|
type: FormsModule
|
|
@@ -2244,7 +2976,8 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2244
2976
|
"label",
|
|
2245
2977
|
"size",
|
|
2246
2978
|
"dismissible",
|
|
2247
|
-
"active"
|
|
2979
|
+
"active",
|
|
2980
|
+
"disabled"
|
|
2248
2981
|
],
|
|
2249
2982
|
outputs: ["select", "dismiss"]
|
|
2250
2983
|
},
|
|
@@ -2443,6 +3176,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2443
3176
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2444
3177
|
encapsulation: ViewEncapsulation.None,
|
|
2445
3178
|
imports: [
|
|
3179
|
+
PspBannerHostDirective,
|
|
2446
3180
|
FormsModule,
|
|
2447
3181
|
NgTemplateOutlet,
|
|
2448
3182
|
AlertComponent,
|
|
@@ -2465,6 +3199,29 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2465
3199
|
@if (open()) {
|
|
2466
3200
|
<div class="psp-sr" role="status" aria-live="polite" aria-atomic="true" data-testid="psp-live">{{ announcement() }}</div>
|
|
2467
3201
|
<div class="psp" [attr.aria-busy]="busy() || submitting() ? 'true' : null">
|
|
3202
|
+
<!-- the card reader banner is the FIRST element of the body (above the method select and every field), whatever the method, plugin or state (it never moves); the plugin draws NO reader banner of its own while it is there (ctx.readerBanner), so there is exactly ONE banner per state -->
|
|
3203
|
+
@if (bannerMounted()) {
|
|
3204
|
+
<div class="psp-reader-banner" data-testid="psp-reader-banner" [hidden]="!showTopBanner()" [attr.aria-hidden]="showTopBanner() ? null : 'true'"><ng-container pspBannerHost /></div>
|
|
3205
|
+
}
|
|
3206
|
+
<!-- the region stays in the DOM so a screen reader announces the reason when it appears; the reason is text (a warning alert with its icon), never colour alone -->
|
|
3207
|
+
<div class="psp-blocked" role="status" aria-live="polite" data-testid="psp-blocked-status">
|
|
3208
|
+
@if (blocked() && !exclusive()) {
|
|
3209
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="psp-blocked">{{ blockedText() }}</ui-alert>
|
|
3210
|
+
}
|
|
3211
|
+
@if (holding() && !exclusive()) {
|
|
3212
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="psp-held">{{ heldText() }}</ui-alert>
|
|
3213
|
+
@if (heldResult()) { <p class="psp-held-result" data-testid="psp-held-result">{{ heldResult() }}</p> }
|
|
3214
|
+
<div class="psp-held-actions">
|
|
3215
|
+
<ui-button variant="secondary" size="sm" [loading]="heldChecking()" [disabled]="heldChecking()" data-testid="psp-held-check" (click)="checkHeld()">{{ labels.t('paymentHeld.check') }}</ui-button>
|
|
3216
|
+
@if (heldCanRetryCancel()) {
|
|
3217
|
+
<ui-button variant="secondary" size="sm" [disabled]="heldChecking()" data-testid="psp-held-retry-cancel" (click)="retryCancelHeld()">{{ labels.t('paymentHeld.retryCancel') }}</ui-button>
|
|
3218
|
+
}
|
|
3219
|
+
@if (heldInconclusive()) {
|
|
3220
|
+
<ui-button variant="ghost" size="sm" [disabled]="heldChecking()" data-testid="psp-held-release" (click)="releaseByUser()">{{ labels.t('paymentHeld.release') }}</ui-button>
|
|
3221
|
+
}
|
|
3222
|
+
</div>
|
|
3223
|
+
}
|
|
3224
|
+
</div>
|
|
2468
3225
|
@if (!exclusive()) {
|
|
2469
3226
|
@if (outstandingBalance() != null && outstandingBalance()! > 0) {
|
|
2470
3227
|
<ui-kpi-card class="psp-balance" data-testid="psp-balance" [label]="labels.t('paymentSidePanel.outstandingBalance')" [value]="money(outstandingBalance()!)" icon="alert-circle" color="red" valueColor="red" />
|
|
@@ -2492,7 +3249,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2492
3249
|
<span class="psp-saved-label" [id]="ids + '-saved'">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>
|
|
2493
3250
|
<ui-chip-group gap="sm" spaceAbove="none" spaceBelow="sm">
|
|
2494
3251
|
@for (saved of savedChips(); track saved.method + saved.last4) {
|
|
2495
|
-
<ui-chip size="sm" [label]="chipLabel(saved)" [active]="method() === saved.method && reference() === saved.last4" data-testid="psp-saved-chip" (select)="selectSaved(saved)" />
|
|
3252
|
+
<ui-chip size="sm" [label]="chipLabel(saved)" [active]="method() === saved.method && reference() === saved.last4" [disabled]="blocked() || busy() || submitting() || !!retryIntentId()" data-testid="psp-saved-chip" (select)="selectSaved(saved)" />
|
|
2496
3253
|
}
|
|
2497
3254
|
</ui-chip-group>
|
|
2498
3255
|
</div>
|
|
@@ -2501,9 +3258,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2501
3258
|
<ui-form-section>
|
|
2502
3259
|
<div class="psp-method-row">
|
|
2503
3260
|
<ui-select class="psp-method" [label]="labels.t('paymentSidePanel.paymentMethod')" [placeholder]="labels.t('paymentSidePanel.selectPaymentMethod')" [required]="methodRequired()" [options]="methodOptions()"
|
|
2504
|
-
[disabled]="busy() || submitting() || !!retryIntentId()" [showErrors]="touched()" [ngModel]="method()" (ngModelChange)="onMethodChange($event)" data-testid="psp-method" />
|
|
3261
|
+
[disabled]="busy() || submitting() || !!retryIntentId() || blocked()" [showErrors]="touched()" [ngModel]="method()" (ngModelChange)="onMethodChange($event)" data-testid="psp-method" />
|
|
2505
3262
|
@if (method()) {
|
|
2506
|
-
<ui-button variant="icon" size="sm" [disabled]="busy() || submitting() || !!retryIntentId()" [ariaLabel]="labels.t('paymentSidePanel.clearPaymentMethod')" data-testid="psp-method-clear" (click)="onMethodChange('')">
|
|
3263
|
+
<ui-button variant="icon" size="sm" [disabled]="busy() || submitting() || !!retryIntentId() || blocked()" [ariaLabel]="labels.t('paymentSidePanel.clearPaymentMethod')" data-testid="psp-method-clear" (click)="onMethodChange('')">
|
|
2507
3264
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true"><path d="M18 6L6 18"/><path d="M6 6l12 12"/></svg>
|
|
2508
3265
|
</ui-button>
|
|
2509
3266
|
}
|
|
@@ -2588,7 +3345,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2588
3345
|
@if (retryIntentId()) {
|
|
2589
3346
|
<ui-button variant="primary" [loading]="retrying()" [disabled]="retrying()" data-testid="psp-terminal-retry" (click)="retryRecording()">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>
|
|
2590
3347
|
} @else {
|
|
2591
|
-
<ui-button variant="primary" [loading]="sendingToReader()" [disabled]="!canSendToReader()" data-testid="psp-terminal-send" (click)="sendToReader()">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>
|
|
3348
|
+
<ui-button variant="primary" [loading]="sendingToReader()" [disabled]="!canSendToReader() || startBlocked()" data-testid="psp-terminal-send" (click)="sendToReader()">{{ sendingToReader() ? labels.t('paymentSidePanel.sending') : labels.t('paymentSidePanel.sendToReader') }}</ui-button>
|
|
2592
3349
|
}
|
|
2593
3350
|
}
|
|
2594
3351
|
@case ('waiting') {
|
|
@@ -2617,7 +3374,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2617
3374
|
}
|
|
2618
3375
|
</ui-side-panel>
|
|
2619
3376
|
`,
|
|
2620
|
-
styles: ["ui-payment-side-panel{display:contents}ui-payment-side-panel .psp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}ui-payment-side-panel .psp{--psp-sunken: var(--ui-psp-sunken, #f8fafc);--psp-border: var(--ui-psp-border, #e2e8f0);--psp-text: var(--ui-psp-text, #1e293b);--psp-muted: var(--ui-psp-muted, #475569);--psp-danger: var(--ui-psp-danger, #b91c1c);display:flex;flex-direction:column;gap:14px;color:var(--psp-text)}ui-payment-side-panel .psp-split{font-size:.8125rem}ui-payment-side-panel .psp-split-title{display:block;margin:12px 0 4px;font-weight:600}ui-payment-side-panel .psp-split-entry{display:flex;align-items:center;gap:8px;padding:4px 0;color:var(--psp-muted);border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-split-entry:last-child{border-bottom:none}ui-payment-side-panel .psp-split-entry>span:first-child{flex:1;min-width:0}ui-payment-side-panel .psp-muted{color:var(--psp-muted)}ui-payment-side-panel .psp-saved-label{display:block;font-size:.75rem;font-weight:600;color:var(--psp-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}ui-payment-side-panel .psp-method-row,ui-payment-side-panel .psp-reader-row{display:flex;align-items:flex-end;gap:8px}ui-payment-side-panel .psp-method,ui-payment-side-panel .psp-reader{flex:1;min-width:0}ui-payment-side-panel .psp-allocation{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--psp-border)}ui-payment-side-panel .psp-charges{max-height:260px;overflow-y:auto;border:1px solid var(--psp-border);border-radius:8px}ui-payment-side-panel .psp-charge{display:flex;flex-direction:column;gap:6px;padding:8px 12px;border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-charge:last-child{border-bottom:none}ui-payment-side-panel .psp-terminal{display:flex;flex-direction:column;gap:12px}ui-payment-side-panel .psp-waiting{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px 16px;background:var(--psp-sunken);border-radius:10px;text-align:center;font-size:.875rem;font-weight:500;color:var(--psp-muted)}ui-payment-side-panel .psp-plugin{min-width:0}ui-payment-side-panel .psp-terminal-error:focus{outline:none}\n"]
|
|
3377
|
+
styles: ["ui-payment-side-panel{display:contents}ui-payment-side-panel .psp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}ui-payment-side-panel .psp{--psp-sunken: var(--ui-psp-sunken, #f8fafc);--psp-border: var(--ui-psp-border, #e2e8f0);--psp-text: var(--ui-psp-text, #1e293b);--psp-muted: var(--ui-psp-muted, #475569);--psp-danger: var(--ui-psp-danger, #b91c1c);display:flex;flex-direction:column;gap:14px;color:var(--psp-text)}ui-payment-side-panel .psp-split{font-size:.8125rem}ui-payment-side-panel .psp-split-title{display:block;margin:12px 0 4px;font-weight:600}ui-payment-side-panel .psp-split-entry{display:flex;align-items:center;gap:8px;padding:4px 0;color:var(--psp-muted);border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-split-entry:last-child{border-bottom:none}ui-payment-side-panel .psp-split-entry>span:first-child{flex:1;min-width:0}ui-payment-side-panel .psp-muted{color:var(--psp-muted)}ui-payment-side-panel .psp-saved-label{display:block;font-size:.75rem;font-weight:600;color:var(--psp-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px}ui-payment-side-panel .psp-method-row,ui-payment-side-panel .psp-reader-row{display:flex;align-items:flex-end;gap:8px}ui-payment-side-panel .psp-method,ui-payment-side-panel .psp-reader{flex:1;min-width:0}ui-payment-side-panel .psp-allocation{display:flex;flex-direction:column;gap:8px;padding-top:12px;border-top:1px solid var(--psp-border)}ui-payment-side-panel .psp-charges{max-height:260px;overflow-y:auto;border:1px solid var(--psp-border);border-radius:8px}ui-payment-side-panel .psp-charge{display:flex;flex-direction:column;gap:6px;padding:8px 12px;border-bottom:1px solid var(--psp-border)}ui-payment-side-panel .psp-charge:last-child{border-bottom:none}ui-payment-side-panel .psp-terminal{display:flex;flex-direction:column;gap:12px}ui-payment-side-panel .psp-waiting{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px 16px;background:var(--psp-sunken);border-radius:10px;text-align:center;font-size:.875rem;font-weight:500;color:var(--psp-muted)}ui-payment-side-panel .psp-plugin{min-width:0}ui-payment-side-panel .psp-blocked:empty{display:none}ui-payment-side-panel .psp-reader-banner{display:contents}ui-payment-side-panel .psp-reader-banner[hidden]{display:none}ui-payment-side-panel .psp-held-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}ui-payment-side-panel .psp-held-result{margin:8px 0 0;font-size:.8125rem;color:var(--psp-muted)}ui-payment-side-panel .psp-terminal-error:focus{outline:none}\n"]
|
|
2621
3378
|
}]
|
|
2622
3379
|
}],
|
|
2623
3380
|
ctorParameters: () => [],
|
|
@@ -2750,6 +3507,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2750
3507
|
required: false
|
|
2751
3508
|
}]
|
|
2752
3509
|
}],
|
|
3510
|
+
blocked: [{
|
|
3511
|
+
type: i0.Input,
|
|
3512
|
+
args: [{
|
|
3513
|
+
isSignal: true,
|
|
3514
|
+
alias: "blocked",
|
|
3515
|
+
required: false
|
|
3516
|
+
}]
|
|
3517
|
+
}],
|
|
3518
|
+
blockedReason: [{
|
|
3519
|
+
type: i0.Input,
|
|
3520
|
+
args: [{
|
|
3521
|
+
isSignal: true,
|
|
3522
|
+
alias: "blockedReason",
|
|
3523
|
+
required: false
|
|
3524
|
+
}]
|
|
3525
|
+
}],
|
|
2753
3526
|
recordPayment: [{
|
|
2754
3527
|
type: i0.Input,
|
|
2755
3528
|
args: [{
|
|
@@ -2758,6 +3531,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2758
3531
|
required: false
|
|
2759
3532
|
}]
|
|
2760
3533
|
}],
|
|
3534
|
+
defaultMethod: [{
|
|
3535
|
+
type: i0.Input,
|
|
3536
|
+
args: [{
|
|
3537
|
+
isSignal: true,
|
|
3538
|
+
alias: "defaultMethod",
|
|
3539
|
+
required: false
|
|
3540
|
+
}]
|
|
3541
|
+
}],
|
|
3542
|
+
readerBanner: [{
|
|
3543
|
+
type: i0.Input,
|
|
3544
|
+
args: [{
|
|
3545
|
+
isSignal: true,
|
|
3546
|
+
alias: "readerBanner",
|
|
3547
|
+
required: false
|
|
3548
|
+
}]
|
|
3549
|
+
}],
|
|
2761
3550
|
listReaders: [{
|
|
2762
3551
|
type: i0.Input,
|
|
2763
3552
|
args: [{
|
|
@@ -2858,6 +3647,30 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2858
3647
|
type: i0.Output,
|
|
2859
3648
|
args: ["outcome"]
|
|
2860
3649
|
}],
|
|
3650
|
+
busyChange: [{
|
|
3651
|
+
type: i0.Output,
|
|
3652
|
+
args: ["busyChange"]
|
|
3653
|
+
}],
|
|
3654
|
+
leftPending: [{
|
|
3655
|
+
type: i0.Output,
|
|
3656
|
+
args: ["leftPending"]
|
|
3657
|
+
}],
|
|
3658
|
+
readerConnect: [{
|
|
3659
|
+
type: i0.Output,
|
|
3660
|
+
args: ["readerConnect"]
|
|
3661
|
+
}],
|
|
3662
|
+
readerOrder: [{
|
|
3663
|
+
type: i0.Output,
|
|
3664
|
+
args: ["readerOrder"]
|
|
3665
|
+
}],
|
|
3666
|
+
readerSetup: [{
|
|
3667
|
+
type: i0.Output,
|
|
3668
|
+
args: ["readerSetup"]
|
|
3669
|
+
}],
|
|
3670
|
+
readerState: [{
|
|
3671
|
+
type: i0.Output,
|
|
3672
|
+
args: ["readerState"]
|
|
3673
|
+
}],
|
|
2861
3674
|
plugins: [{
|
|
2862
3675
|
type: i0.ContentChildren,
|
|
2863
3676
|
args: [i0.forwardRef(() => PAYMENT_METHOD_PLUGIN), {
|
|
@@ -3387,16 +4200,16 @@ var PaymentAttempt = class {
|
|
|
3387
4200
|
const asked = this.pinned();
|
|
3388
4201
|
const askedRef = asked?.ref ?? this.o.payableRef();
|
|
3389
4202
|
this.checking.set(true);
|
|
3390
|
-
let answer = "
|
|
4203
|
+
let answer = "checking";
|
|
3391
4204
|
let timer = null;
|
|
3392
4205
|
try {
|
|
3393
4206
|
const timeout = new Promise((resolve) => {
|
|
3394
4207
|
timer = setTimeout(() => resolve("timeout"), this.o.statusTimeoutMs?.() ?? 1e4);
|
|
3395
4208
|
});
|
|
3396
4209
|
const result = await Promise.race([callHost(() => check(key)), timeout]);
|
|
3397
|
-
answer = result === "timeout" ? "
|
|
4210
|
+
answer = result === "timeout" ? "checking" : result ?? "checking";
|
|
3398
4211
|
} catch {
|
|
3399
|
-
answer = "
|
|
4212
|
+
answer = "checking";
|
|
3400
4213
|
} finally {
|
|
3401
4214
|
if (timer) clearTimeout(timer);
|
|
3402
4215
|
}
|
|
@@ -4335,7 +5148,7 @@ function createPaymentProtection(inputs, options) {
|
|
|
4335
5148
|
const SETUP_LABEL_KEYS = {
|
|
4336
5149
|
"paymentAttempt.checking": "paymentSetup.checking",
|
|
4337
5150
|
"paymentAttempt.checkingHelp": "paymentSetup.checkingHelp",
|
|
4338
|
-
"paymentAttempt.
|
|
5151
|
+
"paymentAttempt.stillChecking": "paymentSetup.stillChecking",
|
|
4339
5152
|
"paymentAttempt.waiting": "paymentSetup.waiting",
|
|
4340
5153
|
"paymentAttempt.paid": "paymentSetup.paid",
|
|
4341
5154
|
"paymentAttempt.queuedOffline": "paymentSetup.queuedOffline",
|
|
@@ -4344,8 +5157,8 @@ const SETUP_LABEL_KEYS = {
|
|
|
4344
5157
|
"paymentReadiness.offline": "paymentSetup.offline",
|
|
4345
5158
|
"paymentReadiness.slow_connection": "paymentSetup.slowConnection",
|
|
4346
5159
|
"paymentReadiness.service_unavailable": "paymentSetup.serviceUnavailable",
|
|
4347
|
-
"paymentReadiness.outcome_unknown": "paymentSetup.
|
|
4348
|
-
"paymentReadiness.unknown_payment": "paymentSetup.
|
|
5160
|
+
"paymentReadiness.outcome_unknown": "paymentSetup.outcomeChecking",
|
|
5161
|
+
"paymentReadiness.unknown_payment": "paymentSetup.outcomeChecking",
|
|
4349
5162
|
"paymentReadiness.payment_in_flight": "paymentSetup.inFlight",
|
|
4350
5163
|
"paymentReadiness.unsupported_browser": "paymentSetup.unsupportedBrowser",
|
|
4351
5164
|
"paymentReadiness.merchant_not_ready": "paymentSetup.merchantNotReady",
|
|
@@ -4375,7 +5188,7 @@ var PaymentAttemptStatusComponent = class PaymentAttemptStatusComponent {
|
|
|
4375
5188
|
const attempt = this.attempt();
|
|
4376
5189
|
if (attempt.paidLocked() && this.showPaid()) return this.text("paymentAttempt.paid");
|
|
4377
5190
|
if (attempt.awaitingVerification()) return this.text("paymentAttempt.awaitingVerification");
|
|
4378
|
-
if (attempt.unknown()) return this.text(attempt.canCheck() && attempt.pollExpired() ? "paymentAttempt.
|
|
5191
|
+
if (attempt.unknown()) return this.text(attempt.canCheck() && attempt.pollExpired() ? "paymentAttempt.stillChecking" : "paymentAttempt.checking");
|
|
4379
5192
|
if (attempt.waitingForHost()) return this.text("paymentAttempt.waiting");
|
|
4380
5193
|
if (this.readiness() && !this.readiness().ready()) return this.readinessText();
|
|
4381
5194
|
if (attempt.blockedOffline()) return this.text("paymentAttempt.offline");
|
|
@@ -4457,7 +5270,7 @@ var PaymentAttemptStatusComponent = class PaymentAttemptStatusComponent {
|
|
|
4457
5270
|
} @else if (attempt().unknown()) {
|
|
4458
5271
|
<ui-alert variant="warning" [quiet]="true" data-testid="pa-checking">
|
|
4459
5272
|
<p class="pa-line" data-testid="pa-checking-title">{{ text('paymentAttempt.checking') }}</p>
|
|
4460
|
-
<p class="pa-line" data-testid="pa-checking-help">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.
|
|
5273
|
+
<p class="pa-line" data-testid="pa-checking-help">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.stillChecking' : 'paymentAttempt.checkingHelp') }}</p>
|
|
4461
5274
|
@if (attempt().canCheck() && attempt().pollExpired()) {
|
|
4462
5275
|
<ui-button variant="secondary" size="sm" data-testid="pa-check-again" [loading]="attempt().checking()" (click)="attempt().checkAgain()">{{ text('paymentAttempt.checkAgain') }}</ui-button>
|
|
4463
5276
|
@if (allowStartOver()) {
|
|
@@ -4578,7 +5391,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4578
5391
|
} @else if (attempt().unknown()) {
|
|
4579
5392
|
<ui-alert variant="warning" [quiet]="true" data-testid="pa-checking">
|
|
4580
5393
|
<p class="pa-line" data-testid="pa-checking-title">{{ text('paymentAttempt.checking') }}</p>
|
|
4581
|
-
<p class="pa-line" data-testid="pa-checking-help">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.
|
|
5394
|
+
<p class="pa-line" data-testid="pa-checking-help">{{ text(attempt().canCheck() && attempt().pollExpired() ? 'paymentAttempt.stillChecking' : 'paymentAttempt.checkingHelp') }}</p>
|
|
4582
5395
|
@if (attempt().canCheck() && attempt().pollExpired()) {
|
|
4583
5396
|
<ui-button variant="secondary" size="sm" data-testid="pa-check-again" [loading]="attempt().checking()" (click)="attempt().checkAgain()">{{ text('paymentAttempt.checkAgain') }}</ui-button>
|
|
4584
5397
|
@if (allowStartOver()) {
|
|
@@ -6253,6 +7066,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
6253
7066
|
}]
|
|
6254
7067
|
}
|
|
6255
7068
|
});
|
|
6256
|
-
export { ALLOCATION_CUSTOM, BankAccountFormComponent, ChargeFormComponent, DEFAULT_ALLOCATION_MODES, DEFAULT_BANK_ACCOUNT_TYPE_OPTIONS, DEFAULT_BANK_HOLDER_TYPE_OPTIONS, DEFAULT_BANK_MANDATE_TEXT, DEFAULT_PAYMENT_METHODS, DEFAULT_REFUND_REASONS, MAX_PAYMENT_AMOUNT, MIN_PAYMENT_AMOUNT, PAYMENT_ATTEMPT_MARKER_TTL_MS, PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS, PAYMENT_ATTEMPT_STORAGE, PAYMENT_ATTEMPT_STORAGE_PREFIX, PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS, PAYMENT_ATTEMPT_VERIFICATION_TTL_MS, PAYMENT_AUTH_TIMEOUT_MS, PAYMENT_FAILURE_CODES, PAYMENT_HOST_SILENCE_MS, PAYMENT_METHOD, PAYMENT_METHOD_PLUGIN, PAYMENT_NO_CHARGE_CODES, PAYMENT_READINESS_EVERY_MS, PAYMENT_READINESS_REASONS, PAYMENT_READINESS_SLOW_RTT_MS, PAYMENT_READINESS_TIMEOUT_MS, PAYMENT_REQUEST_TIMEOUT_MS, PAYMENT_STATUS_CHECK_TIMEOUT_MS, PAYMENT_STATUS_FAIL_GRACE_MS, PAYMENT_STATUS_HARD_MAX_MS, PAYMENT_STATUS_POLL_MAX_MS, PAYMENT_STATUS_POLL_MS, PaymentAttempt, PaymentAttemptStatusComponent, PaymentCustomMethodComponent, PaymentMethodPlugin, PaymentReadiness, PaymentSidePanelComponent, RefundPanelComponent, attemptLabelKey, builtInReadinessReasons, callHost, classifyHostError, createPaymentProtection, defaultChargeAmount, hostErrorMessage, isAttemptFailedReplay, isAwaitingVerificationError, isFinalPaymentRefusal, isValidAmount, last4Error, localizedAllocationModes, localizedPaymentMethods, paymentErrorLabelKey, refusalLabelKey, terminalTimeoutText, terminalVerdict, warnQueuedPayment, wasQueuedOffline };
|
|
7069
|
+
export { ALLOCATION_CUSTOM, BankAccountFormComponent, ChargeFormComponent, DEFAULT_ALLOCATION_MODES, DEFAULT_BANK_ACCOUNT_TYPE_OPTIONS, DEFAULT_BANK_HOLDER_TYPE_OPTIONS, DEFAULT_BANK_MANDATE_TEXT, DEFAULT_PAYMENT_METHODS, DEFAULT_REFUND_REASONS, MAX_PAYMENT_AMOUNT, MIN_PAYMENT_AMOUNT, PAYMENT_ATTEMPT_MARKER_TTL_MS, PAYMENT_ATTEMPT_PAID_RECORD_TTL_MS, PAYMENT_ATTEMPT_STORAGE, PAYMENT_ATTEMPT_STORAGE_PREFIX, PAYMENT_ATTEMPT_TOMBSTONE_TTL_MS, PAYMENT_ATTEMPT_VERIFICATION_TTL_MS, PAYMENT_AUTH_TIMEOUT_MS, PAYMENT_FAILURE_CODES, PAYMENT_HOST_SILENCE_MS, PAYMENT_METHOD, PAYMENT_METHOD_PLUGIN, PAYMENT_NO_CHARGE_CODES, PAYMENT_READINESS_EVERY_MS, PAYMENT_READINESS_REASONS, PAYMENT_READINESS_SLOW_RTT_MS, PAYMENT_READINESS_TIMEOUT_MS, PAYMENT_REQUEST_TIMEOUT_MS, PAYMENT_STATUS_CHECK_TIMEOUT_MS, PAYMENT_STATUS_FAIL_GRACE_MS, PAYMENT_STATUS_HARD_MAX_MS, PAYMENT_STATUS_POLL_MAX_MS, PAYMENT_STATUS_POLL_MS, PaymentAttempt, PaymentAttemptStatusComponent, PaymentCustomMethodComponent, PaymentMethodPlugin, PaymentReadiness, PaymentSidePanelComponent, PspBannerHostDirective, RefundPanelComponent, attemptLabelKey, builtInReadinessReasons, callHost, classifyHostError, createPaymentProtection, defaultChargeAmount, hostErrorMessage, isAttemptFailedReplay, isAwaitingVerificationError, isFinalPaymentRefusal, isValidAmount, last4Error, localizedAllocationModes, localizedPaymentMethods, paymentErrorLabelKey, refusalLabelKey, terminalTimeoutText, terminalVerdict, warnQueuedPayment, wasQueuedOffline };
|
|
6257
7070
|
|
|
6258
7071
|
//# sourceMappingURL=forgeroute-ui-payments.mjs.map
|