@memberstack/dom 2.0.6 → 2.0.7
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/lib/index.js +3 -22
- package/lib/index.mjs +3 -22
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -577,13 +577,8 @@ var createRequestHandler = ({
|
|
|
577
577
|
token,
|
|
578
578
|
customEndpoint
|
|
579
579
|
}) => {
|
|
580
|
-
if (!publicKey) {
|
|
581
|
-
throw new Error(
|
|
582
|
-
"Memberstack: publicKey is required. Pass your public key to memberstack.init({ publicKey: 'pk_...' })"
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
580
|
const warnIfWrongKeyMode = (error) => {
|
|
586
|
-
if (error && typeof error === "object" && "code" in error && error.code === "generic-message" && "message" in error && typeof error.message === "string" && error.message.toLowerCase().includes("disabled") && !publicKey.includes("_sb_")) {
|
|
581
|
+
if (error && typeof error === "object" && "code" in error && error.code === "generic-message" && "message" in error && typeof error.message === "string" && error.message.toLowerCase().includes("disabled") && !(publicKey == null ? void 0 : publicKey.includes("_sb_"))) {
|
|
587
582
|
console.warn(
|
|
588
583
|
"[Memberstack] You're using a Live Mode key (pk_...). If your app hasn't been published yet, use the Test Mode key (pk_sb_...) from Dev Tools in your Memberstack dashboard."
|
|
589
584
|
);
|
|
@@ -606,9 +601,7 @@ var createRequestHandler = ({
|
|
|
606
601
|
method: data.method,
|
|
607
602
|
data: data.data,
|
|
608
603
|
url: formattedUrl,
|
|
609
|
-
headers: __spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues(
|
|
610
|
-
["X-API-Key" /* API_KEY */]: publicKey
|
|
611
|
-
}), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
604
|
+
headers: __spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
612
605
|
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0"
|
|
613
606
|
}), data.contentType && { "Content-Type": data.contentType }), sessionToken && {
|
|
614
607
|
["X-Session-ID" /* SESSION_ID */]: sessionToken
|
|
@@ -655,9 +648,7 @@ var createRequestHandler = ({
|
|
|
655
648
|
options == null ? void 0 : options.token
|
|
656
649
|
].find((x) => x);
|
|
657
650
|
const formattedUrl = `${customEndpoint || endpoints.API}${url}`;
|
|
658
|
-
const fetchHeaders = __spreadProps(__spreadValues(
|
|
659
|
-
["X-API-Key" /* API_KEY */]: publicKey
|
|
660
|
-
}), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
651
|
+
const fetchHeaders = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { Authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
661
652
|
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0",
|
|
662
653
|
"Content-Type": "application/json",
|
|
663
654
|
Referer: window.location.href
|
|
@@ -3055,16 +3046,6 @@ var methods = {
|
|
|
3055
3046
|
_captchaReady: captchaReadyPromise
|
|
3056
3047
|
};
|
|
3057
3048
|
function init(props) {
|
|
3058
|
-
if (!props.publicKey) {
|
|
3059
|
-
throw new Error(
|
|
3060
|
-
"Memberstack: publicKey is required. Pass your public key to init({ publicKey: 'pk_...' }). Find your key at https://app.memberstack.com/apps"
|
|
3061
|
-
);
|
|
3062
|
-
}
|
|
3063
|
-
if (!props.publicKey.startsWith("pk_")) {
|
|
3064
|
-
throw new Error(
|
|
3065
|
-
`Memberstack: Invalid publicKey format. Keys should start with "pk_sb_" (sandbox) or "pk_" (live). Received: "${props.publicKey.slice(0, 12)}...". Find your key at https://app.memberstack.com/apps`
|
|
3066
|
-
);
|
|
3067
|
-
}
|
|
3068
3049
|
if (props.debug) {
|
|
3069
3050
|
setDebugMode(true);
|
|
3070
3051
|
debugLog(`Initializing Memberstack SDK v${SDK_VERSION}`);
|
package/lib/index.mjs
CHANGED
|
@@ -534,13 +534,8 @@ var createRequestHandler = ({
|
|
|
534
534
|
token,
|
|
535
535
|
customEndpoint
|
|
536
536
|
}) => {
|
|
537
|
-
if (!publicKey) {
|
|
538
|
-
throw new Error(
|
|
539
|
-
"Memberstack: publicKey is required. Pass your public key to memberstack.init({ publicKey: 'pk_...' })"
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
537
|
const warnIfWrongKeyMode = (error) => {
|
|
543
|
-
if (error && typeof error === "object" && "code" in error && error.code === "generic-message" && "message" in error && typeof error.message === "string" && error.message.toLowerCase().includes("disabled") && !publicKey.includes("_sb_")) {
|
|
538
|
+
if (error && typeof error === "object" && "code" in error && error.code === "generic-message" && "message" in error && typeof error.message === "string" && error.message.toLowerCase().includes("disabled") && !(publicKey == null ? void 0 : publicKey.includes("_sb_"))) {
|
|
544
539
|
console.warn(
|
|
545
540
|
"[Memberstack] You're using a Live Mode key (pk_...). If your app hasn't been published yet, use the Test Mode key (pk_sb_...) from Dev Tools in your Memberstack dashboard."
|
|
546
541
|
);
|
|
@@ -563,9 +558,7 @@ var createRequestHandler = ({
|
|
|
563
558
|
method: data.method,
|
|
564
559
|
data: data.data,
|
|
565
560
|
url: formattedUrl,
|
|
566
|
-
headers: __spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues(
|
|
567
|
-
["X-API-Key" /* API_KEY */]: publicKey
|
|
568
|
-
}), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
561
|
+
headers: __spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
569
562
|
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0"
|
|
570
563
|
}), data.contentType && { "Content-Type": data.contentType }), sessionToken && {
|
|
571
564
|
["X-Session-ID" /* SESSION_ID */]: sessionToken
|
|
@@ -612,9 +605,7 @@ var createRequestHandler = ({
|
|
|
612
605
|
options == null ? void 0 : options.token
|
|
613
606
|
].find((x) => x);
|
|
614
607
|
const formattedUrl = `${customEndpoint || endpoints.API}${url}`;
|
|
615
|
-
const fetchHeaders = __spreadProps(__spreadValues(
|
|
616
|
-
["X-API-Key" /* API_KEY */]: publicKey
|
|
617
|
-
}), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
608
|
+
const fetchHeaders = __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, authHeader && { Authorization: `Bearer ${authHeader}` }), publicKey && { ["X-API-Key" /* API_KEY */]: publicKey }), appId && { ["X-APP-ID" /* APP_ID */]: appId }), {
|
|
618
609
|
["X-User-Agent" /* USER_AGENT */]: "@memberstack/client@1.2.0",
|
|
619
610
|
"Content-Type": "application/json",
|
|
620
611
|
Referer: window.location.href
|
|
@@ -3012,16 +3003,6 @@ var methods = {
|
|
|
3012
3003
|
_captchaReady: captchaReadyPromise
|
|
3013
3004
|
};
|
|
3014
3005
|
function init(props) {
|
|
3015
|
-
if (!props.publicKey) {
|
|
3016
|
-
throw new Error(
|
|
3017
|
-
"Memberstack: publicKey is required. Pass your public key to init({ publicKey: 'pk_...' }). Find your key at https://app.memberstack.com/apps"
|
|
3018
|
-
);
|
|
3019
|
-
}
|
|
3020
|
-
if (!props.publicKey.startsWith("pk_")) {
|
|
3021
|
-
throw new Error(
|
|
3022
|
-
`Memberstack: Invalid publicKey format. Keys should start with "pk_sb_" (sandbox) or "pk_" (live). Received: "${props.publicKey.slice(0, 12)}...". Find your key at https://app.memberstack.com/apps`
|
|
3023
|
-
);
|
|
3024
|
-
}
|
|
3025
3006
|
if (props.debug) {
|
|
3026
3007
|
setDebugMode(true);
|
|
3027
3008
|
debugLog(`Initializing Memberstack SDK v${SDK_VERSION}`);
|