@asteby/storefront 0.2.0 → 0.3.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/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/mock.cjs +7 -0
- package/dist/mock.cjs.map +1 -1
- package/dist/mock.d.cts +1 -0
- package/dist/mock.d.ts +1 -0
- package/dist/mock.js +7 -0
- package/dist/mock.js.map +1 -1
- package/package.json +1 -1
package/dist/mock.d.cts
CHANGED
package/dist/mock.d.ts
CHANGED
package/dist/mock.js
CHANGED
|
@@ -360,6 +360,7 @@ function createMockStorefront(options = {}) {
|
|
|
360
360
|
otps: /* @__PURE__ */ new Map(),
|
|
361
361
|
sessions: /* @__PURE__ */ new Map(),
|
|
362
362
|
idempotency: /* @__PURE__ */ new Map(),
|
|
363
|
+
checkouts: /* @__PURE__ */ new Map(),
|
|
363
364
|
seq: 0
|
|
364
365
|
};
|
|
365
366
|
}
|
|
@@ -798,9 +799,15 @@ function createMockStorefront(options = {}) {
|
|
|
798
799
|
stock_hold_expires_at: new Date(Date.now() + 30 * 6e4).toISOString()
|
|
799
800
|
}
|
|
800
801
|
};
|
|
802
|
+
state.checkouts.set(checkoutId, result);
|
|
801
803
|
if (key) state.idempotency.set(`${params[0]}:${key}`, { status: 201, body: result });
|
|
802
804
|
return { status: 201, body: result, cache: "private" };
|
|
803
805
|
});
|
|
806
|
+
route("GET", "/checkouts/:id", "checkout:write", ({ params }) => {
|
|
807
|
+
const found = state.checkouts.get(params[0]);
|
|
808
|
+
if (!found) throw new HttpError(404, "not_found", "Checkout not found");
|
|
809
|
+
return { body: found, cache: "private" };
|
|
810
|
+
});
|
|
804
811
|
route("POST", "/customer/otp", "customer:write", ({ body }) => {
|
|
805
812
|
state.otps.set(identifierOf(body), otpCode);
|
|
806
813
|
return { status: 204 };
|