UNPKG

@shipengine/connect-order-source-api

Version:

This is the typescript/javascript definitions for the order source api

87 lines 4.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrderSourceDefinitionSchema = exports.OrderSourceDefinition = void 0; const tslib_1 = require("tslib"); const account_connection_specification_1 = require("./account-connection-specification"); const fs_1 = require("fs"); const joi_1 = tslib_1.__importDefault(require("joi")); const packing_slip_template_version_1 = require("../../models/packing-slip-template-version"); const models_1 = require("../../models"); const connect_runtime_1 = require("@shipengine/connect-runtime"); /** @description This represents a single branded order source within our system */ class OrderSourceDefinition { /** @description This is a unique GUID identifier for this order source */ Id; /** @description The branded name for this order source @example "Shopify", "eBay", "Amazon Canada" */ Name; /** @description A human readable, snake cased identifier for this order source @example "shopify", "ebay", "amazon_ca" */ ApiCode; /** @description Indicates whether or not our system is allowed to send emails to customers */ SendEmail; /** @deprecated This field is no longer used, supply CustomValueOptions instead */ HasCustomMappings; /** @description Indicates whether or not orders can be refreshed @deprecated This field will now be based off of whether or not SalesOrdersExport is implemented. */ CanRefresh; /** @description Indicates whether or not the order source allows sellers to leave feedback on customers */ CanLeaveFeedback; /** @description Indicates whether or not the order source can confirm an order has been shipped @deprecated This field will now be based off of whether or not ShipmentNotification is implemented. */ CanConfirmShipments; /** @description Indicates that refreshing is disabled within our platform @deprecated This field will now be based off of whether or not SalesOrdersExport is implemented. */ IsRefreshDisabled; /** @description Indicates whether this order source allows for custom statuses on a seller by seller basis */ HasCustomStatuses; /** @description Indicates whether or not a user is allowed to configure their own timezone */ CanConfigureTimeZone; /** @description Indicates whether or not the order source has inventory levels */ HasInventoryLevels; /** @description Specifies account connection information */ AccountConnection; /** @description Images that will be used for this branded order source */ Images; /** @description This lets the platform know which packing slip templates this order source supports */ SupportedPackingSlipTemplateVersions; /** @description This tells the UI which options are available for custom fields */ CustomFieldOptions; /** @description Additional settings which can be configured outside of the registration modal */ StoreSettings; } exports.OrderSourceDefinition = OrderSourceDefinition; const fileExists = (value, helpers) => { if ((0, fs_1.existsSync)(value)) { return value; } throw new Error("the file doesn't exist"); }; exports.OrderSourceDefinitionSchema = joi_1.default.object({ Id: joi_1.default.string().uuid().required(), Name: joi_1.default.string().required().max(50), ApiCode: joi_1.default.string().optional().pattern(connect_runtime_1.ApiCodeRegex, connect_runtime_1.ApiCodeValidationMessage), SendEmail: joi_1.default.bool().strict().required(), HasCustomMappings: joi_1.default.bool().strict().optional(), CanRefresh: joi_1.default.bool().optional(), CanLeaveFeedback: joi_1.default.bool().strict().required(), CanConfirmShipments: joi_1.default.bool().optional(), IsRefreshDisabled: joi_1.default.bool().optional(), HasCustomStatuses: joi_1.default.bool().strict().optional(), HasInventoryLevels: joi_1.default.bool().strict().optional(), AccountConnection: account_connection_specification_1.AccountConnectionSpecificationSchema.required(), Images: joi_1.default.object({ Icon: joi_1.default.string() .required() .custom(fileExists, 'icon exists') .pattern(new RegExp('^.*.(svg)$')) .message('Images.Icon must be a svg file.'), Logo: joi_1.default.string() .required() .custom(fileExists, 'logo exists') .pattern(new RegExp('^.*.(svg)$')) .message('Images.Logo must be a svg file.'), }).required(), SupportedPackingSlipTemplateVersions: joi_1.default.array() .items(packing_slip_template_version_1.PackingSlipTemplateVersionSchema) .optional() .empty(), CustomFieldOptions: joi_1.default.array().items(models_1.CustomFieldOptionSchema).optional().empty(), StoreSetting: joi_1.default.array().items(models_1.StoreSettingSchema).optional().empty(), }); //# sourceMappingURL=order-source-specification.js.map