Skip to content

Commit

Permalink
Remove support for Internet Explorer (#1139)
Browse files Browse the repository at this point in the history
* Remove IE10 and 11 from babel targets

* Include mjs, jsx, and cjs files in linting and formatting

* Remove utils/assign.js

* Remove utils/find.js

* Remove utils/includes.js

* Replace isNaN() with Number.isNaN()

* Rewrite padStart to use native function

* Remove utils/values.js

* Remove @adobe/reactor-object-assign from saucelabs configs

* Remove CSS.escape polyfill

* Use destructuring in createInstanceFunction

* Add error message that reports that IE is not supported

* Remove scope polyfill in querySelectorAll

* Remove sendBeacon polyfills in tests

* Remove startsWith and endsWith utils

* Swap reference to deprecated HTMLDocument with Document

* Remove dependency on @adobe/reactor-load-script

* Remove script intro with IE warning

* Remove promise polyfills

* Remove unused dependency on url-parse

* Remove @adobe/reactor-load-script and @adobe/reactor-promise from sauce configs

* Remove utils/flatMap.js

* Add back parse-uri

* Remove assignIf

* Remove padStart

* Remove XHR fallback requests

* Revert "Remove XHR fallback requests"

This reverts commit dc5827c.

* Remove promise polyfill from sandbox

* Revert "Revert "Remove XHR fallback requests""

This reverts commit b1da21a.

* Rectify package.json
  • Loading branch information
carterworks authored Jul 31, 2024
1 parent 934d193 commit 1b3806b
Show file tree
Hide file tree
Showing 85 changed files with 182 additions and 1,120 deletions.
4 changes: 0 additions & 4 deletions .sauce/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ npm:
- js-cookie
- read-cache
- uuid
- css.escape
- "@adobe/reactor-object-assign"
- "@adobe/reactor-load-script"
- "@adobe/reactor-cookie"
- "@adobe/reactor-query-string"
- "@adobe/reactor-promise"
suites:
- name: "Edge"
browserName: "microsoftedge"
Expand Down
4 changes: 0 additions & 4 deletions .sauce/ee-prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ npm:
- js-cookie
- read-cache
- uuid
- css.escape
- "@adobe/reactor-object-assign"
- "@adobe/reactor-load-script"
- "@adobe/reactor-cookie"
- "@adobe/reactor-query-string"
- "@adobe/reactor-promise"
suites:
- name: "Edge"
browserName: "microsoftedge"
Expand Down
4 changes: 0 additions & 4 deletions .sauce/pre-edge-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ npm:
- js-cookie
- read-cache
- uuid
- css.escape
- "@adobe/reactor-object-assign"
- "@adobe/reactor-load-script"
- "@adobe/reactor-cookie"
- "@adobe/reactor-query-string"
- "@adobe/reactor-promise"
suites:
- name: "Edge"
browserName: "microsoftedge"
Expand Down
4 changes: 0 additions & 4 deletions .sauce/pre-prod-upstreams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ npm:
- js-cookie
- read-cache
- uuid
- css.escape
- "@adobe/reactor-object-assign"
- "@adobe/reactor-load-script"
- "@adobe/reactor-cookie"
- "@adobe/reactor-query-string"
- "@adobe/reactor-promise"
suites:
- name: "Edge"
browserName: "microsoftedge"
Expand Down
4 changes: 0 additions & 4 deletions .sauce/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ npm:
- js-cookie
- read-cache
- uuid
- css.escape
- "@adobe/reactor-object-assign"
- "@adobe/reactor-load-script"
- "@adobe/reactor-cookie"
- "@adobe/reactor-query-string"
- "@adobe/reactor-promise"
suites:
- name: "Chrome"
browserName: "chrome"
Expand Down
1 change: 0 additions & 1 deletion babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const targets = {
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"Explorer >= 10",
],
};

Expand Down
1 change: 0 additions & 1 deletion babel.test.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const targets = {
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 Edge versions",
"Explorer >= 10",
],
};

