@forgeroute/ui 0.5.17 → 0.5.19
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-Dzj_XJJM.mjs → forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs} +216 -5
- package/fesm2022/forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-core.mjs +273 -14
- 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 +884 -56
- 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 +6986 -1190
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +6 -2
- package/types/forgeroute-ui-chip.d.ts +11 -1
- package/types/forgeroute-ui-core.d.ts +244 -7
- 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 +340 -8
- package/types/forgeroute-ui-quickbooks.d.ts +3 -3
- package/types/forgeroute-ui-square.d.ts +3 -3
- package/types/forgeroute-ui-stripe.d.ts +1726 -5
- package/types/forgeroute-ui-table-types.d.ts +29 -0
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Dzj_XJJM.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 */ []);
|
|
@@ -956,9 +1039,25 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
956
1039
|
this.exclusive = signal(false, ...ngDevMode ? [{ debugName: "exclusive" }] : /* istanbul ignore next */ []);
|
|
957
1040
|
this.pluginPrimary = signal(null, ...ngDevMode ? [{ debugName: "pluginPrimary" }] : /* istanbul ignore next */ []);
|
|
958
1041
|
this.cancelHook = null;
|
|
1042
|
+
this.closeGuard = null;
|
|
959
1043
|
this.liveMethodValue = "";
|
|
960
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;
|
|
961
1059
|
this.verificationReported = false;
|
|
1060
|
+
this.takenReported = false;
|
|
962
1061
|
this.readers = signal([], ...ngDevMode ? [{ debugName: "readers" }] : /* istanbul ignore next */ []);
|
|
963
1062
|
this.readersLoaded = signal(false, ...ngDevMode ? [{ debugName: "readersLoaded" }] : /* istanbul ignore next */ []);
|
|
964
1063
|
this.loadingReaders = signal(false, ...ngDevMode ? [{ debugName: "loadingReaders" }] : /* istanbul ignore next */ []);
|
|
@@ -978,8 +1077,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
978
1077
|
this.successTimer = null;
|
|
979
1078
|
this.pendingTerminalResult = null;
|
|
980
1079
|
this.terminalContext = null;
|
|
981
|
-
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 */ []);
|
|
982
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 */ []);
|
|
983
1087
|
this.dateMax = computed(() => this.maxDate() || this.today(), ...ngDevMode ? [{ debugName: "dateMax" }] : /* istanbul ignore next */ []);
|
|
984
1088
|
this.money = (value) => formatCurrency(value, {
|
|
985
1089
|
currency: this.currency(),
|
|
@@ -1057,6 +1161,9 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1057
1161
|
this.selectedReader = computed(() => this.readers().find((r) => r.id === this.readerId()) ?? null, ...ngDevMode ? [{ debugName: "selectedReader" }] : /* istanbul ignore next */ []);
|
|
1058
1162
|
this.canSendToReader = computed(() => !!this.readerId() && this.selectedReader()?.status === "online" && this.amountValid() && !!this.receivedDate() && !this.sendingToReader() && !this.hasInvalid(), ...ngDevMode ? [{ debugName: "canSendToReader" }] : /* istanbul ignore next */ []);
|
|
1059
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 */ []);
|
|
1060
1167
|
this.pluginContext = computed(() => ({ $implicit: this.buildContext() }), ...ngDevMode ? [{ debugName: "pluginContext" }] : /* istanbul ignore next */ []);
|
|
1061
1168
|
this.primaryLabel = computed(() => {
|
|
1062
1169
|
if (!this.open()) return "";
|
|
@@ -1068,9 +1175,11 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1068
1175
|
}, ...ngDevMode ? [{ debugName: "primaryLabel" }] : /* istanbul ignore next */ []);
|
|
1069
1176
|
this.primaryLoading = computed(() => this.kind() === "live" ? !!this.pluginPrimary()?.loading : this.submitting(), ...ngDevMode ? [{ debugName: "primaryLoading" }] : /* istanbul ignore next */ []);
|
|
1070
1177
|
this.primaryDisabled = computed(() => {
|
|
1071
|
-
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;
|
|
1072
1180
|
return this.submitting() || this.touched() && this.hasInvalid();
|
|
1073
1181
|
}, ...ngDevMode ? [{ debugName: "primaryDisabled" }] : /* istanbul ignore next */ []);
|
|
1182
|
+
this.lastBusy = false;
|
|
1074
1183
|
this.destroyed = false;
|
|
1075
1184
|
effect(() => {
|
|
1076
1185
|
const isOpen = this.open();
|
|
@@ -1101,10 +1210,120 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1101
1210
|
const visible = this.kind() === "terminal";
|
|
1102
1211
|
untracked(() => visible ? this.startTerminalSession() : this.stopReaderRefresh());
|
|
1103
1212
|
});
|
|
1104
|
-
|
|
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 {
|
|
1105
1256
|
this.destroyed = true;
|
|
1106
|
-
|
|
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;
|
|
1107
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);
|
|
1108
1327
|
}
|
|
1109
1328
|
init() {
|
|
1110
1329
|
this.resetForm();
|
|
@@ -1117,7 +1336,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1117
1336
|
this.resetForm();
|
|
1118
1337
|
}
|
|
1119
1338
|
resetForm() {
|
|
1339
|
+
this.abandonPlugin("reset");
|
|
1340
|
+
this.reportTakenNotDone("reset");
|
|
1341
|
+
this.takenReported = false;
|
|
1120
1342
|
this.session++;
|
|
1343
|
+
this.pluginEpoch.update((n) => n + 1);
|
|
1344
|
+
this.lastAttemptKey = void 0;
|
|
1345
|
+
this.defaultMethodDone = false;
|
|
1121
1346
|
this.method.set("");
|
|
1122
1347
|
this.amount.set(null);
|
|
1123
1348
|
this.receivedDate.set(this.today());
|
|
@@ -1139,16 +1364,28 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1139
1364
|
this.verificationReported = false;
|
|
1140
1365
|
this.resetTerminal();
|
|
1141
1366
|
}
|
|
1142
|
-
dropPendingRetry() {
|
|
1367
|
+
dropPendingRetry(reason = "method-changed") {
|
|
1143
1368
|
const context = this.retryContext;
|
|
1144
1369
|
if (!this.retryIntentId() || !context) {
|
|
1145
1370
|
this.retryIntentId.set("");
|
|
1146
1371
|
this.retryContext = null;
|
|
1147
1372
|
return;
|
|
1148
1373
|
}
|
|
1374
|
+
const retrying = this.retrying();
|
|
1149
1375
|
this.retryIntentId.set("");
|
|
1150
1376
|
this.retryContext = null;
|
|
1151
|
-
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
|
+
});
|
|
1152
1389
|
this.outcome.emit({
|
|
1153
1390
|
kind: "failed",
|
|
1154
1391
|
stage: "terminal",
|
|
@@ -1158,13 +1395,33 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1158
1395
|
})
|
|
1159
1396
|
});
|
|
1160
1397
|
}
|
|
1161
|
-
cleanup() {
|
|
1398
|
+
cleanup(reason = "closed") {
|
|
1162
1399
|
this.session++;
|
|
1163
|
-
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);
|
|
1164
1406
|
this.runCancelHook();
|
|
1407
|
+
this.reportTakenNotDone(reason);
|
|
1408
|
+
if (this.sendingToReader()) this.holdPending(reason, "terminal");
|
|
1165
1409
|
this.sendingToReader.set(false);
|
|
1166
|
-
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
|
+
}
|
|
1167
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();
|
|
1168
1425
|
if (this.readerId()) this.fireCancelReader(this.readerId());
|
|
1169
1426
|
this.terminalPhase.set("idle");
|
|
1170
1427
|
}
|
|
@@ -1175,14 +1432,39 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1175
1432
|
this.successTimer = null;
|
|
1176
1433
|
}
|
|
1177
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 {}
|
|
1178
1450
|
}
|
|
1179
1451
|
onClose() {
|
|
1180
|
-
this.
|
|
1452
|
+
if (this.closeGuard) {
|
|
1453
|
+
let allowed = true;
|
|
1454
|
+
try {
|
|
1455
|
+
allowed = this.closeGuard();
|
|
1456
|
+
} catch {
|
|
1457
|
+
allowed = true;
|
|
1458
|
+
}
|
|
1459
|
+
if (!allowed) return;
|
|
1460
|
+
}
|
|
1461
|
+
this.cleanup("closed");
|
|
1181
1462
|
this.closed.emit();
|
|
1182
1463
|
}
|
|
1183
1464
|
runCancelHook() {
|
|
1184
1465
|
const hook = this.cancelHook;
|
|
1185
1466
|
this.cancelHook = null;
|
|
1467
|
+
this.closeGuard = null;
|
|
1186
1468
|
if (hook) try {
|
|
1187
1469
|
hook();
|
|
1188
1470
|
} catch {}
|
|
@@ -1191,17 +1473,21 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1191
1473
|
const next = value ?? "";
|
|
1192
1474
|
if (next === this.method()) return;
|
|
1193
1475
|
this.runCancelHook();
|
|
1194
|
-
this.cancelTerminalIfWaiting();
|
|
1195
|
-
this.
|
|
1476
|
+
this.cancelTerminalIfWaiting("method-changed");
|
|
1477
|
+
this.abandonPlugin("method-changed");
|
|
1478
|
+
this.defaultMethodDone = true;
|
|
1479
|
+
this.reportTakenNotDone("method-changed");
|
|
1480
|
+
this.takenReported = false;
|
|
1196
1481
|
this.exclusive.set(false);
|
|
1197
1482
|
this.pluginPrimary.set(null);
|
|
1198
1483
|
this.terminalError.set("");
|
|
1199
|
-
this.dropPendingRetry();
|
|
1484
|
+
this.dropPendingRetry("method-changed");
|
|
1200
1485
|
this.submitError.set("");
|
|
1201
1486
|
this.reference.set("");
|
|
1202
1487
|
this.method.set(next);
|
|
1203
1488
|
}
|
|
1204
1489
|
selectSaved(saved) {
|
|
1490
|
+
if (this.blocked() || this.busy() || this.submitting() || this.retryIntentId()) return;
|
|
1205
1491
|
this.onMethodChange(saved.method);
|
|
1206
1492
|
this.reference.set(saved.last4);
|
|
1207
1493
|
}
|
|
@@ -1314,11 +1600,16 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1314
1600
|
};
|
|
1315
1601
|
}
|
|
1316
1602
|
onPrimary() {
|
|
1317
|
-
if (this.kind() === "live")
|
|
1318
|
-
|
|
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();
|
|
1319
1610
|
}
|
|
1320
1611
|
async submit() {
|
|
1321
|
-
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;
|
|
1322
1613
|
this.touched.set(true);
|
|
1323
1614
|
if (this.hasInvalid()) return;
|
|
1324
1615
|
const payload = this.buildPayload();
|
|
@@ -1336,13 +1627,21 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1336
1627
|
this.submitting.set(true);
|
|
1337
1628
|
this.submitError.set("");
|
|
1338
1629
|
this.announcement.set(this.labels.t("paymentSidePanel.announceRecording"));
|
|
1630
|
+
const session = this.session;
|
|
1631
|
+
this.recordsInFlight++;
|
|
1339
1632
|
try {
|
|
1340
1633
|
await callHost(() => record(payload));
|
|
1341
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
|
+
}
|
|
1342
1640
|
const message = hostErrorMessage(err, this.labels.t("paymentSidePanel.recordFailed"));
|
|
1343
1641
|
this.dropPostedEntries(err, payload);
|
|
1344
1642
|
this.submitError.set(message);
|
|
1345
1643
|
this.submitting.set(false);
|
|
1644
|
+
this.clearHeld("recording");
|
|
1346
1645
|
this.outcome.emit({
|
|
1347
1646
|
kind: "failed",
|
|
1348
1647
|
stage: "record",
|
|
@@ -1350,7 +1649,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1350
1649
|
});
|
|
1351
1650
|
return;
|
|
1352
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
|
+
}
|
|
1353
1657
|
this.submitting.set(false);
|
|
1658
|
+
this.clearHeld("recording");
|
|
1354
1659
|
const result = {
|
|
1355
1660
|
type: payload.split ? "split" : "manual",
|
|
1356
1661
|
paymentMethod: payload.paymentMethod,
|
|
@@ -1379,6 +1684,8 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1379
1684
|
buildContext() {
|
|
1380
1685
|
const amount = this.amountValid() ? this.amount() : null;
|
|
1381
1686
|
const method = this.method();
|
|
1687
|
+
const epoch = this.pluginEpoch();
|
|
1688
|
+
const live = () => epoch === untracked(this.pluginEpoch) && !this.destroyed;
|
|
1382
1689
|
return {
|
|
1383
1690
|
method,
|
|
1384
1691
|
amount,
|
|
@@ -1386,24 +1693,59 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1386
1693
|
note: this.note().trim(),
|
|
1387
1694
|
allocation: this.allocationPayload(),
|
|
1388
1695
|
currency: this.currency(),
|
|
1696
|
+
blocked: this.startBlocked(),
|
|
1697
|
+
blockedReason: this.blocked() ? this.blockedText() : this.holding() ? this.heldText() : "",
|
|
1698
|
+
readerBanner: !!this.readerBanner() && !!this.bannerComponent(),
|
|
1389
1699
|
valid: !this.hasInvalid() && !!this.receivedDate() && amount != null,
|
|
1390
1700
|
validate: () => {
|
|
1701
|
+
if (!live()) return false;
|
|
1391
1702
|
this.touched.set(true);
|
|
1392
1703
|
return !this.hasInvalid() && !!this.receivedDate() && this.amountValid();
|
|
1393
1704
|
},
|
|
1394
1705
|
reset: () => {
|
|
1706
|
+
if (!live()) return;
|
|
1395
1707
|
this.runCancelHook();
|
|
1396
1708
|
this.init();
|
|
1397
1709
|
},
|
|
1398
|
-
complete: (result) =>
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
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
|
+
},
|
|
1402
1740
|
onCancel: (fn) => {
|
|
1403
|
-
this.cancelHook = fn;
|
|
1741
|
+
if (live()) this.cancelHook = fn;
|
|
1742
|
+
},
|
|
1743
|
+
setCloseGuard: (fn) => {
|
|
1744
|
+
if (live()) this.closeGuard = fn;
|
|
1404
1745
|
},
|
|
1405
1746
|
report: (code, extra) => {
|
|
1406
|
-
if (
|
|
1747
|
+
if (!live()) return;
|
|
1748
|
+
if (extra?.attemptKey && code !== "paid_elsewhere" && code !== "duplicate_suspected") this.lastAttemptKey = extra.attemptKey;
|
|
1407
1749
|
this.verificationReported = code === "verification";
|
|
1408
1750
|
this.outcome.emit({
|
|
1409
1751
|
kind: "plugin",
|
|
@@ -1415,14 +1757,19 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1415
1757
|
...extra?.paid ? { paid: extra.paid } : {}
|
|
1416
1758
|
});
|
|
1417
1759
|
},
|
|
1418
|
-
announce: (text) =>
|
|
1760
|
+
announce: (text) => {
|
|
1761
|
+
if (live()) this.announcement.set(text);
|
|
1762
|
+
}
|
|
1419
1763
|
};
|
|
1420
1764
|
}
|
|
1421
1765
|
completeFromPlugin(method, snapshotAmount, partial) {
|
|
1422
1766
|
if (this.completed || this.destroyed) return;
|
|
1423
1767
|
this.completed = true;
|
|
1424
1768
|
this.cancelHook = null;
|
|
1769
|
+
this.closeGuard = null;
|
|
1425
1770
|
this.pluginBusy.set(false);
|
|
1771
|
+
this.clearHeld("plugin");
|
|
1772
|
+
this.lastAttemptKey = void 0;
|
|
1426
1773
|
const result = {
|
|
1427
1774
|
type: partial?.type ?? "manual",
|
|
1428
1775
|
paymentMethod: partial?.paymentMethod ?? method,
|
|
@@ -1521,7 +1868,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1521
1868
|
}
|
|
1522
1869
|
async sendToReader() {
|
|
1523
1870
|
const start = this.startTerminalPayment();
|
|
1524
|
-
if (!start || this.sendingToReader() || this.terminalPhase() !== "idle") return;
|
|
1871
|
+
if (!start || this.startBlocked() || this.sendingToReader() || this.terminalPhase() !== "idle") return;
|
|
1525
1872
|
this.touched.set(true);
|
|
1526
1873
|
const base = this.terminalBase();
|
|
1527
1874
|
if (!base || this.hasInvalid() || this.selectedReader()?.status !== "online") return;
|
|
@@ -1595,7 +1942,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1595
1942
|
if (polls >= maxPolls) {
|
|
1596
1943
|
this.stopPolling();
|
|
1597
1944
|
const readerId = this.terminalContext?.readerId;
|
|
1598
|
-
|
|
1945
|
+
this.holdAndCancelReader(readerId, "timeout", this.terminalContext?.paymentIntentId, false, this.terminalContext ?? void 0);
|
|
1599
1946
|
this.endWaiting(terminalTimeoutText(this.terminalTimeoutMs()));
|
|
1600
1947
|
return;
|
|
1601
1948
|
}
|
|
@@ -1627,25 +1974,42 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1627
1974
|
paymentMethod: PAYMENT_METHOD.CARD_PRESENT,
|
|
1628
1975
|
amount: context.amount
|
|
1629
1976
|
};
|
|
1977
|
+
this.recordingNow.add(context.paymentIntentId);
|
|
1630
1978
|
try {
|
|
1631
1979
|
if (confirm) await callHost(() => confirm(context));
|
|
1632
1980
|
} catch (err) {
|
|
1981
|
+
this.recordingNow.delete(context.paymentIntentId);
|
|
1633
1982
|
const message = hostErrorMessage(err, this.labels.t("paymentSidePanel.succeededNotRecorded"));
|
|
1634
1983
|
this.outcome.emit({
|
|
1635
1984
|
kind: "failed",
|
|
1636
1985
|
stage: "terminal",
|
|
1637
1986
|
message
|
|
1638
1987
|
});
|
|
1639
|
-
if (session !== this.session)
|
|
1988
|
+
if (session !== this.session) {
|
|
1989
|
+
this.holdPending("closed", "unrecorded", {
|
|
1990
|
+
paymentIntentId: context.paymentIntentId,
|
|
1991
|
+
context
|
|
1992
|
+
});
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1640
1995
|
this.terminalPhase.set("idle");
|
|
1641
|
-
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
|
+
}
|
|
1642
2004
|
this.retryIntentId.set(context.paymentIntentId);
|
|
1643
2005
|
this.retryContext = context;
|
|
1644
2006
|
this.terminalError.set(message);
|
|
1645
2007
|
this.focusLater("[data-testid=\"psp-terminal-error-wrap\"]");
|
|
1646
2008
|
return;
|
|
1647
2009
|
}
|
|
2010
|
+
this.recordingNow.delete(context.paymentIntentId);
|
|
1648
2011
|
if (session !== this.session) {
|
|
2012
|
+
if (this.unrecordedInFlight.delete(context.paymentIntentId) && this.unrecordedInFlight.size === 0) this.clearHeld("unrecorded");
|
|
1649
2013
|
this.outcome.emit({
|
|
1650
2014
|
kind: "terminal-paid",
|
|
1651
2015
|
result
|
|
@@ -1655,6 +2019,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1655
2019
|
}
|
|
1656
2020
|
this.retryIntentId.set("");
|
|
1657
2021
|
this.retryContext = null;
|
|
2022
|
+
if (this.unrecordedInFlight.delete(context.paymentIntentId) && this.unrecordedInFlight.size === 0) this.clearHeld("unrecorded");
|
|
1658
2023
|
this.terminalPhase.set("success");
|
|
1659
2024
|
this.pendingTerminalResult = result;
|
|
1660
2025
|
const delay = this.terminalSuccessDelayMs();
|
|
@@ -1684,19 +2049,339 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1684
2049
|
});
|
|
1685
2050
|
this.recorded.emit(result);
|
|
1686
2051
|
}
|
|
1687
|
-
cancelTerminalPayment() {
|
|
2052
|
+
cancelTerminalPayment(reason = "canceled") {
|
|
1688
2053
|
const readerId = this.readerId();
|
|
2054
|
+
const intentId = this.terminalContext?.paymentIntentId;
|
|
2055
|
+
const context = this.terminalContext ?? void 0;
|
|
1689
2056
|
this.stopPolling();
|
|
1690
2057
|
this.terminalPhase.set("idle");
|
|
1691
2058
|
this.terminalContext = null;
|
|
1692
|
-
this.
|
|
1693
|
-
this.focusLater("[data-testid=\"psp-terminal-send\"] button");
|
|
1694
|
-
if (readerId) this.fireCancelReader(readerId);
|
|
2059
|
+
this.holdAndCancelReader(readerId, reason, intentId, true, context);
|
|
1695
2060
|
}
|
|
1696
|
-
cancelTerminalIfWaiting() {
|
|
1697
|
-
if (this.terminalPhase() === "waiting") this.cancelTerminalPayment();
|
|
2061
|
+
cancelTerminalIfWaiting(reason = "method-changed") {
|
|
2062
|
+
if (this.terminalPhase() === "waiting") this.cancelTerminalPayment(reason);
|
|
1698
2063
|
else this.stopPolling();
|
|
1699
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
|
+
}
|
|
1700
2385
|
focusLater(selector) {
|
|
1701
2386
|
afterNextRender(() => this.hostEl.nativeElement.querySelector(selector)?.focus(), { injector: this.injector });
|
|
1702
2387
|
}
|
|
@@ -1835,6 +2520,20 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1835
2520
|
isRequired: false,
|
|
1836
2521
|
transformFunction: null
|
|
1837
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
|
+
},
|
|
1838
2537
|
recordPayment: {
|
|
1839
2538
|
classPropertyName: "recordPayment",
|
|
1840
2539
|
publicName: "recordPayment",
|
|
@@ -1842,6 +2541,20 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1842
2541
|
isRequired: false,
|
|
1843
2542
|
transformFunction: null
|
|
1844
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
|
+
},
|
|
1845
2558
|
listReaders: {
|
|
1846
2559
|
classPropertyName: "listReaders",
|
|
1847
2560
|
publicName: "listReaders",
|
|
@@ -1923,7 +2636,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1923
2636
|
outputs: {
|
|
1924
2637
|
closed: "closed",
|
|
1925
2638
|
recorded: "recorded",
|
|
1926
|
-
outcome: "outcome"
|
|
2639
|
+
outcome: "outcome",
|
|
2640
|
+
busyChange: "busyChange",
|
|
2641
|
+
leftPending: "leftPending",
|
|
2642
|
+
readerConnect: "readerConnect",
|
|
2643
|
+
readerOrder: "readerOrder",
|
|
2644
|
+
readerSetup: "readerSetup",
|
|
2645
|
+
readerState: "readerState"
|
|
1927
2646
|
},
|
|
1928
2647
|
queries: [{
|
|
1929
2648
|
propertyName: "plugins",
|
|
@@ -1944,6 +2663,29 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1944
2663
|
@if (open()) {
|
|
1945
2664
|
<div class="psp-sr" role="status" aria-live="polite" aria-atomic="true" data-testid="psp-live">{{ announcement() }}</div>
|
|
1946
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>
|
|
1947
2689
|
@if (!exclusive()) {
|
|
1948
2690
|
@if (outstandingBalance() != null && outstandingBalance()! > 0) {
|
|
1949
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" />
|
|
@@ -1971,7 +2713,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1971
2713
|
<span class="psp-saved-label" [id]="ids + '-saved'">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>
|
|
1972
2714
|
<ui-chip-group gap="sm" spaceAbove="none" spaceBelow="sm">
|
|
1973
2715
|
@for (saved of savedChips(); track saved.method + saved.last4) {
|
|
1974
|
-
<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)" />
|
|
1975
2717
|
}
|
|
1976
2718
|
</ui-chip-group>
|
|
1977
2719
|
</div>
|
|
@@ -1980,9 +2722,9 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
1980
2722
|
<ui-form-section>
|
|
1981
2723
|
<div class="psp-method-row">
|
|
1982
2724
|
<ui-select class="psp-method" [label]="labels.t('paymentSidePanel.paymentMethod')" [placeholder]="labels.t('paymentSidePanel.selectPaymentMethod')" [required]="methodRequired()" [options]="methodOptions()"
|
|
1983
|
-
[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" />
|
|
1984
2726
|
@if (method()) {
|
|
1985
|
-
<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('')">
|
|
1986
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>
|
|
1987
2729
|
</ui-button>
|
|
1988
2730
|
}
|
|
@@ -2067,7 +2809,7 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2067
2809
|
@if (retryIntentId()) {
|
|
2068
2810
|
<ui-button variant="primary" [loading]="retrying()" [disabled]="retrying()" data-testid="psp-terminal-retry" (click)="retryRecording()">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>
|
|
2069
2811
|
} @else {
|
|
2070
|
-
<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>
|
|
2071
2813
|
}
|
|
2072
2814
|
}
|
|
2073
2815
|
@case ('waiting') {
|
|
@@ -2097,8 +2839,13 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2097
2839
|
</ui-side-panel>
|
|
2098
2840
|
`,
|
|
2099
2841
|
isInline: true,
|
|
2100
|
-
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"],
|
|
2101
2843
|
dependencies: [
|
|
2844
|
+
{
|
|
2845
|
+
kind: "directive",
|
|
2846
|
+
type: PspBannerHostDirective,
|
|
2847
|
+
selector: "[pspBannerHost]"
|
|
2848
|
+
},
|
|
2102
2849
|
{
|
|
2103
2850
|
kind: "ngmodule",
|
|
2104
2851
|
type: FormsModule
|
|
@@ -2229,7 +2976,8 @@ var PaymentSidePanelComponent = class PaymentSidePanelComponent {
|
|
|
2229
2976
|
"label",
|
|
2230
2977
|
"size",
|
|
2231
2978
|
"dismissible",
|
|
2232
|
-
"active"
|
|
2979
|
+
"active",
|
|
2980
|
+
"disabled"
|
|
2233
2981
|
],
|
|
2234
2982
|
outputs: ["select", "dismiss"]
|
|
2235
2983
|
},
|
|
@@ -2428,6 +3176,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2428
3176
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2429
3177
|
encapsulation: ViewEncapsulation.None,
|
|
2430
3178
|
imports: [
|
|
3179
|
+
PspBannerHostDirective,
|
|
2431
3180
|
FormsModule,
|
|
2432
3181
|
NgTemplateOutlet,
|
|
2433
3182
|
AlertComponent,
|
|
@@ -2450,6 +3199,29 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2450
3199
|
@if (open()) {
|
|
2451
3200
|
<div class="psp-sr" role="status" aria-live="polite" aria-atomic="true" data-testid="psp-live">{{ announcement() }}</div>
|
|
2452
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>
|
|
2453
3225
|
@if (!exclusive()) {
|
|
2454
3226
|
@if (outstandingBalance() != null && outstandingBalance()! > 0) {
|
|
2455
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" />
|
|
@@ -2477,7 +3249,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2477
3249
|
<span class="psp-saved-label" [id]="ids + '-saved'">{{ labels.t('paymentSidePanel.previouslyUsed') }}</span>
|
|
2478
3250
|
<ui-chip-group gap="sm" spaceAbove="none" spaceBelow="sm">
|
|
2479
3251
|
@for (saved of savedChips(); track saved.method + saved.last4) {
|
|
2480
|
-
<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)" />
|
|
2481
3253
|
}
|
|
2482
3254
|
</ui-chip-group>
|
|
2483
3255
|
</div>
|
|
@@ -2486,9 +3258,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2486
3258
|
<ui-form-section>
|
|
2487
3259
|
<div class="psp-method-row">
|
|
2488
3260
|
<ui-select class="psp-method" [label]="labels.t('paymentSidePanel.paymentMethod')" [placeholder]="labels.t('paymentSidePanel.selectPaymentMethod')" [required]="methodRequired()" [options]="methodOptions()"
|
|
2489
|
-
[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" />
|
|
2490
3262
|
@if (method()) {
|
|
2491
|
-
<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('')">
|
|
2492
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>
|
|
2493
3265
|
</ui-button>
|
|
2494
3266
|
}
|
|
@@ -2573,7 +3345,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2573
3345
|
@if (retryIntentId()) {
|
|
2574
3346
|
<ui-button variant="primary" [loading]="retrying()" [disabled]="retrying()" data-testid="psp-terminal-retry" (click)="retryRecording()">{{ labels.t('paymentSidePanel.retryRecording') }}</ui-button>
|
|
2575
3347
|
} @else {
|
|
2576
|
-
<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>
|
|
2577
3349
|
}
|
|
2578
3350
|
}
|
|
2579
3351
|
@case ('waiting') {
|
|
@@ -2602,7 +3374,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2602
3374
|
}
|
|
2603
3375
|
</ui-side-panel>
|
|
2604
3376
|
`,
|
|
2605
|
-
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"]
|
|
2606
3378
|
}]
|
|
2607
3379
|
}],
|
|
2608
3380
|
ctorParameters: () => [],
|
|
@@ -2735,6 +3507,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2735
3507
|
required: false
|
|
2736
3508
|
}]
|
|
2737
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
|
+
}],
|
|
2738
3526
|
recordPayment: [{
|
|
2739
3527
|
type: i0.Input,
|
|
2740
3528
|
args: [{
|
|
@@ -2743,6 +3531,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2743
3531
|
required: false
|
|
2744
3532
|
}]
|
|
2745
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
|
+
}],
|
|
2746
3550
|
listReaders: [{
|
|
2747
3551
|
type: i0.Input,
|
|
2748
3552
|
args: [{
|
|
@@ -2843,6 +3647,30 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2843
3647
|
type: i0.Output,
|
|
2844
3648
|
args: ["outcome"]
|
|
2845
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
|
+
}],
|
|
2846
3674
|
plugins: [{
|
|
2847
3675
|
type: i0.ContentChildren,
|
|
2848
3676
|
args: [i0.forwardRef(() => PAYMENT_METHOD_PLUGIN), {
|
|
@@ -3372,16 +4200,16 @@ var PaymentAttempt = class {
|
|
|
3372
4200
|
const asked = this.pinned();
|
|
3373
4201
|
const askedRef = asked?.ref ?? this.o.payableRef();
|
|
3374
4202
|
this.checking.set(true);
|
|
3375
|
-
let answer = "
|
|
4203
|
+
let answer = "checking";
|
|
3376
4204
|
let timer = null;
|
|
3377
4205
|
try {
|
|
3378
4206
|
const timeout = new Promise((resolve) => {
|
|
3379
4207
|
timer = setTimeout(() => resolve("timeout"), this.o.statusTimeoutMs?.() ?? 1e4);
|
|
3380
4208
|
});
|
|
3381
4209
|
const result = await Promise.race([callHost(() => check(key)), timeout]);
|
|
3382
|
-
answer = result === "timeout" ? "
|
|
4210
|
+
answer = result === "timeout" ? "checking" : result ?? "checking";
|
|
3383
4211
|
} catch {
|
|
3384
|
-
answer = "
|
|
4212
|
+
answer = "checking";
|
|
3385
4213
|
} finally {
|
|
3386
4214
|
if (timer) clearTimeout(timer);
|
|
3387
4215
|
}
|
|
@@ -4320,7 +5148,7 @@ function createPaymentProtection(inputs, options) {
|
|
|
4320
5148
|
const SETUP_LABEL_KEYS = {
|
|
4321
5149
|
"paymentAttempt.checking": "paymentSetup.checking",
|
|
4322
5150
|
"paymentAttempt.checkingHelp": "paymentSetup.checkingHelp",
|
|
4323
|
-
"paymentAttempt.
|
|
5151
|
+
"paymentAttempt.stillChecking": "paymentSetup.stillChecking",
|
|
4324
5152
|
"paymentAttempt.waiting": "paymentSetup.waiting",
|
|
4325
5153
|
"paymentAttempt.paid": "paymentSetup.paid",
|
|
4326
5154
|
"paymentAttempt.queuedOffline": "paymentSetup.queuedOffline",
|
|
@@ -4329,8 +5157,8 @@ const SETUP_LABEL_KEYS = {
|
|
|
4329
5157
|
"paymentReadiness.offline": "paymentSetup.offline",
|
|
4330
5158
|
"paymentReadiness.slow_connection": "paymentSetup.slowConnection",
|
|
4331
5159
|
"paymentReadiness.service_unavailable": "paymentSetup.serviceUnavailable",
|
|
4332
|
-
"paymentReadiness.outcome_unknown": "paymentSetup.
|
|
4333
|
-
"paymentReadiness.unknown_payment": "paymentSetup.
|
|
5160
|
+
"paymentReadiness.outcome_unknown": "paymentSetup.outcomeChecking",
|
|
5161
|
+
"paymentReadiness.unknown_payment": "paymentSetup.outcomeChecking",
|
|
4334
5162
|
"paymentReadiness.payment_in_flight": "paymentSetup.inFlight",
|
|
4335
5163
|
"paymentReadiness.unsupported_browser": "paymentSetup.unsupportedBrowser",
|
|
4336
5164
|
"paymentReadiness.merchant_not_ready": "paymentSetup.merchantNotReady",
|
|
@@ -4360,7 +5188,7 @@ var PaymentAttemptStatusComponent = class PaymentAttemptStatusComponent {
|
|
|
4360
5188
|
const attempt = this.attempt();
|
|
4361
5189
|
if (attempt.paidLocked() && this.showPaid()) return this.text("paymentAttempt.paid");
|
|
4362
5190
|
if (attempt.awaitingVerification()) return this.text("paymentAttempt.awaitingVerification");
|
|
4363
|
-
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");
|
|
4364
5192
|
if (attempt.waitingForHost()) return this.text("paymentAttempt.waiting");
|
|
4365
5193
|
if (this.readiness() && !this.readiness().ready()) return this.readinessText();
|
|
4366
5194
|
if (attempt.blockedOffline()) return this.text("paymentAttempt.offline");
|
|
@@ -4442,7 +5270,7 @@ var PaymentAttemptStatusComponent = class PaymentAttemptStatusComponent {
|
|
|
4442
5270
|
} @else if (attempt().unknown()) {
|
|
4443
5271
|
<ui-alert variant="warning" [quiet]="true" data-testid="pa-checking">
|
|
4444
5272
|
<p class="pa-line" data-testid="pa-checking-title">{{ text('paymentAttempt.checking') }}</p>
|
|
4445
|
-
<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>
|
|
4446
5274
|
@if (attempt().canCheck() && attempt().pollExpired()) {
|
|
4447
5275
|
<ui-button variant="secondary" size="sm" data-testid="pa-check-again" [loading]="attempt().checking()" (click)="attempt().checkAgain()">{{ text('paymentAttempt.checkAgain') }}</ui-button>
|
|
4448
5276
|
@if (allowStartOver()) {
|
|
@@ -4563,7 +5391,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4563
5391
|
} @else if (attempt().unknown()) {
|
|
4564
5392
|
<ui-alert variant="warning" [quiet]="true" data-testid="pa-checking">
|
|
4565
5393
|
<p class="pa-line" data-testid="pa-checking-title">{{ text('paymentAttempt.checking') }}</p>
|
|
4566
|
-
<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>
|
|
4567
5395
|
@if (attempt().canCheck() && attempt().pollExpired()) {
|
|
4568
5396
|
<ui-button variant="secondary" size="sm" data-testid="pa-check-again" [loading]="attempt().checking()" (click)="attempt().checkAgain()">{{ text('paymentAttempt.checkAgain') }}</ui-button>
|
|
4569
5397
|
@if (allowStartOver()) {
|
|
@@ -6238,6 +7066,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
6238
7066
|
}]
|
|
6239
7067
|
}
|
|
6240
7068
|
});
|
|
6241
|
-
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 };
|
|
6242
7070
|
|
|
6243
7071
|
//# sourceMappingURL=forgeroute-ui-payments.mjs.map
|