@forgeroute/ui 0.5.18 → 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-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 +790 -47
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-chip.d.ts +11 -1
- package/types/forgeroute-ui-core.d.ts +62 -9
- package/types/forgeroute-ui-data-table-core.d.ts +60 -1
- package/types/forgeroute-ui-messaging.d.ts +10 -0
- 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 +1 -1
- package/types/forgeroute-ui-square.d.ts +1 -1
- package/types/forgeroute-ui-stripe.d.ts +283 -15
- package/types/forgeroute-ui-table-types.d.ts +29 -0
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Woi3az70.mjs.map +0 -1
|
@@ -592,6 +592,8 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
592
592
|
this.submitLabel = input("", ...ngDevMode ? [{ debugName: "submitLabel" }] : /* istanbul ignore next */ []);
|
|
593
593
|
this.showSubmit = input(true, ...ngDevMode ? [{ debugName: "showSubmit" }] : /* istanbul ignore next */ []);
|
|
594
594
|
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
595
|
+
this.blocked = input(false, ...ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []);
|
|
596
|
+
this.blockedReason = input("", ...ngDevMode ? [{ debugName: "blockedReason" }] : /* istanbul ignore next */ []);
|
|
595
597
|
this.pending = input(false, ...ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []);
|
|
596
598
|
this.labelInput = input(null, {
|
|
597
599
|
...ngDevMode ? { debugName: "labelInput" } : /* istanbul ignore next */ {},
|
|
@@ -648,7 +650,8 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
648
650
|
this.achNoticeVisible = computed(() => this.showAchNotice() && this.selectedType() === "us_bank_account", ...ngDevMode ? [{ debugName: "achNoticeVisible" }] : /* istanbul ignore next */ []);
|
|
649
651
|
this.achNoticeText = computed(() => this.achNoticeInput() ?? this.labels.t(this.instantOnly() ? "stripePayment.achNoticeInstant" : "stripePayment.achNotice"), ...ngDevMode ? [{ debugName: "achNoticeText" }] : /* istanbul ignore next */ []);
|
|
650
652
|
this.effectiveSubmitLabel = computed(() => this.submitLabel() || (this.mode() === "setup" ? this.labels.t("stripePayment.saveMethod") : this.labels.t("stripePayment.pay")), ...ngDevMode ? [{ debugName: "effectiveSubmitLabel" }] : /* istanbul ignore next */ []);
|
|
651
|
-
this.
|
|
653
|
+
this.blockedText = computed(() => this.blockedReason().trim() || this.labels.t("paymentBlocked.default"), ...ngDevMode ? [{ debugName: "blockedText" }] : /* istanbul ignore next */ []);
|
|
654
|
+
this.submitDisabled = computed(() => this.disabled() || this.blocked() || this.loading() || this.pending() || !this.isReady() || !!this.loadErrorText() || this.protectionOn() && (this.attempt.unknown() || this.attempt.paidLocked() || !this.readiness.ready()), ...ngDevMode ? [{ debugName: "submitDisabled" }] : /* istanbul ignore next */ []);
|
|
652
655
|
this.messages = computed(() => {
|
|
653
656
|
const given = Object.fromEntries(Object.entries(this.a11yMessages() ?? {}).filter(([, text]) => typeof text === "string"));
|
|
654
657
|
return {
|
|
@@ -795,7 +798,7 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
795
798
|
});
|
|
796
799
|
}
|
|
797
800
|
async confirm(options = {}) {
|
|
798
|
-
if (this.disabled()) return null;
|
|
801
|
+
if (this.disabled() || this.blocked()) return null;
|
|
799
802
|
if (this.protectionOn()) return this.confirmProtected(options);
|
|
800
803
|
if (this.submitting()) return null;
|
|
801
804
|
return this.confirmCore(options, null);
|
|
@@ -1901,6 +1904,20 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
1901
1904
|
isRequired: false,
|
|
1902
1905
|
transformFunction: null
|
|
1903
1906
|
},
|
|
1907
|
+
blocked: {
|
|
1908
|
+
classPropertyName: "blocked",
|
|
1909
|
+
publicName: "blocked",
|
|
1910
|
+
isSignal: true,
|
|
1911
|
+
isRequired: false,
|
|
1912
|
+
transformFunction: null
|
|
1913
|
+
},
|
|
1914
|
+
blockedReason: {
|
|
1915
|
+
classPropertyName: "blockedReason",
|
|
1916
|
+
publicName: "blockedReason",
|
|
1917
|
+
isSignal: true,
|
|
1918
|
+
isRequired: false,
|
|
1919
|
+
transformFunction: null
|
|
1920
|
+
},
|
|
1904
1921
|
pending: {
|
|
1905
1922
|
classPropertyName: "pending",
|
|
1906
1923
|
publicName: "pending",
|
|
@@ -2079,6 +2096,12 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
2079
2096
|
@if (!mountOnly() && errorText(); as text) {
|
|
2080
2097
|
<div #errorBox class="sp-block sp-error" [id]="errorId" tabindex="-1" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
|
|
2081
2098
|
}
|
|
2099
|
+
@if (!mountOnly()) {
|
|
2100
|
+
<!-- stays in the DOM so the reason is announced when it appears; the reason is text in a warning alert, never colour alone -->
|
|
2101
|
+
<div class="sp-blocked" role="status" aria-live="polite" data-testid="stripe-blocked-status">
|
|
2102
|
+
@if (blocked()) { <ui-alert variant="warning" [quiet]="true" data-testid="stripe-blocked">{{ blockedText() }}</ui-alert> }
|
|
2103
|
+
</div>
|
|
2104
|
+
}
|
|
2082
2105
|
@if (!mountOnly() && showSubmit()) {
|
|
2083
2106
|
<div class="sp-actions">
|
|
2084
2107
|
<ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
|
|
@@ -2088,7 +2111,7 @@ var StripePaymentComponent = class StripePaymentComponent {
|
|
|
2088
2111
|
</div>
|
|
2089
2112
|
`,
|
|
2090
2113
|
isInline: true,
|
|
2091
|
-
styles: ["ui-stripe-payment{display:block;min-width:0}ui-stripe-payment .sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-error{outline:none;scroll-margin-top:16px;scroll-margin-bottom:80px}.sp-label{font-size:.875rem;font-weight:500;color:#1e293b;margin-bottom:6px}.sp-required{color:#dc2626;margin-left:2px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}ui-stripe-payment .sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}ui-stripe-payment .sp-actions .btn{width:100%}}\n"],
|
|
2114
|
+
styles: ["ui-stripe-payment{display:block;min-width:0}ui-stripe-payment .sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-blocked:not(:empty){margin-top:12px}.sp-error{outline:none;scroll-margin-top:16px;scroll-margin-bottom:80px}.sp-label{font-size:.875rem;font-weight:500;color:#1e293b;margin-bottom:6px}.sp-required{color:#dc2626;margin-left:2px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}ui-stripe-payment .sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}ui-stripe-payment .sp-actions .btn{width:100%}}\n"],
|
|
2092
2115
|
dependencies: [
|
|
2093
2116
|
{
|
|
2094
2117
|
kind: "component",
|
|
@@ -2215,6 +2238,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2215
2238
|
@if (!mountOnly() && errorText(); as text) {
|
|
2216
2239
|
<div #errorBox class="sp-block sp-error" [id]="errorId" tabindex="-1" data-testid="stripe-error"><ui-alert variant="danger">{{ text }}</ui-alert></div>
|
|
2217
2240
|
}
|
|
2241
|
+
@if (!mountOnly()) {
|
|
2242
|
+
<!-- stays in the DOM so the reason is announced when it appears; the reason is text in a warning alert, never colour alone -->
|
|
2243
|
+
<div class="sp-blocked" role="status" aria-live="polite" data-testid="stripe-blocked-status">
|
|
2244
|
+
@if (blocked()) { <ui-alert variant="warning" [quiet]="true" data-testid="stripe-blocked">{{ blockedText() }}</ui-alert> }
|
|
2245
|
+
</div>
|
|
2246
|
+
}
|
|
2218
2247
|
@if (!mountOnly() && showSubmit()) {
|
|
2219
2248
|
<div class="sp-actions">
|
|
2220
2249
|
<ui-button variant="primary" type="button" [loading]="submitting()" [disabled]="submitDisabled()" [ariaDescribedBy]="errorText() ? errorId : undefined"
|
|
@@ -2223,7 +2252,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2223
2252
|
}
|
|
2224
2253
|
</div>
|
|
2225
2254
|
`,
|
|
2226
|
-
styles: ["ui-stripe-payment{display:block;min-width:0}ui-stripe-payment .sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-error{outline:none;scroll-margin-top:16px;scroll-margin-bottom:80px}.sp-label{font-size:.875rem;font-weight:500;color:#1e293b;margin-bottom:6px}.sp-required{color:#dc2626;margin-left:2px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}ui-stripe-payment .sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}ui-stripe-payment .sp-actions .btn{width:100%}}\n"]
|
|
2255
|
+
styles: ["ui-stripe-payment{display:block;min-width:0}ui-stripe-payment .sp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sp-block{margin-top:12px}.sp-blocked:not(:empty){margin-top:12px}.sp-error{outline:none;scroll-margin-top:16px;scroll-margin-bottom:80px}.sp-label{font-size:.875rem;font-weight:500;color:#1e293b;margin-bottom:6px}.sp-required{color:#dc2626;margin-left:2px}.sp-actions{margin-top:16px;display:flex;justify-content:flex-end}ui-stripe-payment .sp{position:relative}.sp-mount--hidden{position:absolute;top:0;left:0;right:0;opacity:0;pointer-events:none}@media(max-width:480px){.sp-actions{display:block}.sp-actions ui-button{display:flex}ui-stripe-payment .sp-actions .btn{width:100%}}\n"]
|
|
2227
2256
|
}]
|
|
2228
2257
|
}],
|
|
2229
2258
|
ctorParameters: () => [],
|
|
@@ -2676,6 +2705,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2676
2705
|
required: false
|
|
2677
2706
|
}]
|
|
2678
2707
|
}],
|
|
2708
|
+
blocked: [{
|
|
2709
|
+
type: i0.Input,
|
|
2710
|
+
args: [{
|
|
2711
|
+
isSignal: true,
|
|
2712
|
+
alias: "blocked",
|
|
2713
|
+
required: false
|
|
2714
|
+
}]
|
|
2715
|
+
}],
|
|
2716
|
+
blockedReason: [{
|
|
2717
|
+
type: i0.Input,
|
|
2718
|
+
args: [{
|
|
2719
|
+
isSignal: true,
|
|
2720
|
+
alias: "blockedReason",
|
|
2721
|
+
required: false
|
|
2722
|
+
}]
|
|
2723
|
+
}],
|
|
2679
2724
|
pending: [{
|
|
2680
2725
|
type: i0.Input,
|
|
2681
2726
|
args: [{
|
|
@@ -4846,6 +4891,24 @@ const STRIPE_READER_STATE_PRECEDENCE = [
|
|
|
4846
4891
|
"reader_busy",
|
|
4847
4892
|
"reader_offline"
|
|
4848
4893
|
];
|
|
4894
|
+
function isTerminalChecking(state) {
|
|
4895
|
+
return state === "checking" || state === "stale" || state === "unknown";
|
|
4896
|
+
}
|
|
4897
|
+
const STRIPE_READER_BANNER_REASONS = {
|
|
4898
|
+
sandbox: "stripeReaderBanner.sandbox",
|
|
4899
|
+
service_disabled: "stripeReaderBanner.serviceDisabled",
|
|
4900
|
+
processor_unsupported: "stripeReaderBanner.processorUnsupported"
|
|
4901
|
+
};
|
|
4902
|
+
function readerBannerReasonKey(reason) {
|
|
4903
|
+
return reason && Object.prototype.hasOwnProperty.call(STRIPE_READER_BANNER_REASONS, reason) ? STRIPE_READER_BANNER_REASONS[reason] : null;
|
|
4904
|
+
}
|
|
4905
|
+
const STRIPE_READER_POLL_MIN_MS = 500;
|
|
4906
|
+
const STRIPE_READER_POLL_MAX_MS = 3e4;
|
|
4907
|
+
const STRIPE_READER_POLL_DEFAULT_MS = 2e3;
|
|
4908
|
+
function clampReaderPollMs(value) {
|
|
4909
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return STRIPE_READER_POLL_DEFAULT_MS;
|
|
4910
|
+
return Math.min(STRIPE_READER_POLL_MAX_MS, Math.max(500, Math.round(value)));
|
|
4911
|
+
}
|
|
4849
4912
|
function readerErrorInfo(error) {
|
|
4850
4913
|
const e = error;
|
|
4851
4914
|
const pick = (guard, ...values) => {
|
|
@@ -4886,7 +4949,7 @@ function paymentBaseAmount(payment) {
|
|
|
4886
4949
|
return null;
|
|
4887
4950
|
}
|
|
4888
4951
|
function readerDegraded(terminal, locale) {
|
|
4889
|
-
if (!terminal || !(terminal.state
|
|
4952
|
+
if (!terminal || !(isTerminalChecking(terminal.state) || terminal.stale === true)) return null;
|
|
4890
4953
|
if (terminal.degradedReason === "reconnect_required" || terminal.degradedReason === "processor_refused") return { kind: "attention" };
|
|
4891
4954
|
if (typeof terminal.staleReads === "number" && terminal.staleReads >= 3 && terminal.staleSince) {
|
|
4892
4955
|
const at = new Date(terminal.staleSince);
|
|
@@ -4925,7 +4988,8 @@ function readerRefusalLabelKey(code) {
|
|
|
4925
4988
|
case "payment_being_sent": return "stripeReader.refusal.payment_being_sent";
|
|
4926
4989
|
case "paid": return "stripeReader.refusal.paid";
|
|
4927
4990
|
case "offline": return "stripeReader.refusal.offline";
|
|
4928
|
-
case "
|
|
4991
|
+
case "outcome_checking":
|
|
4992
|
+
case "outcome_unknown": return "stripeReader.refusal.outcome_checking";
|
|
4929
4993
|
case "queued_offline": return "stripeReader.refusal.queued_offline";
|
|
4930
4994
|
case "start_not_received": return "stripeReader.refusal.start_not_received";
|
|
4931
4995
|
case "retry_unreachable": return "stripeReader.refusal.retry_unreachable";
|
|
@@ -4966,13 +5030,15 @@ const KNOWN_STATES = [
|
|
|
4966
5030
|
"reader_ready",
|
|
4967
5031
|
"reader_busy",
|
|
4968
5032
|
"reader_offline",
|
|
5033
|
+
"checking",
|
|
4969
5034
|
"unknown"
|
|
4970
5035
|
];
|
|
4971
5036
|
function normalizeReadiness(raw) {
|
|
4972
5037
|
const r = raw;
|
|
4973
5038
|
const readers = Array.isArray(r?.readers) ? r.readers.filter((x) => !!x && typeof x.id === "string") : [];
|
|
4974
|
-
let state = KNOWN_STATES.includes(r?.state) ? r.state : "
|
|
4975
|
-
if (state === "
|
|
5039
|
+
let state = KNOWN_STATES.includes(r?.state) ? r.state : "checking";
|
|
5040
|
+
if (state === "unknown") state = "checking";
|
|
5041
|
+
if (state === "reader_ready" && !readers.some(isReaderFree)) state = "checking";
|
|
4976
5042
|
return {
|
|
4977
5043
|
state,
|
|
4978
5044
|
readers,
|
|
@@ -4984,6 +5050,19 @@ function normalizeReadiness(raw) {
|
|
|
4984
5050
|
...r?.degradedReason ? { degradedReason: r.degradedReason } : {}
|
|
4985
5051
|
};
|
|
4986
5052
|
}
|
|
5053
|
+
function formatReaderTime(value, locale) {
|
|
5054
|
+
if (value == null || value === "") return "";
|
|
5055
|
+
const at = value instanceof Date ? value : new Date(value);
|
|
5056
|
+
if (Number.isNaN(at.getTime())) return "";
|
|
5057
|
+
try {
|
|
5058
|
+
return new Intl.DateTimeFormat(locale, {
|
|
5059
|
+
hour: "numeric",
|
|
5060
|
+
minute: "2-digit"
|
|
5061
|
+
}).format(at);
|
|
5062
|
+
} catch {
|
|
5063
|
+
return "";
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
4987
5066
|
function readerDisplayName(reader) {
|
|
4988
5067
|
if (!reader) return "";
|
|
4989
5068
|
return reader.label?.trim() || reader.model?.trim() || STRIPE_READER_MODELS.find((m) => m.deviceType === reader.deviceType)?.model || reader.id;
|
|
@@ -5075,7 +5154,7 @@ var StripeReaderFlow = class {
|
|
|
5075
5154
|
const begun = this.o.attempt.begin();
|
|
5076
5155
|
if (!begun.ok) {
|
|
5077
5156
|
if (begun.reason !== "locked") this.refuse({
|
|
5078
|
-
code: begun.reason === "unknown" ? "
|
|
5157
|
+
code: begun.reason === "unknown" ? "outcome_checking" : begun.reason,
|
|
5079
5158
|
message: "",
|
|
5080
5159
|
paymentId: null,
|
|
5081
5160
|
terminal: null
|
|
@@ -5362,7 +5441,7 @@ var StripeReaderFlow = class {
|
|
|
5362
5441
|
return;
|
|
5363
5442
|
}
|
|
5364
5443
|
this.recoveryExpired.set(false);
|
|
5365
|
-
this.checking.set(!!t && (t.state
|
|
5444
|
+
this.checking.set(!!t && (isTerminalChecking(t.state) || t.stale === true));
|
|
5366
5445
|
this.readerOffline.set(!!t && t.readerOnline === false);
|
|
5367
5446
|
const busyOp = this.phase() === "cancelling" || this.phase() === "retrying";
|
|
5368
5447
|
if (t?.state === "declined") {
|
|
@@ -5530,6 +5609,7 @@ var StripeReaderStatusComponent = class StripeReaderStatusComponent {
|
|
|
5530
5609
|
this.cancelling = input(false, ...ngDevMode ? [{ debugName: "cancelling" }] : /* istanbul ignore next */ []);
|
|
5531
5610
|
this.showManual = input(false, ...ngDevMode ? [{ debugName: "showManual" }] : /* istanbul ignore next */ []);
|
|
5532
5611
|
this.hideConnect = input(false, ...ngDevMode ? [{ debugName: "hideConnect" }] : /* istanbul ignore next */ []);
|
|
5612
|
+
this.hardwareShopAvailable = input(true, ...ngDevMode ? [{ debugName: "hardwareShopAvailable" }] : /* istanbul ignore next */ []);
|
|
5533
5613
|
this.connectReader = output();
|
|
5534
5614
|
this.getReader = output();
|
|
5535
5615
|
this.recheck = output();
|
|
@@ -5538,7 +5618,13 @@ var StripeReaderStatusComponent = class StripeReaderStatusComponent {
|
|
|
5538
5618
|
this.manual = output();
|
|
5539
5619
|
this.state = computed(() => {
|
|
5540
5620
|
const r = this.readiness();
|
|
5541
|
-
|
|
5621
|
+
if (!r) return this.loading() ? "loading" : "checking";
|
|
5622
|
+
if (r.state === "checking" || r.state === "unknown") return readerDegraded({
|
|
5623
|
+
state: "checking",
|
|
5624
|
+
stale: true,
|
|
5625
|
+
degradedReason: r.degradedReason
|
|
5626
|
+
})?.kind === "attention" ? "attention" : "checking";
|
|
5627
|
+
return r.state;
|
|
5542
5628
|
}, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
5543
5629
|
this.variant = computed(() => this.state() === "no_reader" || this.state() === "unsupported_only" || this.state() === "reader_busy" ? "info" : "warning", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
5544
5630
|
this.busyName = computed(() => {
|
|
@@ -5547,15 +5633,8 @@ var StripeReaderStatusComponent = class StripeReaderStatusComponent {
|
|
|
5547
5633
|
return reader ? readerDisplayName(reader) : this.labels.t("stripeReader.theReader");
|
|
5548
5634
|
}, ...ngDevMode ? [{ debugName: "busyName" }] : /* istanbul ignore next */ []);
|
|
5549
5635
|
this.reconnect = computed(() => this.state() === "merchant_not_ready" && this.readiness()?.reason === "reconnect_required", ...ngDevMode ? [{ debugName: "reconnect" }] : /* istanbul ignore next */ []);
|
|
5550
|
-
this.attention = computed(() => {
|
|
5551
|
-
|
|
5552
|
-
return this.state() === "unknown" && !!r && readerDegraded({
|
|
5553
|
-
state: "unknown",
|
|
5554
|
-
stale: true,
|
|
5555
|
-
degradedReason: r.degradedReason
|
|
5556
|
-
})?.kind === "attention";
|
|
5557
|
-
}, ...ngDevMode ? [{ debugName: "attention" }] : /* istanbul ignore next */ []);
|
|
5558
|
-
this.textKey = computed(() => this.reconnect() ? "reconnect_required" : this.attention() ? "unknown_attention" : this.state(), ...ngDevMode ? [{ debugName: "textKey" }] : /* istanbul ignore next */ []);
|
|
5636
|
+
this.attention = computed(() => this.state() === "attention", ...ngDevMode ? [{ debugName: "attention" }] : /* istanbul ignore next */ []);
|
|
5637
|
+
this.textKey = computed(() => this.reconnect() ? "reconnect_required" : this.attention() ? "stale_attention" : this.state(), ...ngDevMode ? [{ debugName: "textKey" }] : /* istanbul ignore next */ []);
|
|
5559
5638
|
this.title = computed(() => this.labels.t(`stripeReader.status.${this.textKey()}.title`), ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
5560
5639
|
this.text = computed(() => this.labels.t(`stripeReader.status.${this.textKey()}.text`, { reader: this.busyName() }), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
5561
5640
|
this.liveText = computed(() => {
|
|
@@ -5628,6 +5707,13 @@ var StripeReaderStatusComponent = class StripeReaderStatusComponent {
|
|
|
5628
5707
|
isSignal: true,
|
|
5629
5708
|
isRequired: false,
|
|
5630
5709
|
transformFunction: null
|
|
5710
|
+
},
|
|
5711
|
+
hardwareShopAvailable: {
|
|
5712
|
+
classPropertyName: "hardwareShopAvailable",
|
|
5713
|
+
publicName: "hardwareShopAvailable",
|
|
5714
|
+
isSignal: true,
|
|
5715
|
+
isRequired: false,
|
|
5716
|
+
transformFunction: null
|
|
5631
5717
|
}
|
|
5632
5718
|
},
|
|
5633
5719
|
outputs: {
|
|
@@ -5656,12 +5742,12 @@ var StripeReaderStatusComponent = class StripeReaderStatusComponent {
|
|
|
5656
5742
|
@if (!hideConnect()) {
|
|
5657
5743
|
<ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('stripeReader.status.connect') }}</ui-button>
|
|
5658
5744
|
}
|
|
5659
|
-
<ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t('stripeReader.status.get') }}</ui-button>
|
|
5745
|
+
<ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t(hardwareShopAvailable() ? 'stripeReader.status.get' : 'stripeReader.status.getInfo') }}</ui-button>
|
|
5660
5746
|
}
|
|
5661
5747
|
@if (state() === 'merchant_not_ready' || attention()) {
|
|
5662
5748
|
<ui-button variant="primary" size="sm" data-testid="reader-status-setup" (click)="openSetup.emit()">{{ labels.t(reconnect() || attention() ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
|
|
5663
5749
|
}
|
|
5664
|
-
@if (state() === 'reader_offline' || state() === '
|
|
5750
|
+
@if (state() === 'reader_offline' || state() === 'checking' || state() === 'attention') {
|
|
5665
5751
|
<ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
|
|
5666
5752
|
}
|
|
5667
5753
|
@if (state() === 'reader_busy') {
|
|
@@ -5791,12 +5877,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
5791
5877
|
@if (!hideConnect()) {
|
|
5792
5878
|
<ui-button variant="primary" size="sm" data-testid="reader-status-connect" (click)="connectReader.emit()">{{ labels.t('stripeReader.status.connect') }}</ui-button>
|
|
5793
5879
|
}
|
|
5794
|
-
<ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t('stripeReader.status.get') }}</ui-button>
|
|
5880
|
+
<ui-button [variant]="hideConnect() ? 'primary' : 'secondary'" size="sm" data-testid="reader-status-get" (click)="getReader.emit()">{{ labels.t(hardwareShopAvailable() ? 'stripeReader.status.get' : 'stripeReader.status.getInfo') }}</ui-button>
|
|
5795
5881
|
}
|
|
5796
5882
|
@if (state() === 'merchant_not_ready' || attention()) {
|
|
5797
5883
|
<ui-button variant="primary" size="sm" data-testid="reader-status-setup" (click)="openSetup.emit()">{{ labels.t(reconnect() || attention() ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
|
|
5798
5884
|
}
|
|
5799
|
-
@if (state() === 'reader_offline' || state() === '
|
|
5885
|
+
@if (state() === 'reader_offline' || state() === 'checking' || state() === 'attention') {
|
|
5800
5886
|
<ui-button variant="secondary" size="sm" data-testid="reader-status-recheck" (click)="recheck.emit()">{{ labels.t('stripeReader.status.recheck') }}</ui-button>
|
|
5801
5887
|
}
|
|
5802
5888
|
@if (state() === 'reader_busy') {
|
|
@@ -5865,6 +5951,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
5865
5951
|
required: false
|
|
5866
5952
|
}]
|
|
5867
5953
|
}],
|
|
5954
|
+
hardwareShopAvailable: [{
|
|
5955
|
+
type: i0.Input,
|
|
5956
|
+
args: [{
|
|
5957
|
+
isSignal: true,
|
|
5958
|
+
alias: "hardwareShopAvailable",
|
|
5959
|
+
required: false
|
|
5960
|
+
}]
|
|
5961
|
+
}],
|
|
5868
5962
|
connectReader: [{
|
|
5869
5963
|
type: i0.Output,
|
|
5870
5964
|
args: ["connectReader"]
|
|
@@ -5891,6 +5985,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
5891
5985
|
}]
|
|
5892
5986
|
}
|
|
5893
5987
|
});
|
|
5988
|
+
const STRIPE_READER_NO_READER_STATES = [
|
|
5989
|
+
"no_reader",
|
|
5990
|
+
"unsupported_only",
|
|
5991
|
+
"merchant_not_ready"
|
|
5992
|
+
];
|
|
5894
5993
|
var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
5895
5994
|
constructor() {
|
|
5896
5995
|
this.labels = inject(UiLabelsService);
|
|
@@ -5919,6 +6018,8 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
5919
6018
|
this.active = input(true, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
5920
6019
|
this.manualAvailable = input(true, ...ngDevMode ? [{ debugName: "manualAvailable" }] : /* istanbul ignore next */ []);
|
|
5921
6020
|
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
6021
|
+
this.hideChecking = input(false, ...ngDevMode ? [{ debugName: "hideChecking" }] : /* istanbul ignore next */ []);
|
|
6022
|
+
this.hideBanner = input(false, ...ngDevMode ? [{ debugName: "hideBanner" }] : /* istanbul ignore next */ []);
|
|
5922
6023
|
this.beforeStart = input(null, ...ngDevMode ? [{ debugName: "beforeStart" }] : /* istanbul ignore next */ []);
|
|
5923
6024
|
this.readinessEveryMs = input(15e3, ...ngDevMode ? [{ debugName: "readinessEveryMs" }] : /* istanbul ignore next */ []);
|
|
5924
6025
|
this.readinessTimeoutMs = input(4e3, ...ngDevMode ? [{ debugName: "readinessTimeoutMs" }] : /* istanbul ignore next */ []);
|
|
@@ -5973,7 +6074,7 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
5973
6074
|
getPayment: () => this.getPayment(),
|
|
5974
6075
|
retry: () => this.retryPayment(),
|
|
5975
6076
|
cancel: () => this.cancelPaymentFn(),
|
|
5976
|
-
pollMs: () => this.pollMs(),
|
|
6077
|
+
pollMs: () => clampReaderPollMs(this.pollMs()),
|
|
5977
6078
|
pollTimeoutMs: () => this.pollTimeoutMs(),
|
|
5978
6079
|
lostAnswerGraceMs: () => this.lostAnswerGraceMs(),
|
|
5979
6080
|
requestTimeoutMs: () => this.requestTimeoutMs(),
|
|
@@ -6028,8 +6129,26 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
6028
6129
|
return null;
|
|
6029
6130
|
}, ...ngDevMode ? [{ debugName: "idleNotice" }] : /* istanbul ignore next */ []);
|
|
6030
6131
|
this.showBlocked = computed(() => this.active() && this.flow.phase() === "idle" && !this.idleNotice(), ...ngDevMode ? [{ debugName: "showBlocked" }] : /* istanbul ignore next */ []);
|
|
6132
|
+
this.ownsReaderMessage = computed(() => {
|
|
6133
|
+
if (this.flow.phase() !== "idle" || this.flow.locked()) return true;
|
|
6134
|
+
if (this.idleNotice()) return true;
|
|
6135
|
+
if (this.blockReason()) return this.showBlocked();
|
|
6136
|
+
return this.showReadiness() && this.shownReadiness()?.state !== "reader_ready";
|
|
6137
|
+
}, ...ngDevMode ? [{ debugName: "ownsReaderMessage" }] : /* istanbul ignore next */ []);
|
|
6138
|
+
this.shownReadiness = computed(() => {
|
|
6139
|
+
const r = this.readiness();
|
|
6140
|
+
if (!r) return null;
|
|
6141
|
+
if ((r.state === "checking" || r.state === "unknown") && readerDegraded({
|
|
6142
|
+
state: "checking",
|
|
6143
|
+
stale: true,
|
|
6144
|
+
degradedReason: r.degradedReason
|
|
6145
|
+
})?.kind !== "attention") return null;
|
|
6146
|
+
return r;
|
|
6147
|
+
}, ...ngDevMode ? [{ debugName: "shownReadiness" }] : /* istanbul ignore next */ []);
|
|
6031
6148
|
this.showReadiness = computed(() => {
|
|
6032
6149
|
if (this.flow.locked() || this.flow.phase() === "succeeded") return false;
|
|
6150
|
+
if (!this.shownReadiness() && this.hideChecking()) return false;
|
|
6151
|
+
if (this.hideBanner() && STRIPE_READER_NO_READER_STATES.includes(this.shownReadiness()?.state)) return false;
|
|
6033
6152
|
return this.active() ? this.flow.phase() === "idle" && !this.idleNotice() : true;
|
|
6034
6153
|
}, ...ngDevMode ? [{ debugName: "showReadiness" }] : /* istanbul ignore next */ []);
|
|
6035
6154
|
this.busyOwnPaymentId = computed(() => {
|
|
@@ -6150,7 +6269,7 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
6150
6269
|
if (!this.active()) return "";
|
|
6151
6270
|
if (this.blockReason() && !this.flow.locked() && phase !== "succeeded") return this.blockText();
|
|
6152
6271
|
if (this.closeBlocked() && this.flow.locked()) return this.labels.t("stripeReader.closeBlocked");
|
|
6153
|
-
if (phase === "idle") return this.foreignPending() ? this.labels.t("stripeReader.refusal.
|
|
6272
|
+
if (phase === "idle") return this.foreignPending() ? this.labels.t("stripeReader.refusal.outcome_checking") : "";
|
|
6154
6273
|
if (phase === "starting") return this.labels.t("stripeReader.startingText");
|
|
6155
6274
|
if (phase === "succeeded") return "";
|
|
6156
6275
|
if (phase === "canceled") return `${this.labels.t("stripeReader.canceled.title")}. ${this.labels.t("stripeReader.canceled.text")}`;
|
|
@@ -6659,6 +6778,20 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
6659
6778
|
isRequired: false,
|
|
6660
6779
|
transformFunction: null
|
|
6661
6780
|
},
|
|
6781
|
+
hideChecking: {
|
|
6782
|
+
classPropertyName: "hideChecking",
|
|
6783
|
+
publicName: "hideChecking",
|
|
6784
|
+
isSignal: true,
|
|
6785
|
+
isRequired: false,
|
|
6786
|
+
transformFunction: null
|
|
6787
|
+
},
|
|
6788
|
+
hideBanner: {
|
|
6789
|
+
classPropertyName: "hideBanner",
|
|
6790
|
+
publicName: "hideBanner",
|
|
6791
|
+
isSignal: true,
|
|
6792
|
+
isRequired: false,
|
|
6793
|
+
transformFunction: null
|
|
6794
|
+
},
|
|
6662
6795
|
beforeStart: {
|
|
6663
6796
|
classPropertyName: "beforeStart",
|
|
6664
6797
|
publicName: "beforeStart",
|
|
@@ -6741,7 +6874,7 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
6741
6874
|
<ui-alert variant="warning" [quiet]="true" data-testid="reader-blocked" [attr.data-reason]="reason">{{ blockText() }}</ui-alert>
|
|
6742
6875
|
}
|
|
6743
6876
|
} @else if (showReadiness()) {
|
|
6744
|
-
<ui-stripe-reader-status [readiness]="
|
|
6877
|
+
<ui-stripe-reader-status [readiness]="shownReadiness()" [loading]="readinessLoading() && !readiness()" [ownBusyPaymentId]="busyOwnPaymentId()" [cancelling]="cancellingBusy()"
|
|
6745
6878
|
[hideConnect]="false"
|
|
6746
6879
|
(connectReader)="connectReader.emit()" (getReader)="getReader.emit()" (recheck)="loadReadiness()" (openSetup)="openSetup.emit()" (cancelBusy)="cancelBusy($event)" />
|
|
6747
6880
|
}
|
|
@@ -6796,7 +6929,7 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
6796
6929
|
<ui-alert variant="info" [quiet]="true" data-testid="reader-paid">{{ labels.t('stripeReader.refusal.paid') }}</ui-alert>
|
|
6797
6930
|
}
|
|
6798
6931
|
@case ('pending-other') {
|
|
6799
|
-
<ui-alert variant="warning" [quiet]="true" data-testid="reader-pending-other">{{ labels.t('stripeReader.refusal.
|
|
6932
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="reader-pending-other">{{ labels.t('stripeReader.refusal.outcome_checking') }}</ui-alert>
|
|
6800
6933
|
}
|
|
6801
6934
|
@case ('cancel-timeout') {
|
|
6802
6935
|
<ui-alert variant="warning" [quiet]="true" data-testid="reader-cancel-busy-timeout">{{ labels.t('stripeReader.cancelBusy.timeout') }}
|
|
@@ -7093,7 +7226,8 @@ var StripeReaderPaymentComponent = class StripeReaderPaymentComponent {
|
|
|
7093
7226
|
"ownBusyPaymentId",
|
|
7094
7227
|
"cancelling",
|
|
7095
7228
|
"showManual",
|
|
7096
|
-
"hideConnect"
|
|
7229
|
+
"hideConnect",
|
|
7230
|
+
"hardwareShopAvailable"
|
|
7097
7231
|
],
|
|
7098
7232
|
outputs: [
|
|
7099
7233
|
"connectReader",
|
|
@@ -7141,7 +7275,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
7141
7275
|
<ui-alert variant="warning" [quiet]="true" data-testid="reader-blocked" [attr.data-reason]="reason">{{ blockText() }}</ui-alert>
|
|
7142
7276
|
}
|
|
7143
7277
|
} @else if (showReadiness()) {
|
|
7144
|
-
<ui-stripe-reader-status [readiness]="
|
|
7278
|
+
<ui-stripe-reader-status [readiness]="shownReadiness()" [loading]="readinessLoading() && !readiness()" [ownBusyPaymentId]="busyOwnPaymentId()" [cancelling]="cancellingBusy()"
|
|
7145
7279
|
[hideConnect]="false"
|
|
7146
7280
|
(connectReader)="connectReader.emit()" (getReader)="getReader.emit()" (recheck)="loadReadiness()" (openSetup)="openSetup.emit()" (cancelBusy)="cancelBusy($event)" />
|
|
7147
7281
|
}
|
|
@@ -7196,7 +7330,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
7196
7330
|
<ui-alert variant="info" [quiet]="true" data-testid="reader-paid">{{ labels.t('stripeReader.refusal.paid') }}</ui-alert>
|
|
7197
7331
|
}
|
|
7198
7332
|
@case ('pending-other') {
|
|
7199
|
-
<ui-alert variant="warning" [quiet]="true" data-testid="reader-pending-other">{{ labels.t('stripeReader.refusal.
|
|
7333
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="reader-pending-other">{{ labels.t('stripeReader.refusal.outcome_checking') }}</ui-alert>
|
|
7200
7334
|
}
|
|
7201
7335
|
@case ('cancel-timeout') {
|
|
7202
7336
|
<ui-alert variant="warning" [quiet]="true" data-testid="reader-cancel-busy-timeout">{{ labels.t('stripeReader.cancelBusy.timeout') }}
|
|
@@ -7458,6 +7592,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
7458
7592
|
required: false
|
|
7459
7593
|
}]
|
|
7460
7594
|
}],
|
|
7595
|
+
hideChecking: [{
|
|
7596
|
+
type: i0.Input,
|
|
7597
|
+
args: [{
|
|
7598
|
+
isSignal: true,
|
|
7599
|
+
alias: "hideChecking",
|
|
7600
|
+
required: false
|
|
7601
|
+
}]
|
|
7602
|
+
}],
|
|
7603
|
+
hideBanner: [{
|
|
7604
|
+
type: i0.Input,
|
|
7605
|
+
args: [{
|
|
7606
|
+
isSignal: true,
|
|
7607
|
+
alias: "hideBanner",
|
|
7608
|
+
required: false
|
|
7609
|
+
}]
|
|
7610
|
+
}],
|
|
7461
7611
|
beforeStart: [{
|
|
7462
7612
|
type: i0.Input,
|
|
7463
7613
|
args: [{
|
|
@@ -7584,6 +7734,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7584
7734
|
this.reader = computed(() => this.config().reader(), ...ngDevMode ? [{ debugName: "reader" }] : /* istanbul ignore next */ []);
|
|
7585
7735
|
this.readerEnabled = computed(() => !!this.reader() && this.ctx().method === "CARD", ...ngDevMode ? [{ debugName: "readerEnabled" }] : /* istanbul ignore next */ []);
|
|
7586
7736
|
this.readerState = signal(null, ...ngDevMode ? [{ debugName: "readerState" }] : /* istanbul ignore next */ []);
|
|
7737
|
+
this.readerAnswered = false;
|
|
7587
7738
|
this.choice = signal(null, ...ngDevMode ? [{ debugName: "choice" }] : /* istanbul ignore next */ []);
|
|
7588
7739
|
this.modeShown = signal("manual", ...ngDevMode ? [{ debugName: "modeShown" }] : /* istanbul ignore next */ []);
|
|
7589
7740
|
this.readerPaid = signal(null, ...ngDevMode ? [{ debugName: "readerPaid" }] : /* istanbul ignore next */ []);
|
|
@@ -7600,7 +7751,10 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7600
7751
|
label: this.labels.t("stripeReader.mode.manual"),
|
|
7601
7752
|
testId: "stripe-reader-mode-manual"
|
|
7602
7753
|
}], ...ngDevMode ? [{ debugName: "modeOptions" }] : /* istanbul ignore next */ []);
|
|
7603
|
-
this.modeLocked = computed(() => this.processing() || this.done() || this.switching(), ...ngDevMode ? [{ debugName: "modeLocked" }] : /* istanbul ignore next */ []);
|
|
7754
|
+
this.modeLocked = computed(() => this.processing() || this.done() || this.switching() || this.isBlocked(), ...ngDevMode ? [{ debugName: "modeLocked" }] : /* istanbul ignore next */ []);
|
|
7755
|
+
this.readerPollMs = computed(() => this.config().readerPollMs() ?? this.reader()?.pollMs ?? 2e3, ...ngDevMode ? [{ debugName: "readerPollMs" }] : /* istanbul ignore next */ []);
|
|
7756
|
+
this.isBlocked = computed(() => this.config().blocked() || !!this.ctx().blocked, ...ngDevMode ? [{ debugName: "isBlocked" }] : /* istanbul ignore next */ []);
|
|
7757
|
+
this.blockedMessage = computed(() => this.config().blocked() && !this.ctx().blocked && !this.done() && !this.readerPaid() && !this.confirmation() ? this.config().blockedReason().trim() || this.labels.t("paymentBlocked.default") : "", ...ngDevMode ? [{ debugName: "blockedMessage" }] : /* istanbul ignore next */ []);
|
|
7604
7758
|
this.switching = signal(false, ...ngDevMode ? [{ debugName: "switching" }] : /* istanbul ignore next */ []);
|
|
7605
7759
|
this.modeBlocked = signal(false, ...ngDevMode ? [{ debugName: "modeBlocked" }] : /* istanbul ignore next */ []);
|
|
7606
7760
|
this.modeBlockedWhy = signal("reader-open", ...ngDevMode ? [{ debugName: "modeBlockedWhy" }] : /* istanbul ignore next */ []);
|
|
@@ -7695,10 +7849,13 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7695
7849
|
const attempt = this.payment()?.attempt;
|
|
7696
7850
|
const amount = attempt?.pinnedAmount() ?? ctx.amount;
|
|
7697
7851
|
const method = attempt?.pinnedMethod() ?? ctx.method;
|
|
7698
|
-
if (context?.attemptKey)
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7852
|
+
if (context?.attemptKey) {
|
|
7853
|
+
this.attempts.set(context.attemptKey, {
|
|
7854
|
+
amount,
|
|
7855
|
+
method
|
|
7856
|
+
});
|
|
7857
|
+
this.config().rememberAttempt(context.attemptKey, "manual", amount);
|
|
7858
|
+
}
|
|
7702
7859
|
let info;
|
|
7703
7860
|
try {
|
|
7704
7861
|
info = await callHost(() => create({
|
|
@@ -7768,6 +7925,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7768
7925
|
const finalRefusal = !!this.finalRefusal();
|
|
7769
7926
|
const readerActive = this.readerActive();
|
|
7770
7927
|
const readerPaid = this.readerPaid();
|
|
7928
|
+
const blocked = this.isBlocked();
|
|
7771
7929
|
const protectedOff = !!this.payment()?.duplicateProtection() && (this.payment().attempt.unknown() || this.payment().attempt.paidLocked() || !this.payment().readiness.ready());
|
|
7772
7930
|
const label = notice ? this.labels.t("common.done") : ctx.amount != null ? `${this.labels.t("stripePayment.pay")} ${formatCurrency(this.total(), { currency: ctx.currency })}` : this.labels.t("stripePayment.pay");
|
|
7773
7931
|
if (readerPaid) {
|
|
@@ -7785,7 +7943,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7785
7943
|
untracked(() => ctx.setPrimary({
|
|
7786
7944
|
label,
|
|
7787
7945
|
loading: processing && !notice,
|
|
7788
|
-
disabled: notice ? done : !complete || processing || estimating || previewPending || estimateFailed || ctx.amount == null || done || protectedOff || finalRefusal,
|
|
7946
|
+
disabled: notice ? done : !complete || processing || estimating || previewPending || estimateFailed || ctx.amount == null || done || protectedOff || finalRefusal || blocked,
|
|
7789
7947
|
onClick: () => notice ? this.finish() : void this.pay()
|
|
7790
7948
|
}));
|
|
7791
7949
|
});
|
|
@@ -7869,6 +8027,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7869
8027
|
this.cancelPreview();
|
|
7870
8028
|
this.choice.set(null);
|
|
7871
8029
|
this.readerState.set(null);
|
|
8030
|
+
this.readerAnswered = false;
|
|
7872
8031
|
});
|
|
7873
8032
|
});
|
|
7874
8033
|
effect(() => {
|
|
@@ -7905,6 +8064,13 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7905
8064
|
this.cancelPreview();
|
|
7906
8065
|
this.cancelIntent();
|
|
7907
8066
|
});
|
|
8067
|
+
inject(DestroyRef).onDestroy(() => this.leaveReaderPending("destroyed"));
|
|
8068
|
+
effect(() => {
|
|
8069
|
+
const enabled = this.readerEnabled();
|
|
8070
|
+
untracked(() => {
|
|
8071
|
+
if (!enabled && this.readerBusy) this.leaveReaderPending("unmounted");
|
|
8072
|
+
});
|
|
8073
|
+
});
|
|
7908
8074
|
const controls = {
|
|
7909
8075
|
markUnknown: () => this.payment()?.markUnknown(),
|
|
7910
8076
|
markSucceeded: () => this.payment()?.markSucceeded(),
|
|
@@ -7922,6 +8088,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7922
8088
|
this.payment()?.markNotCharged();
|
|
7923
8089
|
this.processing.set(false);
|
|
7924
8090
|
this.ctx().setBusy(false);
|
|
8091
|
+
this.ctx().flowOver?.();
|
|
7925
8092
|
}
|
|
7926
8093
|
};
|
|
7927
8094
|
effect((onCleanup) => {
|
|
@@ -7931,18 +8098,57 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7931
8098
|
});
|
|
7932
8099
|
}
|
|
7933
8100
|
registerCloseGuard(ctx) {
|
|
7934
|
-
ctx.setCloseGuard?.(() =>
|
|
8101
|
+
ctx.setCloseGuard?.(() => {
|
|
8102
|
+
const view = this.readerView();
|
|
8103
|
+
const wasOpen = !!view?.isLocked();
|
|
8104
|
+
const allowed = view?.requestClose() ?? true;
|
|
8105
|
+
if (allowed && wasOpen) ctx.report("reader-left-pending", { ...this.readerAttemptKey ? { attemptKey: this.readerAttemptKey } : {} });
|
|
8106
|
+
return allowed;
|
|
8107
|
+
});
|
|
8108
|
+
}
|
|
8109
|
+
leaveReaderPending(reason) {
|
|
8110
|
+
if (!this.readerBusy) return;
|
|
8111
|
+
this.readerBusy = false;
|
|
8112
|
+
const paymentAttemptKey = this.readerAttemptKey;
|
|
8113
|
+
try {
|
|
8114
|
+
this.config().readerLeftPending.emit({
|
|
8115
|
+
reason,
|
|
8116
|
+
...paymentAttemptKey ? { paymentAttemptKey } : {}
|
|
8117
|
+
});
|
|
8118
|
+
} catch {}
|
|
8119
|
+
if (reason === "unmounted") try {
|
|
8120
|
+
this.ctx().leavePending?.({
|
|
8121
|
+
reason: "unmounted",
|
|
8122
|
+
...paymentAttemptKey ? { paymentAttemptKey } : {}
|
|
8123
|
+
});
|
|
8124
|
+
} catch {}
|
|
7935
8125
|
}
|
|
7936
8126
|
onReaderReadiness(state) {
|
|
8127
|
+
const previous = this.readerState();
|
|
8128
|
+
const answeredBefore = this.readerAnswered;
|
|
8129
|
+
this.readerAnswered = true;
|
|
7937
8130
|
this.readerState.set(state);
|
|
8131
|
+
if (answeredBefore && state !== null && previous !== state && this.ctx().readerBanner) try {
|
|
8132
|
+
this.ctx().refreshReaderBanner?.();
|
|
8133
|
+
} catch {}
|
|
7938
8134
|
if (this.choice() === null) this.choice.set(state === "reader_ready" && this.config().readerFirst() ? "reader" : "manual");
|
|
7939
8135
|
}
|
|
7940
8136
|
onReaderBusy(locked) {
|
|
7941
8137
|
if (locked === this.readerBusy) return;
|
|
7942
8138
|
this.readerBusy = locked;
|
|
8139
|
+
if (locked) {
|
|
8140
|
+
try {
|
|
8141
|
+
this.readerAttemptKey = this.readerView()?.attempt.key() || void 0;
|
|
8142
|
+
} catch {
|
|
8143
|
+
this.readerAttemptKey = void 0;
|
|
8144
|
+
}
|
|
8145
|
+
this.config().rememberAttempt(this.readerAttemptKey, "reader", this.ctx().amount ?? void 0);
|
|
8146
|
+
}
|
|
8147
|
+
this.config().readerBusyChange.emit(locked);
|
|
7943
8148
|
if (!locked) this.modeBlocked.set(false);
|
|
7944
8149
|
else if (this.choice() !== "reader") this.choice.set("reader");
|
|
7945
8150
|
this.ctx().setBusy(locked);
|
|
8151
|
+
if (!locked) this.ctx().flowOver?.();
|
|
7946
8152
|
}
|
|
7947
8153
|
async chooseMode(next) {
|
|
7948
8154
|
const target = next === "reader" ? "reader" : "manual";
|
|
@@ -7962,6 +8168,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7962
8168
|
this.refuseSwitch("reader-open");
|
|
7963
8169
|
return;
|
|
7964
8170
|
}
|
|
8171
|
+
this.ctx().flowOver?.();
|
|
7965
8172
|
}
|
|
7966
8173
|
} else if (this.processing() || this.attemptUnknown) {
|
|
7967
8174
|
this.refuseSwitch("manual-pending");
|
|
@@ -7978,6 +8185,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7978
8185
|
}
|
|
7979
8186
|
onReaderManual() {
|
|
7980
8187
|
this.choice.set("manual");
|
|
8188
|
+
this.ctx().flowOver?.();
|
|
7981
8189
|
}
|
|
7982
8190
|
onReaderPaid(event) {
|
|
7983
8191
|
if (this.done() || this.readerPaid()) return;
|
|
@@ -7993,7 +8201,10 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
7993
8201
|
} });
|
|
7994
8202
|
ctx.setExclusive(true);
|
|
7995
8203
|
ctx.setBusy(false);
|
|
7996
|
-
this.readerBusy
|
|
8204
|
+
if (this.readerBusy) {
|
|
8205
|
+
this.readerBusy = false;
|
|
8206
|
+
this.config().readerBusyChange.emit(false);
|
|
8207
|
+
}
|
|
7997
8208
|
}
|
|
7998
8209
|
onElementChange(change) {
|
|
7999
8210
|
this.complete.set(change.complete);
|
|
@@ -8125,7 +8336,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8125
8336
|
async pay() {
|
|
8126
8337
|
const ctx = this.ctx();
|
|
8127
8338
|
const payment = this.payment();
|
|
8128
|
-
if (this.processing() || this.estimating() || this.done() || !payment) return;
|
|
8339
|
+
if (this.processing() || this.estimating() || this.done() || !payment || this.isBlocked()) return;
|
|
8129
8340
|
if (!ctx.validate() || ctx.amount == null) return;
|
|
8130
8341
|
this.payAmount = ctx.amount;
|
|
8131
8342
|
this.payMethod = ctx.method;
|
|
@@ -8263,6 +8474,12 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8263
8474
|
}
|
|
8264
8475
|
</ui-alert>
|
|
8265
8476
|
} @else {
|
|
8477
|
+
<!-- the region stays in the DOM (only its content toggles) so a screen reader announces the reason when it appears -->
|
|
8478
|
+
<div role="status" aria-live="polite" class="psm-blocked" data-testid="stripe-method-blocked-status">
|
|
8479
|
+
@if (blockedMessage(); as reason) {
|
|
8480
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="stripe-method-blocked">{{ reason }}</ui-alert>
|
|
8481
|
+
}
|
|
8482
|
+
</div>
|
|
8266
8483
|
@if (readerEnabled()) {
|
|
8267
8484
|
@if (!readerPaid()) {
|
|
8268
8485
|
<!-- a refused switch re-creates the group (new epoch) so the radio shows the mode that is really in effect -->
|
|
@@ -8277,7 +8494,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8277
8494
|
<ui-stripe-reader-payment [active]="mode() === 'reader'" [amount]="ctx().amount" [currency]="ctx().currency" [payableRef]="config().payableRef()" [paid]="config().paid()"
|
|
8278
8495
|
[startExtras]="readerExtras()" [getReadiness]="reader()!.getReadiness" [startPayment]="reader()!.startPayment" [getPayment]="reader()!.getPayment" [retryPayment]="reader()!.retryPayment"
|
|
8279
8496
|
[cancelPayment]="reader()!.cancelPayment" [estimateFees]="reader()!.estimateFees" [receiptUrl]="reader()!.receiptUrl ?? null" [saveCard]="reader()!.saveCard ?? null"
|
|
8280
|
-
[offlineOverride]="config().offlineOverride()" [beforeStart]="beforeReaderStart" [manualAvailable]="true"
|
|
8497
|
+
[offlineOverride]="config().offlineOverride()" [beforeStart]="beforeReaderStart" [manualAvailable]="true" [disabled]="isBlocked()" [hideBanner]="!!ctx().readerBanner" [pollMs]="readerPollMs()"
|
|
8281
8498
|
(manual)="onReaderManual()" (connectReader)="config().readerConnect.emit()" (getReader)="config().readerOrder.emit()" (openSetup)="config().readerSetup.emit()"
|
|
8282
8499
|
(succeeded)="onReaderPaid($event)" (readinessChange)="onReaderReadiness($event)" (busyChange)="onReaderBusy($event)" />
|
|
8283
8500
|
}
|
|
@@ -8317,7 +8534,7 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8317
8534
|
</div>
|
|
8318
8535
|
`,
|
|
8319
8536
|
isInline: true,
|
|
8320
|
-
styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-mode{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-mode-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"],
|
|
8537
|
+
styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-mode{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-mode-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-blocked:empty{display:none}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"],
|
|
8321
8538
|
dependencies: [
|
|
8322
8539
|
{
|
|
8323
8540
|
kind: "ngmodule",
|
|
@@ -8495,6 +8712,8 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8495
8712
|
"submitLabel",
|
|
8496
8713
|
"showSubmit",
|
|
8497
8714
|
"disabled",
|
|
8715
|
+
"blocked",
|
|
8716
|
+
"blockedReason",
|
|
8498
8717
|
"pending",
|
|
8499
8718
|
"label",
|
|
8500
8719
|
"required",
|
|
@@ -8551,6 +8770,8 @@ var PaymentStripeBodyComponent = class PaymentStripeBodyComponent {
|
|
|
8551
8770
|
"active",
|
|
8552
8771
|
"manualAvailable",
|
|
8553
8772
|
"disabled",
|
|
8773
|
+
"hideChecking",
|
|
8774
|
+
"hideBanner",
|
|
8554
8775
|
"beforeStart",
|
|
8555
8776
|
"readinessEveryMs",
|
|
8556
8777
|
"readinessTimeoutMs",
|
|
@@ -8610,6 +8831,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8610
8831
|
}
|
|
8611
8832
|
</ui-alert>
|
|
8612
8833
|
} @else {
|
|
8834
|
+
<!-- the region stays in the DOM (only its content toggles) so a screen reader announces the reason when it appears -->
|
|
8835
|
+
<div role="status" aria-live="polite" class="psm-blocked" data-testid="stripe-method-blocked-status">
|
|
8836
|
+
@if (blockedMessage(); as reason) {
|
|
8837
|
+
<ui-alert variant="warning" [quiet]="true" data-testid="stripe-method-blocked">{{ reason }}</ui-alert>
|
|
8838
|
+
}
|
|
8839
|
+
</div>
|
|
8613
8840
|
@if (readerEnabled()) {
|
|
8614
8841
|
@if (!readerPaid()) {
|
|
8615
8842
|
<!-- a refused switch re-creates the group (new epoch) so the radio shows the mode that is really in effect -->
|
|
@@ -8624,7 +8851,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8624
8851
|
<ui-stripe-reader-payment [active]="mode() === 'reader'" [amount]="ctx().amount" [currency]="ctx().currency" [payableRef]="config().payableRef()" [paid]="config().paid()"
|
|
8625
8852
|
[startExtras]="readerExtras()" [getReadiness]="reader()!.getReadiness" [startPayment]="reader()!.startPayment" [getPayment]="reader()!.getPayment" [retryPayment]="reader()!.retryPayment"
|
|
8626
8853
|
[cancelPayment]="reader()!.cancelPayment" [estimateFees]="reader()!.estimateFees" [receiptUrl]="reader()!.receiptUrl ?? null" [saveCard]="reader()!.saveCard ?? null"
|
|
8627
|
-
[offlineOverride]="config().offlineOverride()" [beforeStart]="beforeReaderStart" [manualAvailable]="true"
|
|
8854
|
+
[offlineOverride]="config().offlineOverride()" [beforeStart]="beforeReaderStart" [manualAvailable]="true" [disabled]="isBlocked()" [hideBanner]="!!ctx().readerBanner" [pollMs]="readerPollMs()"
|
|
8628
8855
|
(manual)="onReaderManual()" (connectReader)="config().readerConnect.emit()" (getReader)="config().readerOrder.emit()" (openSetup)="config().readerSetup.emit()"
|
|
8629
8856
|
(succeeded)="onReaderPaid($event)" (readinessChange)="onReaderReadiness($event)" (busyChange)="onReaderBusy($event)" />
|
|
8630
8857
|
}
|
|
@@ -8663,7 +8890,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8663
8890
|
}
|
|
8664
8891
|
</div>
|
|
8665
8892
|
`,
|
|
8666
|
-
styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-mode{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-mode-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"]
|
|
8893
|
+
styles: ["ui-payment-stripe-body{display:block;min-width:0}ui-payment-stripe-body .psm-error{margin-top:12px}ui-payment-stripe-body .psm-mode{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-mode-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-blocked{display:block;margin-bottom:12px}ui-payment-stripe-body .psm-blocked:empty{display:none}ui-payment-stripe-body .psm-total{display:block;margin-top:16px}ui-payment-stripe-body .psm-fees{margin:16px 0 0;padding:14px 16px;border:1px solid var(--ui-psp-border, #e2e8f0);border-radius:10px;font-size:.8125rem}ui-payment-stripe-body .psm-fee{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:var(--ui-psp-muted, #475569)}ui-payment-stripe-body .psm-fee dt,ui-payment-stripe-body .psm-fee dd{margin:0}ui-payment-stripe-body .psm-notice:focus{outline:none}ui-payment-stripe-body .psm-notice p{margin:0 0 6px}\n"]
|
|
8667
8894
|
}]
|
|
8668
8895
|
}],
|
|
8669
8896
|
ctorParameters: () => [],
|
|
@@ -8694,6 +8921,394 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8694
8921
|
}]
|
|
8695
8922
|
}
|
|
8696
8923
|
});
|
|
8924
|
+
function stripeReaderBannerConfig(config) {
|
|
8925
|
+
return {
|
|
8926
|
+
...config,
|
|
8927
|
+
component: StripeReaderBannerComponent
|
|
8928
|
+
};
|
|
8929
|
+
}
|
|
8930
|
+
const STRIPE_READER_BANNER_STATES = [
|
|
8931
|
+
"no_reader",
|
|
8932
|
+
"unsupported_only",
|
|
8933
|
+
"merchant_not_ready"
|
|
8934
|
+
];
|
|
8935
|
+
var StripeReaderBannerComponent = class StripeReaderBannerComponent {
|
|
8936
|
+
constructor() {
|
|
8937
|
+
this.labels = inject(UiLabelsService);
|
|
8938
|
+
this.destroyRef = inject(DestroyRef);
|
|
8939
|
+
this.getReadiness = input(null, ...ngDevMode ? [{ debugName: "getReadiness" }] : /* istanbul ignore next */ []);
|
|
8940
|
+
this.refreshKey = input(null, ...ngDevMode ? [{ debugName: "refreshKey" }] : /* istanbul ignore next */ []);
|
|
8941
|
+
this.hardwareShopAvailable = input(true, ...ngDevMode ? [{ debugName: "hardwareShopAvailable" }] : /* istanbul ignore next */ []);
|
|
8942
|
+
this.hideReady = input(false, ...ngDevMode ? [{ debugName: "hideReady" }] : /* istanbul ignore next */ []);
|
|
8943
|
+
this.readinessTimeoutMs = input(4e3, ...ngDevMode ? [{ debugName: "readinessTimeoutMs" }] : /* istanbul ignore next */ []);
|
|
8944
|
+
this.offlineOverride = input(false, ...ngDevMode ? [{ debugName: "offlineOverride" }] : /* istanbul ignore next */ []);
|
|
8945
|
+
this.paused = input(false, ...ngDevMode ? [{ debugName: "paused" }] : /* istanbul ignore next */ []);
|
|
8946
|
+
this.connect = output();
|
|
8947
|
+
this.order = output();
|
|
8948
|
+
this.setup = output();
|
|
8949
|
+
this.stateChange = output();
|
|
8950
|
+
this.confirmed = signal(null, ...ngDevMode ? [{ debugName: "confirmed" }] : /* istanbul ignore next */ []);
|
|
8951
|
+
this.failed = signal(false, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
|
|
8952
|
+
this.offline = signal(false, ...ngDevMode ? [{ debugName: "offline" }] : /* istanbul ignore next */ []);
|
|
8953
|
+
this.run = 0;
|
|
8954
|
+
this.destroyed = false;
|
|
8955
|
+
this.readWhenShown = false;
|
|
8956
|
+
this.shown = computed(() => {
|
|
8957
|
+
const c = this.confirmed();
|
|
8958
|
+
return c && !this.failed() && !this.offline() && STRIPE_READER_BANNER_STATES.includes(c.readiness.state) ? c.readiness : null;
|
|
8959
|
+
}, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
8960
|
+
this.shownState = computed(() => this.shown()?.state ?? "none", ...ngDevMode ? [{ debugName: "shownState" }] : /* istanbul ignore next */ []);
|
|
8961
|
+
this.reasonKey = computed(() => readerBannerReasonKey(this.shown()?.reason), ...ngDevMode ? [{ debugName: "reasonKey" }] : /* istanbul ignore next */ []);
|
|
8962
|
+
this.message = computed(() => this.labels.t(this.reasonKey() ?? (this.shown()?.state === "merchant_not_ready" ? "stripeReaderBanner.setupFirst" : "stripeReaderBanner.getReader")), ...ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []);
|
|
8963
|
+
this.destroyRef.onDestroy(() => {
|
|
8964
|
+
this.destroyed = true;
|
|
8965
|
+
});
|
|
8966
|
+
const syncOffline = () => {
|
|
8967
|
+
this.offline.set(builtInReadinessReasons(this.offlineOverride()).includes("offline"));
|
|
8968
|
+
};
|
|
8969
|
+
if (typeof window !== "undefined") {
|
|
8970
|
+
const update = () => {
|
|
8971
|
+
syncOffline();
|
|
8972
|
+
untracked(() => {
|
|
8973
|
+
if (!this.offline()) this.refresh();
|
|
8974
|
+
});
|
|
8975
|
+
};
|
|
8976
|
+
window.addEventListener("online", update);
|
|
8977
|
+
window.addEventListener("offline", update);
|
|
8978
|
+
this.destroyRef.onDestroy(() => {
|
|
8979
|
+
window.removeEventListener("online", update);
|
|
8980
|
+
window.removeEventListener("offline", update);
|
|
8981
|
+
});
|
|
8982
|
+
}
|
|
8983
|
+
effect(() => {
|
|
8984
|
+
const read = this.getReadiness();
|
|
8985
|
+
this.refreshKey();
|
|
8986
|
+
this.offlineOverride();
|
|
8987
|
+
untracked(() => {
|
|
8988
|
+
syncOffline();
|
|
8989
|
+
if (read) this.refresh();
|
|
8990
|
+
});
|
|
8991
|
+
});
|
|
8992
|
+
effect(() => {
|
|
8993
|
+
const paused = this.paused();
|
|
8994
|
+
untracked(() => {
|
|
8995
|
+
if (!paused && this.readWhenShown) {
|
|
8996
|
+
this.readWhenShown = false;
|
|
8997
|
+
this.refresh();
|
|
8998
|
+
}
|
|
8999
|
+
});
|
|
9000
|
+
});
|
|
9001
|
+
effect(() => {
|
|
9002
|
+
const c = this.confirmed();
|
|
9003
|
+
const failed = this.failed();
|
|
9004
|
+
const next = c && !failed ? {
|
|
9005
|
+
state: c.readiness.state,
|
|
9006
|
+
stale: false,
|
|
9007
|
+
at: c.at,
|
|
9008
|
+
ready: c.readiness.state === "reader_ready"
|
|
9009
|
+
} : failed ? {
|
|
9010
|
+
state: "checking",
|
|
9011
|
+
stale: true,
|
|
9012
|
+
at: null,
|
|
9013
|
+
ready: false
|
|
9014
|
+
} : null;
|
|
9015
|
+
untracked(() => {
|
|
9016
|
+
if (next) this.stateChange.emit(next);
|
|
9017
|
+
});
|
|
9018
|
+
});
|
|
9019
|
+
}
|
|
9020
|
+
async refresh() {
|
|
9021
|
+
const read = this.getReadiness();
|
|
9022
|
+
if (!read || this.destroyed || this.offline()) return;
|
|
9023
|
+
if (untracked(() => this.paused())) {
|
|
9024
|
+
this.readWhenShown = true;
|
|
9025
|
+
return;
|
|
9026
|
+
}
|
|
9027
|
+
const run = ++this.run;
|
|
9028
|
+
let result = null;
|
|
9029
|
+
let timer = null;
|
|
9030
|
+
try {
|
|
9031
|
+
const timeout = new Promise((resolve) => {
|
|
9032
|
+
timer = setTimeout(() => resolve("timeout"), Math.max(1, this.readinessTimeoutMs()));
|
|
9033
|
+
});
|
|
9034
|
+
const raw = await Promise.race([callHost(() => read()), timeout]);
|
|
9035
|
+
result = raw === "timeout" ? null : normalizeReadiness(raw);
|
|
9036
|
+
} catch {
|
|
9037
|
+
result = null;
|
|
9038
|
+
} finally {
|
|
9039
|
+
if (timer) clearTimeout(timer);
|
|
9040
|
+
}
|
|
9041
|
+
if (this.destroyed || run !== this.run) return;
|
|
9042
|
+
if (result && result.state !== "checking") {
|
|
9043
|
+
const at = result.checkedAt ? new Date(result.checkedAt) : /* @__PURE__ */ new Date();
|
|
9044
|
+
this.confirmed.set({
|
|
9045
|
+
readiness: result,
|
|
9046
|
+
at: Number.isNaN(at.getTime()) ? /* @__PURE__ */ new Date() : at
|
|
9047
|
+
});
|
|
9048
|
+
this.failed.set(false);
|
|
9049
|
+
} else this.failed.set(true);
|
|
9050
|
+
}
|
|
9051
|
+
static {
|
|
9052
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
9053
|
+
minVersion: "12.0.0",
|
|
9054
|
+
version: "22.2.2",
|
|
9055
|
+
ngImport: i0,
|
|
9056
|
+
type: StripeReaderBannerComponent,
|
|
9057
|
+
deps: [],
|
|
9058
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
9059
|
+
});
|
|
9060
|
+
}
|
|
9061
|
+
static {
|
|
9062
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
9063
|
+
minVersion: "17.0.0",
|
|
9064
|
+
version: "22.2.2",
|
|
9065
|
+
type: StripeReaderBannerComponent,
|
|
9066
|
+
isStandalone: true,
|
|
9067
|
+
selector: "ui-stripe-reader-banner",
|
|
9068
|
+
inputs: {
|
|
9069
|
+
getReadiness: {
|
|
9070
|
+
classPropertyName: "getReadiness",
|
|
9071
|
+
publicName: "getReadiness",
|
|
9072
|
+
isSignal: true,
|
|
9073
|
+
isRequired: false,
|
|
9074
|
+
transformFunction: null
|
|
9075
|
+
},
|
|
9076
|
+
refreshKey: {
|
|
9077
|
+
classPropertyName: "refreshKey",
|
|
9078
|
+
publicName: "refreshKey",
|
|
9079
|
+
isSignal: true,
|
|
9080
|
+
isRequired: false,
|
|
9081
|
+
transformFunction: null
|
|
9082
|
+
},
|
|
9083
|
+
hardwareShopAvailable: {
|
|
9084
|
+
classPropertyName: "hardwareShopAvailable",
|
|
9085
|
+
publicName: "hardwareShopAvailable",
|
|
9086
|
+
isSignal: true,
|
|
9087
|
+
isRequired: false,
|
|
9088
|
+
transformFunction: null
|
|
9089
|
+
},
|
|
9090
|
+
hideReady: {
|
|
9091
|
+
classPropertyName: "hideReady",
|
|
9092
|
+
publicName: "hideReady",
|
|
9093
|
+
isSignal: true,
|
|
9094
|
+
isRequired: false,
|
|
9095
|
+
transformFunction: null
|
|
9096
|
+
},
|
|
9097
|
+
readinessTimeoutMs: {
|
|
9098
|
+
classPropertyName: "readinessTimeoutMs",
|
|
9099
|
+
publicName: "readinessTimeoutMs",
|
|
9100
|
+
isSignal: true,
|
|
9101
|
+
isRequired: false,
|
|
9102
|
+
transformFunction: null
|
|
9103
|
+
},
|
|
9104
|
+
offlineOverride: {
|
|
9105
|
+
classPropertyName: "offlineOverride",
|
|
9106
|
+
publicName: "offlineOverride",
|
|
9107
|
+
isSignal: true,
|
|
9108
|
+
isRequired: false,
|
|
9109
|
+
transformFunction: null
|
|
9110
|
+
},
|
|
9111
|
+
paused: {
|
|
9112
|
+
classPropertyName: "paused",
|
|
9113
|
+
publicName: "paused",
|
|
9114
|
+
isSignal: true,
|
|
9115
|
+
isRequired: false,
|
|
9116
|
+
transformFunction: null
|
|
9117
|
+
}
|
|
9118
|
+
},
|
|
9119
|
+
outputs: {
|
|
9120
|
+
connect: "connect",
|
|
9121
|
+
order: "order",
|
|
9122
|
+
setup: "setup",
|
|
9123
|
+
stateChange: "stateChange"
|
|
9124
|
+
},
|
|
9125
|
+
host: { properties: { "hidden": "!shown()" } },
|
|
9126
|
+
ngImport: i0,
|
|
9127
|
+
template: `
|
|
9128
|
+
<div class="srb" data-testid="reader-banner" [attr.data-state]="shownState()">
|
|
9129
|
+
@if (shown(); as r) {
|
|
9130
|
+
<ui-alert variant="info" [quiet]="true" data-testid="reader-banner-message">
|
|
9131
|
+
<span class="srb-line">{{ message() }}</span>
|
|
9132
|
+
@if (!reasonKey()) {
|
|
9133
|
+
<!-- a sandbox / service-off / unsupported-processor reason has no action: only the message -->
|
|
9134
|
+
<span class="srb-actions">
|
|
9135
|
+
@if (r.state === 'merchant_not_ready') {
|
|
9136
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-setup" (click)="setup.emit()">{{ labels.t(r.reason === 'reconnect_required' ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
|
|
9137
|
+
} @else {
|
|
9138
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('stripeReader.status.connect') }}</ui-button>
|
|
9139
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(hardwareShopAvailable() ? 'stripeReader.status.get' : 'stripeReader.status.getInfo') }}</ui-button>
|
|
9140
|
+
}
|
|
9141
|
+
</span>
|
|
9142
|
+
}
|
|
9143
|
+
</ui-alert>
|
|
9144
|
+
}
|
|
9145
|
+
</div>
|
|
9146
|
+
`,
|
|
9147
|
+
isInline: true,
|
|
9148
|
+
styles: ["ui-stripe-reader-banner{display:block;min-width:0}ui-stripe-reader-banner[hidden]{display:none}ui-stripe-reader-banner .srb-line{margin-right:8px}ui-stripe-reader-banner .srb-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px}\n"],
|
|
9149
|
+
dependencies: [{
|
|
9150
|
+
kind: "component",
|
|
9151
|
+
type: AlertComponent,
|
|
9152
|
+
selector: "ui-alert",
|
|
9153
|
+
inputs: [
|
|
9154
|
+
"variant",
|
|
9155
|
+
"title",
|
|
9156
|
+
"dismissible",
|
|
9157
|
+
"dismissAriaLabel",
|
|
9158
|
+
"quiet",
|
|
9159
|
+
"compact",
|
|
9160
|
+
"inline",
|
|
9161
|
+
"fill"
|
|
9162
|
+
],
|
|
9163
|
+
outputs: ["dismissed"]
|
|
9164
|
+
}, {
|
|
9165
|
+
kind: "component",
|
|
9166
|
+
type: ButtonComponent,
|
|
9167
|
+
selector: "ui-button",
|
|
9168
|
+
inputs: [
|
|
9169
|
+
"variant",
|
|
9170
|
+
"routerLink",
|
|
9171
|
+
"queryParams",
|
|
9172
|
+
"fragment",
|
|
9173
|
+
"state",
|
|
9174
|
+
"href",
|
|
9175
|
+
"target",
|
|
9176
|
+
"rel",
|
|
9177
|
+
"shortLabel",
|
|
9178
|
+
"shortBelow",
|
|
9179
|
+
"color",
|
|
9180
|
+
"active",
|
|
9181
|
+
"size",
|
|
9182
|
+
"type",
|
|
9183
|
+
"disabled",
|
|
9184
|
+
"loading",
|
|
9185
|
+
"fullWidth",
|
|
9186
|
+
"ariaLabel",
|
|
9187
|
+
"ariaExpanded",
|
|
9188
|
+
"ariaPressed",
|
|
9189
|
+
"ariaDescribedBy",
|
|
9190
|
+
"modal-footer-left",
|
|
9191
|
+
"modal-footer-right"
|
|
9192
|
+
]
|
|
9193
|
+
}],
|
|
9194
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
9195
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
9196
|
+
});
|
|
9197
|
+
}
|
|
9198
|
+
};
|
|
9199
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
9200
|
+
minVersion: "12.0.0",
|
|
9201
|
+
version: "22.2.2",
|
|
9202
|
+
ngImport: i0,
|
|
9203
|
+
type: StripeReaderBannerComponent,
|
|
9204
|
+
decorators: [{
|
|
9205
|
+
type: Component,
|
|
9206
|
+
args: [{
|
|
9207
|
+
selector: "ui-stripe-reader-banner",
|
|
9208
|
+
standalone: true,
|
|
9209
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9210
|
+
encapsulation: ViewEncapsulation.None,
|
|
9211
|
+
host: { "[hidden]": "!shown()" },
|
|
9212
|
+
imports: [AlertComponent, ButtonComponent],
|
|
9213
|
+
template: `
|
|
9214
|
+
<div class="srb" data-testid="reader-banner" [attr.data-state]="shownState()">
|
|
9215
|
+
@if (shown(); as r) {
|
|
9216
|
+
<ui-alert variant="info" [quiet]="true" data-testid="reader-banner-message">
|
|
9217
|
+
<span class="srb-line">{{ message() }}</span>
|
|
9218
|
+
@if (!reasonKey()) {
|
|
9219
|
+
<!-- a sandbox / service-off / unsupported-processor reason has no action: only the message -->
|
|
9220
|
+
<span class="srb-actions">
|
|
9221
|
+
@if (r.state === 'merchant_not_ready') {
|
|
9222
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-setup" (click)="setup.emit()">{{ labels.t(r.reason === 'reconnect_required' ? 'stripeReader.status.reconnect' : 'stripeReader.status.setup') }}</ui-button>
|
|
9223
|
+
} @else {
|
|
9224
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-connect" (click)="connect.emit()">{{ labels.t('stripeReader.status.connect') }}</ui-button>
|
|
9225
|
+
<ui-button variant="link" size="sm" data-testid="reader-banner-get" (click)="order.emit()">{{ labels.t(hardwareShopAvailable() ? 'stripeReader.status.get' : 'stripeReader.status.getInfo') }}</ui-button>
|
|
9226
|
+
}
|
|
9227
|
+
</span>
|
|
9228
|
+
}
|
|
9229
|
+
</ui-alert>
|
|
9230
|
+
}
|
|
9231
|
+
</div>
|
|
9232
|
+
`,
|
|
9233
|
+
styles: ["ui-stripe-reader-banner{display:block;min-width:0}ui-stripe-reader-banner[hidden]{display:none}ui-stripe-reader-banner .srb-line{margin-right:8px}ui-stripe-reader-banner .srb-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px}\n"]
|
|
9234
|
+
}]
|
|
9235
|
+
}],
|
|
9236
|
+
ctorParameters: () => [],
|
|
9237
|
+
propDecorators: {
|
|
9238
|
+
getReadiness: [{
|
|
9239
|
+
type: i0.Input,
|
|
9240
|
+
args: [{
|
|
9241
|
+
isSignal: true,
|
|
9242
|
+
alias: "getReadiness",
|
|
9243
|
+
required: false
|
|
9244
|
+
}]
|
|
9245
|
+
}],
|
|
9246
|
+
refreshKey: [{
|
|
9247
|
+
type: i0.Input,
|
|
9248
|
+
args: [{
|
|
9249
|
+
isSignal: true,
|
|
9250
|
+
alias: "refreshKey",
|
|
9251
|
+
required: false
|
|
9252
|
+
}]
|
|
9253
|
+
}],
|
|
9254
|
+
hardwareShopAvailable: [{
|
|
9255
|
+
type: i0.Input,
|
|
9256
|
+
args: [{
|
|
9257
|
+
isSignal: true,
|
|
9258
|
+
alias: "hardwareShopAvailable",
|
|
9259
|
+
required: false
|
|
9260
|
+
}]
|
|
9261
|
+
}],
|
|
9262
|
+
hideReady: [{
|
|
9263
|
+
type: i0.Input,
|
|
9264
|
+
args: [{
|
|
9265
|
+
isSignal: true,
|
|
9266
|
+
alias: "hideReady",
|
|
9267
|
+
required: false
|
|
9268
|
+
}]
|
|
9269
|
+
}],
|
|
9270
|
+
readinessTimeoutMs: [{
|
|
9271
|
+
type: i0.Input,
|
|
9272
|
+
args: [{
|
|
9273
|
+
isSignal: true,
|
|
9274
|
+
alias: "readinessTimeoutMs",
|
|
9275
|
+
required: false
|
|
9276
|
+
}]
|
|
9277
|
+
}],
|
|
9278
|
+
offlineOverride: [{
|
|
9279
|
+
type: i0.Input,
|
|
9280
|
+
args: [{
|
|
9281
|
+
isSignal: true,
|
|
9282
|
+
alias: "offlineOverride",
|
|
9283
|
+
required: false
|
|
9284
|
+
}]
|
|
9285
|
+
}],
|
|
9286
|
+
paused: [{
|
|
9287
|
+
type: i0.Input,
|
|
9288
|
+
args: [{
|
|
9289
|
+
isSignal: true,
|
|
9290
|
+
alias: "paused",
|
|
9291
|
+
required: false
|
|
9292
|
+
}]
|
|
9293
|
+
}],
|
|
9294
|
+
connect: [{
|
|
9295
|
+
type: i0.Output,
|
|
9296
|
+
args: ["connect"]
|
|
9297
|
+
}],
|
|
9298
|
+
order: [{
|
|
9299
|
+
type: i0.Output,
|
|
9300
|
+
args: ["order"]
|
|
9301
|
+
}],
|
|
9302
|
+
setup: [{
|
|
9303
|
+
type: i0.Output,
|
|
9304
|
+
args: ["setup"]
|
|
9305
|
+
}],
|
|
9306
|
+
stateChange: [{
|
|
9307
|
+
type: i0.Output,
|
|
9308
|
+
args: ["stateChange"]
|
|
9309
|
+
}]
|
|
9310
|
+
}
|
|
9311
|
+
});
|
|
8697
9312
|
var StripePaymentMethodComponent = class StripePaymentMethodComponent extends PaymentMethodPlugin {
|
|
8698
9313
|
constructor() {
|
|
8699
9314
|
super(...arguments);
|
|
@@ -8739,6 +9354,11 @@ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends Pa
|
|
|
8739
9354
|
this.readerConnect = output();
|
|
8740
9355
|
this.readerOrder = output();
|
|
8741
9356
|
this.readerSetup = output();
|
|
9357
|
+
this.readerPollMs = input(null, ...ngDevMode ? [{ debugName: "readerPollMs" }] : /* istanbul ignore next */ []);
|
|
9358
|
+
this.readerBusyChange = output();
|
|
9359
|
+
this.readerLeftPending = output();
|
|
9360
|
+
this.blocked = input(false, ...ngDevMode ? [{ debugName: "blocked" }] : /* istanbul ignore next */ []);
|
|
9361
|
+
this.blockedReason = input("", ...ngDevMode ? [{ debugName: "blockedReason" }] : /* istanbul ignore next */ []);
|
|
8742
9362
|
this.receiptNoteInput = input(null, {
|
|
8743
9363
|
...ngDevMode ? { debugName: "receiptNoteInput" } : /* istanbul ignore next */ {},
|
|
8744
9364
|
alias: "receiptNote"
|
|
@@ -8746,8 +9366,10 @@ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends Pa
|
|
|
8746
9366
|
this.receiptNote = computed(() => this.receiptNoteInput() ?? STRIPE_METHOD_TEXTS.receiptNote, ...ngDevMode ? [{ debugName: "receiptNote" }] : /* istanbul ignore next */ []);
|
|
8747
9367
|
this.body = viewChild("body", ...ngDevMode ? [{ debugName: "body" }] : /* istanbul ignore next */ []);
|
|
8748
9368
|
this.controls = signal(null, ...ngDevMode ? [{ debugName: "controls" }] : /* istanbul ignore next */ []);
|
|
9369
|
+
this.remembered = null;
|
|
8749
9370
|
this.methods = this.methodList;
|
|
8750
9371
|
this.template = this.body;
|
|
9372
|
+
this.readerBannerComponent = StripeReaderBannerComponent;
|
|
8751
9373
|
}
|
|
8752
9374
|
attachControls(controls) {
|
|
8753
9375
|
this.controls.set(controls);
|
|
@@ -8770,6 +9392,71 @@ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends Pa
|
|
|
8770
9392
|
resetPaid() {
|
|
8771
9393
|
this.controls()?.resetPaid();
|
|
8772
9394
|
}
|
|
9395
|
+
rememberAttempt(key, kind, amount) {
|
|
9396
|
+
if (key) this.remembered = {
|
|
9397
|
+
key,
|
|
9398
|
+
kind,
|
|
9399
|
+
...amount !== void 0 ? { amount } : {}
|
|
9400
|
+
};
|
|
9401
|
+
}
|
|
9402
|
+
async checkPending(info) {
|
|
9403
|
+
const key = info.paymentAttemptKey ?? this.remembered?.key;
|
|
9404
|
+
if (!key) return { state: "checking" };
|
|
9405
|
+
const known = this.remembered && this.remembered.key === key ? this.remembered : null;
|
|
9406
|
+
if ((known?.kind ?? (this.reader() ? "reader" : "manual")) === "reader") {
|
|
9407
|
+
const reader = this.reader();
|
|
9408
|
+
if (!reader) return { state: "checking" };
|
|
9409
|
+
let payment = null;
|
|
9410
|
+
try {
|
|
9411
|
+
payment = await callHost(() => reader.getPayment({
|
|
9412
|
+
paymentId: null,
|
|
9413
|
+
attemptKey: key
|
|
9414
|
+
})) ?? null;
|
|
9415
|
+
} catch (error) {
|
|
9416
|
+
if (readerErrorInfo(error).status !== 404) return { state: "checking" };
|
|
9417
|
+
payment = null;
|
|
9418
|
+
}
|
|
9419
|
+
if (!payment || typeof payment !== "object" || typeof payment.id !== "string") return { state: info.ageMs >= 36e4 ? "over" : "checking" };
|
|
9420
|
+
const status = String(payment.status ?? "").toUpperCase();
|
|
9421
|
+
const terminal = payment.terminal?.state;
|
|
9422
|
+
if (status === "SUCCEEDED" || terminal === "succeeded") {
|
|
9423
|
+
const amount = paymentBaseAmount(payment) ?? known?.amount;
|
|
9424
|
+
return {
|
|
9425
|
+
state: "succeeded",
|
|
9426
|
+
result: {
|
|
9427
|
+
type: "stripe",
|
|
9428
|
+
paymentMethod: info.method,
|
|
9429
|
+
...amount !== void 0 && amount !== null ? { amount } : {}
|
|
9430
|
+
}
|
|
9431
|
+
};
|
|
9432
|
+
}
|
|
9433
|
+
if (status === "CANCELED" || status === "FAILED" || terminal === "canceled") return { state: "over" };
|
|
9434
|
+
return { state: "open" };
|
|
9435
|
+
}
|
|
9436
|
+
const check = this.checkStatus();
|
|
9437
|
+
if (!check) return { state: "checking" };
|
|
9438
|
+
let answer;
|
|
9439
|
+
try {
|
|
9440
|
+
answer = String(await callHost(() => check(key)));
|
|
9441
|
+
} catch {
|
|
9442
|
+
return { state: "checking" };
|
|
9443
|
+
}
|
|
9444
|
+
switch (answer) {
|
|
9445
|
+
case "succeeded": return {
|
|
9446
|
+
state: "succeeded",
|
|
9447
|
+
result: {
|
|
9448
|
+
type: "stripe",
|
|
9449
|
+
paymentMethod: info.method,
|
|
9450
|
+
...known?.amount !== void 0 ? { amount: known.amount } : {}
|
|
9451
|
+
}
|
|
9452
|
+
};
|
|
9453
|
+
case "failed": return { state: "over" };
|
|
9454
|
+
case "not_found": return { state: info.ageMs >= this.confirmTimeoutMs() + this.statusFailGraceMs() ? "over" : "checking" };
|
|
9455
|
+
case "in_flight":
|
|
9456
|
+
case "awaiting_verification": return { state: "open" };
|
|
9457
|
+
default: return { state: "checking" };
|
|
9458
|
+
}
|
|
9459
|
+
}
|
|
8773
9460
|
static {
|
|
8774
9461
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
8775
9462
|
minVersion: "12.0.0",
|
|
@@ -9005,6 +9692,27 @@ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends Pa
|
|
|
9005
9692
|
isRequired: false,
|
|
9006
9693
|
transformFunction: null
|
|
9007
9694
|
},
|
|
9695
|
+
readerPollMs: {
|
|
9696
|
+
classPropertyName: "readerPollMs",
|
|
9697
|
+
publicName: "readerPollMs",
|
|
9698
|
+
isSignal: true,
|
|
9699
|
+
isRequired: false,
|
|
9700
|
+
transformFunction: null
|
|
9701
|
+
},
|
|
9702
|
+
blocked: {
|
|
9703
|
+
classPropertyName: "blocked",
|
|
9704
|
+
publicName: "blocked",
|
|
9705
|
+
isSignal: true,
|
|
9706
|
+
isRequired: false,
|
|
9707
|
+
transformFunction: null
|
|
9708
|
+
},
|
|
9709
|
+
blockedReason: {
|
|
9710
|
+
classPropertyName: "blockedReason",
|
|
9711
|
+
publicName: "blockedReason",
|
|
9712
|
+
isSignal: true,
|
|
9713
|
+
isRequired: false,
|
|
9714
|
+
transformFunction: null
|
|
9715
|
+
},
|
|
9008
9716
|
receiptNoteInput: {
|
|
9009
9717
|
classPropertyName: "receiptNoteInput",
|
|
9010
9718
|
publicName: "receiptNote",
|
|
@@ -9016,7 +9724,9 @@ var StripePaymentMethodComponent = class StripePaymentMethodComponent extends Pa
|
|
|
9016
9724
|
outputs: {
|
|
9017
9725
|
readerConnect: "readerConnect",
|
|
9018
9726
|
readerOrder: "readerOrder",
|
|
9019
|
-
readerSetup: "readerSetup"
|
|
9727
|
+
readerSetup: "readerSetup",
|
|
9728
|
+
readerBusyChange: "readerBusyChange",
|
|
9729
|
+
readerLeftPending: "readerLeftPending"
|
|
9020
9730
|
},
|
|
9021
9731
|
host: { styleAttribute: "display: none" },
|
|
9022
9732
|
providers: [{
|
|
@@ -9325,6 +10035,38 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
9325
10035
|
type: i0.Output,
|
|
9326
10036
|
args: ["readerSetup"]
|
|
9327
10037
|
}],
|
|
10038
|
+
readerPollMs: [{
|
|
10039
|
+
type: i0.Input,
|
|
10040
|
+
args: [{
|
|
10041
|
+
isSignal: true,
|
|
10042
|
+
alias: "readerPollMs",
|
|
10043
|
+
required: false
|
|
10044
|
+
}]
|
|
10045
|
+
}],
|
|
10046
|
+
readerBusyChange: [{
|
|
10047
|
+
type: i0.Output,
|
|
10048
|
+
args: ["readerBusyChange"]
|
|
10049
|
+
}],
|
|
10050
|
+
readerLeftPending: [{
|
|
10051
|
+
type: i0.Output,
|
|
10052
|
+
args: ["readerLeftPending"]
|
|
10053
|
+
}],
|
|
10054
|
+
blocked: [{
|
|
10055
|
+
type: i0.Input,
|
|
10056
|
+
args: [{
|
|
10057
|
+
isSignal: true,
|
|
10058
|
+
alias: "blocked",
|
|
10059
|
+
required: false
|
|
10060
|
+
}]
|
|
10061
|
+
}],
|
|
10062
|
+
blockedReason: [{
|
|
10063
|
+
type: i0.Input,
|
|
10064
|
+
args: [{
|
|
10065
|
+
isSignal: true,
|
|
10066
|
+
alias: "blockedReason",
|
|
10067
|
+
required: false
|
|
10068
|
+
}]
|
|
10069
|
+
}],
|
|
9328
10070
|
receiptNoteInput: [{
|
|
9329
10071
|
type: i0.Input,
|
|
9330
10072
|
args: [{
|
|
@@ -10036,7 +10778,8 @@ var StripeReadersComponent = class StripeReadersComponent {
|
|
|
10036
10778
|
"ownBusyPaymentId",
|
|
10037
10779
|
"cancelling",
|
|
10038
10780
|
"showManual",
|
|
10039
|
-
"hideConnect"
|
|
10781
|
+
"hideConnect",
|
|
10782
|
+
"hardwareShopAvailable"
|
|
10040
10783
|
],
|
|
10041
10784
|
outputs: [
|
|
10042
10785
|
"connectReader",
|
|
@@ -11329,6 +12072,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
11329
12072
|
}]
|
|
11330
12073
|
}
|
|
11331
12074
|
});
|
|
11332
|
-
export { INSTANT_ONLY_CODE, MICRODEPOSIT_COPY, MicrodepositVerifyComponent, STRIPE_A11Y_MESSAGES, STRIPE_ACH_NOTICE, STRIPE_CONNECT_LOADER, STRIPE_DEFAULT_ERROR_MESSAGE, STRIPE_ERROR_MESSAGES, STRIPE_LOADER, STRIPE_METHOD_TEXTS, STRIPE_PAYMENT_DEFAULTS, STRIPE_PAYMENT_METHODS, STRIPE_READER_LOST_ANSWER_GRACE_MS, STRIPE_READER_MODELS, STRIPE_READER_NOT_CREATED_CODES, STRIPE_READER_POLL_MS, STRIPE_READER_POLL_TIMEOUT_MS, STRIPE_READER_REQUEST_TIMEOUT_MS, STRIPE_READER_STATE_PRECEDENCE, STRIPE_TECHNICAL_ERROR_MESSAGES, StripeConnectComponent, StripeConnectFlow, StripePaymentComponent, StripePaymentMethodComponent, StripePaymentService, StripeReaderEmbedBase, StripeReaderFlow, StripeReaderOrderPanelComponent, StripeReaderOrdersComponent, StripeReaderPaymentComponent, StripeReaderShopComponent, StripeReaderStatusComponent, StripeReadersComponent, buildLoadOptions, defaultStripeConnectLoader, defaultStripeLoader, depositAmountError, descriptorCodeError, formatElapsed, getStripeErrorMessage, isDarkPage, isReaderFree, isSafeReceiptUrl, isStripeUrl, microdepositArrivalText, microdepositCancelMessage, microdepositKeepsActiveText, microdepositProcessingText, microdepositStepsText, normalizeDescriptorCode, normalizeIntent, normalizeReadiness, outcomeOf, paymentBaseAmount, paymentChargedAmount, paymentMethodIdOf, provideStripePayment, readStripeAppearance, readStripeReturnParams, readerDegraded, readerDisplayName, readerErrorInfo, readerRefusalLabelKey, readerShopFailure, retrieveIntent, stripeAppearanceFromTheme, stripeConnectNotice, toRefusal, verificationOf, verifyMicrodeposits };
|
|
12075
|
+
export { INSTANT_ONLY_CODE, MICRODEPOSIT_COPY, MicrodepositVerifyComponent, STRIPE_A11Y_MESSAGES, STRIPE_ACH_NOTICE, STRIPE_CONNECT_LOADER, STRIPE_DEFAULT_ERROR_MESSAGE, STRIPE_ERROR_MESSAGES, STRIPE_LOADER, STRIPE_METHOD_TEXTS, STRIPE_PAYMENT_DEFAULTS, STRIPE_PAYMENT_METHODS, STRIPE_READER_BANNER_REASONS, STRIPE_READER_LOST_ANSWER_GRACE_MS, STRIPE_READER_MODELS, STRIPE_READER_NOT_CREATED_CODES, STRIPE_READER_POLL_MAX_MS, STRIPE_READER_POLL_MIN_MS, STRIPE_READER_POLL_MS, STRIPE_READER_POLL_TIMEOUT_MS, STRIPE_READER_REQUEST_TIMEOUT_MS, STRIPE_READER_STATE_PRECEDENCE, STRIPE_TECHNICAL_ERROR_MESSAGES, StripeConnectComponent, StripeConnectFlow, StripePaymentComponent, StripePaymentMethodComponent, StripePaymentService, StripeReaderBannerComponent, StripeReaderEmbedBase, StripeReaderFlow, StripeReaderOrderPanelComponent, StripeReaderOrdersComponent, StripeReaderPaymentComponent, StripeReaderShopComponent, StripeReaderStatusComponent, StripeReadersComponent, buildLoadOptions, clampReaderPollMs, defaultStripeConnectLoader, defaultStripeLoader, depositAmountError, descriptorCodeError, formatElapsed, formatReaderTime, getStripeErrorMessage, isDarkPage, isReaderFree, isSafeReceiptUrl, isStripeUrl, isTerminalChecking, microdepositArrivalText, microdepositCancelMessage, microdepositKeepsActiveText, microdepositProcessingText, microdepositStepsText, normalizeDescriptorCode, normalizeIntent, normalizeReadiness, outcomeOf, paymentBaseAmount, paymentChargedAmount, paymentMethodIdOf, provideStripePayment, readStripeAppearance, readStripeReturnParams, readerBannerReasonKey, readerDegraded, readerDisplayName, readerErrorInfo, readerRefusalLabelKey, readerShopFailure, retrieveIntent, stripeAppearanceFromTheme, stripeConnectNotice, stripeReaderBannerConfig, toRefusal, verificationOf, verifyMicrodeposits };
|
|
11333
12076
|
|
|
11334
12077
|
//# sourceMappingURL=forgeroute-ui-stripe.mjs.map
|