@asteby/storefront-react 0.18.0 → 0.20.0
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 +60 -0
- package/dist/account-server.cjs +405 -7
- package/dist/account-server.cjs.map +1 -1
- package/dist/account-server.d.cts +41 -1
- package/dist/account-server.d.ts +41 -1
- package/dist/account-server.js +73 -3
- package/dist/account-server.js.map +1 -1
- package/dist/account.cjs +1507 -4
- package/dist/account.cjs.map +1 -1
- package/dist/account.css +203 -0
- package/dist/account.d.cts +526 -6
- package/dist/account.d.ts +526 -6
- package/dist/account.js +1145 -2
- package/dist/account.js.map +1 -1
- package/dist/checkout.js +2 -2
- package/dist/chunk-PPQEUTXJ.js +260 -0
- package/dist/chunk-PPQEUTXJ.js.map +1 -0
- package/dist/chunk-TXEYBDFG.js +182 -0
- package/dist/chunk-TXEYBDFG.js.map +1 -0
- package/dist/fiscal.d.cts +34 -34
- package/dist/fiscal.d.ts +34 -34
- package/dist/fiscal.js +4 -258
- package/dist/fiscal.js.map +1 -1
- package/dist/payments.cjs +22 -3
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.css +15 -14
- package/dist/payments.d.cts +4 -1
- package/dist/payments.d.ts +4 -1
- package/dist/payments.js +24 -5
- package/dist/payments.js.map +1 -1
- package/dist/voucher-document-SFWJCLTN.js +124 -0
- package/dist/voucher-document-SFWJCLTN.js.map +1 -0
- package/package.json +2 -2
package/dist/payments.cjs
CHANGED
|
@@ -146,6 +146,7 @@ function sanitizeMercadoPagoFormData(data) {
|
|
|
146
146
|
function mercadoPagoBricksAdapter(options = {}) {
|
|
147
147
|
const allowed = options.allowedSdkOrigins ?? ["https://sdk.mercadopago.com"];
|
|
148
148
|
const getSdk = options.getSdk ?? (() => typeof window !== "undefined" ? window.MercadoPago : void 0);
|
|
149
|
+
const retryDelay = options.collectRetryDelayMs ?? 400;
|
|
149
150
|
const getDevice = options.getDeviceSessionId ?? (() => typeof window !== "undefined" ? window.MP_DEVICE_SESSION_ID : void 0);
|
|
150
151
|
return {
|
|
151
152
|
kind: MERCADOPAGO_BRICKS_KIND,
|
|
@@ -187,9 +188,21 @@ function mercadoPagoBricksAdapter(options = {}) {
|
|
|
187
188
|
return {
|
|
188
189
|
async collect() {
|
|
189
190
|
if (gone) throw new Error("payment form is unmounted");
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
const read = async () => {
|
|
192
|
+
const raw = await controller.getFormData();
|
|
193
|
+
const data = sanitizeMercadoPagoFormData(raw);
|
|
194
|
+
if (!data.token) throw new Error("payment form incomplete");
|
|
195
|
+
return data;
|
|
196
|
+
};
|
|
197
|
+
let provider_data;
|
|
198
|
+
try {
|
|
199
|
+
provider_data = await read();
|
|
200
|
+
} catch (first) {
|
|
201
|
+
if (gone) throw first;
|
|
202
|
+
await new Promise((r) => setTimeout(r, retryDelay));
|
|
203
|
+
if (gone) throw first;
|
|
204
|
+
provider_data = await read();
|
|
205
|
+
}
|
|
193
206
|
const device = getDevice();
|
|
194
207
|
return { provider_data, ...typeof device === "string" && device ? { device_session_id: device } : {} };
|
|
195
208
|
},
|
|
@@ -919,15 +932,21 @@ function useEmbeddedPayment(options) {
|
|
|
919
932
|
setError(null);
|
|
920
933
|
setOutcome(null);
|
|
921
934
|
emit({ type: "submit" });
|
|
935
|
+
const withdrawn = () => !alive.current || form.current !== m;
|
|
936
|
+
const settle = () => {
|
|
937
|
+
if (alive.current) setStatus((s) => s === "processing" ? "idle" : s);
|
|
938
|
+
};
|
|
922
939
|
let data;
|
|
923
940
|
try {
|
|
924
941
|
data = await m.collect();
|
|
925
942
|
} catch {
|
|
943
|
+
if (withdrawn()) return settle();
|
|
926
944
|
emit({ type: "tokenize_error" });
|
|
927
945
|
setError({ kind: "generic", message: live.current.msgs["error.card_data"], retrySameAttempt: false, canRetry: true });
|
|
928
946
|
setStatus("ready");
|
|
929
947
|
return;
|
|
930
948
|
}
|
|
949
|
+
if (withdrawn()) return settle();
|
|
931
950
|
const attempt = readAttempt();
|
|
932
951
|
setAttemptId(attempt);
|
|
933
952
|
await send(data, attempt, total);
|