merchi_sdk_ts 0.0.1
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/.babelrc +13 -0
- package/.eslintrc.cjs +43 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/jest.config.js +17 -0
- package/package.json +44 -0
- package/src/constants/auto_assign_production_on_actions.ts +6 -0
- package/src/constants/call_to_actions.test.ts +5 -0
- package/src/constants/call_to_actions.ts +14 -0
- package/src/constants/discount_types.test.ts +5 -0
- package/src/constants/discount_types.ts +3 -0
- package/src/constants/domain_types.test.ts +5 -0
- package/src/constants/domain_types.ts +12 -0
- package/src/constants/errors.ts +32 -0
- package/src/constants/event_types.test.ts +5 -0
- package/src/constants/event_types.ts +5 -0
- package/src/constants/field_types.test.ts +5 -0
- package/src/constants/field_types.ts +13 -0
- package/src/constants/input_types.test.ts +5 -0
- package/src/constants/input_types.ts +13 -0
- package/src/constants/inventory_status.test.ts +5 -0
- package/src/constants/inventory_statuses.ts +6 -0
- package/src/constants/invoice_types.test.ts +5 -0
- package/src/constants/invoice_types.ts +5 -0
- package/src/constants/item_types.test.ts +5 -0
- package/src/constants/item_types.ts +5 -0
- package/src/constants/job/drafting_status.test.ts +5 -0
- package/src/constants/job/drafting_status.ts +7 -0
- package/src/constants/job/payment_status.test.ts +5 -0
- package/src/constants/job/payment_status.ts +7 -0
- package/src/constants/job/production_status.test.ts +5 -0
- package/src/constants/job/production_status.ts +12 -0
- package/src/constants/job/shipment_status.test.ts +5 -0
- package/src/constants/job/shipment_status.ts +11 -0
- package/src/constants/job/supply_chain_request_status.test.ts +5 -0
- package/src/constants/job/supply_chain_request_status.ts +6 -0
- package/src/constants/job_priorities.test.ts +5 -0
- package/src/constants/job_priorities.ts +6 -0
- package/src/constants/job_status.test.ts +5 -0
- package/src/constants/job_status.ts +49 -0
- package/src/constants/job_types.test.ts +5 -0
- package/src/constants/job_types.ts +15 -0
- package/src/constants/notification_sections.test.ts +5 -0
- package/src/constants/notification_sections.ts +13 -0
- package/src/constants/notification_types.test.ts +5 -0
- package/src/constants/notification_types.ts +97 -0
- package/src/constants/notification_urgencies.test.ts +5 -0
- package/src/constants/notification_urgencies.ts +7 -0
- package/src/constants/payment_types.test.ts +5 -0
- package/src/constants/payment_types.ts +10 -0
- package/src/constants/platform.test.ts +15 -0
- package/src/constants/platform.ts +6 -0
- package/src/constants/product_types.test.ts +6 -0
- package/src/constants/product_types.ts +25 -0
- package/src/constants/rights.test.ts +5 -0
- package/src/constants/rights.ts +5 -0
- package/src/constants/robots_meta_directives.test.ts +5 -0
- package/src/constants/robots_meta_directives.ts +11 -0
- package/src/constants/roles.test.ts +5 -0
- package/src/constants/roles.ts +38 -0
- package/src/constants/shipment_companies.test.ts +5 -0
- package/src/constants/shipment_companies.ts +18 -0
- package/src/constants/shipment_services.test.ts +5 -0
- package/src/constants/shipment_services.ts +3 -0
- package/src/constants/system_roles.test.ts +5 -0
- package/src/constants/system_roles.ts +3 -0
- package/src/constants/theme_foundations.test.ts +5 -0
- package/src/constants/theme_foundations.ts +6 -0
- package/src/constants/theme_status.test.ts +5 -0
- package/src/constants/theme_status.ts +5 -0
- package/src/constants/user_types.test.ts +5 -0
- package/src/constants/user_types.ts +17 -0
- package/src/constants/white_label_accessibilities.test.ts +5 -0
- package/src/constants/white_label_accessibilities.ts +6 -0
- package/src/cookie.test.ts +11 -0
- package/src/cookie.ts +16 -0
- package/src/entities/address.test.ts +7 -0
- package/src/entities/address.ts +65 -0
- package/src/entities/assignment.test.ts +39 -0
- package/src/entities/assignment.ts +92 -0
- package/src/entities/automatic_payment_relationship.test.ts +8 -0
- package/src/entities/automatic_payment_relationship.ts +26 -0
- package/src/entities/backup.test.ts +7 -0
- package/src/entities/backup.ts +14 -0
- package/src/entities/bank.test.ts +7 -0
- package/src/entities/bank.ts +45 -0
- package/src/entities/cart.test.ts +50 -0
- package/src/entities/cart.ts +89 -0
- package/src/entities/cart_item.test.ts +33 -0
- package/src/entities/cart_item.ts +77 -0
- package/src/entities/cart_shipment_group.ts +21 -0
- package/src/entities/cart_shipment_quote.ts +33 -0
- package/src/entities/category.test.ts +57 -0
- package/src/entities/category.ts +37 -0
- package/src/entities/company.test.ts +7 -0
- package/src/entities/company.ts +275 -0
- package/src/entities/company_invitation.test.ts +7 -0
- package/src/entities/company_invitation.ts +33 -0
- package/src/entities/component.test.ts +14 -0
- package/src/entities/component.ts +92 -0
- package/src/entities/component_tag.test.ts +7 -0
- package/src/entities/component_tag.ts +17 -0
- package/src/entities/component_version.test.ts +7 -0
- package/src/entities/component_version.ts +30 -0
- package/src/entities/country_tax.test.ts +13 -0
- package/src/entities/country_tax.ts +46 -0
- package/src/entities/discount.test.ts +18 -0
- package/src/entities/discount.ts +34 -0
- package/src/entities/discount_group.test.ts +7 -0
- package/src/entities/discount_group.ts +28 -0
- package/src/entities/domain.test.ts +79 -0
- package/src/entities/domain.ts +246 -0
- package/src/entities/domain_invitation.test.ts +7 -0
- package/src/entities/domain_invitation.ts +36 -0
- package/src/entities/domain_tag.test.ts +7 -0
- package/src/entities/domain_tag.ts +42 -0
- package/src/entities/draft.test.ts +43 -0
- package/src/entities/draft.ts +88 -0
- package/src/entities/draft_comment.test.ts +7 -0
- package/src/entities/draft_comment.ts +54 -0
- package/src/entities/draft_template.test.ts +7 -0
- package/src/entities/draft_template.ts +40 -0
- package/src/entities/email_address.test.ts +7 -0
- package/src/entities/email_address.ts +24 -0
- package/src/entities/email_counter.test.ts +7 -0
- package/src/entities/email_counter.ts +20 -0
- package/src/entities/enrolled_domain.test.ts +7 -0
- package/src/entities/enrolled_domain.ts +40 -0
- package/src/entities/exchange_rate.test.ts +7 -0
- package/src/entities/exchange_rate.ts +22 -0
- package/src/entities/file.test.ts +43 -0
- package/src/entities/file.ts +172 -0
- package/src/entities/internal_tag.test.ts +7 -0
- package/src/entities/internal_tag.ts +51 -0
- package/src/entities/inventory.test.ts +28 -0
- package/src/entities/inventory.ts +56 -0
- package/src/entities/inventory_unit_variation.test.ts +7 -0
- package/src/entities/inventory_unit_variation.ts +29 -0
- package/src/entities/invoice.test.ts +43 -0
- package/src/entities/invoice.ts +179 -0
- package/src/entities/item.test.ts +19 -0
- package/src/entities/item.ts +44 -0
- package/src/entities/job.test.ts +95 -0
- package/src/entities/job.ts +349 -0
- package/src/entities/job_comment.test.ts +7 -0
- package/src/entities/job_comment.ts +50 -0
- package/src/entities/matching_inventory.ts +29 -0
- package/src/entities/menu.test.ts +7 -0
- package/src/entities/menu.ts +30 -0
- package/src/entities/menu_item.test.ts +7 -0
- package/src/entities/menu_item.ts +29 -0
- package/src/entities/notification.test.ts +7 -0
- package/src/entities/notification.ts +99 -0
- package/src/entities/page.test.ts +7 -0
- package/src/entities/page.ts +32 -0
- package/src/entities/payment.test.ts +19 -0
- package/src/entities/payment.ts +65 -0
- package/src/entities/payment_device.test.ts +7 -0
- package/src/entities/payment_device.ts +30 -0
- package/src/entities/phone_number.test.ts +7 -0
- package/src/entities/phone_number.ts +36 -0
- package/src/entities/product.test.ts +750 -0
- package/src/entities/product.ts +427 -0
- package/src/entities/production_comment.test.ts +7 -0
- package/src/entities/production_comment.ts +50 -0
- package/src/entities/quote.test.ts +98 -0
- package/src/entities/quote.ts +140 -0
- package/src/entities/quote_item.test.ts +50 -0
- package/src/entities/quote_item.ts +71 -0
- package/src/entities/seo_domain_page.test.ts +7 -0
- package/src/entities/seo_domain_page.ts +33 -0
- package/src/entities/session.test.ts +7 -0
- package/src/entities/session.ts +28 -0
- package/src/entities/shipment.test.ts +24 -0
- package/src/entities/shipment.ts +185 -0
- package/src/entities/shipment_item.test.ts +7 -0
- package/src/entities/shipment_item.ts +15 -0
- package/src/entities/shipment_item_fulfillment.test.ts +8 -0
- package/src/entities/shipment_item_fulfillment.ts +15 -0
- package/src/entities/shipment_method.test.ts +7 -0
- package/src/entities/shipment_method.ts +61 -0
- package/src/entities/shipment_method_variation.test.ts +7 -0
- package/src/entities/shipment_method_variation.ts +39 -0
- package/src/entities/short_url.test.ts +7 -0
- package/src/entities/short_url.ts +36 -0
- package/src/entities/subscription_plan.test.ts +7 -0
- package/src/entities/subscription_plan.ts +73 -0
- package/src/entities/supply_domain.test.ts +7 -0
- package/src/entities/supply_domain.ts +27 -0
- package/src/entities/system_role.test.ts +7 -0
- package/src/entities/system_role.ts +17 -0
- package/src/entities/theme.test.ts +38 -0
- package/src/entities/theme.ts +267 -0
- package/src/entities/theme_css_setting.test.ts +7 -0
- package/src/entities/theme_css_setting.ts +23 -0
- package/src/entities/user.test.ts +154 -0
- package/src/entities/user.ts +394 -0
- package/src/entities/user_company.test.ts +7 -0
- package/src/entities/user_company.ts +27 -0
- package/src/entities/variation.test.ts +7 -0
- package/src/entities/variation.ts +61 -0
- package/src/entities/variation_field.test.ts +76 -0
- package/src/entities/variation_field.ts +169 -0
- package/src/entities/variation_fields_option.test.ts +46 -0
- package/src/entities/variation_fields_option.ts +95 -0
- package/src/entities/variation_option.test.ts +7 -0
- package/src/entities/variation_option.ts +52 -0
- package/src/entities/variations_group.test.ts +7 -0
- package/src/entities/variations_group.ts +41 -0
- package/src/entity.ts +1002 -0
- package/src/merchi.test.ts +25 -0
- package/src/merchi.ts +379 -0
- package/src/request.test.ts +43 -0
- package/src/request.ts +124 -0
- package/src/test_util.ts +18 -0
- package/src/toasts.test.ts +38 -0
- package/src/toasts.ts +34 -0
- package/src/util/float.ts +12 -0
- package/src/util/query_string.test.ts +7 -0
- package/src/util/query_string.ts +11 -0
- package/src/util/validation.test.ts +16 -0
- package/src/util/validation.ts +2 -0
- package/src/uuid.test.ts +15 -0
- package/src/uuid.ts +8 -0
- package/tsconfig.json +23 -0
- package/webpack.config.cjs +27 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { Address } from './address';
|
|
2
|
+
import { Assignment } from './assignment';
|
|
3
|
+
import { Company } from './company';
|
|
4
|
+
import { CountryTax } from './country_tax';
|
|
5
|
+
import { Domain } from './domain';
|
|
6
|
+
import { DomainTag } from './domain_tag';
|
|
7
|
+
import { Draft } from './draft';
|
|
8
|
+
import { DraftComment } from './draft_comment';
|
|
9
|
+
import { EmailAddress } from './email_address';
|
|
10
|
+
import { Entity } from '../entity';
|
|
11
|
+
import { MerchiFile } from './file';
|
|
12
|
+
import { MatchingInventory } from './matching_inventory';
|
|
13
|
+
import { InternalTag } from './internal_tag';
|
|
14
|
+
import { Invoice } from './invoice';
|
|
15
|
+
import { JobComment } from './job_comment';
|
|
16
|
+
import { Notification } from './notification';
|
|
17
|
+
import { PhoneNumber } from './phone_number';
|
|
18
|
+
import { Product } from './product';
|
|
19
|
+
import { RequestOptions } from '../request';
|
|
20
|
+
import { Shipment } from './shipment';
|
|
21
|
+
import { User } from './user';
|
|
22
|
+
import { Variation } from './variation';
|
|
23
|
+
import { VariationsGroup } from './variations_group';
|
|
24
|
+
import { InventoryStatus } from '../constants/inventory_statuses';
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export class Job extends Entity {
|
|
28
|
+
protected static resourceName = 'jobs';
|
|
29
|
+
protected static singularName = 'job';
|
|
30
|
+
protected static pluralName = 'jobs';
|
|
31
|
+
|
|
32
|
+
@Job.property({type: Date})
|
|
33
|
+
public archived?: Date | null;
|
|
34
|
+
|
|
35
|
+
@Job.property()
|
|
36
|
+
public id?: number;
|
|
37
|
+
|
|
38
|
+
@Job.property()
|
|
39
|
+
public jobType?: number;
|
|
40
|
+
|
|
41
|
+
@Job.property()
|
|
42
|
+
public quantity?: number;
|
|
43
|
+
|
|
44
|
+
@Job.property()
|
|
45
|
+
public currency?: string;
|
|
46
|
+
|
|
47
|
+
@Job.property({type: String})
|
|
48
|
+
public notes?: string | null;
|
|
49
|
+
|
|
50
|
+
@Job.property({type: String})
|
|
51
|
+
public productionNotes?: string | null;
|
|
52
|
+
|
|
53
|
+
@Job.property({type: String})
|
|
54
|
+
public shopifyShopUrl?: string | null;
|
|
55
|
+
|
|
56
|
+
@Job.property()
|
|
57
|
+
public shopifyOrderId?: string;
|
|
58
|
+
|
|
59
|
+
@Job.property()
|
|
60
|
+
public shopifyOrderLineItemId?: string;
|
|
61
|
+
|
|
62
|
+
@Job.property({type: Number})
|
|
63
|
+
public productionStatus?: number | null;
|
|
64
|
+
|
|
65
|
+
@Job.property({type: Number})
|
|
66
|
+
public designStatus?: number | null;
|
|
67
|
+
|
|
68
|
+
@Job.property({type: Number})
|
|
69
|
+
public supplyChainRequestStatus?: number | null;
|
|
70
|
+
|
|
71
|
+
@Job.property()
|
|
72
|
+
public needsDrafting?: boolean;
|
|
73
|
+
|
|
74
|
+
@Job.property()
|
|
75
|
+
public needsGroupBuy?: boolean;
|
|
76
|
+
|
|
77
|
+
@Job.property()
|
|
78
|
+
public needsProduction?: boolean;
|
|
79
|
+
|
|
80
|
+
@Job.property()
|
|
81
|
+
public needsShipping?: boolean;
|
|
82
|
+
|
|
83
|
+
@Job.property()
|
|
84
|
+
public needsInvoicing?: boolean;
|
|
85
|
+
|
|
86
|
+
@Job.property()
|
|
87
|
+
public needsInventory?: boolean;
|
|
88
|
+
|
|
89
|
+
@Job.property()
|
|
90
|
+
public needsSupplyChainRequest?: boolean;
|
|
91
|
+
|
|
92
|
+
@Job.property()
|
|
93
|
+
public showProductionFilesToClient?: boolean;
|
|
94
|
+
|
|
95
|
+
@Job.property()
|
|
96
|
+
public allowClientDraftContribution?: boolean;
|
|
97
|
+
|
|
98
|
+
@Job.property()
|
|
99
|
+
public quoteSet?: boolean;
|
|
100
|
+
|
|
101
|
+
@Job.property()
|
|
102
|
+
public jobInfoApprovedByClient?: boolean;
|
|
103
|
+
|
|
104
|
+
@Job.property({type: Number})
|
|
105
|
+
public groupBuyStatus?: number | null;
|
|
106
|
+
|
|
107
|
+
@Job.property({type: Number})
|
|
108
|
+
public paymentStatus?: number | null;
|
|
109
|
+
|
|
110
|
+
@Job.property({type: Date})
|
|
111
|
+
public deductionDate?: Date | null;
|
|
112
|
+
|
|
113
|
+
@Job.property({type: Number})
|
|
114
|
+
public shippingStatus?: number | null;
|
|
115
|
+
|
|
116
|
+
@Job.property()
|
|
117
|
+
public completed?: boolean;
|
|
118
|
+
|
|
119
|
+
@Job.property()
|
|
120
|
+
public callToActions?: string;
|
|
121
|
+
|
|
122
|
+
@Job.property()
|
|
123
|
+
public callToActionDetails?: any[];
|
|
124
|
+
|
|
125
|
+
@Job.property()
|
|
126
|
+
public priority?: number;
|
|
127
|
+
|
|
128
|
+
@Job.property({type: Number})
|
|
129
|
+
public jobWeight?: number | null;
|
|
130
|
+
|
|
131
|
+
@Job.property({type: Number})
|
|
132
|
+
public jobVolume?: number | null;
|
|
133
|
+
|
|
134
|
+
@Job.property()
|
|
135
|
+
public received?: Date;
|
|
136
|
+
|
|
137
|
+
@Job.property()
|
|
138
|
+
public deadline?: Date;
|
|
139
|
+
|
|
140
|
+
@Job.property()
|
|
141
|
+
public updated?: Date;
|
|
142
|
+
|
|
143
|
+
@Job.property()
|
|
144
|
+
public groupBuyProductionStarted?: Date;
|
|
145
|
+
|
|
146
|
+
@Job.property()
|
|
147
|
+
public automaticPriceEnabled?: boolean;
|
|
148
|
+
|
|
149
|
+
@Job.property()
|
|
150
|
+
public dropShip?: boolean;
|
|
151
|
+
|
|
152
|
+
@Job.property()
|
|
153
|
+
public pickUp?: boolean;
|
|
154
|
+
|
|
155
|
+
@Job.property({type: Number})
|
|
156
|
+
public costPerUnit?: number | null;
|
|
157
|
+
|
|
158
|
+
@Job.property({type: Number})
|
|
159
|
+
public cost?: number | null;
|
|
160
|
+
|
|
161
|
+
@Job.property({type: Number})
|
|
162
|
+
public taxAmount?: number | null;
|
|
163
|
+
|
|
164
|
+
@Job.property({type: Number})
|
|
165
|
+
public totalCost?: number | null;
|
|
166
|
+
|
|
167
|
+
@Job.property({embeddedByDefault: false})
|
|
168
|
+
public inventoriesStatus?: InventoryStatus;
|
|
169
|
+
|
|
170
|
+
@Job.property({embeddedByDefault: false})
|
|
171
|
+
public unreadNotificationsCount?: number;
|
|
172
|
+
|
|
173
|
+
@Job.property({embeddedByDefault: false})
|
|
174
|
+
public unreadJobInfoNotificationsCount?: number;
|
|
175
|
+
|
|
176
|
+
@Job.property({embeddedByDefault: false})
|
|
177
|
+
public unreadJobDraftingNotificationsCount?: number;
|
|
178
|
+
|
|
179
|
+
@Job.property({embeddedByDefault: false})
|
|
180
|
+
public unreadJobProductionNotificationsCount?: number;
|
|
181
|
+
|
|
182
|
+
@Job.property({embeddedByDefault: false})
|
|
183
|
+
public unreadJobShippingNotificationsCount?: number;
|
|
184
|
+
|
|
185
|
+
@Job.property({embeddedByDefault: false})
|
|
186
|
+
public unreadJobInvoicingNotificationsCount?: number;
|
|
187
|
+
|
|
188
|
+
@Job.property({embeddedByDefault: false})
|
|
189
|
+
public limitedStock?: boolean;
|
|
190
|
+
|
|
191
|
+
@Job.property({embeddedByDefault: false})
|
|
192
|
+
public inventoryCount?: number;
|
|
193
|
+
|
|
194
|
+
@Job.property({embeddedByDefault: false})
|
|
195
|
+
public inventorySufficient?: boolean;
|
|
196
|
+
|
|
197
|
+
@Job.property({arrayType: 'Draft'})
|
|
198
|
+
public drafts?: Draft[];
|
|
199
|
+
|
|
200
|
+
@Job.property({arrayType: 'Draft'})
|
|
201
|
+
public sharedDrafts?: Draft[];
|
|
202
|
+
|
|
203
|
+
@Job.property({arrayType: 'Draft'})
|
|
204
|
+
public ownDrafts?: Draft[];
|
|
205
|
+
|
|
206
|
+
@Job.property({arrayType: 'JobComment'})
|
|
207
|
+
public comments?: JobComment[];
|
|
208
|
+
|
|
209
|
+
@Job.property()
|
|
210
|
+
public client?: User;
|
|
211
|
+
|
|
212
|
+
@Job.property({type: User})
|
|
213
|
+
public manager?: User | null;
|
|
214
|
+
|
|
215
|
+
@Job.property({type: User})
|
|
216
|
+
public designer?: User | null;
|
|
217
|
+
|
|
218
|
+
@Job.property({type: Company})
|
|
219
|
+
public clientCompany?: Company | null;
|
|
220
|
+
|
|
221
|
+
@Job.property({type: PhoneNumber})
|
|
222
|
+
public clientPhone?: PhoneNumber | null;
|
|
223
|
+
|
|
224
|
+
@Job.property({type: EmailAddress})
|
|
225
|
+
public clientEmail?: EmailAddress | null;
|
|
226
|
+
|
|
227
|
+
@Job.property({type: PhoneNumber})
|
|
228
|
+
public clientCompanyPhone?: PhoneNumber | null;
|
|
229
|
+
|
|
230
|
+
@Job.property({type: EmailAddress})
|
|
231
|
+
public clientCompanyEmail?: EmailAddress | null;
|
|
232
|
+
|
|
233
|
+
@Job.property()
|
|
234
|
+
public product?: Product;
|
|
235
|
+
|
|
236
|
+
@Job.property()
|
|
237
|
+
public supplyChainRequestProduct?: Product;
|
|
238
|
+
|
|
239
|
+
@Job.property({arrayType: 'DraftComment'})
|
|
240
|
+
public draftComments?: DraftComment[];
|
|
241
|
+
|
|
242
|
+
@Job.property()
|
|
243
|
+
public preDraftCommentsCount?: number;
|
|
244
|
+
|
|
245
|
+
@Job.property({type: CountryTax})
|
|
246
|
+
public taxType?: CountryTax | null;
|
|
247
|
+
|
|
248
|
+
@Job.property({arrayType: 'InternalTag'})
|
|
249
|
+
public internalTags?: InternalTag[];
|
|
250
|
+
|
|
251
|
+
@Job.property({arrayType: 'DomainTag'})
|
|
252
|
+
public tags?: DomainTag[];
|
|
253
|
+
|
|
254
|
+
@Job.property({arrayType: 'Product'})
|
|
255
|
+
public createdProducts?: Product[];
|
|
256
|
+
|
|
257
|
+
@Job.property({type: Address})
|
|
258
|
+
public shipping?: Address | null;
|
|
259
|
+
|
|
260
|
+
@Job.property({type: Address})
|
|
261
|
+
public productionShippingAddress?: Address | null;
|
|
262
|
+
|
|
263
|
+
@Job.property()
|
|
264
|
+
public domain?: Domain;
|
|
265
|
+
|
|
266
|
+
@Job.property({type: Invoice})
|
|
267
|
+
public invoice?: Invoice | null;
|
|
268
|
+
|
|
269
|
+
@Job.property({arrayType: 'MerchiFile'})
|
|
270
|
+
public productionFiles?: MerchiFile[];
|
|
271
|
+
|
|
272
|
+
@Job.property({arrayType: 'MerchiFile'})
|
|
273
|
+
public clientFiles?: MerchiFile[];
|
|
274
|
+
|
|
275
|
+
@Job.property({type: Shipment})
|
|
276
|
+
public shipment?: Shipment | null;
|
|
277
|
+
|
|
278
|
+
@Job.property({arrayType: 'MatchingInventory'})
|
|
279
|
+
public matchingInventories?: MatchingInventory[];
|
|
280
|
+
|
|
281
|
+
@Job.property({arrayType: 'VariationsGroup'})
|
|
282
|
+
public variationsGroups?: VariationsGroup[];
|
|
283
|
+
|
|
284
|
+
@Job.property({arrayType: 'Variation'})
|
|
285
|
+
public variations?: Variation[];
|
|
286
|
+
|
|
287
|
+
@Job.property({arrayType: 'Notification'})
|
|
288
|
+
public notifications?: Notification[];
|
|
289
|
+
|
|
290
|
+
@Job.property({arrayType: 'Assignment'})
|
|
291
|
+
public assignments?: Assignment[];
|
|
292
|
+
|
|
293
|
+
@Job.property()
|
|
294
|
+
public supplyAssignment?: Assignment;
|
|
295
|
+
|
|
296
|
+
@Job.property()
|
|
297
|
+
public supplyJob?: Job;
|
|
298
|
+
|
|
299
|
+
@Job.property()
|
|
300
|
+
public hasValidVolume?: boolean;
|
|
301
|
+
|
|
302
|
+
@Job.property()
|
|
303
|
+
public hasValidWeight?: boolean;
|
|
304
|
+
|
|
305
|
+
public getQuote = () => {
|
|
306
|
+
const resource = '/specialised-order-estimate/';
|
|
307
|
+
const data = this.toFormData({excludeOld: false});
|
|
308
|
+
const fetchOptions: RequestOptions = {method: 'POST', body: data};
|
|
309
|
+
fetchOptions.query = [];
|
|
310
|
+
fetchOptions.query.push(['skip_rights', 'y']);
|
|
311
|
+
// insert product id to query for debug purposes
|
|
312
|
+
fetchOptions.query.push([
|
|
313
|
+
'product_id',
|
|
314
|
+
this.product!.id ? this.product!.id!.toString() : 'null'
|
|
315
|
+
]);
|
|
316
|
+
|
|
317
|
+
return this.merchi.authenticatedFetch(resource, fetchOptions).
|
|
318
|
+
then((data: any) => { this.fromJson(data, {makeDirty: true});
|
|
319
|
+
return this;});
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
public deduct = (matchingInventories: MatchingInventory[]) => {
|
|
323
|
+
const resource = `/jobs/${this.id}/deduct/`;
|
|
324
|
+
const inventoriesNeedToBeDeducted = matchingInventories.map(
|
|
325
|
+
matchingInventory => matchingInventory.inventory!.id);
|
|
326
|
+
const embed = {matchingInventories: {inventory: {}, group: {}}};
|
|
327
|
+
const data = new FormData();
|
|
328
|
+
data.append('inventories', JSON.stringify(inventoriesNeedToBeDeducted));
|
|
329
|
+
const fetchOptions: RequestOptions = {
|
|
330
|
+
method: 'POST',
|
|
331
|
+
body: data,
|
|
332
|
+
query: [['embed', JSON.stringify(embed)]]
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
return this.merchi.authenticatedFetch(resource, fetchOptions).
|
|
336
|
+
then((data: any) => {
|
|
337
|
+
this.fromJson(data);
|
|
338
|
+
return this;});
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
public bulkDeduct = () => {
|
|
342
|
+
if (this.matchingInventories === undefined) {
|
|
343
|
+
const err = 'matchingInventories is undefined, did you forget to embed' +
|
|
344
|
+
' it?';
|
|
345
|
+
throw new Error(err);
|
|
346
|
+
}
|
|
347
|
+
return this.deduct(this.matchingInventories);
|
|
348
|
+
};
|
|
349
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { MerchiFile } from './file';
|
|
3
|
+
import { Job } from './job';
|
|
4
|
+
import { Notification } from './notification';
|
|
5
|
+
import { User } from './user';
|
|
6
|
+
|
|
7
|
+
export class JobComment extends Entity {
|
|
8
|
+
protected static resourceName = 'job_comments';
|
|
9
|
+
protected static singularName = 'jobComment';
|
|
10
|
+
protected static pluralName = 'jobComments';
|
|
11
|
+
|
|
12
|
+
@JobComment.property({type: Date})
|
|
13
|
+
public archived?: Date | null;
|
|
14
|
+
|
|
15
|
+
@JobComment.property()
|
|
16
|
+
public id?: number;
|
|
17
|
+
|
|
18
|
+
@JobComment.property({type: Date})
|
|
19
|
+
public date?: Date | null;
|
|
20
|
+
|
|
21
|
+
@JobComment.property()
|
|
22
|
+
public text?: string;
|
|
23
|
+
|
|
24
|
+
@JobComment.property()
|
|
25
|
+
public sendSms?: boolean;
|
|
26
|
+
|
|
27
|
+
@JobComment.property()
|
|
28
|
+
public sendEmail?: boolean;
|
|
29
|
+
|
|
30
|
+
@JobComment.property()
|
|
31
|
+
public openToClient?: boolean;
|
|
32
|
+
|
|
33
|
+
@JobComment.property()
|
|
34
|
+
public urgency?: number;
|
|
35
|
+
|
|
36
|
+
@JobComment.property({arrayType: "MerchiFile"})
|
|
37
|
+
public files?: MerchiFile[];
|
|
38
|
+
|
|
39
|
+
@JobComment.property({arrayType: 'User'})
|
|
40
|
+
public forwards?: User[];
|
|
41
|
+
|
|
42
|
+
@JobComment.property({arrayType: 'Notification'})
|
|
43
|
+
public notifications?: Notification[];
|
|
44
|
+
|
|
45
|
+
@JobComment.property()
|
|
46
|
+
public job?: Job;
|
|
47
|
+
|
|
48
|
+
@JobComment.property()
|
|
49
|
+
public user?: User;
|
|
50
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Job } from './job';
|
|
3
|
+
import { Inventory } from './inventory';
|
|
4
|
+
import { VariationsGroup } from './variations_group';
|
|
5
|
+
import { InventoryStatus } from '../constants/inventory_statuses';
|
|
6
|
+
|
|
7
|
+
export class MatchingInventory extends Entity {
|
|
8
|
+
protected static resourceName = 'matching_inventories';
|
|
9
|
+
protected static singularName = 'matchingInventory';
|
|
10
|
+
protected static pluralName = 'matchingInventories';
|
|
11
|
+
|
|
12
|
+
@MatchingInventory.property({type: Date})
|
|
13
|
+
public archived?: Date | null;
|
|
14
|
+
|
|
15
|
+
@MatchingInventory.property({type: Date})
|
|
16
|
+
public deductionDate?: Date | null;
|
|
17
|
+
|
|
18
|
+
@MatchingInventory.property()
|
|
19
|
+
public job?: Job;
|
|
20
|
+
|
|
21
|
+
@MatchingInventory.property({type: 'VariationsGroup'})
|
|
22
|
+
public group?: VariationsGroup | null;
|
|
23
|
+
|
|
24
|
+
@MatchingInventory.property({type: Inventory})
|
|
25
|
+
public inventory?: Inventory | null;
|
|
26
|
+
|
|
27
|
+
@MatchingInventory.property()
|
|
28
|
+
public status?: InventoryStatus;
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Theme } from './theme';
|
|
3
|
+
import { MenuItem } from './menu_item';
|
|
4
|
+
|
|
5
|
+
export class Menu extends Entity {
|
|
6
|
+
protected static resourceName = 'menus';
|
|
7
|
+
protected static singularName = 'menu';
|
|
8
|
+
protected static pluralName = 'menus';
|
|
9
|
+
|
|
10
|
+
@Menu.property({type: Date})
|
|
11
|
+
public archived?: Date | null;
|
|
12
|
+
|
|
13
|
+
@Menu.property()
|
|
14
|
+
public id?: number;
|
|
15
|
+
|
|
16
|
+
@Menu.property()
|
|
17
|
+
public name?: string;
|
|
18
|
+
|
|
19
|
+
@Menu.property()
|
|
20
|
+
public menuHandle?: string;
|
|
21
|
+
|
|
22
|
+
@Menu.property()
|
|
23
|
+
public menuType?: number;
|
|
24
|
+
|
|
25
|
+
@Menu.property()
|
|
26
|
+
public theme?: Theme;
|
|
27
|
+
|
|
28
|
+
@Menu.property({arrayType: 'MenuItem'})
|
|
29
|
+
public menuItems?: MenuItem[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Menu } from './menu';
|
|
3
|
+
|
|
4
|
+
export class MenuItem extends Entity {
|
|
5
|
+
protected static resourceName = 'menu_items';
|
|
6
|
+
protected static singularName = 'menuItem';
|
|
7
|
+
protected static pluralName = 'menuItems';
|
|
8
|
+
|
|
9
|
+
@MenuItem.property({type: Date})
|
|
10
|
+
public archived?: Date | null;
|
|
11
|
+
|
|
12
|
+
@MenuItem.property()
|
|
13
|
+
public id?: number;
|
|
14
|
+
|
|
15
|
+
@MenuItem.property()
|
|
16
|
+
public name?: string;
|
|
17
|
+
|
|
18
|
+
@MenuItem.property()
|
|
19
|
+
public linkType?: number;
|
|
20
|
+
|
|
21
|
+
@MenuItem.property()
|
|
22
|
+
public linkUri?: string;
|
|
23
|
+
|
|
24
|
+
@MenuItem.property()
|
|
25
|
+
public position?: number;
|
|
26
|
+
|
|
27
|
+
@MenuItem.property()
|
|
28
|
+
public menu?: Menu;
|
|
29
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Assignment } from './assignment';
|
|
2
|
+
import { Domain } from './domain';
|
|
3
|
+
import { Draft } from './draft';
|
|
4
|
+
import { DraftComment } from './draft_comment';
|
|
5
|
+
import { Entity } from '../entity';
|
|
6
|
+
import { MerchiFile } from './file';
|
|
7
|
+
import { Invoice } from './invoice';
|
|
8
|
+
import { Job } from './job';
|
|
9
|
+
import { JobComment } from './job_comment';
|
|
10
|
+
import { ProductionComment } from './production_comment';
|
|
11
|
+
import { ShortUrl } from './short_url';
|
|
12
|
+
import { User } from './user';
|
|
13
|
+
|
|
14
|
+
export class Notification extends Entity {
|
|
15
|
+
protected static resourceName = 'notifications';
|
|
16
|
+
protected static singularName = 'notification';
|
|
17
|
+
protected static pluralName = 'notifications';
|
|
18
|
+
|
|
19
|
+
@Notification.property({type: Date})
|
|
20
|
+
public archived?: Date | null;
|
|
21
|
+
|
|
22
|
+
@Notification.property()
|
|
23
|
+
public id?: number;
|
|
24
|
+
|
|
25
|
+
@Notification.property()
|
|
26
|
+
public notificationType?: number;
|
|
27
|
+
|
|
28
|
+
@Notification.property()
|
|
29
|
+
public date?: Date;
|
|
30
|
+
|
|
31
|
+
@Notification.property()
|
|
32
|
+
public seen?: boolean;
|
|
33
|
+
|
|
34
|
+
@Notification.property()
|
|
35
|
+
public sendEmail?: boolean;
|
|
36
|
+
|
|
37
|
+
@Notification.property()
|
|
38
|
+
public sendSms?: boolean;
|
|
39
|
+
|
|
40
|
+
@Notification.property()
|
|
41
|
+
public urgency?: number;
|
|
42
|
+
|
|
43
|
+
@Notification.property({type: String})
|
|
44
|
+
public description?: string | null;
|
|
45
|
+
|
|
46
|
+
@Notification.property({type: String})
|
|
47
|
+
public subject?: string | null;
|
|
48
|
+
|
|
49
|
+
@Notification.property()
|
|
50
|
+
public message?: string;
|
|
51
|
+
|
|
52
|
+
@Notification.property()
|
|
53
|
+
public htmlMessage?: string;
|
|
54
|
+
|
|
55
|
+
@Notification.property({type: String})
|
|
56
|
+
public link?: string | null;
|
|
57
|
+
|
|
58
|
+
@Notification.property()
|
|
59
|
+
public section?: number;
|
|
60
|
+
|
|
61
|
+
@Notification.property({type: ShortUrl})
|
|
62
|
+
public shortUrl?: ShortUrl | null;
|
|
63
|
+
|
|
64
|
+
@Notification.property()
|
|
65
|
+
public recipient?: User;
|
|
66
|
+
|
|
67
|
+
@Notification.property({type: User})
|
|
68
|
+
public sender?: User | null;
|
|
69
|
+
|
|
70
|
+
@Notification.property({type: Job})
|
|
71
|
+
public relatedJob?: Job | null;
|
|
72
|
+
|
|
73
|
+
@Notification.property({type: Draft})
|
|
74
|
+
public relatedDraft?: Draft | null;
|
|
75
|
+
|
|
76
|
+
@Notification.property({type: Assignment})
|
|
77
|
+
public relatedAssignment?: Assignment | null;
|
|
78
|
+
|
|
79
|
+
@Notification.property({type: Invoice})
|
|
80
|
+
public relatedInvoice?: Invoice | null;
|
|
81
|
+
|
|
82
|
+
@Notification.property({type: JobComment})
|
|
83
|
+
public relatedJobComment?: JobComment | null;
|
|
84
|
+
|
|
85
|
+
@Notification.property({type: DraftComment})
|
|
86
|
+
public relatedDraftComment?: DraftComment | null;
|
|
87
|
+
|
|
88
|
+
@Notification.property({type: ProductionComment})
|
|
89
|
+
public relatedProductionComment?: ProductionComment | null;
|
|
90
|
+
|
|
91
|
+
@Notification.property()
|
|
92
|
+
public domain?: Domain;
|
|
93
|
+
|
|
94
|
+
@Notification.property({type: MerchiFile})
|
|
95
|
+
public avatar?: MerchiFile | null;
|
|
96
|
+
|
|
97
|
+
@Notification.property({type: MerchiFile})
|
|
98
|
+
public attachment?: MerchiFile | null;
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Entity } from '../entity';
|
|
2
|
+
import { Theme } from './theme';
|
|
3
|
+
|
|
4
|
+
export class Page extends Entity {
|
|
5
|
+
protected static resourceName = 'pages';
|
|
6
|
+
protected static singularName = 'page';
|
|
7
|
+
protected static pluralName = 'themes';
|
|
8
|
+
|
|
9
|
+
@Page.property()
|
|
10
|
+
public id?: number;
|
|
11
|
+
|
|
12
|
+
@Page.property()
|
|
13
|
+
public name?: string;
|
|
14
|
+
|
|
15
|
+
@Page.property()
|
|
16
|
+
public slug?: string;
|
|
17
|
+
|
|
18
|
+
@Page.property()
|
|
19
|
+
public template?: string;
|
|
20
|
+
|
|
21
|
+
@Page.property()
|
|
22
|
+
public js?: string;
|
|
23
|
+
|
|
24
|
+
@Page.property()
|
|
25
|
+
public html?: string;
|
|
26
|
+
|
|
27
|
+
@Page.property({type: String})
|
|
28
|
+
public error?: string | null;
|
|
29
|
+
|
|
30
|
+
@Page.property({type: 'Theme'})
|
|
31
|
+
public theme?: Theme;
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { setup, mockFetch } from '../test_util';
|
|
2
|
+
import { Merchi } from '../merchi';
|
|
3
|
+
|
|
4
|
+
setup();
|
|
5
|
+
|
|
6
|
+
test('can make Payment', () => {
|
|
7
|
+
const merchi = new Merchi();
|
|
8
|
+
const payment = new merchi.Payment();
|
|
9
|
+
expect(payment).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('payment refund', () => {
|
|
13
|
+
const merchi = new Merchi();
|
|
14
|
+
const payment = new merchi.Payment();
|
|
15
|
+
mockFetch(true, { 'amount': 10 }, 200);
|
|
16
|
+
payment.refund().then(payment => {
|
|
17
|
+
expect(payment.amount).toEqual(10);
|
|
18
|
+
});
|
|
19
|
+
});
|