@cmssy/next 0.10.0 → 0.11.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/dist/index.cjs +27 -23
- package/dist/index.js +27 -23
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1088,15 +1088,15 @@ var CART_FIELDS = `
|
|
|
1088
1088
|
snapshot { name price currency imageUrl sku }
|
|
1089
1089
|
}
|
|
1090
1090
|
`;
|
|
1091
|
-
var CART_QUERY = `query Cart($workspaceId: ID!) { cart(workspaceId: $workspaceId) { ${CART_FIELDS} } }`;
|
|
1092
|
-
var ADD_TO_CART = `mutation AddToCart($input: AddToCartInput!) {
|
|
1093
|
-
var UPDATE_ITEM = `mutation UpdateCartItem($input: UpdateCartItemInput!) {
|
|
1094
|
-
var REMOVE_ITEM = `mutation RemoveCartItem($workspaceId: ID!, $itemId: ID!) {
|
|
1095
|
-
var CLEAR_CART = `mutation ClearCart($workspaceId: ID!) {
|
|
1096
|
-
var APPLY_DISCOUNT = `mutation ApplyDiscount($workspaceId: ID!, $code: String!) { applyDiscount(workspaceId: $workspaceId, code: $code) { ${CART_FIELDS} } }`;
|
|
1097
|
-
var REMOVE_DISCOUNT = `mutation RemoveDiscount($workspaceId: ID!) { removeDiscount(workspaceId: $workspaceId) { ${CART_FIELDS} } }`;
|
|
1091
|
+
var CART_QUERY = `query Cart($workspaceId: ID!) { cart { get(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1092
|
+
var ADD_TO_CART = `mutation AddToCart($input: AddToCartInput!) { cart { addItem(input: $input) { ${CART_FIELDS} } } }`;
|
|
1093
|
+
var UPDATE_ITEM = `mutation UpdateCartItem($input: UpdateCartItemInput!) { cart { updateItem(input: $input) { ${CART_FIELDS} } } }`;
|
|
1094
|
+
var REMOVE_ITEM = `mutation RemoveCartItem($workspaceId: ID!, $itemId: ID!) { cart { removeItem(workspaceId: $workspaceId, itemId: $itemId) { ${CART_FIELDS} } } }`;
|
|
1095
|
+
var CLEAR_CART = `mutation ClearCart($workspaceId: ID!) { cart { clear(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1096
|
+
var APPLY_DISCOUNT = `mutation ApplyDiscount($workspaceId: ID!, $code: String!) { cart { applyDiscount(workspaceId: $workspaceId, code: $code) { ${CART_FIELDS} } } }`;
|
|
1097
|
+
var REMOVE_DISCOUNT = `mutation RemoveDiscount($workspaceId: ID!) { cart { removeDiscount(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1098
1098
|
var CHECKOUT = `mutation Checkout($input: CheckoutInput!) {
|
|
1099
|
-
checkout(input: $input) { id status subtotal total currency customerEmail }
|
|
1099
|
+
cart { checkout(input: $input) { id status subtotal total currency customerEmail } }
|
|
1100
1100
|
}`;
|
|
1101
1101
|
var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter: JSON) {
|
|
1102
1102
|
publicModelRecords(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: 1) {
|
|
@@ -1140,7 +1140,7 @@ async function backendGetCart(config, ctx) {
|
|
|
1140
1140
|
{ workspaceId },
|
|
1141
1141
|
"cart query"
|
|
1142
1142
|
);
|
|
1143
|
-
return data.cart;
|
|
1143
|
+
return data.cart.get;
|
|
1144
1144
|
}
|
|
1145
1145
|
async function backendAddToCart(config, ctx, input) {
|
|
1146
1146
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1152,7 +1152,7 @@ async function backendAddToCart(config, ctx, input) {
|
|
|
1152
1152
|
{ input: { workspaceId, ...input } },
|
|
1153
1153
|
"add to cart"
|
|
1154
1154
|
);
|
|
1155
|
-
return data.
|
|
1155
|
+
return data.cart.addItem;
|
|
1156
1156
|
}
|
|
1157
1157
|
async function backendUpdateItem(config, ctx, input) {
|
|
1158
1158
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1164,7 +1164,7 @@ async function backendUpdateItem(config, ctx, input) {
|
|
|
1164
1164
|
{ input: { workspaceId, ...input } },
|
|
1165
1165
|
"update cart item"
|
|
1166
1166
|
);
|
|
1167
|
-
return data.
|
|
1167
|
+
return data.cart.updateItem;
|
|
1168
1168
|
}
|
|
1169
1169
|
async function backendRemoveItem(config, ctx, itemId) {
|
|
1170
1170
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1176,7 +1176,7 @@ async function backendRemoveItem(config, ctx, itemId) {
|
|
|
1176
1176
|
{ workspaceId, itemId },
|
|
1177
1177
|
"remove cart item"
|
|
1178
1178
|
);
|
|
1179
|
-
return data.
|
|
1179
|
+
return data.cart.removeItem;
|
|
1180
1180
|
}
|
|
1181
1181
|
async function backendClearCart(config, ctx) {
|
|
1182
1182
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1188,7 +1188,7 @@ async function backendClearCart(config, ctx) {
|
|
|
1188
1188
|
{ workspaceId },
|
|
1189
1189
|
"clear cart"
|
|
1190
1190
|
);
|
|
1191
|
-
return data.
|
|
1191
|
+
return data.cart.clear;
|
|
1192
1192
|
}
|
|
1193
1193
|
async function backendApplyDiscount(config, ctx, code) {
|
|
1194
1194
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1200,7 +1200,7 @@ async function backendApplyDiscount(config, ctx, code) {
|
|
|
1200
1200
|
{ workspaceId, code },
|
|
1201
1201
|
"apply discount"
|
|
1202
1202
|
);
|
|
1203
|
-
return data.applyDiscount;
|
|
1203
|
+
return data.cart.applyDiscount;
|
|
1204
1204
|
}
|
|
1205
1205
|
async function backendRemoveDiscount(config, ctx) {
|
|
1206
1206
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1212,7 +1212,7 @@ async function backendRemoveDiscount(config, ctx) {
|
|
|
1212
1212
|
{ workspaceId },
|
|
1213
1213
|
"remove discount"
|
|
1214
1214
|
);
|
|
1215
|
-
return data.removeDiscount;
|
|
1215
|
+
return data.cart.removeDiscount;
|
|
1216
1216
|
}
|
|
1217
1217
|
async function backendCheckout(config, ctx, customerEmail) {
|
|
1218
1218
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1224,7 +1224,7 @@ async function backendCheckout(config, ctx, customerEmail) {
|
|
|
1224
1224
|
{ input: { workspaceId, customerEmail } },
|
|
1225
1225
|
"checkout"
|
|
1226
1226
|
);
|
|
1227
|
-
return data.checkout;
|
|
1227
|
+
return data.cart.checkout;
|
|
1228
1228
|
}
|
|
1229
1229
|
async function backendProduct(config, ctx, modelSlug, filter) {
|
|
1230
1230
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1502,14 +1502,18 @@ var ORDER_FIELDS = `
|
|
|
1502
1502
|
payments { amount reference provider at }
|
|
1503
1503
|
`;
|
|
1504
1504
|
var MY_ORDERS = `query MyOrders($workspaceId: ID!, $skip: Int, $limit: Int) {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1505
|
+
account {
|
|
1506
|
+
orders(workspaceId: $workspaceId, skip: $skip, limit: $limit) {
|
|
1507
|
+
total
|
|
1508
|
+
hasMore
|
|
1509
|
+
items { ${ORDER_FIELDS} }
|
|
1510
|
+
}
|
|
1509
1511
|
}
|
|
1510
1512
|
}`;
|
|
1511
1513
|
var MY_ORDER = `query MyOrder($workspaceId: ID!, $id: ID!) {
|
|
1512
|
-
|
|
1514
|
+
account {
|
|
1515
|
+
order(workspaceId: $workspaceId, id: $id) { ${ORDER_FIELDS} }
|
|
1516
|
+
}
|
|
1513
1517
|
}`;
|
|
1514
1518
|
var workspaceIdCache3 = /* @__PURE__ */ new Map();
|
|
1515
1519
|
function workspaceIdFor3(config) {
|
|
@@ -1538,7 +1542,7 @@ async function backendMyOrders(config, accessToken, options) {
|
|
|
1538
1542
|
{ headers: headers2(workspaceId, accessToken) },
|
|
1539
1543
|
"my orders"
|
|
1540
1544
|
);
|
|
1541
|
-
return data.
|
|
1545
|
+
return data.account.orders;
|
|
1542
1546
|
}
|
|
1543
1547
|
async function backendMyOrder(config, accessToken, id) {
|
|
1544
1548
|
const workspaceId = await workspaceIdFor3(config);
|
|
@@ -1549,7 +1553,7 @@ async function backendMyOrder(config, accessToken, id) {
|
|
|
1549
1553
|
{ headers: headers2(workspaceId, accessToken) },
|
|
1550
1554
|
"my order"
|
|
1551
1555
|
);
|
|
1552
|
-
return data.
|
|
1556
|
+
return data.account.order;
|
|
1553
1557
|
}
|
|
1554
1558
|
|
|
1555
1559
|
// src/create-orders-route.ts
|
package/dist/index.js
CHANGED
|
@@ -1087,15 +1087,15 @@ var CART_FIELDS = `
|
|
|
1087
1087
|
snapshot { name price currency imageUrl sku }
|
|
1088
1088
|
}
|
|
1089
1089
|
`;
|
|
1090
|
-
var CART_QUERY = `query Cart($workspaceId: ID!) { cart(workspaceId: $workspaceId) { ${CART_FIELDS} } }`;
|
|
1091
|
-
var ADD_TO_CART = `mutation AddToCart($input: AddToCartInput!) {
|
|
1092
|
-
var UPDATE_ITEM = `mutation UpdateCartItem($input: UpdateCartItemInput!) {
|
|
1093
|
-
var REMOVE_ITEM = `mutation RemoveCartItem($workspaceId: ID!, $itemId: ID!) {
|
|
1094
|
-
var CLEAR_CART = `mutation ClearCart($workspaceId: ID!) {
|
|
1095
|
-
var APPLY_DISCOUNT = `mutation ApplyDiscount($workspaceId: ID!, $code: String!) { applyDiscount(workspaceId: $workspaceId, code: $code) { ${CART_FIELDS} } }`;
|
|
1096
|
-
var REMOVE_DISCOUNT = `mutation RemoveDiscount($workspaceId: ID!) { removeDiscount(workspaceId: $workspaceId) { ${CART_FIELDS} } }`;
|
|
1090
|
+
var CART_QUERY = `query Cart($workspaceId: ID!) { cart { get(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1091
|
+
var ADD_TO_CART = `mutation AddToCart($input: AddToCartInput!) { cart { addItem(input: $input) { ${CART_FIELDS} } } }`;
|
|
1092
|
+
var UPDATE_ITEM = `mutation UpdateCartItem($input: UpdateCartItemInput!) { cart { updateItem(input: $input) { ${CART_FIELDS} } } }`;
|
|
1093
|
+
var REMOVE_ITEM = `mutation RemoveCartItem($workspaceId: ID!, $itemId: ID!) { cart { removeItem(workspaceId: $workspaceId, itemId: $itemId) { ${CART_FIELDS} } } }`;
|
|
1094
|
+
var CLEAR_CART = `mutation ClearCart($workspaceId: ID!) { cart { clear(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1095
|
+
var APPLY_DISCOUNT = `mutation ApplyDiscount($workspaceId: ID!, $code: String!) { cart { applyDiscount(workspaceId: $workspaceId, code: $code) { ${CART_FIELDS} } } }`;
|
|
1096
|
+
var REMOVE_DISCOUNT = `mutation RemoveDiscount($workspaceId: ID!) { cart { removeDiscount(workspaceId: $workspaceId) { ${CART_FIELDS} } } }`;
|
|
1097
1097
|
var CHECKOUT = `mutation Checkout($input: CheckoutInput!) {
|
|
1098
|
-
checkout(input: $input) { id status subtotal total currency customerEmail }
|
|
1098
|
+
cart { checkout(input: $input) { id status subtotal total currency customerEmail } }
|
|
1099
1099
|
}`;
|
|
1100
1100
|
var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter: JSON) {
|
|
1101
1101
|
publicModelRecords(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: 1) {
|
|
@@ -1139,7 +1139,7 @@ async function backendGetCart(config, ctx) {
|
|
|
1139
1139
|
{ workspaceId },
|
|
1140
1140
|
"cart query"
|
|
1141
1141
|
);
|
|
1142
|
-
return data.cart;
|
|
1142
|
+
return data.cart.get;
|
|
1143
1143
|
}
|
|
1144
1144
|
async function backendAddToCart(config, ctx, input) {
|
|
1145
1145
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1151,7 +1151,7 @@ async function backendAddToCart(config, ctx, input) {
|
|
|
1151
1151
|
{ input: { workspaceId, ...input } },
|
|
1152
1152
|
"add to cart"
|
|
1153
1153
|
);
|
|
1154
|
-
return data.
|
|
1154
|
+
return data.cart.addItem;
|
|
1155
1155
|
}
|
|
1156
1156
|
async function backendUpdateItem(config, ctx, input) {
|
|
1157
1157
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1163,7 +1163,7 @@ async function backendUpdateItem(config, ctx, input) {
|
|
|
1163
1163
|
{ input: { workspaceId, ...input } },
|
|
1164
1164
|
"update cart item"
|
|
1165
1165
|
);
|
|
1166
|
-
return data.
|
|
1166
|
+
return data.cart.updateItem;
|
|
1167
1167
|
}
|
|
1168
1168
|
async function backendRemoveItem(config, ctx, itemId) {
|
|
1169
1169
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1175,7 +1175,7 @@ async function backendRemoveItem(config, ctx, itemId) {
|
|
|
1175
1175
|
{ workspaceId, itemId },
|
|
1176
1176
|
"remove cart item"
|
|
1177
1177
|
);
|
|
1178
|
-
return data.
|
|
1178
|
+
return data.cart.removeItem;
|
|
1179
1179
|
}
|
|
1180
1180
|
async function backendClearCart(config, ctx) {
|
|
1181
1181
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1187,7 +1187,7 @@ async function backendClearCart(config, ctx) {
|
|
|
1187
1187
|
{ workspaceId },
|
|
1188
1188
|
"clear cart"
|
|
1189
1189
|
);
|
|
1190
|
-
return data.
|
|
1190
|
+
return data.cart.clear;
|
|
1191
1191
|
}
|
|
1192
1192
|
async function backendApplyDiscount(config, ctx, code) {
|
|
1193
1193
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1199,7 +1199,7 @@ async function backendApplyDiscount(config, ctx, code) {
|
|
|
1199
1199
|
{ workspaceId, code },
|
|
1200
1200
|
"apply discount"
|
|
1201
1201
|
);
|
|
1202
|
-
return data.applyDiscount;
|
|
1202
|
+
return data.cart.applyDiscount;
|
|
1203
1203
|
}
|
|
1204
1204
|
async function backendRemoveDiscount(config, ctx) {
|
|
1205
1205
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1211,7 +1211,7 @@ async function backendRemoveDiscount(config, ctx) {
|
|
|
1211
1211
|
{ workspaceId },
|
|
1212
1212
|
"remove discount"
|
|
1213
1213
|
);
|
|
1214
|
-
return data.removeDiscount;
|
|
1214
|
+
return data.cart.removeDiscount;
|
|
1215
1215
|
}
|
|
1216
1216
|
async function backendCheckout(config, ctx, customerEmail) {
|
|
1217
1217
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1223,7 +1223,7 @@ async function backendCheckout(config, ctx, customerEmail) {
|
|
|
1223
1223
|
{ input: { workspaceId, customerEmail } },
|
|
1224
1224
|
"checkout"
|
|
1225
1225
|
);
|
|
1226
|
-
return data.checkout;
|
|
1226
|
+
return data.cart.checkout;
|
|
1227
1227
|
}
|
|
1228
1228
|
async function backendProduct(config, ctx, modelSlug, filter) {
|
|
1229
1229
|
const workspaceId = await workspaceIdFor2(config);
|
|
@@ -1501,14 +1501,18 @@ var ORDER_FIELDS = `
|
|
|
1501
1501
|
payments { amount reference provider at }
|
|
1502
1502
|
`;
|
|
1503
1503
|
var MY_ORDERS = `query MyOrders($workspaceId: ID!, $skip: Int, $limit: Int) {
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1504
|
+
account {
|
|
1505
|
+
orders(workspaceId: $workspaceId, skip: $skip, limit: $limit) {
|
|
1506
|
+
total
|
|
1507
|
+
hasMore
|
|
1508
|
+
items { ${ORDER_FIELDS} }
|
|
1509
|
+
}
|
|
1508
1510
|
}
|
|
1509
1511
|
}`;
|
|
1510
1512
|
var MY_ORDER = `query MyOrder($workspaceId: ID!, $id: ID!) {
|
|
1511
|
-
|
|
1513
|
+
account {
|
|
1514
|
+
order(workspaceId: $workspaceId, id: $id) { ${ORDER_FIELDS} }
|
|
1515
|
+
}
|
|
1512
1516
|
}`;
|
|
1513
1517
|
var workspaceIdCache3 = /* @__PURE__ */ new Map();
|
|
1514
1518
|
function workspaceIdFor3(config) {
|
|
@@ -1537,7 +1541,7 @@ async function backendMyOrders(config, accessToken, options) {
|
|
|
1537
1541
|
{ headers: headers2(workspaceId, accessToken) },
|
|
1538
1542
|
"my orders"
|
|
1539
1543
|
);
|
|
1540
|
-
return data.
|
|
1544
|
+
return data.account.orders;
|
|
1541
1545
|
}
|
|
1542
1546
|
async function backendMyOrder(config, accessToken, id) {
|
|
1543
1547
|
const workspaceId = await workspaceIdFor3(config);
|
|
@@ -1548,7 +1552,7 @@ async function backendMyOrder(config, accessToken, id) {
|
|
|
1548
1552
|
{ headers: headers2(workspaceId, accessToken) },
|
|
1549
1553
|
"my order"
|
|
1550
1554
|
);
|
|
1551
|
-
return data.
|
|
1555
|
+
return data.account.order;
|
|
1552
1556
|
}
|
|
1553
1557
|
|
|
1554
1558
|
// src/create-orders-route.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cmssy/react": "^0.
|
|
44
|
+
"@cmssy/react": "^0.11.0",
|
|
45
45
|
"next": ">=15",
|
|
46
46
|
"react": "^18.2.0 || ^19.0.0",
|
|
47
47
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tsup": "^8.3.0",
|
|
56
56
|
"typescript": "^5.6.0",
|
|
57
57
|
"vitest": "^2.1.0",
|
|
58
|
-
"@cmssy/react": "0.
|
|
58
|
+
"@cmssy/react": "0.11.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"jose": "^6.2.3"
|