@botim/mp-debug-sdk 0.7.0 → 0.7.1
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 +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +22 -8
- package/dist/types.d.ts +22 -8
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1616,19 +1616,24 @@ function assertConfig(config) {
|
|
|
1616
1616
|
async function enableRemoteDebug(options) {
|
|
1617
1617
|
if (options.enabled === false) return NOOP_HANDLE;
|
|
1618
1618
|
assertConfig(options.config);
|
|
1619
|
-
|
|
1619
|
+
const consentInput = options.consent ?? {};
|
|
1620
|
+
const hasExplicitConsent = consentInput.userOptIn === true || typeof consentInput.hostToken === "string" && consentInput.hostToken.length > 0;
|
|
1621
|
+
const promptDisabled = consentInput.promptUser === false;
|
|
1622
|
+
const canPrompt = typeof document !== "undefined" && typeof window !== "undefined";
|
|
1623
|
+
const shouldPrompt = !hasExplicitConsent && !promptDisabled && canPrompt;
|
|
1624
|
+
if (shouldPrompt) {
|
|
1620
1625
|
const cached = readConsentDecision(options.config.miniProgramId);
|
|
1621
1626
|
let decision = cached;
|
|
1622
1627
|
if (decision === null) {
|
|
1623
1628
|
decision = await promptForConsent(
|
|
1624
1629
|
options.config.miniProgramId,
|
|
1625
|
-
|
|
1630
|
+
consentInput.promptCopy
|
|
1626
1631
|
);
|
|
1627
1632
|
}
|
|
1628
1633
|
if (decision === "denied") return NOOP_HANDLE;
|
|
1629
1634
|
options = {
|
|
1630
1635
|
...options,
|
|
1631
|
-
consent: { ...
|
|
1636
|
+
consent: { ...consentInput, userOptIn: true }
|
|
1632
1637
|
};
|
|
1633
1638
|
}
|
|
1634
1639
|
assertConsent(options.config, options.consent);
|