@webbycrown/webbycommerce 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +21 -3
  2. package/admin/app.js +3 -0
  3. package/admin/jsconfig.json +20 -0
  4. package/admin/src/components/ApiCollectionsContent.jsx +4626 -0
  5. package/admin/src/components/CompareContent.jsx +300 -0
  6. package/admin/src/components/ConfigureContent.jsx +407 -0
  7. package/admin/src/components/Initializer.jsx +64 -0
  8. package/admin/src/components/LoginRegisterContent.jsx +280 -0
  9. package/admin/src/components/PluginIcon.jsx +6 -0
  10. package/admin/src/components/ShippingTypeContent.jsx +230 -0
  11. package/admin/src/components/SmtpContent.jsx +316 -0
  12. package/admin/src/components/WishlistContent.jsx +273 -0
  13. package/admin/src/index.js +81 -0
  14. package/admin/src/pages/ApiCollections.jsx +169 -0
  15. package/admin/src/pages/Configure.jsx +55 -0
  16. package/admin/src/pages/Settings.jsx +93 -0
  17. package/admin/src/pluginId.js +4 -0
  18. package/{dist/_chunks/en-CiQ97iC8.js → admin/src/translations/en.json} +712 -574
  19. package/bin/setup.js +50 -3
  20. package/package.json +14 -13
  21. package/server/bootstrap.js +3 -0
  22. package/server/register.js +3 -0
  23. package/server/src/bootstrap.js +3826 -0
  24. package/server/src/components/content-block.json +37 -0
  25. package/server/src/components/shipping-zone-location.json +27 -0
  26. package/server/src/config/index.js +7 -0
  27. package/server/src/content-types/address/index.js +7 -0
  28. package/server/src/content-types/address/schema.json +74 -0
  29. package/server/src/content-types/cart/index.js +61 -0
  30. package/server/src/content-types/cart-item/index.js +79 -0
  31. package/server/src/content-types/compare.js +73 -0
  32. package/server/src/content-types/coupon/index.js +7 -0
  33. package/server/src/content-types/coupon/schema.json +67 -0
  34. package/server/src/content-types/index.js +42 -0
  35. package/server/src/content-types/order/index.js +7 -0
  36. package/server/src/content-types/order/schema.json +121 -0
  37. package/server/src/content-types/payment-transaction/index.js +7 -0
  38. package/server/src/content-types/payment-transaction/schema.json +73 -0
  39. package/server/src/content-types/product/index.js +7 -0
  40. package/server/src/content-types/product/schema.json +104 -0
  41. package/server/src/content-types/product-attribute/index.js +7 -0
  42. package/server/src/content-types/product-attribute/schema.json +80 -0
  43. package/server/src/content-types/product-attribute-value/index.js +7 -0
  44. package/server/src/content-types/product-attribute-value/schema.json +52 -0
  45. package/server/src/content-types/product-category/index.js +7 -0
  46. package/server/src/content-types/product-category/schema.json +54 -0
  47. package/server/src/content-types/product-tag/index.js +7 -0
  48. package/server/src/content-types/product-tag/schema.json +38 -0
  49. package/server/src/content-types/product-variation/index.js +7 -0
  50. package/server/src/content-types/product-variation/schema.json +74 -0
  51. package/server/src/content-types/shipping-method/index.js +7 -0
  52. package/server/src/content-types/shipping-method/schema.json +91 -0
  53. package/server/src/content-types/shipping-rate/index.js +7 -0
  54. package/server/src/content-types/shipping-rate/schema.json +73 -0
  55. package/server/src/content-types/shipping-rule/index.js +7 -0
  56. package/server/src/content-types/shipping-rule/schema.json +84 -0
  57. package/server/src/content-types/shipping-zone/index.js +7 -0
  58. package/server/src/content-types/shipping-zone/schema.json +57 -0
  59. package/server/src/content-types/wishlist.js +66 -0
  60. package/server/src/controllers/address.js +374 -0
  61. package/server/src/controllers/auth.js +1409 -0
  62. package/server/src/controllers/cart.js +337 -0
  63. package/server/src/controllers/category.js +388 -0
  64. package/server/src/controllers/compare.js +246 -0
  65. package/server/src/controllers/controller.js +168 -0
  66. package/server/src/controllers/ecommerce.js +20 -0
  67. package/server/src/controllers/index.js +34 -0
  68. package/server/src/controllers/order.js +1100 -0
  69. package/server/src/controllers/payment.js +243 -0
  70. package/server/src/controllers/product.js +1006 -0
  71. package/server/src/controllers/productTag.js +370 -0
  72. package/server/src/controllers/productVariation.js +181 -0
  73. package/server/src/controllers/shipping.js +1046 -0
  74. package/server/src/controllers/wishlist.js +332 -0
  75. package/server/src/destroy.js +6 -0
  76. package/server/src/index.js +26 -0
  77. package/server/src/middlewares/index.js +4 -0
  78. package/server/src/policies/index.js +4 -0
  79. package/server/src/register.js +67 -0
  80. package/server/src/routes/index.js +1130 -0
  81. package/server/src/services/cart.js +531 -0
  82. package/server/src/services/compare.js +300 -0
  83. package/server/src/services/index.js +16 -0
  84. package/server/src/services/service.js +19 -0
  85. package/server/src/services/shipping.js +513 -0
  86. package/server/src/services/wishlist.js +238 -0
  87. package/server/src/utils/check-ecommerce-permission.js +204 -0
  88. package/server/src/utils/extend-user-schema.js +161 -0
  89. package/server/src/utils/seed-data.js +639 -0
  90. package/server/src/utils/send-email.js +98 -0
  91. package/strapi-server.js +1 -6
  92. package/dist/_chunks/Settings-Bg2JyQ4c.js +0 -31518
  93. package/dist/_chunks/Settings-BonPzbwr.mjs +0 -31499
  94. package/dist/_chunks/en-DE15m4xZ.mjs +0 -574
  95. package/dist/_chunks/index-BWVy9o1d.mjs +0 -128
  96. package/dist/_chunks/index-NRuOdjd7.js +0 -127
  97. package/dist/admin/index.js +0 -3
  98. package/dist/admin/index.mjs +0 -4
  99. package/dist/robots.txt +0 -3
  100. package/dist/server/index.js +0 -27336
  101. package/dist/uploads/.gitkeep +0 -0
  102. package/dist/uploads/accessories_category_2a5631094b.jpeg +0 -0
  103. package/dist/uploads/beauty_personal_care_category_57f8a8f1e3.jpeg +0 -0
  104. package/dist/uploads/books_category_a9a253eada.jpeg +0 -0
  105. package/dist/uploads/classic_cotton_tshirt_1_cd713425f6.png +0 -0
  106. package/dist/uploads/clothing_category_d5c60ef07b.jpeg +0 -0
  107. package/dist/uploads/daviddoe_strapi_adbcd41787.jpeg +0 -0
  108. package/dist/uploads/electronics_category_fc3e5ef571.jpeg +0 -0
  109. package/dist/uploads/ergonomic_office_chair_1_c751cffb07.png +0 -0
  110. package/dist/uploads/home_garden_category_4f6eb3f8d6.jpeg +0 -0
  111. package/dist/uploads/istockphoto_1188462138_612x612_11f295b9c0.jpg +0 -0
  112. package/dist/uploads/istockphoto_1188462138_612x612_396fb272fd.jpg +0 -0
  113. package/dist/uploads/large_daviddoe_strapi_adbcd41787.jpeg +0 -0
  114. package/dist/uploads/leather_travel_backpack_1_238bc1ae4d.png +0 -0
  115. package/dist/uploads/mechanical_keyboard_pro_1_0cd391a6ac.png +0 -0
  116. package/dist/uploads/medium_classic_cotton_tshirt_1_cd713425f6.png +0 -0
  117. package/dist/uploads/medium_daviddoe_strapi_adbcd41787.jpeg +0 -0
  118. package/dist/uploads/medium_ergonomic_office_chair_1_c751cffb07.png +0 -0
  119. package/dist/uploads/medium_leather_travel_backpack_1_238bc1ae4d.png +0 -0
  120. package/dist/uploads/medium_mechanical_keyboard_pro_1_0cd391a6ac.png +0 -0
  121. package/dist/uploads/medium_smart_watch_series_5_1_cdc2511fb7.png +0 -0
  122. package/dist/uploads/medium_smartphone_x_pro_1_c3f0cbd080.png +0 -0
  123. package/dist/uploads/medium_the_great_gatsby_special_1_2e7c76d997.png +0 -0
  124. package/dist/uploads/medium_wireless_headphones_1_fa75cd50c3.png +0 -0
  125. package/dist/uploads/medium_yoga_mat_premium_1_01f9a3b5fa.png +0 -0
  126. package/dist/uploads/predictive_maintenance_icons_industry_automation_600nw_2685943461_e18a8aa3b0.webp +0 -0
  127. package/dist/uploads/small_classic_cotton_tshirt_1_cd713425f6.png +0 -0
  128. package/dist/uploads/small_daviddoe_strapi_adbcd41787.jpeg +0 -0
  129. package/dist/uploads/small_ergonomic_office_chair_1_c751cffb07.png +0 -0
  130. package/dist/uploads/small_leather_travel_backpack_1_238bc1ae4d.png +0 -0
  131. package/dist/uploads/small_mechanical_keyboard_pro_1_0cd391a6ac.png +0 -0
  132. package/dist/uploads/small_smart_watch_series_5_1_cdc2511fb7.png +0 -0
  133. package/dist/uploads/small_smartphone_x_pro_1_c3f0cbd080.png +0 -0
  134. package/dist/uploads/small_the_great_gatsby_special_1_2e7c76d997.png +0 -0
  135. package/dist/uploads/small_wireless_headphones_1_fa75cd50c3.png +0 -0
  136. package/dist/uploads/small_yoga_mat_premium_1_01f9a3b5fa.png +0 -0
  137. package/dist/uploads/smart_watch_series_5_1_cdc2511fb7.png +0 -0
  138. package/dist/uploads/smartphone_x_pro_1_c3f0cbd080.png +0 -0
  139. package/dist/uploads/the_great_gatsby_special_1_2e7c76d997.png +0 -0
  140. package/dist/uploads/thumbnail_accessories_category_2a5631094b.jpeg +0 -0
  141. package/dist/uploads/thumbnail_beauty_personal_care_category_57f8a8f1e3.jpeg +0 -0
  142. package/dist/uploads/thumbnail_books_category_a9a253eada.jpeg +0 -0
  143. package/dist/uploads/thumbnail_classic_cotton_tshirt_1_cd713425f6.png +0 -0
  144. package/dist/uploads/thumbnail_clothing_category_d5c60ef07b.jpeg +0 -0
  145. package/dist/uploads/thumbnail_daviddoe_strapi_adbcd41787.jpeg +0 -0
  146. package/dist/uploads/thumbnail_electronics_category_fc3e5ef571.jpeg +0 -0
  147. package/dist/uploads/thumbnail_ergonomic_office_chair_1_c751cffb07.png +0 -0
  148. package/dist/uploads/thumbnail_home_garden_category_4f6eb3f8d6.jpeg +0 -0
  149. package/dist/uploads/thumbnail_istockphoto_1188462138_612x612_11f295b9c0.jpg +0 -0
  150. package/dist/uploads/thumbnail_istockphoto_1188462138_612x612_396fb272fd.jpg +0 -0
  151. package/dist/uploads/thumbnail_leather_travel_backpack_1_238bc1ae4d.png +0 -0
  152. package/dist/uploads/thumbnail_mechanical_keyboard_pro_1_0cd391a6ac.png +0 -0
  153. package/dist/uploads/thumbnail_predictive_maintenance_icons_industry_automation_600nw_2685943461_e18a8aa3b0.webp +0 -0
  154. package/dist/uploads/thumbnail_smart_watch_series_5_1_cdc2511fb7.png +0 -0
  155. package/dist/uploads/thumbnail_smartphone_x_pro_1_c3f0cbd080.png +0 -0
  156. package/dist/uploads/thumbnail_the_great_gatsby_special_1_2e7c76d997.png +0 -0
  157. package/dist/uploads/thumbnail_wireless_headphones_1_fa75cd50c3.png +0 -0
  158. package/dist/uploads/thumbnail_yoga_mat_premium_1_01f9a3b5fa.png +0 -0
  159. package/dist/uploads/webby-commerce.png +0 -0
  160. package/dist/uploads/wireless_headphones_1_fa75cd50c3.png +0 -0
  161. package/dist/uploads/yoga_mat_premium_1_01f9a3b5fa.png +0 -0
  162. /package/{dist → server/src}/data/demo-data.json +0 -0
