-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.build entryFileNames index 3.add headless script name buyerPortal
- Loading branch information
1 parent
5c72e02
commit 589a5e5
Showing
2 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// const str = '<script> | ||
// window.b3CheckoutConfig = { | ||
// routes: { | ||
// dashboard: '/account.php?action=order_status' | ||
// } | ||
// } | ||
// window.B3 = { | ||
// setting: { | ||
// 'store_hash': `{{settings.store_hash}}`, | ||
// 'b2b_url': 'https://staging-v2.bundleb2b.net', | ||
// 'captcha_setkey': '6LdGN_sgAAAAAGYFg1lmVoakQ8QXxbhWqZ1GpYaJ', | ||
// }, | ||
// 'dom.checkoutRegisterParentElement': '#checkout-app', | ||
// 'dom.registerElement': '[href^="/login.php"], #checkout-customer-login', | ||
// 'dom.openB3Checkout': 'checkout-customer-continue', | ||
// 'before_login_goto_page': '/account.php?action=order_status', | ||
// 'checkout_super_clear_session': 'true', | ||
// 'dom.navUserLoginElement': '.navUser-item.navUser-item--account', | ||
|
||
// } | ||
// </script> | ||
|
||
// <script crossorigin src="https://cdn.bundleb2b.net/b2b/staging/storefront/polyfills-legacy.158d896b.js"></script> | ||
// <script crossorigin src="https://cdn.bundleb2b.net/b2b/staging/storefront/index-legacy.40470c56.js"></script> | ||
// ' | ||
|
||
function init() { | ||
const insertScript = (scriptString: string) => { | ||
// const scriptElement = document.createElement('script'); | ||
// scriptElement.innerHTML = scriptString; | ||
|
||
// const {body} = document; | ||
|
||
// body.appendChild(scriptElement); | ||
|
||
document.body.innerHTML += scriptString | ||
} | ||
async function getScriptContent(originurl: string) { | ||
console.log(originurl) | ||
const xxx = `<script>console.log('test123')</script> | ||
<script>console.log('test456')</script> | ||
` | ||
|
||
insertScript(xxx) | ||
// const queryParams = new URLSearchParams({ | ||
// url: originurl, | ||
// }); | ||
|
||
// const url = `https://api.example.com/data?${queryParams}`; | ||
// fetch(url).then(response => { | ||
// if (!response.ok) { | ||
// throw new Error('Network response was not ok'); | ||
// } | ||
// return response.json(); | ||
// }) | ||
// .then(data => { | ||
// console.log(data); | ||
|
||
// insertScript(data) | ||
// }) | ||
// .catch(error => { | ||
// console.error('There was a problem with the fetch operation:', error); | ||
// }); | ||
} | ||
|
||
async function analyzeScript() { | ||
try { | ||
const { origin } = window.location | ||
|
||
await getScriptContent(origin) | ||
} catch (error) { | ||
console.error('Interface error') | ||
} | ||
} | ||
|
||
analyzeScript() | ||
} | ||
|
||
init() | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters