@cmssy/core 19.9.0 → 19.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/{content-client-BSNwo1SM.d.cts → content-client-MPHJMucu.d.cts} +4 -1
- package/dist/{content-client-BSNwo1SM.d.ts → content-client-MPHJMucu.d.ts} +4 -1
- package/dist/{csp-CkxY33mW.d.cts → csp-B7EAjPSy.d.cts} +2 -2
- package/dist/{csp-vR6v-WmE.d.ts → csp-DKvpTbqW.d.ts} +2 -2
- package/dist/index.cjs +79 -1
- package/dist/index.d.cts +51 -5
- package/dist/index.d.ts +51 -5
- package/dist/index.js +75 -2
- package/dist/internal/locale.cjs +3 -1
- package/dist/internal/locale.d.cts +2 -2
- package/dist/internal/locale.d.ts +2 -2
- package/dist/internal/locale.js +3 -1
- package/dist/internal.cjs +25 -1
- package/dist/internal.d.cts +5 -5
- package/dist/internal.d.ts +5 -5
- package/dist/internal.js +25 -1
- package/dist/{locale-By_6K3p0.d.ts → locale-B3M-PFm4.d.ts} +2 -2
- package/dist/{locale-D1ZCb7eA.d.cts → locale-DfW5CAIM.d.cts} +2 -2
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.d.cts +1 -1
- package/dist/preflight.d.ts +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +2 -2
|
@@ -26,11 +26,14 @@ interface CmssyGraphqlErrorEntry {
|
|
|
26
26
|
message?: string;
|
|
27
27
|
extensions?: {
|
|
28
28
|
code?: string;
|
|
29
|
+
reason?: string;
|
|
30
|
+
[key: string]: unknown;
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
declare class CmssyGraphqlError extends Error {
|
|
32
34
|
readonly errors: ReadonlyArray<CmssyGraphqlErrorEntry>;
|
|
33
35
|
readonly code: string | undefined;
|
|
36
|
+
readonly reason: string | undefined;
|
|
34
37
|
constructor(message: string, errors: ReadonlyArray<CmssyGraphqlErrorEntry>);
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -65,4 +68,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
|
|
|
65
68
|
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
|
|
66
69
|
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
67
70
|
|
|
68
|
-
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R,
|
|
71
|
+
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, fetchPage as a, fetchPageById as b, fetchPageMeta as c, fetchPages as d, CMSSY_RETRY_MODES as e, fetchLayouts as f, CmssyGraphqlError as g, type CmssyGraphqlErrorEntry as h, CmssyRequestError as i, type CmssyRetryMode as j, type FetchLikeResponse as k, type FetchPageOptions as l, type RetryPolicy as m, createRetryingFetch as n, isTransientRequestError as o, resolveApiUrl as r };
|
|
@@ -26,11 +26,14 @@ interface CmssyGraphqlErrorEntry {
|
|
|
26
26
|
message?: string;
|
|
27
27
|
extensions?: {
|
|
28
28
|
code?: string;
|
|
29
|
+
reason?: string;
|
|
30
|
+
[key: string]: unknown;
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
declare class CmssyGraphqlError extends Error {
|
|
32
34
|
readonly errors: ReadonlyArray<CmssyGraphqlErrorEntry>;
|
|
33
35
|
readonly code: string | undefined;
|
|
36
|
+
readonly reason: string | undefined;
|
|
34
37
|
constructor(message: string, errors: ReadonlyArray<CmssyGraphqlErrorEntry>);
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -65,4 +68,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
|
|
|
65
68
|
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
|
|
66
69
|
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
67
70
|
|
|
68
|
-
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R,
|
|
71
|
+
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, fetchPage as a, fetchPageById as b, fetchPageMeta as c, fetchPages as d, CMSSY_RETRY_MODES as e, fetchLayouts as f, CmssyGraphqlError as g, type CmssyGraphqlErrorEntry as h, CmssyRequestError as i, type CmssyRetryMode as j, type FetchLikeResponse as k, type FetchPageOptions as l, type RetryPolicy as m, createRetryingFetch as n, isTransientRequestError as o, resolveApiUrl as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-DfW5CAIM.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
|
@@ -192,4 +192,4 @@ declare function toCspOrigin(origin: string): string;
|
|
|
192
192
|
declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
|
|
193
193
|
declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
|
|
194
194
|
|
|
195
|
-
export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E,
|
|
195
|
+
export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, defineCmssyLayout as F, isProtocolCompatible as G, normalizeOrigin as H, type InvisibleBlock as I, parseEditorMessage as J, postToEditor as K, resolveEditorOrigin as L, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type VariablesParameter as V, type CmssyClient as a, type CmssyConfig as b, cmssyCspHeaders as c, type CmssyCspOptions as d, type CmssyEnvConfig as e, type CmssyLayout as f, type CmssyRegion as g, type CmssyRegionOf as h, isDevelopment as i, type CmssyRegionSettings as j, type CmssyRegionSettingsOf as k, layoutRegionIds as l, type InvisibleBlocksMessage as m, type ParentReadyMessage as n, type PatchMessage as o, type PostTarget as p, type ScopedVariables as q, resolveInitialTarget as r, type SelectMessage as s, toCspOrigin as t, type ShortcutAction as u, type ShortcutMessage as v, type ViewportMessage as w, applyCmssyCsp as x, createCmssyClient as y, defineCmssyConfig as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-B3M-PFm4.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
|
@@ -192,4 +192,4 @@ declare function toCspOrigin(origin: string): string;
|
|
|
192
192
|
declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
|
|
193
193
|
declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
|
|
194
194
|
|
|
195
|
-
export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E,
|
|
195
|
+
export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, defineCmssyLayout as F, isProtocolCompatible as G, normalizeOrigin as H, type InvisibleBlock as I, parseEditorMessage as J, postToEditor as K, resolveEditorOrigin as L, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type VariablesParameter as V, type CmssyClient as a, type CmssyConfig as b, cmssyCspHeaders as c, type CmssyCspOptions as d, type CmssyEnvConfig as e, type CmssyLayout as f, type CmssyRegion as g, type CmssyRegionOf as h, isDevelopment as i, type CmssyRegionSettings as j, type CmssyRegionSettingsOf as k, layoutRegionIds as l, type InvisibleBlocksMessage as m, type ParentReadyMessage as n, type PatchMessage as o, type PostTarget as p, type ScopedVariables as q, resolveInitialTarget as r, type SelectMessage as s, toCspOrigin as t, type ShortcutAction as u, type ShortcutMessage as v, type ViewportMessage as w, applyCmssyCsp as x, createCmssyClient as y, defineCmssyConfig as z };
|
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.11.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -367,11 +367,13 @@ function createRetryingFetch(retry, doFetch, label = "request") {
|
|
|
367
367
|
var CmssyGraphqlError = class extends Error {
|
|
368
368
|
errors;
|
|
369
369
|
code;
|
|
370
|
+
reason;
|
|
370
371
|
constructor(message, errors) {
|
|
371
372
|
super(message);
|
|
372
373
|
this.name = "CmssyGraphqlError";
|
|
373
374
|
this.errors = errors;
|
|
374
375
|
this.code = errors[0]?.extensions?.code;
|
|
376
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
375
377
|
}
|
|
376
378
|
};
|
|
377
379
|
async function postGraphql(url, query, variables, options) {
|
|
@@ -569,6 +571,77 @@ function createCmssyClient(input) {
|
|
|
569
571
|
return client;
|
|
570
572
|
}
|
|
571
573
|
|
|
574
|
+
// src/data/buyer-prices.ts
|
|
575
|
+
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
576
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
577
|
+
account {
|
|
578
|
+
prices(workspaceId: $workspaceId, items: $items) {
|
|
579
|
+
recordId
|
|
580
|
+
variantKey
|
|
581
|
+
currency
|
|
582
|
+
price
|
|
583
|
+
priceMax
|
|
584
|
+
listed
|
|
585
|
+
tiers {
|
|
586
|
+
minQty
|
|
587
|
+
price
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}`);
|
|
592
|
+
async function getBuyerPrices(config, items, options) {
|
|
593
|
+
if (items.length === 0) return [];
|
|
594
|
+
if (items.length > CMSSY_BUYER_PRICES_MAX_ITEMS) {
|
|
595
|
+
throw new Error(
|
|
596
|
+
`cmssy: getBuyerPrices takes at most ${CMSSY_BUYER_PRICES_MAX_ITEMS} items, got ${items.length} - split the request`
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
if (!options.accessToken) {
|
|
600
|
+
throw new Error(
|
|
601
|
+
"cmssy: getBuyerPrices needs the signed-in member's accessToken - an anonymous visitor reads the catalogue price"
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
const data = await graphqlRequest(
|
|
605
|
+
config,
|
|
606
|
+
BUYER_PRICES_QUERY,
|
|
607
|
+
{
|
|
608
|
+
workspaceId: options.workspaceId,
|
|
609
|
+
items: items.map(
|
|
610
|
+
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
611
|
+
)
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
public: true,
|
|
615
|
+
fetch: options.fetch,
|
|
616
|
+
signal: options.signal,
|
|
617
|
+
retry: options.retry,
|
|
618
|
+
headers: {
|
|
619
|
+
"x-workspace-id": options.workspaceId,
|
|
620
|
+
authorization: `Bearer ${options.accessToken}`
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
"buyer prices"
|
|
624
|
+
);
|
|
625
|
+
return data.account.prices;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// src/data/checkout-errors.ts
|
|
629
|
+
var checkoutErrorReasonValues = [
|
|
630
|
+
"CART_REPRICED",
|
|
631
|
+
"CART_CURRENCY_CHANGED"
|
|
632
|
+
];
|
|
633
|
+
var REASONS = new Set(checkoutErrorReasonValues);
|
|
634
|
+
function checkoutErrorReason(error) {
|
|
635
|
+
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
636
|
+
for (const entry of error.errors) {
|
|
637
|
+
const reason = entry.extensions?.reason;
|
|
638
|
+
if (typeof reason === "string" && REASONS.has(reason)) {
|
|
639
|
+
return reason;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return void 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
572
645
|
// src/fields.ts
|
|
573
646
|
function build(type, opts) {
|
|
574
647
|
return { type, label: opts.label ?? "", ...opts };
|
|
@@ -1202,6 +1275,8 @@ Object.defineProperty(exports, "mediaTypeValues", {
|
|
|
1202
1275
|
enumerable: true,
|
|
1203
1276
|
get: function () { return types.mediaTypeValues; }
|
|
1204
1277
|
});
|
|
1278
|
+
exports.BUYER_PRICES_QUERY = BUYER_PRICES_QUERY;
|
|
1279
|
+
exports.CMSSY_BUYER_PRICES_MAX_ITEMS = CMSSY_BUYER_PRICES_MAX_ITEMS;
|
|
1205
1280
|
exports.CMSSY_EDIT_HEADER = CMSSY_EDIT_HEADER;
|
|
1206
1281
|
exports.CMSSY_EDIT_QUERY_PARAM = CMSSY_EDIT_QUERY_PARAM;
|
|
1207
1282
|
exports.CMSSY_EDIT_TOKEN_HEADER = CMSSY_EDIT_TOKEN_HEADER;
|
|
@@ -1220,11 +1295,14 @@ exports.applyCmssyCsp = applyCmssyCsp;
|
|
|
1220
1295
|
exports.blocksToMeta = blocksToMeta;
|
|
1221
1296
|
exports.blocksToSchemas = blocksToSchemas;
|
|
1222
1297
|
exports.buildBlockManifest = buildBlockManifest;
|
|
1298
|
+
exports.checkoutErrorReason = checkoutErrorReason;
|
|
1299
|
+
exports.checkoutErrorReasonValues = checkoutErrorReasonValues;
|
|
1223
1300
|
exports.createCmssyClient = createCmssyClient;
|
|
1224
1301
|
exports.createRetryingFetch = createRetryingFetch;
|
|
1225
1302
|
exports.defineCmssyConfig = defineCmssyConfig;
|
|
1226
1303
|
exports.defineCmssyLayout = defineCmssyLayout;
|
|
1227
1304
|
exports.fields = fields;
|
|
1305
|
+
exports.getBuyerPrices = getBuyerPrices;
|
|
1228
1306
|
exports.graphqlRequest = graphqlRequest;
|
|
1229
1307
|
exports.isFormFieldRequired = isFormFieldRequired;
|
|
1230
1308
|
exports.isFormFieldVisible = isFormFieldVisible;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig,
|
|
2
|
-
|
|
3
|
-
export {
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, d as CmssyCspOptions, e as CmssyEnvConfig, f as CmssyLayout, g as CmssyRegion, h as CmssyRegionOf, j as CmssyRegionSettings, k as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, m as InvisibleBlocksMessage, P as PROTOCOL_VERSION, n as ParentReadyMessage, o as PatchMessage, p as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, q as ScopedVariables, s as SelectMessage, u as ShortcutAction, v as ShortcutMessage, V as VariablesParameter, w as ViewportMessage, x as applyCmssyCsp, y as createCmssyClient, z as defineCmssyConfig, F as defineCmssyLayout, G as isProtocolCompatible, H as normalizeOrigin, J as parseEditorMessage, K as postToEditor, L as resolveEditorOrigin } from './csp-B7EAjPSy.cjs';
|
|
2
|
+
import { a as CmssyOperation } from './locale-DfW5CAIM.cjs';
|
|
3
|
+
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-DfW5CAIM.cjs';
|
|
4
|
+
import { F as FetchLike, R as RetryOption } from './content-client-MPHJMucu.cjs';
|
|
5
|
+
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, e as CMSSY_RETRY_MODES, g as CmssyGraphqlError, h as CmssyGraphqlErrorEntry, i as CmssyRequestError, j as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, k as FetchLikeResponse, l as FetchPageOptions, m as RetryPolicy, n as createRetryingFetch, o as isTransientRequestError } from './content-client-MPHJMucu.cjs';
|
|
4
6
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
|
-
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
7
|
+
import { CmssyClientConfig, FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
8
|
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookAccountEvent, CmssyWebhookAccountRequest, CmssyWebhookEvent, CmssyWebhookOrder, CmssyWebhookReturn, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
9
|
|
|
10
|
+
declare const CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
11
|
+
interface CmssyPriceQueryItem {
|
|
12
|
+
recordId: string;
|
|
13
|
+
variantKey?: string | null;
|
|
14
|
+
}
|
|
15
|
+
interface CmssyPriceTier {
|
|
16
|
+
minQty: number;
|
|
17
|
+
price: number;
|
|
18
|
+
}
|
|
19
|
+
interface CmssyBuyerPrice {
|
|
20
|
+
recordId: string;
|
|
21
|
+
variantKey: string | null;
|
|
22
|
+
currency: string;
|
|
23
|
+
price: number;
|
|
24
|
+
priceMax: number | null;
|
|
25
|
+
listed: boolean;
|
|
26
|
+
tiers: CmssyPriceTier[];
|
|
27
|
+
}
|
|
28
|
+
interface CmssyMemberPriceList {
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
interface BuyerPricesVariables {
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
items: CmssyPriceQueryItem[];
|
|
34
|
+
}
|
|
35
|
+
interface BuyerPricesResult {
|
|
36
|
+
account: {
|
|
37
|
+
prices: CmssyBuyerPrice[];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
declare const BUYER_PRICES_QUERY: CmssyOperation<BuyerPricesResult, BuyerPricesVariables>;
|
|
41
|
+
interface GetBuyerPricesOptions {
|
|
42
|
+
workspaceId: string;
|
|
43
|
+
accessToken: string;
|
|
44
|
+
fetch?: FetchLike;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
retry?: RetryOption;
|
|
47
|
+
}
|
|
48
|
+
declare function getBuyerPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetBuyerPricesOptions): Promise<CmssyBuyerPrice[]>;
|
|
49
|
+
|
|
50
|
+
declare const checkoutErrorReasonValues: readonly ["CART_REPRICED", "CART_CURRENCY_CHANGED"];
|
|
51
|
+
type CmssyCheckoutErrorReason = (typeof checkoutErrorReasonValues)[number];
|
|
52
|
+
declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
|
|
53
|
+
|
|
8
54
|
/**
|
|
9
55
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
|
10
56
|
* so: a declared `defaultValue` seeds the editor and is not put in place at
|
|
@@ -173,4 +219,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
173
219
|
}
|
|
174
220
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
175
221
|
|
|
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 };
|
|
222
|
+
export { BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceQueryItem, type CmssyPriceTier, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig,
|
|
2
|
-
|
|
3
|
-
export {
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, d as CmssyCspOptions, e as CmssyEnvConfig, f as CmssyLayout, g as CmssyRegion, h as CmssyRegionOf, j as CmssyRegionSettings, k as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, m as InvisibleBlocksMessage, P as PROTOCOL_VERSION, n as ParentReadyMessage, o as PatchMessage, p as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, q as ScopedVariables, s as SelectMessage, u as ShortcutAction, v as ShortcutMessage, V as VariablesParameter, w as ViewportMessage, x as applyCmssyCsp, y as createCmssyClient, z as defineCmssyConfig, F as defineCmssyLayout, G as isProtocolCompatible, H as normalizeOrigin, J as parseEditorMessage, K as postToEditor, L as resolveEditorOrigin } from './csp-DKvpTbqW.js';
|
|
2
|
+
import { a as CmssyOperation } from './locale-B3M-PFm4.js';
|
|
3
|
+
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-B3M-PFm4.js';
|
|
4
|
+
import { F as FetchLike, R as RetryOption } from './content-client-MPHJMucu.js';
|
|
5
|
+
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, e as CMSSY_RETRY_MODES, g as CmssyGraphqlError, h as CmssyGraphqlErrorEntry, i as CmssyRequestError, j as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, k as FetchLikeResponse, l as FetchPageOptions, m as RetryPolicy, n as createRetryingFetch, o as isTransientRequestError } from './content-client-MPHJMucu.js';
|
|
4
6
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
|
-
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
7
|
+
import { CmssyClientConfig, FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
8
|
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookAccountEvent, CmssyWebhookAccountRequest, CmssyWebhookEvent, CmssyWebhookOrder, CmssyWebhookReturn, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
9
|
|
|
10
|
+
declare const CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
11
|
+
interface CmssyPriceQueryItem {
|
|
12
|
+
recordId: string;
|
|
13
|
+
variantKey?: string | null;
|
|
14
|
+
}
|
|
15
|
+
interface CmssyPriceTier {
|
|
16
|
+
minQty: number;
|
|
17
|
+
price: number;
|
|
18
|
+
}
|
|
19
|
+
interface CmssyBuyerPrice {
|
|
20
|
+
recordId: string;
|
|
21
|
+
variantKey: string | null;
|
|
22
|
+
currency: string;
|
|
23
|
+
price: number;
|
|
24
|
+
priceMax: number | null;
|
|
25
|
+
listed: boolean;
|
|
26
|
+
tiers: CmssyPriceTier[];
|
|
27
|
+
}
|
|
28
|
+
interface CmssyMemberPriceList {
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
interface BuyerPricesVariables {
|
|
32
|
+
workspaceId: string;
|
|
33
|
+
items: CmssyPriceQueryItem[];
|
|
34
|
+
}
|
|
35
|
+
interface BuyerPricesResult {
|
|
36
|
+
account: {
|
|
37
|
+
prices: CmssyBuyerPrice[];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
declare const BUYER_PRICES_QUERY: CmssyOperation<BuyerPricesResult, BuyerPricesVariables>;
|
|
41
|
+
interface GetBuyerPricesOptions {
|
|
42
|
+
workspaceId: string;
|
|
43
|
+
accessToken: string;
|
|
44
|
+
fetch?: FetchLike;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
retry?: RetryOption;
|
|
47
|
+
}
|
|
48
|
+
declare function getBuyerPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetBuyerPricesOptions): Promise<CmssyBuyerPrice[]>;
|
|
49
|
+
|
|
50
|
+
declare const checkoutErrorReasonValues: readonly ["CART_REPRICED", "CART_CURRENCY_CHANGED"];
|
|
51
|
+
type CmssyCheckoutErrorReason = (typeof checkoutErrorReasonValues)[number];
|
|
52
|
+
declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
|
|
53
|
+
|
|
8
54
|
/**
|
|
9
55
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
|
10
56
|
* so: a declared `defaultValue` seeds the editor and is not put in place at
|
|
@@ -173,4 +219,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
173
219
|
}
|
|
174
220
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
175
221
|
|
|
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 };
|
|
222
|
+
export { BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceQueryItem, type CmssyPriceTier, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerPrices, 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.11.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -366,11 +366,13 @@ function createRetryingFetch(retry, doFetch, label = "request") {
|
|
|
366
366
|
var CmssyGraphqlError = class extends Error {
|
|
367
367
|
errors;
|
|
368
368
|
code;
|
|
369
|
+
reason;
|
|
369
370
|
constructor(message, errors) {
|
|
370
371
|
super(message);
|
|
371
372
|
this.name = "CmssyGraphqlError";
|
|
372
373
|
this.errors = errors;
|
|
373
374
|
this.code = errors[0]?.extensions?.code;
|
|
375
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
374
376
|
}
|
|
375
377
|
};
|
|
376
378
|
async function postGraphql(url, query, variables, options) {
|
|
@@ -568,6 +570,77 @@ function createCmssyClient(input) {
|
|
|
568
570
|
return client;
|
|
569
571
|
}
|
|
570
572
|
|
|
573
|
+
// src/data/buyer-prices.ts
|
|
574
|
+
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
575
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
576
|
+
account {
|
|
577
|
+
prices(workspaceId: $workspaceId, items: $items) {
|
|
578
|
+
recordId
|
|
579
|
+
variantKey
|
|
580
|
+
currency
|
|
581
|
+
price
|
|
582
|
+
priceMax
|
|
583
|
+
listed
|
|
584
|
+
tiers {
|
|
585
|
+
minQty
|
|
586
|
+
price
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}`);
|
|
591
|
+
async function getBuyerPrices(config, items, options) {
|
|
592
|
+
if (items.length === 0) return [];
|
|
593
|
+
if (items.length > CMSSY_BUYER_PRICES_MAX_ITEMS) {
|
|
594
|
+
throw new Error(
|
|
595
|
+
`cmssy: getBuyerPrices takes at most ${CMSSY_BUYER_PRICES_MAX_ITEMS} items, got ${items.length} - split the request`
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
if (!options.accessToken) {
|
|
599
|
+
throw new Error(
|
|
600
|
+
"cmssy: getBuyerPrices needs the signed-in member's accessToken - an anonymous visitor reads the catalogue price"
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
const data = await graphqlRequest(
|
|
604
|
+
config,
|
|
605
|
+
BUYER_PRICES_QUERY,
|
|
606
|
+
{
|
|
607
|
+
workspaceId: options.workspaceId,
|
|
608
|
+
items: items.map(
|
|
609
|
+
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
610
|
+
)
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
public: true,
|
|
614
|
+
fetch: options.fetch,
|
|
615
|
+
signal: options.signal,
|
|
616
|
+
retry: options.retry,
|
|
617
|
+
headers: {
|
|
618
|
+
"x-workspace-id": options.workspaceId,
|
|
619
|
+
authorization: `Bearer ${options.accessToken}`
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
"buyer prices"
|
|
623
|
+
);
|
|
624
|
+
return data.account.prices;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// src/data/checkout-errors.ts
|
|
628
|
+
var checkoutErrorReasonValues = [
|
|
629
|
+
"CART_REPRICED",
|
|
630
|
+
"CART_CURRENCY_CHANGED"
|
|
631
|
+
];
|
|
632
|
+
var REASONS = new Set(checkoutErrorReasonValues);
|
|
633
|
+
function checkoutErrorReason(error) {
|
|
634
|
+
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
635
|
+
for (const entry of error.errors) {
|
|
636
|
+
const reason = entry.extensions?.reason;
|
|
637
|
+
if (typeof reason === "string" && REASONS.has(reason)) {
|
|
638
|
+
return reason;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return void 0;
|
|
642
|
+
}
|
|
643
|
+
|
|
571
644
|
// src/fields.ts
|
|
572
645
|
function build(type, opts) {
|
|
573
646
|
return { type, label: opts.label ?? "", ...opts };
|
|
@@ -1181,4 +1254,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1181
1254
|
return parsed;
|
|
1182
1255
|
}
|
|
1183
1256
|
|
|
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 };
|
|
1257
|
+
export { BUYER_PRICES_QUERY, CMSSY_BUYER_PRICES_MAX_ITEMS, 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, checkoutErrorReason, checkoutErrorReasonValues, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, getBuyerPrices, 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
|
@@ -154,7 +154,7 @@ function documentText(document) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.11.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -283,11 +283,13 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
283
283
|
var CmssyGraphqlError = class extends Error {
|
|
284
284
|
errors;
|
|
285
285
|
code;
|
|
286
|
+
reason;
|
|
286
287
|
constructor(message, errors) {
|
|
287
288
|
super(message);
|
|
288
289
|
this.name = "CmssyGraphqlError";
|
|
289
290
|
this.errors = errors;
|
|
290
291
|
this.code = errors[0]?.extensions?.code;
|
|
292
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
291
293
|
}
|
|
292
294
|
};
|
|
293
295
|
async function postGraphql(url, query, variables, options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-DfW5CAIM.cjs';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-MPHJMucu.cjs';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-B3M-PFm4.js';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-MPHJMucu.js';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
package/dist/internal/locale.js
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.11.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -281,11 +281,13 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
281
281
|
var CmssyGraphqlError = class extends Error {
|
|
282
282
|
errors;
|
|
283
283
|
code;
|
|
284
|
+
reason;
|
|
284
285
|
constructor(message, errors) {
|
|
285
286
|
super(message);
|
|
286
287
|
this.name = "CmssyGraphqlError";
|
|
287
288
|
this.errors = errors;
|
|
288
289
|
this.code = errors[0]?.extensions?.code;
|
|
290
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
289
291
|
}
|
|
290
292
|
};
|
|
291
293
|
async function postGraphql(url, query, variables, options) {
|
package/dist/internal.cjs
CHANGED
|
@@ -154,7 +154,7 @@ function documentText(document2) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.11.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -283,11 +283,13 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
283
283
|
var CmssyGraphqlError = class extends Error {
|
|
284
284
|
errors;
|
|
285
285
|
code;
|
|
286
|
+
reason;
|
|
286
287
|
constructor(message, errors) {
|
|
287
288
|
super(message);
|
|
288
289
|
this.name = "CmssyGraphqlError";
|
|
289
290
|
this.errors = errors;
|
|
290
291
|
this.code = errors[0]?.extensions?.code;
|
|
292
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
291
293
|
}
|
|
292
294
|
};
|
|
293
295
|
async function postGraphql(url, query, variables, options) {
|
|
@@ -1333,6 +1335,24 @@ function cmssyCspHeaders(options) {
|
|
|
1333
1335
|
};
|
|
1334
1336
|
}
|
|
1335
1337
|
|
|
1338
|
+
// src/data/buyer-prices.ts
|
|
1339
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
1340
|
+
account {
|
|
1341
|
+
prices(workspaceId: $workspaceId, items: $items) {
|
|
1342
|
+
recordId
|
|
1343
|
+
variantKey
|
|
1344
|
+
currency
|
|
1345
|
+
price
|
|
1346
|
+
priceMax
|
|
1347
|
+
listed
|
|
1348
|
+
tiers {
|
|
1349
|
+
minQty
|
|
1350
|
+
price
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}`);
|
|
1355
|
+
|
|
1336
1356
|
// src/data/delivery-operations.ts
|
|
1337
1357
|
var CMSSY_DELIVERY_OPERATIONS = [
|
|
1338
1358
|
{
|
|
@@ -1374,6 +1394,10 @@ var CMSSY_DELIVERY_OPERATIONS = [
|
|
|
1374
1394
|
{
|
|
1375
1395
|
purpose: "Submitting that form - rendering one without this is half a feature.",
|
|
1376
1396
|
document: SUBMIT_FORM_MUTATION
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
purpose: "The signed-in member's prices, read once after the anonymous catalogue rendered.",
|
|
1400
|
+
document: BUYER_PRICES_QUERY
|
|
1377
1401
|
}
|
|
1378
1402
|
];
|
|
1379
1403
|
function layoutRegionIds(layout) {
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { f as fetchLayouts, a as fetchPage, b as fetchPageById, c as fetchPageMeta, d as fetchPages, r as resolveApiUrl } from './content-client-MPHJMucu.cjs';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export {
|
|
4
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-DfW5CAIM.cjs';
|
|
5
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-DfW5CAIM.cjs';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-B7EAjPSy.cjs';
|
|
7
|
+
export { c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-B7EAjPSy.cjs';
|
|
8
8
|
export { localizedPath } from './internal/locale.cjs';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { f as fetchLayouts, a as fetchPage, b as fetchPageById, c as fetchPageMeta, d as fetchPages, r as resolveApiUrl } from './content-client-MPHJMucu.js';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export {
|
|
4
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-B3M-PFm4.js';
|
|
5
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-B3M-PFm4.js';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-DKvpTbqW.js';
|
|
7
|
+
export { c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-DKvpTbqW.js';
|
|
8
8
|
export { localizedPath } from './internal/locale.js';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.js
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document2) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.11.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -281,11 +281,13 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
281
281
|
var CmssyGraphqlError = class extends Error {
|
|
282
282
|
errors;
|
|
283
283
|
code;
|
|
284
|
+
reason;
|
|
284
285
|
constructor(message, errors) {
|
|
285
286
|
super(message);
|
|
286
287
|
this.name = "CmssyGraphqlError";
|
|
287
288
|
this.errors = errors;
|
|
288
289
|
this.code = errors[0]?.extensions?.code;
|
|
290
|
+
this.reason = errors[0]?.extensions?.reason;
|
|
289
291
|
}
|
|
290
292
|
};
|
|
291
293
|
async function postGraphql(url, query, variables, options) {
|
|
@@ -1331,6 +1333,24 @@ function cmssyCspHeaders(options) {
|
|
|
1331
1333
|
};
|
|
1332
1334
|
}
|
|
1333
1335
|
|
|
1336
|
+
// src/data/buyer-prices.ts
|
|
1337
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
1338
|
+
account {
|
|
1339
|
+
prices(workspaceId: $workspaceId, items: $items) {
|
|
1340
|
+
recordId
|
|
1341
|
+
variantKey
|
|
1342
|
+
currency
|
|
1343
|
+
price
|
|
1344
|
+
priceMax
|
|
1345
|
+
listed
|
|
1346
|
+
tiers {
|
|
1347
|
+
minQty
|
|
1348
|
+
price
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}`);
|
|
1353
|
+
|
|
1334
1354
|
// src/data/delivery-operations.ts
|
|
1335
1355
|
var CMSSY_DELIVERY_OPERATIONS = [
|
|
1336
1356
|
{
|
|
@@ -1372,6 +1392,10 @@ var CMSSY_DELIVERY_OPERATIONS = [
|
|
|
1372
1392
|
{
|
|
1373
1393
|
purpose: "Submitting that form - rendering one without this is half a feature.",
|
|
1374
1394
|
document: SUBMIT_FORM_MUTATION
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
purpose: "The signed-in member's prices, read once after the anonymous catalogue rendered.",
|
|
1398
|
+
document: BUYER_PRICES_QUERY
|
|
1375
1399
|
}
|
|
1376
1400
|
];
|
|
1377
1401
|
function layoutRegionIds(layout) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption } from './content-client-MPHJMucu.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
|
@@ -36,4 +36,4 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
|
|
|
36
36
|
}>;
|
|
37
37
|
declare function localeForPath(config: CmssyClientConfig, path: string | string[]): Promise<string>;
|
|
38
38
|
|
|
39
|
-
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G,
|
|
39
|
+
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G, type CmssyOperation as a, CMSSY_LOCALE_HEADER as b, localeForPathname as c, localizeHref as d, splitLocaleFromPath as e, type CmssyTypedDocument as f, graphqlRequest as g, resolveCmssyLocale as h, localeForPath as l, resolveSiteLocales as r, splitCmssyLocale as s, typedOperation as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption } from './content-client-MPHJMucu.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
|
@@ -36,4 +36,4 @@ declare function splitCmssyLocale(config: CmssyClientConfig, path: string[] | un
|
|
|
36
36
|
}>;
|
|
37
37
|
declare function localeForPath(config: CmssyClientConfig, path: string | string[]): Promise<string>;
|
|
38
38
|
|
|
39
|
-
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G,
|
|
39
|
+
export { type CmssyOperationInput as C, type GraphqlRequestOptions as G, type CmssyOperation as a, CMSSY_LOCALE_HEADER as b, localeForPathname as c, localizeHref as d, splitLocaleFromPath as e, type CmssyTypedDocument as f, graphqlRequest as g, resolveCmssyLocale as h, localeForPath as l, resolveSiteLocales as r, splitCmssyLocale as s, typedOperation as t };
|
package/dist/preflight.cjs
CHANGED
package/dist/preflight.d.cts
CHANGED
package/dist/preflight.d.ts
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.11.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.64.0",
|
|
91
91
|
"jose": "^6.2.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|