@fabrix/spool-cart
Version:
Spool - eCommerce Spool for Fabrix
115 lines (114 loc) • 4.32 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const joi = require("joi");
exports.cartSpoolConfig = joi.object().keys({
live_mode: joi.boolean(),
prefix: joi.string().allow('', null),
nexus: joi.object().keys({
name: joi.string().required(),
email: joi.string().required(),
host: joi.string().required(),
address: joi.object().keys({
address_1: joi.string(),
address_2: [joi.string().allow('').optional(), joi.allow(null)],
address_3: [joi.string().allow('').optional(), joi.allow(null)],
company: [joi.string().allow('').optional(), joi.allow(null)],
city: joi.string(),
phone: [joi.string().allow('').optional(), joi.allow(null)],
province: joi.string(),
province_code: joi.string(),
country: joi.string(),
country_code: joi.string(),
country_name: joi.string(),
postal_code: joi.string()
})
}),
allow: joi.object().keys({
destroy_product: joi.boolean(),
destroy_variant: joi.boolean(),
product_variants: joi.number(),
product_images: joi.number(),
product_collections: joi.number(),
product_associations: joi.number(),
product_vendors: joi.number(),
product_shops: joi.number()
}),
default_currency: joi.string().valid(['USD']),
default_countries: joi.array().items(joi.string()),
orders: joi.object().keys({
refund_restock: joi.boolean(),
payment_kind: joi.string().valid(['manual', 'immediate']),
transaction_kind: joi.string().valid(['authorize', 'sale']),
fulfillment_kind: joi.string().valid(['manual', 'immediate']),
retry_attempts: joi.number(),
grace_period_days: joi.number()
}),
subscriptions: joi.object().keys({
retry_attempts: joi.number(),
grace_period_days: joi.number(),
renewal_notice_days: joi.number()
}),
transactions: joi.object().keys({
retry_attempts: joi.number(),
authorization_exp_days: joi.number()
}),
emails: {
customerRetarget: joi.boolean(),
customerAccountBalanceDeducted: joi.boolean(),
customerAccountBalanceCredited: joi.boolean(),
customerAccountSuspended: joi.boolean(),
orderCreated: joi.boolean(),
orderUpdated: joi.boolean(),
orderPaid: joi.boolean(),
orderFulfilled: joi.boolean(),
orderRefunded: joi.boolean(),
orderCancelled: joi.boolean(),
sourceExpired: joi.boolean(),
sourceWillExpire: joi.boolean(),
sourceUpdated: joi.boolean(),
subscriptionCreated: joi.boolean(),
subscriptionUpdated: joi.boolean(),
subscriptionActivated: joi.boolean(),
subscriptionDeactivated: joi.boolean(),
subscriptionCancelled: joi.boolean(),
subscriptionWillRenew: joi.boolean(),
subscriptionRenewed: joi.boolean(),
subscriptionFailed: joi.boolean(),
transactionFailed: joi.boolean(),
},
notifications: {
admin: joi.object().keys({
orderCreated: joi.boolean()
})
},
events: joi.object(),
pagination: joi.string().valid(['x-headers', 'rows']),
afterCreate: joi.object().keys({
customer: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
order: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
subscription: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
}),
afterUpdate: joi.object().keys({
customer: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
order: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
subscription: joi.alternatives().try(joi.func(), joi.object({
arg: joi.string(),
value: joi.func()
}).unknown()),
})
});