ouisys-engine 2.1.13 → 2.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jest.config.js +194 -0
- package/dist/reducers/pinFlow/index.js +86 -70
- package/dist/reducers/pinFlow/utils.js +18 -13
- package/dist/{__tests__/index.test.d.ts → reducers/strategy/__tests__/strategy.spec.d.ts} +0 -0
- package/dist/reducers/strategy/__tests__/strategy.spec.js +33 -0
- package/dist/reducers/strategy/index.js +161 -150
- package/dist/reducers/strategy/utils.js +6 -5
- package/dist/store/index.d.ts +2 -2
- package/dist/test/renderWithRouterAndUserMock.d.ts +21 -0
- package/dist/test/renderWithRouterAndUserMock.js +40 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +24 -0
- package/mockData/config.json +28 -0
- package/package.json +32 -9
- package/prettier.config.js +7 -0
- package/setupJest.js +6 -0
- package/src/@types/window.d.ts +1 -0
- package/src/jest.config.js +194 -0
- package/src/reducers/pinFlow/index.ts +21 -3
- package/src/reducers/pinFlow/utils.ts +11 -1
- package/src/reducers/strategy/index.ts +2 -2
- package/src/reducers/strategy/utils.ts +2 -2
- package/src/store/index.ts +1 -1
- package/dist/__tests__/domMocker.js +0 -31
- package/dist/__tests__/index.test.js +0 -95
- package/dist/__tests__/strategy.test.d.ts +0 -1
- package/dist/__tests__/strategy.test.js +0 -51
- package/src/__tests__/domMocker.js +0 -31
- package/src/__tests__/index.test.tsx +0 -36
- package/src/__tests__/strategy.test.ts +0 -55
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
+
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
// All imported modules in your tests should be mocked automatically
|
|
6
|
+
// automock: false,
|
|
7
|
+
|
|
8
|
+
// Stop running tests after `n` failures
|
|
9
|
+
// bail: 0,
|
|
10
|
+
|
|
11
|
+
// The directory where Jest should store its cached dependency information
|
|
12
|
+
// cacheDirectory: "/private/var/folders/wr/8ghl3gfx0cldjmd7jhzs8gt80000gn/T/jest_dx",
|
|
13
|
+
|
|
14
|
+
// Automatically clear mock calls and instances between every test
|
|
15
|
+
clearMocks: true
|
|
16
|
+
|
|
17
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
18
|
+
// collectCoverage: false,
|
|
19
|
+
|
|
20
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
21
|
+
// collectCoverageFrom: undefined,
|
|
22
|
+
|
|
23
|
+
// The directory where Jest should output its coverage files
|
|
24
|
+
coverageDirectory: 'coverage',
|
|
25
|
+
|
|
26
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
27
|
+
// coveragePathIgnorePatterns: [
|
|
28
|
+
// "/node_modules/"
|
|
29
|
+
// ],
|
|
30
|
+
|
|
31
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
32
|
+
// coverageProvider: 'babel',
|
|
33
|
+
|
|
34
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
35
|
+
// coverageReporters: [
|
|
36
|
+
// "json",
|
|
37
|
+
// "text",
|
|
38
|
+
// "lcov",
|
|
39
|
+
// "clover"
|
|
40
|
+
// ],
|
|
41
|
+
|
|
42
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
43
|
+
// coverageThreshold: undefined,
|
|
44
|
+
|
|
45
|
+
// A path to a custom dependency extractor
|
|
46
|
+
// dependencyExtractor: undefined,
|
|
47
|
+
|
|
48
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
49
|
+
// errorOnDeprecated: false,
|
|
50
|
+
|
|
51
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
52
|
+
// forceCoverageMatch: [],
|
|
53
|
+
|
|
54
|
+
collectCoverageFrom: [
|
|
55
|
+
'src/**/*.{js,ts,tsx}',
|
|
56
|
+
'!src/serviceWorker.{ts,js}',
|
|
57
|
+
'!src/storybook/**',
|
|
58
|
+
'!src/mockServer/**'
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
moduleDirectories: ['node_modules', 'test', __dirname],
|
|
75
|
+
|
|
76
|
+
// An array of file extensions your modules use
|
|
77
|
+
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'svg', 'node'],
|
|
78
|
+
|
|
79
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
80
|
+
moduleNameMapper: {
|
|
81
|
+
'.+\\.(css|scss|png)$': 'identity-obj-proxy'
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
85
|
+
// modulePathIgnorePatterns: [],
|
|
86
|
+
|
|
87
|
+
// Activates notifications for test results
|
|
88
|
+
// notify: false,
|
|
89
|
+
|
|
90
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
91
|
+
// notifyMode: "failure-change",
|
|
92
|
+
|
|
93
|
+
// A preset that is used as a base for Jest's configuration
|
|
94
|
+
// preset: undefined,
|
|
95
|
+
|
|
96
|
+
// Run tests from one or more projects
|
|
97
|
+
// projects: undefined,
|
|
98
|
+
|
|
99
|
+
// Use this configuration option to add custom reporters to Jest
|
|
100
|
+
// reporters: undefined,
|
|
101
|
+
|
|
102
|
+
// Automatically reset mock state between every test
|
|
103
|
+
resetMocks: true,
|
|
104
|
+
|
|
105
|
+
// Reset the module registry before running each individual test
|
|
106
|
+
// resetModules: false,
|
|
107
|
+
|
|
108
|
+
// A path to a custom resolver
|
|
109
|
+
// resolver: undefined,
|
|
110
|
+
|
|
111
|
+
// Automatically restore mock state between every test
|
|
112
|
+
// restoreMocks: false,
|
|
113
|
+
|
|
114
|
+
// The root directory that Jest should scan for tests and modules within
|
|
115
|
+
// rootDir: undefined,
|
|
116
|
+
|
|
117
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
118
|
+
roots: ['<rootDir>/src'],
|
|
119
|
+
|
|
120
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
121
|
+
// runner: "jest-runner",
|
|
122
|
+
|
|
123
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
124
|
+
// setupFiles: ['<rootDir>/src/test/setup.ts', 'jest-localstorage-mock'],
|
|
125
|
+
|
|
126
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
127
|
+
// setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
128
|
+
|
|
129
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
130
|
+
// slowTestThreshold: 5,
|
|
131
|
+
|
|
132
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
133
|
+
// snapshotSerializers: [],
|
|
134
|
+
|
|
135
|
+
// The test environment that will be used for testing
|
|
136
|
+
testEnvironment: 'jest-environment-jsdom',
|
|
137
|
+
|
|
138
|
+
// Options that will be passed to the testEnvironment
|
|
139
|
+
// testEnvironmentOptions: {},
|
|
140
|
+
|
|
141
|
+
// Adds a location field to test results
|
|
142
|
+
// testLocationInResults: false,
|
|
143
|
+
|
|
144
|
+
// The glob patterns Jest uses to detect test files
|
|
145
|
+
// testMatch: [
|
|
146
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
147
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
148
|
+
// ],
|
|
149
|
+
|
|
150
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
151
|
+
// testPathIgnorePatterns: [
|
|
152
|
+
// "/node_modules/"
|
|
153
|
+
// ],
|
|
154
|
+
|
|
155
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
156
|
+
testRegex: '(\\.|/)(test|spec)\\.tsx?$',
|
|
157
|
+
|
|
158
|
+
// This option allows the use of a custom results processor
|
|
159
|
+
// testResultsProcessor: undefined,
|
|
160
|
+
|
|
161
|
+
// This option allows use of a custom test runner
|
|
162
|
+
// testRunner: "jasmine2",
|
|
163
|
+
|
|
164
|
+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
|
|
165
|
+
// testURL: "http://localhost",
|
|
166
|
+
|
|
167
|
+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
|
|
168
|
+
// timers: "real",
|
|
169
|
+
|
|
170
|
+
// A map from regular expressions to paths to transformers
|
|
171
|
+
transform: {
|
|
172
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
173
|
+
'^.+\\.jsx?$': 'ts-jest'
|
|
174
|
+
// '^.+\\.svg$': '<rootDir>/src/test/svgTransformer.js'
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
178
|
+
// transformIgnorePatterns: [
|
|
179
|
+
// "/node_modules/",
|
|
180
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
181
|
+
// ],
|
|
182
|
+
|
|
183
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
184
|
+
// unmockedModulePathPatterns: undefined,
|
|
185
|
+
|
|
186
|
+
// Indicates whether each individual test should be reported during the run
|
|
187
|
+
// verbose: undefined,
|
|
188
|
+
|
|
189
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
190
|
+
// watchPathIgnorePatterns: [],
|
|
191
|
+
|
|
192
|
+
// Whether to use watchman for file crawling
|
|
193
|
+
// watchman: true,
|
|
194
|
+
};
|
|
@@ -8,10 +8,16 @@ require("core-js/modules/es.symbol.description");
|
|
|
8
8
|
|
|
9
9
|
require("core-js/modules/es.symbol.iterator");
|
|
10
10
|
|
|
11
|
+
require("core-js/modules/es.array.filter");
|
|
12
|
+
|
|
11
13
|
require("core-js/modules/es.array.iterator");
|
|
12
14
|
|
|
13
15
|
require("core-js/modules/es.object.get-own-property-descriptor");
|
|
14
16
|
|
|
17
|
+
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.object.keys");
|
|
20
|
+
|
|
15
21
|
require("core-js/modules/es.object.to-string");
|
|
16
22
|
|
|
17
23
|
require("core-js/modules/es.promise");
|
|
@@ -20,6 +26,8 @@ require("core-js/modules/es.string.iterator");
|
|
|
20
26
|
|
|
21
27
|
require("core-js/modules/es.weak-map");
|
|
22
28
|
|
|
29
|
+
require("core-js/modules/web.dom-collections.for-each");
|
|
30
|
+
|
|
23
31
|
require("core-js/modules/web.dom-collections.iterator");
|
|
24
32
|
|
|
25
33
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -45,6 +53,12 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
45
53
|
|
|
46
54
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
55
|
|
|
56
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
57
|
+
|
|
58
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
59
|
+
|
|
60
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
|
+
|
|
48
62
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
49
63
|
|
|
50
64
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -53,15 +67,16 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
53
67
|
function submitMSISDNAction(msisdn, extraParams) {
|
|
54
68
|
return /*#__PURE__*/function () {
|
|
55
69
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, store) {
|
|
56
|
-
var currentState, config, pinMaxLengthByOp, msisdnSubmissionResult, operator, errorType;
|
|
70
|
+
var currentState, pinFlowCurrentState, config, pinMaxLengthByOp, msisdnSubmissionResult, operator, errorType;
|
|
57
71
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58
72
|
while (1) {
|
|
59
73
|
switch (_context.prev = _context.next) {
|
|
60
74
|
case 0:
|
|
61
75
|
currentState = store().strategy.currentState;
|
|
76
|
+
pinFlowCurrentState = store().pinFlow.currentState;
|
|
62
77
|
|
|
63
78
|
if (!(currentState.type === "PIN")) {
|
|
64
|
-
_context.next =
|
|
79
|
+
_context.next = 25;
|
|
65
80
|
break;
|
|
66
81
|
}
|
|
67
82
|
|
|
@@ -71,31 +86,31 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
71
86
|
"SA_STC": 4,
|
|
72
87
|
"SA_ZAIN": 6
|
|
73
88
|
};
|
|
74
|
-
_context.prev =
|
|
89
|
+
_context.prev = 5;
|
|
75
90
|
dispatch({
|
|
76
91
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
77
|
-
payload: {
|
|
92
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
78
93
|
type: "MSISDNEntry",
|
|
79
94
|
result: RDS.Loading()
|
|
80
|
-
}
|
|
95
|
+
})
|
|
81
96
|
});
|
|
82
97
|
|
|
83
98
|
_strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', {
|
|
84
99
|
msisdn: msisdn
|
|
85
100
|
});
|
|
86
101
|
|
|
87
|
-
_context.next =
|
|
102
|
+
_context.next = 10;
|
|
88
103
|
return (0, _utils.default)(window, config, msisdn, extraParams);
|
|
89
104
|
|
|
90
|
-
case
|
|
105
|
+
case 10:
|
|
91
106
|
msisdnSubmissionResult = _context.sent;
|
|
92
107
|
operator = msisdnSubmissionResult.type == "SingleMSISDNSubmissionResult" ? msisdnSubmissionResult.operator : "";
|
|
93
108
|
dispatch({
|
|
94
109
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
95
|
-
payload: {
|
|
110
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
96
111
|
type: "MSISDNEntry",
|
|
97
112
|
result: RDS.Success({})
|
|
98
|
-
}
|
|
113
|
+
})
|
|
99
114
|
});
|
|
100
115
|
|
|
101
116
|
_strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', {
|
|
@@ -104,7 +119,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
104
119
|
|
|
105
120
|
dispatch({
|
|
106
121
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
107
|
-
payload: {
|
|
122
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
108
123
|
type: "PINEntry",
|
|
109
124
|
result: RDS.NothingYet(),
|
|
110
125
|
data: {
|
|
@@ -114,14 +129,14 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
114
129
|
operator: operator,
|
|
115
130
|
pinMaxLength: operator != "" && pinMaxLengthByOp[operator] ? pinMaxLengthByOp[operator] : null
|
|
116
131
|
}
|
|
117
|
-
}
|
|
132
|
+
})
|
|
118
133
|
});
|
|
119
|
-
_context.next =
|
|
134
|
+
_context.next = 23;
|
|
120
135
|
break;
|
|
121
136
|
|
|
122
|
-
case
|
|
123
|
-
_context.prev =
|
|
124
|
-
_context.t0 = _context["catch"](
|
|
137
|
+
case 17:
|
|
138
|
+
_context.prev = 17;
|
|
139
|
+
_context.t0 = _context["catch"](5);
|
|
125
140
|
console.warn(_context.t0);
|
|
126
141
|
errorType = "AlreadySubscribed" === _context.t0.type ? "AlreadySubscribed" : "InvalidMSISDN" === _context.t0.type ? "InvalidMSISDN" : "UnknownError";
|
|
127
142
|
|
|
@@ -132,30 +147,30 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
132
147
|
|
|
133
148
|
dispatch({
|
|
134
149
|
type: "PIN_FLOW_MSISDN_SUBMIT_ERROR",
|
|
135
|
-
payload: {
|
|
150
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
136
151
|
type: "MSISDNEntry",
|
|
137
152
|
result: RDS.Failure({
|
|
138
153
|
errorType: errorType,
|
|
139
154
|
error: _context.t0,
|
|
140
155
|
productUrl: _context.t0.productUrl
|
|
141
156
|
})
|
|
142
|
-
}
|
|
157
|
+
})
|
|
143
158
|
});
|
|
144
159
|
|
|
145
|
-
case
|
|
146
|
-
_context.next =
|
|
160
|
+
case 23:
|
|
161
|
+
_context.next = 28;
|
|
147
162
|
break;
|
|
148
163
|
|
|
149
|
-
case
|
|
164
|
+
case 25:
|
|
150
165
|
dispatch({
|
|
151
166
|
type: "PIN_FLOW_MSISDN_SUBMIT_ERROR",
|
|
152
|
-
payload: {
|
|
167
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
153
168
|
type: "MSISDNEntry",
|
|
154
169
|
result: RDS.Failure({
|
|
155
170
|
errorType: "UnknownError",
|
|
156
171
|
error: null
|
|
157
172
|
})
|
|
158
|
-
}
|
|
173
|
+
})
|
|
159
174
|
});
|
|
160
175
|
|
|
161
176
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
@@ -165,12 +180,12 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
165
180
|
|
|
166
181
|
throw "Unexpected state";
|
|
167
182
|
|
|
168
|
-
case
|
|
183
|
+
case 28:
|
|
169
184
|
case "end":
|
|
170
185
|
return _context.stop();
|
|
171
186
|
}
|
|
172
187
|
}
|
|
173
|
-
}, _callee, null, [[
|
|
188
|
+
}, _callee, null, [[5, 17]]);
|
|
174
189
|
}));
|
|
175
190
|
|
|
176
191
|
return function (_x, _x2) {
|
|
@@ -182,20 +197,21 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
182
197
|
function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
183
198
|
return /*#__PURE__*/function () {
|
|
184
199
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, store) {
|
|
185
|
-
var currentState, config, msisdnSubmissionResult, errorType;
|
|
200
|
+
var currentState, pinFlowCurrentState, config, msisdnSubmissionResult, errorType;
|
|
186
201
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
187
202
|
while (1) {
|
|
188
203
|
switch (_context2.prev = _context2.next) {
|
|
189
204
|
case 0:
|
|
190
205
|
currentState = store().strategy.currentState;
|
|
206
|
+
pinFlowCurrentState = store().pinFlow.currentState;
|
|
191
207
|
|
|
192
208
|
if (!(currentState.type === "PIN")) {
|
|
193
|
-
_context2.next =
|
|
209
|
+
_context2.next = 23;
|
|
194
210
|
break;
|
|
195
211
|
}
|
|
196
212
|
|
|
197
213
|
config = currentState.result.config;
|
|
198
|
-
_context2.prev =
|
|
214
|
+
_context2.prev = 4;
|
|
199
215
|
|
|
200
216
|
// dispatch({
|
|
201
217
|
// type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
@@ -212,17 +228,17 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
212
228
|
msisdn: msisdn
|
|
213
229
|
});
|
|
214
230
|
|
|
215
|
-
_context2.next =
|
|
231
|
+
_context2.next = 9;
|
|
216
232
|
return (0, _utils.default)(window, config, msisdn, extraParams);
|
|
217
233
|
|
|
218
|
-
case
|
|
234
|
+
case 9:
|
|
219
235
|
msisdnSubmissionResult = _context2.sent;
|
|
220
236
|
dispatch({
|
|
221
237
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
222
|
-
payload: {
|
|
238
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
223
239
|
type: "MSISDNEntry",
|
|
224
240
|
result: RDS.Success({})
|
|
225
|
-
}
|
|
241
|
+
})
|
|
226
242
|
});
|
|
227
243
|
|
|
228
244
|
_strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', {
|
|
@@ -231,7 +247,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
231
247
|
|
|
232
248
|
dispatch({
|
|
233
249
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
234
|
-
payload: {
|
|
250
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
235
251
|
type: "PINEntry",
|
|
236
252
|
result: RDS.NothingYet(),
|
|
237
253
|
data: {
|
|
@@ -239,14 +255,14 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
239
255
|
nextAction: "submitPinAction",
|
|
240
256
|
msisdn: msisdn
|
|
241
257
|
}
|
|
242
|
-
}
|
|
258
|
+
})
|
|
243
259
|
});
|
|
244
|
-
_context2.next =
|
|
260
|
+
_context2.next = 21;
|
|
245
261
|
break;
|
|
246
262
|
|
|
247
|
-
case
|
|
248
|
-
_context2.prev =
|
|
249
|
-
_context2.t0 = _context2["catch"](
|
|
263
|
+
case 15:
|
|
264
|
+
_context2.prev = 15;
|
|
265
|
+
_context2.t0 = _context2["catch"](4);
|
|
250
266
|
console.warn(_context2.t0);
|
|
251
267
|
errorType = "AlreadySubscribed" === _context2.t0.type ? "AlreadySubscribed" : "InvalidMSISDN" === _context2.t0.type ? "InvalidMSISDN" : "UnknownError";
|
|
252
268
|
|
|
@@ -257,30 +273,30 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
257
273
|
|
|
258
274
|
dispatch({
|
|
259
275
|
type: "PIN_FLOW_MSISDN_SUBMIT_ERROR",
|
|
260
|
-
payload: {
|
|
276
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
261
277
|
type: "MSISDNEntry",
|
|
262
278
|
result: RDS.Failure({
|
|
263
279
|
errorType: errorType,
|
|
264
280
|
error: _context2.t0,
|
|
265
281
|
productUrl: _context2.t0.productUrl
|
|
266
282
|
})
|
|
267
|
-
}
|
|
283
|
+
})
|
|
268
284
|
});
|
|
269
285
|
|
|
270
|
-
case
|
|
271
|
-
_context2.next =
|
|
286
|
+
case 21:
|
|
287
|
+
_context2.next = 26;
|
|
272
288
|
break;
|
|
273
289
|
|
|
274
|
-
case
|
|
290
|
+
case 23:
|
|
275
291
|
dispatch({
|
|
276
292
|
type: "PIN_FLOW_MSISDN_SUBMIT_ERROR",
|
|
277
|
-
payload: {
|
|
293
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
278
294
|
type: "MSISDNEntry",
|
|
279
295
|
result: RDS.Failure({
|
|
280
296
|
errorType: "UnknownError",
|
|
281
297
|
error: null
|
|
282
298
|
})
|
|
283
|
-
}
|
|
299
|
+
})
|
|
284
300
|
});
|
|
285
301
|
|
|
286
302
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
@@ -290,12 +306,12 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
290
306
|
|
|
291
307
|
throw "Unexpected state";
|
|
292
308
|
|
|
293
|
-
case
|
|
309
|
+
case 26:
|
|
294
310
|
case "end":
|
|
295
311
|
return _context2.stop();
|
|
296
312
|
}
|
|
297
313
|
}
|
|
298
|
-
}, _callee2, null, [[
|
|
314
|
+
}, _callee2, null, [[4, 15]]);
|
|
299
315
|
}));
|
|
300
316
|
|
|
301
317
|
return function (_x3, _x4) {
|
|
@@ -307,18 +323,20 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
307
323
|
function submitPinAction(msisdn, pin, extraParams) {
|
|
308
324
|
return /*#__PURE__*/function () {
|
|
309
325
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(dispatch, store) {
|
|
310
|
-
var currentState, config, result, errorType;
|
|
326
|
+
var currentState, pinFlowCurrentState, config, result, errorType;
|
|
311
327
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
312
328
|
while (1) {
|
|
313
329
|
switch (_context3.prev = _context3.next) {
|
|
314
330
|
case 0:
|
|
315
|
-
|
|
331
|
+
currentState = store().strategy.currentState;
|
|
332
|
+
pinFlowCurrentState = store().pinFlow.currentState;
|
|
333
|
+
_context3.prev = 2;
|
|
316
334
|
dispatch({
|
|
317
335
|
type: "PIN_SUBMIT",
|
|
318
|
-
payload: {
|
|
336
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
319
337
|
type: "PINEntry",
|
|
320
338
|
result: RDS.Loading()
|
|
321
|
-
}
|
|
339
|
+
})
|
|
322
340
|
});
|
|
323
341
|
|
|
324
342
|
_strategy.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submitted', {
|
|
@@ -326,18 +344,16 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
326
344
|
pin: pin
|
|
327
345
|
});
|
|
328
346
|
|
|
329
|
-
currentState = store().strategy.currentState;
|
|
330
|
-
|
|
331
347
|
if (!(currentState.type === "PIN")) {
|
|
332
|
-
_context3.next =
|
|
348
|
+
_context3.next = 14;
|
|
333
349
|
break;
|
|
334
350
|
}
|
|
335
351
|
|
|
336
352
|
config = currentState.result.config;
|
|
337
|
-
_context3.next =
|
|
353
|
+
_context3.next = 9;
|
|
338
354
|
return (0, _utils.submitPIN)(window, pin, config, extraParams);
|
|
339
355
|
|
|
340
|
-
case
|
|
356
|
+
case 9:
|
|
341
357
|
result = _context3.sent;
|
|
342
358
|
|
|
343
359
|
_strategy.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submission-success', {
|
|
@@ -348,18 +364,18 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
348
364
|
|
|
349
365
|
dispatch({
|
|
350
366
|
type: "PIN_SUBMIT",
|
|
351
|
-
payload: {
|
|
367
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
352
368
|
type: "PINEntry",
|
|
353
369
|
result: RDS.Success({
|
|
354
370
|
finalUrl: result.productUrl,
|
|
355
371
|
isAlreadySubscribed: result.isAlreadySubscribed || false
|
|
356
372
|
})
|
|
357
|
-
}
|
|
373
|
+
})
|
|
358
374
|
});
|
|
359
|
-
_context3.next =
|
|
375
|
+
_context3.next = 17;
|
|
360
376
|
break;
|
|
361
377
|
|
|
362
|
-
case
|
|
378
|
+
case 14:
|
|
363
379
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
|
|
364
380
|
msisdn: msisdn,
|
|
365
381
|
pin: pin
|
|
@@ -367,22 +383,22 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
367
383
|
|
|
368
384
|
dispatch({
|
|
369
385
|
type: "PIN_SUBMIT_ERROR",
|
|
370
|
-
payload: {
|
|
386
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
371
387
|
type: "PINEntry",
|
|
372
388
|
result: RDS.Failure({
|
|
373
389
|
errorType: "UnexpectedState"
|
|
374
390
|
})
|
|
375
|
-
}
|
|
391
|
+
})
|
|
376
392
|
});
|
|
377
393
|
throw "Unexpected state";
|
|
378
394
|
|
|
379
|
-
case
|
|
380
|
-
_context3.next =
|
|
395
|
+
case 17:
|
|
396
|
+
_context3.next = 25;
|
|
381
397
|
break;
|
|
382
398
|
|
|
383
|
-
case
|
|
384
|
-
_context3.prev =
|
|
385
|
-
_context3.t0 = _context3["catch"](
|
|
399
|
+
case 19:
|
|
400
|
+
_context3.prev = 19;
|
|
401
|
+
_context3.t0 = _context3["catch"](2);
|
|
386
402
|
console.error(_context3.t0);
|
|
387
403
|
errorType = "InvalidPIN" === _context3.t0.type ? "InvalidPIN" : "UnknownError";
|
|
388
404
|
|
|
@@ -393,20 +409,20 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
393
409
|
|
|
394
410
|
dispatch({
|
|
395
411
|
type: "PIN_SUBMIT_ERROR",
|
|
396
|
-
payload: {
|
|
412
|
+
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
397
413
|
type: "PINEntry",
|
|
398
414
|
result: RDS.Failure({
|
|
399
415
|
errorType: errorType
|
|
400
416
|
})
|
|
401
|
-
}
|
|
417
|
+
})
|
|
402
418
|
});
|
|
403
419
|
|
|
404
|
-
case
|
|
420
|
+
case 25:
|
|
405
421
|
case "end":
|
|
406
422
|
return _context3.stop();
|
|
407
423
|
}
|
|
408
424
|
}
|
|
409
|
-
}, _callee3, null, [[
|
|
425
|
+
}, _callee3, null, [[2, 19]]);
|
|
410
426
|
}));
|
|
411
427
|
|
|
412
428
|
return function (_x5, _x6) {
|