mkfashion-sdk 2.3.3 → 2.3.4
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/mkfashion-sdk-2.3.4.tgz +0 -0
- package/package.json +1 -1
- package/src/mkfashion.js +23 -0
|
Binary file
|
package/package.json
CHANGED
package/src/mkfashion.js
CHANGED
|
@@ -661,4 +661,27 @@ const mkfashion = {
|
|
|
661
661
|
|
|
662
662
|
if (typeof window !== 'undefined') {
|
|
663
663
|
window.mkfashion = mkfashion
|
|
664
|
+
|
|
665
|
+
// Auto-init: abre automaticamente se a URL do site pai tiver startInit=true
|
|
666
|
+
const _mkAutoInit = () => {
|
|
667
|
+
const params = new URLSearchParams(window.location.search)
|
|
668
|
+
if (params.get('startInit') !== 'true') return
|
|
669
|
+
|
|
670
|
+
const projectId = params.get('projectId') || params.get('projectid')
|
|
671
|
+
const identifier = params.get('identifier') || params.get('sku')
|
|
672
|
+
|
|
673
|
+
if (!projectId || !identifier) {
|
|
674
|
+
console.error('[mKFashion] Auto-init requer projectId e identifier na URL')
|
|
675
|
+
return
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
mkfashion._log('Auto-init detectado', { projectId, identifier })
|
|
679
|
+
mkfashion.open({ projectId, identifier })
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (document.readyState === 'loading') {
|
|
683
|
+
document.addEventListener('DOMContentLoaded', _mkAutoInit)
|
|
684
|
+
} else {
|
|
685
|
+
_mkAutoInit()
|
|
686
|
+
}
|
|
664
687
|
}
|