@@ -0,0 +1,4626 @@
1
+ 'use strict';
2
+
3
+ import React, { useState, useEffect, useMemo } from 'react';
4
+ import { useIntl } from 'react-intl';
5
+ import {
6
+ Box,
7
+ Flex,
8
+ Typography,
9
+ Button,
10
+ Modal,
11
+ Pagination,
12
+ PageLink,
13
+ PreviousLink,
14
+ NextLink,
15
+ Dots,
16
+ } from '@strapi/design-system';
17
+ import { useFetchClient } from '@strapi/admin/strapi-admin';
18
+
19
+ import { PLUGIN_ID } from '../pluginId';
20
+
21
+ const ApiCollectionsContent = () => {
22
+ const { formatMessage } = useIntl();
23
+ const fetchClient = useFetchClient();
24
+ const [openModalId, setOpenModalId] = useState(null);
25
+ const [routePrefix, setRoutePrefix] = useState('webbycommerce');
26
+ const [page, setPage] = useState(1);
27
+ const pageSize = 10;
28
+
29
+ useEffect(() => {
30
+ const loadRoutePrefix = async () => {
31
+ try {
32
+ const { data } = await fetchClient.get(`/webbycommerce/settings`);
33
+ if (data?.routePrefix) {
34
+ setRoutePrefix(data.routePrefix);
35
+ }
36
+ } catch (error) {
37
+ console.error('Failed to load route prefix:', error);
38
+ }
39
+ };
40
+ loadRoutePrefix();
41
+ }, [fetchClient]);
42
+
43
+ const description = formatMessage({
44
+ id: `${PLUGIN_ID}.settings.apiCollections.description`,
45
+ defaultMessage:
46
+ 'Reference for the public endpoints exposed by the Strapi Advanced Ecommerce plugin.',
47
+ });
48
+
49
+ const getApiPath = (endpointPath) => {
50
+ // Replace the default prefix with the configured prefix
51
+ return endpointPath.replace('/api/webbycommerce', `/api/${routePrefix}`);
52
+ };
53
+
54
+ const endpoints = useMemo(() => [
55
+ {
56
+ id: 'health',
57
+ method: 'GET',
58
+ path: getApiPath('/api/webbycommerce/health'),
59
+ title: formatMessage({
60
+ id: `${PLUGIN_ID}.settings.apiCollections.health.title`,
61
+ defaultMessage: 'Health Check',
62
+ }),
63
+ summary: formatMessage({
64
+ id: `${PLUGIN_ID}.settings.apiCollections.health.summary`,
65
+ defaultMessage:
66
+ 'Simple endpoint to verify that the ecommerce plugin is installed and running.',
67
+ }),
68
+ auth: formatMessage({
69
+ id: `${PLUGIN_ID}.settings.apiCollections.health.auth`,
70
+ defaultMessage:
71
+ 'Auth: public (no authentication required by default, but respects plugin permissions).',
72
+ }),
73
+ response: `{
74
+ "status": "ok",
75
+ "plugin": "webbycommerce",
76
+ "message": "Ecommerce plugin is running",
77
+ "timestamp": "2024-01-01T00:00:00.000Z"
78
+ }`,
79
+ usage: [
80
+ formatMessage({
81
+ id: `${PLUGIN_ID}.settings.apiCollections.health.usage.monitoring`,
82
+ defaultMessage: 'Use in uptime monitors to check ecommerce availability.',
83
+ }),
84
+ formatMessage({
85
+ id: `${PLUGIN_ID}.settings.apiCollections.health.usage.deploy`,
86
+ defaultMessage:
87
+ 'Use in deployment or CI pipelines to validate the plugin is bootstrapped.',
88
+ }),
89
+ formatMessage({
90
+ id: `${PLUGIN_ID}.settings.apiCollections.health.usage.manual`,
91
+ defaultMessage:
92
+ 'Quick manual verification from a browser or API client (Postman, Insomnia, curl).',
93
+ }),
94
+ ],
95
+ getCurl: () => `curl http://localhost:1337${getApiPath('/api/webbycommerce/health')}`,
96
+ },
97
+ {
98
+ id: 'login-register-otp',
99
+ method: 'POST',
100
+ path: getApiPath('/api/webbycommerce/auth/login-register'),
101
+ title: formatMessage({
102
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.title`,
103
+ defaultMessage: 'Login/Register (OTP)',
104
+ }),
105
+ summary: formatMessage({
106
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.summary`,
107
+ defaultMessage:
108
+ 'Initiate login or registration via email or mobile and send a one-time password (OTP) to the user.',
109
+ }),
110
+ auth: formatMessage({
111
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.auth`,
112
+ defaultMessage:
113
+ 'Auth: public (OTP method must be enabled in plugin settings).',
114
+ }),
115
+ response: `{
116
+ "message": "OTP sent to email.",
117
+ "userId": 1,
118
+ "isNewUser": false
119
+ }`,
120
+ usage: [
121
+ formatMessage({
122
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.usage.request`,
123
+ defaultMessage: 'Send email or mobile number to receive an OTP code.',
124
+ }),
125
+ formatMessage({
126
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.usage.verify`,
127
+ defaultMessage: 'User enters the OTP code in your frontend application.',
128
+ }),
129
+ formatMessage({
130
+ id: `${PLUGIN_ID}.settings.apiCollections.loginRegister.usage.next`,
131
+ defaultMessage: 'Call the verify-otp endpoint to complete authentication.',
132
+ }),
133
+ ],
134
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/auth/login-register')} \\
135
+ -H "Content-Type: application/json" \\
136
+ -d '{"email": "user@example.com", "type": "email"}'`,
137
+ requestBody: `{
138
+ "email": "user@example.com",
139
+ "type": "email"
140
+ }`,
141
+ },
142
+ {
143
+ id: 'verify-otp',
144
+ method: 'POST',
145
+ path: getApiPath('/api/webbycommerce/auth/verify-otp'),
146
+ title: formatMessage({
147
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.title`,
148
+ defaultMessage: 'Verify OTP',
149
+ }),
150
+ summary: formatMessage({
151
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.summary`,
152
+ defaultMessage:
153
+ 'Verify the OTP for a given email or mobile number and return a JWT token for authenticated access.',
154
+ }),
155
+ auth: formatMessage({
156
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.auth`,
157
+ defaultMessage:
158
+ 'Auth: public (OTP method must be enabled in plugin settings).',
159
+ }),
160
+ response: `{
161
+ "message": "Login successfully!",
162
+ "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
163
+ "user": {
164
+ "id": 1,
165
+ "username": "user1234",
166
+ "email": "user@example.com",
167
+ "phone_no": null
168
+ }
169
+ }`,
170
+ usage: [
171
+ formatMessage({
172
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.usage.verify`,
173
+ defaultMessage: 'Submit the OTP code received via email or SMS.',
174
+ }),
175
+ formatMessage({
176
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.usage.token`,
177
+ defaultMessage: 'Receive a JWT token for authenticated API requests.',
178
+ }),
179
+ formatMessage({
180
+ id: `${PLUGIN_ID}.settings.apiCollections.verifyOtp.usage.store`,
181
+ defaultMessage: 'Store the JWT token securely and include it in subsequent requests.',
182
+ }),
183
+ ],
184
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/auth/verify-otp')} \\
185
+ -H "Content-Type: application/json" \\
186
+ -d '{"email": "user@example.com", "otp": "123456", "type": "email"}'`,
187
+ requestBody: `{
188
+ "email": "user@example.com",
189
+ "otp": "123456",
190
+ "type": "email"
191
+ }`,
192
+ },
193
+ {
194
+ id: 'auth-method',
195
+ method: 'GET',
196
+ path: getApiPath('/api/webbycommerce/auth/method'),
197
+ title: formatMessage({
198
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.title`,
199
+ defaultMessage: 'Get Authentication Method',
200
+ }),
201
+ summary: formatMessage({
202
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.summary`,
203
+ defaultMessage:
204
+ 'Get the current authentication method (default or otp) configured in the plugin settings. Use this endpoint in your frontend to determine which authentication flow to display.',
205
+ }),
206
+ auth: formatMessage({
207
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.auth`,
208
+ defaultMessage: 'Auth: public (no authentication required).',
209
+ }),
210
+ response: `{
211
+ "method": "default",
212
+ "message": "Current authentication method: default"
213
+ }`,
214
+ usage: [
215
+ formatMessage({
216
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.usage.frontend`,
217
+ defaultMessage: 'Call this endpoint on app initialization to determine which auth UI to show.',
218
+ }),
219
+ formatMessage({
220
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.usage.conditional`,
221
+ defaultMessage: 'If method is "otp", show OTP login/register form. If "default", show email/password form.',
222
+ }),
223
+ formatMessage({
224
+ id: `${PLUGIN_ID}.settings.apiCollections.authMethod.usage.dynamic`,
225
+ defaultMessage: 'Method can change based on plugin settings, so check this endpoint periodically.',
226
+ }),
227
+ ],
228
+ getCurl: () => `curl http://localhost:1337${getApiPath('/api/webbycommerce/auth/method')}`,
229
+ },
230
+ {
231
+ id: 'unified-auth',
232
+ method: 'POST',
233
+ path: getApiPath('/api/webbycommerce/auth/unified'),
234
+ title: formatMessage({
235
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.title`,
236
+ defaultMessage: 'Unified Authentication',
237
+ }),
238
+ summary: formatMessage({
239
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.summary`,
240
+ defaultMessage:
241
+ 'Unified authentication endpoint that supports both OTP and default (email/password) methods. Automatically detects which method to use based on request body. Perfect for frontends that want to support both authentication methods simultaneously.',
242
+ }),
243
+ auth: formatMessage({
244
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.auth`,
245
+ defaultMessage: 'Auth: public (no authentication required).',
246
+ }),
247
+ response: `{
248
+ "success": true,
249
+ "step": "login",
250
+ "method": "default",
251
+ "message": "Login successfully!",
252
+ "jwt": "eyJhbGciOi...",
253
+ "user": {
254
+ "id": 1,
255
+ "username": "user1234",
256
+ "email": "user@example.com"
257
+ }
258
+ }`,
259
+ usage: [
260
+ formatMessage({
261
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.usage.unified`,
262
+ defaultMessage: 'Use this single endpoint for all authentication needs - OTP and default methods.',
263
+ }),
264
+ formatMessage({
265
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.usage.otp`,
266
+ defaultMessage: 'For OTP: First call with step="request" and email/mobile, then call with step="verify" and OTP code.',
267
+ }),
268
+ formatMessage({
269
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.usage.default`,
270
+ defaultMessage: 'For default: Call with step="login" and identifier/password, or step="register" with username/email/password.',
271
+ }),
272
+ formatMessage({
273
+ id: `${PLUGIN_ID}.settings.apiCollections.unifiedAuth.usage.auto`,
274
+ defaultMessage: 'Method is auto-detected from request body, or specify authMethod="otp" or "default" explicitly.',
275
+ }),
276
+ ],
277
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/auth/unified')} \\
278
+ -H "Content-Type: application/json" \\
279
+ -d '{"step": "login", "identifier": "user@example.com", "password": "password"}'`,
280
+ requestBody: `{
281
+ "step": "login",
282
+ "identifier": "user@example.com",
283
+ "password": "password"
284
+ }`,
285
+ },
286
+ {
287
+ id: 'default-login',
288
+ method: 'POST',
289
+ path: '/api/auth/local',
290
+ title: formatMessage({
291
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultLogin.title`,
292
+ defaultMessage: 'Default Login (Email/Password)',
293
+ }),
294
+ summary: formatMessage({
295
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultLogin.summary`,
296
+ defaultMessage:
297
+ "Use Strapi's built-in /auth/local endpoint for email/password login when the authentication method is set to Default.",
298
+ }),
299
+ auth: formatMessage({
300
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultLogin.auth`,
301
+ defaultMessage:
302
+ "Auth: public (uses Strapi's core Users & Permissions authentication).",
303
+ }),
304
+ response: `{
305
+ "jwt": "eyJhbGciOi...",
306
+ "user": {
307
+ "id": 1,
308
+ "username": "user1234",
309
+ "email": "user@example.com"
310
+ }
311
+ }`,
312
+ usage: [
313
+ formatMessage({
314
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultLogin.usage.request`,
315
+ defaultMessage:
316
+ 'Send identifier (email or username) and password to authenticate the user.',
317
+ }),
318
+ formatMessage({
319
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultLogin.usage.next`,
320
+ defaultMessage:
321
+ 'Store the returned JWT token and use it for authenticated requests.',
322
+ }),
323
+ ],
324
+ getCurl: () => `curl -X POST http://localhost:1337/api/auth/local \
325
+ -H "Content-Type: application/json" \
326
+ -d '{"identifier": "user@example.com", "password": "password"}'`,
327
+ requestBody: `{
328
+ "identifier": "user@example.com",
329
+ "password": "password"
330
+ }`,
331
+ },
332
+ {
333
+ id: 'default-register',
334
+ method: 'POST',
335
+ path: '/api/auth/local/register',
336
+ title: formatMessage({
337
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultRegister.title`,
338
+ defaultMessage: 'Default Register (Email/Password)',
339
+ }),
340
+ summary: formatMessage({
341
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultRegister.summary`,
342
+ defaultMessage:
343
+ "Use Strapi's built-in /auth/local/register endpoint for email/password registration when the authentication method is set to Default.",
344
+ }),
345
+ auth: formatMessage({
346
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultRegister.auth`,
347
+ defaultMessage:
348
+ "Auth: public (uses Strapi's core Users & Permissions registration).",
349
+ }),
350
+ response: `{
351
+ "jwt": "eyJhbGciOi...",
352
+ "user": {
353
+ "id": 1,
354
+ "username": "user1234",
355
+ "email": "user@example.com"
356
+ }
357
+ }`,
358
+ usage: [
359
+ formatMessage({
360
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultRegister.usage.request`,
361
+ defaultMessage:
362
+ 'Send username, email and password to create a new user.',
363
+ }),
364
+ formatMessage({
365
+ id: `${PLUGIN_ID}.settings.apiCollections.defaultRegister.usage.next`,
366
+ defaultMessage:
367
+ 'Use the returned JWT token or confirmation flow according to your Users & Permissions settings.',
368
+ }),
369
+ ],
370
+ getCurl: () => `curl -X POST http://localhost:1337/api/auth/local/register \
371
+ -H "Content-Type: application/json" \
372
+ -d '{"username": "user1234", "email": "user@example.com", "password": "password"}'`,
373
+ requestBody: `{
374
+ "username": "user1234",
375
+ "email": "user@example.com",
376
+ "password": "password"
377
+ }`,
378
+ },
379
+ {
380
+ id: 'profile',
381
+ method: 'GET',
382
+ path: getApiPath('/api/webbycommerce/auth/profile'),
383
+ title: formatMessage({
384
+ id: `${PLUGIN_ID}.settings.apiCollections.profile.title`,
385
+ defaultMessage: 'Get User Profile',
386
+ }),
387
+ summary: formatMessage({
388
+ id: `${PLUGIN_ID}.settings.apiCollections.profile.summary`,
389
+ defaultMessage:
390
+ 'Get complete user profile details for the authenticated user. Requires a valid JWT token.',
391
+ }),
392
+ auth: formatMessage({
393
+ id: `${PLUGIN_ID}.settings.apiCollections.profile.auth`,
394
+ defaultMessage:
395
+ 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
396
+ }),
397
+ response: `{
398
+ "user": {
399
+ "id": 1,
400
+ "username": "user1234",
401
+ "email": "user@example.com",
402
+ "phone_no": "+1234567890",
403
+ "confirmed": true,
404
+ "blocked": false,
405
+ "role": {
406
+ "id": 1,
407
+ "name": "Authenticated",
408
+ "type": "authenticated"
409
+ },
410
+ "createdAt": "2024-01-01T00:00:00.000Z",
411
+ "updatedAt": "2024-01-01T00:00:00.000Z"
412
+ }
413
+ }`,
414
+ usage: [
415
+ formatMessage({
416
+ id: `${PLUGIN_ID}.settings.apiCollections.profile.usage.token`,
417
+ defaultMessage: 'Include the JWT token in the Authorization header.',
418
+ }),
419
+ formatMessage({
420
+ id: `${PLUGIN_ID}.settings.apiCollections.profile.usage.details`,
421
+ defaultMessage: 'Returns all user details including custom fields from the user schema.',
422
+ }),
423
+ ],
424
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/auth/profile')} \\
425
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
426
+ },
427
+ {
428
+ id: 'update-profile',
429
+ method: 'PUT',
430
+ path: getApiPath('/api/webbycommerce/auth/profile'),
431
+ title: formatMessage({
432
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.title`,
433
+ defaultMessage: 'Update User Profile',
434
+ }),
435
+ summary: formatMessage({
436
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.summary`,
437
+ defaultMessage:
438
+ 'Update user profile details including name, email, phone number, and optionally change password (if default login method is enabled).',
439
+ }),
440
+ auth: formatMessage({
441
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.auth`,
442
+ defaultMessage:
443
+ 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
444
+ }),
445
+ response: `{
446
+ "message": "Profile updated successfully.",
447
+ "user": {
448
+ "id": 1,
449
+ "username": "user1234",
450
+ "email": "user@example.com",
451
+ "phone_no": "+1234567890",
452
+ "first_name": "John",
453
+ "last_name": "Doe",
454
+ "display_name": "John Doe",
455
+ "company_name": "WebbyCrown Solutions",
456
+ "confirmed": true,
457
+ "blocked": false,
458
+ "updatedAt": "2024-01-01T00:00:00.000Z"
459
+ }
460
+ }`,
461
+ usage: [
462
+ formatMessage({
463
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.usage.required`,
464
+ defaultMessage: 'First name, last name, email, and phone number are required fields.',
465
+ }),
466
+ formatMessage({
467
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.usage.unique`,
468
+ defaultMessage: 'Email and phone number must be unique (not used by other users).',
469
+ }),
470
+ formatMessage({
471
+ id: `${PLUGIN_ID}.settings.apiCollections.updateProfile.usage.password`,
472
+ defaultMessage: 'Password update is only available when default login method is enabled.',
473
+ }),
474
+ ],
475
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/auth/profile')} \\
476
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
477
+ -H "Content-Type: application/json" \\
478
+ -d '{"first_name": "John", "last_name": "Doe", "email": "user@example.com", "phone_no": "+1234567890", "display_name": "John Doe"}'`,
479
+ requestBody: `{
480
+ "first_name": "John",
481
+ "last_name": "Doe",
482
+ "email": "user@example.com",
483
+ "phone_no": "+1234567890",
484
+ "display_name": "John Doe",
485
+ "company_name": "WebbyCrown Solutions",
486
+ "currentPassword": "oldpassword",
487
+ "newPassword": "newpassword"
488
+ }`,
489
+ },
490
+ {
491
+ id: 'get-addresses',
492
+ method: 'GET',
493
+ path: getApiPath('/api/webbycommerce/addresses'),
494
+ title: formatMessage({
495
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.getList.title`,
496
+ defaultMessage: 'Get All Addresses',
497
+ }),
498
+ summary: formatMessage({
499
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.getList.summary`,
500
+ defaultMessage: 'Retrieve all addresses for the authenticated user. Optionally filter by type (0=billing, 1=shipping).',
501
+ }),
502
+ auth: formatMessage({
503
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.auth`,
504
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
505
+ }),
506
+ response: `{
507
+ "data": [
508
+ {
509
+ "id": 1,
510
+ "type": 0,
511
+ "first_name": "John",
512
+ "last_name": "Doe",
513
+ "company_name": "WebbyCrown Solutions",
514
+ "country": "United States",
515
+ "region": "California",
516
+ "city": "San Francisco",
517
+ "street_address": "123 Main Street",
518
+ "postcode": "94102",
519
+ "phone": "+1234567890",
520
+ "email_address": "john@example.com",
521
+ "createdAt": "2024-01-01T00:00:00.000Z",
522
+ "updatedAt": "2024-01-01T00:00:00.000Z"
523
+ }
524
+ ]
525
+ }`,
526
+ usage: [
527
+ 'Include the JWT token in the Authorization header.',
528
+ 'Optionally add ?type=0 for billing addresses or ?type=1 for shipping addresses.',
529
+ 'Returns all addresses for the authenticated user.',
530
+ ],
531
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/addresses')} \\
532
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
533
+ },
534
+ {
535
+ id: 'get-address',
536
+ method: 'GET',
537
+ path: getApiPath('/api/webbycommerce/addresses/:id'),
538
+ title: formatMessage({
539
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.getSingle.title`,
540
+ defaultMessage: 'Get Single Address',
541
+ }),
542
+ summary: formatMessage({
543
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.getSingle.summary`,
544
+ defaultMessage: 'Retrieve a specific address by ID for the authenticated user.',
545
+ }),
546
+ auth: formatMessage({
547
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.auth`,
548
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
549
+ }),
550
+ response: `{
551
+ "data": {
552
+ "id": 1,
553
+ "type": 0,
554
+ "first_name": "John",
555
+ "last_name": "Doe",
556
+ "company_name": "WebbyCrown Solutions",
557
+ "country": "United States",
558
+ "region": "California",
559
+ "city": "San Francisco",
560
+ "street_address": "123 Main Street",
561
+ "postcode": "94102",
562
+ "phone": "+1234567890",
563
+ "email_address": "john@example.com",
564
+ "createdAt": "2024-01-01T00:00:00.000Z",
565
+ "updatedAt": "2024-01-01T00:00:00.000Z"
566
+ }
567
+ }`,
568
+ usage: [
569
+ 'Include the JWT token in the Authorization header.',
570
+ 'Replace :id with the actual address ID.',
571
+ 'Returns the address if it belongs to the authenticated user.',
572
+ ],
573
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/addresses/1')} \\
574
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
575
+ },
576
+ {
577
+ id: 'create-address',
578
+ method: 'POST',
579
+ path: getApiPath('/api/webbycommerce/addresses'),
580
+ title: formatMessage({
581
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.create.title`,
582
+ defaultMessage: 'Create Address',
583
+ }),
584
+ summary: formatMessage({
585
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.create.summary`,
586
+ defaultMessage: 'Create a new billing or shipping address for the authenticated user.',
587
+ }),
588
+ auth: formatMessage({
589
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.auth`,
590
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
591
+ }),
592
+ response: `{
593
+ "data": {
594
+ "id": 1,
595
+ "type": 0,
596
+ "first_name": "John",
597
+ "last_name": "Doe",
598
+ "company_name": "WebbyCrown Solutions",
599
+ "country": "United States",
600
+ "region": "California",
601
+ "city": "San Francisco",
602
+ "street_address": "123 Main Street",
603
+ "postcode": "94102",
604
+ "phone": "+1234567890",
605
+ "email_address": "john@example.com",
606
+ "createdAt": "2024-01-01T00:00:00.000Z",
607
+ "updatedAt": "2024-01-01T00:00:00.000Z"
608
+ }
609
+ }`,
610
+ usage: [
611
+ 'Include the JWT token in the Authorization header.',
612
+ 'Type must be 0 (billing) or 1 (shipping).',
613
+ 'Email address is required for billing addresses (type=0).',
614
+ 'In single address mode, only one billing and one shipping address are allowed.',
615
+ 'In multiple address mode, users can create unlimited addresses.',
616
+ ],
617
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/addresses')} \\
618
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
619
+ -H "Content-Type: application/json" \\
620
+ -d '{"type": 0, "first_name": "John", "last_name": "Doe", "country": "United States", "city": "San Francisco", "street_address": "123 Main Street", "postcode": "94102", "phone": "+1234567890", "email_address": "john@example.com"}'`,
621
+ requestBody: `{
622
+ "type": 0,
623
+ "first_name": "John",
624
+ "last_name": "Doe",
625
+ "company_name": "WebbyCrown Solutions",
626
+ "country": "United States",
627
+ "region": "California",
628
+ "city": "San Francisco",
629
+ "street_address": "123 Main Street",
630
+ "postcode": "94102",
631
+ "phone": "+1234567890",
632
+ "email_address": "john@example.com"
633
+ }`,
634
+ },
635
+ {
636
+ id: 'update-address',
637
+ method: 'PUT',
638
+ path: getApiPath('/api/webbycommerce/addresses/:id'),
639
+ title: formatMessage({
640
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.update.title`,
641
+ defaultMessage: 'Update Address',
642
+ }),
643
+ summary: formatMessage({
644
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.update.summary`,
645
+ defaultMessage: 'Update an existing address for the authenticated user.',
646
+ }),
647
+ auth: formatMessage({
648
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.auth`,
649
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
650
+ }),
651
+ response: `{
652
+ "data": {
653
+ "id": 1,
654
+ "type": 0,
655
+ "first_name": "John",
656
+ "last_name": "Doe",
657
+ "company_name": "WebbyCrown Solutions",
658
+ "country": "United States",
659
+ "region": "California",
660
+ "city": "San Francisco",
661
+ "street_address": "456 Updated Street",
662
+ "postcode": "94102",
663
+ "phone": "+1234567890",
664
+ "email_address": "john@example.com",
665
+ "createdAt": "2024-01-01T00:00:00.000Z",
666
+ "updatedAt": "2024-01-01T12:00:00.000Z"
667
+ }
668
+ }`,
669
+ usage: [
670
+ 'Include the JWT token in the Authorization header.',
671
+ 'Replace :id with the actual address ID.',
672
+ 'Only fields provided in the request body will be updated.',
673
+ 'All fields are optional, but if provided, they must be valid.',
674
+ ],
675
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/addresses/1')} \\
676
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
677
+ -H "Content-Type: application/json" \\
678
+ -d '{"street_address": "456 Updated Street"}'`,
679
+ requestBody: `{
680
+ "first_name": "John",
681
+ "last_name": "Doe",
682
+ "company_name": "WebbyCrown Solutions",
683
+ "country": "United States",
684
+ "region": "California",
685
+ "city": "San Francisco",
686
+ "street_address": "456 Updated Street",
687
+ "postcode": "94102",
688
+ "phone": "+1234567890",
689
+ "email_address": "john@example.com"
690
+ }`,
691
+ },
692
+ {
693
+ id: 'delete-address',
694
+ method: 'DELETE',
695
+ path: getApiPath('/api/webbycommerce/addresses/:id'),
696
+ title: formatMessage({
697
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.delete.title`,
698
+ defaultMessage: 'Delete Address',
699
+ }),
700
+ summary: formatMessage({
701
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.delete.summary`,
702
+ defaultMessage: 'Delete an address for the authenticated user.',
703
+ }),
704
+ auth: formatMessage({
705
+ id: `${PLUGIN_ID}.settings.apiCollections.addresses.auth`,
706
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
707
+ }),
708
+ response: `{
709
+ "data": {
710
+ "id": 1
711
+ }
712
+ }`,
713
+ usage: [
714
+ 'Include the JWT token in the Authorization header.',
715
+ 'Replace :id with the actual address ID.',
716
+ 'Only addresses belonging to the authenticated user can be deleted.',
717
+ ],
718
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/addresses/1')} \\
719
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
720
+ },
721
+ {
722
+ id: 'get-products',
723
+ method: 'GET',
724
+ path: getApiPath('/api/webbycommerce/products'),
725
+ title: formatMessage({
726
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getList.title`,
727
+ defaultMessage: 'Get All Products',
728
+ }),
729
+ summary: formatMessage({
730
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getList.summary`,
731
+ defaultMessage: 'Retrieve all products with optional filtering by product category, tag, or search.',
732
+ }),
733
+ auth: formatMessage({
734
+ id: `${PLUGIN_ID}.settings.apiCollections.products.auth`,
735
+ defaultMessage: 'Auth: public (no authentication required).',
736
+ }),
737
+ response: `{
738
+ "data": [
739
+ {
740
+ "id": 1,
741
+ "name": "Sample Product",
742
+ "description": "Product description",
743
+ "price": 29.99,
744
+ "sku": "SP001",
745
+ "slug": "sample-product",
746
+ "stock_quantity": 100,
747
+ "stock_status": "in_stock",
748
+ "images": [],
749
+ "product_categories": [],
750
+ "tags": [],
751
+ "createdAt": "2024-01-01T00:00:00.000Z",
752
+ "updatedAt": "2024-01-01T00:00:00.000Z"
753
+ }
754
+ ],
755
+ "meta": {
756
+ "total": 1,
757
+ "limit": 10,
758
+ "start": 0
759
+ }
760
+ }`,
761
+ usage: [
762
+ 'Optional query parameters: ?product_category=1&tag=2&search=product&limit=10&start=0',
763
+ 'Returns paginated list of products.',
764
+ ],
765
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products')}`,
766
+ },
767
+ {
768
+ id: 'get-product',
769
+ method: 'GET',
770
+ path: getApiPath('/api/webbycommerce/products/:id'),
771
+ title: formatMessage({
772
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getSingle.title`,
773
+ defaultMessage: 'Get Single Product',
774
+ }),
775
+ summary: formatMessage({
776
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getSingle.summary`,
777
+ defaultMessage: 'Retrieve a specific product by ID.',
778
+ }),
779
+ auth: formatMessage({
780
+ id: `${PLUGIN_ID}.settings.apiCollections.products.auth`,
781
+ defaultMessage: 'Auth: public (no authentication required).',
782
+ }),
783
+ response: `{
784
+ "data": {
785
+ "id": 1,
786
+ "name": "Sample Product",
787
+ "description": "Product description",
788
+ "price": 29.99,
789
+ "sku": "SP001",
790
+ "slug": "sample-product",
791
+ "stock_quantity": 100,
792
+ "stock_status": "in_stock",
793
+ "images": [],
794
+ "product_categories": [],
795
+ "tags": [],
796
+ "createdAt": "2024-01-01T00:00:00.000Z",
797
+ "updatedAt": "2024-01-01T00:00:00.000Z"
798
+ }
799
+ }`,
800
+ usage: [
801
+ 'Replace :id with the actual product ID.',
802
+ 'Returns the product details.',
803
+ ],
804
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/1')}`,
805
+ },
806
+ {
807
+ id: 'get-product-by-slug',
808
+ method: 'GET',
809
+ path: getApiPath('/api/webbycommerce/products/:slug'),
810
+ title: formatMessage({
811
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getBySlug.title`,
812
+ defaultMessage: 'Get Single Product (By Slug)',
813
+ }),
814
+ summary: formatMessage({
815
+ id: `${PLUGIN_ID}.settings.apiCollections.products.getBySlug.summary`,
816
+ defaultMessage: 'Retrieve a specific product by slug.',
817
+ }),
818
+ auth: formatMessage({
819
+ id: `${PLUGIN_ID}.settings.apiCollections.products.auth`,
820
+ defaultMessage: 'Auth: public (no authentication required).',
821
+ }),
822
+ response: `{
823
+ "data": {
824
+ "id": 1,
825
+ "name": "Sample Product",
826
+ "description": "Product description",
827
+ "price": 29.99,
828
+ "sku": "SP001",
829
+ "slug": "sample-product",
830
+ "stock_quantity": 100,
831
+ "stock_status": "in_stock",
832
+ "images": [],
833
+ "product_categories": [],
834
+ "tags": [],
835
+ "createdAt": "2024-01-01T00:00:00.000Z",
836
+ "updatedAt": "2024-01-01T00:00:00.000Z"
837
+ }
838
+ }`,
839
+ usage: [
840
+ 'Replace :slug with the actual product slug.',
841
+ 'Returns the product details.',
842
+ ],
843
+ getCurl: () =>
844
+ `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/sample-product')}`,
845
+ },
846
+ {
847
+ id: 'create-product',
848
+ method: 'POST',
849
+ path: getApiPath('/api/webbycommerce/products'),
850
+ title: formatMessage({
851
+ id: `${PLUGIN_ID}.settings.apiCollections.products.create.title`,
852
+ defaultMessage: 'Create Product',
853
+ }),
854
+ summary: formatMessage({
855
+ id: `${PLUGIN_ID}.settings.apiCollections.products.create.summary`,
856
+ defaultMessage: 'Create a new product. Requires administrator privileges.',
857
+ }),
858
+ auth: formatMessage({
859
+ id: `${PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
860
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
861
+ }),
862
+ response: `{
863
+ "data": {
864
+ "id": 1,
865
+ "name": "New Product",
866
+ "description": "Product description",
867
+ "price": 49.99,
868
+ "sku": "NP001",
869
+ "slug": "new-product",
870
+ "stock_quantity": 50,
871
+ "stock_status": "in_stock",
872
+ "images": [],
873
+ "product_categories": [],
874
+ "tags": [],
875
+ "createdAt": "2024-01-01T00:00:00.000Z",
876
+ "updatedAt": "2024-01-01T00:00:00.000Z"
877
+ }
878
+ }`,
879
+ usage: [
880
+ 'Include the JWT token in the Authorization header.',
881
+ 'Name and price are required fields.',
882
+ 'Only administrators can create products.',
883
+ ],
884
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/products')} \\
885
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
886
+ -H "Content-Type: application/json" \\
887
+ -d '{"name": "New Product", "price": 49.99, "description": "Product description"}'`,
888
+ requestBody: `{
889
+ "name": "New Product",
890
+ "description": "Product description",
891
+ "price": 49.99,
892
+ "sale_price": 39.99,
893
+ "sku": "NP001",
894
+ "slug": "new-product",
895
+ "stock_quantity": 50,
896
+ "stock_status": "in_stock",
897
+ "weight": 1.5,
898
+ "dimensions": {"length": 10, "width": 5, "height": 2},
899
+ "product_categories": [1, 2],
900
+ "tags": [1]
901
+ }`,
902
+ },
903
+ {
904
+ id: 'create-bulk-products',
905
+ method: 'POST',
906
+ path: getApiPath('/api/webbycommerce/products/bulk'),
907
+ title: formatMessage({
908
+ id: `${PLUGIN_ID}.settings.apiCollections.products.createBulk.title`,
909
+ defaultMessage: 'Create Products in Bulk',
910
+ }),
911
+ summary: formatMessage({
912
+ id: `${PLUGIN_ID}.settings.apiCollections.products.createBulk.summary`,
913
+ defaultMessage: 'Create multiple products in a single request. Returns detailed results for each product including success and failure status.',
914
+ }),
915
+ auth: formatMessage({
916
+ id: `${PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
917
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
918
+ }),
919
+ response: `{
920
+ "data": {
921
+ "success": [
922
+ {
923
+ "index": 0,
924
+ "product": {
925
+ "id": 1,
926
+ "name": "Product 1",
927
+ "price": 49.99,
928
+ "sku": "P001",
929
+ "createdAt": "2024-01-01T00:00:00.000Z"
930
+ }
931
+ }
932
+ ],
933
+ "failed": [
934
+ {
935
+ "index": 1,
936
+ "product": {
937
+ "name": "Product 2",
938
+ "price": "invalid"
939
+ },
940
+ "errors": ["Price must be a valid positive number."]
941
+ }
942
+ ],
943
+ "summary": {
944
+ "total": 2,
945
+ "successful": 1,
946
+ "failed": 1
947
+ }
948
+ }
949
+ }`,
950
+ usage: [
951
+ 'Include the JWT token in the Authorization header.',
952
+ 'Send an array of products in the request body.',
953
+ 'Each product must have name and price (same validation as single product creation).',
954
+ 'Maximum 100 products per request.',
955
+ 'Returns 200 if all succeed, 207 if mixed results, 400 if all fail.',
956
+ 'Check the summary and failed arrays to see which products succeeded or failed.',
957
+ ],
958
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/products/bulk')} \\
959
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
960
+ -H "Content-Type: application/json" \\
961
+ -d '{
962
+ "products": [
963
+ {
964
+ "name": "Product 1",
965
+ "price": 49.99,
966
+ "description": "First product",
967
+ "sku": "P001",
968
+ "stock_quantity": 50
969
+ },
970
+ {
971
+ "name": "Product 2",
972
+ "price": 29.99,
973
+ "description": "Second product",
974
+ "sku": "P002",
975
+ "stock_quantity": 30
976
+ }
977
+ ]
978
+ }'`,
979
+ requestBody: `{
980
+ "products": [
981
+ {
982
+ "name": "Product 1",
983
+ "description": "First product description",
984
+ "price": 49.99,
985
+ "sale_price": 39.99,
986
+ "sku": "P001",
987
+ "slug": "product-1",
988
+ "stock_quantity": 50,
989
+ "stock_status": "in_stock",
990
+ "weight": 1.5,
991
+ "dimensions": {"length": 10, "width": 5, "height": 2},
992
+ "product_categories": [1, 2],
993
+ "tags": [1],
994
+ "images": [1, 2]
995
+ },
996
+ {
997
+ "name": "Product 2",
998
+ "description": "Second product description",
999
+ "price": 29.99,
1000
+ "sale_price": 24.99,
1001
+ "sku": "P002",
1002
+ "slug": "product-2",
1003
+ "stock_quantity": 30,
1004
+ "stock_status": "in_stock",
1005
+ "weight": 0.8,
1006
+ "product_categories": [1],
1007
+ "tags": [2]
1008
+ }
1009
+ ]
1010
+ }`,
1011
+ },
1012
+ {
1013
+ id: 'update-product',
1014
+ method: 'PUT',
1015
+ path: getApiPath('/api/webbycommerce/products/:id'),
1016
+ title: formatMessage({
1017
+ id: `${PLUGIN_ID}.settings.apiCollections.products.update.title`,
1018
+ defaultMessage: 'Update Product',
1019
+ }),
1020
+ summary: formatMessage({
1021
+ id: `${PLUGIN_ID}.settings.apiCollections.products.update.summary`,
1022
+ defaultMessage: 'Update an existing product. Requires administrator privileges.',
1023
+ }),
1024
+ auth: formatMessage({
1025
+ id: `${PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
1026
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1027
+ }),
1028
+ response: `{
1029
+ "data": {
1030
+ "id": 1,
1031
+ "name": "Updated Product",
1032
+ "description": "Updated description",
1033
+ "price": 59.99,
1034
+ "sku": "UP001",
1035
+ "slug": "updated-product",
1036
+ "stock_quantity": 75,
1037
+ "stock_status": "in_stock",
1038
+ "images": [],
1039
+ "product_categories": [],
1040
+ "tags": [],
1041
+ "createdAt": "2024-01-01T00:00:00.000Z",
1042
+ "updatedAt": "2024-01-01T12:00:00.000Z"
1043
+ }
1044
+ }`,
1045
+ usage: [
1046
+ 'Include the JWT token in the Authorization header.',
1047
+ 'Replace :id with the actual product ID.',
1048
+ 'Only fields provided in the request body will be updated.',
1049
+ 'Only administrators can update products.',
1050
+ ],
1051
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/products/1')} \\
1052
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1053
+ -H "Content-Type: application/json" \\
1054
+ -d '{"name": "Updated Product", "price": 59.99}'`,
1055
+ requestBody: `{
1056
+ "name": "Updated Product",
1057
+ "description": "Updated description",
1058
+ "price": 59.99,
1059
+ "slug": "updated-product",
1060
+ "stock_quantity": 75
1061
+ }`,
1062
+ },
1063
+ {
1064
+ id: 'delete-product',
1065
+ method: 'DELETE',
1066
+ path: getApiPath('/api/webbycommerce/products/:id'),
1067
+ title: formatMessage({
1068
+ id: `${PLUGIN_ID}.settings.apiCollections.products.delete.title`,
1069
+ defaultMessage: 'Delete Product',
1070
+ }),
1071
+ summary: formatMessage({
1072
+ id: `${PLUGIN_ID}.settings.apiCollections.products.delete.summary`,
1073
+ defaultMessage: 'Delete a product. Requires administrator privileges.',
1074
+ }),
1075
+ auth: formatMessage({
1076
+ id: `${PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
1077
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1078
+ }),
1079
+ response: `{
1080
+ "data": {
1081
+ "id": 1
1082
+ }
1083
+ }`,
1084
+ usage: [
1085
+ 'Include the JWT token in the Authorization header.',
1086
+ 'Replace :id with the actual product ID.',
1087
+ 'Only administrators can delete products.',
1088
+ ],
1089
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/products/1')} \\
1090
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1091
+ },
1092
+ {
1093
+ id: 'get-product-variants',
1094
+ method: 'GET',
1095
+ path: getApiPath('/api/webbycommerce/product-variants'),
1096
+ title: formatMessage({
1097
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.getList.title`,
1098
+ defaultMessage: 'Get All Product Variants',
1099
+ }),
1100
+ summary: formatMessage({
1101
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.getList.summary`,
1102
+ defaultMessage: 'Retrieve all product variants with optional filtering by product ID.',
1103
+ }),
1104
+ auth: formatMessage({
1105
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.auth`,
1106
+ defaultMessage: 'Auth: public (no authentication required by default).',
1107
+ }),
1108
+ response: `{
1109
+ "data": [
1110
+ {
1111
+ "id": 1,
1112
+ "product_id": 1,
1113
+ "name": "Small",
1114
+ "sku": "TSHIRT-S",
1115
+ "price": 19.99,
1116
+ "stock_quantity": 50,
1117
+ "stock_status": "in_stock",
1118
+ "attributes": {
1119
+ "size": "S",
1120
+ "color": "Black"
1121
+ },
1122
+ "createdAt": "2024-01-01T00:00:00.000Z",
1123
+ "updatedAt": "2024-01-01T00:00:00.000Z"
1124
+ }
1125
+ ],
1126
+ "meta": {
1127
+ "total": 1,
1128
+ "limit": 10,
1129
+ "start": 0
1130
+ }
1131
+ }`,
1132
+ usage: [
1133
+ 'Optional query parameters: ?product_id=1&limit=10&start=0',
1134
+ 'Returns paginated list of product variants.',
1135
+ ],
1136
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-variants')}`,
1137
+ },
1138
+ {
1139
+ id: 'get-product-variant',
1140
+ method: 'GET',
1141
+ path: getApiPath('/api/webbycommerce/product-variants/:id'),
1142
+ title: formatMessage({
1143
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.getSingle.title`,
1144
+ defaultMessage: 'Get Single Product Variant',
1145
+ }),
1146
+ summary: formatMessage({
1147
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.getSingle.summary`,
1148
+ defaultMessage: 'Retrieve a specific product variant by ID.',
1149
+ }),
1150
+ auth: formatMessage({
1151
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.auth`,
1152
+ defaultMessage: 'Auth: public (no authentication required by default).',
1153
+ }),
1154
+ response: `{
1155
+ "data": {
1156
+ "id": 1,
1157
+ "product_id": 1,
1158
+ "name": "Small",
1159
+ "sku": "TSHIRT-S",
1160
+ "price": 19.99,
1161
+ "stock_quantity": 50,
1162
+ "stock_status": "in_stock",
1163
+ "attributes": {
1164
+ "size": "S",
1165
+ "color": "Black"
1166
+ },
1167
+ "createdAt": "2024-01-01T00:00:00.000Z",
1168
+ "updatedAt": "2024-01-01T00:00:00.000Z"
1169
+ }
1170
+ }`,
1171
+ usage: [
1172
+ 'Replace :id with the actual product variant ID.',
1173
+ 'Returns the product variant details.',
1174
+ ],
1175
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-variants/1')}`,
1176
+ },
1177
+ {
1178
+ id: 'create-product-variant',
1179
+ method: 'POST',
1180
+ path: getApiPath('/api/webbycommerce/product-variants'),
1181
+ title: formatMessage({
1182
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.create.title`,
1183
+ defaultMessage: 'Create Product Variant',
1184
+ }),
1185
+ summary: formatMessage({
1186
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.create.summary`,
1187
+ defaultMessage: 'Create a new product variant. Requires administrator privileges.',
1188
+ }),
1189
+ auth: formatMessage({
1190
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.authAdmin`,
1191
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1192
+ }),
1193
+ response: `{
1194
+ "data": {
1195
+ "id": 1,
1196
+ "product_id": 1,
1197
+ "name": "Small",
1198
+ "sku": "TSHIRT-S",
1199
+ "price": 19.99,
1200
+ "stock_quantity": 50,
1201
+ "stock_status": "in_stock",
1202
+ "attributes": {
1203
+ "size": "S",
1204
+ "color": "Black"
1205
+ },
1206
+ "createdAt": "2024-01-01T00:00:00.000Z",
1207
+ "updatedAt": "2024-01-01T00:00:00.000Z"
1208
+ }
1209
+ }`,
1210
+ usage: [
1211
+ 'Include the JWT token in the Authorization header.',
1212
+ 'Product ID and name are required fields.',
1213
+ 'Only administrators can create product variants.',
1214
+ ],
1215
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/product-variants')} \\
1216
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1217
+ -H "Content-Type: application/json" \\
1218
+ -d '{"product_id": 1, "name": "Small", "sku": "TSHIRT-S", "price": 19.99, "attributes": {"size": "S"}}'`,
1219
+ requestBody: `{
1220
+ "product_id": 1,
1221
+ "name": "Small",
1222
+ "sku": "TSHIRT-S",
1223
+ "price": 19.99,
1224
+ "stock_quantity": 50,
1225
+ "stock_status": "in_stock",
1226
+ "attributes": {
1227
+ "size": "S",
1228
+ "color": "Black"
1229
+ }
1230
+ }`,
1231
+ },
1232
+ {
1233
+ id: 'update-product-variant',
1234
+ method: 'PUT',
1235
+ path: getApiPath('/api/webbycommerce/product-variants/:id'),
1236
+ title: formatMessage({
1237
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.update.title`,
1238
+ defaultMessage: 'Update Product Variant',
1239
+ }),
1240
+ summary: formatMessage({
1241
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.update.summary`,
1242
+ defaultMessage: 'Update an existing product variant. Requires administrator privileges.',
1243
+ }),
1244
+ auth: formatMessage({
1245
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.authAdmin`,
1246
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1247
+ }),
1248
+ response: `{
1249
+ "data": {
1250
+ "id": 1,
1251
+ "product_id": 1,
1252
+ "name": "Medium",
1253
+ "sku": "TSHIRT-M",
1254
+ "price": 19.99,
1255
+ "stock_quantity": 75,
1256
+ "stock_status": "in_stock",
1257
+ "attributes": {
1258
+ "size": "M",
1259
+ "color": "Black"
1260
+ },
1261
+ "createdAt": "2024-01-01T00:00:00.000Z",
1262
+ "updatedAt": "2024-01-01T12:00:00.000Z"
1263
+ }
1264
+ }`,
1265
+ usage: [
1266
+ 'Include the JWT token in the Authorization header.',
1267
+ 'Replace :id with the actual product variant ID.',
1268
+ 'Only fields provided in the request body will be updated.',
1269
+ 'Only administrators can update product variants.',
1270
+ ],
1271
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/product-variants/1')} \\
1272
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1273
+ -H "Content-Type: application/json" \\
1274
+ -d '{"name": "Medium", "sku": "TSHIRT-M", "stock_quantity": 75}'`,
1275
+ requestBody: `{
1276
+ "name": "Medium",
1277
+ "sku": "TSHIRT-M",
1278
+ "price": 19.99,
1279
+ "stock_quantity": 75,
1280
+ "stock_status": "in_stock",
1281
+ "attributes": {
1282
+ "size": "M",
1283
+ "color": "Black"
1284
+ }
1285
+ }`,
1286
+ },
1287
+ {
1288
+ id: 'delete-product-variant',
1289
+ method: 'DELETE',
1290
+ path: getApiPath('/api/webbycommerce/product-variants/:id'),
1291
+ title: formatMessage({
1292
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.delete.title`,
1293
+ defaultMessage: 'Delete Product Variant',
1294
+ }),
1295
+ summary: formatMessage({
1296
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.delete.summary`,
1297
+ defaultMessage: 'Delete a product variant. Requires administrator privileges.',
1298
+ }),
1299
+ auth: formatMessage({
1300
+ id: `${PLUGIN_ID}.settings.apiCollections.productVariants.authAdmin`,
1301
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1302
+ }),
1303
+ response: `{
1304
+ "data": {
1305
+ "id": 1
1306
+ }
1307
+ }`,
1308
+ usage: [
1309
+ 'Include the JWT token in the Authorization header.',
1310
+ 'Replace :id with the actual product variant ID.',
1311
+ 'Only administrators can delete product variants.',
1312
+ ],
1313
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/product-variants/1')} \\
1314
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1315
+ },
1316
+ {
1317
+ id: 'get-product-categories',
1318
+ method: 'GET',
1319
+ path: getApiPath('/api/webbycommerce/product-categories'),
1320
+ title: formatMessage({
1321
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.getList.title`,
1322
+ defaultMessage: 'Get All Product Categories',
1323
+ }),
1324
+ summary: formatMessage({
1325
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.getList.summary`,
1326
+ defaultMessage: 'Retrieve all product categories with optional search.',
1327
+ }),
1328
+ auth: formatMessage({
1329
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.auth`,
1330
+ defaultMessage: 'Auth: public (no authentication required).',
1331
+ }),
1332
+ response: `{
1333
+ "data": [
1334
+ { "id": 1, "name": "Electronics", "slug": "electronics", "description": "Electronic products", "image": {"id": 1, "url": "/uploads/electronics-category.png", "alternativeText": "electronics category image"}, "createdAt": "2024-01-01T00:00:00.000Z" }
1335
+ ],
1336
+ "meta": { "total": 1, "limit": 50, "start": 0 }
1337
+ }`,
1338
+ usage: ['Optional query parameters: ?search=category&limit=50&start=0'],
1339
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-categories')}`,
1340
+ },
1341
+ {
1342
+ id: 'get-product-category',
1343
+ method: 'GET',
1344
+ path: getApiPath('/api/webbycommerce/product-categories/:id'),
1345
+ title: formatMessage({
1346
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.getSingle.title`,
1347
+ defaultMessage: 'Get Single Product Category',
1348
+ }),
1349
+ summary: formatMessage({
1350
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.getSingle.summary`,
1351
+ defaultMessage: 'Retrieve a specific product category by ID.',
1352
+ }),
1353
+ auth: formatMessage({
1354
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.auth`,
1355
+ defaultMessage: 'Auth: public (no authentication required).',
1356
+ }),
1357
+ response: `{
1358
+ "data": { "id": 1, "name": "Electronics", "slug": "electronics", "description": "Electronic products", "image": {"id": 1, "url": "/uploads/electronics-category.png", "alternativeText": "electronics category image"}, "products": [] }
1359
+ }`,
1360
+ usage: ['Replace :id with the actual product category ID.'],
1361
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-categories/1')}`,
1362
+ },
1363
+ {
1364
+ id: 'create-product-category',
1365
+ method: 'POST',
1366
+ path: getApiPath('/api/webbycommerce/product-categories'),
1367
+ title: formatMessage({
1368
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.create.title`,
1369
+ defaultMessage: 'Create Product Category',
1370
+ }),
1371
+ summary: formatMessage({
1372
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.create.summary`,
1373
+ defaultMessage: 'Create a new product category. Requires administrator privileges.',
1374
+ }),
1375
+ auth: formatMessage({
1376
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.authAdmin`,
1377
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1378
+ }),
1379
+ response: `{
1380
+ "data": { "id": 2, "name": "New Product Category", "slug": "new-product-category", "description": "Category description", "image": {"id": 2, "url": "/uploads/new-product-category-category.png", "alternativeText": "new-product-category category image"} }
1381
+ }`,
1382
+ usage: ['Include the JWT token in the Authorization header. Name is required.'],
1383
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/product-categories')} \\
1384
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1385
+ -H "Content-Type: application/json" \\
1386
+ -d '{"name": "New Product Category"}'`,
1387
+ requestBody: `{
1388
+ "name": "New Product Category",
1389
+ "slug": "new-product-category",
1390
+ "description": "Category description",
1391
+ "image": 1
1392
+ }`,
1393
+ },
1394
+ {
1395
+ id: 'update-product-category',
1396
+ method: 'PUT',
1397
+ path: getApiPath('/api/webbycommerce/product-categories/:id'),
1398
+ title: formatMessage({
1399
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.update.title`,
1400
+ defaultMessage: 'Update Product Category',
1401
+ }),
1402
+ summary: formatMessage({
1403
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.update.summary`,
1404
+ defaultMessage: 'Update an existing product category. Requires administrator privileges.',
1405
+ }),
1406
+ auth: formatMessage({
1407
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.authAdmin`,
1408
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1409
+ }),
1410
+ response: `{
1411
+ "data": { "id": 2, "name": "Updated Product Category", "slug": "updated-product-category", "description": "Updated description", "image": {"id": 2, "url": "/uploads/updated-product-category-category.png", "alternativeText": "updated-product-category category image"} }
1412
+ }`,
1413
+ usage: ['Include the JWT token in the Authorization header.'],
1414
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/product-categories/2')} \\
1415
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1416
+ -H "Content-Type: application/json" \\
1417
+ -d '{"name": "Updated Product Category"}'`,
1418
+ requestBody: `{
1419
+ "name": "Updated Product Category",
1420
+ "slug": "updated-product-category",
1421
+ "description": "Updated description",
1422
+ "image": 2
1423
+ }`,
1424
+ },
1425
+ {
1426
+ id: 'delete-product-category',
1427
+ method: 'DELETE',
1428
+ path: getApiPath('/api/webbycommerce/product-categories/:id'),
1429
+ title: formatMessage({
1430
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.delete.title`,
1431
+ defaultMessage: 'Delete Product Category',
1432
+ }),
1433
+ summary: formatMessage({
1434
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.delete.summary`,
1435
+ defaultMessage: 'Delete a product category. Requires administrator privileges.',
1436
+ }),
1437
+ auth: formatMessage({
1438
+ id: `${PLUGIN_ID}.settings.apiCollections.productCategories.authAdmin`,
1439
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1440
+ }),
1441
+ response: `{
1442
+ "data": { "id": 2 }
1443
+ }`,
1444
+ usage: ['Include the JWT token in the Authorization header. Replace :id with the product category ID.'],
1445
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/product-categories/2')} \\
1446
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1447
+ },
1448
+ {
1449
+ id: 'get-tags',
1450
+ method: 'GET',
1451
+ path: getApiPath('/api/webbycommerce/tags'),
1452
+ title: formatMessage({
1453
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.getList.title`,
1454
+ defaultMessage: 'Get All Tags',
1455
+ }),
1456
+ summary: formatMessage({
1457
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.getList.summary`,
1458
+ defaultMessage: 'Retrieve all product tags with optional search.',
1459
+ }),
1460
+ auth: formatMessage({
1461
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.auth`,
1462
+ defaultMessage: 'Auth: public (no authentication required).',
1463
+ }),
1464
+ response: `{
1465
+ "data": [
1466
+ { "id": 1, "name": "New", "slug": "new", "createdAt": "2024-01-01T00:00:00.000Z" }
1467
+ ],
1468
+ "meta": { "total": 1, "limit": 50, "start": 0 }
1469
+ }`,
1470
+ usage: ['Optional query parameters: ?search=tag&limit=50&start=0'],
1471
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/tags')}`,
1472
+ },
1473
+ {
1474
+ id: 'get-tag',
1475
+ method: 'GET',
1476
+ path: getApiPath('/api/webbycommerce/tags/:id'),
1477
+ title: formatMessage({
1478
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.getSingle.title`,
1479
+ defaultMessage: 'Get Single Tag',
1480
+ }),
1481
+ summary: formatMessage({
1482
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.getSingle.summary`,
1483
+ defaultMessage: 'Retrieve a specific tag by ID.',
1484
+ }),
1485
+ auth: formatMessage({
1486
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.auth`,
1487
+ defaultMessage: 'Auth: public (no authentication required).',
1488
+ }),
1489
+ response: `{
1490
+ "data": { "id": 1, "name": "New", "slug": "new", "products": [] }
1491
+ }`,
1492
+ usage: ['Replace :id with the actual tag ID.'],
1493
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/tags/1')}`,
1494
+ },
1495
+ {
1496
+ id: 'create-tag',
1497
+ method: 'POST',
1498
+ path: getApiPath('/api/webbycommerce/tags'),
1499
+ title: formatMessage({
1500
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.create.title`,
1501
+ defaultMessage: 'Create Tag',
1502
+ }),
1503
+ summary: formatMessage({
1504
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.create.summary`,
1505
+ defaultMessage: 'Create a new product tag. Requires administrator privileges.',
1506
+ }),
1507
+ auth: formatMessage({
1508
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.authAdmin`,
1509
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1510
+ }),
1511
+ response: `{
1512
+ "data": { "id": 2, "name": "New Tag", "slug": "new-tag" }
1513
+ }`,
1514
+ usage: ['Include the JWT token in the Authorization header. Name is required.'],
1515
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/tags')} \\
1516
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1517
+ -H "Content-Type: application/json" \\
1518
+ -d '{"name": "New Tag"}'`,
1519
+ requestBody: `{
1520
+ "name": "New Tag",
1521
+ "slug": "new-tag"
1522
+ }`,
1523
+ },
1524
+ {
1525
+ id: 'update-tag',
1526
+ method: 'PUT',
1527
+ path: getApiPath('/api/webbycommerce/tags/:id'),
1528
+ title: formatMessage({
1529
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.update.title`,
1530
+ defaultMessage: 'Update Tag',
1531
+ }),
1532
+ summary: formatMessage({
1533
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.update.summary`,
1534
+ defaultMessage: 'Update an existing tag. Requires administrator privileges.',
1535
+ }),
1536
+ auth: formatMessage({
1537
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.authAdmin`,
1538
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1539
+ }),
1540
+ response: `{
1541
+ "data": { "id": 2, "name": "Updated Tag", "slug": "updated-tag" }
1542
+ }`,
1543
+ usage: ['Include the JWT token in the Authorization header.'],
1544
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/tags/2')} \\
1545
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1546
+ -H "Content-Type: application/json" \\
1547
+ -d '{"name": "Updated Tag"}'`,
1548
+ requestBody: `{
1549
+ "name": "Updated Tag",
1550
+ "slug": "updated-tag"
1551
+ }`,
1552
+ },
1553
+ {
1554
+ id: 'delete-tag',
1555
+ method: 'DELETE',
1556
+ path: getApiPath('/api/webbycommerce/tags/:id'),
1557
+ title: formatMessage({
1558
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.delete.title`,
1559
+ defaultMessage: 'Delete Tag',
1560
+ }),
1561
+ summary: formatMessage({
1562
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.delete.summary`,
1563
+ defaultMessage: 'Delete a tag. Requires administrator privileges.',
1564
+ }),
1565
+ auth: formatMessage({
1566
+ id: `${PLUGIN_ID}.settings.apiCollections.tags.authAdmin`,
1567
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
1568
+ }),
1569
+ response: `{
1570
+ "data": { "id": 2 }
1571
+ }`,
1572
+ usage: ['Include the JWT token in the Authorization header. Replace :id with the tag ID.'],
1573
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/tags/2')} \\
1574
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1575
+ },
1576
+ {
1577
+ id: 'get-cart',
1578
+ method: 'GET',
1579
+ path: getApiPath('/api/webbycommerce/cart'),
1580
+ title: formatMessage({
1581
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.getCart.title`,
1582
+ defaultMessage: 'Get My Cart',
1583
+ }),
1584
+ summary: formatMessage({
1585
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.getCart.summary`,
1586
+ defaultMessage: 'Retrieve the authenticated user\'s active cart with items and totals.',
1587
+ }),
1588
+ auth: formatMessage({
1589
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1590
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1591
+ }),
1592
+ response: `{
1593
+ "data": {
1594
+ "id": 1,
1595
+ "status": "active",
1596
+ "currency": "USD",
1597
+ "subtotal": 59.98,
1598
+ "tax": 0,
1599
+ "discount": 0,
1600
+ "total": 59.98,
1601
+ "items": [
1602
+ {
1603
+ "id": 10,
1604
+ "product_id": 1,
1605
+ "product_variation_id": null,
1606
+ "quantity": 2,
1607
+ "unit_price": 29.99,
1608
+ "total_price": 59.98,
1609
+ "product": {
1610
+ "id": 1,
1611
+ "name": "Sample Product",
1612
+ "slug": "sample-product",
1613
+ "sku": "SP001",
1614
+ "image": "/uploads/sample.jpg"
1615
+ },
1616
+ "added_at": "2024-01-01T00:00:00.000Z"
1617
+ }
1618
+ ],
1619
+ "meta": {
1620
+ "total_items": 1,
1621
+ "total_quantity": 2
1622
+ }
1623
+ }
1624
+ }`,
1625
+ usage: [
1626
+ formatMessage({
1627
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.getCart.usage.cart`,
1628
+ defaultMessage: 'Returns cart with calculated subtotal/tax/discount/total.',
1629
+ }),
1630
+ formatMessage({
1631
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.getCart.usage.items`,
1632
+ defaultMessage: 'Includes cart items with product details and pricing snapshot.',
1633
+ }),
1634
+ ],
1635
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/cart')} \\
1636
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1637
+ },
1638
+ {
1639
+ id: 'create-cart',
1640
+ method: 'POST',
1641
+ path: getApiPath('/api/webbycommerce/cart/create'),
1642
+ title: formatMessage({
1643
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.createCart.title`,
1644
+ defaultMessage: 'Create Cart (If Missing)',
1645
+ }),
1646
+ summary: formatMessage({
1647
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.createCart.summary`,
1648
+ defaultMessage: 'Create the authenticated user\'s cart if it does not already exist.',
1649
+ }),
1650
+ auth: formatMessage({
1651
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1652
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1653
+ }),
1654
+ response: `{
1655
+ "data": {
1656
+ "id": 1,
1657
+ "status": "active",
1658
+ "currency": "USD",
1659
+ "subtotal": 0,
1660
+ "tax": 0,
1661
+ "discount": 0,
1662
+ "total": 0,
1663
+ "items": [],
1664
+ "meta": {
1665
+ "total_items": 0,
1666
+ "total_quantity": 0
1667
+ }
1668
+ },
1669
+ "message": "Cart ready"
1670
+ }`,
1671
+ usage: [
1672
+ formatMessage({
1673
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.createCart.usage.create`,
1674
+ defaultMessage: 'Useful on login or app bootstrap to ensure a cart exists.',
1675
+ }),
1676
+ ],
1677
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/cart/create')} \\
1678
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1679
+ },
1680
+ {
1681
+ id: 'add-cart-item',
1682
+ method: 'POST',
1683
+ path: getApiPath('/api/webbycommerce/cart'),
1684
+ title: formatMessage({
1685
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.addItem.title`,
1686
+ defaultMessage: 'Add Item to Cart',
1687
+ }),
1688
+ summary: formatMessage({
1689
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.addItem.summary`,
1690
+ defaultMessage: 'Add a product to the authenticated user\'s shopping cart or update quantity if product already exists.',
1691
+ }),
1692
+ auth: formatMessage({
1693
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1694
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1695
+ }),
1696
+ response: `{
1697
+ "data": {
1698
+ "id": 1,
1699
+ "status": "active",
1700
+ "currency": "USD",
1701
+ "subtotal": 89.97,
1702
+ "tax": 0,
1703
+ "discount": 0,
1704
+ "total": 89.97,
1705
+ "items": [
1706
+ {
1707
+ "id": 10,
1708
+ "product_id": 1,
1709
+ "product_variation_id": null,
1710
+ "quantity": 3,
1711
+ "unit_price": 29.99,
1712
+ "total_price": 89.97
1713
+ }
1714
+ ],
1715
+ "meta": {
1716
+ "total_items": 1,
1717
+ "total_quantity": 3
1718
+ }
1719
+ },
1720
+ "message": "Item added to cart successfully"
1721
+ }`,
1722
+ usage: [
1723
+ formatMessage({
1724
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.addItem.usage.product`,
1725
+ defaultMessage: 'Provide product ID and quantity to add to cart.',
1726
+ }),
1727
+ formatMessage({
1728
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.addItem.usage.existing`,
1729
+ defaultMessage: 'If product already exists in cart, quantity will be increased.',
1730
+ }),
1731
+ formatMessage({
1732
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.addItem.usage.stock`,
1733
+ defaultMessage: 'System validates stock availability before adding to cart.',
1734
+ }),
1735
+ ],
1736
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/cart')} \\
1737
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1738
+ -H "Content-Type: application/json" \\
1739
+ -d '{"product_id": 1, "product_variation_id": null, "quantity": 2}'`,
1740
+ requestBody: `{
1741
+ "product_id": 1,
1742
+ "product_variation_id": null,
1743
+ "quantity": 2
1744
+ }`,
1745
+ },
1746
+ {
1747
+ id: 'update-cart-item',
1748
+ method: 'PUT',
1749
+ path: getApiPath('/api/webbycommerce/cart/:cartItemId'),
1750
+ title: formatMessage({
1751
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.updateItem.title`,
1752
+ defaultMessage: 'Update Cart Item',
1753
+ }),
1754
+ summary: formatMessage({
1755
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.updateItem.summary`,
1756
+ defaultMessage: 'Update the quantity of a specific item in the authenticated user\'s shopping cart.',
1757
+ }),
1758
+ auth: formatMessage({
1759
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1760
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1761
+ }),
1762
+ response: `{
1763
+ "data": {
1764
+ "id": 1,
1765
+ "status": "active",
1766
+ "currency": "USD",
1767
+ "subtotal": 149.95,
1768
+ "tax": 0,
1769
+ "discount": 0,
1770
+ "total": 149.95,
1771
+ "items": [
1772
+ { "id": 10, "product_id": 1, "quantity": 5, "unit_price": 29.99, "total_price": 149.95 }
1773
+ ],
1774
+ "meta": { "total_items": 1, "total_quantity": 5 }
1775
+ },
1776
+ "message": "Cart item updated successfully"
1777
+ }`,
1778
+ usage: [
1779
+ formatMessage({
1780
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.updateItem.usage.quantity`,
1781
+ defaultMessage: 'Update quantity for an existing cart item.',
1782
+ }),
1783
+ formatMessage({
1784
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.updateItem.usage.zero`,
1785
+ defaultMessage: 'Setting quantity to 0 will remove the item from cart.',
1786
+ }),
1787
+ ],
1788
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/cart/1')} \\
1789
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1790
+ -H "Content-Type: application/json" \\
1791
+ -d '{"quantity": 5}'`,
1792
+ requestBody: `{
1793
+ "quantity": 5
1794
+ }`,
1795
+ },
1796
+ {
1797
+ id: 'remove-cart-item',
1798
+ method: 'DELETE',
1799
+ path: getApiPath('/api/webbycommerce/cart/:cartItemId'),
1800
+ title: formatMessage({
1801
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.removeItem.title`,
1802
+ defaultMessage: 'Remove Cart Item',
1803
+ }),
1804
+ summary: formatMessage({
1805
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.removeItem.summary`,
1806
+ defaultMessage: 'Remove a specific item from the authenticated user\'s shopping cart.',
1807
+ }),
1808
+ auth: formatMessage({
1809
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1810
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1811
+ }),
1812
+ response: `{
1813
+ "data": {
1814
+ "id": 1,
1815
+ "status": "active",
1816
+ "currency": "USD",
1817
+ "subtotal": 0,
1818
+ "tax": 0,
1819
+ "discount": 0,
1820
+ "total": 0,
1821
+ "items": [],
1822
+ "meta": { "total_items": 0, "total_quantity": 0 }
1823
+ },
1824
+ "message": "Item removed from cart successfully"
1825
+ }`,
1826
+ usage: [
1827
+ formatMessage({
1828
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.removeItem.usage.item`,
1829
+ defaultMessage: 'Remove a specific item by providing cart item ID.',
1830
+ }),
1831
+ ],
1832
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/cart/1')} \\
1833
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1834
+ },
1835
+ {
1836
+ id: 'clear-cart',
1837
+ method: 'DELETE',
1838
+ path: getApiPath('/api/webbycommerce/cart'),
1839
+ title: formatMessage({
1840
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.clearCart.title`,
1841
+ defaultMessage: 'Clear Cart',
1842
+ }),
1843
+ summary: formatMessage({
1844
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.clearCart.summary`,
1845
+ defaultMessage: 'Remove all items from the authenticated user\'s shopping cart.',
1846
+ }),
1847
+ auth: formatMessage({
1848
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1849
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1850
+ }),
1851
+ response: `{
1852
+ "data": {
1853
+ "id": 1,
1854
+ "status": "active",
1855
+ "currency": "USD",
1856
+ "subtotal": 0,
1857
+ "tax": 0,
1858
+ "discount": 0,
1859
+ "total": 0,
1860
+ "items": [],
1861
+ "meta": { "total_items": 0, "total_quantity": 0 }
1862
+ },
1863
+ "message": "Cart cleared successfully"
1864
+ }`,
1865
+ usage: [
1866
+ formatMessage({
1867
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.clearCart.usage.all`,
1868
+ defaultMessage: 'Removes all items from the cart in one operation.',
1869
+ }),
1870
+ ],
1871
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/cart')} \\
1872
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1873
+ },
1874
+ {
1875
+ id: 'cart-checkout',
1876
+ method: 'POST',
1877
+ path: getApiPath('/api/webbycommerce/cart/checkout'),
1878
+ title: formatMessage({
1879
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.checkout.title`,
1880
+ defaultMessage: 'Checkout Cart (Mark Ordered)',
1881
+ }),
1882
+ summary: formatMessage({
1883
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.checkout.summary`,
1884
+ defaultMessage: 'Mark the authenticated user\'s cart as ordered.',
1885
+ }),
1886
+ auth: formatMessage({
1887
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.auth`,
1888
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1889
+ }),
1890
+ response: `{
1891
+ "data": {
1892
+ "id": 1,
1893
+ "status": "ordered",
1894
+ "currency": "USD",
1895
+ "subtotal": 149.95,
1896
+ "tax": 0,
1897
+ "discount": 0,
1898
+ "total": 149.95,
1899
+ "items": [
1900
+ { "id": 10, "product_id": 1, "quantity": 5, "unit_price": 29.99, "total_price": 149.95 }
1901
+ ],
1902
+ "meta": { "total_items": 1, "total_quantity": 5 }
1903
+ },
1904
+ "message": "Cart checked out successfully"
1905
+ }`,
1906
+ usage: [
1907
+ formatMessage({
1908
+ id: `${PLUGIN_ID}.settings.apiCollections.cart.checkout.usage.status`,
1909
+ defaultMessage: 'Updates cart status to ordered (order creation is handled by the /checkout endpoint).',
1910
+ }),
1911
+ ],
1912
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/cart/checkout')} \\
1913
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
1914
+ },
1915
+ {
1916
+ id: 'checkout',
1917
+ method: 'POST',
1918
+ path: getApiPath('/api/webbycommerce/checkout'),
1919
+ title: formatMessage({
1920
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.title`,
1921
+ defaultMessage: 'Checkout',
1922
+ }),
1923
+ summary: formatMessage({
1924
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.summary`,
1925
+ defaultMessage: 'Process checkout for the authenticated user\'s cart, create an order, update inventory, and clear the cart.',
1926
+ }),
1927
+ auth: formatMessage({
1928
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.auth`,
1929
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
1930
+ }),
1931
+ response: `{
1932
+ "data": {
1933
+ "order_id": 1,
1934
+ "order_number": "ORD-1703123456789-123",
1935
+ "status": "pending",
1936
+ "total": 149.99,
1937
+ "currency": "USD",
1938
+ "items": [
1939
+ {
1940
+ "product_id": 1,
1941
+ "product_name": "Sample Product",
1942
+ "product_sku": "SP001",
1943
+ "product_price": 49.99,
1944
+ "quantity": 3,
1945
+ "total_price": 149.97
1946
+ }
1947
+ ],
1948
+ "created_at": "2024-01-01T00:00:00.000Z"
1949
+ },
1950
+ "message": "Order created successfully"
1951
+ }`,
1952
+ usage: [
1953
+ formatMessage({
1954
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.usage.cart`,
1955
+ defaultMessage: 'Requires items in the user\'s cart before checkout.',
1956
+ }),
1957
+ formatMessage({
1958
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.usage.validation`,
1959
+ defaultMessage: 'Validates stock availability and cart contents.',
1960
+ }),
1961
+ formatMessage({
1962
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.usage.inventory`,
1963
+ defaultMessage: 'Automatically updates product inventory after successful checkout.',
1964
+ }),
1965
+ formatMessage({
1966
+ id: `${PLUGIN_ID}.settings.apiCollections.checkout.usage.clear`,
1967
+ defaultMessage: 'Clears the cart after successful order creation.',
1968
+ }),
1969
+ ],
1970
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/checkout')} \\
1971
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
1972
+ -H "Content-Type: application/json" \\
1973
+ -d '{"billing_address": {"first_name": "John", "last_name": "Doe", "email": "john@example.com", "address_line_1": "123 Main St", "city": "New York", "postal_code": "10001", "country": "US"}, "shipping_address": {"first_name": "John", "last_name": "Doe", "address_line_1": "123 Main St", "city": "New York", "postal_code": "10001", "country": "US"}, "payment_method": {"type": "credit_card", "card_number": "****-****-****-1234", "expiry_date": "12/25"}, "shipping_method": "standard"}'`,
1974
+ requestBody: `{
1975
+ "billing_address": {
1976
+ "first_name": "John",
1977
+ "last_name": "Doe",
1978
+ "email": "john@example.com",
1979
+ "phone": "+1234567890",
1980
+ "address_line_1": "123 Main Street",
1981
+ "city": "New York",
1982
+ "state": "NY",
1983
+ "postal_code": "10001",
1984
+ "country": "US"
1985
+ },
1986
+ "shipping_address": {
1987
+ "first_name": "John",
1988
+ "last_name": "Doe",
1989
+ "address_line_1": "123 Main Street",
1990
+ "city": "New York",
1991
+ "state": "NY",
1992
+ "postal_code": "10001",
1993
+ "country": "US"
1994
+ },
1995
+ "payment_method": {
1996
+ "type": "credit_card",
1997
+ "card_number": "****-****-****-1234",
1998
+ "expiry_date": "12/25",
1999
+ "card_holder_name": "John Doe"
2000
+ },
2001
+ "shipping_method": "standard",
2002
+ "notes": "Please handle with care"
2003
+ }`,
2004
+ },
2005
+ {
2006
+ id: 'get-orders',
2007
+ method: 'GET',
2008
+ path: getApiPath('/api/webbycommerce/orders'),
2009
+ title: formatMessage({
2010
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getList.title`,
2011
+ defaultMessage: 'Get Orders',
2012
+ }),
2013
+ summary: formatMessage({
2014
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getList.summary`,
2015
+ defaultMessage: 'Retrieve all orders for the authenticated user with optional filtering and pagination.',
2016
+ }),
2017
+ auth: formatMessage({
2018
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.auth`,
2019
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
2020
+ }),
2021
+ response: `{
2022
+ "data": [
2023
+ {
2024
+ "id": 1,
2025
+ "order_number": "ORD-1703123456789-123",
2026
+ "status": "delivered",
2027
+ "total": 149.99,
2028
+ "currency": "USD",
2029
+ "items_count": 3,
2030
+ "created_at": "2024-01-01T00:00:00.000Z",
2031
+ "estimated_delivery": "2024-01-05T00:00:00.000Z"
2032
+ }
2033
+ ],
2034
+ "meta": {
2035
+ "pagination": {
2036
+ "page": 1,
2037
+ "limit": 10,
2038
+ "total": 5,
2039
+ "pages": 1
2040
+ }
2041
+ }
2042
+ }`,
2043
+ usage: [
2044
+ formatMessage({
2045
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getList.usage.pagination`,
2046
+ defaultMessage: 'Supports pagination with ?page=1&limit=10 parameters.',
2047
+ }),
2048
+ formatMessage({
2049
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getList.usage.filter`,
2050
+ defaultMessage: 'Filter by status with ?status=delivered parameter.',
2051
+ }),
2052
+ formatMessage({
2053
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getList.usage.sort`,
2054
+ defaultMessage: 'Orders are sorted by creation date (newest first).',
2055
+ }),
2056
+ ],
2057
+ getCurl: () => `curl -X GET "http://localhost:1337${getApiPath('/api/webbycommerce/orders')}?page=1&limit=10&status=delivered" \\
2058
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2059
+ },
2060
+ {
2061
+ id: 'get-order',
2062
+ method: 'GET',
2063
+ path: getApiPath('/api/webbycommerce/orders/:id'),
2064
+ title: formatMessage({
2065
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getSingle.title`,
2066
+ defaultMessage: 'Get Order Details',
2067
+ }),
2068
+ summary: formatMessage({
2069
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getSingle.summary`,
2070
+ defaultMessage: 'Retrieve detailed information for a specific order by ID.',
2071
+ }),
2072
+ auth: formatMessage({
2073
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.auth`,
2074
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
2075
+ }),
2076
+ response: `{
2077
+ "data": {
2078
+ "id": 1,
2079
+ "order_number": "ORD-1703123456789-123",
2080
+ "status": "delivered",
2081
+ "payment_status": "paid",
2082
+ "items": [
2083
+ {
2084
+ "product_id": 1,
2085
+ "product_name": "Sample Product",
2086
+ "product_sku": "SP001",
2087
+ "product_price": 49.99,
2088
+ "quantity": 3,
2089
+ "total_price": 149.97
2090
+ }
2091
+ ],
2092
+ "subtotal": "149.97",
2093
+ "tax_amount": "0.00",
2094
+ "shipping_amount": "0.00",
2095
+ "discount_amount": "0.00",
2096
+ "total": "149.97",
2097
+ "currency": "USD",
2098
+ "billing_address": {
2099
+ "first_name": "John",
2100
+ "last_name": "Doe",
2101
+ "email": "john@example.com",
2102
+ "address_line_1": "123 Main Street",
2103
+ "city": "New York",
2104
+ "postal_code": "10001",
2105
+ "country": "US"
2106
+ },
2107
+ "shipping_address": {
2108
+ "first_name": "John",
2109
+ "last_name": "Doe",
2110
+ "address_line_1": "123 Main Street",
2111
+ "city": "New York",
2112
+ "postal_code": "10001",
2113
+ "country": "US"
2114
+ },
2115
+ "payment_method": {
2116
+ "type": "credit_card",
2117
+ "card_number": "****-****-****-1234",
2118
+ "expiry_date": "12/25"
2119
+ },
2120
+ "shipping_method": "standard",
2121
+ "notes": "Please handle with care",
2122
+ "tracking_number": "TRK123456789",
2123
+ "estimated_delivery": "2024-01-05T00:00:00.000Z",
2124
+ "created_at": "2024-01-01T00:00:00.000Z",
2125
+ "updated_at": "2024-01-01T12:00:00.000Z"
2126
+ }
2127
+ }`,
2128
+ usage: [
2129
+ formatMessage({
2130
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getSingle.usage.id`,
2131
+ defaultMessage: 'Replace :id with the actual order ID.',
2132
+ }),
2133
+ formatMessage({
2134
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getSingle.usage.ownership`,
2135
+ defaultMessage: 'Users can only view their own orders.',
2136
+ }),
2137
+ formatMessage({
2138
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getSingle.usage.details`,
2139
+ defaultMessage: 'Returns complete order information including addresses and payment details.',
2140
+ }),
2141
+ ],
2142
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/orders/1')} \\
2143
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2144
+ },
2145
+ {
2146
+ id: 'cancel-order',
2147
+ method: 'PUT',
2148
+ path: getApiPath('/api/webbycommerce/orders/:id/cancel'),
2149
+ title: formatMessage({
2150
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.cancel.title`,
2151
+ defaultMessage: 'Cancel Order',
2152
+ }),
2153
+ summary: formatMessage({
2154
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.cancel.summary`,
2155
+ defaultMessage: 'Cancel a pending order and restore product inventory.',
2156
+ }),
2157
+ auth: formatMessage({
2158
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.auth`,
2159
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
2160
+ }),
2161
+ response: `{
2162
+ "data": {
2163
+ "id": 1,
2164
+ "order_number": "ORD-1703123456789-123",
2165
+ "status": "cancelled"
2166
+ },
2167
+ "message": "Order cancelled successfully"
2168
+ }`,
2169
+ usage: [
2170
+ formatMessage({
2171
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.cancel.usage.pending`,
2172
+ defaultMessage: 'Only pending orders can be cancelled.',
2173
+ }),
2174
+ formatMessage({
2175
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.cancel.usage.inventory`,
2176
+ defaultMessage: 'Automatically restores product inventory when order is cancelled.',
2177
+ }),
2178
+ formatMessage({
2179
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.cancel.usage.ownership`,
2180
+ defaultMessage: 'Users can only cancel their own orders.',
2181
+ }),
2182
+ ],
2183
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/orders/1/cancel')} \\
2184
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2185
+ },
2186
+ {
2187
+ id: 'update-order-status',
2188
+ method: 'PUT',
2189
+ path: getApiPath('/api/webbycommerce/orders/:id/status'),
2190
+ title: formatMessage({
2191
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.title`,
2192
+ defaultMessage: 'Update Order Status',
2193
+ }),
2194
+ summary: formatMessage({
2195
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.summary`,
2196
+ defaultMessage: 'Update the status of an existing order (admin functionality or user\'s own orders).',
2197
+ }),
2198
+ auth: formatMessage({
2199
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.auth`,
2200
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
2201
+ }),
2202
+ response: `{
2203
+ "data": {
2204
+ "id": 1,
2205
+ "order_number": "ORD-1703123456789-123",
2206
+ "status": "shipped",
2207
+ "tracking_number": "TRK123456789",
2208
+ "estimated_delivery": "2024-01-10T00:00:00.000Z",
2209
+ "updated_at": "2024-01-05T12:00:00.000Z"
2210
+ },
2211
+ "message": "Order status updated successfully"
2212
+ }`,
2213
+ usage: [
2214
+ formatMessage({
2215
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.usage.admin`,
2216
+ defaultMessage: 'Administrators can update any order status.',
2217
+ }),
2218
+ formatMessage({
2219
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.usage.user`,
2220
+ defaultMessage: 'Regular users can only update their own orders.',
2221
+ }),
2222
+ formatMessage({
2223
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.usage.stock`,
2224
+ defaultMessage: 'Cancelling an order automatically restores product inventory.',
2225
+ }),
2226
+ formatMessage({
2227
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.updateStatus.usage.email`,
2228
+ defaultMessage: 'Status updates trigger email notifications to customers.',
2229
+ }),
2230
+ ],
2231
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/orders/1/status')} \\
2232
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
2233
+ -H "Content-Type: application/json" \\
2234
+ -d '{"status": "shipped", "tracking_number": "TRK123456789", "estimated_delivery": "2024-01-10T00:00:00.000Z"}'`,
2235
+ requestBody: `{
2236
+ "status": "shipped",
2237
+ "tracking_number": "TRK123456789",
2238
+ "estimated_delivery": "2024-01-10T00:00:00.000Z",
2239
+ "notes": "Order has been shipped via UPS"
2240
+ }`,
2241
+ },
2242
+ {
2243
+ id: 'get-order-tracking',
2244
+ method: 'GET',
2245
+ path: getApiPath('/api/webbycommerce/orders/:id/tracking'),
2246
+ title: formatMessage({
2247
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.title`,
2248
+ defaultMessage: 'Get Order Tracking',
2249
+ }),
2250
+ summary: formatMessage({
2251
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.summary`,
2252
+ defaultMessage: 'Retrieve detailed tracking information and timeline for a specific order.',
2253
+ }),
2254
+ auth: formatMessage({
2255
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.auth`,
2256
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
2257
+ }),
2258
+ response: `{
2259
+ "data": {
2260
+ "order_id": 1,
2261
+ "order_number": "ORD-1703123456789-123",
2262
+ "status": "shipped",
2263
+ "tracking_number": "TRK123456789",
2264
+ "estimated_delivery": "2024-01-10T00:00:00.000Z",
2265
+ "shipping_method": "standard",
2266
+ "shipping_address": {
2267
+ "first_name": "John",
2268
+ "last_name": "Doe",
2269
+ "address_line_1": "123 Main Street",
2270
+ "city": "New York",
2271
+ "postal_code": "10001",
2272
+ "country": "US"
2273
+ },
2274
+ "tracking_timeline": [
2275
+ {
2276
+ "status": "Order Placed",
2277
+ "description": "Your order has been successfully placed",
2278
+ "timestamp": "2024-01-01T10:00:00.000Z",
2279
+ "completed": true
2280
+ },
2281
+ {
2282
+ "status": "Order Confirmed",
2283
+ "description": "Your order has been confirmed and is being prepared",
2284
+ "timestamp": "2024-01-01T10:30:00.000Z",
2285
+ "completed": true
2286
+ },
2287
+ {
2288
+ "status": "Order Shipped",
2289
+ "description": "Your order has been shipped (Tracking: TRK123456789)",
2290
+ "timestamp": "2024-01-05T12:00:00.000Z",
2291
+ "completed": true
2292
+ },
2293
+ {
2294
+ "status": "Order Delivered",
2295
+ "description": "Estimated delivery: 1/10/2024",
2296
+ "completed": false
2297
+ }
2298
+ ],
2299
+ "current_location": "In Transit",
2300
+ "delivery_status": "Your order is on the way"
2301
+ }
2302
+ }`,
2303
+ usage: [
2304
+ formatMessage({
2305
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.usage.timeline`,
2306
+ defaultMessage: 'Returns a complete tracking timeline showing order progress.',
2307
+ }),
2308
+ formatMessage({
2309
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.usage.location`,
2310
+ defaultMessage: 'Shows current location and delivery status.',
2311
+ }),
2312
+ formatMessage({
2313
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.usage.ownership`,
2314
+ defaultMessage: 'Users can only track their own orders.',
2315
+ }),
2316
+ formatMessage({
2317
+ id: `${PLUGIN_ID}.settings.apiCollections.orders.getTracking.usage.realTime`,
2318
+ defaultMessage: 'Tracking information updates in real-time based on order status.',
2319
+ }),
2320
+ ],
2321
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/orders/1/tracking')} \\
2322
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2323
+ },
2324
+ {
2325
+ id: 'get-wishlist',
2326
+ method: 'GET',
2327
+ path: getApiPath('/api/webbycommerce/wishlist'),
2328
+ title: formatMessage({
2329
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.getWishlist.title`,
2330
+ defaultMessage: 'Get Wishlist',
2331
+ }),
2332
+ summary: formatMessage({
2333
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.getWishlist.summary`,
2334
+ defaultMessage: 'Retrieve all products in the authenticated user\'s wishlist.',
2335
+ }),
2336
+ auth: formatMessage({
2337
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2338
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2339
+ }),
2340
+ response: `{
2341
+ "data": {
2342
+ "id": 1,
2343
+ "userId": "123",
2344
+ "userEmail": "user@example.com",
2345
+ "products": [
2346
+ {
2347
+ "id": 1,
2348
+ "name": "Sample Product",
2349
+ "price": 29.99,
2350
+ "images": [{"url": "https://example.com/image.jpg"}]
2351
+ }
2352
+ ],
2353
+ "isPublic": false
2354
+ },
2355
+ "meta": {
2356
+ "totalProducts": 3,
2357
+ "totalValue": 89.97,
2358
+ "categories": [{"name": "Electronics", "count": 2}]
2359
+ }
2360
+ }`,
2361
+ usage: [
2362
+ formatMessage({
2363
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.getWishlist.title`,
2364
+ defaultMessage: 'GET /wishlist - Get user\'s wishlist',
2365
+ }),
2366
+ ],
2367
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')} \\
2368
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2369
+ },
2370
+ {
2371
+ id: 'add-to-wishlist',
2372
+ method: 'POST',
2373
+ path: getApiPath('/api/webbycommerce/wishlist'),
2374
+ title: formatMessage({
2375
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.addToWishlist.title`,
2376
+ defaultMessage: 'Add to Wishlist',
2377
+ }),
2378
+ summary: formatMessage({
2379
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.addToWishlist.summary`,
2380
+ defaultMessage: 'Add a product to the authenticated user\'s wishlist.',
2381
+ }),
2382
+ auth: formatMessage({
2383
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2384
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2385
+ }),
2386
+ response: `{
2387
+ "data": {
2388
+ "id": 1,
2389
+ "products": [1, 2, 3]
2390
+ },
2391
+ "meta": {
2392
+ "totalProducts": 3,
2393
+ "totalValue": 89.97
2394
+ },
2395
+ "message": "Product added to wishlist successfully"
2396
+ }`,
2397
+ usage: [
2398
+ formatMessage({
2399
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.addToWishlist.title`,
2400
+ defaultMessage: 'POST /wishlist - Add product to wishlist',
2401
+ }),
2402
+ ],
2403
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')} \\
2404
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
2405
+ -H "Content-Type: application/json" \\
2406
+ -d '{"productId": 1}'`,
2407
+ requestBody: `{
2408
+ "productId": 1
2409
+ }`,
2410
+ },
2411
+ {
2412
+ id: 'remove-from-wishlist',
2413
+ method: 'DELETE',
2414
+ path: getApiPath('/api/webbycommerce/wishlist/{productId}'),
2415
+ title: formatMessage({
2416
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.removeFromWishlist.title`,
2417
+ defaultMessage: 'Remove from Wishlist',
2418
+ }),
2419
+ summary: formatMessage({
2420
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.removeFromWishlist.summary`,
2421
+ defaultMessage: 'Remove a specific product from the authenticated user\'s wishlist.',
2422
+ }),
2423
+ auth: formatMessage({
2424
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2425
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2426
+ }),
2427
+ response: `{
2428
+ "data": {
2429
+ "id": 1,
2430
+ "products": [2, 3]
2431
+ },
2432
+ "meta": {
2433
+ "totalProducts": 2,
2434
+ "totalValue": 69.98
2435
+ },
2436
+ "message": "Product removed from wishlist successfully"
2437
+ }`,
2438
+ usage: [
2439
+ formatMessage({
2440
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.removeFromWishlist.title`,
2441
+ defaultMessage: 'DELETE /wishlist/{productId} - Remove from wishlist',
2442
+ }),
2443
+ ],
2444
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')}/1 \\
2445
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2446
+ },
2447
+ {
2448
+ id: 'clear-wishlist',
2449
+ method: 'DELETE',
2450
+ path: getApiPath('/api/webbycommerce/wishlist'),
2451
+ title: formatMessage({
2452
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.clearWishlist.title`,
2453
+ defaultMessage: 'Clear Wishlist',
2454
+ }),
2455
+ summary: formatMessage({
2456
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.clearWishlist.summary`,
2457
+ defaultMessage: 'Remove all products from the authenticated user\'s wishlist.',
2458
+ }),
2459
+ auth: formatMessage({
2460
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2461
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2462
+ }),
2463
+ response: `{
2464
+ "data": {
2465
+ "id": 1,
2466
+ "products": []
2467
+ },
2468
+ "meta": {
2469
+ "totalProducts": 0,
2470
+ "totalValue": 0
2471
+ },
2472
+ "message": "Wishlist cleared successfully"
2473
+ }`,
2474
+ usage: [
2475
+ formatMessage({
2476
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.clearWishlist.title`,
2477
+ defaultMessage: 'DELETE /wishlist - Clear entire wishlist',
2478
+ }),
2479
+ ],
2480
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')} \\
2481
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2482
+ },
2483
+ {
2484
+ id: 'update-wishlist',
2485
+ method: 'PUT',
2486
+ path: getApiPath('/api/webbycommerce/wishlist'),
2487
+ title: formatMessage({
2488
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.updateWishlist.title`,
2489
+ defaultMessage: 'Update Wishlist Settings',
2490
+ }),
2491
+ summary: formatMessage({
2492
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.updateWishlist.summary`,
2493
+ defaultMessage: 'Update wishlist settings and preferences.',
2494
+ }),
2495
+ auth: formatMessage({
2496
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2497
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2498
+ }),
2499
+ response: `{
2500
+ "data": {
2501
+ "id": 1,
2502
+ "name": "My Favorites",
2503
+ "description": "My favorite products",
2504
+ "isPublic": true
2505
+ },
2506
+ "message": "Wishlist updated successfully"
2507
+ }`,
2508
+ usage: [
2509
+ formatMessage({
2510
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.updateWishlist.title`,
2511
+ defaultMessage: 'PUT /wishlist - Update wishlist settings',
2512
+ }),
2513
+ ],
2514
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')} \\
2515
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
2516
+ -H "Content-Type: application/json" \\
2517
+ -d '{"name": "My Favorites", "isPublic": true}'`,
2518
+ requestBody: `{
2519
+ "name": "My Favorites",
2520
+ "description": "My favorite products",
2521
+ "isPublic": true
2522
+ }`,
2523
+ },
2524
+ {
2525
+ id: 'check-wishlist-status',
2526
+ method: 'GET',
2527
+ path: getApiPath('/api/webbycommerce/wishlist/status'),
2528
+ title: formatMessage({
2529
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.checkWishlistStatus.title`,
2530
+ defaultMessage: 'Check Wishlist Status',
2531
+ }),
2532
+ summary: formatMessage({
2533
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.checkWishlistStatus.summary`,
2534
+ defaultMessage: 'Check if specific products are in the authenticated user\'s wishlist.',
2535
+ }),
2536
+ auth: formatMessage({
2537
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.auth`,
2538
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2539
+ }),
2540
+ response: `{
2541
+ "data": {
2542
+ "1": true,
2543
+ "2": false,
2544
+ "3": true
2545
+ },
2546
+ "message": "Wishlist status checked successfully"
2547
+ }`,
2548
+ usage: [
2549
+ formatMessage({
2550
+ id: `${PLUGIN_ID}.settings.apiCollections.wishlist.checkWishlistStatus.title`,
2551
+ defaultMessage: 'GET /wishlist/status - Check if products are in wishlist',
2552
+ }),
2553
+ ],
2554
+ getCurl: () => `curl -X GET "http://localhost:1337${getApiPath('/api/webbycommerce/wishlist')}/status?productIds=1,2,3" \\
2555
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2556
+ },
2557
+ {
2558
+ id: 'get-compare',
2559
+ method: 'GET',
2560
+ path: getApiPath('/api/webbycommerce/compare'),
2561
+ title: formatMessage({
2562
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareList.title`,
2563
+ defaultMessage: 'Get Compare List',
2564
+ }),
2565
+ summary: formatMessage({
2566
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareList.summary`,
2567
+ defaultMessage: 'Retrieve all products in the authenticated user\'s compare list.',
2568
+ }),
2569
+ auth: formatMessage({
2570
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2571
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2572
+ }),
2573
+ response: `{
2574
+ "data": {
2575
+ "id": 1,
2576
+ "userId": "123",
2577
+ "userEmail": "user@example.com",
2578
+ "products": [
2579
+ {
2580
+ "id": 1,
2581
+ "name": "Product A",
2582
+ "price": 29.99,
2583
+ "specifications": {"screen": "6.1 inch"}
2584
+ },
2585
+ {
2586
+ "id": 2,
2587
+ "name": "Product B",
2588
+ "price": 39.99,
2589
+ "specifications": {"screen": "6.5 inch"}
2590
+ }
2591
+ ],
2592
+ "category": {"id": 1, "name": "Electronics"}
2593
+ },
2594
+ "meta": {
2595
+ "totalProducts": 2,
2596
+ "comparisonData": {
2597
+ "specifications": {
2598
+ "screen": {"1": "6.1 inch", "2": "6.5 inch"}
2599
+ }
2600
+ }
2601
+ }
2602
+ }`,
2603
+ usage: [
2604
+ formatMessage({
2605
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareList.title`,
2606
+ defaultMessage: 'GET /compare - Get user\'s compare list',
2607
+ }),
2608
+ ],
2609
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/compare')} \\
2610
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2611
+ },
2612
+ {
2613
+ id: 'add-to-compare',
2614
+ method: 'POST',
2615
+ path: getApiPath('/api/webbycommerce/compare'),
2616
+ title: formatMessage({
2617
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.addToCompare.title`,
2618
+ defaultMessage: 'Add to Compare',
2619
+ }),
2620
+ summary: formatMessage({
2621
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.addToCompare.summary`,
2622
+ defaultMessage: 'Add a product to the authenticated user\'s compare list.',
2623
+ }),
2624
+ auth: formatMessage({
2625
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2626
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2627
+ }),
2628
+ response: `{
2629
+ "data": {
2630
+ "id": 1,
2631
+ "products": [1, 2, 3]
2632
+ },
2633
+ "meta": {
2634
+ "totalProducts": 3,
2635
+ "comparisonData": {...}
2636
+ },
2637
+ "message": "Product added to compare list successfully"
2638
+ }`,
2639
+ usage: [
2640
+ formatMessage({
2641
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.addToCompare.title`,
2642
+ defaultMessage: 'POST /compare - Add product to compare list',
2643
+ }),
2644
+ 'Maximum 4 products allowed in compare list',
2645
+ ],
2646
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/compare')} \\
2647
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
2648
+ -H "Content-Type: application/json" \\
2649
+ -d '{"productId": 1}'`,
2650
+ requestBody: `{
2651
+ "productId": 1
2652
+ }`,
2653
+ },
2654
+ {
2655
+ id: 'remove-from-compare',
2656
+ method: 'DELETE',
2657
+ path: getApiPath('/api/webbycommerce/compare/{productId}'),
2658
+ title: formatMessage({
2659
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.removeFromCompare.title`,
2660
+ defaultMessage: 'Remove from Compare',
2661
+ }),
2662
+ summary: formatMessage({
2663
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.removeFromCompare.summary`,
2664
+ defaultMessage: 'Remove a specific product from the authenticated user\'s compare list.',
2665
+ }),
2666
+ auth: formatMessage({
2667
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2668
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2669
+ }),
2670
+ response: `{
2671
+ "data": {
2672
+ "id": 1,
2673
+ "products": [2, 3]
2674
+ },
2675
+ "meta": {
2676
+ "totalProducts": 2,
2677
+ "comparisonData": {...}
2678
+ },
2679
+ "message": "Product removed from compare list successfully"
2680
+ }`,
2681
+ usage: [
2682
+ formatMessage({
2683
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.removeFromCompare.title`,
2684
+ defaultMessage: 'DELETE /compare/{productId} - Remove from compare list',
2685
+ }),
2686
+ ],
2687
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/compare')}/1 \\
2688
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2689
+ },
2690
+ {
2691
+ id: 'clear-compare',
2692
+ method: 'DELETE',
2693
+ path: getApiPath('/api/webbycommerce/compare'),
2694
+ title: formatMessage({
2695
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.clearCompare.title`,
2696
+ defaultMessage: 'Clear Compare List',
2697
+ }),
2698
+ summary: formatMessage({
2699
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.clearCompare.summary`,
2700
+ defaultMessage: 'Remove all products from the authenticated user\'s compare list.',
2701
+ }),
2702
+ auth: formatMessage({
2703
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2704
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2705
+ }),
2706
+ response: `{
2707
+ "data": {
2708
+ "id": 1,
2709
+ "products": []
2710
+ },
2711
+ "meta": {
2712
+ "totalProducts": 0,
2713
+ "comparisonData": {}
2714
+ },
2715
+ "message": "Compare list cleared successfully"
2716
+ }`,
2717
+ usage: [
2718
+ formatMessage({
2719
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.clearCompare.title`,
2720
+ defaultMessage: 'DELETE /compare - Clear entire compare list',
2721
+ }),
2722
+ ],
2723
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/compare')} \\
2724
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2725
+ },
2726
+ {
2727
+ id: 'update-compare',
2728
+ method: 'PUT',
2729
+ path: getApiPath('/api/webbycommerce/compare'),
2730
+ title: formatMessage({
2731
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.updateCompare.title`,
2732
+ defaultMessage: 'Update Compare Settings',
2733
+ }),
2734
+ summary: formatMessage({
2735
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.updateCompare.summary`,
2736
+ defaultMessage: 'Update compare list settings and preferences.',
2737
+ }),
2738
+ auth: formatMessage({
2739
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2740
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2741
+ }),
2742
+ response: `{
2743
+ "data": {
2744
+ "id": 1,
2745
+ "name": "My Comparison",
2746
+ "description": "Comparing my favorite products"
2747
+ },
2748
+ "message": "Compare list updated successfully"
2749
+ }`,
2750
+ usage: [
2751
+ formatMessage({
2752
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.updateCompare.title`,
2753
+ defaultMessage: 'PUT /compare - Update compare list settings',
2754
+ }),
2755
+ ],
2756
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/compare')} \\
2757
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
2758
+ -H "Content-Type: application/json" \\
2759
+ -d '{"name": "My Comparison"}'`,
2760
+ requestBody: `{
2761
+ "name": "My Comparison",
2762
+ "description": "Comparing my favorite products"
2763
+ }`,
2764
+ },
2765
+ {
2766
+ id: 'get-compare-data',
2767
+ method: 'GET',
2768
+ path: getApiPath('/api/webbycommerce/compare/data'),
2769
+ title: formatMessage({
2770
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareData.title`,
2771
+ defaultMessage: 'Get Compare Data',
2772
+ }),
2773
+ summary: formatMessage({
2774
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareData.summary`,
2775
+ defaultMessage: 'Retrieve comparison data matrix for products in the compare list.',
2776
+ }),
2777
+ auth: formatMessage({
2778
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2779
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2780
+ }),
2781
+ response: `{
2782
+ "data": {
2783
+ "specifications": {
2784
+ "screen": {"1": "6.1 inch", "2": "6.5 inch", "3": "6.7 inch"},
2785
+ "camera": {"1": "12MP", "2": "48MP", "3": "64MP"},
2786
+ "battery": {"1": "3000mAh", "2": "4000mAh", "3": "5000mAh"}
2787
+ },
2788
+ "prices": {"1": 599, "2": 699, "3": 799},
2789
+ "availability": {"1": true, "2": true, "3": false}
2790
+ },
2791
+ "meta": {
2792
+ "totalProducts": 3,
2793
+ "category": "Smartphones"
2794
+ }
2795
+ }`,
2796
+ usage: [
2797
+ formatMessage({
2798
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.getCompareData.title`,
2799
+ defaultMessage: 'GET /compare/data - Get comparison data matrix',
2800
+ }),
2801
+ ],
2802
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/compare')}/data \\
2803
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2804
+ },
2805
+ {
2806
+ id: 'check-compare-status',
2807
+ method: 'GET',
2808
+ path: getApiPath('/api/webbycommerce/compare/status'),
2809
+ title: formatMessage({
2810
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.checkCompareStatus.title`,
2811
+ defaultMessage: 'Check Compare Status',
2812
+ }),
2813
+ summary: formatMessage({
2814
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.checkCompareStatus.summary`,
2815
+ defaultMessage: 'Check if specific products are in the authenticated user\'s compare list.',
2816
+ }),
2817
+ auth: formatMessage({
2818
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.auth`,
2819
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>).',
2820
+ }),
2821
+ response: `{
2822
+ "data": {
2823
+ "1": true,
2824
+ "2": false,
2825
+ "3": true
2826
+ },
2827
+ "message": "Compare status checked successfully"
2828
+ }`,
2829
+ usage: [
2830
+ formatMessage({
2831
+ id: `${PLUGIN_ID}.settings.apiCollections.compare.checkCompareStatus.title`,
2832
+ defaultMessage: 'GET /compare/status - Check if products are in compare list',
2833
+ }),
2834
+ ],
2835
+ getCurl: () => `curl -X GET "http://localhost:1337${getApiPath('/api/webbycommerce/compare')}/status?productIds=1,2,3" \\
2836
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
2837
+ },
2838
+ {
2839
+ id: 'get-product-related',
2840
+ method: 'GET',
2841
+ path: getApiPath('/api/webbycommerce/products/:id/related'),
2842
+ title: 'Get Related Products',
2843
+ summary: 'Get products related to a specific product (same categories or tags).',
2844
+ auth: 'Auth: public (no authentication required).',
2845
+ response: `{
2846
+ "data": [
2847
+ {
2848
+ "id": 2,
2849
+ "name": "Related Product",
2850
+ "price": 29.99,
2851
+ "images": []
2852
+ }
2853
+ ]
2854
+ }`,
2855
+ usage: [
2856
+ 'Replace :id with the actual product ID.',
2857
+ 'Optional query parameter: ?limit=4',
2858
+ 'Returns up to 4 related products by default.',
2859
+ ],
2860
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/1/related')}`,
2861
+ },
2862
+ {
2863
+ id: 'get-product-categories-list',
2864
+ method: 'GET',
2865
+ path: getApiPath('/api/webbycommerce/products/categories'),
2866
+ title: 'List Product Categories',
2867
+ summary: 'Get all active product categories with optional filtering.',
2868
+ auth: 'Auth: public (no authentication required).',
2869
+ response: `{
2870
+ "data": [
2871
+ {
2872
+ "id": 1,
2873
+ "name": "Electronics",
2874
+ "slug": "electronics",
2875
+ "description": "Electronic products"
2876
+ }
2877
+ ],
2878
+ "meta": {
2879
+ "total": 1,
2880
+ "limit": 20,
2881
+ "start": 0
2882
+ }
2883
+ }`,
2884
+ usage: [
2885
+ 'Optional query parameters: ?parent=1&limit=20&start=0',
2886
+ 'Returns hierarchical product categories.',
2887
+ ],
2888
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/categories')}`,
2889
+ },
2890
+ {
2891
+ id: 'get-product-tags-list',
2892
+ method: 'GET',
2893
+ path: getApiPath('/api/webbycommerce/products/tags'),
2894
+ title: 'List Product Tags',
2895
+ summary: 'Get all product tags with optional search and pagination.',
2896
+ auth: 'Auth: public (no authentication required).',
2897
+ response: `{
2898
+ "data": [
2899
+ {
2900
+ "id": 1,
2901
+ "name": "New",
2902
+ "slug": "new"
2903
+ }
2904
+ ],
2905
+ "meta": {
2906
+ "total": 1,
2907
+ "limit": 20,
2908
+ "start": 0
2909
+ }
2910
+ }`,
2911
+ usage: [
2912
+ 'Optional query parameters: ?search=tag&limit=20&start=0',
2913
+ 'Returns paginated list of product tags.',
2914
+ ],
2915
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/tags')}`,
2916
+ },
2917
+ {
2918
+ id: 'get-product-attributes-list',
2919
+ method: 'GET',
2920
+ path: getApiPath('/api/webbycommerce/products/attributes'),
2921
+ title: 'List Product Attributes',
2922
+ summary: 'Get all product attributes with optional filtering.',
2923
+ auth: 'Auth: public (no authentication required).',
2924
+ response: `{
2925
+ "data": [
2926
+ {
2927
+ "id": 1,
2928
+ "name": "Color",
2929
+ "type": "select",
2930
+ "is_variation": true
2931
+ }
2932
+ ],
2933
+ "meta": {
2934
+ "total": 1,
2935
+ "limit": 20,
2936
+ "start": 0
2937
+ }
2938
+ }`,
2939
+ usage: [
2940
+ 'Optional query parameters: ?is_variation=true&limit=20&start=0',
2941
+ 'Returns paginated list of product attributes.',
2942
+ ],
2943
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/products/attributes')}`,
2944
+ },
2945
+ {
2946
+ id: 'get-product-attributes',
2947
+ method: 'GET',
2948
+ path: getApiPath('/api/webbycommerce/product-attributes'),
2949
+ title: 'Get All Product Attributes',
2950
+ summary: 'Retrieve all product attributes with optional filtering by variation status.',
2951
+ auth: formatMessage({
2952
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.auth`,
2953
+ defaultMessage: 'Auth: public for reading, admin for writing.',
2954
+ }),
2955
+ response: `{
2956
+ "data": [
2957
+ {
2958
+ "id": 1,
2959
+ "name": "Color",
2960
+ "is_variation": true,
2961
+ "sort_order": 1,
2962
+ "product_attribute_values": [
2963
+ {
2964
+ "id": 1,
2965
+ "value": "Red",
2966
+ "sort_order": 1
2967
+ }
2968
+ ]
2969
+ }
2970
+ ]
2971
+ }`,
2972
+ usage: [
2973
+ formatMessage({
2974
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getList.usage.filter`,
2975
+ defaultMessage: 'Optional query parameters: ?is_variation=true&limit=20&start=0',
2976
+ }),
2977
+ formatMessage({
2978
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getList.usage.variation`,
2979
+ defaultMessage: 'Filter attributes that are used for product variations.',
2980
+ }),
2981
+ formatMessage({
2982
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getList.usage.sort`,
2983
+ defaultMessage: 'Attributes are sorted by sort_order field.',
2984
+ }),
2985
+ ],
2986
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-attributes')}`,
2987
+ },
2988
+ {
2989
+ id: 'get-product-attribute',
2990
+ method: 'GET',
2991
+ path: getApiPath('/api/webbycommerce/product-attributes/:id'),
2992
+ title: formatMessage({
2993
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getSingle.title`,
2994
+ defaultMessage: 'Get Single Product Attribute',
2995
+ }),
2996
+ summary: formatMessage({
2997
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getSingle.summary`,
2998
+ defaultMessage: 'Retrieve detailed information for a specific product attribute by ID.',
2999
+ }),
3000
+ auth: formatMessage({
3001
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.auth`,
3002
+ defaultMessage: 'Auth: public for reading, admin for writing.',
3003
+ }),
3004
+ response: `{
3005
+ "data": {
3006
+ "id": 1,
3007
+ "name": "Color",
3008
+ "is_variation": true,
3009
+ "sort_order": 1,
3010
+ "product_attribute_values": [
3011
+ {
3012
+ "id": 1,
3013
+ "value": "Red",
3014
+ "sort_order": 1
3015
+ },
3016
+ {
3017
+ "id": 2,
3018
+ "value": "Blue",
3019
+ "sort_order": 2
3020
+ }
3021
+ ]
3022
+ }
3023
+ }`,
3024
+ usage: [
3025
+ formatMessage({
3026
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getSingle.usage.id`,
3027
+ defaultMessage: 'Replace :id with the actual attribute ID.',
3028
+ }),
3029
+ formatMessage({
3030
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.getSingle.usage.populate`,
3031
+ defaultMessage: 'Returns attribute with all associated attribute values.',
3032
+ }),
3033
+ ],
3034
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-attributes/1')}`,
3035
+ },
3036
+ {
3037
+ id: 'create-product-attribute',
3038
+ method: 'POST',
3039
+ path: getApiPath('/api/webbycommerce/product-attributes'),
3040
+ title: formatMessage({
3041
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.create.title`,
3042
+ defaultMessage: 'Create Product Attribute',
3043
+ }),
3044
+ summary: formatMessage({
3045
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.create.summary`,
3046
+ defaultMessage: 'Create a new product attribute (admin functionality).',
3047
+ }),
3048
+ auth: formatMessage({
3049
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.authAdmin`,
3050
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3051
+ }),
3052
+ response: `{
3053
+ "data": {
3054
+ "id": 2,
3055
+ "name": "Size",
3056
+ "is_variation": true,
3057
+ "sort_order": 2,
3058
+ "createdAt": "2024-01-01T00:00:00.000Z",
3059
+ "updatedAt": "2024-01-01T00:00:00.000Z"
3060
+ }
3061
+ }`,
3062
+ usage: [
3063
+ formatMessage({
3064
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.create.usage.required`,
3065
+ defaultMessage: 'Required fields: name, is_variation (boolean).',
3066
+ }),
3067
+ formatMessage({
3068
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.create.usage.sort`,
3069
+ defaultMessage: 'Optional sort_order field to control display order.',
3070
+ }),
3071
+ ],
3072
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/product-attributes')} \\
3073
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3074
+ -H "Content-Type: application/json" \\
3075
+ -d '{"name": "Size", "is_variation": true}'`,
3076
+ requestBody: `{
3077
+ "name": "Size",
3078
+ "is_variation": true,
3079
+ "sort_order": 2
3080
+ }`,
3081
+ },
3082
+ {
3083
+ id: 'update-product-attribute',
3084
+ method: 'PUT',
3085
+ path: getApiPath('/api/webbycommerce/product-attributes/:id'),
3086
+ title: formatMessage({
3087
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.update.title`,
3088
+ defaultMessage: 'Update Product Attribute',
3089
+ }),
3090
+ summary: formatMessage({
3091
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.update.summary`,
3092
+ defaultMessage: 'Update an existing product attribute (admin functionality).',
3093
+ }),
3094
+ auth: formatMessage({
3095
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.authAdmin`,
3096
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3097
+ }),
3098
+ response: `{
3099
+ "data": {
3100
+ "id": 1,
3101
+ "name": "Color Updated",
3102
+ "is_variation": true,
3103
+ "sort_order": 1,
3104
+ "updatedAt": "2024-01-01T12:00:00.000Z"
3105
+ }
3106
+ }`,
3107
+ usage: [
3108
+ formatMessage({
3109
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.update.usage.fields`,
3110
+ defaultMessage: 'Update name, is_variation, or sort_order fields.',
3111
+ }),
3112
+ formatMessage({
3113
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.update.usage.impact`,
3114
+ defaultMessage: 'Changing is_variation may affect existing product variations.',
3115
+ }),
3116
+ ],
3117
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/product-attributes/1')} \\
3118
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3119
+ -H "Content-Type: application/json" \\
3120
+ -d '{"name": "Color Updated"}'`,
3121
+ requestBody: `{
3122
+ "name": "Color Updated",
3123
+ "sort_order": 1
3124
+ }`,
3125
+ },
3126
+ {
3127
+ id: 'delete-product-attribute',
3128
+ method: 'DELETE',
3129
+ path: getApiPath('/api/webbycommerce/product-attributes/:id'),
3130
+ title: formatMessage({
3131
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.delete.title`,
3132
+ defaultMessage: 'Delete Product Attribute',
3133
+ }),
3134
+ summary: formatMessage({
3135
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.delete.summary`,
3136
+ defaultMessage: 'Delete a product attribute (admin functionality).',
3137
+ }),
3138
+ auth: formatMessage({
3139
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.authAdmin`,
3140
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3141
+ }),
3142
+ response: `{
3143
+ "data": {
3144
+ "id": 1
3145
+ }
3146
+ }`,
3147
+ usage: [
3148
+ formatMessage({
3149
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.delete.usage.cascade`,
3150
+ defaultMessage: 'Deleting an attribute also removes all associated attribute values.',
3151
+ }),
3152
+ formatMessage({
3153
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributes.delete.usage.impact`,
3154
+ defaultMessage: 'May affect products that use this attribute in their variations.',
3155
+ }),
3156
+ ],
3157
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/product-attributes/1')} \\
3158
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3159
+ },
3160
+ {
3161
+ id: 'get-product-attribute-values',
3162
+ method: 'GET',
3163
+ path: getApiPath('/api/webbycommerce/product-attribute-values'),
3164
+ title: formatMessage({
3165
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getList.title`,
3166
+ defaultMessage: 'Get All Product Attribute Values',
3167
+ }),
3168
+ summary: formatMessage({
3169
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getList.summary`,
3170
+ defaultMessage: 'Retrieve all product attribute values with optional filtering by attribute ID.',
3171
+ }),
3172
+ auth: formatMessage({
3173
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.auth`,
3174
+ defaultMessage: 'Auth: public for reading, admin for writing.',
3175
+ }),
3176
+ response: `{
3177
+ "data": [
3178
+ {
3179
+ "id": 1,
3180
+ "value": "Red",
3181
+ "sort_order": 1,
3182
+ "product_attribute": {
3183
+ "id": 1,
3184
+ "name": "Color",
3185
+ "is_variation": true
3186
+ }
3187
+ },
3188
+ {
3189
+ "id": 2,
3190
+ "value": "Blue",
3191
+ "sort_order": 2,
3192
+ "product_attribute": {
3193
+ "id": 1,
3194
+ "name": "Color",
3195
+ "is_variation": true
3196
+ }
3197
+ }
3198
+ ]
3199
+ }`,
3200
+ usage: [
3201
+ formatMessage({
3202
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getList.usage.filter`,
3203
+ defaultMessage: 'Optional query parameters: ?product_attribute=1&limit=20&start=0',
3204
+ }),
3205
+ formatMessage({
3206
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getList.usage.attribute`,
3207
+ defaultMessage: 'Filter values by parent attribute ID.',
3208
+ }),
3209
+ formatMessage({
3210
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getList.usage.sort`,
3211
+ defaultMessage: 'Values are sorted by sort_order field.',
3212
+ }),
3213
+ ],
3214
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-attribute-values')}`,
3215
+ },
3216
+ {
3217
+ id: 'get-product-attribute-value',
3218
+ method: 'GET',
3219
+ path: getApiPath('/api/webbycommerce/product-attribute-values/:id'),
3220
+ title: formatMessage({
3221
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getSingle.title`,
3222
+ defaultMessage: 'Get Single Product Attribute Value',
3223
+ }),
3224
+ summary: formatMessage({
3225
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getSingle.summary`,
3226
+ defaultMessage: 'Retrieve detailed information for a specific attribute value by ID.',
3227
+ }),
3228
+ auth: formatMessage({
3229
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.auth`,
3230
+ defaultMessage: 'Auth: public for reading, admin for writing.',
3231
+ }),
3232
+ response: `{
3233
+ "data": {
3234
+ "id": 1,
3235
+ "value": "Red",
3236
+ "sort_order": 1,
3237
+ "product_attribute": {
3238
+ "id": 1,
3239
+ "name": "Color",
3240
+ "is_variation": true
3241
+ }
3242
+ }
3243
+ }`,
3244
+ usage: [
3245
+ formatMessage({
3246
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getSingle.usage.id`,
3247
+ defaultMessage: 'Replace :id with the actual attribute value ID.',
3248
+ }),
3249
+ formatMessage({
3250
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.getSingle.usage.populate`,
3251
+ defaultMessage: 'Returns value with associated attribute information.',
3252
+ }),
3253
+ ],
3254
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/product-attribute-values/1')}`,
3255
+ },
3256
+ {
3257
+ id: 'create-product-attribute-value',
3258
+ method: 'POST',
3259
+ path: getApiPath('/api/webbycommerce/product-attribute-values'),
3260
+ title: formatMessage({
3261
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.create.title`,
3262
+ defaultMessage: 'Create Product Attribute Value',
3263
+ }),
3264
+ summary: formatMessage({
3265
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.create.summary`,
3266
+ defaultMessage: 'Create a new value for a product attribute (admin functionality).',
3267
+ }),
3268
+ auth: formatMessage({
3269
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.authAdmin`,
3270
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3271
+ }),
3272
+ response: `{
3273
+ "data": {
3274
+ "id": 3,
3275
+ "value": "Green",
3276
+ "sort_order": 3,
3277
+ "product_attribute": {
3278
+ "id": 1,
3279
+ "name": "Color"
3280
+ },
3281
+ "createdAt": "2024-01-01T00:00:00.000Z",
3282
+ "updatedAt": "2024-01-01T00:00:00.000Z"
3283
+ }
3284
+ }`,
3285
+ usage: [
3286
+ formatMessage({
3287
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.create.usage.required`,
3288
+ defaultMessage: 'Required fields: value, product_attribute (ID of parent attribute).',
3289
+ }),
3290
+ formatMessage({
3291
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.create.usage.sort`,
3292
+ defaultMessage: 'Optional sort_order field to control display order.',
3293
+ }),
3294
+ formatMessage({
3295
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.create.usage.unique`,
3296
+ defaultMessage: 'Value must be unique within the same attribute.',
3297
+ }),
3298
+ ],
3299
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/product-attribute-values')} \\
3300
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3301
+ -H "Content-Type: application/json" \\
3302
+ -d '{"value": "Green", "product_attribute": 1}'`,
3303
+ requestBody: `{
3304
+ "value": "Green",
3305
+ "product_attribute": 1,
3306
+ "sort_order": 3
3307
+ }`,
3308
+ },
3309
+ {
3310
+ id: 'update-product-attribute-value',
3311
+ method: 'PUT',
3312
+ path: getApiPath('/api/webbycommerce/product-attribute-values/:id'),
3313
+ title: formatMessage({
3314
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.update.title`,
3315
+ defaultMessage: 'Update Product Attribute Value',
3316
+ }),
3317
+ summary: formatMessage({
3318
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.update.summary`,
3319
+ defaultMessage: 'Update an existing attribute value (admin functionality).',
3320
+ }),
3321
+ auth: formatMessage({
3322
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.authAdmin`,
3323
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3324
+ }),
3325
+ response: `{
3326
+ "data": {
3327
+ "id": 1,
3328
+ "value": "Crimson Red",
3329
+ "sort_order": 1,
3330
+ "product_attribute": {
3331
+ "id": 1,
3332
+ "name": "Color"
3333
+ },
3334
+ "updatedAt": "2024-01-01T12:00:00.000Z"
3335
+ }
3336
+ }`,
3337
+ usage: [
3338
+ formatMessage({
3339
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.update.usage.fields`,
3340
+ defaultMessage: 'Update value, sort_order, or product_attribute fields.',
3341
+ }),
3342
+ formatMessage({
3343
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.update.usage.impact`,
3344
+ defaultMessage: 'Changing product_attribute may affect existing product variations.',
3345
+ }),
3346
+ ],
3347
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/product-attribute-values/1')} \\
3348
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3349
+ -H "Content-Type: application/json" \\
3350
+ -d '{"value": "Crimson Red"}'`,
3351
+ requestBody: `{
3352
+ "value": "Crimson Red",
3353
+ "sort_order": 1
3354
+ }`,
3355
+ },
3356
+ {
3357
+ id: 'delete-product-attribute-value',
3358
+ method: 'DELETE',
3359
+ path: getApiPath('/api/webbycommerce/product-attribute-values/:id'),
3360
+ title: formatMessage({
3361
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.delete.title`,
3362
+ defaultMessage: 'Delete Product Attribute Value',
3363
+ }),
3364
+ summary: formatMessage({
3365
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.delete.summary`,
3366
+ defaultMessage: 'Delete an attribute value (admin functionality).',
3367
+ }),
3368
+ auth: formatMessage({
3369
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.authAdmin`,
3370
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3371
+ }),
3372
+ response: `{
3373
+ "data": {
3374
+ "id": 1
3375
+ }
3376
+ }`,
3377
+ usage: [
3378
+ formatMessage({
3379
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.delete.usage.impact`,
3380
+ defaultMessage: 'May affect products that use this attribute value in their variations.',
3381
+ }),
3382
+ formatMessage({
3383
+ id: `${PLUGIN_ID}.settings.apiCollections.productAttributeValues.delete.usage.check`,
3384
+ defaultMessage: 'Ensure no products are currently using this value before deletion.',
3385
+ }),
3386
+ ],
3387
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/product-attribute-values/1')} \\
3388
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3389
+ },
3390
+ {
3391
+ id: 'apply-coupon',
3392
+ method: 'POST',
3393
+ path: getApiPath('/api/webbycommerce/cart/apply-coupon'),
3394
+ title: 'Apply Coupon to Cart',
3395
+ summary: 'Apply a discount coupon to the authenticated user\'s cart.',
3396
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
3397
+ response: `{
3398
+ "data": {
3399
+ "coupon_code": "SAVE10",
3400
+ "coupon_type": "percentage",
3401
+ "coupon_value": 10,
3402
+ "discount_amount": 25.00,
3403
+ "subtotal": 250.00,
3404
+ "total": 225.00
3405
+ },
3406
+ "message": "Coupon applied successfully"
3407
+ }`,
3408
+ usage: [
3409
+ 'Include the JWT token in the Authorization header.',
3410
+ 'Validates coupon expiry, usage limits, and minimum order amount.',
3411
+ 'Returns updated cart totals with discount applied.',
3412
+ ],
3413
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/cart/apply-coupon')} \\
3414
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3415
+ -H "Content-Type: application/json" \\
3416
+ -d '{"coupon_code": "SAVE10"}'`,
3417
+ requestBody: `{
3418
+ "coupon_code": "SAVE10"
3419
+ }`,
3420
+ },
3421
+ {
3422
+ id: 'remove-coupon',
3423
+ method: 'DELETE',
3424
+ path: getApiPath('/api/webbycommerce/cart/coupon'),
3425
+ title: 'Remove Coupon from Cart',
3426
+ summary: 'Remove any applied coupon from the authenticated user\'s cart.',
3427
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
3428
+ response: `{
3429
+ "message": "Coupon removed successfully"
3430
+ }`,
3431
+ usage: [
3432
+ 'Include the JWT token in the Authorization header.',
3433
+ 'Removes any active coupon from the user\'s cart.',
3434
+ ],
3435
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/cart/coupon')} \\
3436
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3437
+ },
3438
+ {
3439
+ id: 'get-cart-totals',
3440
+ method: 'GET',
3441
+ path: getApiPath('/api/webbycommerce/cart/totals'),
3442
+ title: 'Get Cart Totals',
3443
+ summary: 'Calculate and return the authenticated user\'s cart totals.',
3444
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
3445
+ response: `{
3446
+ "data": {
3447
+ "subtotal": 250.00,
3448
+ "tax": 0.00,
3449
+ "discount": 25.00,
3450
+ "total": 225.00,
3451
+ "currency": "USD",
3452
+ "item_count": 3
3453
+ }
3454
+ }`,
3455
+ usage: [
3456
+ 'Include the JWT token in the Authorization header.',
3457
+ 'Returns calculated cart totals including subtotal, tax, and discounts.',
3458
+ ],
3459
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/cart/totals')} \\
3460
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3461
+ },
3462
+ {
3463
+ id: 'move-to-cart',
3464
+ method: 'POST',
3465
+ path: getApiPath('/api/webbycommerce/wishlist/items/:id/move-to-cart'),
3466
+ title: 'Move Wishlist Item to Cart',
3467
+ summary: 'Move a product from the authenticated user\'s wishlist to their cart.',
3468
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
3469
+ response: `{
3470
+ "data": {
3471
+ "cart_item": {
3472
+ "id": 1,
3473
+ "product_id": 5,
3474
+ "product_name": "Sample Product",
3475
+ "quantity": 1,
3476
+ "unit_price": 29.99,
3477
+ "total_price": 29.99
3478
+ }
3479
+ },
3480
+ "message": "Product moved to cart successfully"
3481
+ }`,
3482
+ usage: [
3483
+ 'Include the JWT token in the Authorization header.',
3484
+ 'Replace :id with the actual product ID from wishlist.',
3485
+ 'Optional quantity parameter (defaults to 1).',
3486
+ 'Automatically removes the product from wishlist after adding to cart.',
3487
+ ],
3488
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/wishlist/items/5/move-to-cart')} \\
3489
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3490
+ -H "Content-Type: application/json" \\
3491
+ -d '{"quantity": 1}'`,
3492
+ requestBody: `{
3493
+ "quantity": 1
3494
+ }`,
3495
+ },
3496
+
3497
+ // Shipping endpoints
3498
+ {
3499
+ id: 'calculate-shipping',
3500
+ method: 'POST',
3501
+ path: getApiPath('/api/webbycommerce/shipping/calculate'),
3502
+ title: formatMessage({
3503
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.title`,
3504
+ defaultMessage: 'Calculate Shipping Costs',
3505
+ }),
3506
+ summary: formatMessage({
3507
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.summary`,
3508
+ defaultMessage: 'Calculate available shipping methods and costs for cart items and delivery address.',
3509
+ }),
3510
+ auth: formatMessage({
3511
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.auth`,
3512
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and ecommerce permission enabled.',
3513
+ }),
3514
+ response: `{
3515
+ "data": [
3516
+ {
3517
+ "id": 1,
3518
+ "name": "UPS Ground",
3519
+ "carrier": "UPS",
3520
+ "service_type": "Ground",
3521
+ "transit_time": "1-3 business days",
3522
+ "cost": 9.99,
3523
+ "currency": "USD",
3524
+ "zone": {
3525
+ "id": 1,
3526
+ "name": "United States"
3527
+ }
3528
+ },
3529
+ {
3530
+ "id": 2,
3531
+ "name": "USPS Priority Mail",
3532
+ "carrier": "USPS",
3533
+ "service_type": "Priority",
3534
+ "transit_time": "2-3 business days",
3535
+ "cost": 7.50,
3536
+ "currency": "USD",
3537
+ "zone": {
3538
+ "id": 1,
3539
+ "name": "United States"
3540
+ }
3541
+ }
3542
+ ],
3543
+ "meta": {
3544
+ "total": 2,
3545
+ "address": {
3546
+ "country": "US",
3547
+ "city": "New York",
3548
+ "postcode": "10001"
3549
+ }
3550
+ }
3551
+ }`,
3552
+ usage: [
3553
+ formatMessage({
3554
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.usage.cart`,
3555
+ defaultMessage: 'Requires cart items and valid shipping address.',
3556
+ }),
3557
+ formatMessage({
3558
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.usage.methods`,
3559
+ defaultMessage: 'Returns all eligible shipping methods with calculated costs.',
3560
+ }),
3561
+ formatMessage({
3562
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.usage.free`,
3563
+ defaultMessage: 'Automatically applies free shipping when cart meets threshold.',
3564
+ }),
3565
+ formatMessage({
3566
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.calculate.usage.rules`,
3567
+ defaultMessage: 'Applies shipping rules, restrictions, and surcharges.',
3568
+ }),
3569
+ ],
3570
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/shipping/calculate')} \\
3571
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3572
+ -H "Content-Type: application/json" \\
3573
+ -d '{"cart_items": [{"product": {"weight": 2.5}, "price": 29.99, "quantity": 2}], "shipping_address": {"country": "US", "city": "New York", "street_address": "123 Main St", "postcode": "10001"}}'`,
3574
+ requestBody: `{
3575
+ "cart_items": [
3576
+ {
3577
+ "product": {"weight": 2.5},
3578
+ "price": 29.99,
3579
+ "quantity": 2
3580
+ }
3581
+ ],
3582
+ "shipping_address": {
3583
+ "country": "US",
3584
+ "city": "New York",
3585
+ "street_address": "123 Main St",
3586
+ "postcode": "10001"
3587
+ }
3588
+ }`,
3589
+ },
3590
+ {
3591
+ id: 'get-shipping-zones',
3592
+ method: 'GET',
3593
+ path: getApiPath('/api/webbycommerce/shipping/zones'),
3594
+ title: formatMessage({
3595
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.getList.title`,
3596
+ defaultMessage: 'Get All Shipping Zones',
3597
+ }),
3598
+ summary: formatMessage({
3599
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.getList.summary`,
3600
+ defaultMessage: 'Retrieve all shipping zones with optional filtering (admin only).',
3601
+ }),
3602
+ auth: formatMessage({
3603
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3604
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3605
+ }),
3606
+ response: `{
3607
+ "data": [
3608
+ {
3609
+ "id": 1,
3610
+ "name": "United States",
3611
+ "description": "Mainland US shipping zone",
3612
+ "countries": ["US"],
3613
+ "is_active": true,
3614
+ "sort_order": 0,
3615
+ "createdAt": "2024-01-01T00:00:00.000Z",
3616
+ "updatedAt": "2024-01-01T00:00:00.000Z"
3617
+ }
3618
+ ]
3619
+ }`,
3620
+ usage: [
3621
+ formatMessage({
3622
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.getList.usage.zones`,
3623
+ defaultMessage: 'Returns all active shipping zones.',
3624
+ }),
3625
+ formatMessage({
3626
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.getList.usage.filter`,
3627
+ defaultMessage: 'Optional query parameters: ?is_active=true&limit=20&start=0',
3628
+ }),
3629
+ ],
3630
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/shipping/zones')} \\
3631
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3632
+ },
3633
+ {
3634
+ id: 'create-shipping-zone',
3635
+ method: 'POST',
3636
+ path: getApiPath('/api/webbycommerce/shipping/zones'),
3637
+ title: formatMessage({
3638
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.create.title`,
3639
+ defaultMessage: 'Create Shipping Zone',
3640
+ }),
3641
+ summary: formatMessage({
3642
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.create.summary`,
3643
+ defaultMessage: 'Create a new shipping zone with countries, states, and postal codes (admin only).',
3644
+ }),
3645
+ auth: formatMessage({
3646
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3647
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3648
+ }),
3649
+ response: `{
3650
+ "data": {
3651
+ "id": 2,
3652
+ "name": "European Union",
3653
+ "description": "EU countries shipping zone",
3654
+ "countries": ["DE", "FR", "IT", "ES"],
3655
+ "is_active": true,
3656
+ "sort_order": 1,
3657
+ "createdAt": "2024-01-01T00:00:00.000Z",
3658
+ "updatedAt": "2024-01-01T00:00:00.000Z"
3659
+ }
3660
+ }`,
3661
+ usage: [
3662
+ formatMessage({
3663
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.create.usage.required`,
3664
+ defaultMessage: 'Required fields: name, countries array.',
3665
+ }),
3666
+ formatMessage({
3667
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.create.usage.geography`,
3668
+ defaultMessage: 'Define geographical areas using countries, states, or postal codes.',
3669
+ }),
3670
+ ],
3671
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/shipping/zones')} \\
3672
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3673
+ -H "Content-Type: application/json" \\
3674
+ -d '{"name": "European Union", "countries": ["DE", "FR", "IT", "ES"]}'`,
3675
+ requestBody: `{
3676
+ "name": "European Union",
3677
+ "description": "EU countries shipping zone",
3678
+ "countries": ["DE", "FR", "IT", "ES"],
3679
+ "is_active": true,
3680
+ "sort_order": 1
3681
+ }`,
3682
+ },
3683
+ {
3684
+ id: 'update-shipping-zone',
3685
+ method: 'PUT',
3686
+ path: getApiPath('/api/webbycommerce/shipping/zones/:id'),
3687
+ title: formatMessage({
3688
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.update.title`,
3689
+ defaultMessage: 'Update Shipping Zone',
3690
+ }),
3691
+ summary: formatMessage({
3692
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.update.summary`,
3693
+ defaultMessage: 'Update an existing shipping zone (admin only).',
3694
+ }),
3695
+ auth: formatMessage({
3696
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3697
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3698
+ }),
3699
+ response: `{
3700
+ "data": {
3701
+ "id": 1,
3702
+ "name": "United States Updated",
3703
+ "description": "Updated US shipping zone",
3704
+ "countries": ["US", "CA"],
3705
+ "is_active": true,
3706
+ "updatedAt": "2024-01-01T12:00:00.000Z"
3707
+ }
3708
+ }`,
3709
+ usage: [
3710
+ formatMessage({
3711
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.update.usage.fields`,
3712
+ defaultMessage: 'Update zone name, geography, or active status.',
3713
+ }),
3714
+ formatMessage({
3715
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.update.usage.methods`,
3716
+ defaultMessage: 'Zone changes may affect associated shipping methods.',
3717
+ }),
3718
+ ],
3719
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/shipping/zones/1')} \\
3720
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3721
+ -H "Content-Type: application/json" \\
3722
+ -d '{"name": "United States Updated", "countries": ["US", "CA"]}'`,
3723
+ requestBody: `{
3724
+ "name": "United States Updated",
3725
+ "description": "Updated US shipping zone",
3726
+ "countries": ["US", "CA"]
3727
+ }`,
3728
+ },
3729
+ {
3730
+ id: 'delete-shipping-zone',
3731
+ method: 'DELETE',
3732
+ path: getApiPath('/api/webbycommerce/shipping/zones/:id'),
3733
+ title: formatMessage({
3734
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.delete.title`,
3735
+ defaultMessage: 'Delete Shipping Zone',
3736
+ }),
3737
+ summary: formatMessage({
3738
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.delete.summary`,
3739
+ defaultMessage: 'Delete a shipping zone (admin only).',
3740
+ }),
3741
+ auth: formatMessage({
3742
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3743
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3744
+ }),
3745
+ response: `{
3746
+ "data": {
3747
+ "id": 1
3748
+ }
3749
+ }`,
3750
+ usage: [
3751
+ formatMessage({
3752
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.delete.usage.methods`,
3753
+ defaultMessage: 'Cannot delete zones with associated shipping methods.',
3754
+ }),
3755
+ formatMessage({
3756
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.delete.usage.check`,
3757
+ defaultMessage: 'Ensure no shipping methods reference this zone before deletion.',
3758
+ }),
3759
+ ],
3760
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/shipping/zones/1')} \\
3761
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3762
+ },
3763
+ {
3764
+ id: 'get-shipping-methods',
3765
+ method: 'GET',
3766
+ path: getApiPath('/api/webbycommerce/shipping/methods'),
3767
+ title: formatMessage({
3768
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.getList.title`,
3769
+ defaultMessage: 'Get All Shipping Methods',
3770
+ }),
3771
+ summary: formatMessage({
3772
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.getList.summary`,
3773
+ defaultMessage: 'Retrieve all shipping methods with optional filtering (admin only).',
3774
+ }),
3775
+ auth: formatMessage({
3776
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3777
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3778
+ }),
3779
+ response: `{
3780
+ "data": [
3781
+ {
3782
+ "id": 1,
3783
+ "name": "UPS Ground",
3784
+ "carrier": "UPS",
3785
+ "service_type": "Ground",
3786
+ "transit_time": "1-3 business days",
3787
+ "handling_fee": 0,
3788
+ "is_free_shipping": false,
3789
+ "is_active": true,
3790
+ "zone": {
3791
+ "id": 1,
3792
+ "name": "United States"
3793
+ },
3794
+ "createdAt": "2024-01-01T00:00:00.000Z"
3795
+ }
3796
+ ]
3797
+ }`,
3798
+ usage: [
3799
+ formatMessage({
3800
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.getList.usage.methods`,
3801
+ defaultMessage: 'Returns all shipping methods with carrier information.',
3802
+ }),
3803
+ formatMessage({
3804
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.getList.usage.filter`,
3805
+ defaultMessage: 'Optional query parameters: ?carrier=UPS&is_active=true&zone=1',
3806
+ }),
3807
+ ],
3808
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/shipping/methods')} \\
3809
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3810
+ },
3811
+ {
3812
+ id: 'create-shipping-method',
3813
+ method: 'POST',
3814
+ path: getApiPath('/api/webbycommerce/shipping/methods'),
3815
+ title: formatMessage({
3816
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.create.title`,
3817
+ defaultMessage: 'Create Shipping Method',
3818
+ }),
3819
+ summary: formatMessage({
3820
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.create.summary`,
3821
+ defaultMessage: 'Create a new shipping method with carrier and pricing (admin only).',
3822
+ }),
3823
+ auth: formatMessage({
3824
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3825
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3826
+ }),
3827
+ response: `{
3828
+ "data": {
3829
+ "id": 2,
3830
+ "name": "FedEx Express",
3831
+ "carrier": "FedEx",
3832
+ "service_type": "Express",
3833
+ "transit_time": "1-2 business days",
3834
+ "handling_fee": 2.99,
3835
+ "is_free_shipping": false,
3836
+ "is_active": true,
3837
+ "zone": {
3838
+ "id": 1,
3839
+ "name": "United States"
3840
+ },
3841
+ "createdAt": "2024-01-01T00:00:00.000Z"
3842
+ }
3843
+ }`,
3844
+ usage: [
3845
+ formatMessage({
3846
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.create.usage.required`,
3847
+ defaultMessage: 'Required fields: name, carrier, service_type, zone.',
3848
+ }),
3849
+ formatMessage({
3850
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.create.usage.carrier`,
3851
+ defaultMessage: 'Supports UPS, FedEx, USPS, DHL, and custom carriers.',
3852
+ }),
3853
+ formatMessage({
3854
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.create.usage.free`,
3855
+ defaultMessage: 'Set is_free_shipping=true and free_shipping_threshold for free shipping.',
3856
+ }),
3857
+ ],
3858
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/shipping/methods')} \\
3859
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3860
+ -H "Content-Type: application/json" \\
3861
+ -d '{"name": "FedEx Express", "carrier": "FedEx", "service_type": "Express", "zone": {"id": 1}}'`,
3862
+ requestBody: `{
3863
+ "name": "FedEx Express",
3864
+ "description": "Fast delivery service",
3865
+ "carrier": "FedEx",
3866
+ "service_type": "Express",
3867
+ "carrier_service_code": "FEDEX_EXPRESS",
3868
+ "transit_time": "1-2 business days",
3869
+ "handling_fee": 2.99,
3870
+ "is_free_shipping": false,
3871
+ "free_shipping_threshold": null,
3872
+ "zone": {"id": 1},
3873
+ "is_active": true,
3874
+ "sort_order": 1
3875
+ }`,
3876
+ },
3877
+ {
3878
+ id: 'update-shipping-method',
3879
+ method: 'PUT',
3880
+ path: getApiPath('/api/webbycommerce/shipping/methods/:id'),
3881
+ title: formatMessage({
3882
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.update.title`,
3883
+ defaultMessage: 'Update Shipping Method',
3884
+ }),
3885
+ summary: formatMessage({
3886
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.update.summary`,
3887
+ defaultMessage: 'Update an existing shipping method (admin only).',
3888
+ }),
3889
+ auth: formatMessage({
3890
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3891
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3892
+ }),
3893
+ response: `{
3894
+ "data": {
3895
+ "id": 1,
3896
+ "name": "UPS Ground Updated",
3897
+ "handling_fee": 1.99,
3898
+ "updatedAt": "2024-01-01T12:00:00.000Z"
3899
+ }
3900
+ }`,
3901
+ usage: [
3902
+ formatMessage({
3903
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.update.usage.fields`,
3904
+ defaultMessage: 'Update carrier, pricing, or free shipping settings.',
3905
+ }),
3906
+ formatMessage({
3907
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.update.usage.rates`,
3908
+ defaultMessage: 'Method changes affect associated shipping rates.',
3909
+ }),
3910
+ ],
3911
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/shipping/methods/1')} \\
3912
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
3913
+ -H "Content-Type: application/json" \\
3914
+ -d '{"handling_fee": 1.99}'`,
3915
+ requestBody: `{
3916
+ "handling_fee": 1.99,
3917
+ "transit_time": "1-3 business days"
3918
+ }`,
3919
+ },
3920
+ {
3921
+ id: 'delete-shipping-method',
3922
+ method: 'DELETE',
3923
+ path: getApiPath('/api/webbycommerce/shipping/methods/:id'),
3924
+ title: formatMessage({
3925
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.delete.title`,
3926
+ defaultMessage: 'Delete Shipping Method',
3927
+ }),
3928
+ summary: formatMessage({
3929
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.delete.summary`,
3930
+ defaultMessage: 'Delete a shipping method (admin only).',
3931
+ }),
3932
+ auth: formatMessage({
3933
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3934
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3935
+ }),
3936
+ response: `{
3937
+ "data": {
3938
+ "id": 1
3939
+ }
3940
+ }`,
3941
+ usage: [
3942
+ formatMessage({
3943
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.delete.usage.rates`,
3944
+ defaultMessage: 'Cannot delete methods with associated shipping rates.',
3945
+ }),
3946
+ formatMessage({
3947
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.methods.delete.usage.check`,
3948
+ defaultMessage: 'Ensure no shipping rates reference this method before deletion.',
3949
+ }),
3950
+ ],
3951
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/shipping/methods/1')} \\
3952
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
3953
+ },
3954
+ {
3955
+ id: 'get-shipping-rates',
3956
+ method: 'GET',
3957
+ path: getApiPath('/api/webbycommerce/shipping/methods/:methodId/rates'),
3958
+ title: formatMessage({
3959
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.getList.title`,
3960
+ defaultMessage: 'Get Shipping Rates',
3961
+ }),
3962
+ summary: formatMessage({
3963
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.getList.summary`,
3964
+ defaultMessage: 'Retrieve shipping rates for a specific method (admin only).',
3965
+ }),
3966
+ auth: formatMessage({
3967
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
3968
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
3969
+ }),
3970
+ response: `{
3971
+ "data": [
3972
+ {
3973
+ "id": 1,
3974
+ "name": "0-5 lbs",
3975
+ "condition_type": "weight",
3976
+ "min_value": 0,
3977
+ "max_value": 5,
3978
+ "rate": 9.99,
3979
+ "currency": "USD",
3980
+ "is_active": true,
3981
+ "method": {
3982
+ "id": 1,
3983
+ "name": "UPS Ground"
3984
+ }
3985
+ }
3986
+ ]
3987
+ }`,
3988
+ usage: [
3989
+ formatMessage({
3990
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.getList.usage.method`,
3991
+ defaultMessage: 'Replace :methodId with the actual shipping method ID.',
3992
+ }),
3993
+ formatMessage({
3994
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.getList.usage.rates`,
3995
+ defaultMessage: 'Returns all rate tiers for the specified method.',
3996
+ }),
3997
+ ],
3998
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/shipping/methods/1/rates')} \\
3999
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
4000
+ },
4001
+ {
4002
+ id: 'create-shipping-rate',
4003
+ method: 'POST',
4004
+ path: getApiPath('/api/webbycommerce/shipping/rates'),
4005
+ title: formatMessage({
4006
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.create.title`,
4007
+ defaultMessage: 'Create Shipping Rate',
4008
+ }),
4009
+ summary: formatMessage({
4010
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.create.summary`,
4011
+ defaultMessage: 'Create a new shipping rate tier (admin only).',
4012
+ }),
4013
+ auth: formatMessage({
4014
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
4015
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
4016
+ }),
4017
+ response: `{
4018
+ "data": {
4019
+ "id": 2,
4020
+ "name": "5-10 lbs",
4021
+ "condition_type": "weight",
4022
+ "min_value": 5,
4023
+ "max_value": 10,
4024
+ "rate": 14.99,
4025
+ "currency": "USD",
4026
+ "is_active": true,
4027
+ "method": {
4028
+ "id": 1,
4029
+ "name": "UPS Ground"
4030
+ },
4031
+ "createdAt": "2024-01-01T00:00:00.000Z"
4032
+ }
4033
+ }`,
4034
+ usage: [
4035
+ formatMessage({
4036
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.create.usage.required`,
4037
+ defaultMessage: 'Required fields: name, condition_type, min_value, rate, method.',
4038
+ }),
4039
+ formatMessage({
4040
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.create.usage.condition`,
4041
+ defaultMessage: 'Conditions: weight, price, quantity, volume, dimension.',
4042
+ }),
4043
+ formatMessage({
4044
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.create.usage.tier`,
4045
+ defaultMessage: 'Use min_value and max_value to create pricing tiers.',
4046
+ }),
4047
+ ],
4048
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/shipping/rates')} \\
4049
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
4050
+ -H "Content-Type: application/json" \\
4051
+ -d '{"name": "5-10 lbs", "condition_type": "weight", "min_value": 5, "max_value": 10, "rate": 14.99, "method": {"id": 1}}'`,
4052
+ requestBody: `{
4053
+ "name": "5-10 lbs",
4054
+ "condition_type": "weight",
4055
+ "min_value": 5,
4056
+ "max_value": 10,
4057
+ "rate": 14.99,
4058
+ "currency": "USD",
4059
+ "method": {"id": 1},
4060
+ "is_active": true,
4061
+ "sort_order": 1
4062
+ }`,
4063
+ },
4064
+ {
4065
+ id: 'update-shipping-rate',
4066
+ method: 'PUT',
4067
+ path: getApiPath('/api/webbycommerce/shipping/rates/:id'),
4068
+ title: formatMessage({
4069
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.update.title`,
4070
+ defaultMessage: 'Update Shipping Rate',
4071
+ }),
4072
+ summary: formatMessage({
4073
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.update.summary`,
4074
+ defaultMessage: 'Update an existing shipping rate (admin only).',
4075
+ }),
4076
+ auth: formatMessage({
4077
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
4078
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
4079
+ }),
4080
+ response: `{
4081
+ "data": {
4082
+ "id": 1,
4083
+ "rate": 12.99,
4084
+ "updatedAt": "2024-01-01T12:00:00.000Z"
4085
+ }
4086
+ }`,
4087
+ usage: [
4088
+ formatMessage({
4089
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.update.usage.fields`,
4090
+ defaultMessage: 'Update rate values, conditions, or pricing tiers.',
4091
+ }),
4092
+ formatMessage({
4093
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.update.usage.calculation`,
4094
+ defaultMessage: 'Rate changes affect shipping cost calculations.',
4095
+ }),
4096
+ ],
4097
+ getCurl: () => `curl -X PUT http://localhost:1337${getApiPath('/api/webbycommerce/shipping/rates/1')} \\
4098
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
4099
+ -H "Content-Type: application/json" \\
4100
+ -d '{"rate": 12.99}'`,
4101
+ requestBody: `{
4102
+ "rate": 12.99,
4103
+ "max_value": 7.5
4104
+ }`,
4105
+ },
4106
+ {
4107
+ id: 'delete-shipping-rate',
4108
+ method: 'DELETE',
4109
+ path: getApiPath('/api/webbycommerce/shipping/rates/:id'),
4110
+ title: formatMessage({
4111
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.delete.title`,
4112
+ defaultMessage: 'Delete Shipping Rate',
4113
+ }),
4114
+ summary: formatMessage({
4115
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.delete.summary`,
4116
+ defaultMessage: 'Delete a shipping rate (admin only).',
4117
+ }),
4118
+ auth: formatMessage({
4119
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.zones.authAdmin`,
4120
+ defaultMessage: 'Auth: requires JWT token (Authorization: Bearer <token>) and administrator role.',
4121
+ }),
4122
+ response: `{
4123
+ "data": {
4124
+ "id": 1
4125
+ }
4126
+ }`,
4127
+ usage: [
4128
+ formatMessage({
4129
+ id: `${PLUGIN_ID}.settings.apiCollections.shipping.rates.delete.usage.rates`,
4130
+ defaultMessage: 'Deleting rates may affect shipping cost calculations.',
4131
+ }),
4132
+ ],
4133
+ getCurl: () => `curl -X DELETE http://localhost:1337${getApiPath('/api/webbycommerce/shipping/rates/1')} \\
4134
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
4135
+ },
4136
+ {
4137
+ id: 'create-payment-intent',
4138
+ method: 'POST',
4139
+ path: getApiPath('/api/webbycommerce/payments/create-intent'),
4140
+ title: 'Create Payment Intent',
4141
+ summary: 'Create a payment intent for an order using Stripe, PayPal, or other payment gateways.',
4142
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
4143
+ response: `{
4144
+ "data": {
4145
+ "payment_intent": {
4146
+ "client_secret": "pi_1234567890_secret_ABCDEF",
4147
+ "transaction_id": "temp_1234567890",
4148
+ "amount": 25000,
4149
+ "currency": "usd",
4150
+ "payment_method": "stripe"
4151
+ },
4152
+ "transaction": {
4153
+ "id": 1,
4154
+ "transaction_id": "temp_1234567890",
4155
+ "amount": 250.00,
4156
+ "status": "pending"
4157
+ }
4158
+ }
4159
+ }`,
4160
+ usage: [
4161
+ 'Include the JWT token in the Authorization header.',
4162
+ 'Order ID, payment method, and amount are required.',
4163
+ 'Returns payment gateway-specific data for client-side payment processing.',
4164
+ ],
4165
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/payments/create-intent')} \\
4166
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
4167
+ -H "Content-Type: application/json" \\
4168
+ -d '{"order_id": 1, "payment_method": "stripe", "amount": 250.00}'`,
4169
+ requestBody: `{
4170
+ "order_id": 1,
4171
+ "payment_method": "stripe",
4172
+ "amount": 250.00,
4173
+ "currency": "USD"
4174
+ }`,
4175
+ },
4176
+ {
4177
+ id: 'confirm-payment',
4178
+ method: 'POST',
4179
+ path: getApiPath('/api/webbycommerce/payments/confirm'),
4180
+ title: 'Confirm Payment',
4181
+ summary: 'Confirm a payment after successful processing by the payment gateway.',
4182
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>).',
4183
+ response: `{
4184
+ "data": {
4185
+ "transaction": {
4186
+ "id": 1,
4187
+ "transaction_id": "pi_1234567890",
4188
+ "amount": 250.00,
4189
+ "status": "completed",
4190
+ "processed_at": "2024-01-01T12:00:00.000Z"
4191
+ }
4192
+ },
4193
+ "message": "Payment confirmed successfully"
4194
+ }`,
4195
+ usage: [
4196
+ 'Include the JWT token in the Authorization header.',
4197
+ 'Transaction ID and payment data from gateway are required.',
4198
+ 'Updates order payment status and creates transaction record.',
4199
+ ],
4200
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/payments/confirm')} \\
4201
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
4202
+ -H "Content-Type: application/json" \\
4203
+ -d '{"transaction_id": "temp_1234567890", "payment_data": {"gateway_response": "success"}}'`,
4204
+ requestBody: `{
4205
+ "transaction_id": "temp_1234567890",
4206
+ "payment_data": {
4207
+ "gateway_response": "success"
4208
+ }
4209
+ }`,
4210
+ },
4211
+ {
4212
+ id: 'payment-webhook',
4213
+ method: 'POST',
4214
+ path: getApiPath('/api/webbycommerce/payments/webhook'),
4215
+ title: 'Payment Webhook',
4216
+ summary: 'Handle webhooks from payment gateways (Stripe, PayPal, etc.) for payment status updates.',
4217
+ auth: 'Auth: public (webhook signatures are validated internally).',
4218
+ response: `{
4219
+ "message": "Webhook processed successfully"
4220
+ }`,
4221
+ usage: [
4222
+ 'Called automatically by payment gateways.',
4223
+ 'Validates webhook signatures and updates payment/transaction status.',
4224
+ 'Handles payment completion, failures, and other gateway events.',
4225
+ ],
4226
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/payments/webhook')} \\
4227
+ -H "Content-Type: application/json" \\
4228
+ -H "Stripe-Signature: t=1234567890,v1=signature..." \\
4229
+ -d '{"type": "payment_intent.succeeded", "data": {"object": {"id": "pi_123"}}}'`,
4230
+ },
4231
+ {
4232
+ id: 'process-refund',
4233
+ method: 'POST',
4234
+ path: getApiPath('/api/webbycommerce/payments/:id/refund'),
4235
+ title: 'Process Refund',
4236
+ summary: 'Process a refund for a completed payment transaction.',
4237
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>) and admin privileges.',
4238
+ response: `{
4239
+ "data": {
4240
+ "transaction": {
4241
+ "id": 1,
4242
+ "transaction_id": "pi_1234567890",
4243
+ "amount": 250.00,
4244
+ "status": "refunded",
4245
+ "refund_amount": 250.00,
4246
+ "refunded_at": "2024-01-01T12:00:00.000Z"
4247
+ }
4248
+ },
4249
+ "message": "Refund processed successfully"
4250
+ }`,
4251
+ usage: [
4252
+ 'Include the JWT token in the Authorization header.',
4253
+ 'Replace :id with the payment transaction ID.',
4254
+ 'Optional amount parameter (defaults to full refund).',
4255
+ 'Updates transaction and order status.',
4256
+ ],
4257
+ getCurl: () => `curl -X POST http://localhost:1337${getApiPath('/api/webbycommerce/payments/1/refund')} \\
4258
+ -H "Authorization: Bearer YOUR_JWT_TOKEN" \\
4259
+ -H "Content-Type: application/json" \\
4260
+ -d '{"amount": 100.00, "reason": "Customer request"}'`,
4261
+ requestBody: `{
4262
+ "amount": 100.00,
4263
+ "reason": "Customer request"
4264
+ }`,
4265
+ },
4266
+ {
4267
+ id: 'get-payment-transactions',
4268
+ method: 'GET',
4269
+ path: getApiPath('/api/webbycommerce/payments/transactions'),
4270
+ title: 'List Payment Transactions',
4271
+ summary: 'Get all payment transactions with optional filtering (admin only).',
4272
+ auth: 'Auth: requires JWT token (Authorization: Bearer <token>) and admin privileges.',
4273
+ response: `{
4274
+ "data": [
4275
+ {
4276
+ "id": 1,
4277
+ "transaction_id": "pi_1234567890",
4278
+ "payment_method": "stripe",
4279
+ "amount": 250.00,
4280
+ "status": "completed",
4281
+ "processed_at": "2024-01-01T12:00:00.000Z"
4282
+ }
4283
+ ],
4284
+ "meta": {
4285
+ "total": 1,
4286
+ "limit": 10,
4287
+ "start": 0
4288
+ }
4289
+ }`,
4290
+ usage: [
4291
+ 'Include the JWT token in the Authorization header.',
4292
+ 'Optional query parameters: ?order_id=1&status=completed&limit=10&start=0',
4293
+ 'Admin-only endpoint for viewing payment transactions.',
4294
+ ],
4295
+ getCurl: () => `curl -X GET http://localhost:1337${getApiPath('/api/webbycommerce/payments/transactions')} \\
4296
+ -H "Authorization: Bearer YOUR_JWT_TOKEN"`,
4297
+ },
4298
+ ], [routePrefix, formatMessage]);
4299
+
4300
+ const pageCount = useMemo(() => {
4301
+ return Math.max(1, Math.ceil(endpoints.length / pageSize));
4302
+ }, [endpoints.length]);
4303
+
4304
+ useEffect(() => {
4305
+ setPage((current) => Math.min(Math.max(current, 1), pageCount));
4306
+ }, [pageCount]);
4307
+
4308
+ const pagedEndpoints = useMemo(() => {
4309
+ const start = (page - 1) * pageSize;
4310
+ const end = start + pageSize;
4311
+ return endpoints.slice(start, end);
4312
+ }, [endpoints, page]);
4313
+
4314
+ const pageItems = useMemo(() => {
4315
+ const items = [];
4316
+ const maxVisible = 7;
4317
+
4318
+ if (pageCount <= maxVisible) {
4319
+ for (let i = 1; i <= pageCount; i += 1) items.push(i);
4320
+ return items;
4321
+ }
4322
+
4323
+ items.push(1);
4324
+
4325
+ const start = Math.max(2, page - 1);
4326
+ const end = Math.min(pageCount - 1, page + 1);
4327
+
4328
+ if (start > 2) items.push('dots');
4329
+
4330
+ for (let i = start; i <= end; i += 1) items.push(i);
4331
+
4332
+ if (end < pageCount - 1) items.push('dots');
4333
+
4334
+ items.push(pageCount);
4335
+ return items;
4336
+ }, [page, pageCount]);
4337
+
4338
+ const activeEndpoint = endpoints.find((ep) => ep.id === openModalId) || null;
4339
+
4340
+ return (
4341
+ <Box paddingTop={6}>
4342
+ <Typography variant="epsilon" textColor="neutral800">
4343
+ {description}
4344
+ </Typography>
4345
+
4346
+ <Box marginTop={4}>
4347
+ <Box
4348
+ as="table"
4349
+ width="100%"
4350
+ style={{
4351
+ borderCollapse: 'collapse',
4352
+ fontSize: 13,
4353
+ }}
4354
+ >
4355
+ <thead>
4356
+ <tr>
4357
+ <th style={{ textAlign: 'left', padding: '8px 12px' }}>
4358
+ <Typography variant="sigma" textColor="neutral600">
4359
+ {formatMessage({
4360
+ id: `${PLUGIN_ID}.settings.apiCollections.column.method`,
4361
+ defaultMessage: 'Method',
4362
+ })}
4363
+ </Typography>
4364
+ </th>
4365
+ <th style={{ textAlign: 'left', padding: '8px 12px' }}>
4366
+ <Typography variant="sigma" textColor="neutral600">
4367
+ {formatMessage({
4368
+ id: `${PLUGIN_ID}.settings.apiCollections.column.name`,
4369
+ defaultMessage: 'Name',
4370
+ })}
4371
+ </Typography>
4372
+ </th>
4373
+ <th style={{ textAlign: 'left', padding: '8px 12px' }}>
4374
+ <Typography variant="sigma" textColor="neutral600">
4375
+ {formatMessage({
4376
+ id: `${PLUGIN_ID}.settings.apiCollections.column.path`,
4377
+ defaultMessage: 'Path',
4378
+ })}
4379
+ </Typography>
4380
+ </th>
4381
+ <th style={{ textAlign: 'left', padding: '8px 12px' }}>
4382
+ <Typography variant="sigma" textColor="neutral600">
4383
+ {formatMessage({
4384
+ id: `${PLUGIN_ID}.settings.apiCollections.column.summary`,
4385
+ defaultMessage: 'Summary',
4386
+ })}
4387
+ </Typography>
4388
+ </th>
4389
+ <th style={{ textAlign: 'right', padding: '8px 12px' }}>
4390
+ <Typography variant="sigma" textColor="neutral600">
4391
+ {formatMessage({
4392
+ id: `${PLUGIN_ID}.settings.apiCollections.column.actions`,
4393
+ defaultMessage: 'Actions',
4394
+ })}
4395
+ </Typography>
4396
+ </th>
4397
+ </tr>
4398
+ </thead>
4399
+ <tbody>
4400
+ {pagedEndpoints.map((endpoint) => (
4401
+ <tr key={endpoint.id} style={{ borderTop: '1px solid #e5e5ef' }}>
4402
+ <td style={{ padding: '8px 12px', whiteSpace: 'nowrap' }}>
4403
+ <Typography variant="pi" fontWeight="bold" textColor="success600">
4404
+ {endpoint.method}
4405
+ </Typography>
4406
+ </td>
4407
+ <td style={{ padding: '8px 12px' }}>
4408
+ <Typography variant="pi" textColor="neutral800">
4409
+ {endpoint.title}
4410
+ </Typography>
4411
+ </td>
4412
+ <td style={{ padding: '8px 12px' }}>
4413
+ <Typography variant="pi" textColor="neutral800">
4414
+ {endpoint.path}
4415
+ </Typography>
4416
+ </td>
4417
+ <td style={{ padding: '8px 12px' }}>
4418
+ <Typography variant="pi" textColor="neutral600">
4419
+ {endpoint.summary}
4420
+ </Typography>
4421
+ </td>
4422
+ <td style={{ padding: '8px 12px', textAlign: 'right' }}>
4423
+ <Button
4424
+ size="S"
4425
+ variant="tertiary"
4426
+ onClick={() => setOpenModalId(endpoint.id)}
4427
+ >
4428
+ {formatMessage({
4429
+ id: `${PLUGIN_ID}.settings.apiCollections.action.details`,
4430
+ defaultMessage: 'Show details',
4431
+ })}
4432
+ </Button>
4433
+ </td>
4434
+ </tr>
4435
+ ))}
4436
+ </tbody>
4437
+ </Box>
4438
+ </Box>
4439
+
4440
+ {pageCount > 1 && (
4441
+ <Box marginTop={4}>
4442
+ <Flex justifyContent="flex-end">
4443
+ <Pagination
4444
+ activePage={page}
4445
+ pageCount={pageCount}
4446
+ label={formatMessage({
4447
+ id: `${PLUGIN_ID}.settings.apiCollections.pagination.label`,
4448
+ defaultMessage: 'API collections pagination',
4449
+ })}
4450
+ >
4451
+ <PreviousLink
4452
+ as="button"
4453
+ type="button"
4454
+ disabled={page === 1}
4455
+ onClick={() => setPage((p) => Math.max(1, p - 1))}
4456
+ />
4457
+ {pageItems.map((item, idx) => {
4458
+ if (item === 'dots') {
4459
+ return <Dots key={`dots-${idx}`}>…</Dots>;
4460
+ }
4461
+
4462
+ return (
4463
+ <PageLink
4464
+ key={item}
4465
+ as="button"
4466
+ type="button"
4467
+ number={item}
4468
+ onClick={() => setPage(item)}
4469
+ />
4470
+ );
4471
+ })}
4472
+ <NextLink
4473
+ as="button"
4474
+ type="button"
4475
+ disabled={page === pageCount}
4476
+ onClick={() => setPage((p) => Math.min(pageCount, p + 1))}
4477
+ />
4478
+ </Pagination>
4479
+ </Flex>
4480
+ </Box>
4481
+ )}
4482
+
4483
+ <Box marginTop={6}>
4484
+ <Typography variant="pi" textColor="neutral500">
4485
+ {formatMessage({
4486
+ id: `${PLUGIN_ID}.settings.apiCollections.footer`,
4487
+ defaultMessage:
4488
+ 'As you add more ecommerce endpoints (products, cart, orders, etc.), they can be documented here for your team.',
4489
+ })}
4490
+ </Typography>
4491
+ </Box>
4492
+
4493
+ {activeEndpoint && (
4494
+ <Modal.Root
4495
+ open={Boolean(activeEndpoint)}
4496
+ onOpenChange={(open) => {
4497
+ if (!open) {
4498
+ setOpenModalId(null);
4499
+ }
4500
+ }}
4501
+ >
4502
+ <Modal.Content style={{ width: 'clamp(360px, 90vw, 720px)' }}>
4503
+ <Modal.Header
4504
+ closeLabel={formatMessage({
4505
+ id: `${PLUGIN_ID}.settings.apiCollections.modal.close`,
4506
+ defaultMessage: 'Close details',
4507
+ })}
4508
+ >
4509
+ <Modal.Title>{activeEndpoint.title}</Modal.Title>
4510
+ </Modal.Header>
4511
+ <Modal.Body>
4512
+ <Box paddingTop={2} paddingBottom={4}>
4513
+ <Box marginBottom={4}>
4514
+ <Typography variant="pi" textColor="neutral600">
4515
+ {activeEndpoint.summary}
4516
+ </Typography>
4517
+ </Box>
4518
+
4519
+ <Box marginBottom={4}>
4520
+ <Typography variant="pi" fontWeight="bold">
4521
+ {activeEndpoint.method}
4522
+ </Typography>{' '}
4523
+ <Typography variant="pi" textColor="neutral800">
4524
+ {activeEndpoint.path}
4525
+ </Typography>
4526
+ <Box marginTop={1}>
4527
+ <Typography variant="pi" textColor="neutral600">
4528
+ {activeEndpoint.auth}
4529
+ </Typography>
4530
+ </Box>
4531
+ </Box>
4532
+
4533
+ {activeEndpoint.requestBody && (
4534
+ <Box marginBottom={4}>
4535
+ <Typography variant="pi" textColor="neutral800" fontWeight="bold">
4536
+ {formatMessage({
4537
+ id: `${PLUGIN_ID}.settings.apiCollections.request.title`,
4538
+ defaultMessage: 'Request body',
4539
+ })}
4540
+ </Typography>
4541
+ <Box
4542
+ marginTop={2}
4543
+ padding={4}
4544
+ background="neutral100"
4545
+ hasRadius
4546
+ style={{ fontFamily: 'monospace', fontSize: '12px', whiteSpace: 'pre-wrap' }}
4547
+ >
4548
+ {activeEndpoint.requestBody}
4549
+ </Box>
4550
+ </Box>
4551
+ )}
4552
+
4553
+ <Box marginBottom={4}>
4554
+ <Typography variant="pi" textColor="neutral800" fontWeight="bold">
4555
+ {formatMessage({
4556
+ id: `${PLUGIN_ID}.settings.apiCollections.response.title`,
4557
+ defaultMessage: 'Successful response (200 OK)',
4558
+ })}
4559
+ </Typography>
4560
+ <Box
4561
+ marginTop={2}
4562
+ padding={4}
4563
+ background="neutral100"
4564
+ hasRadius
4565
+ style={{ fontFamily: 'monospace', fontSize: '12px', whiteSpace: 'pre-wrap' }}
4566
+ >
4567
+ {activeEndpoint.response}
4568
+ </Box>
4569
+ </Box>
4570
+
4571
+ <Box marginBottom={4}>
4572
+ <Typography variant="pi" textColor="neutral800" fontWeight="bold">
4573
+ {formatMessage({
4574
+ id: `${PLUGIN_ID}.settings.apiCollections.usage.title`,
4575
+ defaultMessage: 'Typical usage',
4576
+ })}
4577
+ </Typography>
4578
+ <Box as="ul" marginTop={1} paddingLeft={4}>
4579
+ {activeEndpoint.usage.map((usageItem, index) => (
4580
+ <li key={index}>
4581
+ <Typography variant="pi" textColor="neutral600">
4582
+ {usageItem}
4583
+ </Typography>
4584
+ </li>
4585
+ ))}
4586
+ </Box>
4587
+ </Box>
4588
+
4589
+ <Box>
4590
+ <Typography variant="pi" textColor="neutral800" fontWeight="bold">
4591
+ curl
4592
+ </Typography>
4593
+ <Box
4594
+ marginTop={2}
4595
+ padding={4}
4596
+ background="neutral100"
4597
+ hasRadius
4598
+ style={{ fontFamily: 'monospace', fontSize: '12px', whiteSpace: 'pre-wrap' }}
4599
+ >
4600
+ {typeof activeEndpoint.curl === 'function'
4601
+ ? activeEndpoint.curl()
4602
+ : (activeEndpoint.getCurl ? activeEndpoint.getCurl() : activeEndpoint.curl)}
4603
+ </Box>
4604
+ </Box>
4605
+ </Box>
4606
+ </Modal.Body>
4607
+ <Modal.Footer justifyContent="flex-end" gap={2}>
4608
+ <Button
4609
+ variant="tertiary"
4610
+ onClick={() => setOpenModalId(null)}
4611
+ >
4612
+ {formatMessage({
4613
+ id: `${PLUGIN_ID}.settings.apiCollections.modal.close`,
4614
+ defaultMessage: 'Close',
4615
+ })}
4616
+ </Button>
4617
+ </Modal.Footer>
4618
+ </Modal.Content>
4619
+ </Modal.Root>
4620
+ )}
4621
+ </Box>
4622
+ );
4623
+ };
4624
+
4625
+ export default ApiCollectionsContent;
4626
+