@inploi/sdk 0.4.2 → 0.4.3

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/cdn/sdk.js CHANGED
@@ -90,14 +90,6 @@
90
90
  log: (message) => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, message)
91
91
  };
92
92
 
93
- // ../core/dist/chunk-H7ZOE7ZC.mjs
94
- function invariant(condition, message) {
95
- if (condition) {
96
- return;
97
- }
98
- throw new Error(message);
99
- }
100
-
101
93
  // src/sdk.ts
102
94
  function initialiseSdk({
103
95
  publishableKey,
@@ -105,7 +97,8 @@
105
97
  plugins,
106
98
  logger = inploiBrandedLogger
107
99
  }) {
108
- invariant(typeof window !== "undefined", "Can't initialise the inploi SDK outside of a browser environment.");
100
+ if (typeof window === "undefined")
101
+ return null;
109
102
  const apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });
110
103
  const pluginsObj = plugins.reduce((acc, plugin) => {
111
104
  acc[plugin.pluginName] = plugin.initialise({ apiClient, logger });
package/dist/sdk.d.mts CHANGED
@@ -26,6 +26,6 @@ declare function initialiseSdk<TPlugin extends Plugin<any, any>>({ publishableKe
26
26
  pluginName: K;
27
27
  } extends infer T ? { [k in keyof T]: (TPlugin & {
28
28
  pluginName: K;
29
- })[k]; } : never)["initialise"]>; };
29
+ })[k]; } : never)["initialise"]>; } | null;
30
30
 
31
31
  export { InitialiseInploiSdkParams, Logger, Plugin, initialiseSdk };
package/dist/sdk.d.ts CHANGED
@@ -26,6 +26,6 @@ declare function initialiseSdk<TPlugin extends Plugin<any, any>>({ publishableKe
26
26
  pluginName: K;
27
27
  } extends infer T ? { [k in keyof T]: (TPlugin & {
28
28
  pluginName: K;
29
- })[k]; } : never)["initialise"]>; };
29
+ })[k]; } : never)["initialise"]>; } | null;
30
30
 
31
31
  export { InitialiseInploiSdkParams, Logger, Plugin, initialiseSdk };
