@cimplify/sdk 0.66.0 → 0.68.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/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-J3MGY6AU.js → chunk-5HAUJBOK.js} +36 -82
- package/dist/chunk-E6T5VJMG.mjs +156 -0
- package/dist/{chunk-3G4QCENX.mjs → chunk-FVGVJ4TC.mjs} +12 -50
- package/dist/chunk-IQLJJW2H.js +168 -0
- package/dist/{chunk-227XTAEB.mjs → chunk-KNPE4WCQ.mjs} +2 -48
- package/dist/{chunk-H6DBPHMZ.js → chunk-NGQCWFKF.js} +4 -4
- package/dist/{chunk-R6363CC7.mjs → chunk-SOV4H6PQ.mjs} +509 -79
- package/dist/{chunk-HCZTBWU4.js → chunk-SXGFJEME.js} +12 -50
- package/dist/{chunk-MWI5GAUF.mjs → chunk-TAKORJP4.mjs} +2 -2
- package/dist/{chunk-AVQL3TSJ.js → chunk-WCSAZRNC.js} +519 -78
- package/dist/{client-CUrA1uQ0.d.mts → client-CBE7ksYC.d.mts} +1 -1
- package/dist/{client-Bo5rujc2.d.ts → client-CfeQRwhl.d.ts} +55 -21
- package/dist/{client-DasPHOJh.d.ts → client-DlXfZy7N.d.ts} +1 -1
- package/dist/{client-Dka2cGhu.d.mts → client-Dyo3dvNy.d.mts} +55 -21
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +104 -88
- package/dist/index.mjs +16 -12
- package/dist/mock/cli.mjs +12 -50
- package/dist/mock/library.js +12 -50
- package/dist/mock/library.mjs +12 -50
- package/dist/mock/msw.js +12 -50
- package/dist/mock/msw.mjs +12 -50
- package/dist/react.d.mts +44 -44
- package/dist/react.d.ts +44 -44
- package/dist/react.js +298 -175
- package/dist/react.mjs +240 -117
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +16 -9
- package/dist/server.mjs +11 -4
- package/dist/{sign-in-dr7m09nm.d.ts → sign-in-DQlIdqsi.d.mts} +14 -1
- package/dist/{sign-in-dr7m09nm.d.mts → sign-in-DQlIdqsi.d.ts} +14 -1
- package/dist/styles.css +1 -1
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +17 -17
- package/dist/testing.d.ts +17 -17
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/package.json +1 -1
- package/registry/index.json +0 -9
- package/dist/chunk-3Z3FQH7X.mjs +0 -323
- package/dist/chunk-7BKKBJQM.mjs +0 -52
- package/dist/chunk-GDAGM26J.js +0 -338
- package/dist/chunk-KWYI2TTA.js +0 -60
- package/registry/account.json +0 -15
|
@@ -2647,10 +2647,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2647
2647
|
REFRESH_TOKEN: "refresh_token", LOGOUT: "logout",
|
|
2648
2648
|
PROCESS_CHECKOUT: "process_checkout", ABORT_CHECKOUT: "abort_checkout",
|
|
2649
2649
|
READY: "ready", HEIGHT_CHANGE: "height_change",
|
|
2650
|
-
|
|
2650
|
+
AUTH_REQUESTED: "auth_requested", ERROR: "error",
|
|
2651
2651
|
ADDRESS_CHANGED: "address_changed", ADDRESS_SELECTED: "address_selected",
|
|
2652
2652
|
PAYMENT_METHOD_SELECTED: "payment_method_selected",
|
|
2653
|
-
|
|
2653
|
+
LOGOUT_COMPLETE: "logout_complete",
|
|
2654
2654
|
CONTACT_PROVIDED: "contact_provided",
|
|
2655
2655
|
CHECKOUT_STATUS: "checkout_status", CHECKOUT_COMPLETE: "checkout_complete",
|
|
2656
2656
|
ORDER_TYPE_CHANGED: "order_type_changed", REQUEST_SUBMIT: "request_submit"
|
|
@@ -2659,6 +2659,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2659
2659
|
var AUTO = qs.get("auto") === "true";
|
|
2660
2660
|
var DEMO_OTP = qs.get("otp") || "123456";
|
|
2661
2661
|
var ORIGIN = qs.get("origin") || "*";
|
|
2662
|
+
var NONCE = qs.get("nonce");
|
|
2662
2663
|
var state = {
|
|
2663
2664
|
businessId: DEFAULT_BUSINESS,
|
|
2664
2665
|
token: null,
|
|
@@ -2673,7 +2674,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2673
2674
|
var content = document.getElementById("content");
|
|
2674
2675
|
var title = document.getElementById("title");
|
|
2675
2676
|
|
|
2676
|
-
function send(msg) {
|
|
2677
|
+
function send(msg) {
|
|
2678
|
+
if (NONCE) msg.nonce = NONCE;
|
|
2679
|
+
parent.postMessage(msg, ORIGIN);
|
|
2680
|
+
}
|
|
2677
2681
|
function reportHeight() { send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight }); }
|
|
2678
2682
|
function ready() { send({ type: MSG.READY, height: document.documentElement.scrollHeight }); }
|
|
2679
2683
|
|
|
@@ -2693,54 +2697,13 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2693
2697
|
function renderAuth() {
|
|
2694
2698
|
title.textContent = "Sign in";
|
|
2695
2699
|
content.innerHTML =
|
|
2696
|
-
'<
|
|
2697
|
-
'<input id="contact" placeholder="you@example.com or +233..." value="' + (qs.get("contact") || "") + '">' +
|
|
2698
|
-
'<button id="send-otp">Send code</button>' +
|
|
2699
|
-
'<div id="otp-box" style="display:none">' +
|
|
2700
|
-
' <label>Verification code (mock: ' + DEMO_OTP + ')</label>' +
|
|
2701
|
-
' <input id="otp" maxlength="6" value="' + DEMO_OTP + '">' +
|
|
2702
|
-
' <button id="verify-otp">Verify</button>' +
|
|
2703
|
-
'</div>' +
|
|
2700
|
+
'<button id="start-auth">Continue with Cimplify</button>' +
|
|
2704
2701
|
'<div class="err" id="err"></div>';
|
|
2705
|
-
document.getElementById("
|
|
2706
|
-
|
|
2707
|
-
if (!contact) { document.getElementById("err").textContent = "Enter contact"; return; }
|
|
2708
|
-
state.contact = contact;
|
|
2709
|
-
var contactType = contact.indexOf("@") >= 0 ? "email" : "phone";
|
|
2710
|
-
send({ type: MSG.CONTACT_PROVIDED, contact: contact, contactType: contactType });
|
|
2711
|
-
send({ type: MSG.REQUIRES_OTP, contactMasked: contact.slice(0, 3) + "***" });
|
|
2712
|
-
document.getElementById("otp-box").style.display = "block";
|
|
2713
|
-
reportHeight();
|
|
2714
|
-
};
|
|
2715
|
-
document.getElementById("verify-otp").onclick = function () {
|
|
2716
|
-
var code = document.getElementById("otp").value.trim();
|
|
2717
|
-
if (code !== DEMO_OTP) { document.getElementById("err").textContent = "Invalid code"; return; }
|
|
2718
|
-
fetch("/api/v1/auth/verify-otp", {
|
|
2719
|
-
method: "POST",
|
|
2720
|
-
headers: { "content-type": "application/json" },
|
|
2721
|
-
body: JSON.stringify({ contact: state.contact, code: code })
|
|
2722
|
-
}).then(function (r) { return r.json(); }).then(function (body) {
|
|
2723
|
-
var session = body.session || {};
|
|
2724
|
-
state.token = session.token || body.token;
|
|
2725
|
-
state.customer = {
|
|
2726
|
-
name: session.customer_name || "Customer",
|
|
2727
|
-
email: session.customer_email || (state.contact && state.contact.indexOf("@") >= 0 ? state.contact : null),
|
|
2728
|
-
phone: session.customer_phone || (state.contact && state.contact.indexOf("@") < 0 ? state.contact : null)
|
|
2729
|
-
};
|
|
2730
|
-
send({
|
|
2731
|
-
type: MSG.AUTHENTICATED,
|
|
2732
|
-
accountId: "acct_mock_" + (session.id || "x"),
|
|
2733
|
-
customerId: session.customer_id || "cust_mock",
|
|
2734
|
-
token: state.token,
|
|
2735
|
-
customer: state.customer
|
|
2736
|
-
});
|
|
2737
|
-
}).catch(function (e) {
|
|
2738
|
-
send({ type: MSG.ERROR, code: "AUTH_FAILED", message: String(e) });
|
|
2739
|
-
});
|
|
2702
|
+
document.getElementById("start-auth").onclick = function () {
|
|
2703
|
+
send({ type: MSG.AUTH_REQUESTED });
|
|
2740
2704
|
};
|
|
2741
2705
|
if (AUTO) {
|
|
2742
|
-
setTimeout(function () { document.getElementById("
|
|
2743
|
-
setTimeout(function () { document.getElementById("verify-otp").click(); }, 150);
|
|
2706
|
+
setTimeout(function () { document.getElementById("start-auth").click(); }, 50);
|
|
2744
2707
|
}
|
|
2745
2708
|
}
|
|
2746
2709
|
|
|
@@ -2917,7 +2880,6 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2917
2880
|
break;
|
|
2918
2881
|
case MSG.SET_TOKEN:
|
|
2919
2882
|
state.token = msg.token;
|
|
2920
|
-
send({ type: MSG.TOKEN_REFRESHED, token: state.token });
|
|
2921
2883
|
break;
|
|
2922
2884
|
case MSG.SET_CART:
|
|
2923
2885
|
state.cart = msg.cart;
|
|
@@ -2929,7 +2891,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2929
2891
|
send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight });
|
|
2930
2892
|
break;
|
|
2931
2893
|
case MSG.REFRESH_TOKEN:
|
|
2932
|
-
|
|
2894
|
+
reportHeight();
|
|
2933
2895
|
break;
|
|
2934
2896
|
case MSG.LOGOUT:
|
|
2935
2897
|
state.token = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-FVGVJ4TC.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-KNPE4WCQ.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|