Adobe-Marketing-Cloud / target-atjs-extensions

Adobe Target extensions to at.js to support Single Page Application implementations
56 stars 28 forks source link

Previous mboxURL upon state change #11

Closed kvijayk closed 7 years ago

kvijayk commented 8 years ago

I am using https://github.com/Adobe-Marketing-Cloud/target-atjs-extensions/tree/master/angular/ui-router.

Upon state change, when I see mbox calls from AT.js, mboxURL is of the current page and not of the URL that is used after the state change as shown in the pics below. This is preventing the correct offers to be executed when offers are based on the current page URL.

In this case, I am trying to change the text of the button on the “forgot password” page however since the mboxURL being passed is from the previous state/page, offer does not get executed.

You can see the offer in action on this URL: https://wudispatcher-uatrs4.westernunion.com/us/en/send-money/app/forgot-password?test=25&src=test-25

Button text changes based on the AT.js offer but when you click on login and then “forgot password” you come back to the same page without page loading again but now mboxURL is “/login” instead of “/forgot-password”. See the pic below.

image image

vadymus commented 8 years ago

Hi @kvijayk I have seen this issue before with Angular apps that were using internal redirects. Could you share more details about how you land on the route in question? Do you experience this issue throughout the entire site as you browse around or only this particular page?

XDex commented 8 years ago

@kvijayk, could you please try upgrading your angular-ui-router.js lib from v0.2.15 to v0.2.18 and see if the issue gets fixed?

kvijayk commented 8 years ago

@vadymus If I land on the page directly, mboxURL is fine, but when I browse around different pages within the SPA, mboxURL is going as the URL where the click action is performed and not the resulting page URL. Issue is with all pages, not just this page.

@XDex I dont see any changes to angular-ui-router.js for past 3 months, and version is not available to see either. I am sure I am on the latest as I took the file about 15 days back.

XDex commented 8 years ago

@kvijayk I see the following comment in your /etc/clientlibs/westernunion/optimus/optimusclientlibs/js-lib.js

 * State-based routing for AngularJS
 * @version v0.2.15
 * @link http://angular-ui.github.com/

Could you please try updating it to v0.2.18, by downloading it from here?

kvijayk commented 7 years ago

No change even after updating to Angular UI v0.2.18, same behavior as before.

kvijayk commented 7 years ago

Well, finally gave up on this extension and just used the getOffer and applyOffer from AT.js. Working fine as expected.