package/dist/sdk.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty,L=Object.defineProperties,b=Object.getOwnPropertyDescriptor,A=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var P=(e,n,r)=>n in e?g(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,u=(e,n)=>{for(var r in n||(n={}))w.call(n,r)&&P(e,r,n[r]);if(h)for(var r of h(n))C.call(n,r)&&P(e,r,n[r]);return e},x=(e,n)=>L(e,A(n));var N=(e,n)=>{for(var r in n)g(e,r,{get:n[r],enumerable:!0})},S=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of O(n))!w.call(e,i)&&i!==r&&g(e,i,{get:()=>n[i],enumerable:!(t=b(n,i))||t.enumerable});return e};var I=e=>S(g({},"__esModule",{value:!0}),e);var y=(e,n,r)=>new Promise((t,i)=>{var f=a=>{try{o(r.next(a))}catch(m){i(m)}},s=a=>{try{o(r.throw(a))}catch(m){i(m)}},o=a=>a.done?t(a.value):Promise.resolve(a.value).then(f,s);o((r=r.apply(e,n)).next())});var R={};N(R,{CONSOLE_PREFIX:()=>p,CONSOLE_STYLE:()=>l,createPlugin:()=>E,initialiseSdk:()=>q,inploiBrandedLogger:()=>c,noLogging:()=>U});module.exports=I(R);var v={sandbox:"https://preview.api.inploi.com",production:"https://api.inploi.com"};var _="Unauthenticated",M="This action is unauthorized.",T=e=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(i,...f)=>y(void 0,[i,...f],function*(r,t={}){let s=x(u({},t),{headers:u(u({},t.headers),n)}),o=yield fetch(`${e.baseUrl}${r}`,s).then(a=>a.json());if("message"in o){if(o.message===_)throw new Error("You are not authenticated.");if(o.message===M)throw new Error("You are not authenticated.");if("exception"in o)throw new Error(`API error: \u201C${o.message}\u201D`);if("errors"in o)throw new Error(`API error: \u201C${o.message}\u201D`)}return o})}};var p="%c[inploi SDK]",l="color: #65BC67; font-weight: bold;",c={warn:e=>console.warn(p,l,e),error:e=>console.error(p,l,e),info:e=>console.info(p,l,e),log:e=>console.log(p,l,e)},U={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};function d(e,n){if(!e)throw new Error(n)}var E=(e,{initialise:n})=>({pluginName:e,initialise:n});function q({publishableKey:e,env:n,plugins:r,logger:t=c}){d(typeof window!="undefined","Can't initialise the inploi SDK outside of a browser environment.");let i=T({baseUrl:v[n],publishableKey:e});return r.reduce((s,o)=>(s[o.pluginName]=o.initialise({apiClient:i,logger:t}),s),{})}0&&(module.exports={CONSOLE_PREFIX,CONSOLE_STYLE,createPlugin,initialiseSdk,inploiBrandedLogger,noLogging});
1
+ "use strict";var l=Object.defineProperty,T=Object.defineProperties,E=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var f=(e,n,o)=>n in e?l(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,u=(e,n)=>{for(var o in n||(n={}))x.call(n,o)&&f(e,o,n[o]);if(P)for(var o of P(n))v.call(n,o)&&f(e,o,n[o]);return e},h=(e,n)=>T(e,b(n));var I=(e,n)=>{for(var o in n)l(e,o,{get:n[o],enumerable:!0})},N=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of C(n))!x.call(e,r)&&r!==o&&l(e,r,{get:()=>n[r],enumerable:!(t=E(n,r))||t.enumerable});return e};var O=e=>N(l({},"__esModule",{value:!0}),e);var y=(e,n,o)=>new Promise((t,r)=>{var d=s=>{try{i(o.next(s))}catch(m){r(m)}},a=s=>{try{i(o.throw(s))}catch(m){r(m)}},i=s=>s.done?t(s.value):Promise.resolve(s.value).then(d,a);i((o=o.apply(e,n)).next())});var U={};I(U,{CONSOLE_PREFIX:()=>p,CONSOLE_STYLE:()=>g,createPlugin:()=>A,initialiseSdk:()=>S,inploiBrandedLogger:()=>c,noLogging:()=>R});module.exports=O(U);var L={sandbox:"https://preview.api.inploi.com",production:"https://api.inploi.com"};var _="Unauthenticated",M="This action is unauthorized.",w=e=>{let n={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(r,...d)=>y(void 0,[r,...d],function*(o,t={}){let a=h(u({},t),{headers:u(u({},t.headers),n)}),i=yield fetch(`${e.baseUrl}${o}`,a).then(s=>s.json());if("message"in i){if(i.message===_)throw new Error("You are not authenticated.");if(i.message===M)throw new Error("You are not authenticated.");if("exception"in i)throw new Error(`API error: \u201C${i.message}\u201D`);if("errors"in i)throw new Error(`API error: \u201C${i.message}\u201D`)}return i})}};var p="%c[inploi SDK]",g="color: #65BC67; font-weight: bold;",c={warn:e=>console.warn(p,g,e),error:e=>console.error(p,g,e),info:e=>console.info(p,g,e),log:e=>console.log(p,g,e)},R={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};var A=(e,{initialise:n})=>({pluginName:e,initialise:n});function S({publishableKey:e,env:n,plugins:o,logger:t=c}){if(typeof window=="undefined")return null;let r=w({baseUrl:L[n],publishableKey:e});return o.reduce((a,i)=>(a[i.pluginName]=i.initialise({apiClient:r,logger:t}),a),{})}0&&(module.exports={CONSOLE_PREFIX,CONSOLE_STYLE,createPlugin,initialiseSdk,inploiBrandedLogger,noLogging});
2
2
  //# sourceMappingURL=sdk.js.map