Expand Down
2 changes: 1 addition & 1 deletion coverageignore.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ module.exports = [
"**/constants/**",
"**/index.js",
"baseCode.js",
"standalone.js"
"standalone.js",
];
1 change: 0 additions & 1 deletion karma.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module.exports = (config) => {

// list of files / patterns to load in the browser
files: [
"node_modules/promise-polyfill/dist/polyfill.js",
{
pattern: "test/unit/specs/karmaEntry.spec.cjs",
watched: false, // The preprocessor will use its own watcher
Expand Down
5 changes: 1 addition & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"scripts": {
"clean": "rimraf dist distTest libEs5 libEs6",
"lint": "eslint --cache --fix \"*.js\" \"{src,test,scripts}/**/*.js\"",
"format": "prettier --write \"*.{html,js}\" \"{sandbox,src,test,scripts}/**/*.{html,js}\"",
"lint": "eslint --cache --fix \"*.{js,cjs,mjs,jsx}\" \"{src,test,scripts}/**/*.{js,cjs,mjs,jsx}\"",
"format": "prettier --write \"*.{html,js,cjs,mjs,jsx}\" \"{sandbox,src,test,scripts}/**/*.{html,js,cjs,mjs,jsx}\"",
"test": "npm run test:unit && npm run test:scripts && npm run test:functional",
"test:unit": "karma start karma.conf.cjs --single-run",
"test:unit:debug": "karma start --browsers=Chrome --single-run=false --debug",
Expand All @@ -48,16 +48,16 @@
"preinstall": "npx force-resolutions"
},
"lint-staged": {
"./*.js": [
"./*.{cjs,mjs,js,jsx}": [
"eslint --cache --fix"
],
"./{src,test,scripts}/**/*.js": [
"./{src,test,scripts}/**/*.{cjs,mjs,js,jsx}": [
"eslint --cache --fix"
],
"./*.{html,js}": [
"./*.{html,js,cjs,mjs,jsx}": [
"prettier --write"
],
"./{sandbox,src,test,scripts}/**/*.{html,js}": [
"./{sandbox,src,test,scripts}/**/*.{html,js,cjs,mjs,jsx}": [
"prettier --write"
]
},
Expand Down
5 changes: 0 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export const buildConfig = ({
{
file: file || `${destDirectory}alloy${minifiedExtension}.js`,
format: "iife",
intro:
"if (document.documentMode && document.documentMode < 11) {\n" +
" console.warn('The Adobe Experience Cloud Web SDK does not support IE 10 and below.');\n" +
" return;\n" +
"}\n",
sourcemap: variant === SANDBOX,
},
],
Expand Down
5 changes: 0 additions & 5 deletions rollup.test.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ module.exports = {
name: "alloy",
sourcemap: "inline",
format: "iife",
// Allow non-IE browsers and IE11
// document.documentMode was added in IE8, and is specific to IE.
// IE7 and lower are not ES5 compatible so will get a parse error loading the library.
intro:
"if (document.documentMode && document.documentMode < 11) { console.warn('The Adobe Experience Cloud Web SDK does not support IE 10 and below.'); return; }",
},
plugins,
};
1 change: 0 additions & 1 deletion sandbox/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>

<title>Mock website hosting Alloy</title>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>

<title>Mock website hosting Alloy using launch</title>

Expand Down
1 change: 0 additions & 1 deletion sandbox/public/media-collection/streaming-media.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>

<title>Mock website hosting Alloy</title>

Expand Down
72 changes: 36 additions & 36 deletions sandbox/src/ConfigOverrides.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,83 @@ const defaultOverrides = {
com_adobe_experience_platform: {
datasets: {
event: {
datasetId: ""
datasetId: "",
},
profile: {
datasetId: ""
}
}
datasetId: "",
},
},
},
com_adobe_analytics: {
reportSuites: []
reportSuites: [],
},
com_adobe_identity: {
idSyncContainerId: ""
idSyncContainerId: "",
},
com_adobe_target: {
propertyToken: ""
}
propertyToken: "",
},
};

const sendEvent = edgeConfigOverrides => {
const sendEvent = (edgeConfigOverrides) => {
return window.alloy("sendEvent", {
renderDecisions: true,
edgeConfigOverrides: {
...edgeConfigOverrides
}
...edgeConfigOverrides,
},
});
};
const setConsent = edgeConfigOverrides => {
const setConsent = (edgeConfigOverrides) => {
return window.alloy("setConsent", {
consent: [
{
standard: "Adobe",
version: "2.0",
value: {
collect: {
val: "in"
}
}
}
val: "in",
},
},
},
],
edgeConfigOverrides: {
...edgeConfigOverrides
}
...edgeConfigOverrides,
},
});
};
const getIdentity = edgeConfigOverrides => {
const getIdentity = (edgeConfigOverrides) => {
return window.alloy("getIdentity", {
namespaces: ["ECID"],
edgeConfigOverrides: {
...edgeConfigOverrides
}
...edgeConfigOverrides,
},
});
};

const appendIdentityToUrl = edgeConfigOverrides => {
const appendIdentityToUrl = (edgeConfigOverrides) => {
return window
.alloy("appendIdentityToUrl", {
url: "https://example.com",
edgeConfigOverrides: {
...edgeConfigOverrides
}
...edgeConfigOverrides,
},
})
.then(url => console.log("URL with appended identity: ", url));
.then((url) => console.log("URL with appended identity: ", url));
};

export default function ConfigOverrides() {
const [error, setError] = useState("");
const [overrides, setOverrides] = useState({ ...defaultOverrides });
const overridesString = JSON.stringify(overrides, null, 2);
const onTextareaChange = event => {
const onTextareaChange = (event) => {
try {
const newOverrides = JSON.parse(event.target.value);
setOverrides(newOverrides);
setError("");
} catch (err) {
console.error(err);
setError(
`The text you just entered is not valid JSON. Try again.\n${err}`
`The text you just entered is not valid JSON. Try again.\n${err}`,
);
}
};
Expand All @@ -96,16 +96,16 @@ export default function ConfigOverrides() {
analyticsReportSuites: [
...((overrides.com_adobe_analytics || {}).analyticsReportSuites ||
[]),
""
]
}
"",
],
},
});
};
const resetOverrides = () => {
setOverrides({ ...defaultOverrides });
};
const callWithOverrides = callback => () =>
callback(overrides).catch(err => {
const callWithOverrides = (callback) => () =>
callback(overrides).catch((err) => {
console.error(err);
setError(`The request failed.\n${err.toString()}`);
});
Expand All @@ -118,7 +118,7 @@ export default function ConfigOverrides() {
margin: "8px",
border: "1px solid red",
borderRadius: "8px",
padding: "8px"
padding: "8px",
}}
>
<span
Expand All @@ -144,13 +144,13 @@ export default function ConfigOverrides() {
flexDirection: "row",
justifyContent: "space-around",
flexWrap: "wrap-reverse",
maxWidth: "875px"
maxWidth: "875px",
}}
>
<textarea
style={{
fontFamily: "monospace",
boxSizing: "border-box"
boxSizing: "border-box",
}}
name="overrideEditor"
id="overrideEditor"
Expand All @@ -165,7 +165,7 @@ export default function ConfigOverrides() {
{JSON.stringify(
{ renderDecisions: true, edgeConfigOverrides: overrides },
null,
2
2,
)}
)
</code>
Expand Down
19 changes: 9 additions & 10 deletions src/components/Context/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import { flatMap } from "../../utils/index.js";

export default (config, logger, optionalContexts, requiredContexts) => {
const configuredContexts = config.context;

const contexts = flatMap(configuredContexts, (context, i) => {
if (optionalContexts[context]) {
return [optionalContexts[context]];
}
logger.warn(`Invalid context[${i}]: '${context}' is not available.`);
return [];
}).concat(requiredContexts);
const contexts = configuredContexts
.flatMap((context, i) => {
if (optionalContexts[context]) {
return [optionalContexts[context]];
}
logger.warn(`Invalid context[${i}]: '${context}' is not available.`);
return [];
})
.concat(requiredContexts);

return {
namespace: "Context",
Expand Down
Loading

0 comments on commit 1b3806b

Please sign in to comment.