@cimplify/sdk 0.66.0 → 0.67.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-AVQL3TSJ.js → chunk-3QSW33RG.js} +389 -78
- package/dist/chunk-E6T5VJMG.mjs +156 -0
- package/dist/{chunk-MWI5GAUF.mjs → chunk-FNK6UZOE.mjs} +2 -2
- package/dist/{chunk-3G4QCENX.mjs → chunk-FVGVJ4TC.mjs} +12 -50
- package/dist/chunk-IQLJJW2H.js +168 -0
- package/dist/{chunk-227XTAEB.mjs → chunk-JAPCAZN4.mjs} +2 -48
- package/dist/{chunk-R6363CC7.mjs → chunk-QQMDEGAK.mjs} +382 -79
- package/dist/{chunk-H6DBPHMZ.js → chunk-SH6HJW4A.js} +4 -4
- package/dist/{chunk-J3MGY6AU.js → chunk-SSLFZPAI.js} +36 -82
- package/dist/{chunk-HCZTBWU4.js → chunk-SXGFJEME.js} +12 -50
- package/dist/{client-Dka2cGhu.d.mts → client-ByI_3jfL.d.mts} +32 -20
- package/dist/{client-DasPHOJh.d.ts → client-CQlEWH5j.d.ts} +1 -1
- package/dist/{client-Bo5rujc2.d.ts → client-DVFQoDtI.d.ts} +32 -20
- package/dist/{client-CUrA1uQ0.d.mts → client-Dd82KQ_G.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +80 -81
- package/dist/index.mjs +4 -5
- 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 +4 -7
- package/dist/react.d.ts +4 -7
- package/dist/react.js +63 -71
- package/dist/react.mjs +5 -13
- 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-RFuWZOgF.d.mts} +6 -1
- package/dist/{sign-in-dr7m09nm.d.mts → sign-in-RFuWZOgF.d.ts} +6 -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 +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/package.json +1 -1
- 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/dist/mock/library.mjs
CHANGED
|
@@ -2716,10 +2716,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2716
2716
|
REFRESH_TOKEN: "refresh_token", LOGOUT: "logout",
|
|
2717
2717
|
PROCESS_CHECKOUT: "process_checkout", ABORT_CHECKOUT: "abort_checkout",
|
|
2718
2718
|
READY: "ready", HEIGHT_CHANGE: "height_change",
|
|
2719
|
-
|
|
2719
|
+
AUTH_REQUESTED: "auth_requested", ERROR: "error",
|
|
2720
2720
|
ADDRESS_CHANGED: "address_changed", ADDRESS_SELECTED: "address_selected",
|
|
2721
2721
|
PAYMENT_METHOD_SELECTED: "payment_method_selected",
|
|
2722
|
-
|
|
2722
|
+
LOGOUT_COMPLETE: "logout_complete",
|
|
2723
2723
|
CONTACT_PROVIDED: "contact_provided",
|
|
2724
2724
|
CHECKOUT_STATUS: "checkout_status", CHECKOUT_COMPLETE: "checkout_complete",
|
|
2725
2725
|
ORDER_TYPE_CHANGED: "order_type_changed", REQUEST_SUBMIT: "request_submit"
|
|
@@ -2728,6 +2728,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2728
2728
|
var AUTO = qs.get("auto") === "true";
|
|
2729
2729
|
var DEMO_OTP = qs.get("otp") || "123456";
|
|
2730
2730
|
var ORIGIN = qs.get("origin") || "*";
|
|
2731
|
+
var NONCE = qs.get("nonce");
|
|
2731
2732
|
var state = {
|
|
2732
2733
|
businessId: DEFAULT_BUSINESS,
|
|
2733
2734
|
token: null,
|
|
@@ -2742,7 +2743,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2742
2743
|
var content = document.getElementById("content");
|
|
2743
2744
|
var title = document.getElementById("title");
|
|
2744
2745
|
|
|
2745
|
-
function send(msg) {
|
|
2746
|
+
function send(msg) {
|
|
2747
|
+
if (NONCE) msg.nonce = NONCE;
|
|
2748
|
+
parent.postMessage(msg, ORIGIN);
|
|
2749
|
+
}
|
|
2746
2750
|
function reportHeight() { send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight }); }
|
|
2747
2751
|
function ready() { send({ type: MSG.READY, height: document.documentElement.scrollHeight }); }
|
|
2748
2752
|
|
|
@@ -2762,54 +2766,13 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2762
2766
|
function renderAuth() {
|
|
2763
2767
|
title.textContent = "Sign in";
|
|
2764
2768
|
content.innerHTML =
|
|
2765
|
-
'<
|
|
2766
|
-
'<input id="contact" placeholder="you@example.com or +233..." value="' + (qs.get("contact") || "") + '">' +
|
|
2767
|
-
'<button id="send-otp">Send code</button>' +
|
|
2768
|
-
'<div id="otp-box" style="display:none">' +
|
|
2769
|
-
' <label>Verification code (mock: ' + DEMO_OTP + ')</label>' +
|
|
2770
|
-
' <input id="otp" maxlength="6" value="' + DEMO_OTP + '">' +
|
|
2771
|
-
' <button id="verify-otp">Verify</button>' +
|
|
2772
|
-
'</div>' +
|
|
2769
|
+
'<button id="start-auth">Continue with Cimplify</button>' +
|
|
2773
2770
|
'<div class="err" id="err"></div>';
|
|
2774
|
-
document.getElementById("
|
|
2775
|
-
|
|
2776
|
-
if (!contact) { document.getElementById("err").textContent = "Enter contact"; return; }
|
|
2777
|
-
state.contact = contact;
|
|
2778
|
-
var contactType = contact.indexOf("@") >= 0 ? "email" : "phone";
|
|
2779
|
-
send({ type: MSG.CONTACT_PROVIDED, contact: contact, contactType: contactType });
|
|
2780
|
-
send({ type: MSG.REQUIRES_OTP, contactMasked: contact.slice(0, 3) + "***" });
|
|
2781
|
-
document.getElementById("otp-box").style.display = "block";
|
|
2782
|
-
reportHeight();
|
|
2783
|
-
};
|
|
2784
|
-
document.getElementById("verify-otp").onclick = function () {
|
|
2785
|
-
var code = document.getElementById("otp").value.trim();
|
|
2786
|
-
if (code !== DEMO_OTP) { document.getElementById("err").textContent = "Invalid code"; return; }
|
|
2787
|
-
fetch("/api/v1/auth/verify-otp", {
|
|
2788
|
-
method: "POST",
|
|
2789
|
-
headers: { "content-type": "application/json" },
|
|
2790
|
-
body: JSON.stringify({ contact: state.contact, code: code })
|
|
2791
|
-
}).then(function (r) { return r.json(); }).then(function (body) {
|
|
2792
|
-
var session = body.session || {};
|
|
2793
|
-
state.token = session.token || body.token;
|
|
2794
|
-
state.customer = {
|
|
2795
|
-
name: session.customer_name || "Customer",
|
|
2796
|
-
email: session.customer_email || (state.contact && state.contact.indexOf("@") >= 0 ? state.contact : null),
|
|
2797
|
-
phone: session.customer_phone || (state.contact && state.contact.indexOf("@") < 0 ? state.contact : null)
|
|
2798
|
-
};
|
|
2799
|
-
send({
|
|
2800
|
-
type: MSG.AUTHENTICATED,
|
|
2801
|
-
accountId: "acct_mock_" + (session.id || "x"),
|
|
2802
|
-
customerId: session.customer_id || "cust_mock",
|
|
2803
|
-
token: state.token,
|
|
2804
|
-
customer: state.customer
|
|
2805
|
-
});
|
|
2806
|
-
}).catch(function (e) {
|
|
2807
|
-
send({ type: MSG.ERROR, code: "AUTH_FAILED", message: String(e) });
|
|
2808
|
-
});
|
|
2771
|
+
document.getElementById("start-auth").onclick = function () {
|
|
2772
|
+
send({ type: MSG.AUTH_REQUESTED });
|
|
2809
2773
|
};
|
|
2810
2774
|
if (AUTO) {
|
|
2811
|
-
setTimeout(function () { document.getElementById("
|
|
2812
|
-
setTimeout(function () { document.getElementById("verify-otp").click(); }, 150);
|
|
2775
|
+
setTimeout(function () { document.getElementById("start-auth").click(); }, 50);
|
|
2813
2776
|
}
|
|
2814
2777
|
}
|
|
2815
2778
|
|
|
@@ -2986,7 +2949,6 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2986
2949
|
break;
|
|
2987
2950
|
case MSG.SET_TOKEN:
|
|
2988
2951
|
state.token = msg.token;
|
|
2989
|
-
send({ type: MSG.TOKEN_REFRESHED, token: state.token });
|
|
2990
2952
|
break;
|
|
2991
2953
|
case MSG.SET_CART:
|
|
2992
2954
|
state.cart = msg.cart;
|
|
@@ -2998,7 +2960,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2998
2960
|
send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight });
|
|
2999
2961
|
break;
|
|
3000
2962
|
case MSG.REFRESH_TOKEN:
|
|
3001
|
-
|
|
2963
|
+
reportHeight();
|
|
3002
2964
|
break;
|
|
3003
2965
|
case MSG.LOGOUT:
|
|
3004
2966
|
state.token = null;
|
package/dist/mock/msw.js
CHANGED
|
@@ -2716,10 +2716,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2716
2716
|
REFRESH_TOKEN: "refresh_token", LOGOUT: "logout",
|
|
2717
2717
|
PROCESS_CHECKOUT: "process_checkout", ABORT_CHECKOUT: "abort_checkout",
|
|
2718
2718
|
READY: "ready", HEIGHT_CHANGE: "height_change",
|
|
2719
|
-
|
|
2719
|
+
AUTH_REQUESTED: "auth_requested", ERROR: "error",
|
|
2720
2720
|
ADDRESS_CHANGED: "address_changed", ADDRESS_SELECTED: "address_selected",
|
|
2721
2721
|
PAYMENT_METHOD_SELECTED: "payment_method_selected",
|
|
2722
|
-
|
|
2722
|
+
LOGOUT_COMPLETE: "logout_complete",
|
|
2723
2723
|
CONTACT_PROVIDED: "contact_provided",
|
|
2724
2724
|
CHECKOUT_STATUS: "checkout_status", CHECKOUT_COMPLETE: "checkout_complete",
|
|
2725
2725
|
ORDER_TYPE_CHANGED: "order_type_changed", REQUEST_SUBMIT: "request_submit"
|
|
@@ -2728,6 +2728,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2728
2728
|
var AUTO = qs.get("auto") === "true";
|
|
2729
2729
|
var DEMO_OTP = qs.get("otp") || "123456";
|
|
2730
2730
|
var ORIGIN = qs.get("origin") || "*";
|
|
2731
|
+
var NONCE = qs.get("nonce");
|
|
2731
2732
|
var state = {
|
|
2732
2733
|
businessId: DEFAULT_BUSINESS,
|
|
2733
2734
|
token: null,
|
|
@@ -2742,7 +2743,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2742
2743
|
var content = document.getElementById("content");
|
|
2743
2744
|
var title = document.getElementById("title");
|
|
2744
2745
|
|
|
2745
|
-
function send(msg) {
|
|
2746
|
+
function send(msg) {
|
|
2747
|
+
if (NONCE) msg.nonce = NONCE;
|
|
2748
|
+
parent.postMessage(msg, ORIGIN);
|
|
2749
|
+
}
|
|
2746
2750
|
function reportHeight() { send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight }); }
|
|
2747
2751
|
function ready() { send({ type: MSG.READY, height: document.documentElement.scrollHeight }); }
|
|
2748
2752
|
|
|
@@ -2762,54 +2766,13 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2762
2766
|
function renderAuth() {
|
|
2763
2767
|
title.textContent = "Sign in";
|
|
2764
2768
|
content.innerHTML =
|
|
2765
|
-
'<
|
|
2766
|
-
'<input id="contact" placeholder="you@example.com or +233..." value="' + (qs.get("contact") || "") + '">' +
|
|
2767
|
-
'<button id="send-otp">Send code</button>' +
|
|
2768
|
-
'<div id="otp-box" style="display:none">' +
|
|
2769
|
-
' <label>Verification code (mock: ' + DEMO_OTP + ')</label>' +
|
|
2770
|
-
' <input id="otp" maxlength="6" value="' + DEMO_OTP + '">' +
|
|
2771
|
-
' <button id="verify-otp">Verify</button>' +
|
|
2772
|
-
'</div>' +
|
|
2769
|
+
'<button id="start-auth">Continue with Cimplify</button>' +
|
|
2773
2770
|
'<div class="err" id="err"></div>';
|
|
2774
|
-
document.getElementById("
|
|
2775
|
-
|
|
2776
|
-
if (!contact) { document.getElementById("err").textContent = "Enter contact"; return; }
|
|
2777
|
-
state.contact = contact;
|
|
2778
|
-
var contactType = contact.indexOf("@") >= 0 ? "email" : "phone";
|
|
2779
|
-
send({ type: MSG.CONTACT_PROVIDED, contact: contact, contactType: contactType });
|
|
2780
|
-
send({ type: MSG.REQUIRES_OTP, contactMasked: contact.slice(0, 3) + "***" });
|
|
2781
|
-
document.getElementById("otp-box").style.display = "block";
|
|
2782
|
-
reportHeight();
|
|
2783
|
-
};
|
|
2784
|
-
document.getElementById("verify-otp").onclick = function () {
|
|
2785
|
-
var code = document.getElementById("otp").value.trim();
|
|
2786
|
-
if (code !== DEMO_OTP) { document.getElementById("err").textContent = "Invalid code"; return; }
|
|
2787
|
-
fetch("/api/v1/auth/verify-otp", {
|
|
2788
|
-
method: "POST",
|
|
2789
|
-
headers: { "content-type": "application/json" },
|
|
2790
|
-
body: JSON.stringify({ contact: state.contact, code: code })
|
|
2791
|
-
}).then(function (r) { return r.json(); }).then(function (body) {
|
|
2792
|
-
var session = body.session || {};
|
|
2793
|
-
state.token = session.token || body.token;
|
|
2794
|
-
state.customer = {
|
|
2795
|
-
name: session.customer_name || "Customer",
|
|
2796
|
-
email: session.customer_email || (state.contact && state.contact.indexOf("@") >= 0 ? state.contact : null),
|
|
2797
|
-
phone: session.customer_phone || (state.contact && state.contact.indexOf("@") < 0 ? state.contact : null)
|
|
2798
|
-
};
|
|
2799
|
-
send({
|
|
2800
|
-
type: MSG.AUTHENTICATED,
|
|
2801
|
-
accountId: "acct_mock_" + (session.id || "x"),
|
|
2802
|
-
customerId: session.customer_id || "cust_mock",
|
|
2803
|
-
token: state.token,
|
|
2804
|
-
customer: state.customer
|
|
2805
|
-
});
|
|
2806
|
-
}).catch(function (e) {
|
|
2807
|
-
send({ type: MSG.ERROR, code: "AUTH_FAILED", message: String(e) });
|
|
2808
|
-
});
|
|
2771
|
+
document.getElementById("start-auth").onclick = function () {
|
|
2772
|
+
send({ type: MSG.AUTH_REQUESTED });
|
|
2809
2773
|
};
|
|
2810
2774
|
if (AUTO) {
|
|
2811
|
-
setTimeout(function () { document.getElementById("
|
|
2812
|
-
setTimeout(function () { document.getElementById("verify-otp").click(); }, 150);
|
|
2775
|
+
setTimeout(function () { document.getElementById("start-auth").click(); }, 50);
|
|
2813
2776
|
}
|
|
2814
2777
|
}
|
|
2815
2778
|
|
|
@@ -2986,7 +2949,6 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2986
2949
|
break;
|
|
2987
2950
|
case MSG.SET_TOKEN:
|
|
2988
2951
|
state.token = msg.token;
|
|
2989
|
-
send({ type: MSG.TOKEN_REFRESHED, token: state.token });
|
|
2990
2952
|
break;
|
|
2991
2953
|
case MSG.SET_CART:
|
|
2992
2954
|
state.cart = msg.cart;
|
|
@@ -2998,7 +2960,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2998
2960
|
send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight });
|
|
2999
2961
|
break;
|
|
3000
2962
|
case MSG.REFRESH_TOKEN:
|
|
3001
|
-
|
|
2963
|
+
reportHeight();
|
|
3002
2964
|
break;
|
|
3003
2965
|
case MSG.LOGOUT:
|
|
3004
2966
|
state.token = null;
|
package/dist/mock/msw.mjs
CHANGED
|
@@ -2714,10 +2714,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2714
2714
|
REFRESH_TOKEN: "refresh_token", LOGOUT: "logout",
|
|
2715
2715
|
PROCESS_CHECKOUT: "process_checkout", ABORT_CHECKOUT: "abort_checkout",
|
|
2716
2716
|
READY: "ready", HEIGHT_CHANGE: "height_change",
|
|
2717
|
-
|
|
2717
|
+
AUTH_REQUESTED: "auth_requested", ERROR: "error",
|
|
2718
2718
|
ADDRESS_CHANGED: "address_changed", ADDRESS_SELECTED: "address_selected",
|
|
2719
2719
|
PAYMENT_METHOD_SELECTED: "payment_method_selected",
|
|
2720
|
-
|
|
2720
|
+
LOGOUT_COMPLETE: "logout_complete",
|
|
2721
2721
|
CONTACT_PROVIDED: "contact_provided",
|
|
2722
2722
|
CHECKOUT_STATUS: "checkout_status", CHECKOUT_COMPLETE: "checkout_complete",
|
|
2723
2723
|
ORDER_TYPE_CHANGED: "order_type_changed", REQUEST_SUBMIT: "request_submit"
|
|
@@ -2726,6 +2726,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2726
2726
|
var AUTO = qs.get("auto") === "true";
|
|
2727
2727
|
var DEMO_OTP = qs.get("otp") || "123456";
|
|
2728
2728
|
var ORIGIN = qs.get("origin") || "*";
|
|
2729
|
+
var NONCE = qs.get("nonce");
|
|
2729
2730
|
var state = {
|
|
2730
2731
|
businessId: DEFAULT_BUSINESS,
|
|
2731
2732
|
token: null,
|
|
@@ -2740,7 +2741,10 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2740
2741
|
var content = document.getElementById("content");
|
|
2741
2742
|
var title = document.getElementById("title");
|
|
2742
2743
|
|
|
2743
|
-
function send(msg) {
|
|
2744
|
+
function send(msg) {
|
|
2745
|
+
if (NONCE) msg.nonce = NONCE;
|
|
2746
|
+
parent.postMessage(msg, ORIGIN);
|
|
2747
|
+
}
|
|
2744
2748
|
function reportHeight() { send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight }); }
|
|
2745
2749
|
function ready() { send({ type: MSG.READY, height: document.documentElement.scrollHeight }); }
|
|
2746
2750
|
|
|
@@ -2760,54 +2764,13 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2760
2764
|
function renderAuth() {
|
|
2761
2765
|
title.textContent = "Sign in";
|
|
2762
2766
|
content.innerHTML =
|
|
2763
|
-
'<
|
|
2764
|
-
'<input id="contact" placeholder="you@example.com or +233..." value="' + (qs.get("contact") || "") + '">' +
|
|
2765
|
-
'<button id="send-otp">Send code</button>' +
|
|
2766
|
-
'<div id="otp-box" style="display:none">' +
|
|
2767
|
-
' <label>Verification code (mock: ' + DEMO_OTP + ')</label>' +
|
|
2768
|
-
' <input id="otp" maxlength="6" value="' + DEMO_OTP + '">' +
|
|
2769
|
-
' <button id="verify-otp">Verify</button>' +
|
|
2770
|
-
'</div>' +
|
|
2767
|
+
'<button id="start-auth">Continue with Cimplify</button>' +
|
|
2771
2768
|
'<div class="err" id="err"></div>';
|
|
2772
|
-
document.getElementById("
|
|
2773
|
-
|
|
2774
|
-
if (!contact) { document.getElementById("err").textContent = "Enter contact"; return; }
|
|
2775
|
-
state.contact = contact;
|
|
2776
|
-
var contactType = contact.indexOf("@") >= 0 ? "email" : "phone";
|
|
2777
|
-
send({ type: MSG.CONTACT_PROVIDED, contact: contact, contactType: contactType });
|
|
2778
|
-
send({ type: MSG.REQUIRES_OTP, contactMasked: contact.slice(0, 3) + "***" });
|
|
2779
|
-
document.getElementById("otp-box").style.display = "block";
|
|
2780
|
-
reportHeight();
|
|
2781
|
-
};
|
|
2782
|
-
document.getElementById("verify-otp").onclick = function () {
|
|
2783
|
-
var code = document.getElementById("otp").value.trim();
|
|
2784
|
-
if (code !== DEMO_OTP) { document.getElementById("err").textContent = "Invalid code"; return; }
|
|
2785
|
-
fetch("/api/v1/auth/verify-otp", {
|
|
2786
|
-
method: "POST",
|
|
2787
|
-
headers: { "content-type": "application/json" },
|
|
2788
|
-
body: JSON.stringify({ contact: state.contact, code: code })
|
|
2789
|
-
}).then(function (r) { return r.json(); }).then(function (body) {
|
|
2790
|
-
var session = body.session || {};
|
|
2791
|
-
state.token = session.token || body.token;
|
|
2792
|
-
state.customer = {
|
|
2793
|
-
name: session.customer_name || "Customer",
|
|
2794
|
-
email: session.customer_email || (state.contact && state.contact.indexOf("@") >= 0 ? state.contact : null),
|
|
2795
|
-
phone: session.customer_phone || (state.contact && state.contact.indexOf("@") < 0 ? state.contact : null)
|
|
2796
|
-
};
|
|
2797
|
-
send({
|
|
2798
|
-
type: MSG.AUTHENTICATED,
|
|
2799
|
-
accountId: "acct_mock_" + (session.id || "x"),
|
|
2800
|
-
customerId: session.customer_id || "cust_mock",
|
|
2801
|
-
token: state.token,
|
|
2802
|
-
customer: state.customer
|
|
2803
|
-
});
|
|
2804
|
-
}).catch(function (e) {
|
|
2805
|
-
send({ type: MSG.ERROR, code: "AUTH_FAILED", message: String(e) });
|
|
2806
|
-
});
|
|
2769
|
+
document.getElementById("start-auth").onclick = function () {
|
|
2770
|
+
send({ type: MSG.AUTH_REQUESTED });
|
|
2807
2771
|
};
|
|
2808
2772
|
if (AUTO) {
|
|
2809
|
-
setTimeout(function () { document.getElementById("
|
|
2810
|
-
setTimeout(function () { document.getElementById("verify-otp").click(); }, 150);
|
|
2773
|
+
setTimeout(function () { document.getElementById("start-auth").click(); }, 50);
|
|
2811
2774
|
}
|
|
2812
2775
|
}
|
|
2813
2776
|
|
|
@@ -2984,7 +2947,6 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2984
2947
|
break;
|
|
2985
2948
|
case MSG.SET_TOKEN:
|
|
2986
2949
|
state.token = msg.token;
|
|
2987
|
-
send({ type: MSG.TOKEN_REFRESHED, token: state.token });
|
|
2988
2950
|
break;
|
|
2989
2951
|
case MSG.SET_CART:
|
|
2990
2952
|
state.cart = msg.cart;
|
|
@@ -2996,7 +2958,7 @@ var ELEMENT_HANDLER_JS = `/* eslint-disable */
|
|
|
2996
2958
|
send({ type: MSG.HEIGHT_CHANGE, height: document.documentElement.scrollHeight });
|
|
2997
2959
|
break;
|
|
2998
2960
|
case MSG.REFRESH_TOKEN:
|
|
2999
|
-
|
|
2961
|
+
reportHeight();
|
|
3000
2962
|
break;
|
|
3001
2963
|
case MSG.LOGOUT:
|
|
3002
2964
|
state.token = null;
|
package/dist/react.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-
|
|
3
|
-
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-
|
|
4
|
-
import { ac as CimplifyClient,
|
|
2
|
+
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-RFuWZOgF.mjs';
|
|
3
|
+
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-RFuWZOgF.mjs';
|
|
4
|
+
import { ac as CimplifyClient, c1 as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, w as Business, be as Location, ci as ReorderResult, bL as OrderStatus, bu as Order, c3 as QuoteBundleSelectionInput, c4 as QuoteCompositeSelectionInput, bZ as PriceQuote, c7 as QuoteUiMessage, cD as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, cM as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, aY as FxRateResponse, cV as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aM as ElementsOptions, bT as PaymentMethodInfo, aK as ElementsCheckoutResult, c0 as ProcessCheckoutOptions, af as CimplifyElements, b5 as LineItem, cP as Staff, cy as Room } from './client-ByI_3jfL.mjs';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-B_kS4Oxa.mjs';
|
|
7
7
|
import { P as ProductWithPrice } from './price-Cm0tU0V5.mjs';
|
|
@@ -1278,11 +1278,8 @@ interface BaseElementProps {
|
|
|
1278
1278
|
interface AuthElementProps extends BaseElementProps {
|
|
1279
1279
|
prefillEmail?: string;
|
|
1280
1280
|
onAuthenticated?: (data: AuthenticatedData) => void;
|
|
1281
|
-
onRequiresOtp?: (data: {
|
|
1282
|
-
contactMasked: string;
|
|
1283
|
-
}) => void;
|
|
1284
1281
|
}
|
|
1285
|
-
declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated,
|
|
1282
|
+
declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated, onError, }: AuthElementProps): React$1.ReactElement | null;
|
|
1286
1283
|
interface AddressElementProps extends BaseElementProps {
|
|
1287
1284
|
mode?: "shipping" | "billing";
|
|
1288
1285
|
onChange?: (data: {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-
|
|
3
|
-
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-
|
|
4
|
-
import { ac as CimplifyClient,
|
|
2
|
+
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-RFuWZOgF.js';
|
|
3
|
+
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-RFuWZOgF.js';
|
|
4
|
+
import { ac as CimplifyClient, c1 as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, w as Business, be as Location, ci as ReorderResult, bL as OrderStatus, bu as Order, c3 as QuoteBundleSelectionInput, c4 as QuoteCompositeSelectionInput, bZ as PriceQuote, c7 as QuoteUiMessage, cD as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, cM as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, aY as FxRateResponse, cV as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aM as ElementsOptions, bT as PaymentMethodInfo, aK as ElementsCheckoutResult, c0 as ProcessCheckoutOptions, af as CimplifyElements, b5 as LineItem, cP as Staff, cy as Room } from './client-DVFQoDtI.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-B_kS4Oxa.js';
|
|
7
7
|
import { P as ProductWithPrice } from './price-9T1Y47oS.js';
|
|
@@ -1278,11 +1278,8 @@ interface BaseElementProps {
|
|
|
1278
1278
|
interface AuthElementProps extends BaseElementProps {
|
|
1279
1279
|
prefillEmail?: string;
|
|
1280
1280
|
onAuthenticated?: (data: AuthenticatedData) => void;
|
|
1281
|
-
onRequiresOtp?: (data: {
|
|
1282
|
-
contactMasked: string;
|
|
1283
|
-
}) => void;
|
|
1284
1281
|
}
|
|
1285
|
-
declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated,
|
|
1282
|
+
declare function AuthElement({ className, style, prefillEmail, onReady, onAuthenticated, onError, }: AuthElementProps): React$1.ReactElement | null;
|
|
1286
1283
|
interface AddressElementProps extends BaseElementProps {
|
|
1287
1284
|
mode?: "shipping" | "billing";
|
|
1288
1285
|
onChange?: (data: {
|