ouisys-engine 3.0.1 → 3.0.5

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.
Files changed (195) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.husky/pre-commit +4 -0
  4. package/.nvmrc +1 -1
  5. package/.prettierignore +2 -1
  6. package/.vscode/settings.json +1 -1
  7. package/README.md +2 -4
  8. package/dist/api/index.d.ts +5 -5
  9. package/dist/api/index.js +76 -76
  10. package/dist/common-types/AppThunk.d.ts +11 -12
  11. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  12. package/dist/common-types/ITracker.js +1 -2
  13. package/dist/common-types/RemoteDataState.d.ts +4 -4
  14. package/dist/common-types/RemoteDataState.js +17 -17
  15. package/dist/flows/click2smsFlow.d.ts +2 -2
  16. package/dist/flows/moFlow.d.ts +2 -2
  17. package/dist/flows/moRedirFlow.d.ts +2 -2
  18. package/dist/flows/oneClickFlow.d.ts +2 -2
  19. package/dist/flows/pinFlow.d.ts +2 -2
  20. package/dist/flows/pinFlow.js +2 -0
  21. package/dist/flows/strategy.d.ts +8 -8
  22. package/dist/flows/ussdFlow.d.ts +2 -2
  23. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  24. package/dist/ips/tryGetIPRangeName.js +7 -5
  25. package/dist/jest.config.js +1 -1
  26. package/dist/pacman/index.d.ts +2 -2
  27. package/dist/pacman/index.js +41 -41
  28. package/dist/pacman/queryString.js +11 -9
  29. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  30. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  31. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  32. package/dist/reducers/click2smsFlow/index.js +24 -24
  33. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  34. package/dist/reducers/click2smsFlow/utils.js +30 -30
  35. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  36. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  37. package/dist/reducers/moFlow/index.d.ts +3 -3
  38. package/dist/reducers/moFlow/index.js +27 -27
  39. package/dist/reducers/moFlow/utils.d.ts +1 -2
  40. package/dist/reducers/moFlow/utils.js +28 -26
  41. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  42. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  43. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  44. package/dist/reducers/moRedirFlow/index.js +27 -27
  45. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  46. package/dist/reducers/moRedirFlow/utils.js +17 -17
  47. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  48. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  49. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  50. package/dist/reducers/oneClickFlow/index.js +75 -68
  51. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  52. package/dist/reducers/oneClickFlow/utils.js +70 -69
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +24 -23
  55. package/dist/reducers/pinFlow/index.d.ts +3 -3
  56. package/dist/reducers/pinFlow/index.js +76 -76
  57. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  58. package/dist/reducers/pinFlow/utils.js +61 -65
  59. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  60. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  61. package/dist/reducers/strategy/index.d.ts +2 -2
  62. package/dist/reducers/strategy/index.js +99 -99
  63. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
  65. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  67. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  69. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  70. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  71. package/dist/reducers/strategy/utils.d.ts +3 -3
  72. package/dist/reducers/strategy/utils.js +115 -111
  73. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  74. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  75. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  76. package/dist/reducers/ussdFlow/index.js +27 -27
  77. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  78. package/dist/reducers/ussdFlow/utils.js +19 -17
  79. package/dist/store/index.d.ts +8 -8
  80. package/dist/store/index.js +87 -83
  81. package/dist/store/reducers.d.ts +7 -7
  82. package/dist/store/reducers.js +4 -4
  83. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  84. package/dist/utilities/handleSubmitNumber.js +15 -18
  85. package/dist/utilities/index.d.ts +1 -1
  86. package/dist/utilities/index.js +13 -11
  87. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  88. package/index.html +21 -28
  89. package/mockData/config.json +1 -1
  90. package/package.json +23 -15
  91. package/setupJest.js +1 -1
  92. package/tsconfig.json +2 -2
  93. package/dist/api/click2sms.js +0 -357
  94. package/dist/api/mo.js +0 -274
  95. package/dist/api/moRedir.js +0 -186
  96. package/dist/api/oneClick.js +0 -366
  97. package/dist/api/pin.js +0 -493
  98. package/dist/api/strategies.js +0 -704
  99. package/dist/api/ussd.js +0 -1
  100. package/dist/app/store.js +0 -35
  101. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  102. package/dist/features/strategies/categories/askOperator.js +0 -311
  103. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  104. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  105. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  106. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  107. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  108. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  109. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  110. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  111. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  112. package/dist/features/strategies/identifySlice.js +0 -455
  113. package/dist/features/strategies/moFlowSlice.js +0 -196
  114. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  115. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  116. package/dist/features/strategies/pinFlowSlice.js +0 -313
  117. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  118. package/dist/flows/tpayHeFlow.d.ts +0 -7
  119. package/dist/flows/tpayHeFlow.js +0 -23
  120. package/dist/mockServer/browser.js +0 -48
  121. package/dist/mockServer/handlers.js +0 -22
  122. package/dist/mockServer/server.js +0 -48
  123. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  124. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  125. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  126. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  127. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  128. package/dist/reducers/tpayHeFlow/index.js +0 -331
  129. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  130. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  131. package/dist/test/setup.js +0 -24
  132. package/dist/test/test-utils.js +0 -51
  133. package/prettier.config.js +0 -7
  134. package/src/@types/react-tracker.d.ts +0 -16
  135. package/src/@types/redux-cli-logger.d.ts +0 -1
  136. package/src/@types/tiny-async-pool.d.ts +0 -3
  137. package/src/@types/window.d.ts +0 -74
  138. package/src/api/index.ts +0 -225
  139. package/src/common-types/AppThunk.ts +0 -19
  140. package/src/common-types/Either.ts +0 -3
  141. package/src/common-types/IError.ts +0 -5
  142. package/src/common-types/IOptInFlowName.ts +0 -1
  143. package/src/common-types/ITracker.ts +0 -10
  144. package/src/common-types/IVisitor.ts +0 -16
  145. package/src/common-types/RemoteDataState.ts +0 -88
  146. package/src/flows/click2smsFlow.ts +0 -18
  147. package/src/flows/moFlow.ts +0 -20
  148. package/src/flows/moRedirFlow.ts +0 -20
  149. package/src/flows/oneClickFlow.ts +0 -20
  150. package/src/flows/pinFlow.ts +0 -25
  151. package/src/flows/strategy.ts +0 -51
  152. package/src/flows/ussdFlow.ts +0 -20
  153. package/src/index.ts +0 -3
  154. package/src/ips/tryGetIPRangeName.ts +0 -22
  155. package/src/jest.config.js +0 -194
  156. package/src/pacman/index.ts +0 -71
  157. package/src/pacman/queryString.ts +0 -24
  158. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  159. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  160. package/src/reducers/click2smsFlow/index.ts +0 -105
  161. package/src/reducers/click2smsFlow/utils.ts +0 -126
  162. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  163. package/src/reducers/moFlow/MoTypes.ts +0 -125
  164. package/src/reducers/moFlow/index.ts +0 -150
  165. package/src/reducers/moFlow/utils.ts +0 -135
  166. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  167. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  168. package/src/reducers/moRedirFlow/index.ts +0 -137
  169. package/src/reducers/moRedirFlow/utils.ts +0 -78
  170. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  171. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  172. package/src/reducers/oneClickFlow/index.ts +0 -268
  173. package/src/reducers/oneClickFlow/utils.ts +0 -217
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -189
  176. package/src/reducers/pinFlow/index.ts +0 -331
  177. package/src/reducers/pinFlow/utils.ts +0 -232
  178. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  179. package/src/reducers/strategy/StrategyTypes.ts +0 -375
  180. package/src/reducers/strategy/index.ts +0 -321
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
  182. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  183. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  184. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  185. package/src/reducers/strategy/utils.ts +0 -357
  186. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  187. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  188. package/src/reducers/ussdFlow/index.ts +0 -146
  189. package/src/reducers/ussdFlow/utils.ts +0 -88
  190. package/src/store/index.ts +0 -150
  191. package/src/store/reducers.ts +0 -37
  192. package/src/utilities/handleSubmitNumber.ts +0 -65
  193. package/src/utilities/index.ts +0 -114
  194. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  195. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,74 +0,0 @@
