@isoftdata/svelte-ecommerce 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/EcommerceCategoryMapConfiguration.svelte +266 -0
- package/dist/EcommerceCategoryMapConfiguration.svelte.d.ts +14 -0
- package/dist/EcommerceConditionMapConfiguration.svelte +214 -0
- package/dist/EcommerceConditionMapConfiguration.svelte.d.ts +10 -0
- package/dist/EcommerceConfiguration.svelte +195 -0
- package/dist/EcommerceConfiguration.svelte.d.ts +22 -0
- package/dist/EcommerceDefaults.svelte +357 -0
- package/dist/EcommerceDefaults.svelte.d.ts +12 -0
- package/dist/EcommerceListingDetails.svelte +986 -0
- package/dist/EcommerceListingDetails.svelte.d.ts +18 -0
- package/dist/EcommercePartTypeConfig.svelte +305 -0
- package/dist/EcommercePartTypeConfig.svelte.d.ts +15 -0
- package/dist/EcommerceStoreConfiguration.svelte +263 -0
- package/dist/EcommerceStoreConfiguration.svelte.d.ts +13 -0
- package/dist/PolicyList.svelte +66 -0
- package/dist/PolicyList.svelte.d.ts +10 -0
- package/dist/data/ebay.d.ts +11 -0
- package/dist/data/ebay.js +31 -0
- package/dist/data/htp.d.ts +9 -0
- package/dist/data/htp.js +22 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.js +6 -0
- package/dist/data/types.d.ts +4 -0
- package/dist/data/types.js +1 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.js +3 -0
- package/dist/helpers/listing.d.ts +22 -0
- package/dist/helpers/listing.js +324 -0
- package/dist/helpers/template.d.ts +31 -0
- package/dist/helpers/template.js +131 -0
- package/dist/helpers/validation.d.ts +2 -0
- package/dist/helpers/validation.js +91 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/utils.d.ts +321 -0
- package/dist/utils.js +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { i18n } from 'i18next'
|
|
3
|
+
|
|
4
|
+
import { getContext } from 'svelte'
|
|
5
|
+
|
|
6
|
+
import EcommerceDefaults from './EcommerceDefaults.svelte'
|
|
7
|
+
import type {
|
|
8
|
+
EbayCategory,
|
|
9
|
+
EbayCategoryMap,
|
|
10
|
+
EbayPolicy,
|
|
11
|
+
EbayLocation,
|
|
12
|
+
EcommerceCondition,
|
|
13
|
+
EcommerceConditionMap,
|
|
14
|
+
ExtendedEcommerceConditionMap,
|
|
15
|
+
EcommercePartnerConfiguration,
|
|
16
|
+
EcommerceSharedDefaults,
|
|
17
|
+
ExtendedEbayCategoryMap,
|
|
18
|
+
ExtendedInventoryTypeListingDefaults,
|
|
19
|
+
InventoryType,
|
|
20
|
+
InventoryTypeCategory,
|
|
21
|
+
InventoryTypeListingDefaults,
|
|
22
|
+
NewInventoryTypeListingDefaults,
|
|
23
|
+
Store,
|
|
24
|
+
} from './utils.js'
|
|
25
|
+
import EcommerceConditionMapConfig from './EcommerceConditionMapConfiguration.svelte'
|
|
26
|
+
import EcommerceCategoryMapConfig from './EcommerceCategoryMapConfiguration.svelte'
|
|
27
|
+
import EcommerceStoreConfig from './EcommerceStoreConfiguration.svelte'
|
|
28
|
+
import EcommercePartTypeConfig from './EcommercePartTypeConfig.svelte'
|
|
29
|
+
|
|
30
|
+
import { translate as defaultTranslate } from '@isoftdata/utility-string'
|
|
31
|
+
const { t: translate } = getContext<i18n>('i18next') || { t: defaultTranslate }
|
|
32
|
+
|
|
33
|
+
interface Props {
|
|
34
|
+
ebayCategoryList: EbayCategory[]
|
|
35
|
+
ebayCategoryMapList: ExtendedEbayCategoryMap[]
|
|
36
|
+
ebayPolicyList: EbayPolicy[]
|
|
37
|
+
ebayLocationList: EbayLocation[]
|
|
38
|
+
ecommerceConditionList: EcommerceCondition[]
|
|
39
|
+
ecommerceConditionMappingList: ExtendedEcommerceConditionMap[]
|
|
40
|
+
inventoryConditionList: string[]
|
|
41
|
+
inventoryTypeCategoryList: InventoryTypeCategory[]
|
|
42
|
+
inventoryTypeList: InventoryType[]
|
|
43
|
+
inventoryTypeWithDefaultConfigList: ExtendedInventoryTypeListingDefaults[]
|
|
44
|
+
partnerConfigurationList: EcommercePartnerConfiguration[]
|
|
45
|
+
saveEcommerceCategoryMap: (categoryMappingRow: EbayCategoryMap) => Promise<void>
|
|
46
|
+
saveEcommerceConditionMap: (config: EcommerceConditionMap) => Promise<void>
|
|
47
|
+
saveEcommercePartnerConfig: (config: EcommercePartnerConfiguration) => Promise<void>
|
|
48
|
+
saveEcommercePartTypeConfig: (
|
|
49
|
+
config: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults,
|
|
50
|
+
) => Promise<void>
|
|
51
|
+
storeList: Store[]
|
|
52
|
+
//
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let {
|
|
56
|
+
ebayCategoryList = [],
|
|
57
|
+
ebayCategoryMapList = [],
|
|
58
|
+
ebayLocationList = [],
|
|
59
|
+
ebayPolicyList = [],
|
|
60
|
+
ecommerceConditionList = [],
|
|
61
|
+
ecommerceConditionMappingList = [],
|
|
62
|
+
inventoryConditionList = [],
|
|
63
|
+
inventoryTypeCategoryList = [],
|
|
64
|
+
inventoryTypeList = [],
|
|
65
|
+
inventoryTypeWithDefaultConfigList = [],
|
|
66
|
+
partnerConfigurationList = [],
|
|
67
|
+
saveEcommerceCategoryMap = async (_: EbayCategoryMap) => {},
|
|
68
|
+
saveEcommerceConditionMap = async (_: EcommerceConditionMap) => {},
|
|
69
|
+
saveEcommercePartnerConfig = async (_: EcommercePartnerConfiguration) => {},
|
|
70
|
+
saveEcommercePartTypeConfig = async (_: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults) => {},
|
|
71
|
+
storeList = [],
|
|
72
|
+
}: Props = $props()
|
|
73
|
+
// Hard coding this for now, should be selectable between htp and ebay....maybe just default to the only one?
|
|
74
|
+
let selectedEcommercePartnerId = $state(1)
|
|
75
|
+
|
|
76
|
+
let globalDefaults = $derived.by(getGlobalDefaults)
|
|
77
|
+
|
|
78
|
+
function getGlobalDefaults() {
|
|
79
|
+
const matchingPartnerConfig = partnerConfigurationList.find(
|
|
80
|
+
row => row.ecommercePartnerId === selectedEcommercePartnerId,
|
|
81
|
+
)
|
|
82
|
+
if (matchingPartnerConfig) {
|
|
83
|
+
return matchingPartnerConfig.defaults?.global
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Handles global defaults being changed
|
|
88
|
+
async function handleGlobalConfigChange(newGlobalDefaults: EcommerceSharedDefaults) {
|
|
89
|
+
// Find the matching partner config to update the global defaults on
|
|
90
|
+
const matchingPartnerConfig = partnerConfigurationList.find(
|
|
91
|
+
row => row.ecommercePartnerId === selectedEcommercePartnerId,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if (!matchingPartnerConfig) {
|
|
95
|
+
console.error('No matching partner configuration found for ID:', selectedEcommercePartnerId)
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Initialize defaults if it doesn't exist
|
|
100
|
+
if (!matchingPartnerConfig.defaults) {
|
|
101
|
+
matchingPartnerConfig.defaults = {
|
|
102
|
+
global: {},
|
|
103
|
+
store: [],
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Update the global defaults with the new values
|
|
108
|
+
matchingPartnerConfig.defaults.global = { ...newGlobalDefaults }
|
|
109
|
+
|
|
110
|
+
await saveEcommercePartnerConfig(matchingPartnerConfig)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function handleStoreConfigChange(updatedPartnerConfig: EcommercePartnerConfiguration) {
|
|
114
|
+
await saveEcommercePartnerConfig(updatedPartnerConfig)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function handleCategoryMapChange(categoryMappingRow: EbayCategoryMap) {
|
|
118
|
+
await saveEcommerceCategoryMap(categoryMappingRow)
|
|
119
|
+
}
|
|
120
|
+
async function handleConditionMapChange(conditionMapRow: EcommerceConditionMap) {
|
|
121
|
+
await saveEcommerceConditionMap(conditionMapRow)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function handlePartTypeConfigurationChange(
|
|
125
|
+
partTypeConfigRow: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults,
|
|
126
|
+
) {
|
|
127
|
+
await saveEcommercePartTypeConfig(partTypeConfigRow)
|
|
128
|
+
}
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<div class="row">
|
|
132
|
+
<div class="col">
|
|
133
|
+
<div class="card-header">
|
|
134
|
+
<h4 class="mb-0">{translate('ecommerce.configuration.globalDefaults', 'Global Defaults')}</h4>
|
|
135
|
+
<p class="text-muted mb-0">
|
|
136
|
+
{translate('ecommerce.configuration.configureGlobalDefaultsForEbay', 'Configure global defaults for eBay')}
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="card-body">
|
|
140
|
+
<EcommerceDefaults
|
|
141
|
+
bind:defaults={globalDefaults}
|
|
142
|
+
{ebayPolicyList}
|
|
143
|
+
{ecommerceConditionList}
|
|
144
|
+
{partnerConfigurationList}
|
|
145
|
+
defaultsChanged={handleGlobalConfigChange}
|
|
146
|
+
{selectedEcommercePartnerId}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="col">
|
|
151
|
+
<EcommerceStoreConfig
|
|
152
|
+
{ecommerceConditionList}
|
|
153
|
+
{ebayLocationList}
|
|
154
|
+
{ebayPolicyList}
|
|
155
|
+
partnerConfigurationChanged={handleStoreConfigChange}
|
|
156
|
+
{partnerConfigurationList}
|
|
157
|
+
{selectedEcommercePartnerId}
|
|
158
|
+
{storeList}
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="row">
|
|
163
|
+
<div class="col">
|
|
164
|
+
<EcommerceConditionMapConfig
|
|
165
|
+
{ecommerceConditionList}
|
|
166
|
+
{inventoryConditionList}
|
|
167
|
+
{ecommerceConditionMappingList}
|
|
168
|
+
conditionMapChanged={handleConditionMapChange}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="row">
|
|
173
|
+
<div class="col">
|
|
174
|
+
<EcommerceCategoryMapConfig
|
|
175
|
+
{ebayCategoryList}
|
|
176
|
+
{ebayCategoryMapList}
|
|
177
|
+
{inventoryTypeList}
|
|
178
|
+
categoryMapChanged={handleCategoryMapChange}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="row">
|
|
183
|
+
<div class="col">
|
|
184
|
+
<EcommercePartTypeConfig
|
|
185
|
+
{ebayPolicyList}
|
|
186
|
+
{ecommerceConditionList}
|
|
187
|
+
{inventoryTypeList}
|
|
188
|
+
{inventoryTypeWithDefaultConfigList}
|
|
189
|
+
{inventoryTypeCategoryList}
|
|
190
|
+
{partnerConfigurationList}
|
|
191
|
+
partTypeConfigurationChanged={handlePartTypeConfigurationChange}
|
|
192
|
+
{selectedEcommercePartnerId}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EbayCategory, EbayCategoryMap, EbayPolicy, EbayLocation, EcommerceCondition, EcommerceConditionMap, ExtendedEcommerceConditionMap, EcommercePartnerConfiguration, ExtendedEbayCategoryMap, ExtendedInventoryTypeListingDefaults, InventoryType, InventoryTypeCategory, InventoryTypeListingDefaults, NewInventoryTypeListingDefaults, Store } from './utils.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
ebayCategoryList: EbayCategory[];
|
|
4
|
+
ebayCategoryMapList: ExtendedEbayCategoryMap[];
|
|
5
|
+
ebayPolicyList: EbayPolicy[];
|
|
6
|
+
ebayLocationList: EbayLocation[];
|
|
7
|
+
ecommerceConditionList: EcommerceCondition[];
|
|
8
|
+
ecommerceConditionMappingList: ExtendedEcommerceConditionMap[];
|
|
9
|
+
inventoryConditionList: string[];
|
|
10
|
+
inventoryTypeCategoryList: InventoryTypeCategory[];
|
|
11
|
+
inventoryTypeList: InventoryType[];
|
|
12
|
+
inventoryTypeWithDefaultConfigList: ExtendedInventoryTypeListingDefaults[];
|
|
13
|
+
partnerConfigurationList: EcommercePartnerConfiguration[];
|
|
14
|
+
saveEcommerceCategoryMap: (categoryMappingRow: EbayCategoryMap) => Promise<void>;
|
|
15
|
+
saveEcommerceConditionMap: (config: EcommerceConditionMap) => Promise<void>;
|
|
16
|
+
saveEcommercePartnerConfig: (config: EcommercePartnerConfiguration) => Promise<void>;
|
|
17
|
+
saveEcommercePartTypeConfig: (config: InventoryTypeListingDefaults | NewInventoryTypeListingDefaults) => Promise<void>;
|
|
18
|
+
storeList: Store[];
|
|
19
|
+
}
|
|
20
|
+
declare const EcommerceConfiguration: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type EcommerceConfiguration = ReturnType<typeof EcommerceConfiguration>;
|
|
22
|
+
export default EcommerceConfiguration;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { i18n } from 'i18next'
|
|
3
|
+
|
|
4
|
+
import { getContext } from 'svelte'
|
|
5
|
+
import Input from '@isoftdata/svelte-input'
|
|
6
|
+
import Select from '@isoftdata/svelte-select'
|
|
7
|
+
import Button from '@isoftdata/svelte-button'
|
|
8
|
+
import Textarea from '@isoftdata/svelte-textarea'
|
|
9
|
+
import { translate as defaultTranslate } from '@isoftdata/utility-string'
|
|
10
|
+
|
|
11
|
+
const { t: translate } = getContext<i18n>('i18next') || { t: defaultTranslate }
|
|
12
|
+
|
|
13
|
+
import { ecommercePartnerStaticData } from './data/index.js'
|
|
14
|
+
import PolicyList from './PolicyList.svelte'
|
|
15
|
+
|
|
16
|
+
import type {
|
|
17
|
+
EbayPolicy,
|
|
18
|
+
EcommerceCondition,
|
|
19
|
+
EcommercePartnerConfiguration,
|
|
20
|
+
EcommerceSharedDefaults,
|
|
21
|
+
PolicyRowWithChecked,
|
|
22
|
+
} from './utils.js'
|
|
23
|
+
import type { PackageType } from './data/types.js'
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
defaults?: EcommerceSharedDefaults
|
|
27
|
+
ebayPolicyList?: EbayPolicy[]
|
|
28
|
+
ecommerceConditionList: EcommerceCondition[]
|
|
29
|
+
partnerConfigurationList: EcommercePartnerConfiguration[]
|
|
30
|
+
defaultsChanged: (newDefaults: EcommerceSharedDefaults) => Promise<void>
|
|
31
|
+
selectedEcommercePartnerId: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let {
|
|
35
|
+
defaults = $bindable(),
|
|
36
|
+
ebayPolicyList,
|
|
37
|
+
ecommerceConditionList,
|
|
38
|
+
partnerConfigurationList,
|
|
39
|
+
defaultsChanged = async (_: EcommerceSharedDefaults) => {},
|
|
40
|
+
selectedEcommercePartnerId,
|
|
41
|
+
}: Props = $props()
|
|
42
|
+
|
|
43
|
+
// State variables for all form inputs - initialize from defaults prop if provided
|
|
44
|
+
let brandMapping = $state<string>(defaults?.brandMapping ?? '')
|
|
45
|
+
let conditionDescription = $state<string>(defaults?.conditionDescription ?? '')
|
|
46
|
+
let conditionId = $state<number | null>(defaults?.conditionId ?? null)
|
|
47
|
+
let fulfillmentPolicies = $state<string[]>(defaults?.fulfillmentPolicies ?? [])
|
|
48
|
+
let listingDescriptionTemplate = $state<string>(defaults?.listingDescriptionTemplate ?? '')
|
|
49
|
+
let listingDuration = $state<string>(defaults?.listingDuration ?? '')
|
|
50
|
+
let listingTitleTemplate = $state<string>(defaults?.listingTitleTemplate ?? '')
|
|
51
|
+
let fulfillmentTimeValue = $state<number | null>(defaults?.fulfillmentTimeValue ?? null)
|
|
52
|
+
let fulfillmentTimeUnit = $state<string | null>(defaults?.fulfillmentTimeUnit ?? null)
|
|
53
|
+
let manufacturerPartNumberMapping = $state<string>(defaults?.manufacturerPartNumberMapping ?? '')
|
|
54
|
+
let packageType = $state<string | null>(defaults?.packageType ?? null)
|
|
55
|
+
let paymentPolicies = $state<string[]>(defaults?.paymentPolicies ?? [])
|
|
56
|
+
let returnPolicies = $state<string[]>(defaults?.returnPolicies ?? [])
|
|
57
|
+
let shippingLengthUnit = $state<string | null>(defaults?.shippingLengthUnit ?? null)
|
|
58
|
+
let shippingWeightUnit = $state<string | null>(defaults?.shippingWeightUnit ?? null)
|
|
59
|
+
|
|
60
|
+
// Computed properties for UI state
|
|
61
|
+
let ecommerceConditions = $derived(ecommerceConditionList) // TODO: why'd I do this?
|
|
62
|
+
let editEcommerceConditionDisabled = $state<boolean>(false)
|
|
63
|
+
let fulfillmentPolicyList = $derived.by(getFulfillmentPolicyList)
|
|
64
|
+
let lengthUnits = $derived.by(getPartnerLengthUnits)
|
|
65
|
+
let packageTypes = $derived.by(getPartnerPackageTypes)
|
|
66
|
+
let paymentPolicyList = $derived.by(getPaymentPolicyList)
|
|
67
|
+
let returnPolicyList = $derived.by(getReturnPolicyList)
|
|
68
|
+
let selectedPartnerConfig = $derived.by(getSelectedPartnerConfig)
|
|
69
|
+
let showAllOption = $state<boolean>(true)
|
|
70
|
+
let weightUnits = $derived.by(getPartnerWeightUnits)
|
|
71
|
+
|
|
72
|
+
function getFulfillmentPolicyList(): PolicyRowWithChecked[] {
|
|
73
|
+
const policies = ebayPolicyList?.filter(policy => policy.policyType === 'fulfillment') || []
|
|
74
|
+
return policies.map(policy => ({
|
|
75
|
+
...policy,
|
|
76
|
+
checked: fulfillmentPolicies.includes(policy.policyId),
|
|
77
|
+
}))
|
|
78
|
+
}
|
|
79
|
+
function getPaymentPolicyList(): PolicyRowWithChecked[] {
|
|
80
|
+
const policies = ebayPolicyList?.filter(policy => policy.policyType === 'payment') || []
|
|
81
|
+
return policies.map(policy => ({
|
|
82
|
+
...policy,
|
|
83
|
+
checked: paymentPolicies.includes(policy.policyId),
|
|
84
|
+
}))
|
|
85
|
+
}
|
|
86
|
+
function getReturnPolicyList(): PolicyRowWithChecked[] {
|
|
87
|
+
const policies = ebayPolicyList?.filter(policy => policy.policyType === 'return') || []
|
|
88
|
+
return policies.map(policy => ({
|
|
89
|
+
...policy,
|
|
90
|
+
checked: returnPolicies.includes(policy.policyId),
|
|
91
|
+
}))
|
|
92
|
+
}
|
|
93
|
+
function getPartnerLengthUnits(): string[] {
|
|
94
|
+
const partnerName = selectedPartnerConfig.name
|
|
95
|
+
if (!partnerName || !(partnerName in ecommercePartnerStaticData)) {
|
|
96
|
+
return []
|
|
97
|
+
}
|
|
98
|
+
return ecommercePartnerStaticData[partnerName as keyof typeof ecommercePartnerStaticData].lengthUnits
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getPartnerPackageTypes(): PackageType[] {
|
|
102
|
+
const partnerName = selectedPartnerConfig.name
|
|
103
|
+
if (!partnerName || !(partnerName in ecommercePartnerStaticData)) {
|
|
104
|
+
return []
|
|
105
|
+
}
|
|
106
|
+
return ecommercePartnerStaticData[partnerName as keyof typeof ecommercePartnerStaticData].packageTypes
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getPartnerWeightUnits(): string[] {
|
|
110
|
+
const partnerName = selectedPartnerConfig.name
|
|
111
|
+
if (!partnerName || !(partnerName in ecommercePartnerStaticData)) {
|
|
112
|
+
return []
|
|
113
|
+
}
|
|
114
|
+
return ecommercePartnerStaticData[partnerName as keyof typeof ecommercePartnerStaticData].weightUnits
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getSelectedPartnerConfig(): EcommercePartnerConfiguration {
|
|
118
|
+
const matchingPartnerConfig = partnerConfigurationList.find(
|
|
119
|
+
row => row.ecommercePartnerId === selectedEcommercePartnerId,
|
|
120
|
+
)
|
|
121
|
+
if (!matchingPartnerConfig) {
|
|
122
|
+
throw new Error('No matching partner config found')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return matchingPartnerConfig
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function handleInputChange() {
|
|
129
|
+
// Build the defaults object using current input values
|
|
130
|
+
const newDefaults = {
|
|
131
|
+
brandMapping: brandMapping || undefined,
|
|
132
|
+
conditionDescription: conditionDescription || undefined,
|
|
133
|
+
conditionId: conditionId || undefined,
|
|
134
|
+
fulfillmentPolicies: fulfillmentPolicies || [],
|
|
135
|
+
fulfillmentTimeUnit: fulfillmentTimeUnit || undefined,
|
|
136
|
+
fulfillmentTimeValue: fulfillmentTimeValue || undefined,
|
|
137
|
+
listingDescriptionTemplate: listingDescriptionTemplate || undefined,
|
|
138
|
+
listingDuration: listingDuration || undefined,
|
|
139
|
+
listingTitleTemplate: listingTitleTemplate || undefined,
|
|
140
|
+
manufacturerPartNumberMapping: manufacturerPartNumberMapping || undefined,
|
|
141
|
+
packageType: packageType || undefined,
|
|
142
|
+
paymentPolicies: paymentPolicies || [],
|
|
143
|
+
returnPolicies: returnPolicies || [],
|
|
144
|
+
shippingLengthUnit: shippingLengthUnit || undefined,
|
|
145
|
+
shippingWeightUnit: shippingWeightUnit || undefined,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
defaults = newDefaults
|
|
149
|
+
await defaultsChanged(newDefaults)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function handleFulfillmentPoliciesChange(selectedIds: string[]) {
|
|
153
|
+
fulfillmentPolicies = selectedIds
|
|
154
|
+
handleInputChange()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function handlePaymentPoliciesChange(selectedIds: string[]) {
|
|
158
|
+
paymentPolicies = selectedIds
|
|
159
|
+
handleInputChange()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function handleReturnPoliciesChange(selectedIds: string[]) {
|
|
163
|
+
returnPolicies = selectedIds
|
|
164
|
+
handleInputChange()
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<div class="row">
|
|
169
|
+
<div class="col">
|
|
170
|
+
<PolicyList
|
|
171
|
+
title={translate('configuration.ecommerce.fulfillmentPoliciesTitle', 'Fulfillment Policies')}
|
|
172
|
+
policies={fulfillmentPolicyList}
|
|
173
|
+
selectedPolicyIds={fulfillmentPolicies}
|
|
174
|
+
onSelectionChange={handleFulfillmentPoliciesChange}
|
|
175
|
+
/>
|
|
176
|
+
<PolicyList
|
|
177
|
+
title={translate('configuration.ecommerce.paymentPoliciesTitle', 'Payment Policies')}
|
|
178
|
+
policies={paymentPolicyList}
|
|
179
|
+
selectedPolicyIds={paymentPolicies}
|
|
180
|
+
onSelectionChange={handlePaymentPoliciesChange}
|
|
181
|
+
/>
|
|
182
|
+
<PolicyList
|
|
183
|
+
title={translate('configuration.ecommerce.returnPoliciesTitle', 'Return Policies')}
|
|
184
|
+
policies={returnPolicyList}
|
|
185
|
+
selectedPolicyIds={returnPolicies}
|
|
186
|
+
onSelectionChange={handleReturnPoliciesChange}
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="row">
|
|
191
|
+
<div class="col">
|
|
192
|
+
<Input
|
|
193
|
+
label={translate('configuration.ecommerce.fulfillmentTime', 'Fulfillment Time')}
|
|
194
|
+
maxlength={3}
|
|
195
|
+
type="number"
|
|
196
|
+
bind:value={fulfillmentTimeValue}
|
|
197
|
+
placeholder=""
|
|
198
|
+
onchange={handleInputChange}
|
|
199
|
+
/>
|
|
200
|
+
|
|
201
|
+
<Select
|
|
202
|
+
id="fulfillment-time-unit"
|
|
203
|
+
label={translate('configuration.ecommerce.fulfillmentUnit', 'Fulfillment Unit')}
|
|
204
|
+
showEmptyOption={true}
|
|
205
|
+
emptyValue={null}
|
|
206
|
+
emptyText={translate('configuration.ecommerce.selectUnit', 'Select Unit')}
|
|
207
|
+
disabled={false}
|
|
208
|
+
required={false}
|
|
209
|
+
onchange={handleInputChange}
|
|
210
|
+
bind:value={fulfillmentTimeUnit}
|
|
211
|
+
>
|
|
212
|
+
{#each ecommercePartnerStaticData.ebay.timeUnits as unit}
|
|
213
|
+
<option value={unit}>{unit}</option>
|
|
214
|
+
{/each}
|
|
215
|
+
</Select>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="row">
|
|
219
|
+
<div class="col">
|
|
220
|
+
<Select
|
|
221
|
+
id="shipping-length-unit"
|
|
222
|
+
label={translate('configuration.ecommerce.lengthUnit', 'Shipping Length Unit')}
|
|
223
|
+
showEmptyOption={true}
|
|
224
|
+
emptyValue={null}
|
|
225
|
+
emptyText={translate('configuration.ecommerce.selectUnit', 'Select Unit')}
|
|
226
|
+
disabled={false}
|
|
227
|
+
required={false}
|
|
228
|
+
onchange={handleInputChange}
|
|
229
|
+
bind:value={shippingLengthUnit}
|
|
230
|
+
>
|
|
231
|
+
{#each lengthUnits as unit}
|
|
232
|
+
<option value={unit}>{unit}</option>
|
|
233
|
+
{/each}
|
|
234
|
+
</Select>
|
|
235
|
+
</div>
|
|
236
|
+
<div class="col">
|
|
237
|
+
<Select
|
|
238
|
+
id="shipping-weight-unit"
|
|
239
|
+
label={translate('configuration.ecommerce.shippingWeightUnit', 'Shipping Weight Unit')}
|
|
240
|
+
showEmptyOption={true}
|
|
241
|
+
emptyValue={null}
|
|
242
|
+
emptyText={translate('configuration.ecommerce.selectUnit', 'Select Unit')}
|
|
243
|
+
disabled={false}
|
|
244
|
+
required={false}
|
|
245
|
+
onchange={handleInputChange}
|
|
246
|
+
bind:value={shippingWeightUnit}
|
|
247
|
+
>
|
|
248
|
+
{#each weightUnits as unit}
|
|
249
|
+
<option value={unit}>{unit}</option>
|
|
250
|
+
{/each}
|
|
251
|
+
</Select>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
<div class="row">
|
|
255
|
+
<div class="col">
|
|
256
|
+
<Select
|
|
257
|
+
label={translate('configuration.ecommerce.condition', 'Condition')}
|
|
258
|
+
showEmptyOption={showAllOption}
|
|
259
|
+
emptyValue={null}
|
|
260
|
+
emptyText={translate('configuration.ecommerce.selectCondition', 'Select Condition')}
|
|
261
|
+
disabled={editEcommerceConditionDisabled}
|
|
262
|
+
bind:value={conditionId}
|
|
263
|
+
onchange={handleInputChange}
|
|
264
|
+
>
|
|
265
|
+
{#each ecommerceConditions as condition}
|
|
266
|
+
<option value={condition.ecommerceConditionId}>{condition.name}</option>
|
|
267
|
+
{/each}
|
|
268
|
+
</Select>
|
|
269
|
+
</div>
|
|
270
|
+
<div class="col">
|
|
271
|
+
<Input
|
|
272
|
+
label={translate('configuration.ecommerce.conditionDescription', 'Condition Description')}
|
|
273
|
+
maxlength={1000}
|
|
274
|
+
bind:value={conditionDescription}
|
|
275
|
+
placeholder=""
|
|
276
|
+
onchange={handleInputChange}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
<div class="row">
|
|
281
|
+
<div class="col">
|
|
282
|
+
<Input
|
|
283
|
+
label={translate('configuration.ecommerce.brand', 'Brand')}
|
|
284
|
+
maxlength={100}
|
|
285
|
+
bind:value={brandMapping}
|
|
286
|
+
onchange={handleInputChange}
|
|
287
|
+
placeholder={'{?PartManufacturer}'}
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
<div class="col">
|
|
291
|
+
<Input
|
|
292
|
+
label={translate('configuration.ecommerce.manufacturerPartNumber', 'Manufacturer Part Number')}
|
|
293
|
+
maxlength={100}
|
|
294
|
+
bind:value={manufacturerPartNumberMapping}
|
|
295
|
+
onchange={handleInputChange}
|
|
296
|
+
placeholder={'{?PartModel}'}
|
|
297
|
+
/>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
<div class="row">
|
|
301
|
+
<div class="col">
|
|
302
|
+
<Select
|
|
303
|
+
label={translate('configuration.ecommerce.packageType', 'Package Type')}
|
|
304
|
+
showEmptyOption={showAllOption}
|
|
305
|
+
emptyValue={null}
|
|
306
|
+
emptyText={translate('configuration.ecommerce.selectDefaultPackage', 'Select Default Package')}
|
|
307
|
+
onchange={handleInputChange}
|
|
308
|
+
bind:value={packageType}
|
|
309
|
+
>
|
|
310
|
+
{#each packageTypes as pkg}
|
|
311
|
+
<option value={pkg.partnerValue}>{pkg.name}</option>
|
|
312
|
+
{/each}
|
|
313
|
+
</Select>
|
|
314
|
+
</div>
|
|
315
|
+
<div class="col">
|
|
316
|
+
<Input
|
|
317
|
+
label={translate('configuration.ecommerce.listingDuration', 'Listing Duration')}
|
|
318
|
+
disabled={true}
|
|
319
|
+
bind:value={listingDuration}
|
|
320
|
+
onchange={handleInputChange}
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
<div class="row">
|
|
325
|
+
<div class="col mt-3">
|
|
326
|
+
<Button
|
|
327
|
+
outline
|
|
328
|
+
size="sm"
|
|
329
|
+
href="https://wikido.isoftdata.com//index.php?title=Ebay_templates"
|
|
330
|
+
target="htp_chromium_popout"
|
|
331
|
+
icon={{
|
|
332
|
+
prefix: 'fak',
|
|
333
|
+
class: 'fa-isoft-bolt',
|
|
334
|
+
}}>{translate('configuration.ecommerce.templateHelp', 'Template Help')}</Button
|
|
335
|
+
>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
<div class="row">
|
|
339
|
+
<div class="col">
|
|
340
|
+
<Textarea
|
|
341
|
+
label={translate('configuration.ecommerce.titleTemplate', 'Title Template')}
|
|
342
|
+
onchange={handleInputChange}
|
|
343
|
+
rows={10}
|
|
344
|
+
bind:value={listingTitleTemplate}
|
|
345
|
+
disabled={false}
|
|
346
|
+
/>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="col">
|
|
349
|
+
<Textarea
|
|
350
|
+
label={translate('configuration.ecommerce.descriptionTemplate', 'Description Template')}
|
|
351
|
+
onchange={handleInputChange}
|
|
352
|
+
rows={10}
|
|
353
|
+
bind:value={listingDescriptionTemplate}
|
|
354
|
+
disabled={false}
|
|
355
|
+
/>
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EbayPolicy, EcommerceCondition, EcommercePartnerConfiguration, EcommerceSharedDefaults } from './utils.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
defaults?: EcommerceSharedDefaults;
|
|
4
|
+
ebayPolicyList?: EbayPolicy[];
|
|
5
|
+
ecommerceConditionList: EcommerceCondition[];
|
|
6
|
+
partnerConfigurationList: EcommercePartnerConfiguration[];
|
|
7
|
+
defaultsChanged: (newDefaults: EcommerceSharedDefaults) => Promise<void>;
|
|
8
|
+
selectedEcommercePartnerId: number;
|
|
9
|
+
}
|
|
10
|
+
declare const EcommerceDefaults: import("svelte").Component<Props, {}, "defaults">;
|
|
11
|
+
type EcommerceDefaults = ReturnType<typeof EcommerceDefaults>;
|
|
12
|
+
export default EcommerceDefaults;
|