Socket
Socket
Sign inDemoInstall

admin-iframe-compatibility

Package Overview
Dependencies
0
Maintainers
56
Versions
117
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.97 to 1.0.98-beta

42

index.js

@@ -233,2 +233,30 @@ (function () {

function fixBreadcrumbLinksToUseHTTPS() {
$('#breadCrumbNav a').each(function() {
const breadcrumbLink = $(this);
const breadcrumbUrl = breadcrumbLink.attr("href") || '';
if (!breadcrumbUrl.startsWith("https://")) {
breadcrumbLink.attr('href', breadcrumbUrl.replace('http://', 'https://'));
}
});
}
function tryToRedirectUserFromLegacyPageToAdmin() {
const pathMaps = JSON.parse(window.localStorage.getItem('__paths_to_redirect') || '{}');
Object.entries(pathMaps).forEach(function ([legacyPage, adminPage]) {
const pathName = window.location.pathname.toLowerCase();
if (adminPage && pathName.endsWith(legacyPage.toLowerCase())) {
window.parent.postMessage(
{
type: "admin.innerNavigation",
destination: adminPage,
},
"*"
);
}
});
}
function handleTopbarLoaded() {

@@ -239,5 +267,11 @@ vtex.topbar.topbar = new vtex.topbar.Topbar();

function handleIframePostMessage(e) {
if (e.data && e.data.action && e.data.action.type === "LOCALE_SELECTED") {
if (!(e.data && e.data.action)) return;
if (e.data.action.type === "LOCALE_SELECTED") {
handleLocaleSelected(e, e.data.action.payload);
}
if (e.data.action.type === "PATHS_TO_REDIRECT") {
window.localStorage.setItem('__paths_to_redirect', e.data.action.payload);
}
}

@@ -285,2 +319,6 @@

// If the current page should redirect the user to an admin page,
// we trigger an admin.ioAppNavigation that should be handled by the iframe that's rendering this page.
tryToRedirectUserFromLegacyPageToAdmin();
$(function ($) {

@@ -356,2 +394,4 @@ /*****************************

// $('#breadCrumbNav').hide()
// Fixes some breadcrumbs URL that aren't using HTTPS
fixBreadcrumbLinksToUseHTTPS();
if (!window.location.href.includes("Site/RelatorioIndexacao.aspx")) {

@@ -358,0 +398,0 @@ $("#content h2").hide();

4

package.json
{
"name": "admin-iframe-compatibility",
"version": "1.0.97",
"version": "1.0.98-beta",
"description": "Compatiblity js to adapt catalog admin to iframe",

@@ -11,3 +11,3 @@ "main": "build/index.js",

"build": "npm run build:index && npm run build:cms",
"postbuild": "cp package.json README.md build",
"postbuild": "cp package.json docs/README.md build",
"start": "npm run build && node server.js",

@@ -14,0 +14,0 @@ "deploy": "releasy --stable",

@@ -1,3 +0,13 @@

# There is nothing glamorous to see here
[![Internal Docs](https://shields.io/badge/-Internal_Docs-f41963)](https://internal-docs.vtex.com/Admin/admin-iframe-compatibility/)
<p align="center">
<img alt="VTEX Admin" src="./assets/vtex-logo.svg" height="100" width="117" />
<h3 align="center">VTEX Admin Iframe Compatibility</h3>
<p align="center">Reach us on #team-admin channel on Slack | Tag us with @dev-team-admin on Slack</p>
</p>
---
## There is nothing glamorous to see here
This package is just a static JS with jquery code that runs on catalog admin pages. It is responsible for handling translations for legacy applications, messaging the admin shell to adapt its iframe container height to match its children height, and initializing Crowdin in Context script for legacy apps.

@@ -18,6 +28,6 @@

```
Request URL Contains //unpkg.com/admin-iframe-compatibility/index.js
Request URL Contains /npm/admin-iframe-compatibility/index.js
Destination http://localhost:4200/index.js
Request URL Contains //unpkg.com/admin-iframe-compatibility/cms-iframe.js
Request URL Contains /npm/admin-iframe-compatibility/cms-iframe.js
Destination http://localhost:4200/cms-iframe.js

@@ -24,0 +34,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc