2021-06-01 01:43:57 -07:00
|
|
|
import { CamelCaseResource } from '../types';
|
|
|
|
|
2021-04-29 02:56:19 -07:00
|
|
|
export const billingAddress = {
|
|
|
|
displayName: 'Billing Address',
|
|
|
|
name: 'Billing_Address',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Billing Address Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Billing Address Fields',
|
|
|
|
name: 'address_fields',
|
|
|
|
values: [
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'City',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Billing_City',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Country',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Billing_Country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'State',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Billing_State',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Street',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Billing_Street',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
2021-05-10 05:22:07 -07:00
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Zip Code',
|
2021-05-10 05:22:07 -07:00
|
|
|
name: 'Billing_Code',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const shippingAddress = {
|
|
|
|
displayName: 'Shipping Address',
|
|
|
|
name: 'Shipping_Address',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Shipping Address Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Shipping Address Fields',
|
|
|
|
name: 'address_fields',
|
|
|
|
values: [
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'City',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Shipping_City',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Country',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Shipping_Country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'State',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Shipping_State',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Street',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Shipping_Street',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
2021-05-10 05:22:07 -07:00
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Zip Code',
|
2021-05-10 05:22:07 -07:00
|
|
|
name: 'Shipping_Code',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const mailingAddress = {
|
|
|
|
displayName: 'Mailing Address',
|
|
|
|
name: 'Mailing_Address',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Mailing Address Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Mailing Address Fields',
|
|
|
|
name: 'address_fields',
|
|
|
|
values: [
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'City',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Mailing_City',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Country',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Mailing_Country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'State',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Mailing_State',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Street',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Mailing_Street',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Zip Code',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Mailing_Zip',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const otherAddress = {
|
|
|
|
displayName: 'Other Address',
|
|
|
|
name: 'Other_Address',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Other Address Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Other Address Fields',
|
|
|
|
name: 'address_fields',
|
|
|
|
values: [
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'City',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Other_City',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'State',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Other_State',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Street',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Other_Street',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-28 13:47:53 -07:00
|
|
|
displayName: 'Zip Code',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Other_Zip',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const address = {
|
|
|
|
displayName: 'Address',
|
|
|
|
name: 'Address',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Address Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Address Fields',
|
|
|
|
name: 'address_fields',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'City',
|
|
|
|
name: 'City',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Country',
|
|
|
|
name: 'Country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'State',
|
|
|
|
name: 'State',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Street',
|
|
|
|
name: 'Street',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Zip Code',
|
|
|
|
name: 'Zip_Code',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2021-05-31 02:01:13 -07:00
|
|
|
export const makeProductDetails = (resource: string, operation: string, { hasUpsert } = { hasUpsert: false }) => ({
|
2021-05-09 07:30:16 -07:00
|
|
|
displayName: 'Products',
|
2021-04-29 02:56:19 -07:00
|
|
|
name: 'Product_Details',
|
2021-05-07 08:28:42 -07:00
|
|
|
type: 'collection',
|
2021-05-09 07:30:16 -07:00
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
multipleValueButtonText: 'Add Product',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
default: {},
|
2021-05-07 08:28:42 -07:00
|
|
|
placeholder: 'Add Field',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
resource,
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
operation,
|
2021-05-31 02:01:13 -07:00
|
|
|
hasUpsert && 'upsert',
|
2021-05-07 08:28:42 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
options: [
|
|
|
|
{
|
2021-05-07 08:28:42 -07:00
|
|
|
displayName: 'List Price',
|
|
|
|
name: 'list_price',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Net Total',
|
|
|
|
name: 'net_total',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
2021-05-09 07:30:16 -07:00
|
|
|
displayName: 'Product ID',
|
|
|
|
name: 'id',
|
|
|
|
type: 'options',
|
|
|
|
default: [],
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getProducts',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
2021-05-07 08:28:42 -07:00
|
|
|
{
|
|
|
|
displayName: 'Product Description',
|
|
|
|
name: 'product_description',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Quantity',
|
|
|
|
name: 'quantity',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Quantity in Stock',
|
|
|
|
name: 'quantity_in_stock',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tax',
|
|
|
|
name: 'Tax',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Total',
|
|
|
|
name: 'total',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Total After Discount',
|
|
|
|
name: 'total_after_discount',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Unit Price',
|
|
|
|
name: 'unit_price',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
2021-05-07 08:28:42 -07:00
|
|
|
});
|
2021-04-29 02:56:19 -07:00
|
|
|
|
2021-06-01 01:43:57 -07:00
|
|
|
export const makeGetAllFields = (resource: CamelCaseResource) => {
|
|
|
|
const loadOptionsMethod = {
|
|
|
|
account: 'getAccountFields',
|
|
|
|
contact: 'getContactFields',
|
|
|
|
deal: 'getDealFields',
|
|
|
|
invoice: 'getInvoiceFields',
|
|
|
|
lead: 'getLeadFields',
|
|
|
|
product: 'getProductFields',
|
|
|
|
purchaseOrder: 'getPurchaseOrderFields',
|
|
|
|
quote: 'getQuoteFields',
|
|
|
|
salesOrder: 'getSalesOrderFields',
|
|
|
|
vendor: 'getVendorFields',
|
|
|
|
}[resource];
|
|
|
|
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: 'Return all results.',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
resource,
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
|
|
|
},
|
2021-06-01 01:43:57 -07:00
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
default: 5,
|
|
|
|
description: 'The number of results to return.',
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 1000,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
resource,
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
2021-06-01 01:43:57 -07:00
|
|
|
{
|
|
|
|
displayName: 'Options',
|
|
|
|
name: 'options',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Option',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
resource,,
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
2021-06-01 01:43:57 -07:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Approved',
|
|
|
|
name: 'approved',
|
|
|
|
type: 'boolean',
|
|
|
|
default: true,
|
|
|
|
description: 'Retrieve only approved leads. Defaults to true.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Converted',
|
|
|
|
name: 'converted',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: 'Retrieve only converted leads. Defaults to false.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Fields',
|
|
|
|
name: 'fields',
|
|
|
|
type: 'multiOptions',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod,
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Include Child',
|
|
|
|
name: 'include_child',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
description: 'Retrieve only leads from child territories.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sort By',
|
|
|
|
name: 'sort_by',
|
|
|
|
type: 'multiOptions',
|
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod,
|
|
|
|
},
|
|
|
|
default: [],
|
|
|
|
description: 'Field to sort leads by.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Sort Order',
|
|
|
|
name: 'sort_order',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Ascending',
|
|
|
|
value: 'asc',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Descending',
|
|
|
|
value: 'desc',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'desc',
|
|
|
|
description: 'Ascending or descending order sort order.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Territory ID',
|
|
|
|
name: 'territory_id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Retrieve only leads from this territory.',
|
|
|
|
},
|
|
|
|
],
|
2021-04-29 02:56:19 -07:00
|
|
|
},
|
2021-06-01 01:43:57 -07:00
|
|
|
];
|
|
|
|
};
|