@misiki/gocommerce-connector 0.4.3 → 0.4.4
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-wGZwLTCe.d.cts → index-BNYk4TS2.d.cts} +118 -1
- package/dist/{index-wGZwLTCe.d.ts → index-BNYk4TS2.d.ts} +118 -1
- package/dist/index.cjs +24 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +24 -5
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +24 -5
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/dist/services/index.cjs
CHANGED
|
@@ -2025,12 +2025,31 @@ var OrderService = class extends BaseService {
|
|
|
2025
2025
|
async listPublic(_args = {}) {
|
|
2026
2026
|
return emptyPage();
|
|
2027
2027
|
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2028
|
+
/**
|
|
2029
|
+
* Sends a 4-digit code to the email or phone on the order, when `contact`
|
|
2030
|
+
* is that email or phone. The engine answers the same either way, so this
|
|
2031
|
+
* resolves whether or not anything was sent.
|
|
2032
|
+
*/
|
|
2033
|
+
async requestOrderCode({ orderNo, contact }) {
|
|
2034
|
+
const res = await this.data(
|
|
2035
|
+
`/api/orders/${encodeURIComponent(orderNo.trim())}/code`,
|
|
2036
|
+
{ method: "POST", body: { contact: contact.trim() } }
|
|
2037
|
+
);
|
|
2038
|
+
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Opens an order with the code `requestOrderCode` sent. The token it answers
|
|
2042
|
+
* is kept like an order placed in this browser, so the order page and
|
|
2043
|
+
* `getOrder` read it again without another code.
|
|
2044
|
+
*/
|
|
2045
|
+
async getOrderByEmailAndOTP({ orderNo, otp }) {
|
|
2046
|
+
const number = orderNo.trim();
|
|
2047
|
+
const res = await this.data(
|
|
2048
|
+
`/api/orders/${encodeURIComponent(number)}/code/verify`,
|
|
2049
|
+
{ method: "POST", body: { code: String(otp).trim() } }
|
|
2033
2050
|
);
|
|
2051
|
+
rememberOrder({ number: res.order.number, token: res.access_token, cartId: "" });
|
|
2052
|
+
return { data: [toOrder(res.order)] };
|
|
2034
2053
|
}
|
|
2035
2054
|
};
|
|
2036
2055
|
var clean2 = (v) => v && v !== "undefined" && v !== "null" ? v : void 0;
|