2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2021-12-03 00:44:16 -08:00
|
|
|
|
|
|
|
const customerAddressOptions: INodeProperties[] = [
|
2021-08-01 12:33:21 -07:00
|
|
|
{
|
|
|
|
displayName: 'First Name',
|
|
|
|
name: 'first_name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Name',
|
|
|
|
name: 'last_name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Company',
|
|
|
|
name: 'company',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Address 1',
|
|
|
|
name: 'address_1',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Address 2',
|
|
|
|
name: 'address_2',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'City',
|
|
|
|
name: 'city',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'State',
|
|
|
|
name: 'state',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Postcode',
|
|
|
|
name: 'postcode',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Country',
|
|
|
|
name: 'country',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Email',
|
|
|
|
name: 'email',
|
|
|
|
type: 'string',
|
2022-06-20 07:54:01 -07:00
|
|
|
placeholder: 'name@email.com',
|
2021-08-01 12:33:21 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Phone',
|
|
|
|
name: 'phone',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
const customerUpdateOptions: INodeProperties[] = [
|
2021-08-01 12:33:21 -07:00
|
|
|
{
|
|
|
|
displayName: 'Billing Address',
|
|
|
|
name: 'billing',
|
|
|
|
type: 'collection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
options: customerAddressOptions,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'First Name',
|
|
|
|
name: 'first_name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Last Name',
|
|
|
|
name: 'last_name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Metadata',
|
|
|
|
name: 'meta_data',
|
|
|
|
type: 'fixedCollection',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Metadata Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Metadata Fields',
|
|
|
|
name: 'meta_data_fields',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Key',
|
|
|
|
name: 'key',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-11-03 17:48:07 -07:00
|
|
|
{
|
|
|
|
displayName: 'Password',
|
|
|
|
name: 'password',
|
|
|
|
type: 'string',
|
2022-09-12 00:36:50 -07:00
|
|
|
typeOptions: { password: true },
|
2021-11-03 17:48:07 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
'/resource': ['customer'],
|
|
|
|
'/operation': ['create'],
|
2021-11-03 17:48:07 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
2021-08-01 12:33:21 -07:00
|
|
|
{
|
|
|
|
displayName: 'Shipping Address',
|
|
|
|
name: 'shipping',
|
|
|
|
type: 'collection',
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
options: customerAddressOptions,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
const customerCreateOptions: INodeProperties[] = [
|
2021-08-01 12:33:21 -07:00
|
|
|
...customerUpdateOptions,
|
|
|
|
{
|
|
|
|
displayName: 'Username',
|
|
|
|
name: 'username',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const customerCreateFields: INodeProperties = {
|
2021-08-01 12:33:21 -07:00
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['customer'],
|
|
|
|
operation: ['create'],
|
2021-08-01 12:33:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: customerCreateOptions,
|
|
|
|
};
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const customerUpdateFields: INodeProperties = {
|
2021-08-01 12:33:21 -07:00
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['customer'],
|
|
|
|
operation: ['update'],
|
2021-08-01 12:33:21 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: customerUpdateOptions,
|
|
|
|
};
|