1
- // import {IPacman, IPacmanAnalytics} from "../pacman/types";
2
- import { IPacmanAnalytics } from "pacman-client/.build-lib/Pacman/types";
3
- import { ITallyman } from "../api";
4
-
5
- declare global {
6
- interface Event {
7
- accelerationIncludingGravity: {
8
- x: number;
9
- y: number;
10
- z: number;
11
- };
12
- }
13
-
14
- interface Navigator {
15
- connection: any;
16
- userLanguage: any;
17
- browserLanguage: any;
18
- systemLanguage: any;
19
- oscpu: any;
20
- }
21
-
22
- export interface OuisysCallBackResponse {
23
- subscription_url: string;
24
- success: boolean;
25
- rockman_id: string;
26
- }
27
-
28
- export type ITpay = {
29
- HeaderEnrichment:{
30
- operatorCode:()=>string | number;
31
- sessionId:()=>number;
32
- hasSubscription:(prodSku:string, f:(hasSub:boolean, subId:string)=>void)=>void;
33
- confirm:(subscriptionPlanId:number, catName:string, prodSku:string, sessionId:number, rUrl:string, rockmanId:string, lang:string, hash:string)=>void;
34
- consent:(subscriptionPlanId:number, catName:string, prodSku:string, sessionId:number, rUrl:string, rockmanId:string, lang:string, hash:string)=>void;
35
- msisdn:()=>string;
36
- }
37
-
38
- }
39
-
40
- interface Window {
41
- openDatabase: any;
42
- pac_analytics?: IPacmanAnalytics;
43
- // pacman?: IPacman;
44
- dataLayer: {
45
- push: (...args:any) => void
46
- };
47
- //@ts-ignore
48
- requestIdleCallback? : (...args:any) => void;
49
- google_optimize?: { get: (exprId: string) => string }
50
- "x-requested-with":string;
51
- evina_special_gateway:string;
52
- ouisys_callback_functionResponse:OuisysCallBackResponse;
53
- ouisys_callback_function:OuisysCallBackResponse;
54
- tallymanApi:ITallyman;
55
- TPay:ITpay;
56
- tPayhash:string;
57
- hostCountry?:string;
58
- hostSlug?:string;
59
- tid:string;
60
- isAutoFraudScreener: boolean;
61
- isEvinaSessionChecked: boolean;
62
- shouldBlock: boolean;
63
- reCaptchaToken: string;
64
- uniqidOnLoadResult: string;
65
- }
66
-
67
- namespace NodeJS {
68
-
69
- interface Global {
70
- window:Window
71
- }
72
- }
73
- function gtag(...args:any): void;
74
- }
package/src/api/index.ts DELETED
@@ -1,225 +0,0 @@
1
- import { IHash, IConfig, IMSISDNSubmissionResult, IPINSubmissionResult, ICheckSubscriptionResult, IMcpShieldResult } from "../reducers/pinFlow/PinTypes"
2
- import { IMSISDNSubmissionResult as IMoRedirMSISDNSubmissionResult } from "../reducers/moRedirFlow/MoRedirTypes"
3
- import { IGoogleReCaptcha, IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes"
4
-
5
-
6
- import IError from "../common-types/IError";
7
- import { IIdentifyResult } from "../reducers/strategy/StrategyTypes";
8
- import { IFetchResult } from "../reducers/click2smsFlow/Click2smsTypes";
9
-
10
- const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
11
-
12
- export interface ITallyman {
13
- identify:(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string)=>Promise<IIdentifyResult>
14
- triggerPin:(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string)=>Promise<IMSISDNSubmissionResult>;
15
- verifyPin:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string, evinaTid:string)=>Promise<IPINSubmissionResult>;
16
- checkSubscriptionByRockmanIdOnly:(host:string, rockmanId:string)=>Promise<ICheckSubscriptionResult>;
17
- checkSubscription:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string)=>Promise<ICheckSubscriptionResult>;
18
- triggerMessage:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
19
- redirect:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, ip_range_name:string, search:string, extraParamsQs:string)=>Promise<IMoRedirMSISDNSubmissionResult>;
20
- ussd:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
21
- oc2sms:(host: string, country:string, slug:string, offer:number, rockmanId:string, keyword:string, operator:string, search:string)=>Promise<IFetchResult>;
22
- mcpShield:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string)=>Promise<IMcpShieldResult>;
23
- getGoogleCaptcha:(host: string, country: string, slug: string, device:string, domain: string)=>Promise<IGoogleReCaptcha>;
24
- }
25
- function sleep(milliseconds:number) {
26
- const date = Date.now();
27
- let currentDate = null;
28
- do {
29
- currentDate = Date.now();
30
- } while (currentDate - date < milliseconds);
31
- }
32
-
33
-
34
- export const MockTallyman:ITallyman = {
35
- identify:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string): Promise<IIdentifyResult> =>{
36
- console.log("MockTallyman")
37
- sleep(2000);
38
- return {
39
- operator: "",
40
- flow: "",
41
- success: true,
42
- rockman_id: ""
43
- }
44
- },
45
- triggerPin:async(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string, evinaTid?:string): Promise<IMSISDNSubmissionResult> =>{
46
- console.log("MockTallyman")
47
- sleep(2000);
48
- return {
49
- success: true,
50
- operator:"",
51
- rockman_id: "",
52
- pin: "",
53
- product_url: ""
54
- }
55
- },
56
- verifyPin:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string): Promise<IPINSubmissionResult> =>{
57
- console.log("MockTallyman")
58
- sleep(2000);
59
- return {
60
- success: true,
61
- rockman_id: "000",
62
- product_url: "/mock-product-url",
63
- async: false
64
- }
65
- },
66
- checkSubscription:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string): Promise<ICheckSubscriptionResult> =>{
67
- console.log("MockTallyman")
68
- sleep(2000);
69
- return {
70
- success: true,
71
- rockman_id: "000",
72
- product_url: "/mock-product-url",
73
- msisdn:"000"
74
- }
75
- },
76
- checkSubscriptionByRockmanIdOnly:async(host:string, rockmanId:string): Promise<ICheckSubscriptionResult> =>{
77
- console.log("MockTallyman")
78
- sleep(2000);
79
- return {
80
- success: true,
81
- rockman_id: "000",
82
- product_url: "/mock-product-url",
83
- msisdn:"000"
84
- }
85
- },
86
- redirect:async(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, ip_range_name:string, search:string, extraParamsQs:string): Promise<IMoRedirMSISDNSubmissionResult> =>{
87
- console.log("MockTallyman")
88
- sleep(2000);
89
- return {
90
- success: true,
91
- rockman_id: "000",
92
- redirect_url: "/mock-product-url"
93
- }
94
- },
95
- triggerMessage:async(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string): Promise<IMoMSISDNSubmissionResult> =>{
96
- console.log("MockTallyman")
97
- sleep(2000);
98
- return {
99
- success: true,
100
- rockman_id: "0000",
101
- keyword: 'TEST OK',
102
- shortcode: '666'
103
- }
104
- },
105
- ussd:async(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string): Promise<IMoMSISDNSubmissionResult> =>{
106
- console.log("MockTallyman")
107
- sleep(2000);
108
- return {
109
- success: true,
110
- rockman_id: "0000",
111
- keyword: 'TEST OK',
112
- shortcode: '666'
113
- }
114
- },
115
- oc2sms:async(host: string, country: string, slug: string, offer: number, rockmanId: string, keyword:string, operator:string, search: string): Promise<IFetchResult>=> {
116
- console.log("MockTallyman")
117
- sleep(2000);
118
- return {
119
- success: true,
120
- uid:"1",
121
- keyword: 'TEST OK',
122
- displayKeyword:"TEST OK",
123
- shortcode: '666'
124
- }
125
- },
126
- mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string,): Promise<IMcpShieldResult>=> {
127
- console.log("MockTallyman")
128
- sleep(2000);
129
- return {
130
- "source": "**********some very long text**********",
131
- "uniqid": "a26e7c3983a9cebd469601d695c7dbc4",
132
- "success": true,
133
- "rockman_id": "d66ac1a3ee6d40c289c23322ecd9aa79"
134
- }
135
- },
136
- getGoogleCaptcha:async(host: string, country: string, slug: string, device:string, domain: string):Promise<IGoogleReCaptcha>=>{
137
- return {
138
- "site_key": "6LfMTS8fAAAAAHw-cibJXMfnsIYNpWh81GatD1lw",
139
- "secret_key": "6LfMTS8fAAAAAIAET7tvHjrU-tRPGuqSdfCZZX6G",
140
- "domains": "n.gamiclub.com",
141
- "success": true
142
- }
143
- }
144
- }
145
-
146
- export const RealTallyman:ITallyman = {
147
- identify:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string): Promise<IIdentifyResult> =>{
148
- console.log("RealTallyman")
149
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
150
- const newHost = isDMB ? "de.tallymans.com" : host;
151
-
152
- return await fetch(`https://${newHost}/tallyman/v1/?action=identify&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}`).then(x => x.json());
153
- },
154
- triggerPin:async(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string): Promise<IMSISDNSubmissionResult> =>{
155
- console.log("RealTallyman")
156
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
157
- const newHost = isDMB ? "de.tallymans.com" : host;
158
- const isCleanTraffic = (country.toLowerCase() === "be") ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
159
-
160
- return await fetch(`https://${newHost}/tallyman/v1/?action=trigger-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&msisdn=${msisdn}&rockman_id=${rockmanId}${uniqid}${isCleanTraffic}${extraParamsQs}&${search}`).then(x => x.json());
161
- },
162
- verifyPin:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string, evinaTid:string): Promise<IPINSubmissionResult> =>{
163
- console.log("RealTallyman");
164
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
165
- const newHost = isDMB ? "de.tallymans.com" : host;
166
- const isCleanTraffic = (country.toLowerCase() === "be") ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
167
-
168
- return await fetch(`https://${newHost}/tallyman/v1/?action=verify-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&pin=${pin}${uniqid}&sam_evina_tid=${evinaTid}${isCleanTraffic}${extraParamsQs}`).then(x => x.json())
169
- },
170
- checkSubscription:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string): Promise<ICheckSubscriptionResult> =>{
171
- console.log("RealTallyman")
172
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
173
- const newHost = isDMB ? "de.tallymans.com" : host;
174
- return await fetch(`https://${newHost}/tallyman/v1/?action=check-subscription&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}`).then(x => x.json())
175
- },
176
- checkSubscriptionByRockmanIdOnly:async(host:string, rockmanId:string): Promise<ICheckSubscriptionResult> =>{
177
- console.log("RealTallyman")
178
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
179
- const newHost = isDMB ? "de.tallymans.com" : host;
180
- return await fetch(`https://${newHost}/tallyman/v1/?action=check-subscription&rockman_id=${rockmanId}`).then(x => x.json())
181
- },
182
- redirect:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, ip_range_name: string, search: string, extraParamsQs: string): Promise<IMoRedirMSISDNSubmissionResult> =>{
183
- console.log("RealTallyman")
184
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
185
- const newHost = isDMB ? "de.tallymans.com" : host;
186
- const evinaTi = (country.toLowerCase() === "a2") ? `&evinaTi=${rockmanId}` : '';
187
-
188
- return await fetch(`https://${newHost}/tallyman/v1/?action=redirect&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&network_type=${!ip_range_name ? "wifi":""}&${search}${evinaTi}${extraParamsQs}`).then(x => x.json())
189
- },
190
- triggerMessage:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string): Promise<IMoMSISDNSubmissionResult> =>{
191
- console.log("RealTallyman")
192
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
193
- const newHost = isDMB ? "de.tallymans.com" : host;
194
- const samGtoken = window.reCaptchaToken ? `sam-g-token=${window.reCaptchaToken}` : ''
195
-
196
- return await fetch(`https://${newHost}/tallyman/v1/?action=trigger-message&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&${samGtoken}${search}${extraParamsQs}`).then(x => x.json());
197
- },
198
- ussd:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string): Promise<IMoMSISDNSubmissionResult> =>{
199
- console.log("RealTallyman")
200
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
201
- const newHost = isDMB ? "de.tallymans.com" : host;
202
- return await fetch(`https://${newHost}/tallyman/v1/?action=ussd&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&${search}${extraParamsQs}`).then(x => x.json());
203
- },
204
- oc2sms:async(host: string, country: string, slug: string, offer: number, rockmanId: string, keyword:string, operator:string, search: string): Promise<IFetchResult>=> {
205
- console.log("RealTallyman")
206
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
207
- const newHost = isDMB ? "de.tallymans.com" : host;
208
- return await fetch(`https://${newHost}/tallyman/v1/?action=oc2sms&country=${country}&slug=${slug}&offerId=${offer}${!!keyword ? '&keyword=' + keyword : ''}&device=smart&rockman_id=${rockmanId}${!!operator ? '&operator=' + operator : ''}&${search}`).then(x => x.json())
209
- },
210
- mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string): Promise<IMcpShieldResult>=> {
211
- console.log("RealTallyman")
212
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
213
- const newHost = isDMB ? "de.tallymans.com" : host;
214
- const pageUrl = window.location.href;
215
- const ipAdd = window.pac_analytics.visitor.ip;
216
- const userIp = ipAdd ? `&client_ip=${ipAdd}` : '';
217
- return await fetch(`https://${newHost}/tallyman/v1/?action=mcp-shield&country=${country}&slug=${slug}&device=${device}&offerId=${offer}&operator=${operator || ''}&rockman_id=${rockmanId}&client_lpu=${pageUrl}${userIp}${uniqid || ''}`).then(x => x.json())
218
- },
219
- getGoogleCaptcha:async(host: string, country: string, slug: string, device:string, domain: string):Promise<IGoogleReCaptcha>=>{
220
- const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
221
- const newHost = isDMB ? "de.tallymans.com" : host;
222
- return await fetch(`https://${newHost}/tallyman/helper/?action=google-captcha-v3-config&country=${country}&slug=${slug}&device=${device}&domain=${domain}`).then(x => x.json())
223
-
224
- }
225
- }
@@ -1,19 +0,0 @@
1
- import { IApplicationState } from "../store/reducers";
2
- import { Action } from "redux";
3
- import { ThunkAction } from "redux-thunk";
4
- import IStategyActionContants from "../reducers/strategy/IStategyActionContants";
5
- import IPinConstants from "../reducers/pinFlow/IPinConstants";
6
- import IMoConstants from "../reducers/moFlow/IMoConstants";
7
- import IMoRedirConstants from "../reducers/moRedirFlow/IMoRedirConstants";
8
- import IOneClickConstants from "../reducers/oneClickFlow/IOneClickConstants";
9
- import IClick2smsConstants from "../reducers/click2smsFlow/IClick2smsConstants";
10
- import IUssdConstants from "../reducers/ussdFlow/IUssdConstants";
11
-
12
- type IAllActionConstants = IStategyActionContants | IPinConstants | IMoConstants | IMoRedirConstants | IOneClickConstants | IClick2smsConstants | IUssdConstants;
13
-
14
- export type AppThunk<ReturnType = void> = ThunkAction<
15
- ReturnType,
16
- IApplicationState,
17
- unknown,
18
- Action<IAllActionConstants>
19
- >
@@ -1,3 +0,0 @@
1
- type Either<L, R> = { type: 'left', value: L } | {type: 'right', value: R}
2
-
3
- export default Either
@@ -1,5 +0,0 @@
1
- type IError = Error & {
2
- type:string;
3
- }
4
-
5
- export default IError
@@ -1 +0,0 @@
1
- type IOptInFlowName = "Block" | "Click to sms" | "Hybrid Pin" | "Msisdn to sms" | "Not available" | "Pin" | "Redirect" | "To be determined" | "USSD" | "3G click";
@@ -1,10 +0,0 @@
1
- interface ITracker {
2
- viewChanged: (view: string) => void;
3
- msisdnSubmitted: (msisdn: string) => void;
4
- advancedInFlow: (flow: string, action: string, args?: any) => void;
5
- advancedInPreFlow: (label: string, args?: any) => void;
6
- recedeInFlow: (flow: string, newState: string, args?: any) => void;
7
- customEvent:(category: string, action: string, label: string, args?: any)=> void;
8
- };
9
-
10
- export default ITracker
@@ -1,16 +0,0 @@
1
- type IVisitor = {
2
- country: string;
3
- rockmanId: string;
4
- impressionNumber: number;
5
- page: string;
6
- xaid: string; // affiliateId
7
- cid: number; // integer normalized value of campaignId
8
- handle_name?:string;
9
- chainRedirectUrl?:string;
10
- offer?: number;
11
- ip?: string;
12
- ip_range_name?: string;
13
-
14
- };
15
-
16
- export default IVisitor
@@ -1,88 +0,0 @@
1
- export type RemoteDataState<E, D> =
2
- | { type: "NothingYet" }
3
- | { type: "Loading" }
4
- | { type: "Failure"; error: E }
5
- | { type: "Success"; data: D };
6
-
7
- export interface IMatcher<E, D, R> {
8
- nothingYet: (data?: D) => R;
9
- loading: () => R;
10
- failure: (error: E) => R;
11
- success: (data: D) => R;
12
- }
13
-
14
- export interface ISuccessMatcher<E, D, R> {
15
- success: (data: D) => R;
16
- otherwise: (rds: RemoteDataState<E, D>) => R;
17
- }
18
-
19
- export function match<E, D, R>({
20
- nothingYet,
21
- loading,
22
- failure,
23
- success
24
- }: IMatcher<E, D, R>): (model: RemoteDataState<E, D>) => R {
25
- return model => {
26
- switch (model.type) {
27
- case "NothingYet":
28
- return nothingYet();
29
- case "Loading":
30
- return loading();
31
- case "Failure":
32
- return failure(model.error);
33
- case "Success":
34
- return success(model.data);
35
- }
36
- };
37
- }
38
-
39
- export const NothingYet = <E, D>(data?: D): RemoteDataState<E, D> => ({
40
- type: "NothingYet"
41
- });
42
-
43
- export const Loading = <E, D>(): RemoteDataState<E, D> => ({
44
- type: "Loading"
45
- });
46
-
47
- export const Failure = <E, D>(error: E): RemoteDataState<E, D> => ({
48
- type: "Failure",
49
- error: error
50
- });
51
-
52
- export const Success = <E, D>(data: D): RemoteDataState<E, D> => ({
53
- type: "Success",
54
- data: data
55
- });
56
-
57
- export const IsNothingYet = <E, D>(s: RemoteDataState<E, D>) =>
58
- s.type == "NothingYet";
59
- export const IsLoading = <E, D>(s: RemoteDataState<E, D>) =>
60
- s.type == "Loading";
61
- export const IsFailure = <E, D>(s: RemoteDataState<E, D>) =>
62
- s.type == "Failure";
63
- export const IsSuccess = <E, D>(s: RemoteDataState<E, D>) =>
64
- s.type == "Success";
65
-
66
-
67
-
68
-
69
- export const WhenFailure = <E, D, R>(d: R, r: (err: E) => R) => (
70
- s: RemoteDataState<E, D>
71
- ) => (s.type == "Failure" ? r(s.error) : d);
72
-
73
- export const WhenLoading = <D, R>(d: R, r: () => R) => (
74
- s: RemoteDataState<any, D>
75
- ) => (s.type == "Loading" ? r() : d);
76
-
77
- export const WhenSuccess = <D, R>(d: R, r: (data: D) => R) => (
78
- s: RemoteDataState<any, D>
79
- ) => (s.type == "Success" ? r(s.data) : d);
80
-
81
- export const MatchFailure = <E, D, R>({failure, otherwise} : {otherwise: () => R, failure: (err: E) => R}) => (
82
- s: RemoteDataState<E, D>
83
- ) => (s.type == "Failure" ? failure(s.error) : otherwise());
84
-
85
-
86
- export const MatchSuccess = <E, D, R>({success, otherwise} : ISuccessMatcher<E, D, R>) => (
87
- s: RemoteDataState<E, D>
88
- ) => (s.type == "Success" ? success(s.data) : otherwise(s));
@@ -1,18 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
-
3
- import { IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess, IOneClickCurrentState } from "../reducers/oneClickFlow/OneClickTypes";
4
- import { IClick2smsFlowCurrentState, IWithMultiKeywordShortcode } from "../reducers/click2smsFlow/Click2smsTypes";
5
-
6
- function click2smsFlowMatch <R>(
7
- { load }:
8
- { load: (rds: RDS.RemoteDataState<string, IWithMultiKeywordShortcode>) => R
9
- }): (state: IClick2smsFlowCurrentState) => R {
10
- return state => {
11
- switch (state.type) {
12
- case 'LOAD_OC2SMS':
13
- return load(state.result)
14
- }
15
- }
16
- }
17
-
18
- export default click2smsFlowMatch;
@@ -1,20 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import {
3
- IMoFlowCurrentState,
4
- MSISDNEntryFailure,
5
- MSISDNEntrySuccess,
6
- } from "../reducers/moFlow/MoTypes";
7
-
8
- function moFlowMatch<R>(
9
- { msisdnEntry }:
10
- { msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R
11
- }): (state: IMoFlowCurrentState) => R {
12
- return state => {
13
- switch (state.type) {
14
- case 'MSISDNEntry':
15
- return msisdnEntry(state.result)
16
- }
17
- }
18
- }
19
-
20
- export default moFlowMatch;
@@ -1,20 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import {
3
- IMoRedirFlowCurrentState,
4
- MSISDNEntryFailure,
5
- MSISDNEntrySuccess,
6
- } from "../reducers/moRedirFlow/MoRedirTypes";
7
-
8
- function moRedirFlowMatch<R>(
9
- { msisdnEntry }:
10
- { msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R
11
- }): (state: IMoRedirFlowCurrentState) => R {
12
- return state => {
13
- switch (state.type) {
14
- case 'MSISDNEntry':
15
- return msisdnEntry(state.result)
16
- }
17
- }
18
- }
19
-
20
- export default moRedirFlowMatch;
@@ -1,20 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
-
3
- import { IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess, IOneClickCurrentState, SubscribeFailure, SubscribeSuccess } from "../reducers/oneClickFlow/OneClickTypes";
4
-
5
- function oneClickFlowMatch <R>(
6
- { getRedirectUrl, subscribe }:
7
- { getRedirectUrl: (rds: RDS.RemoteDataState<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>) => R
8
- , subscribe?: (rds: RDS.RemoteDataState<SubscribeFailure, SubscribeSuccess>) => R
9
- }): (state: IOneClickCurrentState) => R {
10
- return state => {
11
- switch (state.type) {
12
- case 'GET_REDIRECT_URL':
13
- return getRedirectUrl(state.result)
14
- case 'SUBCRIBE_AJAX':
15
- return subscribe(state.result)
16
- }
17
- }
18
- }
19
-
20
- export default oneClickFlowMatch;
@@ -1,25 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import {
3
- MSISDNEntryFailure,
4
- MSISDNEntrySuccess,
5
- PINEntryFailure, PINEntrySuccess,
6
- IPinFlowCurrentState,
7
- IMsisdnSumbitNextData
8
- } from "../reducers/pinFlow/PinTypes";
9
-
10
- function pinFlowMatch<R>(
11
- { msisdnEntry, pinEntry }:
12
- { msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R
13
- , pinEntry: (rds: RDS.RemoteDataState<PINEntryFailure, PINEntrySuccess>, nextData:IMsisdnSumbitNextData) => R
14
- }): (state: IPinFlowCurrentState) => R {
15
- return state => {
16
- switch (state.type) {
17
- case 'MSISDNEntry':
18
- return msisdnEntry(state.result)
19
- case 'PINEntry':
20
- return pinEntry(state.result, state.data)
21
- }
22
- }
23
- }
24
-
25
- export default pinFlowMatch;
@@ -1,51 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
-
3
- import { OPERATORSelectFlowIdentifySuccess, IStrategyCurrentState, IIdenyifyFlowByMsisdnSumbitNextData, IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess, IdentifyFlowOptionsResult } from '../reducers/strategy/StrategyTypes';
4
-
5
-
6
- function strategy<R>(
7
- {
8
- identifyFlowByOperatorSelect,
9
- identifyFlowByMsisdn,
10
- pinFlow,
11
- moFlow,
12
- moRedirFlow,
13
- oneClickFlow,
14
- click2smsFlow,
15
- ussdFlow
16
- }:
17
- {
18
- identifyFlowByOperatorSelect: (data: OPERATORSelectFlowIdentifySuccess) => R,
19
- identifyFlowByMsisdn: (rds: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>, nextData: IIdenyifyFlowByMsisdnSumbitNextData) => R,
20
- pinFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
21
- moFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
22
- moRedirFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
23
- oneClickFlow: (data: IdentifyFlowOptionsResult<"getRedirectUrlAction">) => R
24
- click2smsFlow: (data: IdentifyFlowOptionsResult<"loadOc2sms">) => R,
25
- ussdFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
26
- }): (state: IStrategyCurrentState) => R {
27
-
28
-
29
- return state => {
30
- switch (state.type) {
31
- case 'IDENTIFY_FLOW_BY_OPERATOR_SELECT':
32
- return identifyFlowByOperatorSelect(state.result);
33
- case 'IDENTIFY_FLOW_BY_MSISDN':
34
- return identifyFlowByMsisdn(state.result, state.nextData);
35
- case 'PIN':
36
- return pinFlow(state.result);
37
- case 'MO':
38
- return moFlow(state.result);
39
- case 'MO_REDIR':
40
- return moRedirFlow(state.result);
41
- case 'ONE_CLICK':
42
- return oneClickFlow(state.result);
43
- case 'CLICK2SMS':
44
- return click2smsFlow(state.result);
45
- case 'USSD':
46
- return ussdFlow(state.result);
47
- }
48
- }
49
- }
50
-
51
- export default strategy;
@@ -1,20 +0,0 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import {
3
- IUssdFlowCurrentState,
4
- MSISDNEntryFailure,
5
- MSISDNEntrySuccess,
6
- } from "../reducers/ussdFlow/UssdTypes";
7
-
8
- function ussdFlowMatch<R>(
9
- { msisdnEntry }:
10
- { msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R
11
- }): (state: IUssdFlowCurrentState) => R {
12
- return state => {
13
- switch (state.type) {
14
- case 'MSISDNEntry':
15
- return msisdnEntry(state.result)
16
- }
17
- }
18
- }
19
-
20
- export default ussdFlowMatch;
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- // import * as clients from "./clients"
2
-
3
- // export default {clients}