merchi_sdk_ts 1.32.0 → 1.32.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 (692) hide show
  1. package/.eslintrc.cjs +43 -43
  2. package/LICENSE +21 -21
  3. package/README.md +244 -244
  4. package/coverage/clover.xml +4870 -366
  5. package/coverage/coverage-final.json +131 -7
  6. package/coverage/lcov-report/block-navigation.js +1 -1
  7. package/coverage/lcov-report/index.html +76 -91
  8. package/coverage/lcov-report/sorter.js +21 -7
  9. package/coverage/lcov-report/src/constants/auto_assign_production_on_actions.ts.html +7 -7
  10. package/coverage/lcov-report/src/constants/call_to_actions.ts.html +37 -37
  11. package/coverage/lcov-report/src/constants/discount_types.ts.html +19 -19
  12. package/coverage/lcov-report/src/constants/domain_types.ts.html +13 -13
  13. package/coverage/lcov-report/src/constants/errors.ts.html +43 -43
  14. package/coverage/lcov-report/src/constants/event_types.ts.html +19 -19
  15. package/coverage/lcov-report/src/constants/field_types.ts.html +17 -23
  16. package/coverage/lcov-report/src/constants/index.html +221 -221
  17. package/coverage/lcov-report/src/constants/index.ts.html +103 -103
  18. package/coverage/lcov-report/src/constants/input_types.ts.html +35 -35
  19. package/coverage/lcov-report/src/constants/inventory_statuses.ts.html +7 -7
  20. package/coverage/lcov-report/src/constants/invoice_types.ts.html +19 -19
  21. package/coverage/lcov-report/src/constants/item_types.ts.html +19 -19
  22. package/coverage/lcov-report/src/constants/job/drafting_status.ts.html +23 -23
  23. package/coverage/lcov-report/src/constants/job/index.html +66 -66
  24. package/coverage/lcov-report/src/constants/job/payment_status.ts.html +23 -23
  25. package/coverage/lcov-report/src/constants/job/production_status.ts.html +33 -33
  26. package/coverage/lcov-report/src/constants/job/shipment_status.ts.html +31 -31
  27. package/coverage/lcov-report/src/constants/job/supply_chain_request_status.ts.html +21 -21
  28. package/coverage/lcov-report/src/constants/job_priorities.ts.html +21 -21
  29. package/coverage/lcov-report/src/constants/job_status.ts.html +91 -91
  30. package/coverage/lcov-report/src/constants/job_types.ts.html +41 -41
  31. package/coverage/lcov-report/src/constants/notification_sections.ts.html +14 -14
  32. package/coverage/lcov-report/src/constants/notification_types.ts.html +98 -98
  33. package/coverage/lcov-report/src/constants/notification_urgencies.ts.html +21 -21
  34. package/coverage/lcov-report/src/constants/payment_types.ts.html +29 -29
  35. package/coverage/lcov-report/src/constants/platform.ts.html +17 -17
  36. package/coverage/lcov-report/src/constants/product_types.ts.html +61 -61
  37. package/coverage/lcov-report/src/constants/rights.ts.html +19 -19
  38. package/coverage/lcov-report/src/constants/robots_meta_directives.ts.html +9 -9
  39. package/coverage/lcov-report/src/constants/roles.ts.html +19 -19
  40. package/coverage/lcov-report/src/constants/shipment_companies.ts.html +47 -47
  41. package/coverage/lcov-report/src/constants/shipment_services.ts.html +4 -4
  42. package/coverage/lcov-report/src/constants/system_roles.ts.html +15 -15
  43. package/coverage/lcov-report/src/constants/theme_status.ts.html +6 -6
  44. package/coverage/lcov-report/src/constants/user_types.ts.html +18 -18
  45. package/coverage/lcov-report/src/constants/white_label_accessibilities.ts.html +19 -19
  46. package/coverage/lcov-report/src/cookie.ts.html +4 -4
  47. package/coverage/lcov-report/src/entities/address.ts.html +25 -25
  48. package/coverage/lcov-report/src/entities/agent_conversation.ts.html +20 -20
  49. package/coverage/lcov-report/src/entities/agent_skill.ts.html +31 -31
  50. package/coverage/lcov-report/src/entities/agent_skill_approval.ts.html +15 -15
  51. package/coverage/lcov-report/src/entities/agent_skill_version.ts.html +31 -31
  52. package/coverage/lcov-report/src/entities/agent_token_usage.ts.html +31 -31
  53. package/coverage/lcov-report/src/entities/assignment.ts.html +63 -63
  54. package/coverage/lcov-report/src/entities/automatic_payment_relationship.ts.html +16 -16
  55. package/coverage/lcov-report/src/entities/bank.ts.html +21 -21
  56. package/coverage/lcov-report/src/entities/cart.ts.html +58 -58
  57. package/coverage/lcov-report/src/entities/cart_item.ts.html +67 -67
  58. package/coverage/lcov-report/src/entities/cart_shipment_group.ts.html +13 -13
  59. package/coverage/lcov-report/src/entities/cart_shipment_quote.ts.html +18 -18
  60. package/coverage/lcov-report/src/entities/category.ts.html +25 -25
  61. package/coverage/lcov-report/src/entities/company.ts.html +129 -129
  62. package/coverage/lcov-report/src/entities/company_invitation.ts.html +18 -18
  63. package/coverage/lcov-report/src/entities/country_tax.ts.html +37 -37
  64. package/coverage/lcov-report/src/entities/discount.ts.html +41 -41
  65. package/coverage/lcov-report/src/entities/discount_group.ts.html +19 -19
  66. package/coverage/lcov-report/src/entities/domain.ts.html +259 -385
  67. package/coverage/lcov-report/src/entities/domain_chat_settings.ts.html +34 -34
  68. package/coverage/lcov-report/src/entities/domain_invitation.ts.html +19 -19
  69. package/coverage/lcov-report/src/entities/domain_tag.ts.html +19 -19
  70. package/coverage/lcov-report/src/entities/draft.ts.html +51 -51
  71. package/coverage/lcov-report/src/entities/draft_comment.ts.html +27 -27
  72. package/coverage/lcov-report/src/entities/draft_preview.ts.html +19 -19
  73. package/coverage/lcov-report/src/entities/draft_preview_layer.ts.html +14 -14
  74. package/coverage/lcov-report/src/entities/draft_template.ts.html +32 -50
  75. package/coverage/lcov-report/src/entities/email_address.ts.html +13 -13
  76. package/coverage/lcov-report/src/entities/email_counter.ts.html +13 -13
  77. package/coverage/lcov-report/src/entities/enrolled_domain.ts.html +40 -40
  78. package/coverage/lcov-report/src/entities/exchange_rate.ts.html +13 -13
  79. package/coverage/lcov-report/src/entities/file.ts.html +84 -84
  80. package/coverage/lcov-report/src/entities/index.html +274 -274
  81. package/coverage/lcov-report/src/entities/internal_tag.ts.html +20 -20
  82. package/coverage/lcov-report/src/entities/inventory.ts.html +43 -43
  83. package/coverage/lcov-report/src/entities/inventory_group.ts.html +17 -17
  84. package/coverage/lcov-report/src/entities/inventory_unit_variation.ts.html +32 -32
  85. package/coverage/lcov-report/src/entities/invoice.ts.html +70 -70
  86. package/coverage/lcov-report/src/entities/item.ts.html +45 -45
  87. package/coverage/lcov-report/src/entities/job.ts.html +188 -188
  88. package/coverage/lcov-report/src/entities/job_comment.ts.html +23 -23
  89. package/coverage/lcov-report/src/entities/job_note.ts.html +20 -20
  90. package/coverage/lcov-report/src/entities/job_operation_log.ts.html +20 -20
  91. package/coverage/lcov-report/src/entities/matching_inventory.ts.html +17 -17
  92. package/coverage/lcov-report/src/entities/notification.ts.html +48 -48
  93. package/coverage/lcov-report/src/entities/payment.ts.html +48 -48
  94. package/coverage/lcov-report/src/entities/payment_device.ts.html +16 -16
  95. package/coverage/lcov-report/src/entities/phone_number.ts.html +17 -17
  96. package/coverage/lcov-report/src/entities/product.ts.html +285 -276
  97. package/coverage/lcov-report/src/entities/product_form.ts.html +22 -22
  98. package/coverage/lcov-report/src/entities/product_form_version.ts.html +22 -22
  99. package/coverage/lcov-report/src/entities/product_review.ts.html +26 -26
  100. package/coverage/lcov-report/src/entities/production_comment.ts.html +23 -23
  101. package/coverage/lcov-report/src/entities/quote.ts.html +163 -163
  102. package/coverage/lcov-report/src/entities/quote_item.ts.html +61 -61
  103. package/coverage/lcov-report/src/entities/reminder.ts.html +35 -35
  104. package/coverage/lcov-report/src/entities/session.ts.html +17 -17
  105. package/coverage/lcov-report/src/entities/shipment.ts.html +98 -98
  106. package/coverage/lcov-report/src/entities/shipment_item.ts.html +11 -11
  107. package/coverage/lcov-report/src/entities/shipment_item_fulfillment.ts.html +12 -12
  108. package/coverage/lcov-report/src/entities/shipment_log.ts.html +17 -17
  109. package/coverage/lcov-report/src/entities/shipment_method.ts.html +28 -28
  110. package/coverage/lcov-report/src/entities/shipment_method_variation.ts.html +19 -19
  111. package/coverage/lcov-report/src/entities/short_url.ts.html +18 -18
  112. package/coverage/lcov-report/src/entities/subscription_plan.ts.html +31 -31
  113. package/coverage/lcov-report/src/entities/supply_domain.ts.html +16 -16
  114. package/coverage/lcov-report/src/entities/support_conversation.ts.html +27 -27
  115. package/coverage/lcov-report/src/entities/support_message.ts.html +17 -17
  116. package/coverage/lcov-report/src/entities/system_role.ts.html +12 -12
  117. package/coverage/lcov-report/src/entities/theme.ts.html +66 -66
  118. package/coverage/lcov-report/src/entities/theme_css_setting.ts.html +14 -14
  119. package/coverage/lcov-report/src/entities/user.ts.html +250 -250
  120. package/coverage/lcov-report/src/entities/user_company.ts.html +16 -16
  121. package/coverage/lcov-report/src/entities/variation.ts.html +29 -29
  122. package/coverage/lcov-report/src/entities/variation_field.ts.html +128 -359
  123. package/coverage/lcov-report/src/entities/variation_fields_option.ts.html +86 -95
  124. package/coverage/lcov-report/src/entities/variation_option.ts.html +25 -25
  125. package/coverage/lcov-report/src/entities/variations_group.ts.html +21 -21
  126. package/coverage/lcov-report/src/entity.ts.html +918 -942
  127. package/coverage/lcov-report/src/index.html +68 -68
  128. package/coverage/lcov-report/src/index.ts.html +349 -349
  129. package/coverage/lcov-report/src/merchi.ts.html +236 -236
  130. package/coverage/lcov-report/src/pricing/discount.ts.html +29 -29
  131. package/coverage/lcov-report/src/pricing/estimate.ts.html +232 -463
  132. package/coverage/lcov-report/src/pricing/index.html +75 -90
  133. package/coverage/lcov-report/src/pricing/index.ts.html +21 -24
  134. package/coverage/lcov-report/src/pricing/inventory.ts.html +103 -103
  135. package/coverage/lcov-report/src/pricing/round.ts.html +33 -33
  136. package/coverage/lcov-report/src/pricing/visibility.ts.html +113 -113
  137. package/coverage/lcov-report/src/request.ts.html +76 -76
  138. package/coverage/lcov-report/src/test_util.ts.html +26 -26
  139. package/coverage/lcov-report/src/toasts.ts.html +30 -30
  140. package/coverage/lcov-report/src/util/float.ts.html +27 -27
  141. package/coverage/lcov-report/src/util/index.html +49 -49
  142. package/coverage/lcov-report/src/util/index.ts.html +15 -15
  143. package/coverage/lcov-report/src/util/query_string.ts.html +29 -29
  144. package/coverage/lcov-report/src/util/validation.ts.html +15 -15
  145. package/coverage/lcov-report/src/uuid.ts.html +8 -8
  146. package/coverage/lcov.info +7332 -722
  147. package/dist/constants/auto_assign_production_on_actions.js +7 -7
  148. package/dist/constants/call_to_actions.js +15 -15
  149. package/dist/constants/call_to_actions.test.js +4 -4
  150. package/dist/constants/discount_types.js +6 -6
  151. package/dist/constants/discount_types.test.js +4 -4
  152. package/dist/constants/domain_types.js +13 -13
  153. package/dist/constants/domain_types.test.js +4 -4
  154. package/dist/constants/errors.js +32 -32
  155. package/dist/constants/event_types.js +6 -6
  156. package/dist/constants/event_types.test.js +4 -4
  157. package/dist/constants/field_types.js +17 -17
  158. package/dist/constants/field_types.test.js +4 -4
  159. package/dist/constants/index.js +25 -25
  160. package/dist/constants/input_types.js +14 -14
  161. package/dist/constants/input_types.test.js +4 -4
  162. package/dist/constants/inventory_status.test.js +4 -4
  163. package/dist/constants/inventory_statuses.js +7 -7
  164. package/dist/constants/invoice_types.js +6 -6
  165. package/dist/constants/invoice_types.test.js +4 -4
  166. package/dist/constants/item_types.js +6 -6
  167. package/dist/constants/item_types.test.js +4 -4
  168. package/dist/constants/job/drafting_status.js +8 -8
  169. package/dist/constants/job/drafting_status.test.js +4 -4
  170. package/dist/constants/job/payment_status.js +8 -8
  171. package/dist/constants/job/payment_status.test.js +4 -4
  172. package/dist/constants/job/production_status.js +13 -13
  173. package/dist/constants/job/production_status.test.js +4 -4
  174. package/dist/constants/job/shipment_status.js +12 -12
  175. package/dist/constants/job/shipment_status.test.js +4 -4
  176. package/dist/constants/job/supply_chain_request_status.js +7 -7
  177. package/dist/constants/job/supply_chain_request_status.test.js +4 -4
  178. package/dist/constants/job_priorities.js +7 -7
  179. package/dist/constants/job_priorities.test.js +4 -4
  180. package/dist/constants/job_status.js +50 -50
  181. package/dist/constants/job_status.test.js +4 -4
  182. package/dist/constants/job_types.js +17 -17
  183. package/dist/constants/job_types.test.js +4 -4
  184. package/dist/constants/notification_sections.js +14 -14
  185. package/dist/constants/notification_sections.test.js +4 -4
  186. package/dist/constants/notification_types.js +98 -98
  187. package/dist/constants/notification_types.test.js +4 -4
  188. package/dist/constants/notification_urgencies.js +7 -7
  189. package/dist/constants/notification_urgencies.test.js +4 -4
  190. package/dist/constants/payment_types.js +11 -11
  191. package/dist/constants/payment_types.test.js +4 -4
  192. package/dist/constants/platform.js +5 -5
  193. package/dist/constants/platform.test.js +8 -8
  194. package/dist/constants/product_types.js +27 -27
  195. package/dist/constants/product_types.test.js +4 -4
  196. package/dist/constants/rights.js +6 -6
  197. package/dist/constants/rights.test.js +4 -4
  198. package/dist/constants/robots_meta_directives.js +11 -11
  199. package/dist/constants/robots_meta_directives.test.js +4 -4
  200. package/dist/constants/roles.js +57 -57
  201. package/dist/constants/roles.test.js +4 -4
  202. package/dist/constants/shipment_companies.js +20 -20
  203. package/dist/constants/shipment_companies.test.js +4 -4
  204. package/dist/constants/shipment_services.js +4 -4
  205. package/dist/constants/shipment_services.test.js +4 -4
  206. package/dist/constants/system_roles.js +4 -4
  207. package/dist/constants/system_roles.test.js +4 -4
  208. package/dist/constants/theme_status.js +6 -6
  209. package/dist/constants/theme_status.test.js +4 -4
  210. package/dist/constants/user_types.js +18 -18
  211. package/dist/constants/user_types.test.js +4 -4
  212. package/dist/constants/white_label_accessibilities.js +6 -6
  213. package/dist/constants/white_label_accessibilities.test.js +4 -4
  214. package/dist/cookie.js +15 -15
  215. package/dist/cookie.test.js +10 -10
  216. package/dist/entities/address.js +104 -104
  217. package/dist/entities/address.test.js +6 -6
  218. package/dist/entities/agent_conversation.js +78 -78
  219. package/dist/entities/agent_conversation.test.js +6 -6
  220. package/dist/entities/agent_skill.js +133 -133
  221. package/dist/entities/agent_skill.test.js +11 -11
  222. package/dist/entities/agent_skill_approval.js +61 -61
  223. package/dist/entities/agent_skill_version.js +99 -99
  224. package/dist/entities/agent_token_analytics.js +1 -1
  225. package/dist/entities/agent_token_usage.js +127 -127
  226. package/dist/entities/agent_token_usage.test.js +6 -6
  227. package/dist/entities/assignment.js +135 -135
  228. package/dist/entities/assignment.test.js +30 -30
  229. package/dist/entities/automatic_payment_relationship.js +65 -65
  230. package/dist/entities/automatic_payment_relationship.test.js +6 -6
  231. package/dist/entities/bank.js +85 -85
  232. package/dist/entities/bank.test.js +6 -6
  233. package/dist/entities/cart.js +169 -165
  234. package/dist/entities/cart.test.js +45 -45
  235. package/dist/entities/cart_item.js +125 -125
  236. package/dist/entities/cart_item.test.js +28 -28
  237. package/dist/entities/cart_shipment_group.js +53 -53
  238. package/dist/entities/cart_shipment_quote.js +70 -70
  239. package/dist/entities/category.js +101 -101
  240. package/dist/entities/category.test.js +52 -52
  241. package/dist/entities/company.js +509 -509
  242. package/dist/entities/company.test.js +6 -6
  243. package/dist/entities/company_invitation.js +70 -70
  244. package/dist/entities/company_invitation.test.js +6 -6
  245. package/dist/entities/country_tax.js +80 -80
  246. package/dist/entities/country_tax.test.js +11 -11
  247. package/dist/entities/discount.js +80 -80
  248. package/dist/entities/discount.test.js +16 -16
  249. package/dist/entities/discount_group.js +80 -80
  250. package/dist/entities/discount_group.test.js +6 -6
  251. package/dist/entities/domain.js +564 -556
  252. package/dist/entities/domain.test.js +348 -348
  253. package/dist/entities/domain_chat_settings.js +134 -134
  254. package/dist/entities/domain_chat_settings.test.js +15 -15
  255. package/dist/entities/domain_invitation.js +74 -74
  256. package/dist/entities/domain_invitation.test.js +6 -6
  257. package/dist/entities/domain_tag.js +77 -77
  258. package/dist/entities/domain_tag.test.js +6 -6
  259. package/dist/entities/draft.js +122 -118
  260. package/dist/entities/draft.test.js +26 -26
  261. package/dist/entities/draft_comment.js +107 -103
  262. package/dist/entities/draft_comment.test.js +6 -6
  263. package/dist/entities/draft_preview.js +74 -74
  264. package/dist/entities/draft_preview.test.js +36 -36
  265. package/dist/entities/draft_preview_layer.js +54 -54
  266. package/dist/entities/draft_preview_layer.test.js +6 -6
  267. package/dist/entities/draft_template.js +119 -119
  268. package/dist/entities/draft_template.test.js +12 -12
  269. package/dist/entities/email_address.js +56 -56
  270. package/dist/entities/email_address.test.js +6 -6
  271. package/dist/entities/email_counter.js +53 -53
  272. package/dist/entities/email_counter.test.js +6 -6
  273. package/dist/entities/enrolled_domain.js +74 -74
  274. package/dist/entities/enrolled_domain.test.js +6 -6
  275. package/dist/entities/exchange_rate.js +56 -56
  276. package/dist/entities/exchange_rate.test.js +6 -6
  277. package/dist/entities/file.js +218 -218
  278. package/dist/entities/file.test.js +38 -38
  279. package/dist/entities/internal_tag.js +84 -84
  280. package/dist/entities/internal_tag.test.js +6 -6
  281. package/dist/entities/inventory.js +97 -97
  282. package/dist/entities/inventory.test.js +22 -22
  283. package/dist/entities/inventory_group.js +69 -69
  284. package/dist/entities/inventory_group.test.js +6 -6
  285. package/dist/entities/inventory_unit_variation.js +61 -61
  286. package/dist/entities/inventory_unit_variation.test.js +6 -6
  287. package/dist/entities/invoice.js +264 -260
  288. package/dist/entities/invoice.test.js +39 -39
  289. package/dist/entities/item.js +96 -96
  290. package/dist/entities/item.test.js +17 -17
  291. package/dist/entities/job.js +515 -511
  292. package/dist/entities/job.test.js +83 -83
  293. package/dist/entities/job_comment.js +94 -90
  294. package/dist/entities/job_comment.test.js +6 -6
  295. package/dist/entities/job_note.js +78 -78
  296. package/dist/entities/job_operation_log.js +82 -82
  297. package/dist/entities/job_operation_log.test.js +6 -6
  298. package/dist/entities/matching_inventory.js +63 -63
  299. package/dist/entities/notification.js +163 -163
  300. package/dist/entities/notification.test.js +51 -51
  301. package/dist/entities/payment.js +106 -106
  302. package/dist/entities/payment.test.js +16 -16
  303. package/dist/entities/payment_device.js +65 -65
  304. package/dist/entities/payment_device.test.js +6 -6
  305. package/dist/entities/phone_number.js +72 -72
  306. package/dist/entities/phone_number.test.js +6 -6
  307. package/dist/entities/product.js +611 -611
  308. package/dist/entities/product.test.js +716 -716
  309. package/dist/entities/product_form.js +92 -92
  310. package/dist/entities/product_form_version.js +95 -95
  311. package/dist/entities/product_review.js +234 -234
  312. package/dist/entities/production_comment.js +94 -90
  313. package/dist/entities/production_comment.test.js +6 -6
  314. package/dist/entities/quote.js +168 -168
  315. package/dist/entities/quote.test.js +86 -86
  316. package/dist/entities/quote_item.js +99 -99
  317. package/dist/entities/quote_item.test.js +40 -40
  318. package/dist/entities/reminder.js +120 -120
  319. package/dist/entities/reminder.test.js +14 -14
  320. package/dist/entities/session.js +63 -63
  321. package/dist/entities/session.test.js +6 -6
  322. package/dist/entities/shipment.js +256 -252
  323. package/dist/entities/shipment.test.js +20 -20
  324. package/dist/entities/shipment_item.js +45 -45
  325. package/dist/entities/shipment_item.test.js +6 -6
  326. package/dist/entities/shipment_item_fulfillment.js +46 -46
  327. package/dist/entities/shipment_item_fulfillment.test.js +6 -6
  328. package/dist/entities/shipment_log.js +75 -75
  329. package/dist/entities/shipment_method.js +104 -104
  330. package/dist/entities/shipment_method.test.js +6 -6
  331. package/dist/entities/shipment_method_variation.js +77 -77
  332. package/dist/entities/shipment_method_variation.test.js +6 -6
  333. package/dist/entities/short_url.js +73 -73
  334. package/dist/entities/short_url.test.js +6 -6
  335. package/dist/entities/subscription_plan.js +122 -122
  336. package/dist/entities/subscription_plan.test.js +6 -6
  337. package/dist/entities/supply_domain.js +62 -62
  338. package/dist/entities/supply_domain.test.js +6 -6
  339. package/dist/entities/support_conversation.js +106 -106
  340. package/dist/entities/support_conversation.test.js +6 -6
  341. package/dist/entities/support_message.js +66 -66
  342. package/dist/entities/support_message.test.js +6 -6
  343. package/dist/entities/system_role.js +49 -49
  344. package/dist/entities/system_role.test.js +6 -6
  345. package/dist/entities/theme.js +125 -125
  346. package/dist/entities/theme.test.js +35 -35
  347. package/dist/entities/theme_css_setting.js +57 -57
  348. package/dist/entities/theme_css_setting.test.js +6 -6
  349. package/dist/entities/user.js +508 -508
  350. package/dist/entities/user.test.js +134 -134
  351. package/dist/entities/user_company.js +62 -62
  352. package/dist/entities/user_company.test.js +6 -6
  353. package/dist/entities/variation.js +108 -108
  354. package/dist/entities/variation.test.js +6 -6
  355. package/dist/entities/variation_field.js +381 -381
  356. package/dist/entities/variation_field.test.js +69 -69
  357. package/dist/entities/variation_fields_option.js +153 -153
  358. package/dist/entities/variation_fields_option.test.js +43 -43
  359. package/dist/entities/variation_option.js +104 -104
  360. package/dist/entities/variation_option.test.js +6 -6
  361. package/dist/entities/variations_group.js +79 -79
  362. package/dist/entities/variations_group.test.js +6 -6
  363. package/dist/entity.js +947 -947
  364. package/dist/index.js +86 -86
  365. package/dist/merchi.js +296 -296
  366. package/dist/merchi.test.js +21 -21
  367. package/dist/pricing/discount.js +11 -11
  368. package/dist/pricing/discount.test.js +35 -35
  369. package/dist/pricing/estimate.js +335 -335
  370. package/dist/pricing/estimate.test.js +403 -403
  371. package/dist/pricing/golden.test.js +61 -61
  372. package/dist/pricing/index.js +7 -7
  373. package/dist/pricing/index.test.js +8 -8
  374. package/dist/pricing/inventory.js +238 -238
  375. package/dist/pricing/inventory.test.js +188 -188
  376. package/dist/pricing/matrix.js +245 -245
  377. package/dist/pricing/matrix.test.js +437 -437
  378. package/dist/pricing/round.js +29 -29
  379. package/dist/pricing/round.test.js +27 -27
  380. package/dist/pricing/types.js +1 -1
  381. package/dist/pricing/visibility.js +227 -227
  382. package/dist/pricing/visibility.test.js +210 -210
  383. package/dist/request.js +169 -169
  384. package/dist/request.test.js +70 -70
  385. package/dist/test_util.js +17 -17
  386. package/dist/toasts.js +14 -14
  387. package/dist/toasts.test.js +28 -28
  388. package/dist/util/float.js +34 -34
  389. package/dist/util/index.js +3 -3
  390. package/dist/util/query_string.js +13 -13
  391. package/dist/util/query_string.test.js +6 -6
  392. package/dist/util/validation.js +3 -3
  393. package/dist/util/validation.test.js +12 -12
  394. package/dist/uuid.js +8 -8
  395. package/dist/uuid.test.js +11 -11
  396. package/jest.config.js +23 -23
  397. package/package.json +34 -34
  398. package/src/constants/auto_assign_production_on_actions.ts +6 -6
  399. package/src/constants/call_to_actions.test.ts +5 -5
  400. package/src/constants/call_to_actions.ts +14 -14
  401. package/src/constants/discount_types.test.ts +5 -5
  402. package/src/constants/discount_types.ts +5 -5
  403. package/src/constants/domain_types.test.ts +5 -5
  404. package/src/constants/domain_types.ts +12 -12
  405. package/src/constants/errors.ts +32 -32
  406. package/src/constants/event_types.test.ts +5 -5
  407. package/src/constants/event_types.ts +5 -5
  408. package/src/constants/field_types.test.ts +5 -5
  409. package/src/constants/field_types.ts +16 -16
  410. package/src/constants/index.ts +51 -51
  411. package/src/constants/input_types.test.ts +5 -5
  412. package/src/constants/input_types.ts +13 -13
  413. package/src/constants/inventory_status.test.ts +5 -5
  414. package/src/constants/inventory_statuses.ts +6 -6
  415. package/src/constants/invoice_types.test.ts +5 -5
  416. package/src/constants/invoice_types.ts +5 -5
  417. package/src/constants/item_types.test.ts +5 -5
  418. package/src/constants/item_types.ts +5 -5
  419. package/src/constants/job/drafting_status.test.ts +5 -5
  420. package/src/constants/job/drafting_status.ts +7 -7
  421. package/src/constants/job/payment_status.test.ts +5 -5
  422. package/src/constants/job/payment_status.ts +7 -7
  423. package/src/constants/job/production_status.test.ts +5 -5
  424. package/src/constants/job/production_status.ts +12 -12
  425. package/src/constants/job/shipment_status.test.ts +5 -5
  426. package/src/constants/job/shipment_status.ts +11 -11
  427. package/src/constants/job/supply_chain_request_status.test.ts +5 -5
  428. package/src/constants/job/supply_chain_request_status.ts +6 -6
  429. package/src/constants/job_priorities.test.ts +5 -5
  430. package/src/constants/job_priorities.ts +6 -6
  431. package/src/constants/job_status.test.ts +5 -5
  432. package/src/constants/job_status.ts +49 -49
  433. package/src/constants/job_types.test.ts +5 -5
  434. package/src/constants/job_types.ts +16 -16
  435. package/src/constants/notification_sections.test.ts +5 -5
  436. package/src/constants/notification_sections.ts +13 -13
  437. package/src/constants/notification_types.test.ts +5 -5
  438. package/src/constants/notification_types.ts +97 -97
  439. package/src/constants/notification_urgencies.test.ts +5 -5
  440. package/src/constants/notification_urgencies.ts +7 -7
  441. package/src/constants/payment_types.test.ts +5 -5
  442. package/src/constants/payment_types.ts +10 -10
  443. package/src/constants/platform.test.ts +15 -15
  444. package/src/constants/platform.ts +6 -6
  445. package/src/constants/product_types.test.ts +6 -6
  446. package/src/constants/product_types.ts +26 -26
  447. package/src/constants/rights.test.ts +5 -5
  448. package/src/constants/rights.ts +5 -5
  449. package/src/constants/robots_meta_directives.test.ts +5 -5
  450. package/src/constants/robots_meta_directives.ts +11 -11
  451. package/src/constants/roles.test.ts +5 -5
  452. package/src/constants/roles.ts +38 -38
  453. package/src/constants/shipment_companies.test.ts +5 -5
  454. package/src/constants/shipment_companies.ts +19 -19
  455. package/src/constants/shipment_services.test.ts +5 -5
  456. package/src/constants/shipment_services.ts +3 -3
  457. package/src/constants/system_roles.test.ts +5 -5
  458. package/src/constants/system_roles.ts +3 -3
  459. package/src/constants/theme_status.test.ts +5 -5
  460. package/src/constants/theme_status.ts +5 -5
  461. package/src/constants/user_types.test.ts +5 -5
  462. package/src/constants/user_types.ts +17 -17
  463. package/src/constants/white_label_accessibilities.test.ts +5 -5
  464. package/src/constants/white_label_accessibilities.ts +6 -6
  465. package/src/cookie.test.ts +11 -11
  466. package/src/cookie.ts +16 -16
  467. package/src/entities/address.test.ts +7 -7
  468. package/src/entities/address.ts +65 -65
  469. package/src/entities/agent_conversation.test.ts +7 -7
  470. package/src/entities/agent_conversation.ts +39 -39
  471. package/src/entities/agent_skill.test.ts +13 -13
  472. package/src/entities/agent_skill.ts +99 -99
  473. package/src/entities/agent_skill_approval.ts +26 -26
  474. package/src/entities/agent_skill_version.ts +64 -64
  475. package/src/entities/agent_token_analytics.ts +49 -49
  476. package/src/entities/agent_token_usage.test.ts +7 -7
  477. package/src/entities/agent_token_usage.ts +88 -88
  478. package/src/entities/assignment.test.ts +39 -39
  479. package/src/entities/assignment.ts +99 -99
  480. package/src/entities/automatic_payment_relationship.test.ts +8 -8
  481. package/src/entities/automatic_payment_relationship.ts +29 -29
  482. package/src/entities/bank.test.ts +7 -7
  483. package/src/entities/bank.ts +45 -45
  484. package/src/entities/cart.test.ts +50 -50
  485. package/src/entities/cart.ts +99 -96
  486. package/src/entities/cart_item.test.ts +33 -33
  487. package/src/entities/cart_item.ts +85 -85
  488. package/src/entities/cart_shipment_group.ts +21 -21
  489. package/src/entities/cart_shipment_quote.ts +33 -33
  490. package/src/entities/category.test.ts +57 -57
  491. package/src/entities/category.ts +59 -59
  492. package/src/entities/company.test.ts +7 -7
  493. package/src/entities/company.ts +397 -397
  494. package/src/entities/company_invitation.test.ts +7 -7
  495. package/src/entities/company_invitation.ts +33 -33
  496. package/src/entities/country_tax.test.ts +13 -13
  497. package/src/entities/country_tax.ts +46 -46
  498. package/src/entities/discount.test.ts +18 -18
  499. package/src/entities/discount.ts +43 -43
  500. package/src/entities/discount_group.test.ts +7 -7
  501. package/src/entities/discount_group.ts +43 -43
  502. package/src/entities/domain.test.ts +382 -382
  503. package/src/entities/domain.ts +1069 -1063
  504. package/src/entities/domain_chat_settings.test.ts +16 -16
  505. package/src/entities/domain_chat_settings.ts +82 -82
  506. package/src/entities/domain_invitation.test.ts +7 -7
  507. package/src/entities/domain_invitation.ts +36 -36
  508. package/src/entities/domain_tag.test.ts +7 -7
  509. package/src/entities/domain_tag.ts +42 -42
  510. package/src/entities/draft.test.ts +29 -29
  511. package/src/entities/draft.ts +79 -76
  512. package/src/entities/draft_comment.test.ts +7 -7
  513. package/src/entities/draft_comment.ts +63 -60
  514. package/src/entities/draft_preview.test.ts +42 -42
  515. package/src/entities/draft_preview.ts +37 -37
  516. package/src/entities/draft_preview_layer.test.ts +7 -7
  517. package/src/entities/draft_preview_layer.ts +21 -21
  518. package/src/entities/draft_template.test.ts +14 -14
  519. package/src/entities/draft_template.ts +81 -81
  520. package/src/entities/email_address.test.ts +7 -7
  521. package/src/entities/email_address.ts +24 -24
  522. package/src/entities/email_counter.test.ts +7 -7
  523. package/src/entities/email_counter.ts +20 -20
  524. package/src/entities/enrolled_domain.test.ts +7 -7
  525. package/src/entities/enrolled_domain.ts +40 -40
  526. package/src/entities/exchange_rate.test.ts +7 -7
  527. package/src/entities/exchange_rate.ts +22 -22
  528. package/src/entities/file.test.ts +43 -43
  529. package/src/entities/file.ts +165 -165
  530. package/src/entities/internal_tag.test.ts +7 -7
  531. package/src/entities/internal_tag.ts +51 -51
  532. package/src/entities/inventory.test.ts +28 -28
  533. package/src/entities/inventory.ts +63 -63
  534. package/src/entities/inventory_group.test.ts +7 -7
  535. package/src/entities/inventory_group.ts +36 -36
  536. package/src/entities/inventory_unit_variation.test.ts +7 -7
  537. package/src/entities/inventory_unit_variation.ts +29 -29
  538. package/src/entities/invoice.test.ts +43 -43
  539. package/src/entities/invoice.ts +189 -186
  540. package/src/entities/item.test.ts +19 -19
  541. package/src/entities/item.ts +59 -59
  542. package/src/entities/job.test.ts +95 -95
  543. package/src/entities/job.ts +398 -395
  544. package/src/entities/job_comment.test.ts +7 -7
  545. package/src/entities/job_comment.ts +53 -50
  546. package/src/entities/job_note.ts +40 -40
  547. package/src/entities/job_operation_log.test.ts +7 -7
  548. package/src/entities/job_operation_log.ts +41 -41
  549. package/src/entities/matching_inventory.ts +29 -29
  550. package/src/entities/notification.test.ts +58 -58
  551. package/src/entities/notification.ts +106 -106
  552. package/src/entities/payment.test.ts +19 -19
  553. package/src/entities/payment.ts +65 -65
  554. package/src/entities/payment_device.test.ts +7 -7
  555. package/src/entities/payment_device.ts +30 -30
  556. package/src/entities/phone_number.test.ts +7 -7
  557. package/src/entities/phone_number.ts +36 -36
  558. package/src/entities/product.test.ts +772 -772
  559. package/src/entities/product.ts +480 -480
  560. package/src/entities/product_form.ts +51 -51
  561. package/src/entities/product_form_version.ts +51 -51
  562. package/src/entities/product_review.ts +221 -221
  563. package/src/entities/production_comment.test.ts +7 -7
  564. package/src/entities/production_comment.ts +53 -50
  565. package/src/entities/quote.test.ts +98 -98
  566. package/src/entities/quote.ts +140 -140
  567. package/src/entities/quote_item.test.ts +50 -50
  568. package/src/entities/quote_item.ts +71 -71
  569. package/src/entities/reminder.test.ts +16 -16
  570. package/src/entities/reminder.ts +74 -74
  571. package/src/entities/session.test.ts +7 -7
  572. package/src/entities/session.ts +28 -28
  573. package/src/entities/shipment.test.ts +24 -24
  574. package/src/entities/shipment.ts +196 -193
  575. package/src/entities/shipment_item.test.ts +7 -7
  576. package/src/entities/shipment_item.ts +15 -15
  577. package/src/entities/shipment_item_fulfillment.test.ts +8 -8
  578. package/src/entities/shipment_item_fulfillment.ts +15 -15
  579. package/src/entities/shipment_log.ts +37 -37
  580. package/src/entities/shipment_method.test.ts +7 -7
  581. package/src/entities/shipment_method.ts +61 -61
  582. package/src/entities/shipment_method_variation.test.ts +7 -7
  583. package/src/entities/shipment_method_variation.ts +39 -39
  584. package/src/entities/short_url.test.ts +7 -7
  585. package/src/entities/short_url.ts +36 -36
  586. package/src/entities/subscription_plan.test.ts +7 -7
  587. package/src/entities/subscription_plan.ts +73 -73
  588. package/src/entities/supply_domain.test.ts +7 -7
  589. package/src/entities/supply_domain.ts +27 -27
  590. package/src/entities/support_conversation.test.ts +7 -7
  591. package/src/entities/support_conversation.ts +65 -65
  592. package/src/entities/support_message.test.ts +7 -7
  593. package/src/entities/support_message.ts +30 -30
  594. package/src/entities/system_role.test.ts +7 -7
  595. package/src/entities/system_role.ts +17 -17
  596. package/src/entities/theme.test.ts +38 -38
  597. package/src/entities/theme.ts +82 -82
  598. package/src/entities/theme_css_setting.test.ts +7 -7
  599. package/src/entities/theme_css_setting.ts +23 -23
  600. package/src/entities/user.test.ts +154 -154
  601. package/src/entities/user.ts +428 -428
  602. package/src/entities/user_company.test.ts +7 -7
  603. package/src/entities/user_company.ts +27 -27
  604. package/src/entities/variation.test.ts +7 -7
  605. package/src/entities/variation.ts +64 -64
  606. package/src/entities/variation_field.test.ts +76 -76
  607. package/src/entities/variation_field.ts +268 -268
  608. package/src/entities/variation_fields_option.test.ts +46 -46
  609. package/src/entities/variation_fields_option.ts +107 -107
  610. package/src/entities/variation_option.test.ts +7 -7
  611. package/src/entities/variation_option.ts +58 -58
  612. package/src/entities/variations_group.test.ts +7 -7
  613. package/src/entities/variations_group.ts +41 -41
  614. package/src/entity.ts +1094 -1094
  615. package/src/index.ts +189 -189
  616. package/src/merchi.test.ts +25 -25
  617. package/src/merchi.ts +445 -445
  618. package/src/pricing/__fixtures__/conditional_field_hidden.json +111 -111
  619. package/src/pricing/__fixtures__/conditional_field_visible.json +112 -112
  620. package/src/pricing/__fixtures__/group_product.json +129 -129
  621. package/src/pricing/__fixtures__/non_selectable_number_field.json +107 -107
  622. package/src/pricing/__fixtures__/quantity_break_discount.json +103 -103
  623. package/src/pricing/__fixtures__/simple_selectable_field.json +109 -109
  624. package/src/pricing/discount.test.ts +47 -47
  625. package/src/pricing/discount.ts +17 -17
  626. package/src/pricing/estimate.test.ts +486 -486
  627. package/src/pricing/estimate.ts +310 -310
  628. package/src/pricing/golden.test.ts +51 -51
  629. package/src/pricing/index.test.ts +9 -9
  630. package/src/pricing/index.ts +7 -7
  631. package/src/pricing/inventory.test.ts +197 -197
  632. package/src/pricing/inventory.ts +89 -89
  633. package/src/pricing/matrix.test.ts +553 -553
  634. package/src/pricing/matrix.ts +217 -217
  635. package/src/pricing/round.test.ts +31 -31
  636. package/src/pricing/round.ts +27 -27
  637. package/src/pricing/types.ts +140 -140
  638. package/src/pricing/visibility.test.ts +223 -223
  639. package/src/pricing/visibility.ts +111 -111
  640. package/src/request.test.ts +79 -79
  641. package/src/request.ts +196 -196
  642. package/src/test_util.ts +18 -18
  643. package/src/toasts.test.ts +38 -38
  644. package/src/toasts.ts +34 -34
  645. package/src/util/float.ts +12 -12
  646. package/src/util/index.ts +7 -7
  647. package/src/util/query_string.test.ts +7 -7
  648. package/src/util/query_string.ts +13 -13
  649. package/src/util/validation.test.ts +16 -16
  650. package/src/util/validation.ts +2 -2
  651. package/src/uuid.test.ts +15 -15
  652. package/src/uuid.ts +8 -8
  653. package/tsconfig.json +29 -29
  654. package/coverage/lcov-report/discount.ts.html +0 -136
  655. package/coverage/lcov-report/estimate.ts.html +0 -1015
  656. package/coverage/lcov-report/index.ts.html +0 -106
  657. package/coverage/lcov-report/inventory.ts.html +0 -352
  658. package/coverage/lcov-report/matrix.ts.html +0 -736
  659. package/coverage/lcov-report/round.ts.html +0 -166
  660. package/coverage/lcov-report/src/constants/theme_foundations.ts.html +0 -103
  661. package/coverage/lcov-report/src/entities/component.ts.html +0 -361
  662. package/coverage/lcov-report/src/entities/component_tag.ts.html +0 -136
  663. package/coverage/lcov-report/src/entities/component_version.ts.html +0 -175
  664. package/coverage/lcov-report/src/entities/menu.ts.html +0 -175
  665. package/coverage/lcov-report/src/entities/menu_item.ts.html +0 -172
  666. package/coverage/lcov-report/src/entities/page.ts.html +0 -181
  667. package/coverage/lcov-report/src/entities/seo_domain_page.ts.html +0 -184
  668. package/coverage/lcov-report/src/pricing/matrix.ts.html +0 -736
  669. package/coverage/lcov-report/visibility.ts.html +0 -418
  670. package/dist/constants/theme_foundations.js +0 -7
  671. package/dist/constants/theme_foundations.test.js +0 -4
  672. package/dist/entities/backup.js +0 -45
  673. package/dist/entities/backup.test.js +0 -6
  674. package/dist/entities/company_invoice_settings.js +0 -80
  675. package/dist/entities/company_invoice_settings_version.js +0 -64
  676. package/dist/entities/component.js +0 -141
  677. package/dist/entities/component.test.js +0 -12
  678. package/dist/entities/component_tag.js +0 -49
  679. package/dist/entities/component_tag.test.js +0 -6
  680. package/dist/entities/component_version.js +0 -65
  681. package/dist/entities/component_version.test.js +0 -6
  682. package/dist/entities/invoice_template.js +0 -60
  683. package/dist/entities/invoice_template_version.js +0 -52
  684. package/dist/entities/menu.js +0 -65
  685. package/dist/entities/menu.test.js +0 -6
  686. package/dist/entities/menu_item.js +0 -65
  687. package/dist/entities/menu_item.test.js +0 -6
  688. package/dist/entities/page.js +0 -69
  689. package/dist/entities/page.test.js +0 -6
  690. package/dist/entities/seo_domain_page.js +0 -70
  691. package/dist/entities/seo_domain_page.test.js +0 -6
  692. package/yarn-error.log +0 -4718
