OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
683 stars 95 forks source link

Intl support on Outlook Add-Ins which run on JavaScript only runtime (Launch event based add-in) #4631

Open pepso opened 4 months ago

pepso commented 4 months ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

Using Intl package (and its DateTimeFormat, NumberFormat, ListFormat) works as before.

Current behavior

Before updating the outlook to the version 2406 (Build 17726.20126) the add-ins bundle.js was working completely fine with references to Intl package and its standard functions (the same add-in bundle still works fine on some of the older Outlook versions across our client desktops).

When using the latest version on the current-channel: references to Intl in the Add-In bundle (JavaScript only runtime) throws errors like this to the office logs: Verbose Runtime [Console] [Log] [ReferenceError: Intl is not defined]

Has there been changes to Intl package / availability of it lately? Is this a bug? Is this a dropped support? Or have we used some unsupported package previously?

We really would not like to budle Intl functionality to the extension code base because this issue impacts events executed on "JavaScript runtime only" on Outlook Classic and not the browser based platforms like OWA/new Outlook/Classic Outlook's side panel.

Steps to reproduce

Happy to share our add-in manifest.xml privately to test between different versions if desired, but thought this can be first clarified if the support should be there in the first place before digging into deeper.



Link to live example(s)




Provide additional details




Context

Our clients are mostly in Enterprise semi-annual, or Enterprise monthly channels so the impact is quite contained still, but it looks like the problem might get out of hand if the Intl support is purposefully dropped from the launch events.

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

pepso commented 4 months ago

Hi @exextoc,

I understand the underlying JS engine the Classic Outlook launch events uses is based on V8, and by default the i18 / Intl support should be enabled during the compilation time. Does the ICU 75 update from April explain the dropped support?

Do we expect the support for Intl in Classic Outlook to be back in the upcoming Outlook releases?

We resorted to implement our Add-in without Intl package dependency for non-marketplace clients. We'd love to know this before we update the marketplace manifest version listing.

I noticed the current channel release notes were talking about character issues and decided to update the Outlook to the latest version and can confirm our add-in is still executed in an environment without Intl package:

Following code in action function:

console.log("Testing Intl Support...");
console.log("Intl typeof?", typeof Intl);
console.log("Intl available?", Intl ? true : false);

Results to following OfficeAddins.log.txt entries:

12/07/2024 11:36:51 Verbose Runtime [Console] [Log] Testing Intl Support...     
12/07/2024 11:36:51 Verbose Runtime [Console] [Log] 'Intl typeof?', 'undefined'     
12/07/2024 11:36:51 Verbose Runtime [Console] [Log] ReferenceError: Intl is not defined
12/07/2024 11:36:51 Unexpected  Runtime [Error] [Log] ReferenceError: Intl is not defined
Object.h [as error]
foundation.win32.bundle:57:1965
Object.error
C:\FOLDER\bundle.js:53:24
Object.error
C:\FOLDER\bundle.js:66:22
_callee$
C:\FOLDER\bundle.js:7640:12
tryCatch
C:\FOLDER\bundle.js:7581:1061
Generator.<anonymous>
C:\FOLDER\bundle.js:7581:3007
Generator.next
C:\FOLDER\bundle.js:7581:1698
asyncGeneratorStep
C:\FOLDER\bundle.js:7582:69
_next
C:\FOLDER\bundle.js:7583:162
u
foundation.win32.bundle:70:156
ztcdsb commented 3 months ago

@pepso We didn't disable Intl package as far as I am aware. I am not an expert in this area so I'm not sure if this is related to ICU75 update.

If it's missing indeed, it will require a feature request to specifically to add it.

pepso commented 3 months ago

Hi @ztcdsb thanks for the message.

I find this a bit concerning: Intl used to be part of the launch event environment (Chakra JS engine), it was dropped as part of migration to V8, and now we need to create a feature request to support it like it used to?

ztcdsb commented 3 months ago

@pepso Well, we recently rolled out V8 to everyone, but V8 was already the default engine for debugging event based add-ins for a while because Chakra does not support VS code debugging. Do you recall if you had the same issue when debugging event based add-ins before?

pepso commented 3 months ago

Hi @ztcdsb,

I have been running Intl package functionality on local development machine (debug flag on, which should mean the engine used was V8 as far as I am aware) for quite some time, including on 26th of April, when I resolved an underlying issue of required parameters (Intl.NumberFormat) being different between the JS engine implementations.

All this is to say the Intl package was present, and only since then gone missing: https://github.com/OfficeDev/office-js/issues/4391#issuecomment-2079216194

Also as mentioned in the original description of the issue, Outlook Classic 2406 (Build 17726.20126) was the first where the Intl package was missing on admin installed launch event Add-ins.

What I noticed while we developed the workaround to Intl package being missing is that many (like ~75% of common Intl replacement libraries) rely on Intl package and checks for certain function implementations (i.e. Intl.NumberFormat), which all end up being "silent failures" when attempting to use those are part of the bundled Add-in code.