@cmssy/core 19.5.0 → 19.7.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 +36 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +35 -2
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +1 -1
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -225,7 +225,7 @@ function documentText(document2) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// src/version.ts
|
|
228
|
-
var CMSSY_CORE_VERSION = "19.
|
|
228
|
+
var CMSSY_CORE_VERSION = "19.7.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -1084,6 +1084,39 @@ async function verifyCmssyEditToken(token, secret, options = {}) {
|
|
|
1084
1084
|
return timingSafeHexEqual(expected, provided);
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
|
+
// src/order-progress.ts
|
|
1088
|
+
var orderProgressValues = [
|
|
1089
|
+
"placed",
|
|
1090
|
+
"paid",
|
|
1091
|
+
"shipped",
|
|
1092
|
+
"out_for_delivery",
|
|
1093
|
+
"delivered",
|
|
1094
|
+
"refunded",
|
|
1095
|
+
"canceled"
|
|
1096
|
+
];
|
|
1097
|
+
var PAID = /* @__PURE__ */ new Set(["paid", "partially_refunded"]);
|
|
1098
|
+
var SHIPPED_FULFILLMENT = /* @__PURE__ */ new Set([
|
|
1099
|
+
"fulfilled",
|
|
1100
|
+
"partially_fulfilled"
|
|
1101
|
+
]);
|
|
1102
|
+
var SHIPPED_DELIVERY = /* @__PURE__ */ new Set([
|
|
1103
|
+
"in_transit",
|
|
1104
|
+
"partially_delivered"
|
|
1105
|
+
]);
|
|
1106
|
+
function orderProgress(order) {
|
|
1107
|
+
if (order.state === "canceled") return "canceled";
|
|
1108
|
+
if (order.paymentStatus === "refunded") return "refunded";
|
|
1109
|
+
if (order.deliveryStatus === "delivered") return "delivered";
|
|
1110
|
+
if ((order.shipments ?? []).some((s) => s.status === "out_for_delivery")) {
|
|
1111
|
+
return "out_for_delivery";
|
|
1112
|
+
}
|
|
1113
|
+
if (SHIPPED_FULFILLMENT.has(order.fulfillmentStatus) || SHIPPED_DELIVERY.has(order.deliveryStatus)) {
|
|
1114
|
+
return "shipped";
|
|
1115
|
+
}
|
|
1116
|
+
if (PAID.has(order.paymentStatus)) return "paid";
|
|
1117
|
+
return "placed";
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1087
1120
|
// src/verify-webhook.ts
|
|
1088
1121
|
var CmssyWebhookError = class extends Error {
|
|
1089
1122
|
constructor(message) {
|
|
@@ -1207,6 +1240,8 @@ exports.mediaUrl = mediaUrl;
|
|
|
1207
1240
|
exports.mediaUrls = mediaUrls;
|
|
1208
1241
|
exports.mintCmssyEditToken = mintCmssyEditToken;
|
|
1209
1242
|
exports.normalizeOrigin = normalizeOrigin;
|
|
1243
|
+
exports.orderProgress = orderProgress;
|
|
1244
|
+
exports.orderProgressValues = orderProgressValues;
|
|
1210
1245
|
exports.parseEditorMessage = parseEditorMessage;
|
|
1211
1246
|
exports.postToEditor = postToEditor;
|
|
1212
1247
|
exports.propsToSchema = propsToSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -155,9 +155,22 @@ interface VerifyCmssyEditTokenOptions {
|
|
|
155
155
|
}
|
|
156
156
|
declare function verifyCmssyEditToken(token: string | null | undefined, secret: string, options?: VerifyCmssyEditTokenOptions): Promise<boolean>;
|
|
157
157
|
|
|
158
|
+
declare const orderProgressValues: readonly ["placed", "paid", "shipped", "out_for_delivery", "delivered", "refunded", "canceled"];
|
|
159
|
+
type CmssyOrderProgress = (typeof orderProgressValues)[number];
|
|
160
|
+
interface CmssyOrderProgressInput {
|
|
161
|
+
state: string;
|
|
162
|
+
paymentStatus: string;
|
|
163
|
+
fulfillmentStatus: string;
|
|
164
|
+
deliveryStatus: string;
|
|
165
|
+
shipments?: ReadonlyArray<{
|
|
166
|
+
status: string;
|
|
167
|
+
}> | null;
|
|
168
|
+
}
|
|
169
|
+
declare function orderProgress(order: CmssyOrderProgressInput): CmssyOrderProgress;
|
|
170
|
+
|
|
158
171
|
declare class CmssyWebhookError extends Error {
|
|
159
172
|
constructor(message: string);
|
|
160
173
|
}
|
|
161
174
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
162
175
|
|
|
163
|
-
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
176
|
+
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, type CmssyOrderProgress, type CmssyOrderProgressInput, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -155,9 +155,22 @@ interface VerifyCmssyEditTokenOptions {
|
|
|
155
155
|
}
|
|
156
156
|
declare function verifyCmssyEditToken(token: string | null | undefined, secret: string, options?: VerifyCmssyEditTokenOptions): Promise<boolean>;
|
|
157
157
|
|
|
158
|
+
declare const orderProgressValues: readonly ["placed", "paid", "shipped", "out_for_delivery", "delivered", "refunded", "canceled"];
|
|
159
|
+
type CmssyOrderProgress = (typeof orderProgressValues)[number];
|
|
160
|
+
interface CmssyOrderProgressInput {
|
|
161
|
+
state: string;
|
|
162
|
+
paymentStatus: string;
|
|
163
|
+
fulfillmentStatus: string;
|
|
164
|
+
deliveryStatus: string;
|
|
165
|
+
shipments?: ReadonlyArray<{
|
|
166
|
+
status: string;
|
|
167
|
+
}> | null;
|
|
168
|
+
}
|
|
169
|
+
declare function orderProgress(order: CmssyOrderProgressInput): CmssyOrderProgress;
|
|
170
|
+
|
|
158
171
|
declare class CmssyWebhookError extends Error {
|
|
159
172
|
constructor(message: string);
|
|
160
173
|
}
|
|
161
174
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
162
175
|
|
|
163
|
-
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
176
|
+
export { type BlockManifest, type BlockManifestBlock, type BlockManifestSource, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, type CmssyOrderProgress, type CmssyOrderProgressInput, CmssyWebhookError, type ConditionalFormField, type MediaLike, type MintCmssyEditTokenOptions, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, fields, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.js
CHANGED
|
@@ -224,7 +224,7 @@ function documentText(document2) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/version.ts
|
|
227
|
-
var CMSSY_CORE_VERSION = "19.
|
|
227
|
+
var CMSSY_CORE_VERSION = "19.7.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -1083,6 +1083,39 @@ async function verifyCmssyEditToken(token, secret, options = {}) {
|
|
|
1083
1083
|
return timingSafeHexEqual(expected, provided);
|
|
1084
1084
|
}
|
|
1085
1085
|
|
|
1086
|
+
// src/order-progress.ts
|
|
1087
|
+
var orderProgressValues = [
|
|
1088
|
+
"placed",
|
|
1089
|
+
"paid",
|
|
1090
|
+
"shipped",
|
|
1091
|
+
"out_for_delivery",
|
|
1092
|
+
"delivered",
|
|
1093
|
+
"refunded",
|
|
1094
|
+
"canceled"
|
|
1095
|
+
];
|
|
1096
|
+
var PAID = /* @__PURE__ */ new Set(["paid", "partially_refunded"]);
|
|
1097
|
+
var SHIPPED_FULFILLMENT = /* @__PURE__ */ new Set([
|
|
1098
|
+
"fulfilled",
|
|
1099
|
+
"partially_fulfilled"
|
|
1100
|
+
]);
|
|
1101
|
+
var SHIPPED_DELIVERY = /* @__PURE__ */ new Set([
|
|
1102
|
+
"in_transit",
|
|
1103
|
+
"partially_delivered"
|
|
1104
|
+
]);
|
|
1105
|
+
function orderProgress(order) {
|
|
1106
|
+
if (order.state === "canceled") return "canceled";
|
|
1107
|
+
if (order.paymentStatus === "refunded") return "refunded";
|
|
1108
|
+
if (order.deliveryStatus === "delivered") return "delivered";
|
|
1109
|
+
if ((order.shipments ?? []).some((s) => s.status === "out_for_delivery")) {
|
|
1110
|
+
return "out_for_delivery";
|
|
1111
|
+
}
|
|
1112
|
+
if (SHIPPED_FULFILLMENT.has(order.fulfillmentStatus) || SHIPPED_DELIVERY.has(order.deliveryStatus)) {
|
|
1113
|
+
return "shipped";
|
|
1114
|
+
}
|
|
1115
|
+
if (PAID.has(order.paymentStatus)) return "paid";
|
|
1116
|
+
return "placed";
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1086
1119
|
// src/verify-webhook.ts
|
|
1087
1120
|
var CmssyWebhookError = class extends Error {
|
|
1088
1121
|
constructor(message) {
|
|
@@ -1148,4 +1181,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1148
1181
|
return parsed;
|
|
1149
1182
|
}
|
|
1150
1183
|
|
|
1151
|
-
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyGraphqlError, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
1184
|
+
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyGraphqlError, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, orderProgress, orderProgressValues, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/internal/locale.cjs
CHANGED
package/dist/internal/locale.js
CHANGED
package/dist/internal.cjs
CHANGED
package/dist/internal.js
CHANGED
package/dist/preflight.cjs
CHANGED
package/dist/preflight.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/core",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.7.0",
|
|
4
4
|
"description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"vitest": "^2.1.0"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@cmssy/types": "0.
|
|
90
|
+
"@cmssy/types": "0.61.0",
|
|
91
91
|
"jose": "^6.2.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|