UNPKG

@commercelayer/organization-config

Version:

Organization config utils for extracting config by market

2 lines 930 B
import{merge as _}from"merge-anything";function I({jsonConfig:l,market:t,params:e}){var n,i,f;if((l==null?void 0:l.mfe)==null)return null;let N=(i=(n=l==null?void 0:l.mfe)==null?void 0:n.default)!=null?i:{},k=t!=null?(f=l==null?void 0:l.mfe[t])!=null?f:{}:{};function M(T){var u,g,o,r,c,d,y;let b=JSON.stringify(T).replace(/:lang/g,(u=e==null?void 0:e.lang)!=null?u:":lang").replace(/:slug/g,(g=e==null?void 0:e.slug)!=null?g:":slug").replace(/:token/g,(o=e==null?void 0:e.token)!=null?o:":token").replace(/:access_token/g,(r=e==null?void 0:e.accessToken)!=null?r:":access_token").replace(/:order_id/g,(c=e==null?void 0:e.orderId)!=null?c:":order_id").replace(/:sku_list_id/g,(d=e==null?void 0:e.skuListId)!=null?d:":sku_list_id").replace(/:sku_id/g,(y=e==null?void 0:e.skuId)!=null?y:":sku_id");return JSON.parse(b)}let C=_(JSON.parse(JSON.stringify(N)),k);return M(C)}export{I as getMfeConfig}; //# sourceMappingURL=index.js.map