From 8614ea65f7eed3f8a222a97201843d7d7f03a11b Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 19 Apr 2023 19:28:32 -0500 Subject: [PATCH 1/9] fix Promise is undefined issue with ie11 polyfill --- .changeset/khaki-spoons-laugh.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/khaki-spoons-laugh.md diff --git a/.changeset/khaki-spoons-laugh.md b/.changeset/khaki-spoons-laugh.md new file mode 100644 index 000000000..d6cbb8d99 --- /dev/null +++ b/.changeset/khaki-spoons-laugh.md @@ -0,0 +1,5 @@ +--- +'@segment/analytics-next': patch +--- + +Fix 'Promise is undefined' issue with ie11 polyfill From 26efac584f5196172a8b7a624d7252936c994ace Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 19 Apr 2023 22:52:47 -0500 Subject: [PATCH 2/9] add opera mini check --- packages/browser/src/lib/browser-polyfill.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/browser/src/lib/browser-polyfill.ts b/packages/browser/src/lib/browser-polyfill.ts index 2a46284db..5fd8e0e57 100644 --- a/packages/browser/src/lib/browser-polyfill.ts +++ b/packages/browser/src/lib/browser-polyfill.ts @@ -4,6 +4,8 @@ export function shouldPolyfill(): boolean { Edge: 13, } + const isOperaMiniExtremeMode = (window as any).operamini // compression proxy - allows for page() calls. + // Unfortunately IE doesn't follow the same pattern as other browsers, so we // need to check `isIE11` differently. // @ts-expect-error @@ -14,10 +16,8 @@ export function shouldPolyfill(): boolean { return ( isIE11 || + isOperaMiniExtremeMode || (browserVersionCompatList[browser] !== undefined && browserVersionCompatList[browser] >= parseInt(version)) ) } - -// appName = Netscape IE / Edge -// edge 13 Edge/13... same as FF From 552283c4ea04b120aa7e586ff259b532d65c4bba Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Wed, 19 Apr 2023 23:35:57 -0500 Subject: [PATCH 3/9] wip --- packages/browser/src/browser/standalone.ts | 4 ++-- packages/browser/src/lib/browser-polyfill.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/browser/standalone.ts b/packages/browser/src/browser/standalone.ts index c4f4fd4a2..c80ece30c 100644 --- a/packages/browser/src/browser/standalone.ts +++ b/packages/browser/src/browser/standalone.ts @@ -75,8 +75,8 @@ if (shouldPolyfill()) { // load polyfills in order to get AJS to work with old browsers const script = document.createElement('script') script.setAttribute( - 'src', - 'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.7.0/polyfill.min.js' + 'src', // this should map to tsconfig lib. + 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020' ) if (document.readyState === 'loading') { diff --git a/packages/browser/src/lib/browser-polyfill.ts b/packages/browser/src/lib/browser-polyfill.ts index 5fd8e0e57..f760d6ab9 100644 --- a/packages/browser/src/lib/browser-polyfill.ts +++ b/packages/browser/src/lib/browser-polyfill.ts @@ -2,6 +2,7 @@ export function shouldPolyfill(): boolean { const browserVersionCompatList: { [browser: string]: number } = { Firefox: 46, Edge: 13, + Opera: 50, } const isOperaMiniExtremeMode = (window as any).operamini // compression proxy - allows for page() calls. From fac6da57ee1c25357ebdede0bf9aca42bd4521d7 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:04:59 -0500 Subject: [PATCH 4/9] Update standalone.ts --- packages/browser/src/browser/standalone.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/browser/standalone.ts b/packages/browser/src/browser/standalone.ts index c80ece30c..7e838f81a 100644 --- a/packages/browser/src/browser/standalone.ts +++ b/packages/browser/src/browser/standalone.ts @@ -75,8 +75,8 @@ if (shouldPolyfill()) { // load polyfills in order to get AJS to work with old browsers const script = document.createElement('script') script.setAttribute( - 'src', // this should map to tsconfig lib. - 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020' + 'src', // this should map to tsconfig lib. always,gated mean "always download all polyfills from the server, but only load them if a polyfill does not exist" + 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=always,gated' ) if (document.readyState === 'loading') { From fc6629729aac2f55fc2fbd05d9308f3d28db6325 Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:07:26 -0500 Subject: [PATCH 5/9] Update standalone.ts --- packages/browser/src/browser/standalone.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/browser/src/browser/standalone.ts b/packages/browser/src/browser/standalone.ts index 7e838f81a..e5fc90d4d 100644 --- a/packages/browser/src/browser/standalone.ts +++ b/packages/browser/src/browser/standalone.ts @@ -75,8 +75,8 @@ if (shouldPolyfill()) { // load polyfills in order to get AJS to work with old browsers const script = document.createElement('script') script.setAttribute( - 'src', // this should map to tsconfig lib. always,gated mean "always download all polyfills from the server, but only load them if a polyfill does not exist" - 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=always,gated' + 'src', // this should map to tsconfig lib. gated means "only load polyfill if feature does not exist" + 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=gated' ) if (document.readyState === 'loading') { From 40b4737aef0fe947cf53ac8c39f4583b6c14b33c Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:27:05 -0500 Subject: [PATCH 6/9] Update standalone.ts --- packages/browser/src/browser/standalone.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser/src/browser/standalone.ts b/packages/browser/src/browser/standalone.ts index e5fc90d4d..519d3b61b 100644 --- a/packages/browser/src/browser/standalone.ts +++ b/packages/browser/src/browser/standalone.ts @@ -76,7 +76,7 @@ if (shouldPolyfill()) { const script = document.createElement('script') script.setAttribute( 'src', // this should map to tsconfig lib. gated means "only load polyfill if feature does not exist" - 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=gated' + 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=always,gated' ) if (document.readyState === 'loading') { From 8493439c8d6d036f408f80bdac96f6ea668dca2d Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Thu, 20 Apr 2023 22:34:21 -0500 Subject: [PATCH 7/9] Update standalone.ts --- packages/browser/src/browser/standalone.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser/src/browser/standalone.ts b/packages/browser/src/browser/standalone.ts index 519d3b61b..e5fc90d4d 100644 --- a/packages/browser/src/browser/standalone.ts +++ b/packages/browser/src/browser/standalone.ts @@ -76,7 +76,7 @@ if (shouldPolyfill()) { const script = document.createElement('script') script.setAttribute( 'src', // this should map to tsconfig lib. gated means "only load polyfill if feature does not exist" - 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=always,gated' + 'https://polyfill.io/v3/polyfill.min.js?features=es5,es2015,es2016,es2017,es2018,es2019,es2020&flags=gated' ) if (document.readyState === 'loading') { From 7a9386d2fbb7ebe8cd503a74c5933e2ba5fc4d4e Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Mon, 1 May 2023 17:20:32 -0500 Subject: [PATCH 8/9] Update khaki-spoons-laugh.md --- .changeset/khaki-spoons-laugh.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/khaki-spoons-laugh.md b/.changeset/khaki-spoons-laugh.md index d6cbb8d99..14d891229 100644 --- a/.changeset/khaki-spoons-laugh.md +++ b/.changeset/khaki-spoons-laugh.md @@ -1,5 +1,5 @@ --- -'@segment/analytics-next': patch +'@segment/analytics-next': minor --- -Fix 'Promise is undefined' issue with ie11 polyfill +Update polyfill cdn use polyfill.io. Auto-polyfill support for opera mini extreme mode and old versions of opera. From 3ef42632700ad2fe119ff088fba236f876d5932a Mon Sep 17 00:00:00 2001 From: Seth Silesky <5115498+silesky@users.noreply.github.com> Date: Mon, 1 May 2023 17:21:13 -0500 Subject: [PATCH 9/9] Update khaki-spoons-laugh.md --- .changeset/khaki-spoons-laugh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/khaki-spoons-laugh.md b/.changeset/khaki-spoons-laugh.md index 14d891229..1fafeace4 100644 --- a/.changeset/khaki-spoons-laugh.md +++ b/.changeset/khaki-spoons-laugh.md @@ -2,4 +2,4 @@ '@segment/analytics-next': minor --- -Update polyfill cdn use polyfill.io. Auto-polyfill support for opera mini extreme mode and old versions of opera. +Update cdn from babel to polyfill.io. Add Auto-polyfill support for opera mini extreme mode and old versions of opera.