package/dist/sdk.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sdk.ts","../src/journeys/journeys.constants.ts","../src/journeys/journeys.api.ts","../src/common/common.logger.ts","../../core/src/common/common.utils.ts","../src/common/common.plugins.ts"],"sourcesContent":["import { ENV_TO_API_URL } from './journeys/journeys.constants';\nimport { createApiClient } from './journeys/journeys.api';\nimport { Logger, inploiBrandedLogger } from './common/common.logger';\n\nimport { Flatten, invariant } from '@inploi/core/common';\nimport { AppEnvironment } from './common/common.constants';\nimport { Plugin } from './common/common.plugins';\n\n/** Different loggers so people can use `noLogging` */\nexport * from './common/common.logger';\nexport type { Plugin } from './common/common.plugins';\nexport { createPlugin } from './common/common.plugins';\n\nexport type InitialiseInploiSdkParams<P extends Plugin<any, any>> = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Add your plugins here. Try importing and passing `journeysPlugin` ;) */\n\tplugins: P[];\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: AppEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by importing and passing `noLogging`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger;\n};\n\nexport function initialiseSdk<TPlugin extends Plugin<any, any>>({\n\tpublishableKey,\n\tenv,\n\tplugins,\n\tlogger = inploiBrandedLogger,\n}: InitialiseInploiSdkParams<TPlugin>) {\n\tinvariant(typeof window !== 'undefined', \"Can't initialise the inploi SDK outside of a browser environment.\");\n\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\n\tconst pluginsObj = plugins.reduce((acc, plugin) => {\n\t\tacc[plugin.pluginName as TPlugin['pluginName']] = plugin.initialise({ apiClient, logger });\n\t\treturn acc;\n\t}, {} as { [K in TPlugin['pluginName']]: ReturnType<Flatten<TPlugin & { pluginName: K }>['initialise']> });\n\n\treturn pluginsObj;\n}\n","import { AppEnvironment } from '../common/common.constants';\n\nexport const ENV_TO_API_URL: Record<AppEnvironment, string> = {\n\tsandbox: 'https://preview.api.inploi.com',\n\tproduction: 'https://api.inploi.com',\n};\n\nexport const JOURNEY_PATHNAME = '/journey/log';\n","export const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init).then(res => res.json());\n\n\t\t\tif ('message' in response) {\n\t\t\t\tif (response.message === unauthenticatedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif (response.message === unauthorisedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif ('exception' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t\tif ('errors' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn response;\n\t\t},\n\t};\n};\n","export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: message => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\terror: message => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tinfo: message => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tlog: message => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","export const exhaustive = (value: never) => {\n\tthrow new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);\n};\n\nexport function invariant(condition: any, message?: string): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\n\tthrow new Error(message);\n}\n\nexport const uniqueOrThrow = <T>(array: T[]) => {\n\tconst uniqueValues = new Set(array);\n\n\tif (array.length !== uniqueValues.size) {\n\t\tthrow new Error('Duplicate values found');\n\t}\n\treturn true;\n};\n\nexport const uniqueByPropertyOrThrow =\n\t<T extends PropertyKey>(propertyKey: T) =>\n\t(array: { [K in T]: any }[]) => {\n\t\tconst values = array.map(item => item[propertyKey]);\n\t\tconst uniqueValues = new Set(values);\n\n\t\tif (values.length !== uniqueValues.size) {\n\t\t\tthrow new Error(`Duplicate values found for property: ${propertyKey.toString()}`);\n\t\t}\n\t\treturn true;\n\t};\n","import { Logger } from './common.logger';\nimport { ApiClient } from '../journeys/journeys.api';\n\nexport type PluginParams = {\n\tapiClient: ApiClient;\n\tlogger?: Logger;\n};\n\nexport type Plugin<T extends string, P> = {\n\tpluginName: T;\n\tinitialise: (params: PluginParams) => P;\n};\n\nexport const createPlugin = <T extends string, P>(\n\tpluginName: T,\n\t{ initialise }: { initialise: (params: PluginParams) => P }\n): Plugin<T, P> => ({\n\tpluginName,\n\tinitialise,\n});\n"],"mappings":"i9BAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,kBAAAC,EAAA,wBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAR,GCEO,IAAMS,EAAiD,CAC7D,QAAS,iCACT,WAAY,wBACb,ECLO,IAAMC,EAAyB,kBACzBC,EAAsB,+BAMtBC,EAAmBC,GAAmE,CAClG,IAAMC,EAA8B,CACnC,OAAQ,mBACR,eAAgB,mBAChB,oBAAqBD,EAAO,cAC7B,EAEA,MAAO,CACN,MAAO,CAAOE,KAA2BC,IAAAC,EAAA,QAA3BF,EAA2B,GAAAC,GAAA,UAA3BE,EAAUC,EAAU,CAAC,EAAM,CACxC,IAAMC,EAAOC,EAAAC,EAAA,GAAKH,GAAL,CAAc,QAASG,IAAA,GAAKH,EAAQ,SAAYL,EAAiB,GACxES,EAAW,MAAM,MAAM,GAAGV,EAAO,OAAO,GAAGK,CAAQ,GAAIE,CAAI,EAAE,KAAKI,GAAOA,EAAI,KAAK,CAAC,EAEzF,GAAI,YAAaD,EAAU,CAC1B,GAAIA,EAAS,UAAYb,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAIa,EAAS,UAAYZ,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAI,cAAeY,EAClB,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,EAEnD,GAAI,WAAYA,EACf,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,CAEpD,CACA,OAAOA,CACR,EACD,CACD,ECpCO,IAAME,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAMC,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,MAAOA,GAAW,QAAQ,MAAMH,EAAgBC,EAAeE,CAAO,EACtE,KAAMA,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,IAAKA,GAAW,QAAQ,IAAIH,EAAgBC,EAAeE,CAAO,CACnE,EAEaC,EAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECd3G,SAASC,EAAUC,EAAgBC,EAAqC,CAC9E,GAAI,CAAAD,EAIJ,MAAM,IAAI,MAAMC,CAAO,CACxB,CCGO,IAAMC,EAAe,CAC3BC,EACA,CAAE,WAAAC,CAAW,KACM,CACnB,WAAAD,EACA,WAAAC,CACD,GLSO,SAASC,EAAgD,CAC/D,eAAAC,EACA,IAAAC,EACA,QAAAC,EACA,OAAAC,EAASC,CACV,EAAuC,CACtCC,EAAU,OAAO,QAAW,YAAa,mEAAmE,EAE5G,IAAMC,EAAYC,EAAgB,CAAE,QAASC,EAAeP,CAAG,EAAG,eAAAD,CAAe,CAAC,EAOlF,OALmBE,EAAQ,OAAO,CAACO,EAAKC,KACvCD,EAAIC,EAAO,UAAmC,EAAIA,EAAO,WAAW,CAAE,UAAAJ,EAAW,OAAAH,CAAO,CAAC,EAClFM,GACL,CAAC,CAAqG,CAG1G","names":["sdk_exports","__export","CONSOLE_PREFIX","CONSOLE_STYLE","createPlugin","initialiseSdk","inploiBrandedLogger","noLogging","__toCommonJS","ENV_TO_API_URL","unauthenticatedMessage","unauthorisedMessage","createApiClient","params","defaultHeaders","_0","_1","__async","pathname","options","init","__spreadProps","__spreadValues","response","res","CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","message","noLogging","invariant","condition","message","createPlugin","pluginName","initialise","initialiseSdk","publishableKey","env","plugins","logger","inploiBrandedLogger","invariant","apiClient","createApiClient","ENV_TO_API_URL","acc","plugin"]}
1
+ {"version":3,"sources":["../src/sdk.ts","../src/journeys/journeys.constants.ts","../src/journeys/journeys.api.ts","../src/common/common.logger.ts","../src/common/common.plugins.ts"],"sourcesContent":["import { ENV_TO_API_URL } from './journeys/journeys.constants';\nimport { createApiClient } from './journeys/journeys.api';\nimport { Logger, inploiBrandedLogger } from './common/common.logger';\n\nimport { Flatten } from '@inploi/core/common';\nimport { AppEnvironment } from './common/common.constants';\nimport { Plugin } from './common/common.plugins';\n\n/** Different loggers so people can use `noLogging` */\nexport * from './common/common.logger';\nexport type { Plugin } from './common/common.plugins';\nexport { createPlugin } from './common/common.plugins';\n\nexport type InitialiseInploiSdkParams<P extends Plugin<any, any>> = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Add your plugins here. Try importing and passing `journeysPlugin` ;) */\n\tplugins: P[];\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: AppEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by importing and passing `noLogging`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger;\n};\n\nexport function initialiseSdk<TPlugin extends Plugin<any, any>>({\n\tpublishableKey,\n\tenv,\n\tplugins,\n\tlogger = inploiBrandedLogger,\n}: InitialiseInploiSdkParams<TPlugin>) {\n\tif (typeof window === 'undefined') return null;\n\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\n\tconst pluginsObj = plugins.reduce((acc, plugin) => {\n\t\tacc[plugin.pluginName as TPlugin['pluginName']] = plugin.initialise({ apiClient, logger });\n\t\treturn acc;\n\t}, {} as { [K in TPlugin['pluginName']]: ReturnType<Flatten<TPlugin & { pluginName: K }>['initialise']> });\n\n\treturn pluginsObj;\n}\n","import { AppEnvironment } from '../common/common.constants';\n\nexport const ENV_TO_API_URL: Record<AppEnvironment, string> = {\n\tsandbox: 'https://preview.api.inploi.com',\n\tproduction: 'https://api.inploi.com',\n};\n\nexport const JOURNEY_PATHNAME = '/journey/log';\n","export const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init).then(res => res.json());\n\n\t\t\tif ('message' in response) {\n\t\t\t\tif (response.message === unauthenticatedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif (response.message === unauthorisedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif ('exception' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t\tif ('errors' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn response;\n\t\t},\n\t};\n};\n","export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: message => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\terror: message => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tinfo: message => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tlog: message => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","import { Logger } from './common.logger';\nimport { ApiClient } from '../journeys/journeys.api';\n\nexport type PluginParams = {\n\tapiClient: ApiClient;\n\tlogger?: Logger;\n};\n\nexport type Plugin<T extends string, P> = {\n\tpluginName: T;\n\tinitialise: (params: PluginParams) => P;\n};\n\nexport const createPlugin = <T extends string, P>(\n\tpluginName: T,\n\t{ initialise }: { initialise: (params: PluginParams) => P }\n): Plugin<T, P> => ({\n\tpluginName,\n\tinitialise,\n});\n"],"mappings":"i9BAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,kBAAAC,EAAA,wBAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAR,GCEO,IAAMS,EAAiD,CAC7D,QAAS,iCACT,WAAY,wBACb,ECLO,IAAMC,EAAyB,kBACzBC,EAAsB,+BAMtBC,EAAmBC,GAAmE,CAClG,IAAMC,EAA8B,CACnC,OAAQ,mBACR,eAAgB,mBAChB,oBAAqBD,EAAO,cAC7B,EAEA,MAAO,CACN,MAAO,CAAOE,KAA2BC,IAAAC,EAAA,QAA3BF,EAA2B,GAAAC,GAAA,UAA3BE,EAAUC,EAAU,CAAC,EAAM,CACxC,IAAMC,EAAOC,EAAAC,EAAA,GAAKH,GAAL,CAAc,QAASG,IAAA,GAAKH,EAAQ,SAAYL,EAAiB,GACxES,EAAW,MAAM,MAAM,GAAGV,EAAO,OAAO,GAAGK,CAAQ,GAAIE,CAAI,EAAE,KAAKI,GAAOA,EAAI,KAAK,CAAC,EAEzF,GAAI,YAAaD,EAAU,CAC1B,GAAIA,EAAS,UAAYb,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAIa,EAAS,UAAYZ,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAI,cAAeY,EAClB,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,EAEnD,GAAI,WAAYA,EACf,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,CAEpD,CACA,OAAOA,CACR,EACD,CACD,ECpCO,IAAME,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAMC,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,MAAOA,GAAW,QAAQ,MAAMH,EAAgBC,EAAeE,CAAO,EACtE,KAAMA,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,IAAKA,GAAW,QAAQ,IAAIH,EAAgBC,EAAeE,CAAO,CACnE,EAEaC,EAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECL3G,IAAMC,EAAe,CAC3BC,EACA,CAAE,WAAAC,CAAW,KACM,CACnB,WAAAD,EACA,WAAAC,CACD,GJSO,SAASC,EAAgD,CAC/D,eAAAC,EACA,IAAAC,EACA,QAAAC,EACA,OAAAC,EAASC,CACV,EAAuC,CACtC,GAAI,OAAO,QAAW,YAAa,OAAO,KAE1C,IAAMC,EAAYC,EAAgB,CAAE,QAASC,EAAeN,CAAG,EAAG,eAAAD,CAAe,CAAC,EAOlF,OALmBE,EAAQ,OAAO,CAACM,EAAKC,KACvCD,EAAIC,EAAO,UAAmC,EAAIA,EAAO,WAAW,CAAE,UAAAJ,EAAW,OAAAF,CAAO,CAAC,EAClFK,GACL,CAAC,CAAqG,CAG1G","names":["sdk_exports","__export","CONSOLE_PREFIX","CONSOLE_STYLE","createPlugin","initialiseSdk","inploiBrandedLogger","noLogging","__toCommonJS","ENV_TO_API_URL","unauthenticatedMessage","unauthorisedMessage","createApiClient","params","defaultHeaders","_0","_1","__async","pathname","options","init","__spreadProps","__spreadValues","response","res","CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","message","noLogging","createPlugin","pluginName","initialise","initialiseSdk","publishableKey","env","plugins","logger","inploiBrandedLogger","apiClient","createApiClient","ENV_TO_API_URL","acc","plugin"]}
package/dist/sdk.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a as t,b as p,c as g,d as c,f as w}from"./chunk-KHVPBEFD.mjs";var x="Unauthenticated",y="This action is unauthorized.",m=e=>{let r={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(h,...P)=>g(void 0,[h,...P],function*(u,o={}){let i=p(t({},o),{headers:t(t({},o.headers),r)}),n=yield fetch(`${e.baseUrl}${u}`,i).then(f=>f.json());if("message"in n){if(n.message===x)throw new Error("You are not authenticated.");if(n.message===y)throw new Error("You are not authenticated.");if("exception"in n)throw new Error(`API error: \u201C${n.message}\u201D`);if("errors"in n)throw new Error(`API error: \u201C${n.message}\u201D`)}return n})}};var a="%c[inploi SDK]",s="color: #65BC67; font-weight: bold;",d={warn:e=>console.warn(a,s,e),error:e=>console.error(a,s,e),info:e=>console.info(a,s,e),log:e=>console.log(a,s,e)},b={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};function l(e,r){if(!e)throw new Error(r)}function j({publishableKey:e,env:r,plugins:u,logger:o=d}){l(typeof window!="undefined","Can't initialise the inploi SDK outside of a browser environment.");let h=m({baseUrl:c[r],publishableKey:e});return u.reduce((i,n)=>(i[n.pluginName]=n.initialise({apiClient:h,logger:o}),i),{})}export{a as CONSOLE_PREFIX,s as CONSOLE_STYLE,w as createPlugin,j as initialiseSdk,d as inploiBrandedLogger,b as noLogging};
1
+ import{a as i,b as l,c as p,d as u,f as h}from"./chunk-KHVPBEFD.mjs";var P="Unauthenticated",x="This action is unauthorized.",c=e=>{let a={Accept:"application/json","Content-Type":"application/json","x-publishable-key":e.publishableKey};return{fetch:(d,...y)=>p(void 0,[d,...y],function*(g,o={}){let r=l(i({},o),{headers:i(i({},o.headers),a)}),n=yield fetch(`${e.baseUrl}${g}`,r).then(f=>f.json());if("message"in n){if(n.message===P)throw new Error("You are not authenticated.");if(n.message===x)throw new Error("You are not authenticated.");if("exception"in n)throw new Error(`API error: \u201C${n.message}\u201D`);if("errors"in n)throw new Error(`API error: \u201C${n.message}\u201D`)}return n})}};var t="%c[inploi SDK]",s="color: #65BC67; font-weight: bold;",m={warn:e=>console.warn(t,s,e),error:e=>console.error(t,s,e),info:e=>console.info(t,s,e),log:e=>console.log(t,s,e)},b={info:()=>{},error:()=>{},log:()=>{},warn:()=>{}};function v({publishableKey:e,env:a,plugins:g,logger:o=m}){if(typeof window=="undefined")return null;let d=c({baseUrl:u[a],publishableKey:e});return g.reduce((r,n)=>(r[n.pluginName]=n.initialise({apiClient:d,logger:o}),r),{})}export{t as CONSOLE_PREFIX,s as CONSOLE_STYLE,h as createPlugin,v as initialiseSdk,m as inploiBrandedLogger,b as noLogging};
2
2
  //# sourceMappingURL=sdk.mjs.map
