ouisys-engine 3.0.2 → 3.0.6

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 (198) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.nvmrc +1 -1
  4. package/.prettierignore +2 -1
  5. package/README.md +2 -4
  6. package/dist/api/index.d.ts +5 -5
  7. package/dist/api/index.js +76 -76
  8. package/dist/common-types/AppThunk.d.ts +11 -12
  9. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  10. package/dist/common-types/ITracker.js +1 -2
  11. package/dist/common-types/RemoteDataState.d.ts +4 -4
  12. package/dist/common-types/RemoteDataState.js +17 -17
  13. package/dist/flows/click2smsFlow.d.ts +2 -2
  14. package/dist/flows/moFlow.d.ts +2 -2
  15. package/dist/flows/moRedirFlow.d.ts +2 -2
  16. package/dist/flows/oneClickFlow.d.ts +2 -2
  17. package/dist/flows/pinFlow.d.ts +2 -2
  18. package/dist/flows/pinFlow.js +2 -0
  19. package/dist/flows/strategy.d.ts +8 -8
  20. package/dist/flows/ussdFlow.d.ts +2 -2
  21. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  22. package/dist/ips/tryGetIPRangeName.js +7 -5
  23. package/dist/jest.config.js +1 -1
  24. package/dist/pacman/index.d.ts +2 -2
  25. package/dist/pacman/index.js +41 -41
  26. package/dist/pacman/queryString.js +11 -9
  27. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  28. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  29. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  30. package/dist/reducers/click2smsFlow/index.js +24 -24
  31. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  32. package/dist/reducers/click2smsFlow/utils.js +30 -30
  33. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  34. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  35. package/dist/reducers/moFlow/index.d.ts +3 -3
  36. package/dist/reducers/moFlow/index.js +27 -27
  37. package/dist/reducers/moFlow/utils.d.ts +1 -2
  38. package/dist/reducers/moFlow/utils.js +28 -26
  39. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  40. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  41. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  42. package/dist/reducers/moRedirFlow/index.js +27 -27
  43. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  44. package/dist/reducers/moRedirFlow/utils.js +17 -17
  45. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  46. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  47. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  48. package/dist/reducers/oneClickFlow/index.js +75 -68
  49. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  50. package/dist/reducers/oneClickFlow/utils.js +70 -69
  51. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  52. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  53. package/dist/reducers/pinFlow/index.d.ts +3 -3
  54. package/dist/reducers/pinFlow/index.js +76 -76
  55. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  56. package/dist/reducers/pinFlow/utils.js +61 -65
  57. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  58. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  59. package/dist/reducers/strategy/index.d.ts +2 -2
  60. package/dist/reducers/strategy/index.js +99 -99
  61. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
  62. package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
  63. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  65. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  67. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  69. package/dist/reducers/strategy/utils.d.ts +3 -3
  70. package/dist/reducers/strategy/utils.js +115 -111
  71. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  72. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  73. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  74. package/dist/reducers/ussdFlow/index.js +27 -27
  75. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  76. package/dist/reducers/ussdFlow/utils.js +19 -17
  77. package/dist/store/index.d.ts +8 -8
  78. package/dist/store/index.js +87 -83
  79. package/dist/store/reducers.d.ts +7 -7
  80. package/dist/store/reducers.js +4 -4
  81. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  82. package/dist/utilities/handleSubmitNumber.js +15 -18
  83. package/dist/utilities/index.d.ts +1 -1
  84. package/dist/utilities/index.js +13 -11
  85. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  86. package/index.html +21 -28
  87. package/package.json +23 -15
  88. package/setupJest.js +1 -1
  89. package/tsconfig.json +2 -2
  90. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  91. package/.idea/modules.xml +0 -8
  92. package/.idea/ouisys-engine.iml +0 -12
  93. package/.idea/vcs.xml +0 -6
  94. package/.vscode/settings.json +0 -6
  95. package/dist/api/click2sms.js +0 -357
  96. package/dist/api/mo.js +0 -274
  97. package/dist/api/moRedir.js +0 -186
  98. package/dist/api/oneClick.js +0 -366
  99. package/dist/api/pin.js +0 -493
  100. package/dist/api/strategies.js +0 -704
  101. package/dist/api/ussd.js +0 -1
  102. package/dist/app/store.js +0 -35
  103. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  104. package/dist/features/strategies/categories/askOperator.js +0 -311
  105. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  106. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  107. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  108. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  109. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  110. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  111. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  112. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  113. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  114. package/dist/features/strategies/identifySlice.js +0 -455
  115. package/dist/features/strategies/moFlowSlice.js +0 -196
  116. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  117. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  118. package/dist/features/strategies/pinFlowSlice.js +0 -313
  119. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  120. package/dist/flows/tpayHeFlow.d.ts +0 -7
  121. package/dist/flows/tpayHeFlow.js +0 -23
  122. package/dist/mockServer/browser.js +0 -48
  123. package/dist/mockServer/handlers.js +0 -22
  124. package/dist/mockServer/server.js +0 -48
  125. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  126. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  127. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  128. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  129. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  130. package/dist/reducers/tpayHeFlow/index.js +0 -331
  131. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  132. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  133. package/dist/test/setup.js +0 -24
  134. package/dist/test/test-utils.js +0 -51
  135. package/mockData/config.json +0 -28
  136. package/prettier.config.js +0 -7
  137. package/src/@types/react-tracker.d.ts +0 -16
  138. package/src/@types/redux-cli-logger.d.ts +0 -1
  139. package/src/@types/tiny-async-pool.d.ts +0 -3
  140. package/src/@types/window.d.ts +0 -74
  141. package/src/api/index.ts +0 -225
  142. package/src/common-types/AppThunk.ts +0 -19
  143. package/src/common-types/Either.ts +0 -3
  144. package/src/common-types/IError.ts +0 -5
  145. package/src/common-types/IOptInFlowName.ts +0 -1
  146. package/src/common-types/ITracker.ts +0 -10
  147. package/src/common-types/IVisitor.ts +0 -16
  148. package/src/common-types/RemoteDataState.ts +0 -88
  149. package/src/flows/click2smsFlow.ts +0 -18
  150. package/src/flows/moFlow.ts +0 -20
  151. package/src/flows/moRedirFlow.ts +0 -20
  152. package/src/flows/oneClickFlow.ts +0 -20
  153. package/src/flows/pinFlow.ts +0 -25
  154. package/src/flows/strategy.ts +0 -51
  155. package/src/flows/ussdFlow.ts +0 -20
  156. package/src/index.ts +0 -3
  157. package/src/ips/tryGetIPRangeName.ts +0 -22
  158. package/src/jest.config.js +0 -194
  159. package/src/pacman/index.ts +0 -71
  160. package/src/pacman/queryString.ts +0 -24
  161. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  162. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  163. package/src/reducers/click2smsFlow/index.ts +0 -105
  164. package/src/reducers/click2smsFlow/utils.ts +0 -126
  165. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  166. package/src/reducers/moFlow/MoTypes.ts +0 -125
  167. package/src/reducers/moFlow/index.ts +0 -150
  168. package/src/reducers/moFlow/utils.ts +0 -135
  169. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  170. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  171. package/src/reducers/moRedirFlow/index.ts +0 -137
  172. package/src/reducers/moRedirFlow/utils.ts +0 -78
  173. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  174. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  175. package/src/reducers/oneClickFlow/index.ts +0 -268
  176. package/src/reducers/oneClickFlow/utils.ts +0 -217
  177. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  178. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  179. package/src/reducers/pinFlow/index.ts +0 -331
  180. package/src/reducers/pinFlow/utils.ts +0 -232
  181. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  182. package/src/reducers/strategy/StrategyTypes.ts +0 -375
  183. package/src/reducers/strategy/index.ts +0 -321
  184. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
  185. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  186. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  187. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  188. package/src/reducers/strategy/utils.ts +0 -357
  189. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  190. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  191. package/src/reducers/ussdFlow/index.ts +0 -146
  192. package/src/reducers/ussdFlow/utils.ts +0 -88
  193. package/src/store/index.ts +0 -150
  194. package/src/store/reducers.ts +0 -37
  195. package/src/utilities/handleSubmitNumber.ts +0 -65
  196. package/src/utilities/index.ts +0 -114
  197. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  198. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,232 +0,0 @@
