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.
Files changed (226) hide show
  1. package/.babelrc +13 -0
  2. package/.eslintrc.cjs +43 -0
  3. package/LICENSE +21 -0
  4. package/README.md +2 -0
  5. package/jest.config.js +17 -0
  6. package/package.json +44 -0
  7. package/src/constants/auto_assign_production_on_actions.ts +6 -0
  8. package/src/constants/call_to_actions.test.ts +5 -0
  9. package/src/constants/call_to_actions.ts +14 -0
  10. package/src/constants/discount_types.test.ts +5 -0
  11. package/src/constants/discount_types.ts +3 -0
  12. package/src/constants/domain_types.test.ts +5 -0
  13. package/src/constants/domain_types.ts +12 -0
  14. package/src/constants/errors.ts +32 -0
  15. package/src/constants/event_types.test.ts +5 -0
  16. package/src/constants/event_types.ts +5 -0
  17. package/src/constants/field_types.test.ts +5 -0
  18. package/src/constants/field_types.ts +13 -0
  19. package/src/constants/input_types.test.ts +5 -0
  20. package/src/constants/input_types.ts +13 -0
  21. package/src/constants/inventory_status.test.ts +5 -0
  22. package/src/constants/inventory_statuses.ts +6 -0
  23. package/src/constants/invoice_types.test.ts +5 -0
  24. package/src/constants/invoice_types.ts +5 -0
  25. package/src/constants/item_types.test.ts +5 -0
  26. package/src/constants/item_types.ts +5 -0
  27. package/src/constants/job/drafting_status.test.ts +5 -0
  28. package/src/constants/job/drafting_status.ts +7 -0
  29. package/src/constants/job/payment_status.test.ts +5 -0
  30. package/src/constants/job/payment_status.ts +7 -0
  31. package/src/constants/job/production_status.test.ts +5 -0
  32. package/src/constants/job/production_status.ts +12 -0
  33. package/src/constants/job/shipment_status.test.ts +5 -0
  34. package/src/constants/job/shipment_status.ts +11 -0
  35. package/src/constants/job/supply_chain_request_status.test.ts +5 -0
  36. package/src/constants/job/supply_chain_request_status.ts +6 -0
  37. package/src/constants/job_priorities.test.ts +5 -0
  38. package/src/constants/job_priorities.ts +6 -0
  39. package/src/constants/job_status.test.ts +5 -0
  40. package/src/constants/job_status.ts +49 -0
  41. package/src/constants/job_types.test.ts +5 -0
  42. package/src/constants/job_types.ts +15 -0
  43. package/src/constants/notification_sections.test.ts +5 -0
  44. package/src/constants/notification_sections.ts +13 -0
  45. package/src/constants/notification_types.test.ts +5 -0
  46. package/src/constants/notification_types.ts +97 -0
  47. package/src/constants/notification_urgencies.test.ts +5 -0
  48. package/src/constants/notification_urgencies.ts +7 -0
  49. package/src/constants/payment_types.test.ts +5 -0
  50. package/src/constants/payment_types.ts +10 -0
  51. package/src/constants/platform.test.ts +15 -0
  52. package/src/constants/platform.ts +6 -0
  53. package/src/constants/product_types.test.ts +6 -0
  54. package/src/constants/product_types.ts +25 -0
  55. package/src/constants/rights.test.ts +5 -0
  56. package/src/constants/rights.ts +5 -0
  57. package/src/constants/robots_meta_directives.test.ts +5 -0
  58. package/src/constants/robots_meta_directives.ts +11 -0
  59. package/src/constants/roles.test.ts +5 -0
  60. package/src/constants/roles.ts +38 -0
  61. package/src/constants/shipment_companies.test.ts +5 -0
  62. package/src/constants/shipment_companies.ts +18 -0
  63. package/src/constants/shipment_services.test.ts +5 -0
  64. package/src/constants/shipment_services.ts +3 -0
  65. package/src/constants/system_roles.test.ts +5 -0
  66. package/src/constants/system_roles.ts +3 -0
  67. package/src/constants/theme_foundations.test.ts +5 -0
  68. package/src/constants/theme_foundations.ts +6 -0
  69. package/src/constants/theme_status.test.ts +5 -0
  70. package/src/constants/theme_status.ts +5 -0
  71. package/src/constants/user_types.test.ts +5 -0
  72. package/src/constants/user_types.ts +17 -0
  73. package/src/constants/white_label_accessibilities.test.ts +5 -0
  74. package/src/constants/white_label_accessibilities.ts +6 -0
  75. package/src/cookie.test.ts +11 -0
  76. package/src/cookie.ts +16 -0
  77. package/src/entities/address.test.ts +7 -0
  78. package/src/entities/address.ts +65 -0
  79. package/src/entities/assignment.test.ts +39 -0
  80. package/src/entities/assignment.ts +92 -0
  81. package/src/entities/automatic_payment_relationship.test.ts +8 -0
  82. package/src/entities/automatic_payment_relationship.ts +26 -0
  83. package/src/entities/backup.test.ts +7 -0
  84. package/src/entities/backup.ts +14 -0
  85. package/src/entities/bank.test.ts +7 -0
  86. package/src/entities/bank.ts +45 -0
  87. package/src/entities/cart.test.ts +50 -0
  88. package/src/entities/cart.ts +89 -0
  89. package/src/entities/cart_item.test.ts +33 -0
  90. package/src/entities/cart_item.ts +77 -0
  91. package/src/entities/cart_shipment_group.ts +21 -0
  92. package/src/entities/cart_shipment_quote.ts +33 -0
  93. package/src/entities/category.test.ts +57 -0
  94. package/src/entities/category.ts +37 -0
  95. package/src/entities/company.test.ts +7 -0
  96. package/src/entities/company.ts +275 -0
  97. package/src/entities/company_invitation.test.ts +7 -0
  98. package/src/entities/company_invitation.ts +33 -0
  99. package/src/entities/component.test.ts +14 -0
  100. package/src/entities/component.ts +92 -0
  101. package/src/entities/component_tag.test.ts +7 -0
  102. package/src/entities/component_tag.ts +17 -0
  103. package/src/entities/component_version.test.ts +7 -0
  104. package/src/entities/component_version.ts +30 -0
  105. package/src/entities/country_tax.test.ts +13 -0
  106. package/src/entities/country_tax.ts +46 -0
  107. package/src/entities/discount.test.ts +18 -0
  108. package/src/entities/discount.ts +34 -0
  109. package/src/entities/discount_group.test.ts +7 -0
  110. package/src/entities/discount_group.ts +28 -0
  111. package/src/entities/domain.test.ts +79 -0
  112. package/src/entities/domain.ts +246 -0
  113. package/src/entities/domain_invitation.test.ts +7 -0
  114. package/src/entities/domain_invitation.ts +36 -0
  115. package/src/entities/domain_tag.test.ts +7 -0
  116. package/src/entities/domain_tag.ts +42 -0
  117. package/src/entities/draft.test.ts +43 -0
  118. package/src/entities/draft.ts +88 -0
  119. package/src/entities/draft_comment.test.ts +7 -0
  120. package/src/entities/draft_comment.ts +54 -0
  121. package/src/entities/draft_template.test.ts +7 -0
  122. package/src/entities/draft_template.ts +40 -0
  123. package/src/entities/email_address.test.ts +7 -0
  124. package/src/entities/email_address.ts +24 -0
  125. package/src/entities/email_counter.test.ts +7 -0
  126. package/src/entities/email_counter.ts +20 -0
  127. package/src/entities/enrolled_domain.test.ts +7 -0
  128. package/src/entities/enrolled_domain.ts +40 -0
  129. package/src/entities/exchange_rate.test.ts +7 -0
  130. package/src/entities/exchange_rate.ts +22 -0
  131. package/src/entities/file.test.ts +43 -0
  132. package/src/entities/file.ts +172 -0
  133. package/src/entities/internal_tag.test.ts +7 -0
  134. package/src/entities/internal_tag.ts +51 -0
  135. package/src/entities/inventory.test.ts +28 -0
  136. package/src/entities/inventory.ts +56 -0
  137. package/src/entities/inventory_unit_variation.test.ts +7 -0
  138. package/src/entities/inventory_unit_variation.ts +29 -0
  139. package/src/entities/invoice.test.ts +43 -0
  140. package/src/entities/invoice.ts +179 -0
  141. package/src/entities/item.test.ts +19 -0
  142. package/src/entities/item.ts +44 -0
  143. package/src/entities/job.test.ts +95 -0
  144. package/src/entities/job.ts +349 -0
  145. package/src/entities/job_comment.test.ts +7 -0
  146. package/src/entities/job_comment.ts +50 -0
  147. package/src/entities/matching_inventory.ts +29 -0
  148. package/src/entities/menu.test.ts +7 -0
  149. package/src/entities/menu.ts +30 -0
  150. package/src/entities/menu_item.test.ts +7 -0
  151. package/src/entities/menu_item.ts +29 -0
  152. package/src/entities/notification.test.ts +7 -0
  153. package/src/entities/notification.ts +99 -0
  154. package/src/entities/page.test.ts +7 -0
  155. package/src/entities/page.ts +32 -0
  156. package/src/entities/payment.test.ts +19 -0
  157. package/src/entities/payment.ts +65 -0
  158. package/src/entities/payment_device.test.ts +7 -0
  159. package/src/entities/payment_device.ts +30 -0
  160. package/src/entities/phone_number.test.ts +7 -0
  161. package/src/entities/phone_number.ts +36 -0
  162. package/src/entities/product.test.ts +750 -0
  163. package/src/entities/product.ts +427 -0
  164. package/src/entities/production_comment.test.ts +7 -0
  165. package/src/entities/production_comment.ts +50 -0
  166. package/src/entities/quote.test.ts +98 -0
  167. package/src/entities/quote.ts +140 -0
  168. package/src/entities/quote_item.test.ts +50 -0
  169. package/src/entities/quote_item.ts +71 -0
  170. package/src/entities/seo_domain_page.test.ts +7 -0
  171. package/src/entities/seo_domain_page.ts +33 -0
  172. package/src/entities/session.test.ts +7 -0
  173. package/src/entities/session.ts +28 -0
  174. package/src/entities/shipment.test.ts +24 -0
  175. package/src/entities/shipment.ts +185 -0
  176. package/src/entities/shipment_item.test.ts +7 -0
  177. package/src/entities/shipment_item.ts +15 -0
  178. package/src/entities/shipment_item_fulfillment.test.ts +8 -0
  179. package/src/entities/shipment_item_fulfillment.ts +15 -0
  180. package/src/entities/shipment_method.test.ts +7 -0
  181. package/src/entities/shipment_method.ts +61 -0
  182. package/src/entities/shipment_method_variation.test.ts +7 -0
  183. package/src/entities/shipment_method_variation.ts +39 -0
  184. package/src/entities/short_url.test.ts +7 -0
  185. package/src/entities/short_url.ts +36 -0
  186. package/src/entities/subscription_plan.test.ts +7 -0
  187. package/src/entities/subscription_plan.ts +73 -0
  188. package/src/entities/supply_domain.test.ts +7 -0
  189. package/src/entities/supply_domain.ts +27 -0
  190. package/src/entities/system_role.test.ts +7 -0
  191. package/src/entities/system_role.ts +17 -0
  192. package/src/entities/theme.test.ts +38 -0
  193. package/src/entities/theme.ts +267 -0
  194. package/src/entities/theme_css_setting.test.ts +7 -0
  195. package/src/entities/theme_css_setting.ts +23 -0
  196. package/src/entities/user.test.ts +154 -0
  197. package/src/entities/user.ts +394 -0
  198. package/src/entities/user_company.test.ts +7 -0
  199. package/src/entities/user_company.ts +27 -0
  200. package/src/entities/variation.test.ts +7 -0
  201. package/src/entities/variation.ts +61 -0
  202. package/src/entities/variation_field.test.ts +76 -0
  203. package/src/entities/variation_field.ts +169 -0
  204. package/src/entities/variation_fields_option.test.ts +46 -0
  205. package/src/entities/variation_fields_option.ts +95 -0
  206. package/src/entities/variation_option.test.ts +7 -0
  207. package/src/entities/variation_option.ts +52 -0
  208. package/src/entities/variations_group.test.ts +7 -0
  209. package/src/entities/variations_group.ts +41 -0
  210. package/src/entity.ts +1002 -0
  211. package/src/merchi.test.ts +25 -0
  212. package/src/merchi.ts +379 -0
  213. package/src/request.test.ts +43 -0
  214. package/src/request.ts +124 -0
  215. package/src/test_util.ts +18 -0
  216. package/src/toasts.test.ts +38 -0
  217. package/src/toasts.ts +34 -0
  218. package/src/util/float.ts +12 -0
  219. package/src/util/query_string.test.ts +7 -0
  220. package/src/util/query_string.ts +11 -0
  221. package/src/util/validation.test.ts +16 -0
  222. package/src/util/validation.ts +2 -0
  223. package/src/uuid.test.ts +15 -0
  224. package/src/uuid.ts +8 -0
  225. package/tsconfig.json +23 -0
  226. package/webpack.config.cjs +27 -0