package/dist/sdk.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/journeys/journeys.api.ts","../src/common/common.logger.ts","../../core/src/common/common.utils.ts","../src/sdk.ts"],"sourcesContent":["export const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init).then(res => res.json());\n\n\t\t\tif ('message' in response) {\n\t\t\t\tif (response.message === unauthenticatedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif (response.message === unauthorisedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif ('exception' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t\tif ('errors' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn response;\n\t\t},\n\t};\n};\n","export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: message => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\terror: message => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tinfo: message => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tlog: message => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","export const exhaustive = (value: never) => {\n\tthrow new Error(`Unhandled discriminated union member: ${JSON.stringify(value)}`);\n};\n\nexport function invariant(condition: any, message?: string): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\n\tthrow new Error(message);\n}\n\nexport const uniqueOrThrow = <T>(array: T[]) => {\n\tconst uniqueValues = new Set(array);\n\n\tif (array.length !== uniqueValues.size) {\n\t\tthrow new Error('Duplicate values found');\n\t}\n\treturn true;\n};\n\nexport const uniqueByPropertyOrThrow =\n\t<T extends PropertyKey>(propertyKey: T) =>\n\t(array: { [K in T]: any }[]) => {\n\t\tconst values = array.map(item => item[propertyKey]);\n\t\tconst uniqueValues = new Set(values);\n\n\t\tif (values.length !== uniqueValues.size) {\n\t\t\tthrow new Error(`Duplicate values found for property: ${propertyKey.toString()}`);\n\t\t}\n\t\treturn true;\n\t};\n","import { ENV_TO_API_URL } from './journeys/journeys.constants';\nimport { createApiClient } from './journeys/journeys.api';\nimport { Logger, inploiBrandedLogger } from './common/common.logger';\n\nimport { Flatten, invariant } from '@inploi/core/common';\nimport { AppEnvironment } from './common/common.constants';\nimport { Plugin } from './common/common.plugins';\n\n/** Different loggers so people can use `noLogging` */\nexport * from './common/common.logger';\nexport type { Plugin } from './common/common.plugins';\nexport { createPlugin } from './common/common.plugins';\n\nexport type InitialiseInploiSdkParams<P extends Plugin<any, any>> = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Add your plugins here. Try importing and passing `journeysPlugin` ;) */\n\tplugins: P[];\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: AppEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by importing and passing `noLogging`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger;\n};\n\nexport function initialiseSdk<TPlugin extends Plugin<any, any>>({\n\tpublishableKey,\n\tenv,\n\tplugins,\n\tlogger = inploiBrandedLogger,\n}: InitialiseInploiSdkParams<TPlugin>) {\n\tinvariant(typeof window !== 'undefined', \"Can't initialise the inploi SDK outside of a browser environment.\");\n\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\n\tconst pluginsObj = plugins.reduce((acc, plugin) => {\n\t\tacc[plugin.pluginName as TPlugin['pluginName']] = plugin.initialise({ apiClient, logger });\n\t\treturn acc;\n\t}, {} as { [K in TPlugin['pluginName']]: ReturnType<Flatten<TPlugin & { pluginName: K }>['initialise']> });\n\n\treturn pluginsObj;\n}\n"],"mappings":"qEAAO,IAAMA,EAAyB,kBACzBC,EAAsB,+BAMtBC,EAAmBC,GAAmE,CAClG,IAAMC,EAA8B,CACnC,OAAQ,mBACR,eAAgB,mBAChB,oBAAqBD,EAAO,cAC7B,EAEA,MAAO,CACN,MAAO,CAAOE,KAA2BC,IAAAC,EAAA,QAA3BF,EAA2B,GAAAC,GAAA,UAA3BE,EAAUC,EAAU,CAAC,EAAM,CACxC,IAAMC,EAAOC,EAAAC,EAAA,GAAKH,GAAL,CAAc,QAASG,IAAA,GAAKH,EAAQ,SAAYL,EAAiB,GACxES,EAAW,MAAM,MAAM,GAAGV,EAAO,OAAO,GAAGK,CAAQ,GAAIE,CAAI,EAAE,KAAKI,GAAOA,EAAI,KAAK,CAAC,EAEzF,GAAI,YAAaD,EAAU,CAC1B,GAAIA,EAAS,UAAYb,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAIa,EAAS,UAAYZ,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAI,cAAeY,EAClB,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,EAEnD,GAAI,WAAYA,EACf,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,CAEpD,CACA,OAAOA,CACR,EACD,CACD,ECpCO,IAAME,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAMC,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,MAAOA,GAAW,QAAQ,MAAMH,EAAgBC,EAAeE,CAAO,EACtE,KAAMA,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,IAAKA,GAAW,QAAQ,IAAIH,EAAgBC,EAAeE,CAAO,CACnE,EAEaC,EAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECd3G,SAASC,EAAUC,EAAgBC,EAAqC,CAC9E,GAAI,CAAAD,EAIJ,MAAM,IAAI,MAAMC,CAAO,CACxB,CCkBO,SAASC,EAAgD,CAC/D,eAAAC,EACA,IAAAC,EACA,QAAAC,EACA,OAAAC,EAASC,CACV,EAAuC,CACtCC,EAAU,OAAO,QAAW,YAAa,mEAAmE,EAE5G,IAAMC,EAAYC,EAAgB,CAAE,QAASC,EAAeP,CAAG,EAAG,eAAAD,CAAe,CAAC,EAOlF,OALmBE,EAAQ,OAAO,CAACO,EAAKC,KACvCD,EAAIC,EAAO,UAAmC,EAAIA,EAAO,WAAW,CAAE,UAAAJ,EAAW,OAAAH,CAAO,CAAC,EAClFM,GACL,CAAC,CAAqG,CAG1G","names":["unauthenticatedMessage","unauthorisedMessage","createApiClient","params","defaultHeaders","_0","_1","__async","pathname","options","init","__spreadProps","__spreadValues","response","res","CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","message","noLogging","invariant","condition","message","initialiseSdk","publishableKey","env","plugins","logger","inploiBrandedLogger","invariant","apiClient","createApiClient","ENV_TO_API_URL","acc","plugin"]}
1
+ {"version":3,"sources":["../src/journeys/journeys.api.ts","../src/common/common.logger.ts","../src/sdk.ts"],"sourcesContent":["export const unauthenticatedMessage = 'Unauthenticated';\nexport const unauthorisedMessage = 'This action is unauthorized.';\n\nexport type ApiClient = {\n\tfetch: (pathname: string, options?: RequestInit) => Promise<unknown>;\n};\n\nexport const createApiClient = (params: { baseUrl: string; publishableKey: string }): ApiClient => {\n\tconst defaultHeaders: HeadersInit = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'x-publishable-key': params.publishableKey,\n\t};\n\n\treturn {\n\t\tfetch: async (pathname, options = {}) => {\n\t\t\tconst init = { ...options, headers: { ...options.headers, ...defaultHeaders } };\n\t\t\tconst response = await fetch(`${params.baseUrl}${pathname}`, init).then(res => res.json());\n\n\t\t\tif ('message' in response) {\n\t\t\t\tif (response.message === unauthenticatedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif (response.message === unauthorisedMessage) {\n\t\t\t\t\tthrow new Error('You are not authenticated.');\n\t\t\t\t}\n\t\t\t\tif ('exception' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t\tif ('errors' in response) {\n\t\t\t\t\tthrow new Error(`API error: “${response.message}”`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn response;\n\t\t},\n\t};\n};\n","export const CONSOLE_PREFIX = '%c[inploi SDK]';\nexport const CONSOLE_STYLE = 'color: #65BC67; font-weight: bold;';\n\ntype LogMessage = (...data: any[]) => void;\nexport type Logger = {\n\twarn: LogMessage;\n\terror: LogMessage;\n\tinfo: LogMessage;\n\tlog: LogMessage;\n};\n\nexport const inploiBrandedLogger: Logger = {\n\twarn: message => console.warn(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\terror: message => console.error(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tinfo: message => console.info(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n\tlog: message => console.log(CONSOLE_PREFIX, CONSOLE_STYLE, message),\n};\n\nexport const noLogging: Logger = { info: () => void 0, error: () => void 0, log: () => void 0, warn: () => void 0 };\n","import { ENV_TO_API_URL } from './journeys/journeys.constants';\nimport { createApiClient } from './journeys/journeys.api';\nimport { Logger, inploiBrandedLogger } from './common/common.logger';\n\nimport { Flatten } from '@inploi/core/common';\nimport { AppEnvironment } from './common/common.constants';\nimport { Plugin } from './common/common.plugins';\n\n/** Different loggers so people can use `noLogging` */\nexport * from './common/common.logger';\nexport type { Plugin } from './common/common.plugins';\nexport { createPlugin } from './common/common.plugins';\n\nexport type InitialiseInploiSdkParams<P extends Plugin<any, any>> = {\n\t/** Your public API key for the inploi SDK. */\n\tpublishableKey: string;\n\t/** Add your plugins here. Try importing and passing `journeysPlugin` ;) */\n\tplugins: P[];\n\t/** Which app environment to run. This ultimately affects which inploi endpoints to gather data are going to be used.\n\t * Anything other than `production` should be considered a development environment and the data periodicaly purged. */\n\tenv: AppEnvironment;\n\t/** Logger object that handles logging of different levels.\n\t * You can override this to use your own logger, or to disable logging altogether by importing and passing `noLogging`.\n\t * @default inploiBrandedLogger\n\t * */\n\tlogger?: Logger;\n};\n\nexport function initialiseSdk<TPlugin extends Plugin<any, any>>({\n\tpublishableKey,\n\tenv,\n\tplugins,\n\tlogger = inploiBrandedLogger,\n}: InitialiseInploiSdkParams<TPlugin>) {\n\tif (typeof window === 'undefined') return null;\n\n\tconst apiClient = createApiClient({ baseUrl: ENV_TO_API_URL[env], publishableKey });\n\n\tconst pluginsObj = plugins.reduce((acc, plugin) => {\n\t\tacc[plugin.pluginName as TPlugin['pluginName']] = plugin.initialise({ apiClient, logger });\n\t\treturn acc;\n\t}, {} as { [K in TPlugin['pluginName']]: ReturnType<Flatten<TPlugin & { pluginName: K }>['initialise']> });\n\n\treturn pluginsObj;\n}\n"],"mappings":"qEAAO,IAAMA,EAAyB,kBACzBC,EAAsB,+BAMtBC,EAAmBC,GAAmE,CAClG,IAAMC,EAA8B,CACnC,OAAQ,mBACR,eAAgB,mBAChB,oBAAqBD,EAAO,cAC7B,EAEA,MAAO,CACN,MAAO,CAAOE,KAA2BC,IAAAC,EAAA,QAA3BF,EAA2B,GAAAC,GAAA,UAA3BE,EAAUC,EAAU,CAAC,EAAM,CACxC,IAAMC,EAAOC,EAAAC,EAAA,GAAKH,GAAL,CAAc,QAASG,IAAA,GAAKH,EAAQ,SAAYL,EAAiB,GACxES,EAAW,MAAM,MAAM,GAAGV,EAAO,OAAO,GAAGK,CAAQ,GAAIE,CAAI,EAAE,KAAKI,GAAOA,EAAI,KAAK,CAAC,EAEzF,GAAI,YAAaD,EAAU,CAC1B,GAAIA,EAAS,UAAYb,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAIa,EAAS,UAAYZ,EACxB,MAAM,IAAI,MAAM,4BAA4B,EAE7C,GAAI,cAAeY,EAClB,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,EAEnD,GAAI,WAAYA,EACf,MAAM,IAAI,MAAM,oBAAeA,EAAS,OAAO,QAAG,CAEpD,CACA,OAAOA,CACR,EACD,CACD,ECpCO,IAAME,EAAiB,iBACjBC,EAAgB,qCAUhBC,EAA8B,CAC1C,KAAMC,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,MAAOA,GAAW,QAAQ,MAAMH,EAAgBC,EAAeE,CAAO,EACtE,KAAMA,GAAW,QAAQ,KAAKH,EAAgBC,EAAeE,CAAO,EACpE,IAAKA,GAAW,QAAQ,IAAIH,EAAgBC,EAAeE,CAAO,CACnE,EAEaC,EAAoB,CAAE,KAAM,IAAG,GAAW,MAAO,IAAG,GAAW,IAAK,IAAG,GAAW,KAAM,IAAG,EAAU,ECU3G,SAASC,EAAgD,CAC/D,eAAAC,EACA,IAAAC,EACA,QAAAC,EACA,OAAAC,EAASC,CACV,EAAuC,CACtC,GAAI,OAAO,QAAW,YAAa,OAAO,KAE1C,IAAMC,EAAYC,EAAgB,CAAE,QAASC,EAAeN,CAAG,EAAG,eAAAD,CAAe,CAAC,EAOlF,OALmBE,EAAQ,OAAO,CAACM,EAAKC,KACvCD,EAAIC,EAAO,UAAmC,EAAIA,EAAO,WAAW,CAAE,UAAAJ,EAAW,OAAAF,CAAO,CAAC,EAClFK,GACL,CAAC,CAAqG,CAG1G","names":["unauthenticatedMessage","unauthorisedMessage","createApiClient","params","defaultHeaders","_0","_1","__async","pathname","options","init","__spreadProps","__spreadValues","response","res","CONSOLE_PREFIX","CONSOLE_STYLE","inploiBrandedLogger","message","noLogging","initialiseSdk","publishableKey","env","plugins","logger","inploiBrandedLogger","apiClient","createApiClient","ENV_TO_API_URL","acc","plugin"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",