Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Embed launch script for typescript applications

Avatar

Level 2

Hi all,

 

We have a application which uses typescript and are facing issues to embed the launch script. Need help on how we could do this.

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @jane_12 

What issues you're facing .. could you please provide more details like error or screenshot? 

Meantime, please see below documentation and see if you have embed the code in right way 

https://experienceleague.adobe.com/docs/platform-learn/implement-in-websites/configure-tags/add-embe... 

View solution in original post

11 Replies

Avatar

Correct answer by
Community Advisor

Hello @jane_12 

What issues you're facing .. could you please provide more details like error or screenshot? 

Meantime, please see below documentation and see if you have embed the code in right way 

https://experienceleague.adobe.com/docs/platform-learn/implement-in-websites/configure-tags/add-embe... 

Avatar

Level 2

Hi @Gokul_Agiwal ,

 

Don't have the screenshots but the application uses TypeScript instead of JavaScript for client-side programming. So the launch embed script which is JavaScript, isn't working.

Avatar

Community Advisor

so In this case, you have to include as external JS library ( Launch library) and import it into your typescript application. 

Avatar

Community Advisor

Technically, there should be no issues running Typescript and Javascript together on the same site.. Typescript is a superset of Javascript, unless of course you are using a compiler which is converting all .js files to use the .ts file extension (and it's changing the Adobe Files as well). Since the Adobe scripts aren't hosted on your server, that could affect targeting... but surely you have ads or other third party scripts loading on your site that are using JS...

 

Can you provide more information about the issue you are getting? I don't work with Typescript sites, so I don't have an "actual" example to work with and can only guess at the issue you are encountering....

Avatar

Level 2

@Gokul_Agiwal and @Jennifer_Dungan ,

The application uses SharePoint Framework (SPFx) used for development of SharePoint Online applications.

Avatar

Community Advisor

Oh dear... it's SharePoint too?

 

Is the code live? Would you be willing to share the URL (even if through a private message) so we can see what is happening in the network panel and console logs?

Avatar

Community Advisor

@jane_12 / @Jennifer_Dungan 

Though it's SharePoint but TS / JS works like on any other platforms except if you're facing some SharePoint related issues then it's different.

I think you need to import your JS ( _satellite / launchJS) as module

import * as _Satellite from './../folder/_Satellite';

and in the typescript declaration file ( tsconfig.json) and make sure you enable the below compiler options 

{
  "compilerOptions": {
    "allowJs": true
    "checkJs": false

  }
}

 Reference -

 https://www.typescriptlang.org/tsconfig#allowJs 

https://www.typescriptlang.org/tsconfig#checkJs 

See if this method works. Let us know. 

Avatar

Level 2

Thanks for sharing this, will try this approach and let you know.

Avatar

Community Advisor

What's the error ? Is it possible to put logs / screenshot here 

Avatar

Community Advisor

@jane_12 Is your issues resolved? 

If yes, could you please post the solution here so it will be helpful for others.