@@ -0,0 +1,39 @@
1
+ import { Entity } from '../entity';
2
+ import { CountryTax } from './country_tax';
3
+ import { ShipmentMethod } from './shipment_method';
4
+
5
+ export class ShipmentMethodVariation extends Entity {
6
+ protected static resourceName = 'shipment_method_variations';
7
+ protected static singularName = 'shipmentMethodVariation';
8
+ protected static pluralName = 'shipmentMethodVariations';
9
+
10
+ @ShipmentMethodVariation.property()
11
+ public id?: number;
12
+
13
+ @ShipmentMethodVariation.property({type: String})
14
+ public destinationCountry?: string | null;
15
+
16
+ @ShipmentMethodVariation.property({type: String})
17
+ public destinationState?: string | null;
18
+
19
+ @ShipmentMethodVariation.property({type: Number})
20
+ public cost?: number | null;
21
+
22
+ @ShipmentMethodVariation.property()
23
+ public currency?: string;
24
+
25
+ @ShipmentMethodVariation.property({type: Number})
26
+ public buyCost?: number | null;
27
+
28
+ @ShipmentMethodVariation.property()
29
+ public buyCurrency?: string;
30
+
31
+ @ShipmentMethodVariation.property({type: Number})
32
+ public maxWeight?: number | null;
33
+
34
+ @ShipmentMethodVariation.property({type: 'CountryTax'})
35
+ public taxType?: CountryTax | null;
36
+
37
+ @ShipmentMethodVariation.property()
38
+ public shipmentMethod?: ShipmentMethod;
39
+ }
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make ShortUrl', () => {
4
+ const merchi = new Merchi();
5
+ const shortUrl = new merchi.ShortUrl();
6
+ expect(shortUrl).toBeTruthy();
7
+ });
@@ -0,0 +1,36 @@
1
+ import { Entity } from '../entity';
2
+ import { Notification } from './notification';
3
+ import { User } from './user';
4
+
5
+ export class ShortUrl extends Entity {
6
+ protected static resourceName = 'short_urls';
7
+ protected static singularName = 'shortUrl';
8
+ protected static pluralName = 'shortUrls';
9
+
10
+ @ShortUrl.property({type: Date})
11
+ public archived?: Date | null;
12
+
13
+ @ShortUrl.property()
14
+ public id?: number;
15
+
16
+ @ShortUrl.property()
17
+ public prefixToken?: string;
18
+
19
+ @ShortUrl.property()
20
+ public suffixToken?: string;
21
+
22
+ @ShortUrl.property()
23
+ public originalLink?: string;
24
+
25
+ @ShortUrl.property()
26
+ public triedTimes?: number;
27
+
28
+ @ShortUrl.property({type: Date})
29
+ public lastLookup?: Date | null;
30
+
31
+ @ShortUrl.property({type: User})
32
+ public user?: User | null;
33
+
34
+ @ShortUrl.property({arrayType: 'Notification'})
35
+ public notification?: Notification[];
36
+ }
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make SubscriptionPlan', () => {
4
+ const merchi = new Merchi();
5
+ const subscriptionPlan = new merchi.SubscriptionPlan();
6
+ expect(subscriptionPlan).toBeTruthy();
7
+ });
@@ -0,0 +1,73 @@
1
+ import { Entity } from '../entity';
2
+ import { CountryTax } from './country_tax';
3
+ import { User } from './user';
4
+ import { Company } from './company';
5
+
6
+ export class SubscriptionPlan extends Entity {
7
+ protected static resourceName = 'subscription_plans';
8
+ protected static singularName = 'subscriptionPlan';
9
+ protected static pluralName = 'subscriptionPlans';
10
+
11
+ @SubscriptionPlan.property()
12
+ public id?: number;
13
+
14
+ @SubscriptionPlan.property({type: Date})
15
+ public created?: Date | null;
16
+
17
+ @SubscriptionPlan.property({type: Date})
18
+ public updated?: Date | null;
19
+
20
+ @SubscriptionPlan.property({type: User})
21
+ public createdBy?: User | null;
22
+
23
+ @SubscriptionPlan.property({type: User})
24
+ public updatedBy?: User | null;
25
+
26
+ @SubscriptionPlan.property()
27
+ public name?: string;
28
+
29
+ @SubscriptionPlan.property()
30
+ public currency?: string;
31
+
32
+ @SubscriptionPlan.property({type: CountryTax})
33
+ public tax?: CountryTax | null;
34
+
35
+ @SubscriptionPlan.property()
36
+ public baseCost?: number;
37
+
38
+ @SubscriptionPlan.property()
39
+ public whiteLabelDomainCost?: number;
40
+
41
+ @SubscriptionPlan.property()
42
+ public perSmsCost?: number;
43
+
44
+ @SubscriptionPlan.property()
45
+ public perUserCost?: number;
46
+
47
+ @SubscriptionPlan.property()
48
+ public perDomainCost?: number;
49
+
50
+ @SubscriptionPlan.property()
51
+ public transactionCost?: number;
52
+
53
+ @SubscriptionPlan.property()
54
+ public commissionRate?: number;
55
+
56
+ @SubscriptionPlan.property()
57
+ public baseUserCount?: number;
58
+
59
+ @SubscriptionPlan.property()
60
+ public baseDomainCount?: number;
61
+
62
+ @SubscriptionPlan.property()
63
+ public billingCycleDays?: number;
64
+
65
+ @SubscriptionPlan.property()
66
+ public isPrivate?: boolean;
67
+
68
+ @SubscriptionPlan.property()
69
+ public showPublic?: boolean;
70
+
71
+ @SubscriptionPlan.property({arrayType: 'Company'})
72
+ public companies?: Company[];
73
+ }
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make SupplyDomain', () => {
4
+ const merchi = new Merchi();
5
+ const supplyDomain = new merchi.SupplyDomain();
6
+ expect(supplyDomain).toBeTruthy();
7
+ });
@@ -0,0 +1,27 @@
1
+ import { Domain } from './domain';
2
+ import { Entity } from '../entity';
3
+ import { Product } from './product';
4
+
5
+ export class SupplyDomain extends Entity {
6
+ protected static resourceName = 'supply_domains';
7
+ protected static singularName = 'supplyDomain';
8
+ protected static pluralName = 'supplyDomains';
9
+
10
+ @SupplyDomain.property({type: Date})
11
+ public archived?: Date | null;
12
+
13
+ @SupplyDomain.property()
14
+ public id?: number;
15
+
16
+ @SupplyDomain.property()
17
+ public needsDrafting?: boolean;
18
+
19
+ @SupplyDomain.property()
20
+ public product?: Product;
21
+
22
+ @SupplyDomain.property({type: Product})
23
+ public supplyProduct?: Product | null;
24
+
25
+ @SupplyDomain.property()
26
+ public domain?: Domain;
27
+ }
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make SystemRole', () => {
4
+ const merchi = new Merchi();
5
+ const systemRole = new merchi.SystemRole();
6
+ expect(systemRole).toBeTruthy();
7
+ });
@@ -0,0 +1,17 @@
1
+ import { Entity } from '../entity';
2
+ import { User } from './user';
3
+
4
+ export class SystemRole extends Entity {
5
+ protected static resourceName = 'system_roles';
6
+ protected static singularName = 'systemRole';
7
+ protected static pluralName = 'systemRoles';
8
+
9
+ @SystemRole.property()
10
+ public id?: number;
11
+
12
+ @SystemRole.property()
13
+ public role?: number;
14
+
15
+ @SystemRole.property()
16
+ public user?: User;
17
+ }
@@ -0,0 +1,38 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make Theme', () => {
4
+ const merchi = new Merchi();
5
+ const theme = new merchi.Theme();
6
+ expect(theme).toBeTruthy();
7
+ });
8
+
9
+ test('can be activated', () => {
10
+ const merchi = new Merchi();
11
+ const theme = new merchi.Theme();
12
+ expect(theme.canBeActivated).toThrow();
13
+ theme.mainCssStatus = 3;
14
+ theme.emailCssStatus = 3;
15
+ expect(theme.canBeActivated()).toBe(true);
16
+ theme.mainCssStatus = 1;
17
+ expect(theme.canBeActivated()).toBe(false);
18
+ });
19
+
20
+ test('is active on domain', () => {
21
+ const merchi = new Merchi();
22
+ const theme = new merchi.Theme();
23
+ theme.id = 3;
24
+ const otherTheme = new merchi.Theme();
25
+ otherTheme.id = 4;
26
+ const domain = new merchi.Domain();
27
+ domain.id = 1;
28
+ expect(() => theme.isActiveOnDomain(1)).toThrow();
29
+ theme.domain = null;
30
+ expect(theme.isActiveOnDomain(1)).toBe(false);
31
+ theme.domain = domain;
32
+ expect(() => theme.isActiveOnDomain(1)).toThrow();
33
+ domain.activeTheme = otherTheme;
34
+ expect(theme.isActiveOnDomain(1)).toBe(false);
35
+ domain.activeTheme = theme;
36
+ expect(theme.isActiveOnDomain(1)).toBe(true);
37
+ expect(theme.isActiveOnDomain(2)).toBe(false);
38
+ });
@@ -0,0 +1,267 @@
1
+ import { Component } from './component';
2
+ import { Domain } from './domain';
3
+ import { Entity } from '../entity';
4
+ import { MerchiFile } from './file';
5
+ import { InternalTag } from './internal_tag';
6
+ import { User } from './user';
7
+ import { Menu } from './menu';
8
+ import { Page } from './page';
9
+ import { ThemeStatus } from '../constants/theme_status';
10
+
11
+ export class Theme extends Entity {
12
+ protected static resourceName = 'themes';
13
+ protected static singularName = 'theme';
14
+ protected static pluralName = 'themes';
15
+
16
+ @Theme.property({type: Date})
17
+ public archived?: Date | null;
18
+
19
+ @Theme.property()
20
+ public id?: number;
21
+
22
+ @Theme.property()
23
+ public foundation?: number;
24
+
25
+ @Theme.property({arrayType: 'InternalTag'})
26
+ public internalTags?: InternalTag[];
27
+
28
+ @Theme.property({arrayType: 'Component'})
29
+ public components?: Component[];
30
+
31
+ @Theme.property({arrayType: 'Component'})
32
+ public contextComponents?: Component[];
33
+
34
+ @Theme.property()
35
+ public mainCssStatus?: number;
36
+
37
+ @Theme.property({type: String})
38
+ public mainCssErrorMessage?: string | null;
39
+
40
+ @Theme.property()
41
+ public emailCssStatus?: number;
42
+
43
+ @Theme.property({type: String})
44
+ public emailCssErrorMessage?: string | null;
45
+
46
+ @Theme.property()
47
+ public name?: string;
48
+
49
+ @Theme.property()
50
+ public description?: string;
51
+
52
+ @Theme.property()
53
+ public jsBundle?: string;
54
+
55
+ @Theme.property()
56
+ public headerTemplate?: string;
57
+
58
+ @Theme.property({type: String})
59
+ public headerError?: string | null;
60
+
61
+ @Theme.property()
62
+ public headerHtml?: string;
63
+
64
+ @Theme.property()
65
+ public footerTemplate?: string;
66
+
67
+ @Theme.property({type: String})
68
+ public footerError?: string | null;
69
+
70
+ @Theme.property()
71
+ public footerHtml?: string;
72
+
73
+ @Theme.property()
74
+ public indexPageTemplate?: string;
75
+
76
+ @Theme.property({type: String})
77
+ public indexPageError?: string | null;
78
+
79
+ @Theme.property()
80
+ public indexHtml?: string;
81
+
82
+ @Theme.property({arrayType: 'Menu'})
83
+ public menus?: Menu[];
84
+
85
+ @Theme.property()
86
+ public productsPageTemplate?: string;
87
+
88
+ @Theme.property({type: String})
89
+ public productsPageError?: string | null;
90
+
91
+ @Theme.property()
92
+ public productsHtml?: string;
93
+
94
+ @Theme.property({type: String})
95
+ public domainInvitePageTemplate?: string | null;
96
+
97
+ @Theme.property({type: String})
98
+ public domainInvitePageError?: string | null;
99
+
100
+ @Theme.property()
101
+ public domainInviteHtml?: string;
102
+
103
+ @Theme.property({type: String})
104
+ public resetPasswordPageTemplate?: string | null;
105
+
106
+ @Theme.property({type: String})
107
+ public resetPasswordPageError?: string | null;
108
+
109
+ @Theme.property()
110
+ public passwordResetHtml?: string;
111
+
112
+ @Theme.property({type: String})
113
+ public passwordChangePageTemplate?: string | null;
114
+
115
+ @Theme.property({type: String})
116
+ public passwordChangePageError?: string | null;
117
+
118
+ @Theme.property()
119
+ public passwordChangeHtml?: string;
120
+
121
+ @Theme.property({type: String})
122
+ public jobDraftingPageTemplate?: string | null;
123
+
124
+ @Theme.property({type: String})
125
+ public jobDraftingPageError?: string | null;
126
+
127
+ @Theme.property()
128
+ public jobDraftingHtml?: string;
129
+
130
+ @Theme.property({type: String})
131
+ public jobQuoteRequestedPageTemplate?: string | null;
132
+
133
+ @Theme.property({type: String})
134
+ public jobQuoteRequestedPageError?: string | null;
135
+
136
+ @Theme.property()
137
+ public jobQuoteRequestedHtml?: string;
138
+
139
+ @Theme.property({type: String})
140
+ public invoicePageTemplate?: string | null;
141
+
142
+ @Theme.property({type: String})
143
+ public invoicePageError?: string | null;
144
+
145
+ @Theme.property()
146
+ public invoiceHtml?: string;
147
+
148
+ @Theme.property({type: String})
149
+ public loginPageTemplate?: string | null;
150
+
151
+ @Theme.property({type: String})
152
+ public loginPageError?: string | null;
153
+
154
+ @Theme.property()
155
+ public loginPageHtml?: string;
156
+
157
+ @Theme.property({type: String})
158
+ public errorPageTemplate?: string | null;
159
+
160
+ @Theme.property({type: String})
161
+ public errorPageError?: string | null;
162
+
163
+ @Theme.property()
164
+ public errorPageHtml?: string;
165
+
166
+ @Theme.property({type: String})
167
+ public userProfilePageTemplate?: string | null;
168
+
169
+ @Theme.property({type: String})
170
+ public userProfilePageError?: string | null;
171
+
172
+ @Theme.property()
173
+ public userProfileHtml?: string;
174
+
175
+ @Theme.property({type: String})
176
+ public productPageTemplate?: string | null;
177
+
178
+ @Theme.property({type: String})
179
+ public productPageError?: string | null;
180
+
181
+ @Theme.property()
182
+ public productHtml?: string;
183
+
184
+ @Theme.property({type: String})
185
+ public invoicePaidPageTemplate?: string | null;
186
+
187
+ @Theme.property({type: String})
188
+ public invoicePaidPageError?: string | null;
189
+
190
+ @Theme.property()
191
+ public invoicePaidHtml?: string;
192
+
193
+ @Theme.property()
194
+ public lastUpdated?: Date;
195
+
196
+ @Theme.property()
197
+ public public?: boolean;
198
+
199
+ @Theme.property({type: String})
200
+ public aiContext?: string;
201
+
202
+ @Theme.property({embeddedByDefault: false, type: String})
203
+ public mainCss?: string | null;
204
+
205
+ @Theme.property({embeddedByDefault: false, type: String})
206
+ public mainCssTemplateUsing?: string | null;
207
+
208
+ @Theme.property({embeddedByDefault: false, type: String})
209
+ public mainCssTemplateEditing?: string | null;
210
+
211
+ @Theme.property({embeddedByDefault: false, type: String})
212
+ public emailCss?: string | null;
213
+
214
+ @Theme.property({embeddedByDefault: false, type: String})
215
+ public emailCssTemplateUsing?: string | null;
216
+
217
+ @Theme.property({embeddedByDefault: false, type: String})
218
+ public emailCssTemplateEditing?: string | null;
219
+
220
+ @Theme.property({arrayType: 'MerchiFile'})
221
+ public cssImageFiles?: MerchiFile[];
222
+
223
+ @Theme.property({type: MerchiFile})
224
+ public featureImage?: MerchiFile | null;
225
+
226
+ @Theme.property({type: 'Domain'})
227
+ public domain?: Domain | null;
228
+
229
+ @Theme.property({type: User})
230
+ public author?: User | null;
231
+
232
+ @Theme.property({arrayType: 'MerchiFile'})
233
+ public images?: MerchiFile[];
234
+
235
+ @Theme.property({arrayType: 'Domain'})
236
+ public domains?: Domain[];
237
+
238
+ @Theme.property({arrayType: 'Page'})
239
+ public pages?: Page[];
240
+
241
+ @Theme.property({type: Number})
242
+ public defaultForDomainType?: number | null;
243
+
244
+ public canBeActivated = () => {
245
+ const validStatus = ThemeStatus.VALID_BUT_NOT_UPDATED;
246
+ if (this.mainCssStatus === undefined || this.emailCssStatus === undefined) {
247
+ throw new Error('status is unknown');
248
+ }
249
+ return this.mainCssStatus >= validStatus &&
250
+ this.emailCssStatus >= validStatus;
251
+ };
252
+
253
+ public isActiveOnDomain = (domainId: number) => {
254
+ const domain = this.domain;
255
+ if (domain === undefined) {
256
+ throw new Error('domain is unknown');
257
+ }
258
+ if (domain === null) {
259
+ return false;
260
+ }
261
+ const activeTheme = domain.activeTheme;
262
+ if (activeTheme === undefined) {
263
+ throw new Error('activeTheme is unknown');
264
+ }
265
+ return domain.id == domainId && activeTheme.id === this.id;
266
+ };
267
+ }
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi';
2
+
3
+ test('can make ThemeCssSetting', () => {
4
+ const merchi = new Merchi();
5
+ const themeCssSetting = new merchi.ThemeCssSetting();
6
+ expect(themeCssSetting).toBeTruthy();
7
+ });
@@ -0,0 +1,23 @@
1
+ import { Entity } from '../entity';
2
+ import { User } from './user';
3
+
4
+ export class ThemeCssSetting extends Entity {
5
+ protected static resourceName = 'theme_css_settings';
6
+ protected static singularName = 'themeCssSetting';
7
+ protected static pluralName = 'themeCssSettings';
8
+
9
+ @ThemeCssSetting.property()
10
+ public id?: number;
11
+
12
+ @ThemeCssSetting.property({type: Date})
13
+ public created?: Date | null;
14
+
15
+ @ThemeCssSetting.property({type: User})
16
+ public createdBy?: User | null;
17
+
18
+ @ThemeCssSetting.property()
19
+ public allowedAttributes?: string;
20
+
21
+ @ThemeCssSetting.property()
22
+ public notAllowedAttributes?: string;
23
+ }