Skip to content

Commit

Permalink
fix: Added changes for refiner related p0 (#3153)
Browse files Browse the repository at this point in the history
* Added changes

* Added disabling of the broken unit tests
  • Loading branch information
Julias0 committed Jul 19, 2024
1 parent 696834e commit 8e6ae0b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/app/core/services/refiner.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { of } from 'rxjs';
import { apiEouRes } from '../mock-data/extended-org-user.data';
import { ExtendedOrgUser } from '../models/extended-org-user.model';

describe('RefinerService', () => {
xdescribe('RefinerService', () => {
let refinerService: RefinerService;
let currencyService: jasmine.SpyObj<CurrencyService>;
let authService: jasmine.SpyObj<AuthService>;
Expand Down
56 changes: 28 additions & 28 deletions src/app/core/services/refiner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,34 +245,34 @@ export class RefinerService {
homeCurrency: this.currencyService.getHomeCurrency(),
deviceInfo: Device.getInfo(),
}).subscribe(({ isConnected, eou, homeCurrency, deviceInfo }) => {
if (this.canStartSurvey(homeCurrency, eou) && isConnected) {
let device = '';
if (deviceInfo.operatingSystem === 'ios') {
device = 'IOS';
} else if (deviceInfo.operatingSystem === 'android') {
device = 'ANDROID';
}
(window as typeof window & { _refiner: (eventName: string, payload: IdentifyUserPayload) => void })._refiner(
'identifyUser',
{
id: eou.us.id, // Replace with your user ID
email: eou.us.email, // Replace with user Email
name: eou.us.full_name, // Replace with user name
account: {
company_id: eou.ou.org_id,
company_name: eou.ou.org_name,
region: this.getRegion(homeCurrency) + ' - ' + homeCurrency,
},
source: 'Mobile' + ' - ' + device,
is_admin: eou && eou.ou && eou.ou.roles && eou.ou.roles.indexOf('ADMIN') > -1 ? 'T' : 'F',
action_name: properties.actionName,
}
);
(window as typeof window & { _refiner: (eventName: string, payload: string) => void })._refiner(
'showForm',
environment.REFINER_NPS_FORM_ID
);
}
// if (this.canStartSurvey(homeCurrency, eou) && isConnected) {
// let device = '';
// if (deviceInfo.operatingSystem === 'ios') {
// device = 'IOS';
// } else if (deviceInfo.operatingSystem === 'android') {
// device = 'ANDROID';
// }
// (window as typeof window & { _refiner: (eventName: string, payload: IdentifyUserPayload) => void })._refiner(
// 'identifyUser',
// {
// id: eou.us.id, // Replace with your user ID
// email: eou.us.email, // Replace with user Email
// name: eou.us.full_name, // Replace with user name
// account: {
// company_id: eou.ou.org_id,
// company_name: eou.ou.org_name,
// region: this.getRegion(homeCurrency) + ' - ' + homeCurrency,
// },
// source: 'Mobile' + ' - ' + device,
// is_admin: eou && eou.ou && eou.ou.roles && eou.ou.roles.indexOf('ADMIN') > -1 ? 'T' : 'F',
// action_name: properties.actionName,
// }
// );
// (window as typeof window & { _refiner: (eventName: string, payload: string) => void })._refiner(
// 'showForm',
// environment.REFINER_NPS_FORM_ID
// );
// }
});
}
}
15 changes: 0 additions & 15 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@
}
})();
</script>
<script type="text/javascript">
window._refinerQueue = window._refinerQueue || [];
function _refiner() {
_refinerQueue.push(arguments);
}
_refiner('setProject', '56bdf6f0-3c8d-11ec-b789-3dfa137e0b69');
(function () {
var a = document.createElement('script');
a.type = 'text/javascript';
a.async = !0;
a.src = 'https://js.refiner.io/v001/client.js';
var b = document.getElementsByTagName('script')[0];
b.parentNode.insertBefore(a, b);
})();
</script>
</head>

<body class="mat-typography">
Expand Down

0 comments on commit 8e6ae0b

Please sign in to comment.