ouisys-engine 2.1.21 → 2.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/click2sms.js +357 -0
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.js +88 -164
- package/dist/api/mo.js +274 -0
- package/dist/api/moRedir.js +186 -0
- package/dist/api/oneClick.js +366 -0
- package/dist/api/pin.js +493 -0
- package/dist/api/strategies.js +704 -0
- package/dist/api/ussd.js +1 -0
- package/dist/app/store.js +35 -0
- package/dist/common-types/AppThunk.d.ts +1 -2
- package/dist/features/strategies/categories/askMobileNumber.js +395 -0
- package/dist/features/strategies/categories/askOperator.js +311 -0
- package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
- package/dist/features/strategies/categories/headerEnrichment.js +670 -0
- package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
- package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
- package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
- package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
- package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
- package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
- package/dist/features/strategies/click2smsFlowSlice.js +172 -0
- package/dist/features/strategies/identifySlice.js +455 -0
- package/dist/features/strategies/moFlowSlice.js +196 -0
- package/dist/features/strategies/moRedirFlowSlice.js +190 -0
- package/dist/features/strategies/oneClickFlowSlice.js +277 -0
- package/dist/features/strategies/pinFlowSlice.js +313 -0
- package/dist/features/strategies/ussdFlowSlice.js +1 -0
- package/dist/flows/strategy.d.ts +1 -2
- package/dist/flows/strategy.js +1 -5
- package/dist/ips/tryGetIPRangeName.js +14 -13
- package/dist/mockServer/browser.js +48 -0
- package/dist/mockServer/handlers.js +22 -0
- package/dist/mockServer/server.js +48 -0
- package/dist/pacman/index.js +0 -1
- package/dist/reducers/click2smsFlow/utils.js +1 -3
- package/dist/reducers/moRedirFlow/utils.js +1 -1
- package/dist/reducers/oneClickFlow/utils.js +47 -19
- package/dist/reducers/pinFlow/utils.js +7 -12
- package/dist/reducers/strategy/utils.js +12 -13
- package/dist/reducers/tpayHeFlow/utils.js +1 -1
- package/dist/store/index.d.ts +1 -2
- package/dist/store/reducers.d.ts +0 -2
- package/dist/store/reducers.js +1 -4
- package/dist/test/setup.js +24 -0
- package/dist/test/test-utils.js +51 -0
- package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
- package/dist/utilities/loadScriptInnerHtml.js +18 -0
- package/package.json +1 -1
- package/src/api/index.ts +4 -37
- package/src/common-types/AppThunk.ts +1 -2
- package/src/flows/strategy.ts +1 -5
- package/src/ips/tryGetIPRangeName.ts +3 -2
- package/src/pacman/index.ts +1 -1
- package/src/reducers/click2smsFlow/utils.ts +0 -3
- package/src/reducers/moRedirFlow/utils.ts +1 -1
- package/src/reducers/oneClickFlow/utils.ts +77 -11
- package/src/reducers/pinFlow/utils.ts +2 -9
- package/src/reducers/strategy/utils.ts +2 -3
- package/src/store/index.ts +1 -2
- package/src/store/reducers.ts +1 -5
- package/src/utilities/loadScriptInnerHtml.ts +10 -0
- package/yarn.lock +5204 -0
- package/src/flows/tpayHeFlow.ts +0 -20
- package/src/reducers/tpayHeFlow/ITpayHeConstants.ts +0 -7
- package/src/reducers/tpayHeFlow/TpayHeTypes.ts +0 -135
- package/src/reducers/tpayHeFlow/index.ts +0 -207
- package/src/reducers/tpayHeFlow/utils.ts +0 -311
|
@@ -3,6 +3,8 @@ import { IConfig, ILinkExtraParams, IGETREDIRECTURLFailure, IGETREDIRECTURLSucce
|
|
|
3
3
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
4
4
|
import IError from "../../common-types/IError";
|
|
5
5
|
import { IHash } from "../strategy/StrategyTypes";
|
|
6
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
7
|
+
import { IMcpShieldResult } from "../pinFlow/PinTypes";
|
|
6
8
|
|
|
7
9
|
export const additionalQueryString = `msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N`
|
|
8
10
|
|
|
@@ -30,15 +32,8 @@ const fetchJsonp: <T>(_url:string)=>Promise<T> = (_url:string)=>{
|
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
script.type = 'text/javascript';
|
|
36
|
-
script.innerHTML = innerHTML
|
|
37
|
-
document.body.appendChild(script);
|
|
38
|
-
console.log('loadScript');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraParams?:ILinkExtraParams): Promise<{
|
|
35
|
+
let uniqidResult;
|
|
36
|
+
export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraParams?:ILinkExtraParams): Promise<{
|
|
42
37
|
subscription_url?:string;
|
|
43
38
|
redirect_url?:string;
|
|
44
39
|
action?:()=>Promise<string>;
|
|
@@ -46,7 +41,7 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraP
|
|
|
46
41
|
if (typeof window == "undefined") {
|
|
47
42
|
throw "javascript: console.error('SSR'); void 6"
|
|
48
43
|
} else {
|
|
49
|
-
const { host, country, slug, queryString, apiAction} = maybeConfig
|
|
44
|
+
const { host, country, slug, queryString, device, apiAction} = maybeConfig
|
|
50
45
|
const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
|
|
51
46
|
const offer = window.pac_analytics.visitor.offer
|
|
52
47
|
const s = window.location.search.substr(1)
|
|
@@ -78,6 +73,77 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraP
|
|
|
78
73
|
return {redirect_url:result.redirectUrlWithReplacedUniqid}
|
|
79
74
|
}
|
|
80
75
|
}else{
|
|
76
|
+
if(country.toLowerCase() === "za"){
|
|
77
|
+
try{
|
|
78
|
+
const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId)
|
|
79
|
+
if(false == mcpShieldResult.success){
|
|
80
|
+
console.warn(mcpShieldResult.message);
|
|
81
|
+
}else{
|
|
82
|
+
loadScriptInnerHtml(mcpShieldResult.source);
|
|
83
|
+
uniqidResult = mcpShieldResult.uniqid;
|
|
84
|
+
const mcpSessionCheckWithBlock = `
|
|
85
|
+
|
|
86
|
+
document.addEventListener('click', function (event) {
|
|
87
|
+
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
try{
|
|
90
|
+
if (!event.target.matches('.mcp')) return;
|
|
91
|
+
if (!window.isMcpSessionChecked) {
|
|
92
|
+
|
|
93
|
+
var url = "https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=${slug}&country=${country}&device=${device}&rockman_id=${rockmanId}&mcpUniqid=${uniqidResult}";
|
|
94
|
+
|
|
95
|
+
fetch(url).then(function(res) {
|
|
96
|
+
return res.json()
|
|
97
|
+
}).then(function(resJson) {
|
|
98
|
+
window.isMcpSessionChecked = true;
|
|
99
|
+
console.log('MCP');
|
|
100
|
+
|
|
101
|
+
if (resJson["should-block"] == true) {
|
|
102
|
+
document.body.innerHTML = ""
|
|
103
|
+
|
|
104
|
+
var div = document.createElement("div");
|
|
105
|
+
div.setAttribute("id", "page_blocked")
|
|
106
|
+
div.style.width = "100%";
|
|
107
|
+
div.style.height = "100%";
|
|
108
|
+
div.style.background = "#fff";
|
|
109
|
+
div.style.color = "#000";
|
|
110
|
+
div.style.position = "fixed";
|
|
111
|
+
div.style.display = "flex";
|
|
112
|
+
div.style.justifyContent = "center";
|
|
113
|
+
div.style.alignItems = "center";
|
|
114
|
+
div.style.fontSize = "40px";
|
|
115
|
+
div.style.top = "0";
|
|
116
|
+
div.style.bottom = "0";
|
|
117
|
+
div.style.left = "0";
|
|
118
|
+
div.style.right = "0";
|
|
119
|
+
div.innerHTML = "Offer Expired";
|
|
120
|
+
document.body.appendChild(div);
|
|
121
|
+
}else{
|
|
122
|
+
const target = event.target || event.srcElement;
|
|
123
|
+
|
|
124
|
+
while (target) {
|
|
125
|
+
if (target instanceof HTMLAnchorElement) {
|
|
126
|
+
console.log(target.getAttribute('href'));
|
|
127
|
+
window.location.href = target.getAttribute('href')
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
target = target.parentNode;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}catch(err){
|
|
137
|
+
console.error(err);
|
|
138
|
+
}
|
|
139
|
+
},false)
|
|
140
|
+
`
|
|
141
|
+
loadScriptInnerHtml(mcpSessionCheckWithBlock);
|
|
142
|
+
}
|
|
143
|
+
}catch(err){
|
|
144
|
+
console.warn(err)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
81
147
|
const url = `https://de.tallymans.com/tallyman/v1/?action=redirect&country=${bupperizeCountry(country)}&slug=${slug}&device=${"smart"}&offerId=${offer}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
|
|
82
148
|
const result = await fetch(url).then(x => x.json())
|
|
83
149
|
|
|
@@ -137,7 +203,7 @@ export const mockedRedirectUrlSuccessState : IOneClickFlowReducerState = {
|
|
|
137
203
|
currentState:{
|
|
138
204
|
type: "GET_REDIRECT_URL",
|
|
139
205
|
//@ts-ignore
|
|
140
|
-
result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: '
|
|
206
|
+
result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: '/mock-product-url'})
|
|
141
207
|
}
|
|
142
208
|
}
|
|
143
209
|
|
|
@@ -2,15 +2,8 @@ import { IConfig, IHash, SingleMSISDNSubmissionResult, MultiOperatorMSISDNSubmis
|
|
|
2
2
|
import IError from "../../common-types/IError";
|
|
3
3
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
4
4
|
import { identifyUser, left, loop, right } from "../strategy/utils";
|
|
5
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
5
6
|
|
|
6
|
-
const loadScriptInnerHtml = (innerHTML:string)=>{
|
|
7
|
-
var script = document.createElement('script');
|
|
8
|
-
script.type = 'text/javascript';
|
|
9
|
-
script.innerHTML = innerHTML;
|
|
10
|
-
var headElem = document.getElementsByTagName('head')[0];
|
|
11
|
-
headElem.insertBefore(script, headElem.firstChild)
|
|
12
|
-
console.log('loadScript');
|
|
13
|
-
}
|
|
14
7
|
|
|
15
8
|
export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string,extraParams?: IHash): Promise<SingleMSISDNSubmissionResult | MultiOperatorMSISDNSubmissionResult> {
|
|
16
9
|
|
|
@@ -218,7 +211,7 @@ export const mockedPINState : IPinFlowReducerState = {
|
|
|
218
211
|
export const mockedCompletedState : IPinFlowReducerState = {
|
|
219
212
|
currentState:{
|
|
220
213
|
type: "PINEntry",
|
|
221
|
-
result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"
|
|
214
|
+
result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"/mock-product-url"}),
|
|
222
215
|
data:{
|
|
223
216
|
actualPIN: "",
|
|
224
217
|
nextAction: "submitPinAction",
|
|
@@ -225,7 +225,6 @@ export const identifyUser = async(extraParams?:ILinkExtraParams):
|
|
|
225
225
|
return {redirect_url, msisdn:msisdn, operator:operator}
|
|
226
226
|
}
|
|
227
227
|
}else{
|
|
228
|
-
console.log("newUrl",window.location.href)
|
|
229
228
|
const newUrl = new URL(window.location.href);
|
|
230
229
|
const queryString = newUrl.search;
|
|
231
230
|
const urlParams = new URLSearchParams(queryString);
|
|
@@ -237,7 +236,7 @@ export const identifyUser = async(extraParams?:ILinkExtraParams):
|
|
|
237
236
|
|
|
238
237
|
}
|
|
239
238
|
}else{
|
|
240
|
-
const url = `https://${newHost}/tallyman/v1/?action=identify-user&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&page=${window.location.href}&pixel_url=${encodeURIComponent(`http
|
|
239
|
+
const url = `https://${newHost}/tallyman/v1/?action=identify-user&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&page=${window.location.href}&pixel_url=${encodeURIComponent(`http://${window.location.host}/pixels?xcid=${window.location.pathname.replace("/", "")}&xaid=${window.pac_analytics.visitor.xaid}&country=${bupperizeCountry(country)}`)}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
|
|
241
240
|
|
|
242
241
|
const result = await fetchJsonp<IStrategyIDentifyUserResult>(url);
|
|
243
242
|
if(false === result.success){
|
|
@@ -261,7 +260,7 @@ export const subscribe:(url:string)=>Promise<string> = async(url:string)=>{
|
|
|
261
260
|
// subscribeError['type'] = "SubscriptionError";
|
|
262
261
|
// throw subscribeError
|
|
263
262
|
// }else{
|
|
264
|
-
return "
|
|
263
|
+
return "/mock-product-url"
|
|
265
264
|
//}
|
|
266
265
|
|
|
267
266
|
}
|
package/src/store/index.ts
CHANGED
|
@@ -13,10 +13,9 @@ import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
|
13
13
|
import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
|
|
14
14
|
import { RealTallyman, MockTallyman } from "../api";
|
|
15
15
|
import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
16
|
-
import { ITpayHeActions } from "../reducers/tpayHeFlow/TpayHeTypes";
|
|
17
16
|
import { getConfig, getOperators } from "../reducers/strategy/utils";
|
|
18
17
|
|
|
19
|
-
export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions
|
|
18
|
+
export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
|
|
20
19
|
|
|
21
20
|
const log = createLogger({ diff: true, collapsed: true });
|
|
22
21
|
|
package/src/store/reducers.ts
CHANGED
|
@@ -7,7 +7,6 @@ import moRedirFlow from "../reducers/moRedirFlow";
|
|
|
7
7
|
import oneClickFlow from "../reducers/oneClickFlow";
|
|
8
8
|
import click2smsFlow from "../reducers/click2smsFlow";
|
|
9
9
|
import ussdFlow from "../reducers/ussdFlow";
|
|
10
|
-
import tpayHeFlow from "../reducers/tpayHeFlow";
|
|
11
10
|
|
|
12
11
|
import { IStrategyReducerState } from "../reducers/strategy/StrategyTypes";
|
|
13
12
|
import { IPinFlowReducerState } from "../reducers/pinFlow/PinTypes";
|
|
@@ -16,7 +15,6 @@ import { IMoRedirFlowReducerState } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
|
16
15
|
import { IOneClickFlowReducerState } from "../reducers/oneClickFlow/OneClickTypes";
|
|
17
16
|
import { IClick2smsFlowReducerState } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
18
17
|
import { IUssdFlowReducerState } from "../reducers/ussdFlow/UssdTypes";
|
|
19
|
-
import { ITpayHeFlowReducerState } from "../reducers/tpayHeFlow/TpayHeTypes";
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
export interface IApplicationState {
|
|
@@ -27,7 +25,6 @@ export interface IApplicationState {
|
|
|
27
25
|
oneClickFlow:IOneClickFlowReducerState;
|
|
28
26
|
click2smsFlow:IClick2smsFlowReducerState;
|
|
29
27
|
ussdFlow:IUssdFlowReducerState;
|
|
30
|
-
tpayHeFlow:ITpayHeFlowReducerState;
|
|
31
28
|
}
|
|
32
29
|
export default() => combineReducers<IApplicationState>({
|
|
33
30
|
strategy,
|
|
@@ -36,6 +33,5 @@ export default() => combineReducers<IApplicationState>({
|
|
|
36
33
|
moRedirFlow,
|
|
37
34
|
oneClickFlow,
|
|
38
35
|
click2smsFlow,
|
|
39
|
-
ussdFlow
|
|
40
|
-
tpayHeFlow
|
|
36
|
+
ussdFlow
|
|
41
37
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const loadScriptInnerHtml = (innerHTML:string)=>{
|
|
2
|
+
var script = document.createElement('script');
|
|
3
|
+
script.type = 'text/javascript';
|
|
4
|
+
script.innerHTML = innerHTML;
|
|
5
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
6
|
+
headElem.insertBefore(script, headElem.firstChild)
|
|
7
|
+
console.log('loadScript');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default loadScriptInnerHtml;
|