@flopay/shared 1.14.7 → 1.14.9
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/README.md +2 -0
- package/dist/checkout-init-error.d.ts +48 -0
- package/dist/constants.d.ts +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.mjs +1 -1
- package/dist/settled-session-intent.d.ts +18 -0
- package/dist/telemetry-failure.d.ts +15 -2
- package/dist/telemetry.d.ts +30 -1
- package/dist/types.d.ts +13 -0
- package/package.json +1 -1
package/dist/telemetry.d.ts
CHANGED
|
@@ -36,8 +36,16 @@ export type TelemetryFailureCategory = (typeof TELEMETRY_FAILURE_CATEGORIES)[num
|
|
|
36
36
|
declare const TELEMETRY_ERROR_REASONS: readonly ['authorization_declined', 'authentication_required', 'authorization_expired', 'capture_failed', 'deferred_contract_mismatch', 'intent_unexpected_state', 'invalid_request', 'confirmation_result_missing', 'confirmation_result_not_object', 'confirmation_result_unconfirmed', 'unknown'];
|
|
37
37
|
export type TelemetryErrorReason = (typeof TELEMETRY_ERROR_REASONS)[number];
|
|
38
38
|
/** Closed catalog of SDK-authored lifecycle and operational log names. */
|
|
39
|
-
export declare const TELEMETRY_LOG_NAMES: readonly ['sdk.initialize.started', 'sdk.initialize.ready', 'sdk.cache.hit', 'sdk.cache.miss', 'checkout.mount', 'session.create.started', 'session.shell.ready', 'session.claim.started', 'session.claim.completed', 'session.read.started', 'session.request.first_byte', 'session.request.completed', 'checkout.data.ready', 'checkout.rendered', 'checkout.recovery.started', 'checkout.recovery.completed', 'checkout.unmount', 'provider.load.started', 'provider.eligibility.checked', 'provider.availability.checked', 'provider.ready', 'provider.handoff.requested', 'provider.popup.opened', 'provider.overlay.opened', 'provider.overlay.returned', 'provider.redirect.started', 'provider.redirect.resumed', 'vault.capture.requested', 'vault.widget.mounted', 'vault.widget.ready', 'vault.submission.started', 'vault.action.required', 'vault.three_ds.handoff', 'vault.three_ds.returned', 'vault.terminal', 'payment.method.selected', 'payment.intent.started', 'payment.intent.completed', 'payment.provider_confirmation.started', 'payment.provider_confirmation.returned', 'payment.tokenization.started', 'payment.tokenization.completed', 'payment.processing.started', 'payment.processing.completed', 'payment.three_ds.handoff', 'payment.three_ds.returned', 'operation.retry', 'operation.deduplicated', 'operation.fallback', 'operation.cache.hit', 'operation.cache.miss', 'operation.recovery.started', 'operation.recovery.completed', 'operation.state_transition'];
|
|
39
|
+
export declare const TELEMETRY_LOG_NAMES: readonly ['sdk.initialize.started', 'sdk.initialize.ready', 'sdk.cache.hit', 'sdk.cache.miss', 'checkout.mount', 'session.create.started', 'session.shell.ready', 'session.claim.started', 'session.claim.completed', 'session.read.started', 'session.request.first_byte', 'session.request.completed', 'checkout.data.ready', 'checkout.rendered', 'checkout.recovery.started', 'checkout.recovery.completed', 'checkout.unmount', 'provider.load.started', 'provider.eligibility.checked', 'provider.availability.checked', 'provider.ready', 'provider.handoff.requested', 'provider.popup.opened', 'provider.overlay.opened', 'provider.overlay.returned', 'provider.callback.ignored', 'provider.redirect.started', 'provider.redirect.resumed', 'vault.capture.requested', 'vault.widget.mounted', 'vault.widget.ready', 'vault.submission.started', 'vault.action.required', 'vault.three_ds.handoff', 'vault.three_ds.returned', 'vault.terminal', 'payment.method.selected', 'payment.intent.started', 'payment.intent.completed', 'payment.provider_confirmation.started', 'payment.provider_confirmation.returned', 'payment.tokenization.started', 'payment.tokenization.completed', 'payment.processing.started', 'payment.processing.completed', 'payment.three_ds.handoff', 'payment.three_ds.returned', 'operation.retry', 'operation.deduplicated', 'operation.fallback', 'operation.cache.hit', 'operation.cache.miss', 'operation.recovery.started', 'operation.recovery.completed', 'operation.state_transition'];
|
|
40
40
|
export type TelemetryLogName = (typeof TELEMETRY_LOG_NAMES)[number];
|
|
41
|
+
/**
|
|
42
|
+
* Closed reasons a provider callback was ignored instead of reaching checkout
|
|
43
|
+
* recovery (`provider.callback.ignored` only): no current attempt owned it, its
|
|
44
|
+
* attempt had finished or been replaced, its session changed, the checkout was
|
|
45
|
+
* torn down, or another payment method's flow is the selected one.
|
|
46
|
+
*/
|
|
47
|
+
export declare const TELEMETRY_CALLBACK_IGNORED_REASONS: readonly ['no_current_attempt', 'stale_attempt', 'session_changed', 'torn_down', 'other_method_active'];
|
|
48
|
+
export type TelemetryCallbackIgnoredReason = (typeof TELEMETRY_CALLBACK_IGNORED_REASONS)[number];
|
|
41
49
|
declare const TELEMETRY_REQUEST_CATEGORIES: readonly ['session_create', 'session_claim', 'session_read', 'intent_create', 'process_payment', 'vault_capture', 'account_snapshot', 'provider_sdk', 'other'];
|
|
42
50
|
export type TelemetryRequestCategory = (typeof TELEMETRY_REQUEST_CATEGORIES)[number];
|
|
43
51
|
declare const TELEMETRY_STATUS_CLASSES: readonly ['2xx', '3xx', '4xx', '5xx', 'network_error', 'timeout', 'unknown'];
|
|
@@ -95,6 +103,13 @@ export interface TelemetryErrorEvent extends TelemetryCommonFields {
|
|
|
95
103
|
reason?: TelemetryErrorReason;
|
|
96
104
|
checkoutSessionId?: string;
|
|
97
105
|
durationMs?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Exact HTTP status of the failed response: an integer from 100 to 599 that
|
|
108
|
+
* falls inside an HTTP `statusClass` when the event has one.
|
|
109
|
+
*/
|
|
110
|
+
httpStatus?: number;
|
|
111
|
+
/** Server `X-Request-Id` of the failed response, `[A-Za-z0-9_-]{1,64}`. */
|
|
112
|
+
requestId?: string;
|
|
98
113
|
}
|
|
99
114
|
export interface BuildTelemetryErrorEventInput extends BuildTelemetryCommonInput {
|
|
100
115
|
errorCode: TelemetryErrorCode;
|
|
@@ -102,13 +117,20 @@ export interface BuildTelemetryErrorEventInput extends BuildTelemetryCommonInput
|
|
|
102
117
|
reason?: TelemetryErrorReason;
|
|
103
118
|
checkoutSessionId?: string;
|
|
104
119
|
durationMs?: number;
|
|
120
|
+
/** Exact HTTP status of the failed response; an invalid value is omitted. */
|
|
121
|
+
httpStatus?: number;
|
|
122
|
+
/** Server `X-Request-Id` of the failed response; an invalid value is omitted. */
|
|
123
|
+
requestId?: string;
|
|
105
124
|
}
|
|
106
125
|
export interface TelemetryLogEvent extends TelemetryCommonFields {
|
|
107
126
|
class: 'lifecycle';
|
|
108
127
|
name: TelemetryLogName;
|
|
128
|
+
/** Only on `provider.callback.ignored`, from the closed ignored-callback set. */
|
|
129
|
+
reason?: TelemetryCallbackIgnoredReason;
|
|
109
130
|
}
|
|
110
131
|
export interface BuildTelemetryLogEventInput extends BuildTelemetryCommonInput {
|
|
111
132
|
name: TelemetryLogName;
|
|
133
|
+
reason?: TelemetryCallbackIgnoredReason;
|
|
112
134
|
}
|
|
113
135
|
export interface TelemetryExpectedOutcomeEvent extends TelemetryCommonFields {
|
|
114
136
|
class: 'expected_outcome';
|
|
@@ -148,6 +170,13 @@ export interface TelemetryBatchEnvelope {
|
|
|
148
170
|
};
|
|
149
171
|
events: TelemetryEvent[];
|
|
150
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Keep an exact HTTP status only inside the backend contract: an integer from
|
|
175
|
+
* 100 to 599 that, when the event has an HTTP status class, falls in that class.
|
|
176
|
+
*/
|
|
177
|
+
export declare function safeTelemetryHttpStatus(value: unknown, statusClass?: string): number | undefined;
|
|
178
|
+
/** Keep a server request id only in the closed `[A-Za-z0-9_-]{1,64}` format. */
|
|
179
|
+
export declare function safeTelemetryRequestId(value: unknown): string | undefined;
|
|
151
180
|
/** Build a closed SDK technical-error event. */
|
|
152
181
|
export declare function buildTelemetryErrorEvent(input: BuildTelemetryErrorEventInput): TelemetryErrorEvent;
|
|
153
182
|
/** Build a typed SDK lifecycle event; arbitrary text is never accepted. */
|
package/dist/types.d.ts
CHANGED
|
@@ -644,6 +644,19 @@ export type PayPalSessionIntent = (PayPalLegacySessionIntentRequest & PayPalSess
|
|
|
644
644
|
providerObjectType: 'setup_token';
|
|
645
645
|
});
|
|
646
646
|
export type SessionIntent = StripeSessionIntent | PayPalSessionIntent;
|
|
647
|
+
/**
|
|
648
|
+
* What `PaymentAPI.createSessionIntent` yields when the billing API answers the intent
|
|
649
|
+
* request with `202 checkout_processing` (the session-intent fence is held by an earlier
|
|
650
|
+
* operation, for example a PayPal capture under review) and polling `/status` reaches a
|
|
651
|
+
* verdict. There is no intent to confirm: `response` is the same `Response` a `/process`
|
|
652
|
+
* call produces for that verdict (`204` success, `200` authorized, `400` JSON decline).
|
|
653
|
+
*/
|
|
654
|
+
export interface SettledSessionIntent {
|
|
655
|
+
settled: true;
|
|
656
|
+
response: Response;
|
|
657
|
+
}
|
|
658
|
+
/** A created session intent, or the settled verdict of a session that was already processing. */
|
|
659
|
+
export type SessionIntentResult = SessionIntent | SettledSessionIntent;
|
|
647
660
|
export type SessionIntentDeclineRequest = {
|
|
648
661
|
provider: 'stripe';
|
|
649
662
|
paymentMethodCategory: NonCardPaymentMethodCategory;
|