@webbycrown/webbycommerce 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/_chunks/{Settings-DpLvkyId.mjs → Settings-BWuSG1Bc.mjs} +167 -12
- package/dist/_chunks/{Settings-FFmXhBSE.js → Settings-C3yoIgMy.js} +167 -12
- package/dist/_chunks/{en-BsbZxjAR.mjs → en-7gtFcumM.mjs} +2 -0
- package/dist/_chunks/{en-CwvqDxF2.js → en-DIeqB4AB.js} +2 -0
- package/dist/_chunks/{index-DaVBMS-M.js → index-CtxKh-aM.js} +48 -5
- package/dist/_chunks/{index-rT-5a8Cs.mjs → index-DIGoLhGE.mjs} +48 -5
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +370 -107
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -580,6 +580,14 @@ Authorization: Bearer YOUR_JWT_TOKEN
|
|
|
580
580
|
|
|
581
581
|
## 📜 Changelog
|
|
582
582
|
|
|
583
|
+
## [1.1.0]
|
|
584
|
+
- ✨ Added Bulk Product API for mass product creation
|
|
585
|
+
|
|
586
|
+
## [1.0.2] – Patch Release
|
|
587
|
+
|
|
588
|
+
### Fixed
|
|
589
|
+
- Fix critical bugs
|
|
590
|
+
|
|
583
591
|
## [1.0.1] – Patch Release
|
|
584
592
|
|
|
585
593
|
### Changed
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import React__default, { useContext, useRef, useCallback, useDebugValue, useMemo, useState, useEffect, useLayoutEffect, createContext as createContext$1, createElement, useReducer } from "react";
|
|
4
4
|
import { useIntl, FormattedMessage } from "react-intl";
|
|
5
5
|
import { Flex, Box, Popover, Typography, Button, LinkButton, Link as Link$1, Portal, Alert, Field, SubNav, Badge, TextInput, Pagination, PreviousLink, Dots, PageLink, NextLink, Modal, Main } from "@strapi/design-system";
|
|
6
|
-
import { P as PLUGIN_ID } from "./index-
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-DIGoLhGE.mjs";
|
|
7
7
|
import { WarningCircle, CaretDown, Trash } from "@strapi/icons";
|
|
8
8
|
import "react-dom/client";
|
|
9
9
|
import ReactDOM, { unstable_batchedUpdates as unstable_batchedUpdates$1 } from "react-dom";
|
|
@@ -19124,6 +19124,7 @@ new QueryClient({
|
|
|
19124
19124
|
});
|
|
19125
19125
|
const HEIGHT_TOP_NAVIGATION = "6.4rem";
|
|
19126
19126
|
const HEIGHT_TOP_NAVIGATION_MEDIUM = "5.6rem";
|
|
19127
|
+
const WIDTH_SIDE_NAVIGATION = "23.2rem";
|
|
19127
19128
|
styled(Alert)`
|
|
19128
19129
|
& > div:first-child {
|
|
19129
19130
|
display: none;
|
|
@@ -21358,6 +21359,8 @@ flatRest(function(object2, paths) {
|
|
|
21358
21359
|
styled(Field.Root)`
|
|
21359
21360
|
height: 3.2rem;
|
|
21360
21361
|
width: 3.2rem;
|
|
21362
|
+
align-items: center;
|
|
21363
|
+
justify-content: center;
|
|
21361
21364
|
|
|
21362
21365
|
> label,
|
|
21363
21366
|
~ input {
|
|
@@ -21408,21 +21411,30 @@ create().shape({
|
|
|
21408
21411
|
if (!value || typeof value !== "string") return true;
|
|
21409
21412
|
const byteSize = getByteSize(value);
|
|
21410
21413
|
return byteSize <= 72;
|
|
21411
|
-
}).
|
|
21414
|
+
}).test("lowercase", {
|
|
21412
21415
|
message: {
|
|
21413
21416
|
id: "components.Input.error.contain.lowercase",
|
|
21414
21417
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21415
21418
|
}
|
|
21416
|
-
})
|
|
21419
|
+
}, (value) => {
|
|
21420
|
+
if (!value) return true;
|
|
21421
|
+
return /[a-z]/.test(value);
|
|
21422
|
+
}).test("uppercase", {
|
|
21417
21423
|
message: {
|
|
21418
21424
|
id: "components.Input.error.contain.uppercase",
|
|
21419
21425
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21420
21426
|
}
|
|
21421
|
-
})
|
|
21427
|
+
}, (value) => {
|
|
21428
|
+
if (!value) return true;
|
|
21429
|
+
return /[A-Z]/.test(value);
|
|
21430
|
+
}).test("number", {
|
|
21422
21431
|
message: {
|
|
21423
21432
|
id: "components.Input.error.contain.number",
|
|
21424
21433
|
defaultMessage: "Password must contain at least 1 number"
|
|
21425
21434
|
}
|
|
21435
|
+
}, (value) => {
|
|
21436
|
+
if (!value) return true;
|
|
21437
|
+
return /\d/.test(value);
|
|
21426
21438
|
}).required({
|
|
21427
21439
|
id: errorsTrads.required.id,
|
|
21428
21440
|
defaultMessage: "Password is required"
|
|
@@ -21460,21 +21472,30 @@ create().shape({
|
|
|
21460
21472
|
}, function(value) {
|
|
21461
21473
|
if (!value) return true;
|
|
21462
21474
|
return new TextEncoder().encode(value).length <= 72;
|
|
21463
|
-
}).
|
|
21475
|
+
}).test("lowercase", {
|
|
21464
21476
|
message: {
|
|
21465
21477
|
id: "components.Input.error.contain.lowercase",
|
|
21466
21478
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21467
21479
|
}
|
|
21468
|
-
})
|
|
21480
|
+
}, (value) => {
|
|
21481
|
+
if (!value) return true;
|
|
21482
|
+
return /[a-z]/.test(value);
|
|
21483
|
+
}).test("uppercase", {
|
|
21469
21484
|
message: {
|
|
21470
21485
|
id: "components.Input.error.contain.uppercase",
|
|
21471
21486
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21472
21487
|
}
|
|
21473
|
-
})
|
|
21488
|
+
}, (value) => {
|
|
21489
|
+
if (!value) return true;
|
|
21490
|
+
return /[A-Z]/.test(value);
|
|
21491
|
+
}).test("number", {
|
|
21474
21492
|
message: {
|
|
21475
21493
|
id: "components.Input.error.contain.number",
|
|
21476
21494
|
defaultMessage: "Password must contain at least 1 number"
|
|
21477
21495
|
}
|
|
21496
|
+
}, (value) => {
|
|
21497
|
+
if (!value) return true;
|
|
21498
|
+
return /\d/.test(value);
|
|
21478
21499
|
}).required({
|
|
21479
21500
|
id: errorsTrads.required.id,
|
|
21480
21501
|
defaultMessage: "Password is required"
|
|
@@ -21517,21 +21538,30 @@ create().shape({
|
|
|
21517
21538
|
if (!value || typeof value !== "string") return true;
|
|
21518
21539
|
const byteSize = getByteSize(value);
|
|
21519
21540
|
return byteSize <= 72;
|
|
21520
|
-
}).
|
|
21541
|
+
}).test("lowercase", {
|
|
21521
21542
|
message: {
|
|
21522
21543
|
id: "components.Input.error.contain.lowercase",
|
|
21523
21544
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21524
21545
|
}
|
|
21525
|
-
})
|
|
21546
|
+
}, (value) => {
|
|
21547
|
+
if (!value) return true;
|
|
21548
|
+
return /[a-z]/.test(value);
|
|
21549
|
+
}).test("uppercase", {
|
|
21526
21550
|
message: {
|
|
21527
21551
|
id: "components.Input.error.contain.uppercase",
|
|
21528
21552
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21529
21553
|
}
|
|
21530
|
-
})
|
|
21554
|
+
}, (value) => {
|
|
21555
|
+
if (!value) return true;
|
|
21556
|
+
return /[A-Z]/.test(value);
|
|
21557
|
+
}).test("number", {
|
|
21531
21558
|
message: {
|
|
21532
21559
|
id: "components.Input.error.contain.number",
|
|
21533
21560
|
defaultMessage: "Password must contain at least 1 number"
|
|
21534
21561
|
}
|
|
21562
|
+
}, (value) => {
|
|
21563
|
+
if (!value) return true;
|
|
21564
|
+
return /\d/.test(value);
|
|
21535
21565
|
}).required({
|
|
21536
21566
|
id: errorsTrads.required.id,
|
|
21537
21567
|
defaultMessage: "Password is required"
|
|
@@ -21591,7 +21621,7 @@ const MainSubNav = styled(SubNav)`
|
|
|
21591
21621
|
z-index: 2;
|
|
21592
21622
|
|
|
21593
21623
|
${({ theme }) => theme.breakpoints.medium} {
|
|
21594
|
-
width:
|
|
21624
|
+
width: ${WIDTH_SIDE_NAVIGATION};
|
|
21595
21625
|
position: sticky;
|
|
21596
21626
|
top: 0;
|
|
21597
21627
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
@@ -21684,12 +21714,28 @@ styled(Box)`
|
|
|
21684
21714
|
}
|
|
21685
21715
|
`;
|
|
21686
21716
|
styled(Badge)`
|
|
21717
|
+
width: 100%;
|
|
21687
21718
|
background: linear-gradient(
|
|
21688
21719
|
90deg,
|
|
21689
21720
|
${({ theme }) => theme.colors.primary600} 0%,
|
|
21690
21721
|
${({ theme }) => theme.colors.alternative600} 121.48%
|
|
21691
21722
|
);
|
|
21692
|
-
padding:
|
|
21723
|
+
padding: 1.1rem 1rem;
|
|
21724
|
+
|
|
21725
|
+
${({ theme }) => theme.breakpoints.small} {
|
|
21726
|
+
padding: 1.2rem 1rem;
|
|
21727
|
+
}
|
|
21728
|
+
${({ theme }) => theme.breakpoints.medium} {
|
|
21729
|
+
padding: 0.4rem 1rem;
|
|
21730
|
+
}
|
|
21731
|
+
`;
|
|
21732
|
+
styled(Typography)`
|
|
21733
|
+
font-size: 1.2rem;
|
|
21734
|
+
|
|
21735
|
+
${({ theme }) => theme.breakpoints.small} {
|
|
21736
|
+
font-size: 1.4rem;
|
|
21737
|
+
line-height: 1.6rem;
|
|
21738
|
+
}
|
|
21693
21739
|
`;
|
|
21694
21740
|
const useFetchClient = () => {
|
|
21695
21741
|
const controller = React.useRef(null);
|
|
@@ -27018,6 +27064,115 @@ const ApiCollectionsContent = () => {
|
|
|
27018
27064
|
"dimensions": {"length": 10, "width": 5, "height": 2},
|
|
27019
27065
|
"product_categories": [1, 2],
|
|
27020
27066
|
"tags": [1]
|
|
27067
|
+
}`
|
|
27068
|
+
},
|
|
27069
|
+
{
|
|
27070
|
+
id: "create-bulk-products",
|
|
27071
|
+
method: "POST",
|
|
27072
|
+
path: getApiPath("/api/webbycommerce/products/bulk"),
|
|
27073
|
+
title: formatMessage({
|
|
27074
|
+
id: `${PLUGIN_ID}.settings.apiCollections.products.createBulk.title`,
|
|
27075
|
+
defaultMessage: "Create Products in Bulk"
|
|
27076
|
+
}),
|
|
27077
|
+
summary: formatMessage({
|
|
27078
|
+
id: `${PLUGIN_ID}.settings.apiCollections.products.createBulk.summary`,
|
|
27079
|
+
defaultMessage: "Create multiple products in a single request. Returns detailed results for each product including success and failure status."
|
|
27080
|
+
}),
|
|
27081
|
+
auth: formatMessage({
|
|
27082
|
+
id: `${PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
|
|
27083
|
+
defaultMessage: "Auth: requires JWT token (Authorization: Bearer <token>) and administrator role."
|
|
27084
|
+
}),
|
|
27085
|
+
response: `{
|
|
27086
|
+
"data": {
|
|
27087
|
+
"success": [
|
|
27088
|
+
{
|
|
27089
|
+
"index": 0,
|
|
27090
|
+
"product": {
|
|
27091
|
+
"id": 1,
|
|
27092
|
+
"name": "Product 1",
|
|
27093
|
+
"price": 49.99,
|
|
27094
|
+
"sku": "P001",
|
|
27095
|
+
"createdAt": "2024-01-01T00:00:00.000Z"
|
|
27096
|
+
}
|
|
27097
|
+
}
|
|
27098
|
+
],
|
|
27099
|
+
"failed": [
|
|
27100
|
+
{
|
|
27101
|
+
"index": 1,
|
|
27102
|
+
"product": {
|
|
27103
|
+
"name": "Product 2",
|
|
27104
|
+
"price": "invalid"
|
|
27105
|
+
},
|
|
27106
|
+
"errors": ["Price must be a valid positive number."]
|
|
27107
|
+
}
|
|
27108
|
+
],
|
|
27109
|
+
"summary": {
|
|
27110
|
+
"total": 2,
|
|
27111
|
+
"successful": 1,
|
|
27112
|
+
"failed": 1
|
|
27113
|
+
}
|
|
27114
|
+
}
|
|
27115
|
+
}`,
|
|
27116
|
+
usage: [
|
|
27117
|
+
"Include the JWT token in the Authorization header.",
|
|
27118
|
+
"Send an array of products in the request body.",
|
|
27119
|
+
"Each product must have name and price (same validation as single product creation).",
|
|
27120
|
+
"Maximum 100 products per request.",
|
|
27121
|
+
"Returns 200 if all succeed, 207 if mixed results, 400 if all fail.",
|
|
27122
|
+
"Check the summary and failed arrays to see which products succeeded or failed."
|
|
27123
|
+
],
|
|
27124
|
+
getCurl: () => `curl -X POST http://localhost:1337${getApiPath("/api/webbycommerce/products/bulk")} \\
|
|
27125
|
+
-H "Authorization: Bearer YOUR_JWT_TOKEN" \\
|
|
27126
|
+
-H "Content-Type: application/json" \\
|
|
27127
|
+
-d '{
|
|
27128
|
+
"products": [
|
|
27129
|
+
{
|
|
27130
|
+
"name": "Product 1",
|
|
27131
|
+
"price": 49.99,
|
|
27132
|
+
"description": "First product",
|
|
27133
|
+
"sku": "P001",
|
|
27134
|
+
"stock_quantity": 50
|
|
27135
|
+
},
|
|
27136
|
+
{
|
|
27137
|
+
"name": "Product 2",
|
|
27138
|
+
"price": 29.99,
|
|
27139
|
+
"description": "Second product",
|
|
27140
|
+
"sku": "P002",
|
|
27141
|
+
"stock_quantity": 30
|
|
27142
|
+
}
|
|
27143
|
+
]
|
|
27144
|
+
}'`,
|
|
27145
|
+
requestBody: `{
|
|
27146
|
+
"products": [
|
|
27147
|
+
{
|
|
27148
|
+
"name": "Product 1",
|
|
27149
|
+
"description": "First product description",
|
|
27150
|
+
"price": 49.99,
|
|
27151
|
+
"sale_price": 39.99,
|
|
27152
|
+
"sku": "P001",
|
|
27153
|
+
"slug": "product-1",
|
|
27154
|
+
"stock_quantity": 50,
|
|
27155
|
+
"stock_status": "in_stock",
|
|
27156
|
+
"weight": 1.5,
|
|
27157
|
+
"dimensions": {"length": 10, "width": 5, "height": 2},
|
|
27158
|
+
"product_categories": [1, 2],
|
|
27159
|
+
"tags": [1],
|
|
27160
|
+
"images": [1, 2]
|
|
27161
|
+
},
|
|
27162
|
+
{
|
|
27163
|
+
"name": "Product 2",
|
|
27164
|
+
"description": "Second product description",
|
|
27165
|
+
"price": 29.99,
|
|
27166
|
+
"sale_price": 24.99,
|
|
27167
|
+
"sku": "P002",
|
|
27168
|
+
"slug": "product-2",
|
|
27169
|
+
"stock_quantity": 30,
|
|
27170
|
+
"stock_status": "in_stock",
|
|
27171
|
+
"weight": 0.8,
|
|
27172
|
+
"product_categories": [1],
|
|
27173
|
+
"tags": [2]
|
|
27174
|
+
}
|
|
27175
|
+
]
|
|
27021
27176
|
}`
|
|
27022
27177
|
},
|
|
27023
27178
|
{
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactIntl = require("react-intl");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const index = require("./index-
|
|
7
|
+
const index = require("./index-CtxKh-aM.js");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
require("react-dom/client");
|
|
10
10
|
const ReactDOM = require("react-dom");
|
|
@@ -19124,6 +19124,7 @@ new QueryClient({
|
|
|
19124
19124
|
});
|
|
19125
19125
|
const HEIGHT_TOP_NAVIGATION = "6.4rem";
|
|
19126
19126
|
const HEIGHT_TOP_NAVIGATION_MEDIUM = "5.6rem";
|
|
19127
|
+
const WIDTH_SIDE_NAVIGATION = "23.2rem";
|
|
19127
19128
|
styled.styled(designSystem.Alert)`
|
|
19128
19129
|
& > div:first-child {
|
|
19129
19130
|
display: none;
|
|
@@ -21358,6 +21359,8 @@ flatRest(function(object2, paths) {
|
|
|
21358
21359
|
styled.styled(designSystem.Field.Root)`
|
|
21359
21360
|
height: 3.2rem;
|
|
21360
21361
|
width: 3.2rem;
|
|
21362
|
+
align-items: center;
|
|
21363
|
+
justify-content: center;
|
|
21361
21364
|
|
|
21362
21365
|
> label,
|
|
21363
21366
|
~ input {
|
|
@@ -21408,21 +21411,30 @@ create().shape({
|
|
|
21408
21411
|
if (!value || typeof value !== "string") return true;
|
|
21409
21412
|
const byteSize = getByteSize(value);
|
|
21410
21413
|
return byteSize <= 72;
|
|
21411
|
-
}).
|
|
21414
|
+
}).test("lowercase", {
|
|
21412
21415
|
message: {
|
|
21413
21416
|
id: "components.Input.error.contain.lowercase",
|
|
21414
21417
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21415
21418
|
}
|
|
21416
|
-
})
|
|
21419
|
+
}, (value) => {
|
|
21420
|
+
if (!value) return true;
|
|
21421
|
+
return /[a-z]/.test(value);
|
|
21422
|
+
}).test("uppercase", {
|
|
21417
21423
|
message: {
|
|
21418
21424
|
id: "components.Input.error.contain.uppercase",
|
|
21419
21425
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21420
21426
|
}
|
|
21421
|
-
})
|
|
21427
|
+
}, (value) => {
|
|
21428
|
+
if (!value) return true;
|
|
21429
|
+
return /[A-Z]/.test(value);
|
|
21430
|
+
}).test("number", {
|
|
21422
21431
|
message: {
|
|
21423
21432
|
id: "components.Input.error.contain.number",
|
|
21424
21433
|
defaultMessage: "Password must contain at least 1 number"
|
|
21425
21434
|
}
|
|
21435
|
+
}, (value) => {
|
|
21436
|
+
if (!value) return true;
|
|
21437
|
+
return /\d/.test(value);
|
|
21426
21438
|
}).required({
|
|
21427
21439
|
id: errorsTrads.required.id,
|
|
21428
21440
|
defaultMessage: "Password is required"
|
|
@@ -21460,21 +21472,30 @@ create().shape({
|
|
|
21460
21472
|
}, function(value) {
|
|
21461
21473
|
if (!value) return true;
|
|
21462
21474
|
return new TextEncoder().encode(value).length <= 72;
|
|
21463
|
-
}).
|
|
21475
|
+
}).test("lowercase", {
|
|
21464
21476
|
message: {
|
|
21465
21477
|
id: "components.Input.error.contain.lowercase",
|
|
21466
21478
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21467
21479
|
}
|
|
21468
|
-
})
|
|
21480
|
+
}, (value) => {
|
|
21481
|
+
if (!value) return true;
|
|
21482
|
+
return /[a-z]/.test(value);
|
|
21483
|
+
}).test("uppercase", {
|
|
21469
21484
|
message: {
|
|
21470
21485
|
id: "components.Input.error.contain.uppercase",
|
|
21471
21486
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21472
21487
|
}
|
|
21473
|
-
})
|
|
21488
|
+
}, (value) => {
|
|
21489
|
+
if (!value) return true;
|
|
21490
|
+
return /[A-Z]/.test(value);
|
|
21491
|
+
}).test("number", {
|
|
21474
21492
|
message: {
|
|
21475
21493
|
id: "components.Input.error.contain.number",
|
|
21476
21494
|
defaultMessage: "Password must contain at least 1 number"
|
|
21477
21495
|
}
|
|
21496
|
+
}, (value) => {
|
|
21497
|
+
if (!value) return true;
|
|
21498
|
+
return /\d/.test(value);
|
|
21478
21499
|
}).required({
|
|
21479
21500
|
id: errorsTrads.required.id,
|
|
21480
21501
|
defaultMessage: "Password is required"
|
|
@@ -21517,21 +21538,30 @@ create().shape({
|
|
|
21517
21538
|
if (!value || typeof value !== "string") return true;
|
|
21518
21539
|
const byteSize = getByteSize(value);
|
|
21519
21540
|
return byteSize <= 72;
|
|
21520
|
-
}).
|
|
21541
|
+
}).test("lowercase", {
|
|
21521
21542
|
message: {
|
|
21522
21543
|
id: "components.Input.error.contain.lowercase",
|
|
21523
21544
|
defaultMessage: "Password must contain at least 1 lowercase letter"
|
|
21524
21545
|
}
|
|
21525
|
-
})
|
|
21546
|
+
}, (value) => {
|
|
21547
|
+
if (!value) return true;
|
|
21548
|
+
return /[a-z]/.test(value);
|
|
21549
|
+
}).test("uppercase", {
|
|
21526
21550
|
message: {
|
|
21527
21551
|
id: "components.Input.error.contain.uppercase",
|
|
21528
21552
|
defaultMessage: "Password must contain at least 1 uppercase letter"
|
|
21529
21553
|
}
|
|
21530
|
-
})
|
|
21554
|
+
}, (value) => {
|
|
21555
|
+
if (!value) return true;
|
|
21556
|
+
return /[A-Z]/.test(value);
|
|
21557
|
+
}).test("number", {
|
|
21531
21558
|
message: {
|
|
21532
21559
|
id: "components.Input.error.contain.number",
|
|
21533
21560
|
defaultMessage: "Password must contain at least 1 number"
|
|
21534
21561
|
}
|
|
21562
|
+
}, (value) => {
|
|
21563
|
+
if (!value) return true;
|
|
21564
|
+
return /\d/.test(value);
|
|
21535
21565
|
}).required({
|
|
21536
21566
|
id: errorsTrads.required.id,
|
|
21537
21567
|
defaultMessage: "Password is required"
|
|
@@ -21591,7 +21621,7 @@ const MainSubNav = styled.styled(designSystem.SubNav)`
|
|
|
21591
21621
|
z-index: 2;
|
|
21592
21622
|
|
|
21593
21623
|
${({ theme }) => theme.breakpoints.medium} {
|
|
21594
|
-
width:
|
|
21624
|
+
width: ${WIDTH_SIDE_NAVIGATION};
|
|
21595
21625
|
position: sticky;
|
|
21596
21626
|
top: 0;
|
|
21597
21627
|
border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
@@ -21684,12 +21714,28 @@ styled.styled(designSystem.Box)`
|
|
|
21684
21714
|
}
|
|
21685
21715
|
`;
|
|
21686
21716
|
styled.styled(designSystem.Badge)`
|
|
21717
|
+
width: 100%;
|
|
21687
21718
|
background: linear-gradient(
|
|
21688
21719
|
90deg,
|
|
21689
21720
|
${({ theme }) => theme.colors.primary600} 0%,
|
|
21690
21721
|
${({ theme }) => theme.colors.alternative600} 121.48%
|
|
21691
21722
|
);
|
|
21692
|
-
padding:
|
|
21723
|
+
padding: 1.1rem 1rem;
|
|
21724
|
+
|
|
21725
|
+
${({ theme }) => theme.breakpoints.small} {
|
|
21726
|
+
padding: 1.2rem 1rem;
|
|
21727
|
+
}
|
|
21728
|
+
${({ theme }) => theme.breakpoints.medium} {
|
|
21729
|
+
padding: 0.4rem 1rem;
|
|
21730
|
+
}
|
|
21731
|
+
`;
|
|
21732
|
+
styled.styled(designSystem.Typography)`
|
|
21733
|
+
font-size: 1.2rem;
|
|
21734
|
+
|
|
21735
|
+
${({ theme }) => theme.breakpoints.small} {
|
|
21736
|
+
font-size: 1.4rem;
|
|
21737
|
+
line-height: 1.6rem;
|
|
21738
|
+
}
|
|
21693
21739
|
`;
|
|
21694
21740
|
const useFetchClient = () => {
|
|
21695
21741
|
const controller = React__namespace.useRef(null);
|
|
@@ -27018,6 +27064,115 @@ const ApiCollectionsContent = () => {
|
|
|
27018
27064
|
"dimensions": {"length": 10, "width": 5, "height": 2},
|
|
27019
27065
|
"product_categories": [1, 2],
|
|
27020
27066
|
"tags": [1]
|
|
27067
|
+
}`
|
|
27068
|
+
},
|
|
27069
|
+
{
|
|
27070
|
+
id: "create-bulk-products",
|
|
27071
|
+
method: "POST",
|
|
27072
|
+
path: getApiPath("/api/webbycommerce/products/bulk"),
|
|
27073
|
+
title: formatMessage({
|
|
27074
|
+
id: `${index.PLUGIN_ID}.settings.apiCollections.products.createBulk.title`,
|
|
27075
|
+
defaultMessage: "Create Products in Bulk"
|
|
27076
|
+
}),
|
|
27077
|
+
summary: formatMessage({
|
|
27078
|
+
id: `${index.PLUGIN_ID}.settings.apiCollections.products.createBulk.summary`,
|
|
27079
|
+
defaultMessage: "Create multiple products in a single request. Returns detailed results for each product including success and failure status."
|
|
27080
|
+
}),
|
|
27081
|
+
auth: formatMessage({
|
|
27082
|
+
id: `${index.PLUGIN_ID}.settings.apiCollections.products.authAdmin`,
|
|
27083
|
+
defaultMessage: "Auth: requires JWT token (Authorization: Bearer <token>) and administrator role."
|
|
27084
|
+
}),
|
|
27085
|
+
response: `{
|
|
27086
|
+
"data": {
|
|
27087
|
+
"success": [
|
|
27088
|
+
{
|
|
27089
|
+
"index": 0,
|
|
27090
|
+
"product": {
|
|
27091
|
+
"id": 1,
|
|
27092
|
+
"name": "Product 1",
|
|
27093
|
+
"price": 49.99,
|
|
27094
|
+
"sku": "P001",
|
|
27095
|
+
"createdAt": "2024-01-01T00:00:00.000Z"
|
|
27096
|
+
}
|
|
27097
|
+
}
|
|
27098
|
+
],
|
|
27099
|
+
"failed": [
|
|
27100
|
+
{
|
|
27101
|
+
"index": 1,
|
|
27102
|
+
"product": {
|
|
27103
|
+
"name": "Product 2",
|
|
27104
|
+
"price": "invalid"
|
|
27105
|
+
},
|
|
27106
|
+
"errors": ["Price must be a valid positive number."]
|
|
27107
|
+
}
|
|
27108
|
+
],
|
|
27109
|
+
"summary": {
|
|
27110
|
+
"total": 2,
|
|
27111
|
+
"successful": 1,
|
|
27112
|
+
"failed": 1
|
|
27113
|
+
}
|
|
27114
|
+
}
|
|
27115
|
+
}`,
|
|
27116
|
+
usage: [
|
|
27117
|
+
"Include the JWT token in the Authorization header.",
|
|
27118
|
+
"Send an array of products in the request body.",
|
|
27119
|
+
"Each product must have name and price (same validation as single product creation).",
|
|
27120
|
+
"Maximum 100 products per request.",
|
|
27121
|
+
"Returns 200 if all succeed, 207 if mixed results, 400 if all fail.",
|
|
27122
|
+
"Check the summary and failed arrays to see which products succeeded or failed."
|
|
27123
|
+
],
|
|
27124
|
+
getCurl: () => `curl -X POST http://localhost:1337${getApiPath("/api/webbycommerce/products/bulk")} \\
|
|
27125
|
+
-H "Authorization: Bearer YOUR_JWT_TOKEN" \\
|
|
27126
|
+
-H "Content-Type: application/json" \\
|
|
27127
|
+
-d '{
|
|
27128
|
+
"products": [
|
|
27129
|
+
{
|
|
27130
|
+
"name": "Product 1",
|
|
27131
|
+
"price": 49.99,
|
|
27132
|
+
"description": "First product",
|
|
27133
|
+
"sku": "P001",
|
|
27134
|
+
"stock_quantity": 50
|
|
27135
|
+
},
|
|
27136
|
+
{
|
|
27137
|
+
"name": "Product 2",
|
|
27138
|
+
"price": 29.99,
|
|
27139
|
+
"description": "Second product",
|
|
27140
|
+
"sku": "P002",
|
|
27141
|
+
"stock_quantity": 30
|
|
27142
|
+
}
|
|
27143
|
+
]
|
|
27144
|
+
}'`,
|
|
27145
|
+
requestBody: `{
|
|
27146
|
+
"products": [
|
|
27147
|
+
{
|
|
27148
|
+
"name": "Product 1",
|
|
27149
|
+
"description": "First product description",
|
|
27150
|
+
"price": 49.99,
|
|
27151
|
+
"sale_price": 39.99,
|
|
27152
|
+
"sku": "P001",
|
|
27153
|
+
"slug": "product-1",
|
|
27154
|
+
"stock_quantity": 50,
|
|
27155
|
+
"stock_status": "in_stock",
|
|
27156
|
+
"weight": 1.5,
|
|
27157
|
+
"dimensions": {"length": 10, "width": 5, "height": 2},
|
|
27158
|
+
"product_categories": [1, 2],
|
|
27159
|
+
"tags": [1],
|
|
27160
|
+
"images": [1, 2]
|
|
27161
|
+
},
|
|
27162
|
+
{
|
|
27163
|
+
"name": "Product 2",
|
|
27164
|
+
"description": "Second product description",
|
|
27165
|
+
"price": 29.99,
|
|
27166
|
+
"sale_price": 24.99,
|
|
27167
|
+
"sku": "P002",
|
|
27168
|
+
"slug": "product-2",
|
|
27169
|
+
"stock_quantity": 30,
|
|
27170
|
+
"stock_status": "in_stock",
|
|
27171
|
+
"weight": 0.8,
|
|
27172
|
+
"product_categories": [1],
|
|
27173
|
+
"tags": [2]
|
|
27174
|
+
}
|
|
27175
|
+
]
|
|
27021
27176
|
}`
|
|
27022
27177
|
},
|
|
27023
27178
|
{
|
|
@@ -183,6 +183,8 @@ const en = {
|
|
|
183
183
|
"webbycommerce.settings.apiCollections.products.getBySlug.summary": "Retrieve detailed information for a specific product by slug.",
|
|
184
184
|
"webbycommerce.settings.apiCollections.products.create.title": "Create Product",
|
|
185
185
|
"webbycommerce.settings.apiCollections.products.create.summary": "Create a new product (admin functionality).",
|
|
186
|
+
"webbycommerce.settings.apiCollections.products.createBulk.title": "Create Products in Bulk",
|
|
187
|
+
"webbycommerce.settings.apiCollections.products.createBulk.summary": "Create multiple products in a single request. Returns detailed results for each product including success and failure status.",
|
|
186
188
|
"webbycommerce.settings.apiCollections.products.update.title": "Update Product",
|
|
187
189
|
"webbycommerce.settings.apiCollections.products.update.summary": "Update an existing product (admin functionality).",
|
|
188
190
|
"webbycommerce.settings.apiCollections.products.delete.title": "Delete Product",
|
|
@@ -185,6 +185,8 @@ const en = {
|
|
|
185
185
|
"webbycommerce.settings.apiCollections.products.getBySlug.summary": "Retrieve detailed information for a specific product by slug.",
|
|
186
186
|
"webbycommerce.settings.apiCollections.products.create.title": "Create Product",
|
|
187
187
|
"webbycommerce.settings.apiCollections.products.create.summary": "Create a new product (admin functionality).",
|
|
188
|
+
"webbycommerce.settings.apiCollections.products.createBulk.title": "Create Products in Bulk",
|
|
189
|
+
"webbycommerce.settings.apiCollections.products.createBulk.summary": "Create multiple products in a single request. Returns detailed results for each product including success and failure status.",
|
|
188
190
|
"webbycommerce.settings.apiCollections.products.update.title": "Update Product",
|
|
189
191
|
"webbycommerce.settings.apiCollections.products.update.summary": "Update an existing product (admin functionality).",
|
|
190
192
|
"webbycommerce.settings.apiCollections.products.delete.title": "Delete Product",
|