package/.eslintrc.cjs CHANGED
@@ -1,43 +1,43 @@
1
- module.exports = {
2
- 'parser': '@typescript-eslint/parser',
3
- 'plugins': ['@typescript-eslint'],
4
- 'env': {
5
- 'browser': true,
6
- 'es6': true,
7
- 'jest': true
8
- },
9
- 'extends': ['eslint:recommended',
10
- 'plugin:@typescript-eslint/eslint-recommended',
11
- 'plugin:@typescript-eslint/recommended'],
12
- 'globals': {
13
- 'Atomics': 'readonly',
14
- 'SharedArrayBuffer': 'readonly',
15
- 'global': 'writable'
16
- },
17
- 'parserOptions': {
18
- 'ecmaVersion': 2018,
19
- 'sourceType': 'module'
20
- },
21
- 'rules': {
22
- 'indent': 'off',
23
- '@typescript-eslint/indent': ['error', 2],
24
- '@typescript-eslint/explicit-function-return-type': 'off',
25
- '@typescript-eslint/no-explicit-any': 'off',
26
- '@typescript-eslint/no-non-null-assertion': 'off',
27
- '@typescript-eslint/no-empty-function': 'off',
28
- '@typescript-eslint/no-this-alias': 'off',
29
- '@typescript-eslint/ban-types': 'off',
30
- 'linebreak-style': [
31
- 'error',
32
- 'unix'
33
- ],
34
- 'quotes': [
35
- 'error',
36
- 'single'
37
- ],
38
- 'semi': [
39
- 'error',
40
- 'always'
41
- ]
42
- }
43
- };
1
+ module.exports = {
2
+ 'parser': '@typescript-eslint/parser',
3
+ 'plugins': ['@typescript-eslint'],
4
+ 'env': {
5
+ 'browser': true,
6
+ 'es6': true,
7
+ 'jest': true
8
+ },
9
+ 'extends': ['eslint:recommended',
10
+ 'plugin:@typescript-eslint/eslint-recommended',
11
+ 'plugin:@typescript-eslint/recommended'],
12
+ 'globals': {
13
+ 'Atomics': 'readonly',
14
+ 'SharedArrayBuffer': 'readonly',
15
+ 'global': 'writable'
16
+ },
17
+ 'parserOptions': {
18
+ 'ecmaVersion': 2018,
19
+ 'sourceType': 'module'
20
+ },
21
+ 'rules': {
22
+ 'indent': 'off',
23
+ '@typescript-eslint/indent': ['error', 2],
24
+ '@typescript-eslint/explicit-function-return-type': 'off',
25
+ '@typescript-eslint/no-explicit-any': 'off',
26
+ '@typescript-eslint/no-non-null-assertion': 'off',
27
+ '@typescript-eslint/no-empty-function': 'off',
28
+ '@typescript-eslint/no-this-alias': 'off',
29
+ '@typescript-eslint/ban-types': 'off',
30
+ 'linebreak-style': [
31
+ 'error',
32
+ 'unix'
33
+ ],
34
+ 'quotes': [
35
+ 'error',
36
+ 'single'
37
+ ],
38
+ 'semi': [
39
+ 'error',
40
+ 'always'
41
+ ]
42
+ }
43
+ };
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Merchi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Merchi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,244 +1,244 @@
1
- # Merchi TypeScript SDK
2
-
3
- A TypeScript SDK for interacting with the Merchi API.
4
-
5
- [![npm version](https://img.shields.io/npm/v/merchi_sdk_ts.svg)](https://www.npmjs.com/package/merchi_sdk_ts)
6
- [![License: GPL-3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
7
-
8
- ## Table of Contents
9
-
10
- - [Installation](#installation)
11
- - [Quick Start](#quick-start)
12
- - [Configuration](#configuration)
13
- - [Authentication](#authentication)
14
- - [Basic Usage](#basic-usage)
15
- - [Entity Operations](#entity-operations)
16
- - [Embedding Related Entities](#embedding-related-entities)
17
- - [Available Entities](#available-entities)
18
- - [Examples](#examples)
19
- - [TypeScript Support](#typescript-support)
20
- - [License](#license)
21
-
22
- ## Installation
23
-
24
- ```bash
25
- # Using npm
26
- npm install merchi_sdk_ts
27
-
28
- # Using yarn
29
- yarn add merchi_sdk_ts
30
- ```
31
-
32
- ## Quick Start
33
-
34
- ```typescript
35
- import { Merchi, Product } from 'merchi_sdk_ts';
36
-
37
- // Initialize the SDK
38
- const merchi = new Merchi();
39
-
40
- // Fetch a product by ID
41
- Product.get(123).then(product => {
42
- console.log(product.name);
43
- });
44
- ```
45
-
46
- ## Configuration
47
-
48
- The SDK by default is set up to make requests to the Merchi production server at `https://api.merchi.co/v6/`.
49
-
50
- You can customize the API endpoint by:
51
-
52
- 1. Setting `process.env.MERCHI_BACKEND_URI` in your Node.js environment.
53
- 2. Setting `window.merchiBackendUri` in the browser.
54
- 3. Passing the `backendUri` directly to the `Merchi` constructor (highest precedence).
55
-
56
- The SDK will look for these in the order of 3, 2, 1, and finally use the default production URL if none are found.
57
- The API version (e.g., `/v6/`) will be appended automatically if not included in your custom URI, assuming the URI ends with the base domain (e.g. `https://custom.merchi.co`). If your custom URI already includes a path (e.g., `https://custom.merchi.co/api/`), ensure it ends with a trailing slash for the version to be appended correctly (e.g., `https://custom.merchi.co/api/v6/`).
58
-
59
- **Example: Passing `backendUri` to the constructor**
60
-
61
- ```typescript
62
- import { Merchi } from 'merchi_sdk_ts';
63
-
64
- // Initialize the SDK with a custom backend URI
65
- // This URI should be the base path to your Merchi backend instance.
66
- // The API version (e.g., /v6/) will be appended.
67
- const customBackend = 'https://my-custom-merchi-instance.com/';
68
- const merchi = new Merchi(undefined, undefined, undefined, undefined, customBackend);
69
-
70
- // If your custom URI already includes a specific path and you want to control the full endpoint:
71
- const specificCustomBackend = 'https://my-custom-merchi-instance.com/api/custom_version/';
72
- const merchiSpecific = new Merchi(undefined, undefined, undefined, undefined, specificCustomBackend);
73
-
74
- // Now, all API calls made using this 'merchi' or 'merchiSpecific' instance
75
- // will be directed to your specified backend.
76
- // For example:
77
- // merchi.Product.get(1) will call https://my-custom-merchi-instance.com/v6/products/1/
78
- // merchiSpecific.Product.get(1) will call https://my-custom-merchi-instance.com/api/custom_version/products/1/
79
- ```
80
-
81
- ## Authentication
82
-
83
- The SDK supports several authentication methods:
84
-
85
- ```typescript
86
- // Session token authentication (most common)
87
- const merchi = new Merchi('your-session-token');
88
-
89
- // Alternative methods
90
- const merchi = new Merchi(
91
- 'your-session-token', // Session token
92
- 'your-client-token', // Client token
93
- 'your-invoice-token', // Invoice token
94
- 'your-cart-token' // Cart token
95
- );
96
-
97
- // The SDK will also attempt to read session_token from cookies
98
- // if no token is provided
99
- ```
100
-
101
- ## Basic Usage
102
-
103
- ### Entity Operations
104
-
105
- Each entity supports standard CRUD operations:
106
-
107
- ```typescript
108
- // Fetch a single entity
109
- Product.get(123).then(product => {
110
- console.log(product);
111
- });
112
-
113
- // List entities with filtering
114
- Product.list({
115
- limit: 10,
116
- offset: 0,
117
- q: 'search-term'
118
- }).then(response => {
119
- console.log(response.items); // Array of products
120
- console.log(response.metadata); // Metadata including count, limit, offset
121
- });
122
-
123
- // Create a new entity
124
- const product = new Product();
125
- product.name = 'New Product';
126
- product.description = 'Product description';
127
- product.create().then(newProduct => {
128
- console.log(newProduct.id);
129
- });
130
-
131
- // Update an entity
132
- product.name = 'Updated Product Name';
133
- product.save().then(updatedProduct => {
134
- console.log(updatedProduct);
135
- });
136
-
137
- // Delete an entity
138
- product.delete().then(() => {
139
- console.log('Product deleted');
140
- });
141
- ```
142
-
143
- ### Embedding Related Entities
144
-
145
- You can request related entities be included in responses:
146
-
147
- ```typescript
148
- Product.get(123, {
149
- embed: {
150
- domain: {},
151
- variations: {
152
- variationFields: {}
153
- }
154
- }
155
- }).then(product => {
156
- console.log(product.domain); // Domain entity is included
157
- console.log(product.variations); // Variations are included
158
- console.log(product.variations[0].variationFields); // Fields are included
159
- });
160
- ```
161
-
162
- ## Available Entities
163
-
164
- The SDK provides access to all Merchi entities, including but not limited to:
165
-
166
- - User, Company, Domain
167
- - Product, Category, Variation
168
- - Cart, CartItem
169
- - Job, Assignment, Invoice
170
- - File, Draft, DraftTemplate
171
- - Payment, Shipment
172
- - And many more...
173
-
174
- Each entity maps directly to the corresponding API endpoint and data structure.
175
-
176
- ## Examples
177
-
178
- ### Working with Products
179
-
180
- ```typescript
181
- import { Merchi, Product } from 'merchi_sdk_ts';
182
-
183
- // Initialize Merchi
184
- const merchi = new Merchi('your-session-token');
185
-
186
- // Create a new product
187
- const product = new Product();
188
- product.name = 'Custom T-Shirt';
189
- product.description = 'High-quality custom printed t-shirt';
190
- product.public = true;
191
-
192
- product.create().then(newProduct => {
193
- console.log(`Created product with ID: ${newProduct.id}`);
194
- });
195
- ```
196
-
197
- ### Managing a Cart
198
-
199
- ```typescript
200
- import { Merchi, Cart, CartItem } from 'merchi_sdk_ts';
201
-
202
- // Initialize Merchi
203
- const merchi = new Merchi('your-session-token');
204
-
205
- // Create a new cart
206
- const cart = new Cart();
207
- cart.create().then(newCart => {
208
- // Add an item to the cart
209
- const cartItem = new CartItem();
210
- cartItem.productId = 123;
211
- cartItem.quantity = 2;
212
- cartItem.cartId = newCart.id;
213
-
214
- return cartItem.create();
215
- }).then(newCartItem => {
216
- console.log('Item added to cart!');
217
- });
218
- ```
219
-
220
- ## TypeScript Support
221
-
222
- This SDK is built with TypeScript and provides full type definitions for all entities and operations.
223
-
224
- ```typescript
225
- import { Product, EmbedDescriptor } from 'merchi_sdk_ts';
226
-
227
- // TypeScript will provide intellisense for all properties
228
- const product = new Product();
229
- product.name = 'New Product';
230
-
231
- // Type checking for embed options
232
- const embedOptions: EmbedDescriptor = {
233
- domain: {},
234
- variations: {
235
- variationFields: {}
236
- }
237
- };
238
-
239
- Product.get(123, { embed: embedOptions });
240
- ```
241
-
242
- ## License
243
-
244
- This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
1
+ # Merchi TypeScript SDK
2
+
3
+ A TypeScript SDK for interacting with the Merchi API.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/merchi_sdk_ts.svg)](https://www.npmjs.com/package/merchi_sdk_ts)
6
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Quick Start](#quick-start)
12
+ - [Configuration](#configuration)
13
+ - [Authentication](#authentication)
14
+ - [Basic Usage](#basic-usage)
15
+ - [Entity Operations](#entity-operations)
16
+ - [Embedding Related Entities](#embedding-related-entities)
17
+ - [Available Entities](#available-entities)
18
+ - [Examples](#examples)
19
+ - [TypeScript Support](#typescript-support)
20
+ - [License](#license)
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ # Using npm
26
+ npm install merchi_sdk_ts
27
+
28
+ # Using yarn
29
+ yarn add merchi_sdk_ts
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```typescript
35
+ import { Merchi, Product } from 'merchi_sdk_ts';
36
+
37
+ // Initialize the SDK
38
+ const merchi = new Merchi();
39
+
40
+ // Fetch a product by ID
41
+ Product.get(123).then(product => {
42
+ console.log(product.name);
43
+ });
44
+ ```
45
+
46
+ ## Configuration
47
+
48
+ The SDK by default is set up to make requests to the Merchi production server at `https://api.merchi.co/v6/`.
49
+
50
+ You can customize the API endpoint by:
51
+
52
+ 1. Setting `process.env.MERCHI_BACKEND_URI` in your Node.js environment.
53
+ 2. Setting `window.merchiBackendUri` in the browser.
54
+ 3. Passing the `backendUri` directly to the `Merchi` constructor (highest precedence).
55
+
56
+ The SDK will look for these in the order of 3, 2, 1, and finally use the default production URL if none are found.
57
+ The API version (e.g., `/v6/`) will be appended automatically if not included in your custom URI, assuming the URI ends with the base domain (e.g. `https://custom.merchi.co`). If your custom URI already includes a path (e.g., `https://custom.merchi.co/api/`), ensure it ends with a trailing slash for the version to be appended correctly (e.g., `https://custom.merchi.co/api/v6/`).
58
+
59
+ **Example: Passing `backendUri` to the constructor**
60
+
61
+ ```typescript
62
+ import { Merchi } from 'merchi_sdk_ts';
63
+
64
+ // Initialize the SDK with a custom backend URI
65
+ // This URI should be the base path to your Merchi backend instance.
66
+ // The API version (e.g., /v6/) will be appended.
67
+ const customBackend = 'https://my-custom-merchi-instance.com/';
68
+ const merchi = new Merchi(undefined, undefined, undefined, undefined, customBackend);
69
+
70
+ // If your custom URI already includes a specific path and you want to control the full endpoint:
71
+ const specificCustomBackend = 'https://my-custom-merchi-instance.com/api/custom_version/';
72
+ const merchiSpecific = new Merchi(undefined, undefined, undefined, undefined, specificCustomBackend);
73
+
74
+ // Now, all API calls made using this 'merchi' or 'merchiSpecific' instance
75
+ // will be directed to your specified backend.
76
+ // For example:
77
+ // merchi.Product.get(1) will call https://my-custom-merchi-instance.com/v6/products/1/
78
+ // merchiSpecific.Product.get(1) will call https://my-custom-merchi-instance.com/api/custom_version/products/1/
79
+ ```
80
+
81
+ ## Authentication
82
+
83
+ The SDK supports several authentication methods:
84
+
85
+ ```typescript
86
+ // Session token authentication (most common)
87
+ const merchi = new Merchi('your-session-token');
88
+
89
+ // Alternative methods
90
+ const merchi = new Merchi(
91
+ 'your-session-token', // Session token
92
+ 'your-client-token', // Client token
93
+ 'your-invoice-token', // Invoice token
94
+ 'your-cart-token' // Cart token
95
+ );
96
+
97
+ // The SDK will also attempt to read session_token from cookies
98
+ // if no token is provided
99
+ ```
100
+
101
+ ## Basic Usage
102
+
103
+ ### Entity Operations
104
+
105
+ Each entity supports standard CRUD operations:
106
+
107
+ ```typescript
108
+ // Fetch a single entity
109
+ Product.get(123).then(product => {
110
+ console.log(product);
111
+ });
112
+
113
+ // List entities with filtering
114
+ Product.list({
115
+ limit: 10,
116
+ offset: 0,
117
+ q: 'search-term'
118
+ }).then(response => {
119
+ console.log(response.items); // Array of products
120
+ console.log(response.metadata); // Metadata including count, limit, offset
121
+ });
122
+
123
+ // Create a new entity
124
+ const product = new Product();
125
+ product.name = 'New Product';
126
+ product.description = 'Product description';
127
+ product.create().then(newProduct => {
128
+ console.log(newProduct.id);
129
+ });
130
+
131
+ // Update an entity
132
+ product.name = 'Updated Product Name';
133
+ product.save().then(updatedProduct => {
134
+ console.log(updatedProduct);
135
+ });
136
+
137
+ // Delete an entity
138
+ product.delete().then(() => {
139
+ console.log('Product deleted');
140
+ });
141
+ ```
142
+
143
+ ### Embedding Related Entities
144
+
145
+ You can request related entities be included in responses:
146
+
147
+ ```typescript
148
+ Product.get(123, {
149
+ embed: {
150
+ domain: {},
151
+ variations: {
152
+ variationFields: {}
153
+ }
154
+ }
155
+ }).then(product => {
156
+ console.log(product.domain); // Domain entity is included
157
+ console.log(product.variations); // Variations are included
158
+ console.log(product.variations[0].variationFields); // Fields are included
159
+ });
160
+ ```
161
+
162
+ ## Available Entities
163
+
164
+ The SDK provides access to all Merchi entities, including but not limited to:
165
+
166
+ - User, Company, Domain
167
+ - Product, Category, Variation
168
+ - Cart, CartItem
169
+ - Job, Assignment, Invoice
170
+ - File, Draft, DraftTemplate
171
+ - Payment, Shipment
172
+ - And many more...
173
+
174
+ Each entity maps directly to the corresponding API endpoint and data structure.
175
+
176
+ ## Examples
177
+
178
+ ### Working with Products
179
+
180
+ ```typescript
181
+ import { Merchi, Product } from 'merchi_sdk_ts';
182
+
183
+ // Initialize Merchi
184
+ const merchi = new Merchi('your-session-token');
185
+
186
+ // Create a new product
187
+ const product = new Product();
188
+ product.name = 'Custom T-Shirt';
189
+ product.description = 'High-quality custom printed t-shirt';
190
+ product.public = true;
191
+
192
+ product.create().then(newProduct => {
193
+ console.log(`Created product with ID: ${newProduct.id}`);
194
+ });
195
+ ```
196
+
197
+ ### Managing a Cart
198
+
199
+ ```typescript
200
+ import { Merchi, Cart, CartItem } from 'merchi_sdk_ts';
201
+
202
+ // Initialize Merchi
203
+ const merchi = new Merchi('your-session-token');
204
+
205
+ // Create a new cart
206
+ const cart = new Cart();
207
+ cart.create().then(newCart => {
208
+ // Add an item to the cart
209
+ const cartItem = new CartItem();
210
+ cartItem.productId = 123;
211
+ cartItem.quantity = 2;
212
+ cartItem.cartId = newCart.id;
213
+
214
+ return cartItem.create();
215
+ }).then(newCartItem => {
216
+ console.log('Item added to cart!');
217
+ });
218
+ ```
219
+
220
+ ## TypeScript Support
221
+
222
+ This SDK is built with TypeScript and provides full type definitions for all entities and operations.
223
+
224
+ ```typescript
225
+ import { Product, EmbedDescriptor } from 'merchi_sdk_ts';
226
+
227
+ // TypeScript will provide intellisense for all properties
228
+ const product = new Product();
229
+ product.name = 'New Product';
230
+
231
+ // Type checking for embed options
232
+ const embedOptions: EmbedDescriptor = {
233
+ domain: {},
234
+ variations: {
235
+ variationFields: {}
236
+ }
237
+ };
238
+
239
+ Product.get(123, { embed: embedOptions });
240
+ ```
241
+
242
+ ## License
243
+
244
+ This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.