ouisys-engine 4.3.0-alpha.0 → 4.5.0-alpha.0
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/@types/window.d.js +1 -1
- package/dist/api/index.d.ts +43 -0
- package/dist/api/index.js +1 -728
- package/dist/common-types/AppThunk.d.ts +13 -0
- package/dist/common-types/AppThunk.js +1 -1
- package/dist/common-types/Either.d.ts +8 -0
- package/dist/common-types/Either.js +1 -1
- package/dist/common-types/IError.d.ts +3 -0
- package/dist/common-types/IError.js +1 -1
- package/dist/common-types/IOptInFlowName.d.ts +1 -0
- package/dist/common-types/ITracker.d.ts +9 -0
- package/dist/common-types/ITracker.js +1 -3
- package/dist/common-types/IVisitor.d.ts +14 -0
- package/dist/common-types/IVisitor.js +1 -1
- package/dist/common-types/RemoteDataState.d.ts +38 -0
- package/dist/common-types/RemoteDataState.js +1 -135
- package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +3 -0
- package/dist/custom-hooks/useOneClickRedirectUrl.js +1 -0
- package/dist/custom-hooks/usePinEntryState.d.ts +8 -0
- package/dist/custom-hooks/usePinEntryState.js +1 -0
- package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
- package/dist/custom-hooks/useStrategyConfig.js +1 -0
- package/dist/flows/click2smsFlow.d.ts +6 -0
- package/dist/flows/click2smsFlow.js +1 -19
- package/dist/flows/creditCardFlow.d.ts +6 -0
- package/dist/flows/creditCardFlow.js +1 -0
- package/dist/flows/moFlow.d.ts +6 -0
- package/dist/flows/moFlow.js +1 -19
- package/dist/flows/moRedirFlow.d.ts +6 -0
- package/dist/flows/moRedirFlow.js +1 -19
- package/dist/flows/oneClickFlow.d.ts +7 -0
- package/dist/flows/oneClickFlow.js +1 -23
- package/dist/flows/pinFlow.d.ts +7 -0
- package/dist/flows/pinFlow.js +1 -23
- package/dist/flows/strategy.d.ts +14 -0
- package/dist/flows/strategy.js +1 -53
- package/dist/flows/ussdFlow.d.ts +6 -0
- package/dist/flows/ussdFlow.js +1 -19
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -2
- package/dist/ips/tryGetIPRangeName.d.ts +2 -0
- package/dist/ips/tryGetIPRangeName.js +1 -74
- package/dist/jest.config.js +194 -0
- package/dist/pacman/index.d.ts +6 -0
- package/dist/pacman/index.js +1 -108
- package/dist/pacman/queryString.d.ts +3 -0
- package/dist/pacman/queryString.js +1 -45
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +76 -0
- package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -1
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +2 -0
- package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -1
- package/dist/reducers/click2smsFlow/index.d.ts +5 -0
- package/dist/reducers/click2smsFlow/index.js +1 -183
- package/dist/reducers/click2smsFlow/utils.d.ts +4 -0
- package/dist/reducers/click2smsFlow/utils.js +1 -357
- package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +79 -0
- package/dist/reducers/creditCardFlow/CreditCardTypes.js +1 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +2 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.js +1 -0
- package/dist/reducers/creditCardFlow/index.d.ts +5 -0
- package/dist/reducers/creditCardFlow/index.js +1 -0
- package/dist/reducers/creditCardFlow/utils.d.ts +8 -0
- package/dist/reducers/creditCardFlow/utils.js +1 -0
- package/dist/reducers/moFlow/IMoConstants.d.ts +2 -0
- package/dist/reducers/moFlow/IMoConstants.js +1 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +88 -0
- package/dist/reducers/moFlow/MoTypes.js +1 -1
- package/dist/reducers/moFlow/index.d.ts +16 -0
- package/dist/reducers/moFlow/index.js +1 -251
- package/dist/reducers/moFlow/utils.d.ts +12 -0
- package/dist/reducers/moFlow/utils.js +1 -284
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +2 -0
- package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +64 -0
- package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -1
- package/dist/reducers/moRedirFlow/index.d.ts +14 -0
- package/dist/reducers/moRedirFlow/index.js +1 -226
- package/dist/reducers/moRedirFlow/utils.d.ts +10 -0
- package/dist/reducers/moRedirFlow/utils.js +1 -186
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +2 -0
- package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +85 -0
- package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -1
- package/dist/reducers/oneClickFlow/index.d.ts +13 -0
- package/dist/reducers/oneClickFlow/index.js +1 -409
- package/dist/reducers/oneClickFlow/utils.d.ts +16 -0
- package/dist/reducers/oneClickFlow/utils.js +1 -366
- package/dist/reducers/pinFlow/IPinConstants.d.ts +2 -0
- package/dist/reducers/pinFlow/IPinConstants.js +1 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +156 -0
- package/dist/reducers/pinFlow/PinTypes.js +1 -1
- package/dist/reducers/pinFlow/index.d.ts +19 -0
- package/dist/reducers/pinFlow/index.js +1 -514
- package/dist/reducers/pinFlow/utils.d.ts +11 -0
- package/dist/reducers/pinFlow/utils.js +1 -494
- package/dist/reducers/strategy/IStategyActionContants.d.ts +2 -0
- package/dist/reducers/strategy/IStategyActionContants.js +1 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +248 -0
- package/dist/reducers/strategy/StrategyTypes.js +1 -1
- package/dist/reducers/strategy/index.d.ts +13 -0
- package/dist/reducers/strategy/index.js +1 -389
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +15 -0
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -403
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +5 -0
- package/dist/reducers/strategy/strategies/ask_operator.js +1 -305
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +10 -0
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -459
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +7 -0
- package/dist/reducers/strategy/strategies/header_enrichment.js +1 -783
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +2 -0
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -0
- package/dist/reducers/strategy/utils.d.ts +30 -0
- package/dist/reducers/strategy/utils.js +1 -702
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +2 -0
- package/dist/reducers/ussdFlow/IUssdConstants.js +1 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +77 -0
- package/dist/reducers/ussdFlow/UssdTypes.js +1 -1
- package/dist/reducers/ussdFlow/index.d.ts +14 -0
- package/dist/reducers/ussdFlow/index.js +1 -251
- package/dist/reducers/ussdFlow/utils.d.ts +11 -0
- package/dist/reducers/ussdFlow/utils.js +1 -225
- package/dist/store/index.d.ts +14 -0
- package/dist/store/index.js +1 -177
- package/dist/store/reducers.d.ts +20 -0
- package/dist/store/reducers.js +1 -41
- package/dist/utilities/addEmpelloToken.d.ts +4 -0
- package/dist/utilities/addEmpelloToken.js +1 -0
- package/dist/utilities/handleSubmitNumber.d.ts +21 -0
- package/dist/utilities/handleSubmitNumber.js +1 -59
- package/dist/utilities/index.d.ts +14 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
- package/dist/utilities/loadScriptInnerHtml.js +1 -0
- package/dist/utilities/loadScriptSrc.d.ts +8 -0
- package/dist/utilities/loadScriptSrc.js +1 -0
- package/dist/utilities/replaceUrlParam.d.ts +1 -0
- package/dist/utilities/replaceUrlParam.js +1 -0
- package/dist/utilities/storeMsisdn.d.ts +3 -0
- package/dist/utilities/storeMsisdn.js +1 -0
- package/package.json +1 -1
- package/dist/app/store.js +0 -20
- package/dist/features/strategies/categories/askMobileNumber.js +0 -388
- package/dist/features/strategies/categories/askOperator.js +0 -313
- package/dist/features/strategies/categories/detectOperatorByIp.js +0 -599
- package/dist/features/strategies/categories/headerEnrichment.js +0 -665
- package/dist/features/strategies/categories/singleFlows/pin.js +0 -1
- package/dist/features/strategies/identifySlice.js +0 -355
- package/dist/features/strategies/pinFlowSlice.js +0 -338
- package/dist/flows/tpayHeFlow.js +0 -23
- package/dist/mockServer/browser.js +0 -48
- package/dist/mockServer/handlers.js +0 -22
- package/dist/mockServer/server.js +0 -48
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
- package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
- package/dist/reducers/tpayHeFlow/index.js +0 -331
- package/dist/reducers/tpayHeFlow/utils.js +0 -510
- package/dist/test/setup.js +0 -24
- package/dist/test/test-utils.js +0 -51
|
@@ -1,183 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.symbol.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.filter");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.iterator");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.object.get-own-property-descriptor");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.object.keys");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.object.to-string");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.promise");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.regexp.to-string");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.string.iterator");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.weak-map");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(exports, "__esModule", {
|
|
36
|
-
value: true
|
|
37
|
-
});
|
|
38
|
-
exports.loadOc2sms = loadOc2sms;
|
|
39
|
-
exports.default = Click2smsFlowReducer;
|
|
40
|
-
exports.Click2smsFlowActionMaps = void 0;
|
|
41
|
-
|
|
42
|
-
require("regenerator-runtime/runtime");
|
|
43
|
-
|
|
44
|
-
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
45
|
-
|
|
46
|
-
var _strategy = require("../strategy");
|
|
47
|
-
|
|
48
|
-
var _utils = _interopRequireDefault(require("./utils"));
|
|
49
|
-
|
|
50
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
51
|
-
|
|
52
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
53
|
-
|
|
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; }
|
|
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
|
-
|
|
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); } }
|
|
63
|
-
|
|
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); }); }; }
|
|
65
|
-
|
|
66
|
-
//ACTION CREATORS
|
|
67
|
-
function loadOc2sms() {
|
|
68
|
-
return /*#__PURE__*/function () {
|
|
69
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, store) {
|
|
70
|
-
var currentState, maybeConfig;
|
|
71
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
72
|
-
while (1) {
|
|
73
|
-
switch (_context.prev = _context.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
currentState = store().strategy.currentState;
|
|
76
|
-
|
|
77
|
-
if (!(currentState.type === "CLICK2SMS")) {
|
|
78
|
-
_context.next = 6;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
maybeConfig = currentState.result.config;
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
dispatch({
|
|
86
|
-
type: "LOAD_OC2SMS",
|
|
87
|
-
payload: {
|
|
88
|
-
type: "LOAD_OC2SMS",
|
|
89
|
-
result: RDS.Loading()
|
|
90
|
-
}
|
|
91
|
-
}); //@ts-ignore
|
|
92
|
-
|
|
93
|
-
if (!!maybeConfig && maybeConfig.tag == "keywordAndShortCode") {
|
|
94
|
-
dispatch({
|
|
95
|
-
type: "LOAD_OC2SMS",
|
|
96
|
-
payload: {
|
|
97
|
-
type: "LOAD_OC2SMS",
|
|
98
|
-
result: RDS.Success(_objectSpread({
|
|
99
|
-
type: "SingleSubmissionResult"
|
|
100
|
-
}, maybeConfig))
|
|
101
|
-
}
|
|
102
|
-
}); //@ts-ignore
|
|
103
|
-
} else if (!!maybeConfig && maybeConfig.tag != "keyword" || !maybeConfig) {
|
|
104
|
-
//@ts-ignore
|
|
105
|
-
(0, _utils.default)(window, maybeConfig).then(function (x) {
|
|
106
|
-
return dispatch({
|
|
107
|
-
type: "LOAD_OC2SMS",
|
|
108
|
-
payload: {
|
|
109
|
-
type: "LOAD_OC2SMS",
|
|
110
|
-
result: RDS.Success(x)
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}).catch(function (e) {
|
|
114
|
-
return dispatch({
|
|
115
|
-
type: "LOAD_OC2SMS",
|
|
116
|
-
payload: {
|
|
117
|
-
type: "LOAD_OC2SMS",
|
|
118
|
-
result: RDS.Failure(e.toString())
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
} catch (ex) {
|
|
124
|
-
console.warn(ex);
|
|
125
|
-
dispatch({
|
|
126
|
-
type: "LOAD_OC2SMS",
|
|
127
|
-
payload: {
|
|
128
|
-
type: "LOAD_OC2SMS",
|
|
129
|
-
result: RDS.Failure(ex.toString())
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
_context.next = 8;
|
|
135
|
-
break;
|
|
136
|
-
|
|
137
|
-
case 6:
|
|
138
|
-
dispatch({
|
|
139
|
-
type: "LOAD_OC2SMS",
|
|
140
|
-
payload: {
|
|
141
|
-
type: "LOAD_OC2SMS",
|
|
142
|
-
result: RDS.Failure("Unexpected state")
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
throw "Unexpected state";
|
|
146
|
-
|
|
147
|
-
case 8:
|
|
148
|
-
case "end":
|
|
149
|
-
return _context.stop();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, _callee);
|
|
153
|
-
}));
|
|
154
|
-
|
|
155
|
-
return function (_x, _x2) {
|
|
156
|
-
return _ref.apply(this, arguments);
|
|
157
|
-
};
|
|
158
|
-
}();
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
var initialState = {
|
|
162
|
-
currentState: {
|
|
163
|
-
type: "LOAD_OC2SMS",
|
|
164
|
-
result: RDS.NothingYet()
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
var Click2smsFlowActionMaps = {
|
|
168
|
-
loadOc2sms: loadOc2sms
|
|
169
|
-
};
|
|
170
|
-
exports.Click2smsFlowActionMaps = Click2smsFlowActionMaps;
|
|
171
|
-
|
|
172
|
-
function Click2smsFlowReducer() {
|
|
173
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
174
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
175
|
-
|
|
176
|
-
switch (action.type) {
|
|
177
|
-
case "LOAD_OC2SMS":
|
|
178
|
-
return (0, _strategy.genericHandler)(state, action.payload);
|
|
179
|
-
|
|
180
|
-
default:
|
|
181
|
-
return state;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.Click2smsFlowActionMaps=void 0,exports.default=Click2smsFlowReducer,exports.loadOc2sms=loadOc2sms,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.promise.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_strategy=require("../strategy"),_utils=_interopRequireDefault(require("./utils"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function loadOc2sms(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,maybeConfig;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,"CLICK2SMS"!==currentState.type){_context.next=6;break}maybeConfig=currentState.result.config;try{dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Loading()}}),maybeConfig&&"keywordAndShortCode"===maybeConfig.tag?dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Success(_objectSpread({type:"SingleSubmissionResult"},maybeConfig))}}):(!!maybeConfig&&"keyword"!==maybeConfig.tag||!maybeConfig)&&(0,_utils.default)(window,maybeConfig).then(function(x){return dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Success(x)}})}).catch(function(e){return dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Failure(e.toString())}})})}catch(ex){console.warn(ex),dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Failure(ex.toString())}})}_context.next=8;break;case 6:throw dispatch({type:"LOAD_OC2SMS",payload:{type:"LOAD_OC2SMS",result:RDS.Failure("Unexpected state")}}),new Error("Unexpected state");case 8:case"end":return _context.stop();}},_callee)}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}var initialState={currentState:{type:"LOAD_OC2SMS",result:RDS.NothingYet()}},Click2smsFlowActionMaps={loadOc2sms:loadOc2sms};exports.Click2smsFlowActionMaps=Click2smsFlowActionMaps;function Click2smsFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"LOAD_OC2SMS":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IConfig, MultiOperatorSubmissionResult, SingleSubmissionResult } from './Click2smsTypes';
|
|
2
|
+
export default function load(window: Window, maybeConfig: IConfig, keyword?: string, shortcode?: string): Promise<SingleSubmissionResult | MultiOperatorSubmissionResult>;
|
|
3
|
+
export declare function load1(window: Window, maybeConfig: IConfig, keyword?: string, shortcode?: string): Promise<SingleSubmissionResult | MultiOperatorSubmissionResult>;
|
|
4
|
+
export declare function checkSubscription(window: Window, maybeConfig: IConfig): Promise<string>;
|
|
@@ -1,357 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.symbol");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.array.concat");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.filter");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.map");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.get-own-property-descriptor");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.object.keys");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.object.to-string");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.promise");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.regexp.exec");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.string.iterator");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.string.search");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(exports, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
});
|
|
36
|
-
exports.default = load;
|
|
37
|
-
exports.load1 = load1;
|
|
38
|
-
exports.checkSubscription = checkSubscription;
|
|
39
|
-
|
|
40
|
-
require("regenerator-runtime/runtime");
|
|
41
|
-
|
|
42
|
-
var _utils = require("../strategy/utils");
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
46
|
-
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; }
|
|
47
|
-
|
|
48
|
-
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; }
|
|
49
|
-
|
|
50
|
-
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); } }
|
|
51
|
-
|
|
52
|
-
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
|
-
|
|
54
|
-
function loadOnce(_x, _x2, _x3, _x4, _x5) {
|
|
55
|
-
return _loadOnce.apply(this, arguments);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _loadOnce() {
|
|
59
|
-
_loadOnce = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(window, maybeConfig, operator, keyword, shortcode) {
|
|
60
|
-
var _keyword, _shortcode, offer, config, host, country, slug, rockmanId, search, result;
|
|
61
|
-
|
|
62
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
63
|
-
while (1) {
|
|
64
|
-
switch (_context.prev = _context.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
if (!(!!maybeConfig && maybeConfig.tag == "keywordAndShortCode")) {
|
|
67
|
-
_context.next = 5;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
_keyword = maybeConfig.keyword, _shortcode = maybeConfig.shortcode;
|
|
72
|
-
return _context.abrupt("return", _objectSpread({
|
|
73
|
-
type: "SingleSubmissionResult"
|
|
74
|
-
}, {
|
|
75
|
-
keyword: _keyword,
|
|
76
|
-
shortcode: _shortcode
|
|
77
|
-
}));
|
|
78
|
-
|
|
79
|
-
case 5:
|
|
80
|
-
offer = window.pac_analytics.visitor.offer;
|
|
81
|
-
config = _objectSpread({
|
|
82
|
-
offer: window.pac_analytics.visitor.offer
|
|
83
|
-
}, maybeConfig);
|
|
84
|
-
host = config.host, country = config.country, slug = config.slug;
|
|
85
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
86
|
-
search = window.location.search.substr(1) || '';
|
|
87
|
-
_context.next = 12;
|
|
88
|
-
return window.tallymanApi.oc2sms(host, country, slug, offer, rockmanId, keyword, operator, search);
|
|
89
|
-
|
|
90
|
-
case 12:
|
|
91
|
-
result = _context.sent;
|
|
92
|
-
|
|
93
|
-
if (result.success) {
|
|
94
|
-
_context.next = 17;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
throw result.message;
|
|
99
|
-
|
|
100
|
-
case 17:
|
|
101
|
-
return _context.abrupt("return", _objectSpread({
|
|
102
|
-
type: "SingleSubmissionResult"
|
|
103
|
-
}, {
|
|
104
|
-
keyword: "".concat(keyword || result.displayKeyword).concat(!!result.uid ? ' ' + result.uid : ''),
|
|
105
|
-
shortcode: result.shortcode
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
case 18:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, _callee);
|
|
114
|
-
}));
|
|
115
|
-
return _loadOnce.apply(this, arguments);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function right(r) {
|
|
119
|
-
return {
|
|
120
|
-
type: 'right',
|
|
121
|
-
value: r
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function left(l) {
|
|
126
|
-
return {
|
|
127
|
-
type: 'left',
|
|
128
|
-
value: l
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function foldEither(left, right, either) {
|
|
133
|
-
return either.type == 'left' ? left(either.value) : right(either.value);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function loadForMultipleOperators(_x6, _x7, _x8, _x9, _x10) {
|
|
137
|
-
return _loadForMultipleOperators.apply(this, arguments);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function _loadForMultipleOperators() {
|
|
141
|
-
_loadForMultipleOperators = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, maybeConfig, operators, keyword, shortcode) {
|
|
142
|
-
var results, finalResults, arrResult;
|
|
143
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
144
|
-
while (1) {
|
|
145
|
-
switch (_context3.prev = _context3.next) {
|
|
146
|
-
case 0:
|
|
147
|
-
results = Promise.all(operators.map( /*#__PURE__*/function () {
|
|
148
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(o) {
|
|
149
|
-
var singleResult;
|
|
150
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
151
|
-
while (1) {
|
|
152
|
-
switch (_context2.prev = _context2.next) {
|
|
153
|
-
case 0:
|
|
154
|
-
_context2.prev = 0;
|
|
155
|
-
_context2.next = 3;
|
|
156
|
-
return loadOnce(window, maybeConfig, o, keyword, shortcode);
|
|
157
|
-
|
|
158
|
-
case 3:
|
|
159
|
-
singleResult = _context2.sent;
|
|
160
|
-
return _context2.abrupt("return", right(_objectSpread(_objectSpread({}, singleResult), {}, {
|
|
161
|
-
operator: o
|
|
162
|
-
})));
|
|
163
|
-
|
|
164
|
-
case 7:
|
|
165
|
-
_context2.prev = 7;
|
|
166
|
-
_context2.t0 = _context2["catch"](0);
|
|
167
|
-
return _context2.abrupt("return", left(_context2.t0));
|
|
168
|
-
|
|
169
|
-
case 10:
|
|
170
|
-
case "end":
|
|
171
|
-
return _context2.stop();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}, _callee2, null, [[0, 7]]);
|
|
175
|
-
}));
|
|
176
|
-
|
|
177
|
-
return function (_x21) {
|
|
178
|
-
return _ref.apply(this, arguments);
|
|
179
|
-
};
|
|
180
|
-
}()));
|
|
181
|
-
_context3.next = 3;
|
|
182
|
-
return Promise.resolve(results);
|
|
183
|
-
|
|
184
|
-
case 3:
|
|
185
|
-
finalResults = _context3.sent;
|
|
186
|
-
|
|
187
|
-
if (!finalResults.every(function (r) {
|
|
188
|
-
return r.type == 'left';
|
|
189
|
-
})) {
|
|
190
|
-
_context3.next = 8;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
throw finalResults[0].value;
|
|
195
|
-
|
|
196
|
-
case 8:
|
|
197
|
-
arrResult = [];
|
|
198
|
-
finalResults.map(function (obj) {
|
|
199
|
-
if (obj.type == 'right') {
|
|
200
|
-
var _ref2 = obj.value,
|
|
201
|
-
_keyword2 = _ref2.keyword,
|
|
202
|
-
_shortcode2 = _ref2.shortcode,
|
|
203
|
-
operator = _ref2.operator;
|
|
204
|
-
arrResult.push({
|
|
205
|
-
keyword: _keyword2,
|
|
206
|
-
shortcode: _shortcode2,
|
|
207
|
-
operator: operator
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
return _context3.abrupt("return", {
|
|
212
|
-
type: "MultiOperatorSubmissionResult",
|
|
213
|
-
data: arrResult
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
case 11:
|
|
217
|
-
case "end":
|
|
218
|
-
return _context3.stop();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}, _callee3);
|
|
222
|
-
}));
|
|
223
|
-
return _loadForMultipleOperators.apply(this, arguments);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function load(_x11, _x12, _x13, _x14) {
|
|
227
|
-
return _load.apply(this, arguments);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function _load() {
|
|
231
|
-
_load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(window, maybeConfig, keyword, shortcode) {
|
|
232
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
233
|
-
while (1) {
|
|
234
|
-
switch (_context4.prev = _context4.next) {
|
|
235
|
-
case 0:
|
|
236
|
-
if (!(!!maybeConfig && maybeConfig.tag == "keywordAndShortCode")) {
|
|
237
|
-
_context4.next = 4;
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return _context4.abrupt("return", _objectSpread({
|
|
242
|
-
type: "SingleSubmissionResult"
|
|
243
|
-
}, {
|
|
244
|
-
keyword: maybeConfig.keyword,
|
|
245
|
-
shortcode: maybeConfig.shortcode
|
|
246
|
-
}));
|
|
247
|
-
|
|
248
|
-
case 4:
|
|
249
|
-
if (!(!!maybeConfig && maybeConfig.tag == "keyword")) {
|
|
250
|
-
_context4.next = 8;
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return _context4.abrupt("return", load1(window, maybeConfig, keyword, shortcode));
|
|
255
|
-
|
|
256
|
-
case 8:
|
|
257
|
-
return _context4.abrupt("return", load1(window, maybeConfig, null, null));
|
|
258
|
-
|
|
259
|
-
case 9:
|
|
260
|
-
case "end":
|
|
261
|
-
return _context4.stop();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}, _callee4);
|
|
265
|
-
}));
|
|
266
|
-
return _load.apply(this, arguments);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function load1(_x15, _x16, _x17, _x18) {
|
|
270
|
-
return _load2.apply(this, arguments);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function _load2() {
|
|
274
|
-
_load2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(window, maybeConfig, keyword, shortcode) {
|
|
275
|
-
var config, singleOperator;
|
|
276
|
-
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
277
|
-
while (1) {
|
|
278
|
-
switch (_context5.prev = _context5.next) {
|
|
279
|
-
case 0:
|
|
280
|
-
config = _objectSpread({
|
|
281
|
-
offer: window.pac_analytics.visitor.offer
|
|
282
|
-
}, maybeConfig);
|
|
283
|
-
|
|
284
|
-
if (!(true == config.automaticallySubmitAllOperators && !!config.operators && config.operators.length > 0)) {
|
|
285
|
-
_context5.next = 5;
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return _context5.abrupt("return", loadForMultipleOperators(window, maybeConfig, config.operators, keyword, shortcode));
|
|
290
|
-
|
|
291
|
-
case 5:
|
|
292
|
-
singleOperator = maybeConfig.operators && maybeConfig.operators.length > 0 ? maybeConfig.operators[0] : null;
|
|
293
|
-
return _context5.abrupt("return", loadOnce(window, maybeConfig, singleOperator, keyword, shortcode));
|
|
294
|
-
|
|
295
|
-
case 7:
|
|
296
|
-
case "end":
|
|
297
|
-
return _context5.stop();
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}, _callee5);
|
|
301
|
-
}));
|
|
302
|
-
return _load2.apply(this, arguments);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function checkSubscription(_x19, _x20) {
|
|
306
|
-
return _checkSubscription.apply(this, arguments);
|
|
307
|
-
} // {"success":true,"uid":"*5QADM","shortcode":"1901","keyword":"TIPS"}%
|
|
308
|
-
// curl "http://w1.mozzi.com/spa-api/?country=gh&device=smart&slug=18plus-oc2sms&action=oc2sms"
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
function _checkSubscription() {
|
|
312
|
-
_checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, maybeConfig) {
|
|
313
|
-
var config, host, rockmanId, check, checkResult, error;
|
|
314
|
-
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
315
|
-
while (1) {
|
|
316
|
-
switch (_context6.prev = _context6.next) {
|
|
317
|
-
case 0:
|
|
318
|
-
config = _objectSpread({
|
|
319
|
-
offer: window.pac_analytics.visitor.offer
|
|
320
|
-
}, maybeConfig);
|
|
321
|
-
host = config.host;
|
|
322
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
323
|
-
|
|
324
|
-
check = function check() {
|
|
325
|
-
return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host, rockmanId);
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
_context6.next = 6;
|
|
329
|
-
return (0, _utils.loop)(check, 60, function (r) {
|
|
330
|
-
return r.success;
|
|
331
|
-
}, 0);
|
|
332
|
-
|
|
333
|
-
case 6:
|
|
334
|
-
checkResult = _context6.sent;
|
|
335
|
-
|
|
336
|
-
if (!(true === checkResult.success)) {
|
|
337
|
-
_context6.next = 12;
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
window.location.href = checkResult.product_url;
|
|
342
|
-
return _context6.abrupt("return", checkResult.product_url || null);
|
|
343
|
-
|
|
344
|
-
case 12:
|
|
345
|
-
error = new Error("SubscriptionFailed".concat(":\n", checkResult.message));
|
|
346
|
-
error['type'] = "SubscriptionFailed";
|
|
347
|
-
throw error;
|
|
348
|
-
|
|
349
|
-
case 15:
|
|
350
|
-
case "end":
|
|
351
|
-
return _context6.stop();
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}, _callee6);
|
|
355
|
-
}));
|
|
356
|
-
return _checkSubscription.apply(this, arguments);
|
|
357
|
-
}
|
|
1
|
+
"use strict";var _utils=require("../strategy/utils");function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkSubscription=checkSubscription,exports.default=load,exports.load1=load1,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.map.js");function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function loadOnce(){return _loadOnce.apply(this,arguments)}function _loadOnce(){return _loadOnce=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,maybeConfig,operator,keyword){var keywordFromConfig,shortcodeFromConfig,offer,config,host,country,slug,rockmanId,search,result;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(!maybeConfig||"keywordAndShortCode"!==maybeConfig.tag){_context.next=3;break}return keywordFromConfig=maybeConfig.keyword,shortcodeFromConfig=maybeConfig.shortcode,_context.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:keywordFromConfig,shortcode:shortcodeFromConfig}));case 3:return offer=window.pac_analytics.visitor.offer,config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),host=config.host,country=config.country,slug=config.slug,rockmanId=window.pac_analytics.visitor.rockmanId,search=window.location.search.substr(1)||"",_context.next=10,window.tallymanApi.oc2sms(host,country,slug,offer,rockmanId,keyword,operator,search);case 10:if(result=_context.sent,result.success){_context.next=15;break}throw result.message;case 15:return _context.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:"".concat(keyword||result.displayKeyword).concat(result.uid?" ".concat(result.uid):""),shortcode:result.shortcode}));case 16:case"end":return _context.stop();}},_callee)})),_loadOnce.apply(this,arguments)}function right(r){return{type:"right",value:r}}function left(l){return{type:"left",value:l}}function loadForMultipleOperators(_x6,_x7,_x8,_x9,_x10){return _loadForMultipleOperators.apply(this,arguments)}function _loadForMultipleOperators(){return _loadForMultipleOperators=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig,operators,keyword,shortcode){var results,finalResults,arrResult;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return results=Promise.all(operators.map(function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(o){var singleResult;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return _context2.prev=0,_context2.next=3,loadOnce(window,maybeConfig,o,keyword,shortcode);case 3:return singleResult=_context2.sent,_context2.abrupt("return",right(_objectSpread(_objectSpread({},singleResult),{},{operator:o})));case 7:return _context2.prev=7,_context2.t0=_context2["catch"](0),_context2.abrupt("return",left(_context2.t0));case 10:case"end":return _context2.stop();}},_callee2,null,[[0,7]])}));return function(_x21){return _ref.apply(this,arguments)}}())),_context3.next=3,Promise.resolve(results);case 3:if(finalResults=_context3.sent,!finalResults.every(function(r){return"left"===r.type})){_context3.next=8;break}throw finalResults[0].value;case 8:return arrResult=[],finalResults.map(function(obj){if("right"===obj.type){var r=obj.value;arrResult.push({keyword:null===r||void 0===r?void 0:r.keyword,shortcode:null===r||void 0===r?void 0:r.shortcode,operator:null===r||void 0===r?void 0:r.operator})}return obj}),_context3.abrupt("return",{type:"MultiOperatorSubmissionResult",data:arrResult});case 11:case"end":return _context3.stop();}},_callee3)})),_loadForMultipleOperators.apply(this,arguments)}function load(_x11,_x12,_x13,_x14){return _load.apply(this,arguments)}function _load(){return _load=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(window,maybeConfig,keyword,shortcode){return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:if(!maybeConfig||"keywordAndShortCode"!==maybeConfig.tag){_context4.next=2;break}return _context4.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:maybeConfig.keyword,shortcode:maybeConfig.shortcode}));case 2:if(!maybeConfig||"keyword"!==maybeConfig.tag){_context4.next=4;break}return _context4.abrupt("return",load1(window,maybeConfig,keyword,shortcode));case 4:return _context4.abrupt("return",load1(window,maybeConfig,null,null));case 5:case"end":return _context4.stop();}},_callee4)})),_load.apply(this,arguments)}function load1(_x15,_x16,_x17,_x18){return _load2.apply(this,arguments)}function _load2(){return _load2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,maybeConfig,keyword,shortcode){var config,singleOperator;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:if(config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),!0!==config.automaticallySubmitAllOperators||!config.operators||!(0<config.operators.length)){_context5.next=3;break}return _context5.abrupt("return",loadForMultipleOperators(window,maybeConfig,config.operators,keyword,shortcode));case 3:return singleOperator=maybeConfig.operators&&0<maybeConfig.operators.length?maybeConfig.operators[0]:null,_context5.abrupt("return",loadOnce(window,maybeConfig,singleOperator,keyword,shortcode));case 5:case"end":return _context5.stop();}},_callee5)})),_load2.apply(this,arguments)}function checkSubscription(_x19,_x20){return _checkSubscription.apply(this,arguments)}function _checkSubscription(){return _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(window,maybeConfig){var config,host,rockmanId,search,isMock,check,checkResult,error;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,search=(0,_utils.searchToObject)(),isMock="check-subscription-success-state"===search["current-state"],isMock&&console.log("isMock is true"),check=function check(){return isMock?Promise.resolve({success:!0,rockman_id:rockmanId,product_url:"/product",msisdn:"000"}):window.tallymanApi.checkSubscriptionByRockmanIdOnly(host,rockmanId)},_context6.next=9,(0,_utils.loop)(check,60,function(r){return r.success},0);case 9:if(checkResult=_context6.sent,!0!==checkResult.success){_context6.next=13;break}return window.location.href=checkResult.product_url,_context6.abrupt("return",checkResult.product_url||null);case 13:throw error=new Error("SubscriptionFailed".concat(":\n",checkResult.message)),error.type="SubscriptionFailed",error;case 16:case"end":return _context6.stop();}},_callee6)})),_checkSubscription.apply(this,arguments)}
|