ouisys-engine 3.0.3 → 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 +38 -38
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -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 +2 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +78 -78
  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 -219
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  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 -376
  180. package/src/reducers/strategy/index.ts +0 -322
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -366
  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,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,376 +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
- | "pin-combo-ask-mobile-number";
90
-
91
- export interface IHash {
92
- [key: string]: string
93
- }
94
-
95
- export type IDENTIFYMSISDNEntryErrorTypes =
96
- | "AlreadySubscribed"
97
- | "UnknownError"
98
- | "InvalidMSISDN";
99
-
100
- export type IDENTIFYMSISDNEntryFailure = {
101
- errorType: IDENTIFYMSISDNEntryErrorTypes;
102
- error: any;
103
- };
104
-
105
-
106
- export type IdentifyFlowOptionsResult<F> = {
107
- config:IConfig;
108
- nextAction:F;
109
- msisdn?:string;
110
- operator?:string;
111
- subscription_url?:string;
112
- redirect_url?:string;
113
- rockman_id?:string;
114
- isHeaderEnrichmentSuccess?:boolean;
115
- autoRedirect?:boolean;
116
- isUseMsisdnPrefix?: boolean;
117
- }
118
-
119
-
120
- export type IDENTIFYMSISDNEntrySuccess = { };
121
- export type OPERATORSelectFailure = { };
122
- export type OPERATORSelectSuccess = IdentifyFlowOptionsResult<"submitMSISDNAction" | "loadOc2sms">;
123
-
124
-
125
- export type IDETECTYOPERATOBYIPFailure = { };
126
- export type IDETECTYOPERATOBYIPSuccess = IdentifyFlowOptionsResult<"getRedirectUrlAction">
127
-
128
-
129
-
130
- export type IDENTIFY_OPERATOR_MSISDNEntrySuccess = IdentifyFlowOptionsResult<"submitMSISDNAction">
131
-
132
- export type IDENTIFY_FLOW_HESuccess = IdentifyFlowOptionsResult<"subscribeAction">
133
-
134
- export type OPERATORSelectFlowIdentifyFailure = { };
135
- export type OPERATORSelectFlowIdentifySuccess = {
136
- operators:Array<string>;
137
- msisdn?:string;
138
- nextAction:"selectOperator"
139
- };
140
- export type IDENTIFYFailure = {}
141
-
142
- export type IDENTIFYSuccess = {}
143
-
144
- export type IOperatorSelectFlowIdentifyPayload = {
145
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT"
146
- result: RDS.RemoteDataState<OPERATORSelectFlowIdentifyFailure, OPERATORSelectFlowIdentifySuccess>;
147
- }
148
-
149
-
150
- // export type IIdentifyByIPPayload= {
151
- // type:"IDENTIFY_FLOW_BY_IP"
152
- // result: RDS.RemoteDataState<IDENTIFYBYIPFailure, IDENTIFYBYIPSuccess>;
153
- // }
154
-
155
-
156
-
157
- export type IDetectOperatorByIpPayload = {
158
- type: "DETECT_OPERATOR_BY_IP",
159
- result:RDS.RemoteDataState<IDETECTYOPERATOBYIPFailure, IDETECTYOPERATOBYIPSuccess>;
160
- }
161
-
162
-
163
- export type IPossibleFlows = "PIN" | "MO" | "MO_REDIR" | "ONE_CLICK" | "CLICK2SMS" | "USSD" | "TPAY_HE";
164
- export type IOperatorSelectPayload = {
165
- type: IPossibleFlows,
166
- result:OPERATORSelectSuccess;
167
- }
168
-
169
-
170
-
171
- export type ISubmitMsisdnPayload = {
172
- type: IPossibleFlows;
173
- result:IDENTIFY_OPERATOR_MSISDNEntrySuccess;
174
- }
175
-
176
- export type IIdentifyFlowByIpOperatorPayload = {
177
- type: IPossibleFlows;
178
- result:IDENTIFY_OPERATOR_MSISDNEntrySuccess;
179
- }
180
-
181
- export type IIdentifyFlowByHePayload = {
182
- type: IPossibleFlows;
183
- result:IDENTIFY_FLOW_HESuccess;
184
- }
185
-
186
- export type IIdentfyFlowByMsisdnNextAction = "submitMSISDNAction" | "loadOc2sms";
187
- export type IIdentfyFlowByOperatorNextAction = "submitMSISDNAction" | "loadOc2sms";
188
- export type IIdentfyFlowByIPOperatorNextAction = "getRedirectUrlAction" | "submitMSISDNAction";
189
-
190
-
191
- export type IIdenyifyFlowByMsisdnSumbitNextData = {
192
- nextAction:IIdentfyFlowByMsisdnNextAction
193
- }
194
-
195
-
196
- export type IIdenyifyFlowByMsisdnPayload = {
197
- type:"IDENTIFY_FLOW_BY_MSISDN";
198
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
199
- data:IIdenyifyFlowByMsisdnSumbitNextData;
200
- }
201
-
202
- export type IIdenyifyStrategyPayload = {
203
- type:"IDENTIFY_FLOW_BY_MSISDN";
204
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
205
- data:IIdenyifyFlowByMsisdnSumbitNextData;
206
- }
207
-
208
-
209
- export type IStrategyActions =
210
-
211
- {
212
- type: "IDENTIFY_STRATEGY",
213
- payload:IIdenyifyStrategyPayload;
214
- }
215
- |
216
- {
217
- type: "DETECT_OPERATOR_BY_IP",
218
- payload:IDetectOperatorByIpPayload;
219
-
220
- }
221
- |
222
- {
223
- type: "HE_IDENTIFY",
224
- payload:IIdenyifyStrategyPayload
225
- }
226
- |
227
- {
228
- type: "IDENTIFY_FLOW_BY_OPERATOR_SELECT";
229
- payload:IOperatorSelectFlowIdentifyPayload;
230
-
231
- }
232
- |
233
- {
234
- type: "IDENTIFY_FLOW_BY_IP";
235
- payload:IIdentifyFlowByIpOperatorPayload;
236
-
237
- }
238
- |
239
- {
240
- type: "OPERATOR_SELECT";
241
- payload:IOperatorSelectPayload;
242
- }
243
- |
244
- {
245
- type:"IDENTIFY_FLOW_BY_MSISDN",
246
- payload:IIdenyifyFlowByMsisdnPayload,
247
- }
248
-
249
- |
250
-
251
- {
252
- type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
253
- payload:ISubmitMsisdnPayload,
254
- }
255
-
256
- |
257
-
258
- {
259
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
260
- payload:IIdentifyFlowByIpOperatorPayload,
261
- }
262
- |
263
- {
264
- type: "IDENTIFY_FLOW_BY_HE",
265
- payload:IIdentifyFlowByHePayload,
266
- }
267
- |
268
- {
269
- type:"MOCK_STRATEGY_STATE",
270
- payload:any
271
- }
272
-
273
- export type IStrategyCurrentState =
274
- {
275
- type:"IDENTIFY_STRATEGY";
276
- result:RDS.RemoteDataState<IDENTIFYFailure, IDENTIFYSuccess>;
277
- }
278
- |
279
- {
280
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT"
281
- result: OPERATORSelectFlowIdentifySuccess;
282
- }
283
- |
284
- {
285
- type: "DETECT_OPERATOR_BY_IP";
286
- result: RDS.RemoteDataState<IDETECTYOPERATOBYIPFailure, IDETECTYOPERATOBYIPSuccess>;
287
- }
288
- |
289
- {
290
- type: "HE_IDENTIFY",
291
- result:RDS.RemoteDataState<IDENTIFYFailure, IDENTIFYSuccess>;
292
- }
293
- |
294
- {
295
- type: "OPERATOR_SELECT";
296
- result: RDS.RemoteDataState<OPERATORSelectFailure, OPERATORSelectSuccess>;
297
- config:IConfig;
298
- }
299
- |
300
- {
301
- type:"IDENTIFY_FLOW_BY_MSISDN",
302
- result: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>;
303
- nextData:IIdenyifyFlowByMsisdnSumbitNextData;
304
-
305
- }
306
- |
307
- {
308
- type: "PIN";
309
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
310
- }
311
- |
312
- {
313
- type: "MO";
314
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
315
- }
316
- |
317
- {
318
- type: "USSD";
319
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
320
- }
321
- |
322
- {
323
- type: "MO_REDIR";
324
- result: IdentifyFlowOptionsResult<"submitMSISDNAction">;
325
- }
326
- |
327
- {
328
- type: "ONE_CLICK";
329
- result: IdentifyFlowOptionsResult<"getRedirectUrlAction">;
330
- }
331
- |
332
- {
333
- type: "CLICK2SMS";
334
- result: IdentifyFlowOptionsResult<"loadOc2sms">;
335
- }
336
- |
337
- {
338
- type: "TPAY_HE";
339
- result: IdentifyFlowOptionsResult<"loadTpayAction">;
340
- }
341
-
342
-
343
-
344
- export type IStrategyReducerState = {
345
- currentState:IStrategyCurrentState
346
- }
347
-
348
- export type IStrategyActionMaps = {
349
- selectOperator:(operator:string)=>AppThunk;
350
- submitMSISDNAction:(msisdn:string)=>AppThunk;
351
- loadOc2sms:()=>AppThunk;
352
- }
353
-
354
- export type IStrategyIDentifyUserResult = {
355
- success:true;
356
- rockman_id: string;
357
- msisdn:string;
358
- operator?:string;
359
- subscription_url?:string;
360
- redirect_url?:string;
361
- "redirect-back"?:string;
362
- } |
363
- {
364
- success: false;
365
- rockman_id: string;
366
- message: string;
367
- "redirect-back"?:string;
368
- }
369
-
370
-
371
- export type IMockFlows = "pin" | "mo" | "oneclick" | "click2sms" | "moredir" | "ussd" | "tpay";
372
-
373
- export interface IMockFlowParams<T> {
374
- "mock-flow":IMockFlows;
375
- "current-state":T;
376
- }