@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.js
CHANGED
|
@@ -1614,19 +1614,24 @@ function assertConfig(config) {
|
|
|
1614
1614
|
async function enableRemoteDebug(options) {
|
|
1615
1615
|
if (options.enabled === false) return NOOP_HANDLE;
|
|
1616
1616
|
assertConfig(options.config);
|
|
1617
|
-
|
|
1617
|
+
const consentInput = options.consent ?? {};
|
|
1618
|
+
const hasExplicitConsent = consentInput.userOptIn === true || typeof consentInput.hostToken === "string" && consentInput.hostToken.length > 0;
|
|
1619
|
+
const promptDisabled = consentInput.promptUser === false;
|
|
1620
|
+
const canPrompt = typeof document !== "undefined" && typeof window !== "undefined";
|
|
1621
|
+
const shouldPrompt = !hasExplicitConsent && !promptDisabled && canPrompt;
|
|
1622
|
+
if (shouldPrompt) {
|
|
1618
1623
|
const cached = readConsentDecision(options.config.miniProgramId);
|
|
1619
1624
|
let decision = cached;
|
|
1620
1625
|
if (decision === null) {
|
|
1621
1626
|
decision = await promptForConsent(
|
|
1622
1627
|
options.config.miniProgramId,
|
|
1623
|
-
|
|
1628
|
+
consentInput.promptCopy
|
|
1624
1629
|
);
|
|
1625
1630
|
}
|
|
1626
1631
|
if (decision === "denied") return NOOP_HANDLE;
|
|
1627
1632
|
options = {
|
|
1628
1633
|
...options,
|
|
1629
|
-
consent: { ...
|
|
1634
|
+
consent: { ...consentInput, userOptIn: true }
|
|
1630
1635
|
};
|
|
1631
1636
|
}
|
|
1632
1637
|
assertConsent(options.config, options.consent);
|