1
- import { IConfig, IHash, SingleMSISDNSubmissionResult, MultiOperatorMSISDNSubmissionResult, IMSISDNSubmissionResult, IPINSubmissionResult, ICheckSubscriptionResult, IPinFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess, PINEntryFailure, PINEntrySuccess, IPinFlowReducerState, IMcpShieldResult } from "./PinTypes";
2
- import IError from "../../common-types/IError";
3
- import * as RDS from "../../common-types/RemoteDataState";
4
- import { identifyUser, left, loop, right } from "../strategy/utils";
5
- import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
6
-
7
-
8
- export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string,extraParams?: IHash): Promise<SingleMSISDNSubmissionResult | MultiOperatorMSISDNSubmissionResult> {
9
-
10
- const config: IConfig = {offer:window.pac_analytics.visitor.offer, ...(maybeConfig||{})}
11
- if(true == config.automaticallySubmitAllOperators && !!config.operators && config.operators.length > 0) {
12
- return submitMSISDNForMultipleOperators(window, config, internationalMSISDN, config.operators, extraParams)
13
- } else {
14
- return submitMSISDNOnce(window, config, internationalMSISDN, extraParams)
15
- }
16
- }
17
- const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
18
-
19
- let uniqidResult = "";
20
- export async function loadMcpShield(window: Window, config: IConfig): Promise<IMcpShieldResult> {
21
- const { slug, country, device, host } = config;
22
-
23
- const offer = window.pac_analytics.visitor.offer;
24
- const rockmanId = window.pac_analytics.visitor.rockmanId
25
-
26
- try{
27
-
28
- const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId)
29
- if(false == mcpShieldResult.success){
30
- console.warn(mcpShieldResult.message);
31
- }else{
32
- loadScriptInnerHtml(mcpShieldResult.source);
33
- uniqidResult = mcpShieldResult.uniqid;
34
- return mcpShieldResult
35
- }
36
- }catch(err){
37
- console.warn(err)
38
- }
39
- }
40
-
41
- async function submitMSISDNOnce(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: IHash): Promise<SingleMSISDNSubmissionResult> {
42
- if (!internationalMSISDN ) {
43
- const submissionError = new Error(`Error in submitMSISDN() trigger-pin action`) as IError & {type:string}
44
- submissionError['type'] = "InvalidMSISDN";
45
- throw submissionError
46
- }
47
-
48
- const msisdn = (!!extraParams && extraParams["skip-validation"] === "1") //Special case Digital Virgo sents encrypted msisdn we dont need to validate is
49
- ? internationalMSISDN : internationalMSISDN.match(/\d+/gi).join('') // tallyman API expects international msisdn without any special character
50
- const rockmanId = window.pac_analytics.visitor.rockmanId
51
-
52
- // HARDCODING This for now if the concerpt works we move this to configs
53
- const supportedSlugs:{[key:string]:string} = {
54
- "kuwait-agency-mix-gamezone-puzzle1":"kuwait-agency-mix-gamezone-puzzle1",
55
- "kuwait-agency-mix-yourspot-riddles":"kuwait-agency-mix-yourspot-riddles"
56
- }
57
-
58
- if(config.country.toLowerCase() == "k2" && supportedSlugs[config.slug]){
59
- const identifiedUser = await window.tallymanApi.identify(config.host, config.slug, config.country, msisdn, config.device, config.offer, rockmanId);
60
- if(identifiedUser.operator && identifiedUser.operator == "K2_ZAIN"){
61
- window.hostCountry = "KW";
62
- window.hostSlug = "kw-mt2-hosted-flow-mobfun";
63
- config.country = window.hostCountry;
64
- config.slug = window.hostSlug;
65
- }
66
- }
67
-
68
- const { slug, country, device, offer, host } = config;
69
-
70
-
71
-
72
-
73
- const search = (window.location.search.indexOf("redirect-back=1") == -1) ? (window.location.search.substr(1) || '') : ''
74
- const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
75
- const uniqid = (!!uniqidResult && uniqidResult != "") ? `&mcpUniqid=${uniqidResult}` : '';
76
-
77
-
78
- const result: IMSISDNSubmissionResult = await window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid)
79
- if (false === result.success) {
80
-
81
- const error = new Error(`Error in submitMSISDN() trigger-pin action:\n${result.message}`) as IError & {type:string; productUrl:string;}
82
- error['type'] = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "InvalidMSISDN";
83
- error['productUrl'] = result.product_url ? result.product_url : "";
84
- console.error(error)
85
- throw error
86
- } else {
87
-
88
- const kwCodesWithMcpShied:{[key:string]:{[key:string]:string}} = {
89
- kw:{
90
- kw_viva:"kw_viva"
91
- },
92
- k2:{
93
- k2_viva:"k2_viva"
94
- }
95
- }
96
- if(country && result.operator && (
97
- (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
98
- country.toLowerCase() == "iq"
99
- )
100
- ){
101
- try{
102
-
103
- const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId,result.operator, uniqid)
104
- if(false == mcpShieldResult.success){
105
- console.warn(mcpShieldResult.message);
106
- }else{
107
- loadScriptInnerHtml(mcpShieldResult.source);
108
- uniqidResult = mcpShieldResult.uniqid;
109
- }
110
- }catch(err){
111
- console.warn(err)
112
- }
113
- }
114
-
115
- return {
116
- type: "SingleMSISDNSubmissionResult",
117
- pin: result.pin,
118
- uniqidResult,
119
- operator:result.operator
120
- }
121
- }
122
- }
123
-
124
- async function submitMSISDNForMultipleOperators(window: Window, config: IConfig, internationalMSISDN: string, operators: string[], extraParams?: IHash): Promise<MultiOperatorMSISDNSubmissionResult> {
125
- const results = await Promise.all(operators.map(async o => {
126
- try {
127
- const singleResult = await submitMSISDNOnce(window, config, internationalMSISDN, { ...extraParams, operator: o })
128
- return right({...singleResult, operator: o})
129
- } catch (error) {
130
- return left(error)
131
- }
132
- }
133
- ))
134
-
135
- //@ts-ignore
136
- const alreadySubscribed = results.find(r => r.type == 'left' && r.value.type == 'AlreadySubscribed')
137
-
138
- if (results.every(r => r.type == 'left')) {
139
- // no submission worked
140
- throw results[0].value
141
- } else if (!!alreadySubscribed) {
142
- throw alreadySubscribed.value
143
- } else {
144
- return {
145
- type: "MultiOperatorMSISDNSubmissionResult"
146
- }
147
- }
148
- }
149
-
150
- export async function submitPIN(window:Window, pin: string, config:IConfig, extraParams:IHash): Promise<{productUrl:string; isAlreadySubscribed?:boolean;}> {
151
-
152
- if(window.hostCountry && window.hostSlug){
153
- config.country = window.hostCountry;
154
- config.slug = window.hostSlug;
155
- }
156
- const { slug, country, device, host } = config;
157
- const offer = window.pac_analytics.visitor.offer;
158
- const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
159
- const rockmanId = window.pac_analytics.visitor.rockmanId;
160
-
161
- if(!pin){
162
- const emptyPinError = new Error(`Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty`) as IError & {type:string}
163
- emptyPinError['type'] = "InvalidPIN";
164
- throw emptyPinError
165
- }
166
- const uniqid = uniqidResult != "" ? `&mcpUniqid=${uniqidResult}` : '';
167
- const evinaTid = (typeof window != "undefined" && window.tid) ? window.tid : "";
168
-
169
- const pinResult: IPINSubmissionResult = await window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid)
170
- if (false === pinResult.success) {
171
- const pinErrorTypeMap:{[key:string]:string} = {
172
- "pin does not match": "InvalidPIN",
173
- "mcp blocked": "SessionBlocked"
174
- }
175
- const errorMessage = pinErrorTypeMap[pinResult.message as string]
176
- const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${errorMessage}`) as IError & {type:string}
177
- pinError['type'] = errorMessage ? errorMessage : "InvalidPIN";
178
- throw pinError
179
- } else {
180
- if(true === pinResult.async) {
181
- const check : () => Promise<ICheckSubscriptionResult> = () => window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs)
182
-
183
- const checkResult: ICheckSubscriptionResult = await loop(
184
- check,
185
- 30,
186
- r => r.success,
187
- 0
188
- )
189
- if(true === checkResult.success) {
190
- const isAlreadySubscribed = (pinResult.message == "ALREADY SUBSCRIBED") ? true : false;
191
- return {productUrl:checkResult.product_url || null, isAlreadySubscribed}
192
- } else {
193
- const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${checkResult.message}`) as IError & {type:string}
194
- pinError['type'] = "InvalidPIN";
195
- throw pinError
196
- }
197
- } else {
198
- const isAlreadySubscribed = (pinResult.message == "ALREADY SUBSCRIBED") ? true : false;
199
- return {productUrl:pinResult.product_url || null, isAlreadySubscribed}
200
- }
201
- }
202
- }
203
-
204
- export const mockedPINState : IPinFlowReducerState = {
205
- currentState:{
206
- type: "PINEntry",
207
- result: RDS.NothingYet<PINEntryFailure, PINEntrySuccess>({finalUrl:""}),
208
- data:{
209
- actualPIN: "",
210
- nextAction: "submitPinAction",
211
- msisdn: ""
212
- }
213
- }
214
- }
215
-
216
- export const mockedCompletedState : IPinFlowReducerState = {
217
- currentState:{
218
- type: "PINEntry",
219
- result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"/mock-product-url"}),
220
- data:{
221
- actualPIN: "",
222
- nextAction: "submitPinAction",
223
- msisdn: ""
224
- }
225
- }
226
- }
227
- export const mockedMSISDNEntryFailure : IPinFlowReducerState = {
228
- currentState:{
229
- type: "MSISDNEntry",
230
- result: RDS.Failure<MSISDNEntryFailure, MSISDNEntrySuccess>({errorType: "InvalidMSISDN", error: "Invalid Mobile Number"})
231
- }
232
- }
@@ -1,17 +0,0 @@
1
- type IStategyActionContants =
2
- "IDENTIFY_FLOW_BY_OPERATOR_SELECT"
3
- | "IDENTIFY_STRATEGY"
4
- | "OPERATOR_SELECT"
5
- | "MSISDN_ENTRY_SUBMIT"
6
- | "IDENTIFY_FLOW_BY_MSISDN"
7
- | "IDENTIFY_FLOW_BY_MSISDN_SUBMIT"
8
- | "IDENTIFY_FLOW_BY_MSISDN_SUBMIT_ERROR"
9
- | "IDENTIFY_FLOW_BY_MSISDN_ERROR"
10
- | "DETECT_OPERATOR_BY_IP"
11
- | "IDENTIFY_FLOW_BY_IP_OPERATOR"
12
- | "CHECK_SUBSCRIPTION"
13
- | "HE_IDENTIFY"
14
- | "IDENTIFY_FLOW_BY_HE"
15
- | "MOCK_STRATEGY_STATE"
16
-
17
- export default IStategyActionContants
@@ -1,375 +0,0 @@
1
- import * as RDS from "../../common-types/RemoteDataState";
2
- import { AppThunk } from "../../common-types/AppThunk";
3
-
4
-
5
- export type IIdentifyResult = {
6
- operator: string;
7
- flow?: string;
8
- success: boolean;
9
- rockman_id?: string;
10
- message?:string;
11
- }
12
-
13
- export type ConfigDetails = {
14
- host: string;
15
- slug: string;
16
- country: string;
17
- device?: "smart" | "feature";
18
- queryString?:Array<[string, string]>
19
- automaticallySubmitAllOperators?: boolean;
20
- operators?: string[];
21
- service: string;
22
- offer?: number;
23
- };
24
-
25
- export type IConfig = {
26
- offer?: number,
27
- slug?: string;
28
- country?: string;
29
- host?:string;
30
- device?: "smart" | "feature";
31
- automaticallySubmitAllOperators?: boolean;
32
- operators?: string[];
33
- }
34
-
35
- export type ISupportedFlows = "pin" | "mo" | "oneClick" | "click2sms" | "moRedir" | "ussd" | "tpayHe";
36
- export type IFlow = {
37
- flow: ISupportedFlows;
38
- operator?:string;
39
- flowConfig:ConfigDetails;
40
- default?:IFlow;
41
- rockman_id?:string;
42
- }
43
-
44
- export type StrategyConfig = {
45
- operators:{
46
- [key:string]:IFlow;
47
- };
48
- default:IFlow;
49
- isUseMsisdnPrefix?:boolean;
50
- }
51
- // export type IStrategy = IPinStrategy | IMoStrategy;
52
-
53
-
54
- export type IStrategy = {
55
- strategy: IStrategyNames;
56
- country: string;
57
- strategyConfigs:StrategyConfig
58
- }
59
-
60
-
61
- export type IStrategyNames =
62
- "pin"
63
- | "mo"
64
- | "mo-redir"
65
- | "click2sms"
66
- | "one-click"
67
- | "ussd"
68
- | "tpay-he"
69
- | "tallyman-one-click"
70
- | "pin-mo-ask-operator"
71
- | "pin-mo-ask-mobile-number"
72
- | "pin-one-click-ask-operator"
73
- | "pin-one-click-detect-operator-by-ip"
74
- | "one-click-mo-pin-detect-operator-by-ip-or-msisdn"
75
- | "pin-click2sms-ask-operator"
76
- | "mo-redir-one-click-detect-operator-by-ip"
77
- | "pin-mo-redir-ask-mobile-number"
78
- | "pin-click2sms-ask-mobile-number"
79
- | "mo-one-click-detect-operator-by-ip"
80
- | "click2sms-one-click-detect-operator-by-ip"
81
- | "pin-header-enrichment"
82
- | "pin-msisdn-fowarding-pin-header-enrichment"
83
- | "he-pin-mo-redir-header-enrichment"
84
- | "he-pin-one-click-header-enrichment"
85
- | "he-pin-one-click-ask-operator"
86
- | "click2sms-one-click-ask-operator"
87
- | "pin-mo-detect-operator-by-ip"
88
- | "he-mo-redir-one-click-header-enrichment";
89
-
90
- export interface IHash {
91
- [key: string]: string
92
- }
93
-
94
- export type IDENTIFYMSISDNEntryErrorTypes =
95
- | "AlreadySubscribed"
96
- | "UnknownError"
97
- | "InvalidMSISDN";
98
-
99
- export type IDENTIFYMSISDNEntryFailure = {
100
- errorType: IDENTIFYMSISDNEntryErrorTypes;
101
- error: any;
102
- };
103
-
104
-
105
- export type IdentifyFlowOptionsResult<F> = {
106
- config:IConfig;
107
- nextAction:F;
108
- msisdn?:string;
109
- operator?:string;
110
- subscription_url?:string;
111
- redirect_url?:string;
112
- rockman_id?:string;
113
- isHeaderEnrichmentSuccess?:boolean;
114
- autoRedirect?:boolean;
115
- isUseMsisdnPrefix?: boolean;
116
- }
117
-
118
-
119
- export type IDENTIFYMSISDNEntrySuccess = { };
120
- export type OPERATORSelectFailure = { };
121
- export type OPERATORSelectSuccess = IdentifyFlowOptionsResult<"submitMSISDNAction" | "loadOc2sms">;
122
-
123
-
124
- export type IDETECTYOPERATOBYIPFailure = { };
125
- export type IDETECTYOPERATOBYIPSuccess = IdentifyFlowOptionsResult<"getRedirectUrlAction">
126
-
127
-
128
-
129
- export type IDENTIFY_OPERATOR_MSISDNEntrySuccess = IdentifyFlowOptionsResult<"submitMSISDNAction">
130
-
131
- export type IDENTIFY_FLOW_HESuccess = IdentifyFlowOptionsResult<"subscribeAction">
132
-
133
- export type OPERATORSelectFlowIdentifyFailure = { };
134
- export type OPERATORSelectFlowIdentifySuccess = {
135
- operators:Array<string>;
136
- msisdn?:string;
137
- nextAction:"selectOperator"
138
- };
139
- export type IDENTIFYFailure = {}
140
-
141
- export type IDENTIFYSuccess = {}
142
-
143
- export type IOperatorSelectFlowIdentifyPayload = {
144
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT"
145
- result: RDS.RemoteDataState<OPERATORSelectFlowIdentifyFailure, OPERATORSelectFlowIdentifySuccess>;
146
- }
147
-
148
-
149
- // export type IIdentifyByIPPayload= {
150
- // type:"IDENTIFY_FLOW_BY_IP"
151
- // result: RDS.RemoteDataState<IDENTIFYBYIPFailure, IDENTIFYBYIPSuccess>;
152
- // }
153
-
154
-
155
-
156
- export type IDetectOperatorByIpPayload = {
157
- type: "DETECT_OPERATOR_BY_IP",
158
- result:RDS.RemoteDataState<IDETECTYOPERATOBYIPFailure, IDETECTYOPERATOBYIPSuccess>;
159
- }
160
-
161
-
162
- export type IPossibleFlows = "PIN" | "MO" | "MO_REDIR" | "ONE_CLICK" | "CLICK2SMS" | "USSD" | "TPAY_HE";
163
- export type IOperatorSelectPayload = {
164
- type: IPossibleFlows,
165
- result:OPERATORSelectSuccess;
166
- }
167
-
168
-
169
-
170
- export type ISubmitMsisdnPayload = {
171
- type: IPossibleFlows;
172
- result:IDENTIFY_OPERATOR_MSISDNEntrySuccess;
173
- }
174
-
175
- export type IIdentifyFlowByIpOperatorPayload = {
176
- type: IPossibleFlows;
177
- result:IDENTIFY_OPERATOR_MSISDNEntrySuccess;
178
- }
179
-
180
- export type IIdentifyFlowByHePayload = {
181
- type: IPossibleFlows;
182
- result:IDENTIFY_FLOW_HESuccess;
183
- }
184
-
185
- export type IIdentfyFlowByMsisdnNextAction = "submitMSISDNAction" | "loadOc2sms";
186
- export type IIdentfyFlowByOperatorNextAction = "submitMSISDNAction" | "loadOc2sms";
187
- export type IIdentfyFlowByIPOperatorNextAction = "getRedirectUrlAction" | "submitMSISDNAction";
188
-
189
-
190
- export type IIdenyifyFlowByMsisdnSumbitNextData = {
191
- nextAction:IIdentfyFlowByMsisdnNextAction
192
- }
193
-
194
-
195
- export type IIdenyifyFlowByMsisdnPayload = {
196
- type:"IDENTIFY_FLOW_BY_MSISDN";
197
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
198
- data:IIdenyifyFlowByMsisdnSumbitNextData;
199
- }
200
-
201
- export type IIdenyifyStrategyPayload = {
202
- type:"IDENTIFY_FLOW_BY_MSISDN";
203
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
204
- data:IIdenyifyFlowByMsisdnSumbitNextData;
205
- }
206
-
207
-
208
- export type IStrategyActions =
209
-
210
- {
211
- type: "IDENTIFY_STRATEGY",
212
- payload:IIdenyifyStrategyPayload;
213
- }
214
- |
215
- {
216
- type: "DETECT_OPERATOR_BY_IP",
217
- payload:IDetectOperatorByIpPayload;
218
-
219
- }
220
- |
221
- {
222
- type: "HE_IDENTIFY",
223
- payload:IIdenyifyStrategyPayload
224
- }
225
- |
226
- {
227
- type: "IDENTIFY_FLOW_BY_OPERATOR_SELECT";
228
- payload:IOperatorSelectFlowIdentifyPayload;
229
-
230
- }
231
- |
232
- {
233
- type: "IDENTIFY_FLOW_BY_IP";
234
- payload:IIdentifyFlowByIpOperatorPayload;
235
-
236
- }
237
- |
238
- {
239
- type: "OPERATOR_SELECT";
240
- payload:IOperatorSelectPayload;
241
- }
242
- |
243
- {
244
- type:"IDENTIFY_FLOW_BY_MSISDN",
245
- payload:IIdenyifyFlowByMsisdnPayload,
246
- }
247
-
248
- |
249
-
250
- {
251
- type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
252
- payload:ISubmitMsisdnPayload,
253
- }
254
-
255
- |
256
-
257
- {
258
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
259
- payload:IIdentifyFlowByIpOperatorPayload,
260
- }
261
- |
262
- {
263
- type: "IDENTIFY_FLOW_BY_HE",
264
- payload:IIdentifyFlowByHePayload,
265
- }
266
- |
267
- {
268
- type:"MOCK_STRATEGY_STATE",
269
- payload:any
270
- }
271
-
272
- export type IStrategyCurrentState =
273
- {
274
- type:"IDENTIFY_STRATEGY";
275
- result:RDS.RemoteDataState<IDENTIFYFailure, IDENTIFYSuccess>;
276
- }
277
- |
278
- {
279
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT"
280
- result: OPERATORSelectFlowIdentifySuccess;
281
- }
282
- |
283
- {
284
- type: "DETECT_OPERATOR_BY_IP";
285
- result: RDS.RemoteDataState<IDETECTYOPERATOBYIPFailure, IDETECTYOPERATOBYIPSuccess>;
286
- }
287
- |
288
- {
289
- type: "HE_IDENTIFY",
290
- result:RDS.RemoteDataState<IDENTIFYFailure, IDENTIFYSuccess>;
291
- }
292
- |
293
- {
294
- type: "OPERATOR_SELECT";
295
- result: RDS.RemoteDataState<OPERATORSelectFailure, OPERATORSelectSuccess>;
296
- config:IConfig;
297
- }
298
- |
299
- {
300
- type:"IDENTIFY_FLOW_BY_MSISDN",
301
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
302
- nextData:IIdenyifyFlowByMsisdnSumbitNextData;
303
-
304
- }
305
- |
306
- {
307
- type: "PIN";
308
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
309
- }
310
- |
311
- {
312
- type: "MO";
313
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
314
- }
315
- |
316
- {
317
- type: "USSD";
318
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
319
- }
320
- |
321
- {
322
- type: "MO_REDIR";
323
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
324
- }
325
- |
326
- {
327
- type: "ONE_CLICK";
328
- result: IdentifyFlowOptionsResult<"getRedirectUrlAction">;
329
- }
330
- |
331
- {
332
- type: "CLICK2SMS";
333
- result: IdentifyFlowOptionsResult<"loadOc2sms">;
334
- }
335
- |
336
- {
337
- type: "TPAY_HE";
338
- result: IdentifyFlowOptionsResult<"loadTpayAction">;
339
- }
340
-
341
-
342
-
343
- export type IStrategyReducerState = {
344
- currentState:IStrategyCurrentState
345
- }
346
-
347
- export type IStrategyActionMaps = {
348
- selectOperator:(operator:string)=>AppThunk;
349
- submitMSISDNAction:(msisdn:string)=>AppThunk;
350
- loadOc2sms:()=>AppThunk;
351
- }
352
-
353
- export type IStrategyIDentifyUserResult = {
354
- success:true;
355
- rockman_id: string;
356
- msisdn:string;
357
- operator?:string;
358
- subscription_url?:string;
359
- redirect_url?:string;
360
- "redirect-back"?:string;
361
- } |
362
- {
363
- success: false;
364
- rockman_id: string;
365
- message: string;
366
- "redirect-back"?:string;
367
- }
368
-
369
-
370
- export type IMockFlows = "pin" | "mo" | "oneclick" | "click2sms" | "moredir" | "ussd" | "tpay";
371
-
372
- export interface IMockFlowParams<T> {
373
- "mock-flow":IMockFlows;
374
- "current-state":T;
375
- }