UNPKG

@bolttech/server-side-next

Version:

This library was generated with [Nx](https://nx.dev).

3 lines (2 loc) 11.8 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("dotenv"),r=require("./_rollupPluginBabelHelpers-41c00fec.js"),t=require("./_tslib-0e64cda4.js"),n=require("./quote.constants-da151fc5.js"),o=require("./logger.service-16a2faf9.js"),i=require("./voucher.service-18daae54.js"),a=require("./get-translations.util-55556247.js"),u=require("crypto"),s=require("./filter-component-by-language.util-14e693f6.js"),c=require("@bolttech/essentials"),p=require("./url.util-0719d39e.js"),v=require("./index-3f29ef8b.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("lodash"),require("@edirect/request"),require("@edirect/oidc-client"),require("lodash/fp"),require("axios"),require("url"),require("querystring");var d=l(e).default,f=process.env.NODE_ENV||"development",g=d.config({path:".".concat(f,".env")}),m={assetPrefix:process.env.BUNDLE_URL,compiler:{styledComponents:{ssr:!0,minify:!0,pure:!0}},env:g.parsed,images:{loader:"default",minimumCacheTTL:31536e3,domains:Object.keys(process.env).filter((function(e){return e.includes("CDN_DOMAINS")})).map((function(e){return process.env[e]}))}};"production"===process.env.NODE_ENV&&(m.compress=!0,m.compiler.removeConsole={exclude:["error"]},m.distDir="build/client",m.experimental={modularizeImports:{lodash:{transform:"lodash/{{member}}"}}},m.productionBrowserSourceMaps=!0,m.swcMinify=!0);var h=m,y=new(function(){return r._createClass((function e(){r._classCallCheck(this,e)}),[{key:"sendRequest",value:function(e,o,i,a){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",n.gatewayService.sendRequest(e,o,i,a).then((function(e){return e.result})));case 1:case"end":return r.stop()}}),t)})))}},{key:"createCustomer",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("POST","/customer",e,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on createCustomer:",r.t0),new Error("Error on createCustomer: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"createEntity",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("POST","/entity",e,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on createEntity:",r.t0),new Error("Error on createEntity: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"createEntityUser",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){var i;return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,e.firstName=e.firstName||e.name,e.email=e.email&&"".concat(e.email).toLowerCase(),e.entityId){r.next=5;break}throw new Error("invalidPartner");case 5:if(!(i=e.shop)){r.next=12;break}return r.next=9,this.validatePartnerId(e.entityId,i.partnerId);case 9:if(r.sent){r.next=12;break}throw new Error("partnerId is not valid");case 12:return r.abrupt("return",this.sendRequest("POST","/entityuser",e,n));case 15:throw r.prev=15,r.t0=r.catch(0),o.loggerService.error("Error on createEntityUser:",r.t0),new Error("Error on createEntityUser: ".concat(r.t0));case 19:case"end":return r.stop()}}),t,this,[[0,15]])})))}},{key:"deleteEntity",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.sendRequest("DELETE","/entity/".concat(e),void 0,n);case 3:r.next=9;break;case 5:throw r.prev=5,r.t0=r.catch(0),o.loggerService.error("Error on deleteEntity:",r.t0),new Error("Error on deleteEntity: ".concat(r.t0));case 9:case"end":return r.stop()}}),t,this,[[0,5]])})))}},{key:"getAllEntities",value:function(e){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/entity",void 0,e));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on getAllEntities:",r.t0),new Error("Error on getAllEntities: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"getCustomerById",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/customer/".concat(e),void 0,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on getCustomerById:",r.t0),new Error("Error on getCustomerById: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"getEntity",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/entity/".concat(e),void 0,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on getEntity:",r.t0),new Error("Error on getEntity: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"getEntityUser",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/entityuser?query=".concat(JSON.stringify(e)),void 0,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on getEntityUser:",r.t0),new Error("Error on getEntityUser: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"getEntityUserByEmail",value:function(e,n){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/entityuser?query=".concat(JSON.stringify({query:{email:e}})),void 0,n));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on getEntityUserByEmail:",r.t0),new Error("Error on getEntityUserByEmail: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"updateEntity",value:function(e,n,i){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("PUT","/entity/".concat(e),n,i));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on updateEntity:",r.t0),new Error("Error on updateEntity: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"updateEntityUser",value:function(e,n,i){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("PUT","/entityuser/".concat(e),n,i));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on updateEntityUser:",r.t0),new Error("Error on updateEntityUser: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}},{key:"validatePartnerId",value:function(e,n,i){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.abrupt("return",this.sendRequest("GET","/entity/".concat(e,"/validate/partnerId/").concat(n),void 0,i));case 4:throw r.prev=4,r.t0=r.catch(0),o.loggerService.error("Error on validatePartnerId:",r.t0),new Error("Error on validatePartnerId: ".concat(r.t0));case 8:case"end":return r.stop()}}),t,this,[[0,4]])})))}}])}()),E=new(function(){return r._createClass((function e(){r._classCallCheck(this,e)}),[{key:"getTemplate",value:function(e,o){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){var i;return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.gatewayService.sendRequest("GET","template/".concat(e,"/").concat(o));case 2:return i=r.sent,r.abrupt("return",i);case 4:case"end":return r.stop()}}),t)})))}},{key:"useTemplate",value:function(e,o,i){return t.__awaiter(this,void 0,void 0,r._regeneratorRuntime().mark((function t(){var a;return r._regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,n.gatewayService.sendRequest("POST","template/".concat(e,"/").concat(o),i);case 2:return a=r.sent,r.abrupt("return",a);case 4:case"end":return r.stop()}}),t)})))}}])}()),S=function(){return r._createClass((function e(){r._classCallCheck(this,e)}),[{key:"encryptStringWithRsaPublicKey",value:function(e,r){var t=Buffer.from(JSON.stringify(e));return u.publicEncrypt(r,t).toString("base64")}},{key:"decryptStringWithRsaPrivateKey",value:function(e,r){var t=Buffer.from(e,"base64");return u.privateDecrypt(r,t).toString("utf8")}}])}(),_=new S;Object.defineProperty(exports,"ORDER_STATUS",{enumerable:!0,get:function(){return n.ORDER_STATUS}}),exports.PERMISSIONS_OMITTING_FIELDS=n.PERMISSIONS_OMITTING_FIELDS,exports.QUOTEHASH_STATUS=n.QUOTEHASH_STATUS,Object.defineProperty(exports,"QUOTE_STATUS",{enumerable:!0,get:function(){return n.QUOTE_STATUS}}),Object.defineProperty(exports,"QUOTE_SUB_STATUS",{enumerable:!0,get:function(){return n.QUOTE_SUB_STATUS}}),exports.QuoteService=n.QuoteService,exports.STATUS=n.STATUS,exports.SUBSTATUS=n.SUBSTATUS,exports.authService=n.authService,exports.crmStatusReason=n.crmStatusReason,exports.gatewayService=n.gatewayService,exports.oidcService=n.oidcService,exports.pickFieldsOnPaymentConfirmed=n.pickFieldsOnPaymentConfirmed,exports.quoteHashStatuses=n.quoteHashStatuses,exports.quoteParams=n.quoteParams,exports.quoteService=n.quoteService,exports.quoteStatus=n.quoteStatus,exports.quoteSubStatus=n.quoteSubStatus,exports.ConfigService=o.ConfigService,exports.configService=o.configService,exports.VoucherService=i.VoucherService,exports.voucherService=i.voucherService,exports.getTranslations=a.getTranslations,exports.getTranslationsForPageProps=a.getTranslationsForPageProps,exports.filterComponentByDevice=s.filterComponentByDevice,exports.filterComponentByLanguage=s.filterComponentByLanguage,Object.defineProperty(exports,"VerticalComponentMapper",{enumerable:!0,get:function(){return c.VerticalComponentMapper}}),Object.defineProperty(exports,"encodeJsonValues",{enumerable:!0,get:function(){return c.encodeJsonValues}}),Object.defineProperty(exports,"formatDate",{enumerable:!0,get:function(){return c.formatDate}}),Object.defineProperty(exports,"formatValue",{enumerable:!0,get:function(){return c.formatValue}}),Object.defineProperty(exports,"get",{enumerable:!0,get:function(){return c.get}}),Object.defineProperty(exports,"getParams",{enumerable:!0,get:function(){return c.getParams}}),Object.defineProperty(exports,"post",{enumerable:!0,get:function(){return c.post}}),exports.urlEncode=p.urlEncode,exports.urlFilter=p.urlFilter,exports.urlMapper=p.urlMapper,exports.urlParse=p.urlParse,exports.getLocaleFromUrl=v.getLocaleFromUrl,exports.BolttechCryptoService=S,exports.bolttechCryptoService=_,exports.entityService=y,exports.nextConfig=h,exports.templateService=E; //# sourceMappingURL=index.js.map