@hotwax/oms-api
Version:
The OMS API package comes with prebuilt methods that helps communicate with HotWax Commerce OMS using Rest API
967 lines (791 loc) • 41.9 kB
JavaScript
"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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "askQuery", {
enumerable: true,
get: function get() {
return _gitbook.askQuery;
}
});
exports.fetchFacilities = fetchFacilities;
exports.fetchFacilitiesByGroup = fetchFacilitiesByGroup;
exports.fetchFacilitiesByParty = fetchFacilitiesByParty;
exports.fetchGoodIdentificationTypes = void 0;
Object.defineProperty(exports, "fetchProducts", {
enumerable: true,
get: function get() {
return _product.fetchProducts;
}
});
Object.defineProperty(exports, "fetchProductsGroupedBy", {
enumerable: true,
get: function get() {
return _product.fetchProductsGroupedBy;
}
});
Object.defineProperty(exports, "fetchProductsGroupedByParent", {
enumerable: true,
get: function get() {
return _product.fetchProductsGroupedByParent;
}
});
Object.defineProperty(exports, "fetchProductsStock", {
enumerable: true,
get: function get() {
return _stock.fetchProductsStock;
}
});
Object.defineProperty(exports, "fetchProductsStockAtFacility", {
enumerable: true,
get: function get() {
return _stock.fetchProductsStockAtFacility;
}
});
exports.getAvailableTimeZones = void 0;
exports.getEComStores = getEComStores;
exports.getEComStoresByFacility = getEComStoresByFacility;
Object.defineProperty(exports, "getGitBookPage", {
enumerable: true,
get: function get() {
return _gitbook.getGitBookPage;
}
});
exports.getNotificationEnumIds = getNotificationEnumIds;
exports.getNotificationUserPrefTypeIds = getNotificationUserPrefTypeIds;
Object.defineProperty(exports, "getOrderDetails", {
enumerable: true,
get: function get() {
return _order.getOrderDetails;
}
});
exports.getProductIdentificationPref = getProductIdentificationPref;
Object.defineProperty(exports, "getProfile", {
enumerable: true,
get: function get() {
return _user.getProfile;
}
});
exports.getUserFacilities = getUserFacilities;
exports.getUserPreference = getUserPreference;
exports.loginShopifyAppUser = loginShopifyAppUser;
Object.defineProperty(exports, "logout", {
enumerable: true,
get: function get() {
return _user.logout;
}
});
exports.removeClientRegistrationToken = removeClientRegistrationToken;
Object.defineProperty(exports, "searchProducts", {
enumerable: true,
get: function get() {
return _product.searchProducts;
}
});
Object.defineProperty(exports, "searchQuery", {
enumerable: true,
get: function get() {
return _gitbook.searchQuery;
}
});
exports.setProductIdentificationPref = setProductIdentificationPref;
exports.setUserLocale = setUserLocale;
exports.setUserPreference = void 0;
exports.setUserTimeZone = setUserTimeZone;
exports.storeClientRegistrationToken = storeClientRegistrationToken;
exports.subscribeTopic = subscribeTopic;
exports.unsubscribeTopic = unsubscribeTopic;
Object.defineProperty(exports, "updateOrderStatus", {
enumerable: true,
get: function get() {
return _order.updateOrderStatus;
}
});
var _order = require("../modules/order");
var _product = require("../modules/product");
var _user = require("../modules/user");
var _notification = require("../modules/notification");
var _stock = require("../modules/stock");
var _gitbook = require("../modules/gitbook");
var _moquiIndex = _interopRequireDefault(require("./user/moquiIndex"));
var _moquiIndex2 = _interopRequireDefault(require("./product/moquiIndex"));
var _moquiIndex3 = _interopRequireDefault(require("./notification/moquiIndex"));
var _api = require("../api");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { 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"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } 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 }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var 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); 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 (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, 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 = undefined), 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 = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } 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 = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, 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) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --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 (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (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 i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (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 = undefined), ContinueSentinel; } }, exports; }
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); } }
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); }); }; }
var getAvailableTimeZones = /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context.next = 7;
break;
}
_context.next = 4;
return _moquiIndex["default"].getAvailableTimeZones();
case 4:
return _context.abrupt("return", _context.sent);
case 7:
_context.next = 9;
return (0, _user.omsGetAvailableTimeZones)();
case 9:
return _context.abrupt("return", _context.sent);
case 10:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function getAvailableTimeZones() {
return _ref.apply(this, arguments);
};
}();
exports.getAvailableTimeZones = getAvailableTimeZones;
function getUserFacilities(_x, _x2, _x3, _x4) {
return _getUserFacilities.apply(this, arguments);
}
function _getUserFacilities() {
_getUserFacilities = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(token, baseURL, partyId, facilityGroupId) {
var isAdminUser,
payload,
apiConfig,
_args4 = arguments;
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
isAdminUser = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : false;
payload = _args4.length > 5 && _args4[5] !== undefined ? _args4[5] : {};
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context4.next = 9;
break;
}
_context4.next = 6;
return _moquiIndex["default"].fetchFacilities(token, baseURL, partyId, facilityGroupId, isAdminUser, payload);
case 6:
return _context4.abrupt("return", _context4.sent);
case 9:
_context4.next = 11;
return (0, _user.omsGetUserFacilities)(token, baseURL, partyId, facilityGroupId, isAdminUser, payload);
case 11:
return _context4.abrupt("return", _context4.sent);
case 12:
case "end":
return _context4.stop();
}
}
}, _callee4);
}));
return _getUserFacilities.apply(this, arguments);
}
function fetchFacilities(_x5, _x6, _x7, _x8) {
return _fetchFacilities.apply(this, arguments);
}
function _fetchFacilities() {
_fetchFacilities = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(token, baseURL, partyId, facilityGroupId) {
var isAdminUser,
payload,
_args5 = arguments;
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
isAdminUser = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : false;
payload = _args5.length > 5 && _args5[5] !== undefined ? _args5[5] : {};
_context5.next = 4;
return _moquiIndex["default"].fetchFacilities(token, baseURL, partyId, facilityGroupId, isAdminUser, payload);
case 4:
return _context5.abrupt("return", _context5.sent);
case 5:
case "end":
return _context5.stop();
}
}
}, _callee5);
}));
return _fetchFacilities.apply(this, arguments);
}
function fetchFacilitiesByGroup(_x9, _x10, _x11, _x12) {
return _fetchFacilitiesByGroup.apply(this, arguments);
}
function _fetchFacilitiesByGroup() {
_fetchFacilitiesByGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(facilityGroupId, baseURL, token, payload) {
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return _moquiIndex["default"].fetchFacilitiesByGroup(facilityGroupId, baseURL, token, payload);
case 2:
return _context6.abrupt("return", _context6.sent);
case 3:
case "end":
return _context6.stop();
}
}
}, _callee6);
}));
return _fetchFacilitiesByGroup.apply(this, arguments);
}
function fetchFacilitiesByParty(_x13, _x14, _x15, _x16) {
return _fetchFacilitiesByParty.apply(this, arguments);
}
function _fetchFacilitiesByParty() {
_fetchFacilitiesByParty = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(partyId, baseURL, token, payload) {
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return _moquiIndex["default"].fetchFacilitiesByParty(partyId, baseURL, token, payload);
case 2:
return _context7.abrupt("return", _context7.sent);
case 3:
case "end":
return _context7.stop();
}
}
}, _callee7);
}));
return _fetchFacilitiesByParty.apply(this, arguments);
}
function getEComStores(_x17, _x18) {
return _getEComStores.apply(this, arguments);
}
function _getEComStores() {
_getEComStores = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(token, baseURL) {
var vSize,
apiConfig,
_args8 = arguments;
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
vSize = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : 100;
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context8.next = 8;
break;
}
_context8.next = 5;
return _moquiIndex["default"].getEComStores(token, baseURL, vSize);
case 5:
return _context8.abrupt("return", _context8.sent);
case 8:
_context8.next = 10;
return (0, _user.omsGetEComStores)(token, baseURL, vSize);
case 10:
return _context8.abrupt("return", _context8.sent);
case 11:
case "end":
return _context8.stop();
}
}
}, _callee8);
}));
return _getEComStores.apply(this, arguments);
}
function getEComStoresByFacility(_x19, _x20) {
return _getEComStoresByFacility.apply(this, arguments);
}
function _getEComStoresByFacility() {
_getEComStoresByFacility = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(token, baseURL) {
var vSize,
facilityId,
apiConfig,
_args9 = arguments;
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
vSize = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : 100;
facilityId = _args9.length > 3 ? _args9[3] : undefined;
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context9.next = 9;
break;
}
_context9.next = 6;
return _moquiIndex["default"].getEComStoresByFacility(token, baseURL, vSize, facilityId);
case 6:
return _context9.abrupt("return", _context9.sent);
case 9:
_context9.next = 11;
return (0, _user.omsGetEComStoresByFacility)(token, baseURL, vSize, facilityId);
case 11:
return _context9.abrupt("return", _context9.sent);
case 12:
case "end":
return _context9.stop();
}
}
}, _callee9);
}));
return _getEComStoresByFacility.apply(this, arguments);
}
function getUserPreference(_x21, _x22, _x23) {
return _getUserPreference.apply(this, arguments);
}
function _getUserPreference() {
_getUserPreference = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(token, baseURL, userPrefTypeId) {
var userId,
apiConfig,
_args10 = arguments;
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
while (1) {
switch (_context10.prev = _context10.next) {
case 0:
userId = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : "";
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context10.next = 8;
break;
}
_context10.next = 5;
return _moquiIndex["default"].getUserPreference(token, baseURL, userPrefTypeId, userId);
case 5:
return _context10.abrupt("return", _context10.sent);
case 8:
_context10.next = 10;
return (0, _user.omsGetUserPreference)(token, baseURL, userPrefTypeId);
case 10:
return _context10.abrupt("return", _context10.sent);
case 11:
case "end":
return _context10.stop();
}
}
}, _callee10);
}));
return _getUserPreference.apply(this, arguments);
}
function getProductIdentificationPref(_x24) {
return _getProductIdentificationPref.apply(this, arguments);
}
function _getProductIdentificationPref() {
_getProductIdentificationPref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(eComStoreId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context11.next = 7;
break;
}
_context11.next = 4;
return _moquiIndex["default"].getProductIdentificationPref(eComStoreId);
case 4:
return _context11.abrupt("return", _context11.sent);
case 7:
_context11.next = 9;
return (0, _user.omsGetProductIdentificationPref)(eComStoreId);
case 9:
return _context11.abrupt("return", _context11.sent);
case 10:
case "end":
return _context11.stop();
}
}
}, _callee11);
}));
return _getProductIdentificationPref.apply(this, arguments);
}
function setProductIdentificationPref(_x25, _x26) {
return _setProductIdentificationPref.apply(this, arguments);
}
function _setProductIdentificationPref() {
_setProductIdentificationPref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(eComStoreId, productIdentificationPref) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
while (1) {
switch (_context12.prev = _context12.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context12.next = 7;
break;
}
_context12.next = 4;
return _moquiIndex["default"].setProductIdentificationPref(eComStoreId, productIdentificationPref);
case 4:
return _context12.abrupt("return", _context12.sent);
case 7:
_context12.next = 9;
return (0, _user.omsSetProductIdentificationPref)(eComStoreId, productIdentificationPref);
case 9:
return _context12.abrupt("return", _context12.sent);
case 10:
case "end":
return _context12.stop();
}
}
}, _callee12);
}));
return _setProductIdentificationPref.apply(this, arguments);
}
var setUserPreference = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context2.next = 7;
break;
}
_context2.next = 4;
return _moquiIndex["default"].updateUserPreference(payload);
case 4:
return _context2.abrupt("return", _context2.sent);
case 7:
_context2.next = 9;
return (0, _user.omsSetUserPreference)(payload);
case 9:
return _context2.abrupt("return", _context2.sent);
case 10:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return function setUserPreference(_x27) {
return _ref2.apply(this, arguments);
};
}();
exports.setUserPreference = setUserPreference;
var fetchGoodIdentificationTypes = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payload) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context3.next = 7;
break;
}
_context3.next = 4;
return _moquiIndex2["default"].fetchGoodIdentificationTypes(payload);
case 4:
return _context3.abrupt("return", _context3.sent);
case 7:
_context3.next = 9;
return (0, _product.omsFetchGoodIdentificationTypes)(payload);
case 9:
return _context3.abrupt("return", _context3.sent);
case 10:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return function fetchGoodIdentificationTypes(_x28) {
return _ref3.apply(this, arguments);
};
}();
exports.fetchGoodIdentificationTypes = fetchGoodIdentificationTypes;
function getNotificationEnumIds(_x29) {
return _getNotificationEnumIds.apply(this, arguments);
} // getNotificationUserPrefTypeIds
function _getNotificationEnumIds() {
_getNotificationEnumIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(enumTypeId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
while (1) {
switch (_context13.prev = _context13.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context13.next = 7;
break;
}
_context13.next = 4;
return _moquiIndex3["default"].getNotificationEnumIds(enumTypeId);
case 4:
return _context13.abrupt("return", _context13.sent);
case 7:
_context13.next = 9;
return (0, _notification.omsGetNotificationEnumIds)(enumTypeId);
case 9:
return _context13.abrupt("return", _context13.sent);
case 10:
case "end":
return _context13.stop();
}
}
}, _callee13);
}));
return _getNotificationEnumIds.apply(this, arguments);
}
function getNotificationUserPrefTypeIds(_x30, _x31) {
return _getNotificationUserPrefTypeIds.apply(this, arguments);
} // storeClientRegistrationToken
function _getNotificationUserPrefTypeIds() {
_getNotificationUserPrefTypeIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(applicationId, userLoginId) {
var filterConditions,
apiConfig,
_args14 = arguments;
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
while (1) {
switch (_context14.prev = _context14.next) {
case 0:
filterConditions = _args14.length > 2 && _args14[2] !== undefined ? _args14[2] : {};
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context14.next = 8;
break;
}
_context14.next = 5;
return _moquiIndex3["default"].getNotificationUserPrefTypeIds(applicationId, userLoginId, filterConditions);
case 5:
return _context14.abrupt("return", _context14.sent);
case 8:
_context14.next = 10;
return (0, _notification.omsGetNotificationUserPrefTypeIds)(applicationId, userLoginId, filterConditions);
case 10:
return _context14.abrupt("return", _context14.sent);
case 11:
case "end":
return _context14.stop();
}
}
}, _callee14);
}));
return _getNotificationUserPrefTypeIds.apply(this, arguments);
}
function storeClientRegistrationToken(_x32, _x33, _x34) {
return _storeClientRegistrationToken.apply(this, arguments);
} // removeClientRegistrationToken
function _storeClientRegistrationToken() {
_storeClientRegistrationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(registrationToken, deviceId, applicationId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
while (1) {
switch (_context15.prev = _context15.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context15.next = 7;
break;
}
_context15.next = 4;
return _moquiIndex3["default"].storeClientRegistrationToken(registrationToken, deviceId, applicationId);
case 4:
return _context15.abrupt("return", _context15.sent);
case 7:
_context15.next = 9;
return (0, _notification.omsStoreClientRegistrationToken)(registrationToken, deviceId, applicationId);
case 9:
return _context15.abrupt("return", _context15.sent);
case 10:
case "end":
return _context15.stop();
}
}
}, _callee15);
}));
return _storeClientRegistrationToken.apply(this, arguments);
}
function removeClientRegistrationToken(_x35, _x36) {
return _removeClientRegistrationToken.apply(this, arguments);
} // subscribeTopic
function _removeClientRegistrationToken() {
_removeClientRegistrationToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(deviceId, applicationId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
while (1) {
switch (_context16.prev = _context16.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context16.next = 7;
break;
}
_context16.next = 4;
return _moquiIndex3["default"].removeClientRegistrationToken(deviceId, applicationId);
case 4:
return _context16.abrupt("return", _context16.sent);
case 7:
_context16.next = 9;
return (0, _notification.omsRemoveClientRegistrationToken)(deviceId, applicationId);
case 9:
return _context16.abrupt("return", _context16.sent);
case 10:
case "end":
return _context16.stop();
}
}
}, _callee16);
}));
return _removeClientRegistrationToken.apply(this, arguments);
}
function subscribeTopic(_x37, _x38) {
return _subscribeTopic.apply(this, arguments);
} // unsubscribeTopic
function _subscribeTopic() {
_subscribeTopic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(topicName, applicationId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
while (1) {
switch (_context17.prev = _context17.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context17.next = 7;
break;
}
_context17.next = 4;
return _moquiIndex3["default"].subscribeTopic(topicName, applicationId);
case 4:
return _context17.abrupt("return", _context17.sent);
case 7:
_context17.next = 9;
return (0, _notification.omsSubscribeTopic)(topicName, applicationId);
case 9:
return _context17.abrupt("return", _context17.sent);
case 10:
case "end":
return _context17.stop();
}
}
}, _callee17);
}));
return _subscribeTopic.apply(this, arguments);
}
function unsubscribeTopic(_x39, _x40) {
return _unsubscribeTopic.apply(this, arguments);
}
function _unsubscribeTopic() {
_unsubscribeTopic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(topicName, applicationId) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
while (1) {
switch (_context18.prev = _context18.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context18.next = 7;
break;
}
_context18.next = 4;
return _moquiIndex3["default"].unsubscribeTopic(topicName, applicationId);
case 4:
return _context18.abrupt("return", _context18.sent);
case 7:
_context18.next = 9;
return (0, _notification.omsUnsubscribeTopic)(topicName, applicationId);
case 9:
return _context18.abrupt("return", _context18.sent);
case 10:
case "end":
return _context18.stop();
}
}
}, _callee18);
}));
return _unsubscribeTopic.apply(this, arguments);
}
function loginShopifyAppUser(_x41, _x42) {
return _loginShopifyAppUser.apply(this, arguments);
}
function _loginShopifyAppUser() {
_loginShopifyAppUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(baseURL, payload) {
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
while (1) {
switch (_context19.prev = _context19.next) {
case 0:
_context19.next = 2;
return _moquiIndex["default"].loginShopifyAppUser(baseURL, payload);
case 2:
return _context19.abrupt("return", _context19.sent);
case 3:
case "end":
return _context19.stop();
}
}
}, _callee19);
}));
return _loginShopifyAppUser.apply(this, arguments);
}
function setUserTimeZone(_x43) {
return _setUserTimeZone.apply(this, arguments);
}
function _setUserTimeZone() {
_setUserTimeZone = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(payload) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
while (1) {
switch (_context20.prev = _context20.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context20.next = 7;
break;
}
_context20.next = 4;
return _moquiIndex["default"].setUserTimeZone(payload);
case 4:
return _context20.abrupt("return", _context20.sent);
case 7:
_context20.next = 9;
return (0, _user.omsSetUserTimeZone)(payload);
case 9:
return _context20.abrupt("return", _context20.sent);
case 10:
case "end":
return _context20.stop();
}
}
}, _callee20);
}));
return _setUserTimeZone.apply(this, arguments);
}
function setUserLocale(_x44) {
return _setUserLocale.apply(this, arguments);
}
function _setUserLocale() {
_setUserLocale = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(payload) {
var apiConfig;
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
while (1) {
switch (_context21.prev = _context21.next) {
case 0:
apiConfig = (0, _api.getConfig)();
if (!(apiConfig.systemType === "MOQUI")) {
_context21.next = 7;
break;
}
_context21.next = 4;
return _moquiIndex["default"].setUserLocale(payload);
case 4:
return _context21.abrupt("return", _context21.sent);
case 7:
_context21.next = 9;
return (0, _user.omsSetUserLocale)(payload);
case 9:
return _context21.abrupt("return", _context21.sent);
case 10:
case "end":
return _context21.stop();
}
}
}, _callee21);
}));
return _setUserLocale.apply(this, arguments);
}