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O,EAAI,EAAO,YAAc,CAAC,EAAG,EAAO,OAAS,CAAC,EAAG,EAAO,eAAiB,CAAC,EAAG,EAC/F,EACA,OAAO,IACH,UAAU,EAAI,GACP,QAAQ,EAAI,MAKzB,WAAa,CACf,KAAM,OACN,WAAY,CACR,OACA,OACA,cACA,YACA,kBACA,SACA,iBACA,mBACA,cACA,eACA,aAEJ,cAAe,CACX,kBAAmB,sBACnB,OAAQ,SACR,YAAa,cACb,oBAAqB,sBACrB,YAAa,cACb,YAAa,gBAGf,KAAO,eAAe,YAEtB,yBAA2B,CAC7B,KAAM,OACN,WAAY,CAAC,QACb,cAAe,CACX,KAAM,OACN,YAAa,gBAGf,mBAAqB,eAAe,0BAEpC,aAAe,CACjB,KAAM,SACN,WAAY,CACR,gBACA,WACA,eACA,eACA,mBACA,0BACA,0BACA,+BAEJ,cAAe,CACX,WAAY,cACZ,IAAK,OACL,YAAa,gBAGf,OAAS,eAAe,cAExB,iBAAmB,CACrB,KAAM,cACN,WAAY,CAAC,OAAQ,gBAAiB,gBACtC,cAAe,CACX,OAAQ,SACR,YAAa,gBAGf,WAAa,eAAe,kBAE5B,aAAe,CACjB,KAAM,SACN,WAAY,CACR,SACA,SACA,iBACA,qBACA,QACA,WACA,YACA,iBACA,oBACA,gBACA,gBACA,eACA,WACA,kBACA,wBACA,eACA,6BACA,cACA,iBACA,2BACA,wBACA,wBACA,4BACA,wBACA,wBACA,4BACA,8BACA,8BACA,kCACA,wBACA,wBACA,4BACA,0BACA,0BACA,8BACA,yBACA,yBACA,6BACA,yBACA,yBACA,6BACA,4BACA,4BACA,gCACA,4BACA,4BACA,gCACA,kCACA,kCACA,sCACA,8BACA,8BACA,kCACA,qBACA,qBACA,yBACA,6BACA,6BACA,iCACA,gCACA,gCACA,oCACA,gCACA,gCACA,oCACA,sCACA,sCACA,0CACA,kCACA,kCACA,sCACA,gCACA,gCACA,oCACA,oBACA,oBACA,wBACA,oBACA,oBACA,wBACA,aACA,0BACA,kBACA,yBACA,QACA,WACA,aACA,YACA,cACA,eACA,WACA,aACA,SACA,UACA,WACA,uBACA,aACA,8BACA,WACA,UACA,gBACA,4BACA,6BACA,8BACA,oCACA,oCACA,0CACA,kDACA,iDACA,WACA,YACA,cACA,eACA,qBACA,yBACA,cACA,cAEJ,cAAe,CACX,OAAQ,UACR,SAAU,YACV,iBAAkB,YAClB,gBAAiB,YACjB,0BAA2B,kBAC3B,mCAAoC,2BACpC,eAAgB,kBAChB,eAAgB,CACZ,aAAa,GAEjB,WAAY,aACZ,UAAW,YACX,aAAc,eACd,eAAgB,iBAChB,SAAU,WACV,MAAO,QACP,QAAS,UACT,YAAa,gBAGf,OAAS,eAAe,cAExB,gBAAkB,CACpB,KAAM,aACN,WAAY,CACR,WACA,WACA,kBACA,mBACA,gBACA,oBACA,oBACA,wBACA,uBACA,uBACA,2BACA,iBACA,iBACA,qBACA,qBACA,qBACA,yBACA,mBACA,mBACA,uBACA,OACA,YACA,qBACA,WACA,gBACA,YACA,eAEJ,cAAe,CACX,MAAO,SACP,KAAM,CACF,aAAa,GAEjB,kBAAmB,oBACnB,oBAAqB,aACrB,gBAAiB,oBAGnB,UAAY,eAAe,iBAE3B,wBAA0B,CAC5B,KAAM,sBACN,WAAY,CAAC,YAAa,YAAa,WAAY,YACnD,cAAe,CACX,eAAgB,kBAChB,gBAAiB,mBACjB,YAAa,gBAGf,kBAAoB,eAAe,yBAEnC,gBAAkB,CACpB,KAAM,YACN,WAAY,CAAC,QAAS,WAAY,SAAU,gBAC5C,cAAe,CACX,eAAgB,kBAChB,mBAAoB,qBACpB,yBAA0B,2BAC1B,uBAAwB,yBACxB,OAAQ,SACR,QAAS,UACT,YAAa,gBAGf,UAAY,eAAe,iBAE3B,gBAAkB,CACpB,KAAM,YACN,WAAY,CACR,WACA,aACA,YACA,UACA,YACA,SACA,SACA,OACA,WACA,aACA,eACA,QACA,eACA,OACA,QACA,QACA,MACA,MACA,eACA,cACA,gBACA,UACA,iBACA,gBAEJ,cAAe,CACX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AGf,QAAU,eAAe,eAE/B,QAAQ,UAAY,UACpB,QAAQ,YAAc,YACtB,QAAQ,YAAc,YACtB,QAAQ,KAAO,KACf,QAAQ,QAAU,QAClB,QAAQ,kBAAoB,kBAC5B,QAAQ,eAAiB,eACzB,QAAQ,uBAAyB,uBACjC,QAAQ,uBAAyB,uBACjC,QAAQ,UAAY,UACpB,QAAQ,kBAAoB,kBAC5B,QAAQ,UAAY,UACpB,QAAQ,UAAY,UACpB,QAAQ,QAAU,QAClB,QAAQ,YAAc,YACtB,QAAQ,mBAAqB,mBAC7B,QAAQ,OAAS,OACjB,QAAQ,gBAAkB,gBAC1B,QAAQ,eAAiB,eACzB,QAAQ,WAAa,WACrB,QAAQ,OAAS,OACjB,QAAQ,QAAU,QAClB,QAAQ,cAAgB,cACxB,QAAQ,QAAU,QAClB,QAAQ,UAAY,UACpB,QAAQ,mBAAqB,mBAC7B,QAAQ,gBAAkB,gBAC1B,QAAQ,aAAe,aACvB,QAAQ,SAAW,SACnB,QAAQ,KAAO,KACf,QAAQ,WAAa,WACrB,QAAQ,eAAiB,eACzB,QAAQ,eAAiB,eACzB,QAAQ,cAAgB,cACxB,QAAQ,UAAY,UACpB,QAAQ,KAAO","file":"/npm/@atoms-studio/commercelayer-sdk@1.6.0/dist/commercelayer-sdk.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@atoms-studio/commercelayer-sdk@1.6.0/dist/commercelayer-sdk.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar axios = require('axios');\nvar jsonapiSerializer = require('jsonapi-serializer');\n\nfunction _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }\n\nvar axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);\n\nconst defaultConfig = {\r\n    host: '',\r\n    timeout: 5000,\r\n    clientId: '',\r\n    clientSecret: '',\r\n    refreshTokens: true,\r\n    refreshTokensAttempts: 3,\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    onRefreshError: /* istanbul ignore next */ (error) => {\r\n        // Do nothing by default\r\n    },\r\n    cookies: {\r\n        scopes: 'cl_scopes',\r\n        customer_token: 'cl_customer_token',\r\n        customer_refresh_token: 'cl_customer_refresh_token',\r\n    },\r\n};\r\nconst config = {\r\n    host: defaultConfig.host,\r\n    timeout: defaultConfig.timeout,\r\n    clientId: defaultConfig.clientId,\r\n    clientSecret: defaultConfig.clientSecret,\r\n    refreshTokens: defaultConfig.refreshTokens,\r\n    refreshTokensAttempts: defaultConfig.refreshTokensAttempts,\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    onRefreshError: /* istanbul ignore next */ (error) => {\r\n        // Do nothing by default\r\n    },\r\n    cookies: {\r\n        scopes: defaultConfig.cookies.scopes,\r\n        customer_token: defaultConfig.cookies\r\n            .customer_token,\r\n        customer_refresh_token: defaultConfig.cookies.customer_refresh_token,\r\n    },\r\n};\r\nconst initConfig = (providedConfig) => {\r\n    config.host = providedConfig.host;\r\n    config.timeout = providedConfig.timeout || 5000;\r\n    config.clientId = providedConfig.clientId || '';\r\n    config.clientSecret = providedConfig.clientSecret || '';\r\n    config.refreshTokens = !!providedConfig.refreshTokens;\r\n    config.refreshTokensAttempts = Number(providedConfig.refreshTokensAttempts);\r\n    config.onRefreshError =\r\n        providedConfig.onRefreshError || defaultConfig.onRefreshError;\r\n    if (typeof providedConfig.refreshTokens === 'boolean') {\r\n        config.refreshTokens = providedConfig.refreshTokens;\r\n    }\r\n    else {\r\n        config.refreshTokens = defaultConfig.refreshTokens;\r\n    }\r\n    if (providedConfig.cookies === false) {\r\n        config.cookies = {\r\n            scopes: false,\r\n            customer_token: false,\r\n            customer_refresh_token: false,\r\n        };\r\n    }\r\n    else if (providedConfig.cookies) {\r\n        config.cookies = {};\r\n        config.cookies.scopes =\r\n            providedConfig.cookies.scopes || defaultConfig.cookies.scopes;\r\n        config.cookies.customer_token =\r\n            providedConfig.cookies.customer_token ||\r\n                defaultConfig.cookies.customer_token;\r\n        config.cookies.customer_refresh_token =\r\n            providedConfig.cookies.customer_refresh_token ||\r\n                defaultConfig.cookies.customer_refresh_token;\r\n    }\r\n    else {\r\n        config.cookies = {\r\n            scopes: defaultConfig.cookies.scopes,\r\n            customer_token: defaultConfig.cookies.customer_token,\r\n            customer_refresh_token: defaultConfig.cookies.customer_refresh_token,\r\n        };\r\n    }\r\n    if (!config.host) {\r\n        throw new Error('Missing host');\r\n    }\r\n    if (isNaN(config.refreshTokensAttempts)) {\r\n        config.refreshTokensAttempts = defaultConfig.refreshTokensAttempts;\r\n    }\r\n    initRequest(config);\r\n};\r\nconst getConfig = () => config;\r\nconst baseRequest = axios__default['default'].create({\r\n    baseURL: '',\r\n    timeout: defaultConfig.timeout,\r\n    headers: {\r\n        Accept: 'application/vnd.api+json',\r\n        'Content-Type': 'application/vnd.api+json',\r\n    },\r\n});\r\nconst initRequest = (config) => {\r\n    baseRequest.defaults.baseURL = config.host;\r\n    baseRequest.defaults.timeout = config.timeout;\r\n};\r\nconst commonPayloadAttributes = [\r\n    'reference',\r\n    'reference_origin',\r\n    'metadata',\r\n];\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\r\nconst isObject = (value) => {\r\n    return value.toString() === '[object Object]';\r\n};\r\nconst getType = (variable) => {\r\n    if (variable === null) {\r\n        return 'null';\r\n    }\r\n    if (Array.isArray(variable)) {\r\n        return 'array';\r\n    }\r\n    return typeof variable;\r\n};\n\nconst deserializer = new jsonapiSerializer.Deserializer({\r\n    keyForAttribute: 'snake_case',\r\n});\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nconst deserialize = (data) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const deserialized = yield deserializer.deserialize(data);\r\n    if (data.data.type && !deserialized.type) {\r\n        deserialized.type = data.data.type;\r\n    }\r\n    if (Array.isArray(deserialized)) {\r\n        return {\r\n            items: deserialized,\r\n            total: (data.meta || {}).record_count || 0,\r\n            lastPage: (data.meta || {}).page_count || 1,\r\n        };\r\n    }\r\n    return deserialized;\r\n});\r\nconst serialize = (config, attributes, relationships) => __awaiter(void 0, void 0, void 0, function* () {\r\n    if (!attributes || !isObject(attributes)) {\r\n        throw new Error(`Invalid resource attributes, expected object, received ${getType(attributes)}`);\r\n    }\r\n    if (!relationships || !isObject(relationships)) {\r\n        throw new Error(`Invalid resource relationships, expected object, received ${getType(relationships)}`);\r\n    }\r\n    const serializer = new jsonapiSerializer.Serializer(config.type, {\r\n        keyForAttribute: 'snake_case',\r\n        attributes: config.attributes.concat(commonPayloadAttributes),\r\n    });\r\n    const serialized = serializer.serialize(attributes);\r\n    // Add empty attributes if the key is missing\r\n    // This is needed if an empty set of attributes is passed\r\n    if (!serialized.data.attributes) {\r\n        serialized.data.attributes = {};\r\n    }\r\n    // Manually add relationships to the serialized payload.\r\n    // Serializing relationships seems broken in jsonapi-serializer\r\n    const relationshipKeys = Object.keys(relationships);\r\n    if (relationshipKeys.length) {\r\n        serialized.data.relationships = {};\r\n        // https://docs.commercelayer.io/api/creating-resources\r\n        // Loop through each relationship passed,\r\n        // and create an object with the following structure:\r\n        // {\r\n        //    <relationship name>: {\r\n        //       data: {\r\n        //         type: <relationship type>,\r\n        //         id: <id>\r\n        //       }\r\n        //    }\r\n        // }\r\n        //\r\n        relationshipKeys.forEach((relationshipKey) => {\r\n            var _a;\r\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n            const configRelationships = config.relationships;\r\n            const relationshipTypeConfig = configRelationships[relationshipKey];\r\n            // Only add relationships supported by the config\r\n            if (relationshipTypeConfig) {\r\n                // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n                const relationshipValue = relationships[relationshipKey] || {\r\n                    id: null,\r\n                };\r\n                if (typeof relationshipValue !== 'string' && !relationshipValue.id) {\r\n                    console.warn(`Invalid relationship value for \"${relationshipKey}\" on resource \"${config.type}\"`);\r\n                }\r\n                if (typeof relationshipTypeConfig === 'object' &&\r\n                    relationshipTypeConfig.polymorphic &&\r\n                    (typeof relationshipValue === 'string' || !relationshipValue.type)) {\r\n                    throw new Error(`You must pass a type for relationship \"${relationshipKey}\" because it is polymorphic`);\r\n                }\r\n                serialized.data.relationships[relationshipKey] = {\r\n                    data: {\r\n                        type: (_a = relationshipValue.type) !== null && _a !== void 0 ? _a : relationshipTypeConfig,\r\n                        // Support passing a relationship as id or as a full object\r\n                        id: typeof relationshipValue === 'string'\r\n                            ? relationshipValue\r\n                            : relationshipValue.id || '',\r\n                    },\r\n                };\r\n            }\r\n        });\r\n    }\r\n    return serialized;\r\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types\r\nconst handleApiErrors = (error) => {\r\n    // Process axios error\r\n    if (error.response) {\r\n        return new ResourceError(error);\r\n    }\r\n    // Throw anything else\r\n    throw error;\r\n};\r\nclass ResourceError extends Error {\r\n    constructor(axiosError) {\r\n        super(`CommerceLayer API error`);\r\n        this.messages = [];\r\n        this.isResourceError = true;\r\n        Object.setPrototypeOf(this, ResourceError.prototype);\r\n        this.request = axiosError.request;\r\n        this.response = axiosError.response;\r\n        this.config = axiosError.config;\r\n        if (this.response && this.response.data && this.response.data.errors) {\r\n            this.messages = this.response.data.errors;\r\n        }\r\n        if (Array.isArray(this.messages) && this.messages.length) {\r\n            this.firstMessage = this.messages[0];\r\n        }\r\n        if (this.response) {\r\n            this.status = this.response.status;\r\n        }\r\n    }\r\n}\n\nconst createRequestParams = (query) => {\r\n    const params = {};\r\n    if (!query || query.toString() !== '[object Object]') {\r\n        return params;\r\n    }\r\n    if (query.include) {\r\n        params.include = query.include.join(',');\r\n    }\r\n    if (query.fields) {\r\n        Object.keys(query.fields).forEach((key) => {\r\n            params[`fields[${key}]`] = query.fields[key].join(',');\r\n        });\r\n    }\r\n    if (query.sort) {\r\n        params.sort = query.sort.join(',');\r\n    }\r\n    if (query.page) {\r\n        if (query.page.number) {\r\n            params[`page[number]`] = query.page.number.toString();\r\n        }\r\n        if (query.page.size) {\r\n            params[`page[size]`] = query.page.size.toString();\r\n        }\r\n    }\r\n    if (query.filter) {\r\n        Object.keys(query.filter).forEach((key) => {\r\n            params[`filter[q][${key}]`] = query.filter[key].toString();\r\n        });\r\n    }\r\n    return params;\r\n};\r\nconst createRequest = (url, method, query, \r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ndata) => {\r\n    const { token } = getCurrentToken();\r\n    return baseRequest.request({\r\n        method,\r\n        url,\r\n        params: createRequestParams(query || {}),\r\n        data,\r\n        headers: {\r\n            accept: 'application/vnd.api+json',\r\n            'content-type': 'application/vnd.api+json',\r\n            authorization: `Bearer ${token}`,\r\n        },\r\n    });\r\n};\r\nconst getRelatedPrefix = (resource) => {\r\n    if (!resource) {\r\n        return '';\r\n    }\r\n    if (!resource.type) {\r\n        throw new Error('Resource type is missing in related resource');\r\n    }\r\n    if (!resource.id) {\r\n        throw new Error('Resource id is missing in related resource');\r\n    }\r\n    return `${resource.type}/${resource.id}/`;\r\n};\r\nconst find = (id, query, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const prefix = getRelatedPrefix(query.relatedTo);\r\n    const request = createRequest(`/api/${prefix}${config.type}/${id}`, 'get', query);\r\n    try {\r\n        const { data } = yield request;\r\n        return yield deserialize(data);\r\n    }\r\n    catch (error) {\r\n        throw handleApiErrors(error);\r\n    }\r\n});\r\nconst findAll = (query, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const prefix = getRelatedPrefix(query.relatedTo);\r\n    const request = createRequest(`/api/${prefix}${config.type}`, 'get', query);\r\n    try {\r\n        const { data } = yield request;\r\n        const result = yield deserialize(data);\r\n        const currentPage = (query.page || {}).number || 1;\r\n        return {\r\n            items: result.items || [],\r\n            total: result.total,\r\n            currentPage,\r\n            prevPage: currentPage - 1 || null,\r\n            nextPage: currentPage < result.lastPage ? currentPage + 1 : null,\r\n            lastPage: result.lastPage,\r\n            hasMore: currentPage < result.lastPage,\r\n        };\r\n    }\r\n    catch (error) {\r\n        throw handleApiErrors(error);\r\n    }\r\n});\r\nconst findBy = (query, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const result = yield findAll(query, config);\r\n    if (result.items.length) {\r\n        return result.items[0];\r\n    }\r\n    return null;\r\n});\r\nconst destroy = (id, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    try {\r\n        yield createRequest(`/api/${config.type}/${id}`, 'delete');\r\n    }\r\n    catch (error) {\r\n        throw handleApiErrors(error);\r\n    }\r\n});\r\nconst create = (attributes, query, relationships, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const body = yield serialize(config, attributes, relationships);\r\n    const request = createRequest(`/api/${config.type}`, 'post', query, body);\r\n    try {\r\n        const { data } = yield request;\r\n        return yield deserialize(data);\r\n    }\r\n    catch (error) {\r\n        throw handleApiErrors(error);\r\n    }\r\n});\r\nconst update = (id, attributes, query, relationships, config) => __awaiter(void 0, void 0, void 0, function* () {\r\n    // Add id to attributes as it is always required\r\n    Object.assign(attributes, {\r\n        id,\r\n    });\r\n    const body = yield serialize(config, attributes, relationships);\r\n    const request = createRequest(`/api/${config.type}/${id}`, 'patch', query, body);\r\n    try {\r\n        const { data } = yield request;\r\n        return yield deserialize(data);\r\n    }\r\n    catch (error) {\r\n        throw handleApiErrors(error);\r\n    }\r\n});\n\nlet tokenType = 'sales_channel';\r\nconst setTokenType = (type) => {\r\n    tokenType = type;\r\n};\r\nconst getTokenType = () => tokenType;\r\nconst tokenCache = new Map();\r\nconst INTEGRATION_PREFIX = 'integration__';\r\nconst cacheKey = () => {\r\n    let prefix = '';\r\n    if (tokenType === 'integration') {\r\n        prefix = INTEGRATION_PREFIX;\r\n    }\r\n    return prefix + getCurrentMarkets().join(',');\r\n};\r\nconst cacheToken = (token, expires) => {\r\n    tokenCache.set(cacheKey(), {\r\n        token,\r\n        expires,\r\n    });\r\n};\r\n/* istanbul ignore next */\r\nconst removeCurrentToken = () => {\r\n    tokenCache.delete(cacheKey());\r\n};\r\nconst getToken = () => {\r\n    const key = cacheKey();\r\n    const cachedValue = tokenCache.get(key);\r\n    if (!cachedValue || !cachedValue.token || cachedValue.expires <= Date.now()) {\r\n        return {\r\n            token: '',\r\n            expires: 0,\r\n        };\r\n    }\r\n    return cachedValue;\r\n};\r\nconst currentCustomerData = {\r\n    id: '',\r\n    customer: null,\r\n    token: '',\r\n    refreshToken: '',\r\n    expires: 0,\r\n};\r\nconst resetSession = () => {\r\n    currentCustomerData.id = '';\r\n    currentCustomerData.customer = null;\r\n    currentCustomerData.token = '';\r\n    currentCustomerData.refreshToken = '';\r\n    currentCustomerData.expires = 0;\r\n};\r\nconst isCustomerLoggedIn = () => {\r\n    return !!(currentCustomerData.token && currentCustomerData.refreshToken);\r\n};\r\nconst getCustomerToken = () => {\r\n    if (currentCustomerData.expires <= Date.now()) {\r\n        return {\r\n            token: '',\r\n            expires: 0,\r\n        };\r\n    }\r\n    return {\r\n        token: currentCustomerData.token,\r\n        expires: currentCustomerData.expires,\r\n    };\r\n};\r\nlet currentMarkets = [];\r\nconst getCurrentMarkets = () => {\r\n    return currentMarkets.slice();\r\n};\r\nconst setCurrentMarkets = (markets) => {\r\n    currentMarkets = markets.slice();\r\n};\r\nconst getScope = () => getCurrentMarkets()\r\n    .map((market) => `market:code:${market}`)\r\n    .join(' ');\r\nconst getCurrentToken = () => {\r\n    return isCustomerLoggedIn() ? getCustomerToken() : getToken();\r\n};\r\nconst refreshCurrentToken = () => {\r\n    return isCustomerLoggedIn()\r\n        ? refreshCustomer()\r\n        : tokenType === 'integration'\r\n            ? refreshIntegration()\r\n            : refreshGuest();\r\n};\r\nconst loginAsIntegration = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    const config = getConfig();\r\n    if (!config.host) {\r\n        throw new Error('You must call \"init\" before using any Auth method');\r\n    }\r\n    if (!config.clientId) {\r\n        throw new Error('Missing client id');\r\n    }\r\n    if (!config.clientSecret) {\r\n        throw new Error('Missing client secret');\r\n    }\r\n    setTokenType('integration');\r\n    // Check if a token is already available\r\n    const cachedValue = getToken();\r\n    if (cachedValue.token) {\r\n        return cachedValue;\r\n    }\r\n    const scope = getScope();\r\n    const { data } = yield axios__default['default'].post(`https://auth.commercelayer.io/oauth/token`, {\r\n        grant_type: 'client_credentials',\r\n        client_id: config.clientId,\r\n        client_secret: config.clientSecret,\r\n        scope,\r\n    });\r\n    /* istanbul ignore next */\r\n    const expires = Date.now() + (Number(data.expires_in) || 0) * 1000;\r\n    cacheToken(data.access_token, expires);\r\n    return {\r\n        token: data.access_token,\r\n        expires,\r\n    };\r\n});\r\nconst refreshIntegration = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    removeCurrentToken();\r\n    return yield loginAsIntegration();\r\n});\r\nconst loginAsGuest = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    const config = getConfig();\r\n    if (!config.host) {\r\n        throw new Error('You must call \"init\" before using any Auth method');\r\n    }\r\n    if (!config.clientId) {\r\n        throw new Error('Missing client id');\r\n    }\r\n    const scope = getScope();\r\n    if (!scope) {\r\n        throw new Error('You must first set a market');\r\n    }\r\n    setTokenType('sales_channel');\r\n    // Check if a token is already available\r\n    const cachedValue = getToken();\r\n    if (cachedValue.token) {\r\n        return cachedValue;\r\n    }\r\n    // We dont use try..catch as auth errors must be handled by consumers\r\n    const { data } = yield axios__default['default'].post(`https://auth.commercelayer.io/oauth/token`, {\r\n        grant_type: 'client_credentials',\r\n        client_id: config.clientId,\r\n        scope,\r\n    });\r\n    /* istanbul ignore next */\r\n    const expires = Date.now() + (Number(data.expires_in) || 0) * 1000;\r\n    cacheToken(data.access_token, expires);\r\n    return {\r\n        token: data.access_token,\r\n        expires,\r\n    };\r\n});\r\nconst refreshGuest = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    removeCurrentToken();\r\n    return yield loginAsGuest();\r\n});\r\nconst setMarket = (marketId) => __awaiter(void 0, void 0, void 0, function* () {\r\n    let markets;\r\n    if (Array.isArray(marketId)) {\r\n        markets = marketId;\r\n    }\r\n    else {\r\n        markets = [marketId];\r\n    }\r\n    setCurrentMarkets(markets);\r\n    // Changing markets invalidates customer tokens\r\n    // so we need to log them out\r\n    resetSession();\r\n    // Changing markets also invalidates the current token\r\n    // so we need to get a new one ( or use the cached version )\r\n    if (getTokenType() === 'integration') {\r\n        yield loginAsIntegration();\r\n    }\r\n    else {\r\n        yield loginAsGuest();\r\n    }\r\n});\r\n// Always return a copy so consumers cannot alter directly\r\nconst getMarket = () => getCurrentMarkets();\r\nconst isRefreshTokenError = /* istanbul ignore next */ (error) => {\r\n    return !!(error.response &&\r\n        error.response.status === 401 &&\r\n        error.response.data &&\r\n        error.response.data.errors &&\r\n        error.response.data.errors.length &&\r\n        error.response.data.errors[0].code === 'INVALID_TOKEN');\r\n};\r\nconst getRefreshTokenInterceptor = (config) => [\r\n    (response) => {\r\n        return response;\r\n    },\r\n    (error) => __awaiter(void 0, void 0, void 0, function* () {\r\n        if (!isRefreshTokenError(error)) {\r\n            throw error;\r\n        }\r\n        if (!config.refreshTokens) {\r\n            throw error;\r\n        }\r\n        const errorConfig = error.config;\r\n        const retries = errorConfig.__retryAttempts || /* istanbul ignore next */ 0;\r\n        /* istanbul ignore next */\r\n        if (retries < config.refreshTokensAttempts) {\r\n            try {\r\n                const authData = yield refreshCurrentToken();\r\n                errorConfig.__retryAttempts++;\r\n                errorConfig.headers.authorization = `Bearer ${authData.token}`;\r\n            }\r\n            catch (err) {\r\n                // Could not refresh the token, exit immediatly\r\n                config.onRefreshError(err);\r\n                throw err;\r\n            }\r\n            return yield axios__default['default'].request(error.config);\r\n        }\r\n        else {\r\n            config.onRefreshError(error);\r\n            throw error;\r\n        }\r\n    }),\r\n];\r\nbaseRequest.interceptors.response.use(...getRefreshTokenInterceptor(getConfig()));\r\nconst logoutCustomer = () => {\r\n    resetSession();\r\n};\r\nconst loginAsCustomer = (username, password) => __awaiter(void 0, void 0, void 0, function* () {\r\n    const config = getConfig();\r\n    if (!config.host) {\r\n        throw new Error('You must call \"init\" before using any Auth method');\r\n    }\r\n    const scope = getScope();\r\n    if (!scope) {\r\n        throw new Error('You must first set a market');\r\n    }\r\n    try {\r\n        const { data } = yield axios__default['default'].post(`https://auth.commercelayer.io/oauth/token`, {\r\n            grant_type: 'password',\r\n            client_id: config.clientId,\r\n            username,\r\n            password,\r\n            scope,\r\n        });\r\n        currentCustomerData.id = data.owner_id;\r\n        currentCustomerData.token = data.access_token;\r\n        currentCustomerData.refreshToken = data.refresh_token;\r\n        currentCustomerData.customer = null;\r\n        currentCustomerData.expires = Date.now() + data.expires_in * 1000;\r\n        yield loadProfile();\r\n    }\r\n    catch (err) /* istanbul ignore next */ {\r\n        // Reset auth data and rethrow the error\r\n        logoutCustomer();\r\n        throw err;\r\n    }\r\n    return currentCustomerData;\r\n});\r\nconst refreshCustomer = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    const config = getConfig();\r\n    if (!config.host) {\r\n        throw new Error('You must call \"init\" before using any Auth method');\r\n    }\r\n    if (!isCustomerLoggedIn()) {\r\n        return {\r\n            id: '',\r\n            customer: null,\r\n            token: '',\r\n            refreshToken: '',\r\n            expires: 0,\r\n        };\r\n    }\r\n    try {\r\n        const { data } = yield axios__default['default'].post(`https://auth.commercelayer.io/oauth/token`, {\r\n            grant_type: 'refresh_token',\r\n            client_id: config.clientId,\r\n            refresh_token: currentCustomerData.refreshToken,\r\n            scope: getScope(),\r\n        });\r\n        currentCustomerData.id = data.owner_id;\r\n        currentCustomerData.token = data.access_token;\r\n        currentCustomerData.refreshToken = data.refresh_token;\r\n        currentCustomerData.customer = null;\r\n        currentCustomerData.expires = Date.now() + data.expires_in * 1000;\r\n        yield loadProfile();\r\n    }\r\n    catch (err) /* istanbul ignore next */ {\r\n        // Reset auth data and rethrow the error\r\n        logoutCustomer();\r\n        throw err;\r\n    }\r\n    return currentCustomerData;\r\n});\r\nconst useCustomerSession = (accessToken, refreshToken, scope) => __awaiter(void 0, void 0, void 0, function* () {\r\n    if (!accessToken || !refreshToken || scope !== getScope()) {\r\n        throw new Error('Invalid session data');\r\n    }\r\n    // Temporarily set auth data\r\n    currentCustomerData.id = '';\r\n    currentCustomerData.token = accessToken;\r\n    currentCustomerData.refreshToken = refreshToken;\r\n    currentCustomerData.customer = null;\r\n    currentCustomerData.expires = Date.now() + 5 * 1000;\r\n    return yield refreshCustomer();\r\n});\r\nconst loadProfile = () => __awaiter(void 0, void 0, void 0, function* () {\r\n    /* istanbul ignore else */\r\n    if (isCustomerLoggedIn()) {\r\n        currentCustomerData.customer = (yield find(currentCustomerData.id, {}, {\r\n            type: 'customers',\r\n            attributes: ['email', 'password', 'status', 'has_password'],\r\n            relationships: {},\r\n        }));\r\n    }\r\n});\r\nconst getProfile = () => {\r\n    return currentCustomerData.customer;\r\n};\n\nconst Auth = {\r\n    setMarket,\r\n    getMarket,\r\n    getScope,\r\n    loginAsGuest,\r\n    loginAsCustomer,\r\n    isCustomerLoggedIn,\r\n    logoutCustomer,\r\n    loginAsIntegration,\r\n    getToken,\r\n    getCustomerToken,\r\n    useCustomerSession,\r\n    loadProfile,\r\n    getProfile,\r\n    __setCurrentToken: cacheToken,\r\n    getCurrentToken,\r\n    getRefreshTokenInterceptor,\r\n};\n\nconst requireId = (id, config) => {\r\n    if (!id) {\r\n        throw new Error(`[${config.type}] Missing resource id`);\r\n    }\r\n};\r\nconst checkQuery = (query, config) => {\r\n    if (query && !isObject(query)) {\r\n        throw new Error(`[${config.type}] Invalid resource query, expected object, received ${getType(query)}`);\r\n    }\r\n};\r\nconst requireQuery = (query, config) => {\r\n    if (!query) {\r\n        throw new Error(`[${config.type}] Missing resource query`);\r\n    }\r\n    checkQuery(query, config);\r\n};\r\nconst checkAttributes = (attributes, config) => {\r\n    if (attributes && !isObject(attributes)) {\r\n        throw new Error(`[${config.type}] Invalid resource attributes, expected object, received ${getType(attributes)}`);\r\n    }\r\n};\r\nconst checkRelationships = (relationships, config) => {\r\n    if (relationships && !isObject(relationships)) {\r\n        throw new Error(`[${config.type}] Invalid resource relationships, expected object, received ${getType(relationships)}`);\r\n    }\r\n};\r\nconst createResource = (config) => {\r\n    return {\r\n        find(id, query) {\r\n            requireId(id, config);\r\n            checkQuery(query, config);\r\n            return find(id, query || {}, config);\r\n        },\r\n        findBy(query) {\r\n            requireQuery(query, config);\r\n            return findBy(query, config);\r\n        },\r\n        findAll(query) {\r\n            requireQuery(query, config);\r\n            return findAll(query, config);\r\n        },\r\n        create(params = {}) {\r\n            if (!params || getType(params) !== 'object') {\r\n                throw new Error(`[${config.type}] Invalid resource params, expected object, received ${getType(params)}`);\r\n            }\r\n            checkAttributes(params.attributes, config);\r\n            checkRelationships(params.relationships, config);\r\n            return create(params.attributes || {}, params.query || {}, params.relationships || {}, config);\r\n        },\r\n        update(id, params) {\r\n            requireId(id, config);\r\n            if (!params || getType(params) !== 'object') {\r\n                throw new Error(`[${config.type}] Invalid resource params, expected object, received ${getType(params)}`);\r\n            }\r\n            checkAttributes(params.attributes, config);\r\n            checkRelationships(params.relationships, config);\r\n            return update(id, params.attributes || {}, params.query || {}, params.relationships || {}, config);\r\n        },\r\n        delete(id) {\r\n            requireId(id, config);\r\n            return destroy(id, config);\r\n        },\r\n    };\r\n};\n\nconst SkusConfig = {\r\n    type: 'skus',\r\n    attributes: [\r\n        'code',\r\n        'name',\r\n        'description',\r\n        'image_url',\r\n        'pieces_per_pack',\r\n        'weight',\r\n        'unit_of_weight',\r\n        'hs_tariff_number',\r\n        'do_not_ship',\r\n        'do_not_track',\r\n        'inventory',\r\n    ],\r\n    relationships: {\r\n        shipping_category: 'shipping_categories',\r\n        prices: 'prices',\r\n        stock_items: 'stock_items',\r\n        delivery_lead_times: 'delivery_lead_times',\r\n        sku_options: 'sku_options',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Skus = createResource(SkusConfig);\n\nconst ShippingCategoriesConfig = {\r\n    type: 'skus',\r\n    attributes: ['name'],\r\n    relationships: {\r\n        skus: 'skus',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst ShippingCategories = createResource(ShippingCategoriesConfig);\n\nconst PricesConfig = {\r\n    type: 'prices',\r\n    attributes: [\r\n        'currency_code',\r\n        'sku_code',\r\n        'amount_cents',\r\n        'amount_float',\r\n        'formatted_amount',\r\n        'compare_at_amount_cents',\r\n        'compare_at_amount_float',\r\n        'formatted_compare_at_amount',\r\n    ],\r\n    relationships: {\r\n        price_list: 'price_lists',\r\n        sku: 'skus',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Prices = createResource(PricesConfig);\n\nconst PriceListsConfig = {\r\n    type: 'price_lists',\r\n    attributes: ['name', 'currency_code', 'tax_included'],\r\n    relationships: {\r\n        prices: 'prices',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst PriceLists = createResource(PriceListsConfig);\n\nconst OrdersConfig = {\r\n    type: 'orders',\r\n    attributes: [\r\n        'number',\r\n        'status',\r\n        'payment_status',\r\n        'fulfillment_status',\r\n        'guest',\r\n        'editable',\r\n        'placeable',\r\n        'customer_email',\r\n        'customer_password',\r\n        'language_code',\r\n        'currency_code',\r\n        'tax_included',\r\n        'tax_rate',\r\n        'freight_taxable',\r\n        'requires_billing_info',\r\n        'country_code',\r\n        'shipping_country_code_lock',\r\n        'coupon_code',\r\n        'gift_card_code',\r\n        'gift_card_or_coupon_code',\r\n        'subtotal_amount_cents',\r\n        'subtotal_amount_float',\r\n        'formatted_subtotal_amount',\r\n        'shipping_amount_cents',\r\n        'shipping_amount_float',\r\n        'formatted_shipping_amount',\r\n        'payment_method_amount_cents',\r\n        'payment_method_amount_float',\r\n        'formatted_payment_method_amount',\r\n        'discount_amount_cents',\r\n        'discount_amount_float',\r\n        'formatted_discount_amount',\r\n        'adjustment_amount_cents',\r\n        'adjustment_amount_float',\r\n        'formatted_adjustment_amount',\r\n        'gift_card_amount_cents',\r\n        'gift_card_amount_float',\r\n        'formatted_gift_card_amount',\r\n        'total_tax_amount_cents',\r\n        'total_tax_amount_float',\r\n        'formatted_total_tax_amount',\r\n        'subtotal_tax_amount_cents',\r\n        'subtotal_tax_amount_float',\r\n        'formatted_subtotal_tax_amount',\r\n        'shipping_tax_amount_cents',\r\n        'shipping_tax_amount_float',\r\n        'formatted_shipping_tax_amount',\r\n        'payment_method_tax_amount_cents',\r\n        'payment_method_tax_amount_float',\r\n        'formatted_payment_method_tax_amount',\r\n        'adjustment_tax_amount_cents',\r\n        'adjustment_tax_amount_float',\r\n        'formatted_adjustment_tax_amount',\r\n        'total_amount_cents',\r\n        'total_amount_float',\r\n        'formatted_total_amount',\r\n        'total_taxable_amount_cents',\r\n        'total_taxable_amount_float',\r\n        'formatted_total_taxable_amount',\r\n        'subtotal_taxable_amount_cents',\r\n        'subtotal_taxable_amount_float',\r\n        'formatted_subtotal_taxable_amount',\r\n        'shipping_taxable_amount_cents',\r\n        'shipping_taxable_amount_float',\r\n        'formatted_shipping_taxable_amount',\r\n        'payment_method_taxable_amount_cents',\r\n        'payment_method_taxable_amount_float',\r\n        'formatted_payment_method_taxable_amount',\r\n        'adjustment_taxable_amount_cents',\r\n        'adjustment_taxable_amount_float',\r\n        'formatted_adjustment_taxable_amount',\r\n        'total_amount_with_taxes_cents',\r\n        'total_amount_with_taxes_float',\r\n        'formatted_total_amount_with_taxes',\r\n        'fees_amount_cents',\r\n        'fees_amount_float',\r\n        'formatted_fees_amount',\r\n        'duty_amount_cents',\r\n        'duty_amount_float',\r\n        'formatted_duty_amount',\r\n        'skus_count',\r\n        'line_item_options_count',\r\n        'shipments_count',\r\n        'payment_source_details',\r\n        'token',\r\n        'cart_url',\r\n        'return_url',\r\n        'terms_url',\r\n        'privacy_url',\r\n        'checkout_url',\r\n        '_archive',\r\n        '_unarchive',\r\n        '_place',\r\n        '_cancel',\r\n        '_approve',\r\n        '_approve_and_capture',\r\n        '_authorize',\r\n        '_authorization_amount_cents',\r\n        '_capture',\r\n        '_refund',\r\n        '_update_taxes',\r\n        '_billing_address_clone_id',\r\n        '_shipping_address_clone_id',\r\n        '_customer_payment_source_id',\r\n        '_shipping_address_same_as_billing',\r\n        '_billing_address_same_as_shipping',\r\n        '_save_payment_source_to_customer_wallet',\r\n        '_save_shipping_address_to_customer_address_book',\r\n        '_save_billing_address_to_customer_address_book',\r\n        '_refresh',\r\n        'placed_at',\r\n        'approved_at',\r\n        'cancelled_at',\r\n        'payment_updated_at',\r\n        'fulfillment_updated_at',\r\n        'archived_at',\r\n        'expires_at',\r\n    ],\r\n    relationships: {\r\n        market: 'markets',\r\n        customer: 'customers',\r\n        shipping_address: 'addresses',\r\n        billing_address: 'addresses',\r\n        available_payment_methods: 'payment_methods',\r\n        available_customer_payment_sources: 'customer_payment_sources',\r\n        payment_method: 'payment_methods',\r\n        payment_source: {\r\n            polymorphic: true,\r\n        },\r\n        line_items: 'line_items',\r\n        shipments: 'shipments',\r\n        transactions: 'transactions',\r\n        authorizations: 'authorizations',\r\n        captures: 'captures',\r\n        voids: 'voids',\r\n        refunds: 'refunds',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Orders = createResource(OrdersConfig);\n\nconst LineItemsConfig = {\r\n    type: 'line_items',\r\n    attributes: [\r\n        'sku_code',\r\n        'quantity',\r\n        '_external_price',\r\n        '_update_quantity',\r\n        'currency_code',\r\n        'unit_amount_cents',\r\n        'unit_amount_float',\r\n        'formatted_unit_amount',\r\n        'options_amount_cents',\r\n        'options_amount_float',\r\n        'formatted_options_amount',\r\n        'discount_cents',\r\n        'discount_float',\r\n        'formatted_discount',\r\n        'total_amount_cents',\r\n        'total_amount_float',\r\n        'formatted_total_amount',\r\n        'tax_amount_cents',\r\n        'tax_amount_float',\r\n        'formatted_tax_amount',\r\n        'name',\r\n        'image_url',\r\n        'discount_breakdown',\r\n        'tax_rate',\r\n        'tax_breakdown',\r\n        'item_type',\r\n        'bundle_code',\r\n    ],\r\n    relationships: {\r\n        order: 'orders',\r\n        item: {\r\n            polymorphic: true,\r\n        },\r\n        line_item_options: 'line_item_options',\r\n        shipment_line_items: 'line_items',\r\n        stock_transfers: 'stock_transfers',\r\n    },\r\n};\r\nconst LineItems = createResource(LineItemsConfig);\n\nconst DeliveryLeadTimesConfig = {\r\n    type: 'delivery_lead_times',\r\n    attributes: ['min_hours', 'max_hours', 'min_days', 'max_days'],\r\n    relationships: {\r\n        stock_location: 'stock_locations',\r\n        shipping_method: 'shipping_methods',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst DeliveryLeadTimes = createResource(DeliveryLeadTimesConfig);\n\nconst CustomersConfig = {\r\n    type: 'customers',\r\n    attributes: ['email', 'password', 'status', 'has_password'],\r\n    relationships: {\r\n        customer_group: 'customer_groups',\r\n        customer_addresses: 'customer_addresses',\r\n        customer_payment_sources: 'customer_payment_sources',\r\n        customer_subscriptions: 'customer_subscriptions',\r\n        orders: 'orders',\r\n        returns: 'returns',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Customers = createResource(CustomersConfig);\n\nconst AddressesConfig = {\r\n    type: 'addresses',\r\n    attributes: [\r\n        'business',\r\n        'first_name',\r\n        'last_name',\r\n        'company',\r\n        'full_name',\r\n        'line_1',\r\n        'line_2',\r\n        'city',\r\n        'zip_code',\r\n        'state_code',\r\n        'country_code',\r\n        'phone',\r\n        'full_address',\r\n        'name',\r\n        'email',\r\n        'notes',\r\n        'lat',\r\n        'lng',\r\n        'is_localized',\r\n        'is_geocoded',\r\n        'provider_name',\r\n        'map_url',\r\n        'static_map_url',\r\n        'billing_info',\r\n    ],\r\n    relationships: {\r\n        geocoder: 'geocoders', // TODO: it seems there is no \"geocoders\" type, maybe it's a documentation error\r\n    },\r\n};\r\nconst Addresses = createResource(AddressesConfig);\n\nconst CustomerAddressesConfig = {\r\n    type: 'customer_addresses',\r\n    attributes: ['name'],\r\n    relationships: {\r\n        customer: 'customers',\r\n        address: 'addresses',\r\n    },\r\n};\r\nconst CustomerAddresses = createResource(CustomerAddressesConfig);\n\nconst MarketsConfig = {\r\n    type: 'markets',\r\n    attributes: [\r\n        'number',\r\n        'name',\r\n        'facebook_pixel_id',\r\n        'checkout_url',\r\n        'external_prices_url',\r\n        'private',\r\n    ],\r\n    relationships: {\r\n        merchant: 'merchants',\r\n        price_list: 'price_lists',\r\n        inventory_model: 'inventory_models',\r\n        customer_group: 'customer_groups',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Markets = createResource(MarketsConfig);\n\nconst ShipmentsConfig = {\r\n    type: 'shipments',\r\n    attributes: [\r\n        'number',\r\n        'status',\r\n        'currency_code',\r\n        'cost_amount_cents',\r\n        'cost_amount_float',\r\n        'formatted_cost_amount',\r\n        'skus_count',\r\n        '_on_hold',\r\n        '_picking',\r\n        '_packing',\r\n        '_ready_to_ship',\r\n        '_ship',\r\n        '_get_rates',\r\n        'selected_rate_id',\r\n        'rates',\r\n        '_purchase',\r\n        'purchase_error_code',\r\n        'purchase_error_message',\r\n        'get_rates_started_at',\r\n        'get_rates_completed_at',\r\n        'purchase_started_at',\r\n        'purchase_completed_at',\r\n        'purchase_failed_at',\r\n    ],\r\n    relationships: {\r\n        order: 'orders',\r\n        shipping_category: 'shipping_categories',\r\n        stock_location: 'stock_locations',\r\n        origin_address: 'addresses',\r\n        shipping_address: 'addresses',\r\n        shipping_method: 'shipping_methods',\r\n        delivery_lead_time: 'delivery_lead_times',\r\n        shipment_line_items: 'line_items',\r\n        stock_transfers: 'stock_transfers',\r\n        available_shipping_methods: 'shipping_methods',\r\n        carrier_accounts: 'carrier_accounts',\r\n        parcels: 'parcels',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Shipments = createResource(ShipmentsConfig);\n\nconst PaymentMethodsConfig = {\r\n    type: 'payment_methods',\r\n    attributes: [\r\n        'payment_source_type',\r\n        'name',\r\n        'disabled_at',\r\n        'price_amount_cents',\r\n        'price_amount_float',\r\n        'formatted_price_amount',\r\n    ],\r\n    relationships: {\r\n        market: 'markets',\r\n        payment_gateway: 'payment_gateways',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst PaymentMethods = createResource(PaymentMethodsConfig);\n\nconst AdjustmentsConfig = {\r\n    type: 'adjustments',\r\n    attributes: [\r\n        'name',\r\n        'currency_code',\r\n        'amount_cents',\r\n        'amount_float',\r\n        'formatted_amount',\r\n    ],\r\n    relationships: {},\r\n};\r\nconst Adjustments = createResource(AdjustmentsConfig);\n\nconst GiftCardsConfig = {\r\n    type: 'gift_cards',\r\n    attributes: [\r\n        'status',\r\n        'code',\r\n        'currency_code',\r\n        'initial_balance_cents',\r\n        'initial_balance_float',\r\n        'formatted_initial_balance',\r\n        'balance_cents',\r\n        'balance_float',\r\n        'formatted_balance',\r\n        'balance_max_cents',\r\n        'balance_max_float',\r\n        'formatted_balance_max',\r\n        'balance_log',\r\n        'single_use',\r\n        'rechargeable',\r\n        'image_url',\r\n        'expires_at',\r\n        'recipient_email',\r\n        '_purchase',\r\n        '_activate',\r\n        '_deactivate',\r\n        '_balance_change_cents',\r\n    ],\r\n    relationships: {\r\n        market: 'markets',\r\n        gift_card_recipient: 'gift_card_recipients',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst GiftCards = createResource(GiftCardsConfig);\n\nconst ShippingMethodsConfig = {\r\n    type: 'shipping_methods',\r\n    attributes: [\r\n        'name',\r\n        'disabled_at',\r\n        'currency_code',\r\n        'price_amount_cents',\r\n        'price_amount_float',\r\n        'formatted_price_amount',\r\n        'free_over_amount_cents',\r\n        'free_over_amount_float',\r\n        'formatted_free_over_amount',\r\n        'price_amount_for_shipment_cents',\r\n        'price_amount_for_shipment_float',\r\n        'formatted_price_amount_for_shipment',\r\n    ],\r\n    relationships: {\r\n        market: 'markets',\r\n        shipping_zone: 'shipping_zones',\r\n        shipping_category: 'shipping_categories',\r\n        delivery_lead_time_for_shipment: 'delivery_lead_times',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst ShippingMethods = createResource(ShippingMethodsConfig);\n\nconst AttachmentsConfig = {\r\n    type: 'attachments',\r\n    attributes: ['name', 'description', 'url'],\r\n    relationships: {\r\n        attachable: {\r\n            polymorphic: true,\r\n        },\r\n    },\r\n};\r\nconst Attachments = createResource(AttachmentsConfig);\n\nconst ReturnsConfig = {\r\n    type: 'returns',\r\n    attributes: [\r\n        'number',\r\n        'status',\r\n        'customer_email',\r\n        'skus_count',\r\n        'approved_at',\r\n        'cancelled_at',\r\n        'shipped_at',\r\n        'rejected_at',\r\n        'received_at',\r\n        'archived_at',\r\n        '_request',\r\n        '_approve',\r\n        '_cancel',\r\n        '_ship',\r\n        '_reject',\r\n        '_receive',\r\n        '_restock',\r\n        '_archive',\r\n        '_unarchive',\r\n    ],\r\n    relationships: {\r\n        order: 'orders',\r\n        customer: 'customers',\r\n        stock_location: 'stock_locations',\r\n        origin_address: 'addresses',\r\n        destination_address: 'addresses',\r\n        return_line_items: 'line_items',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Returns = createResource(ReturnsConfig);\n\nconst WireTransfersConfig = {\r\n    type: 'wire_transfers',\r\n    attributes: [],\r\n    relationships: {\r\n        order: 'orders', // TODO: check relationship type\r\n    },\r\n};\r\nconst WireTransfers = createResource(WireTransfersConfig);\n\nconst RefundsConfig = {\r\n    type: 'refunds',\r\n    attributes: [\r\n        'number',\r\n        'currency_code',\r\n        'amount_cents',\r\n        'amount_float',\r\n        'formatted_amount',\r\n        'succeeded',\r\n        'message',\r\n        'error_code',\r\n        'error_detail',\r\n        'token',\r\n        'gateway_transaction_id',\r\n    ],\r\n    relationships: {\r\n        order: 'orders',\r\n        reference_capture: 'reference_captures', // TODO: check relationship type\r\n    },\r\n};\r\nconst Refunds = createResource(RefundsConfig);\n\nconst StripePaymentsConfig = {\r\n    type: 'stripe_payments',\r\n    attributes: ['client_secret', 'publishable_key', 'options', 'payment_method'],\r\n    relationships: {\r\n        order: 'orders',\r\n        payment_gateway: 'payment_gateways',\r\n    },\r\n};\r\nconst StripePayments = createResource(StripePaymentsConfig);\n\nconst PaymentGatewaysConfig = {\r\n    type: 'payment_gateways',\r\n    attributes: ['name'],\r\n    relationships: {\r\n        payment_methods: 'payment_methods', // TODO: check relationship type\r\n    },\r\n};\r\nconst PaymentGateways = createResource(PaymentGatewaysConfig);\n\nconst CustomerPasswordResetsConfig = {\r\n    type: 'customer_password_resets',\r\n    attributes: [\r\n        'customer_email',\r\n        'reset_password_token',\r\n        'customer_password',\r\n        '_reset_password_token',\r\n        'reset_password_at',\r\n    ],\r\n    relationships: {\r\n        customer: 'customers',\r\n    },\r\n};\r\nconst CustomerPasswordResets = createResource(CustomerPasswordResetsConfig);\n\nconst OrderCopiesConfig = {\r\n    type: 'order_copies',\r\n    attributes: [\r\n        'status',\r\n        'started_at',\r\n        'completed_at',\r\n        'failed_at',\r\n        'place_target_order',\r\n        'cancel_source_order',\r\n        'reuse_wallet',\r\n        'errors_log',\r\n        'errors_count',\r\n    ],\r\n    relationships: {\r\n        source_order: 'orders',\r\n        target_order: 'orders',\r\n        order_subscription: 'order_subscriptions',\r\n    },\r\n};\r\nconst OrderCopies = createResource(OrderCopiesConfig);\n\nconst OrderSubscriptionsConfig = {\r\n    type: 'order_subscriptions',\r\n    attributes: [\r\n        'number',\r\n        'status',\r\n        'frequency',\r\n        'activate_by_source_order',\r\n        'customer_email',\r\n        'starts_at',\r\n        'expires_at',\r\n        'next_run_at',\r\n        'occurrencies',\r\n        'errors_count',\r\n        'succeeded_on_last_run',\r\n        'options',\r\n        '_activate',\r\n        '_deactivate',\r\n        '_cancel',\r\n    ],\r\n    relationships: {\r\n        market: 'markets',\r\n        source_order: 'orders',\r\n        order_copies: 'order_copies',\r\n        orders: 'orders',\r\n    },\r\n};\r\nconst OrderSubscriptions = createResource(OrderSubscriptionsConfig);\n\nconst CustomerPaymentSourcesConfig = {\r\n    type: 'customer_payment_sources',\r\n    attributes: ['name', 'customer_token', 'payment_source_token'],\r\n    relationships: {\r\n        customer: 'customers',\r\n        payment_source: {\r\n            polymorphic: true,\r\n        },\r\n    },\r\n};\r\nconst CustomerPaymentSources = createResource(CustomerPaymentSourcesConfig);\n\nconst StockLocationConfig = {\r\n    type: 'stock_locations',\r\n    attributes: ['number', 'name', 'label_format', 'suppress_etd'],\r\n    relationships: {\r\n        inventory_stock_locations: 'inventory_stock_locations',\r\n        inventory_return_locations: 'inventory_return_locations',\r\n        stock_items: 'stock_items',\r\n        stock_transfers: 'stock_transfers',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst StockLocations = createResource(StockLocationConfig);\n\nconst StockItemConfig = {\r\n    type: 'stock_items',\r\n    attributes: ['sku_code', 'quantity'],\r\n    relationships: {\r\n        stock_location: 'stock_locations',\r\n        sku: 'skus',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst StockItems = createResource(StockItemConfig);\n\nconst CustomerGroupsConfig = {\r\n    type: 'customer_groups',\r\n    attributes: ['name'],\r\n    relationships: {\r\n        customers: 'customers',\r\n        markets: 'markets',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst CustomerGroups = createResource(CustomerGroupsConfig);\n\nconst SkuListItemsConfig = {\r\n    type: 'sku_lists',\r\n    attributes: [\r\n        'position',\r\n        'sku_code',\r\n        'quantity',\r\n        'created_at',\r\n        'updated_at',\r\n        'reference',\r\n        'reference_origin',\r\n    ],\r\n    relationships: {\r\n        sku_list: 'sku_list',\r\n        sku: 'sku',\r\n    },\r\n};\r\nconst SkuListItems = createResource(SkuListItemsConfig);\n\nconst SkuListsConfig = {\r\n    type: 'sku_lists',\r\n    attributes: [\r\n        'name',\r\n        'slug',\r\n        'description',\r\n        'image_url',\r\n        'manual',\r\n        'sku_code_regex',\r\n        'created_at',\r\n        'updated_at',\r\n        'reference',\r\n        'reference_origin',\r\n    ],\r\n    relationships: {\r\n        skus: 'shipping_categories',\r\n        sku_list_items: 'prices',\r\n        bundles: 'stock_items',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst SkuLists = createResource(SkuListsConfig);\n\nconst BundlesConfig = {\r\n    type: 'bundles',\r\n    attributes: [\r\n        'code',\r\n        'name',\r\n        'currency_code',\r\n        'description',\r\n        'image_url',\r\n        'do_not_ship',\r\n        'do_not_track',\r\n        'price_amount_cents',\r\n        'price_amount_float',\r\n        'formatted_price_amount',\r\n        'compare_at_amount_cents',\r\n        'compare_at_amount_float',\r\n        'formatted_compare_at_amount',\r\n        '_compute_price_amount',\r\n        '_compute_compare_at_amount',\r\n        'skus_count',\r\n        'created_at',\r\n        'updated_at',\r\n        'reference',\r\n        'reference_origin',\r\n    ],\r\n    relationships: {\r\n        market: 'shipping_categories',\r\n        sku_list: 'prices',\r\n        skus: 'stock_items',\r\n        attachments: 'attachments',\r\n    },\r\n};\r\nconst Bundles = createResource(BundlesConfig);\n\nexports.Addresses = Addresses;\nexports.Adjustments = Adjustments;\nexports.Attachments = Attachments;\nexports.Auth = Auth;\nexports.Bundles = Bundles;\nexports.CustomerAddresses = CustomerAddresses;\nexports.CustomerGroups = CustomerGroups;\nexports.CustomerPasswordResets = CustomerPasswordResets;\nexports.CustomerPaymentSources = CustomerPaymentSources;\nexports.Customers = Customers;\nexports.DeliveryLeadTimes = DeliveryLeadTimes;\nexports.GiftCards = GiftCards;\nexports.LineItems = LineItems;\nexports.Markets = Markets;\nexports.OrderCopies = OrderCopies;\nexports.OrderSubscriptions = OrderSubscriptions;\nexports.Orders = Orders;\nexports.PaymentGateways = PaymentGateways;\nexports.PaymentMethods = PaymentMethods;\nexports.PriceLists = PriceLists;\nexports.Prices = Prices;\nexports.Refunds = Refunds;\nexports.ResourceError = ResourceError;\nexports.Returns = Returns;\nexports.Shipments = Shipments;\nexports.ShippingCategories = ShippingCategories;\nexports.ShippingMethods = ShippingMethods;\nexports.SkuListItems = SkuListItems;\nexports.SkuLists = SkuLists;\nexports.Skus = Skus;\nexports.StockItems = StockItems;\nexports.StockLocations = StockLocations;\nexports.StripePayments = StripePayments;\nexports.WireTransfers = WireTransfers;\nexports.getConfig = getConfig;\nexports.init = initConfig;\n"]}