@cmssy/core 19.22.0 → 19.24.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 CHANGED
@@ -225,7 +225,7 @@ function documentText(document2) {
225
225
  }
226
226
 
227
227
  // src/version.ts
228
- var CMSSY_CORE_VERSION = "19.22.0" ;
228
+ var CMSSY_CORE_VERSION = "19.24.0" ;
229
229
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
230
230
 
231
231
  // src/data/http.ts
@@ -590,9 +590,15 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
590
590
  $workspaceId: ID!
591
591
  $items: [PriceQueryItem!]!
592
592
  $channel: String
593
+ $previewSecret: String
593
594
  ) {
594
595
  account {
595
- prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
596
+ prices(
597
+ workspaceId: $workspaceId
598
+ items: $items
599
+ channel: $channel
600
+ previewSecret: $previewSecret
601
+ ) {
596
602
  recordId
597
603
  variantKey
598
604
  currency
@@ -650,7 +656,8 @@ async function getBuyerPrices(config, items, options) {
650
656
  items: items.map(
651
657
  ({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
652
658
  ),
653
- ...channelVariable(options.channel)
659
+ ...channelVariable(options.channel),
660
+ ...previewSecretVariable(options.previewSecret)
654
661
  },
655
662
  {
656
663
  public: true,
@@ -679,6 +686,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
679
686
  $limit: Int
680
687
  $offset: Int
681
688
  $channel: String
689
+ $previewSecret: String
682
690
  ) {
683
691
  account {
684
692
  catalogPrices(
@@ -693,6 +701,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
693
701
  sort: $sort
694
702
  limit: $limit
695
703
  offset: $offset
704
+ previewSecret: $previewSecret
696
705
  channel: $channel
697
706
  ) {
698
707
  total
@@ -753,7 +762,8 @@ async function getBuyerCatalogPrices(config, query, options) {
753
762
  {
754
763
  ...query,
755
764
  workspaceId: options.workspaceId,
756
- ...channelVariable(options.channel)
765
+ ...channelVariable(options.channel),
766
+ ...previewSecretVariable(options.previewSecret)
757
767
  },
758
768
  {
759
769
  public: true,
@@ -772,6 +782,9 @@ async function getBuyerCatalogPrices(config, query, options) {
772
782
  function channelVariable(channel) {
773
783
  return channel === void 0 ? {} : { channel };
774
784
  }
785
+ function previewSecretVariable(previewSecret) {
786
+ return previewSecret ? { previewSecret } : {};
787
+ }
775
788
 
776
789
  // src/data/public-prices.ts
777
790
  var CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
@@ -784,6 +797,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
784
797
  $channel: String!
785
798
  $items: [PriceQueryItem!]!
786
799
  $locale: String
800
+ $previewSecret: String
787
801
  ) {
788
802
  public {
789
803
  pricing {
@@ -792,6 +806,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
792
806
  channel: $channel
793
807
  items: $items
794
808
  locale: $locale
809
+ previewSecret: $previewSecret
795
810
  ) {
796
811
  currency
797
812
  displayMode
@@ -863,6 +878,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
863
878
  $sort: BuyerCatalogSort
864
879
  $limit: Int
865
880
  $offset: Int
881
+ $previewSecret: String
866
882
  ) {
867
883
  public {
868
884
  pricing {
@@ -879,6 +895,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
879
895
  sort: $sort
880
896
  limit: $limit
881
897
  offset: $offset
898
+ previewSecret: $previewSecret
882
899
  ) {
883
900
  total
884
901
  hasMore
@@ -964,7 +981,8 @@ async function getPublicPrices(config, items, options) {
964
981
  items: items.map(
965
982
  ({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
966
983
  ),
967
- ...options.locale ? { locale: options.locale } : {}
984
+ ...options.locale ? { locale: options.locale } : {},
985
+ ...options.previewSecret ? { previewSecret: options.previewSecret } : {}
968
986
  },
969
987
  {
970
988
  public: true,
@@ -982,7 +1000,12 @@ async function getPublicCatalogPrices(config, query, options) {
982
1000
  const data = await graphqlRequest(
983
1001
  config,
984
1002
  PUBLIC_CATALOG_PRICES_QUERY,
985
- { ...query, workspaceId: options.workspaceId, channel },
1003
+ {
1004
+ ...query,
1005
+ workspaceId: options.workspaceId,
1006
+ channel,
1007
+ ...options.previewSecret ? { previewSecret: options.previewSecret } : {}
1008
+ },
986
1009
  {
987
1010
  public: true,
988
1011
  fetch: options.fetch,
@@ -1019,6 +1042,17 @@ function checkoutErrorReason(error) {
1019
1042
  }
1020
1043
  return void 0;
1021
1044
  }
1045
+ function checkoutErrorItemId(error) {
1046
+ if (!(error instanceof CmssyGraphqlError)) return void 0;
1047
+ for (const entry of error.errors) {
1048
+ const ext = entry.extensions;
1049
+ if (!ext || typeof ext.reason !== "string" || !REASONS.has(ext.reason)) {
1050
+ continue;
1051
+ }
1052
+ return typeof ext.itemId === "string" ? ext.itemId : void 0;
1053
+ }
1054
+ return void 0;
1055
+ }
1022
1056
  function isCount(value) {
1023
1057
  return typeof value === "number" && Number.isInteger(value);
1024
1058
  }
@@ -1731,6 +1765,7 @@ exports.blocksToSchemas = blocksToSchemas;
1731
1765
  exports.buildBlockManifest = buildBlockManifest;
1732
1766
  exports.channelRefusal = channelRefusal;
1733
1767
  exports.channelRefusalReasonValues = channelRefusalReasonValues;
1768
+ exports.checkoutErrorItemId = checkoutErrorItemId;
1734
1769
  exports.checkoutErrorReason = checkoutErrorReason;
1735
1770
  exports.checkoutErrorReasonValues = checkoutErrorReasonValues;
1736
1771
  exports.createCmssyClient = createCmssyClient;
package/dist/index.d.cts CHANGED
@@ -62,6 +62,7 @@ interface BuyerPricesVariables {
62
62
  workspaceId: string;
63
63
  items: CmssyPriceQueryItem[];
64
64
  channel?: string | null;
65
+ previewSecret?: string | null;
65
66
  }
66
67
  interface BuyerPricesResult {
67
68
  account: {
@@ -73,6 +74,7 @@ interface GetBuyerPricesOptions {
73
74
  workspaceId: string;
74
75
  accessToken: string;
75
76
  channel?: string | null;
77
+ previewSecret?: string;
76
78
  fetch?: FetchLike;
77
79
  signal?: AbortSignal;
78
80
  retry?: RetryOption;
@@ -119,6 +121,7 @@ interface BuyerCatalogPricesVariables {
119
121
  limit?: number | null;
120
122
  offset?: number | null;
121
123
  channel?: string | null;
124
+ previewSecret?: string | null;
122
125
  }
123
126
  interface BuyerCatalogPricesResult {
124
127
  account: {
@@ -126,7 +129,7 @@ interface BuyerCatalogPricesResult {
126
129
  };
127
130
  }
128
131
  declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResult, BuyerCatalogPricesVariables>;
129
- type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel">;
132
+ type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
130
133
  declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
131
134
 
132
135
  declare const CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
@@ -163,6 +166,7 @@ interface PublicPricesVariables {
163
166
  channel: string;
164
167
  items: CmssyPriceQueryItem[];
165
168
  locale?: string | null;
169
+ previewSecret?: string | null;
166
170
  }
167
171
  interface PublicPricesResult {
168
172
  public: {
@@ -185,6 +189,7 @@ interface PublicCatalogPricesVariables {
185
189
  sort?: CmssyBuyerCatalogSort | null;
186
190
  limit?: number | null;
187
191
  offset?: number | null;
192
+ previewSecret?: string | null;
188
193
  }
189
194
  interface PublicCatalogPricesResult {
190
195
  public: {
@@ -198,12 +203,13 @@ interface GetPublicPricesOptions {
198
203
  workspaceId: string;
199
204
  channel?: string;
200
205
  locale?: string | null;
206
+ previewSecret?: string;
201
207
  fetch?: FetchLike;
202
208
  signal?: AbortSignal;
203
209
  retry?: RetryOption;
204
210
  }
205
211
  declare function getPublicPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetPublicPricesOptions): Promise<CmssyPublicPriceResult>;
206
- type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel">;
212
+ type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
207
213
  declare function getPublicCatalogPrices(config: CmssyClientConfig, query: GetPublicCatalogPricesQuery, options: Omit<GetPublicPricesOptions, "locale">): Promise<CmssyPublicCatalogPage>;
208
214
 
209
215
  declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
@@ -219,6 +225,7 @@ interface CmssyQuantityRuleViolation {
219
225
  itemId: string | null;
220
226
  }
221
227
  declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
228
+ declare function checkoutErrorItemId(error: unknown): string | undefined;
222
229
  declare function quantityRuleViolation(error: unknown): CmssyQuantityRuleViolation | undefined;
223
230
  declare const channelRefusalReasonValues: readonly ["UNKNOWN_CHANNEL", "MEMBERS_ONLY", "COMPANY_MEMBERS_ONLY"];
224
231
  type CmssyChannelRefusalReason = (typeof channelRefusalReasonValues)[number];
@@ -396,4 +403,4 @@ declare class CmssyWebhookError extends Error {
396
403
  }
397
404
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
398
405
 
399
- export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerCatalogPricesResult, type BuyerCatalogPricesVariables, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyChannelRefusal, type CmssyChannelRefusalReason, type CmssyCheckoutErrorReason, CmssyClientConfig, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceListSource, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyPriceWithheldReason, type CmssyPublicCatalogPage, type CmssyPublicPriceResult, type CmssyPublicPricedRecord, type CmssyPublicPricedRecordData, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxTreatment, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type GetPublicCatalogPricesQuery, type GetPublicPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, type PublicCatalogPricesResult, type PublicCatalogPricesVariables, type PublicPricesResult, type PublicPricesVariables, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
406
+ export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerCatalogPricesResult, type BuyerCatalogPricesVariables, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyChannelRefusal, type CmssyChannelRefusalReason, type CmssyCheckoutErrorReason, CmssyClientConfig, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceListSource, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyPriceWithheldReason, type CmssyPublicCatalogPage, type CmssyPublicPriceResult, type CmssyPublicPricedRecord, type CmssyPublicPricedRecordData, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxTreatment, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type GetPublicCatalogPricesQuery, type GetPublicPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, type PublicCatalogPricesResult, type PublicCatalogPricesVariables, type PublicPricesResult, type PublicPricesVariables, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorItemId, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,7 @@ interface BuyerPricesVariables {
62
62
  workspaceId: string;
63
63
  items: CmssyPriceQueryItem[];
64
64
  channel?: string | null;
65
+ previewSecret?: string | null;
65
66
  }
66
67
  interface BuyerPricesResult {
67
68
  account: {
@@ -73,6 +74,7 @@ interface GetBuyerPricesOptions {
73
74
  workspaceId: string;
74
75
  accessToken: string;
75
76
  channel?: string | null;
77
+ previewSecret?: string;
76
78
  fetch?: FetchLike;
77
79
  signal?: AbortSignal;
78
80
  retry?: RetryOption;
@@ -119,6 +121,7 @@ interface BuyerCatalogPricesVariables {
119
121
  limit?: number | null;
120
122
  offset?: number | null;
121
123
  channel?: string | null;
124
+ previewSecret?: string | null;
122
125
  }
123
126
  interface BuyerCatalogPricesResult {
124
127
  account: {
@@ -126,7 +129,7 @@ interface BuyerCatalogPricesResult {
126
129
  };
127
130
  }
128
131
  declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResult, BuyerCatalogPricesVariables>;
129
- type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel">;
132
+ type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
130
133
  declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
131
134
 
132
135
  declare const CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
@@ -163,6 +166,7 @@ interface PublicPricesVariables {
163
166
  channel: string;
164
167
  items: CmssyPriceQueryItem[];
165
168
  locale?: string | null;
169
+ previewSecret?: string | null;
166
170
  }
167
171
  interface PublicPricesResult {
168
172
  public: {
@@ -185,6 +189,7 @@ interface PublicCatalogPricesVariables {
185
189
  sort?: CmssyBuyerCatalogSort | null;
186
190
  limit?: number | null;
187
191
  offset?: number | null;
192
+ previewSecret?: string | null;
188
193
  }
189
194
  interface PublicCatalogPricesResult {
190
195
  public: {
@@ -198,12 +203,13 @@ interface GetPublicPricesOptions {
198
203
  workspaceId: string;
199
204
  channel?: string;
200
205
  locale?: string | null;
206
+ previewSecret?: string;
201
207
  fetch?: FetchLike;
202
208
  signal?: AbortSignal;
203
209
  retry?: RetryOption;
204
210
  }
205
211
  declare function getPublicPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetPublicPricesOptions): Promise<CmssyPublicPriceResult>;
206
- type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel">;
212
+ type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
207
213
  declare function getPublicCatalogPrices(config: CmssyClientConfig, query: GetPublicCatalogPricesQuery, options: Omit<GetPublicPricesOptions, "locale">): Promise<CmssyPublicCatalogPage>;
208
214
 
209
215
  declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
@@ -219,6 +225,7 @@ interface CmssyQuantityRuleViolation {
219
225
  itemId: string | null;
220
226
  }
221
227
  declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
228
+ declare function checkoutErrorItemId(error: unknown): string | undefined;
222
229
  declare function quantityRuleViolation(error: unknown): CmssyQuantityRuleViolation | undefined;
223
230
  declare const channelRefusalReasonValues: readonly ["UNKNOWN_CHANNEL", "MEMBERS_ONLY", "COMPANY_MEMBERS_ONLY"];
224
231
  type CmssyChannelRefusalReason = (typeof channelRefusalReasonValues)[number];
@@ -396,4 +403,4 @@ declare class CmssyWebhookError extends Error {
396
403
  }
397
404
  declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
398
405
 
399
- export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerCatalogPricesResult, type BuyerCatalogPricesVariables, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyChannelRefusal, type CmssyChannelRefusalReason, type CmssyCheckoutErrorReason, CmssyClientConfig, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceListSource, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyPriceWithheldReason, type CmssyPublicCatalogPage, type CmssyPublicPriceResult, type CmssyPublicPricedRecord, type CmssyPublicPricedRecordData, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxTreatment, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type GetPublicCatalogPricesQuery, type GetPublicPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, type PublicCatalogPricesResult, type PublicCatalogPricesVariables, type PublicPricesResult, type PublicPricesVariables, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
406
+ export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, type BlockManifest, type BlockManifestBlock, type BlockManifestSource, type BuyerCatalogPricesResult, type BuyerCatalogPricesVariables, type BuyerPricesResult, type BuyerPricesVariables, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, CMSSY_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyChannelRefusal, type CmssyChannelRefusalReason, type CmssyCheckoutErrorReason, CmssyClientConfig, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceListSource, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyPriceWithheldReason, type CmssyPublicCatalogPage, type CmssyPublicPriceResult, type CmssyPublicPricedRecord, type CmssyPublicPricedRecordData, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxTreatment, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type GetPublicCatalogPricesQuery, type GetPublicPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, type PublicCatalogPricesResult, type PublicCatalogPricesVariables, type PublicPricesResult, type PublicPricesVariables, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorItemId, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, 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.22.0" ;
227
+ var CMSSY_CORE_VERSION = "19.24.0" ;
228
228
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
229
229
 
230
230
  // src/data/http.ts
@@ -589,9 +589,15 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
589
589
  $workspaceId: ID!
590
590
  $items: [PriceQueryItem!]!
591
591
  $channel: String
592
+ $previewSecret: String
592
593
  ) {
593
594
  account {
594
- prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
595
+ prices(
596
+ workspaceId: $workspaceId
597
+ items: $items
598
+ channel: $channel
599
+ previewSecret: $previewSecret
600
+ ) {
595
601
  recordId
596
602
  variantKey
597
603
  currency
@@ -649,7 +655,8 @@ async function getBuyerPrices(config, items, options) {
649
655
  items: items.map(
650
656
  ({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
651
657
  ),
652
- ...channelVariable(options.channel)
658
+ ...channelVariable(options.channel),
659
+ ...previewSecretVariable(options.previewSecret)
653
660
  },
654
661
  {
655
662
  public: true,
@@ -678,6 +685,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
678
685
  $limit: Int
679
686
  $offset: Int
680
687
  $channel: String
688
+ $previewSecret: String
681
689
  ) {
682
690
  account {
683
691
  catalogPrices(
@@ -692,6 +700,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
692
700
  sort: $sort
693
701
  limit: $limit
694
702
  offset: $offset
703
+ previewSecret: $previewSecret
695
704
  channel: $channel
696
705
  ) {
697
706
  total
@@ -752,7 +761,8 @@ async function getBuyerCatalogPrices(config, query, options) {
752
761
  {
753
762
  ...query,
754
763
  workspaceId: options.workspaceId,
755
- ...channelVariable(options.channel)
764
+ ...channelVariable(options.channel),
765
+ ...previewSecretVariable(options.previewSecret)
756
766
  },
757
767
  {
758
768
  public: true,
@@ -771,6 +781,9 @@ async function getBuyerCatalogPrices(config, query, options) {
771
781
  function channelVariable(channel) {
772
782
  return channel === void 0 ? {} : { channel };
773
783
  }
784
+ function previewSecretVariable(previewSecret) {
785
+ return previewSecret ? { previewSecret } : {};
786
+ }
774
787
 
775
788
  // src/data/public-prices.ts
776
789
  var CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
@@ -783,6 +796,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
783
796
  $channel: String!
784
797
  $items: [PriceQueryItem!]!
785
798
  $locale: String
799
+ $previewSecret: String
786
800
  ) {
787
801
  public {
788
802
  pricing {
@@ -791,6 +805,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
791
805
  channel: $channel
792
806
  items: $items
793
807
  locale: $locale
808
+ previewSecret: $previewSecret
794
809
  ) {
795
810
  currency
796
811
  displayMode
@@ -862,6 +877,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
862
877
  $sort: BuyerCatalogSort
863
878
  $limit: Int
864
879
  $offset: Int
880
+ $previewSecret: String
865
881
  ) {
866
882
  public {
867
883
  pricing {
@@ -878,6 +894,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
878
894
  sort: $sort
879
895
  limit: $limit
880
896
  offset: $offset
897
+ previewSecret: $previewSecret
881
898
  ) {
882
899
  total
883
900
  hasMore
@@ -963,7 +980,8 @@ async function getPublicPrices(config, items, options) {
963
980
  items: items.map(
964
981
  ({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
965
982
  ),
966
- ...options.locale ? { locale: options.locale } : {}
983
+ ...options.locale ? { locale: options.locale } : {},
984
+ ...options.previewSecret ? { previewSecret: options.previewSecret } : {}
967
985
  },
968
986
  {
969
987
  public: true,
@@ -981,7 +999,12 @@ async function getPublicCatalogPrices(config, query, options) {
981
999
  const data = await graphqlRequest(
982
1000
  config,
983
1001
  PUBLIC_CATALOG_PRICES_QUERY,
984
- { ...query, workspaceId: options.workspaceId, channel },
1002
+ {
1003
+ ...query,
1004
+ workspaceId: options.workspaceId,
1005
+ channel,
1006
+ ...options.previewSecret ? { previewSecret: options.previewSecret } : {}
1007
+ },
985
1008
  {
986
1009
  public: true,
987
1010
  fetch: options.fetch,
@@ -1018,6 +1041,17 @@ function checkoutErrorReason(error) {
1018
1041
  }
1019
1042
  return void 0;
1020
1043
  }
1044
+ function checkoutErrorItemId(error) {
1045
+ if (!(error instanceof CmssyGraphqlError)) return void 0;
1046
+ for (const entry of error.errors) {
1047
+ const ext = entry.extensions;
1048
+ if (!ext || typeof ext.reason !== "string" || !REASONS.has(ext.reason)) {
1049
+ continue;
1050
+ }
1051
+ return typeof ext.itemId === "string" ? ext.itemId : void 0;
1052
+ }
1053
+ return void 0;
1054
+ }
1021
1055
  function isCount(value) {
1022
1056
  return typeof value === "number" && Number.isInteger(value);
1023
1057
  }
@@ -1680,4 +1714,4 @@ async function verifyCmssyWebhook(options) {
1680
1714
  return parsed;
1681
1715
  }
1682
1716
 
1683
- export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, 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, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorReason, checkoutErrorReasonValues, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, orderProgress, orderProgressValues, parseEditorMessage, postToEditor, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
1717
+ export { BUYER_CATALOG_PRICES_QUERY, BUYER_PRICES_QUERY, CMSSY_BUYER_PRICES_MAX_ITEMS, CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_PUBLIC_PRICES_MAX_ITEMS, 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, PUBLIC_CATALOG_PRICES_QUERY, PUBLIC_PRICES_QUERY, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, channelRefusal, channelRefusalReasonValues, checkoutErrorItemId, checkoutErrorReason, checkoutErrorReasonValues, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, getBuyerCatalogPrices, getBuyerPrices, getPublicCatalogPrices, getPublicPrices, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, orderProgress, orderProgressValues, parseEditorMessage, postToEditor, priceDisplayModeValues, priceListSourceValues, priceWithheldReasonValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
@@ -154,7 +154,7 @@ function documentText(document) {
154
154
  }
155
155
 
156
156
  // src/version.ts
157
- var CMSSY_CORE_VERSION = "19.22.0" ;
157
+ var CMSSY_CORE_VERSION = "19.24.0" ;
158
158
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
159
159
 
160
160
  // src/data/http.ts
@@ -152,7 +152,7 @@ function documentText(document) {
152
152
  }
153
153
 
154
154
  // src/version.ts
155
- var CMSSY_CORE_VERSION = "19.22.0" ;
155
+ var CMSSY_CORE_VERSION = "19.24.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/data/http.ts
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.22.0" ;
157
+ var CMSSY_CORE_VERSION = "19.24.0" ;
158
158
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
159
159
 
160
160
  // src/data/http.ts
@@ -640,10 +640,10 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
640
640
  }
641
641
  }
642
642
  }`);
643
- var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {
643
+ var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
644
644
  public {
645
645
  model {
646
- records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {
646
+ records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
647
647
  items { id modelId data status createdAt updatedAt }
648
648
  total
649
649
  hasMore
@@ -782,10 +782,10 @@ function createCmssyClient(input) {
782
782
  }
783
783
 
784
784
  // src/data/block-content.ts
785
- var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {
785
+ var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String, $previewSecret: String) {
786
786
  public {
787
787
  model {
788
- recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {
788
+ recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale, previewSecret: $previewSecret) {
789
789
  id modelId data status createdAt updatedAt
790
790
  }
791
791
  }
@@ -925,7 +925,7 @@ function collectionKey(ref) {
925
925
  "\0"
926
926
  );
927
927
  }
928
- async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}) {
928
+ async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}, previewSecret) {
929
929
  const refs = collectRefs(entries, schemas);
930
930
  if (refs.length === 0) return;
931
931
  const client = createCmssyClient(config);
@@ -949,8 +949,20 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
949
949
  let collectionItems;
950
950
  try {
951
951
  [recordsById, collectionItems] = await Promise.all([
952
- fetchPickedRecords(client, [...pickedIds], locale, requestOptions),
953
- fetchCollections(client, collections, locale, requestOptions)
952
+ fetchPickedRecords(
953
+ client,
954
+ [...pickedIds],
955
+ locale,
956
+ requestOptions,
957
+ previewSecret
958
+ ),
959
+ fetchCollections(
960
+ client,
961
+ collections,
962
+ locale,
963
+ requestOptions,
964
+ previewSecret
965
+ )
954
966
  ]);
955
967
  } catch (err) {
956
968
  if (typeof console !== "undefined") {
@@ -984,7 +996,7 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
984
996
  }
985
997
  }
986
998
  }
987
- async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
999
+ async function fetchPickedRecords(client, ids, locale, requestOptions = {}, previewSecret) {
988
1000
  const byId = /* @__PURE__ */ new Map();
989
1001
  const chunks = [];
990
1002
  for (let i = 0; i < ids.length; i += BY_IDS_CHUNK) {
@@ -994,7 +1006,11 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
994
1006
  chunks.map(async (chunk) => {
995
1007
  const result = await client.queryScoped(
996
1008
  RECORDS_BY_IDS_QUERY,
997
- { ids: chunk, locale: locale ?? null },
1009
+ {
1010
+ ids: chunk,
1011
+ locale: locale ?? null,
1012
+ previewSecret: previewSecret ?? null
1013
+ },
998
1014
  requestOptions
999
1015
  );
1000
1016
  for (const record of result.public.model.recordsByIds) {
@@ -1004,7 +1020,7 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
1004
1020
  );
1005
1021
  return byId;
1006
1022
  }
1007
- async function fetchCollections(client, collections, locale, requestOptions = {}) {
1023
+ async function fetchCollections(client, collections, locale, requestOptions = {}, previewSecret) {
1008
1024
  const byKey = /* @__PURE__ */ new Map();
1009
1025
  await Promise.all(
1010
1026
  [...collections.entries()].map(async ([key, { model, sort, limit }]) => {
@@ -1014,7 +1030,8 @@ async function fetchCollections(client, collections, locale, requestOptions = {}
1014
1030
  modelSlug: model,
1015
1031
  sort: sort ?? null,
1016
1032
  limit: limit ?? COLLECTION_DEFAULT_LIMIT,
1017
- locale: locale ?? null
1033
+ locale: locale ?? null,
1034
+ previewSecret: previewSecret ?? null
1018
1035
  },
1019
1036
  requestOptions
1020
1037
  );
@@ -1351,9 +1368,15 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
1351
1368
  $workspaceId: ID!
1352
1369
  $items: [PriceQueryItem!]!
1353
1370
  $channel: String
1371
+ $previewSecret: String
1354
1372
  ) {
1355
1373
  account {
1356
- prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
1374
+ prices(
1375
+ workspaceId: $workspaceId
1376
+ items: $items
1377
+ channel: $channel
1378
+ previewSecret: $previewSecret
1379
+ ) {
1357
1380
  recordId
1358
1381
  variantKey
1359
1382
  currency
@@ -37,6 +37,7 @@ interface ModelRecordsVariables {
37
37
  limit?: number | null;
38
38
  offset?: number | null;
39
39
  populate?: string[] | null;
40
+ previewSecret?: string | null;
40
41
  }
41
42
  interface ModelRecordsResult {
42
43
  public: {
@@ -91,7 +92,7 @@ type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
91
92
  * page.
92
93
  */
93
94
  declare function normalizeBlockContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
94
- declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
95
+ declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions, previewSecret?: string): Promise<void>;
95
96
 
96
97
  /**
97
98
  * Finds the forms a page needs by reading the blocks' schemas, so a form field
@@ -37,6 +37,7 @@ interface ModelRecordsVariables {
37
37
  limit?: number | null;
38
38
  offset?: number | null;
39
39
  populate?: string[] | null;
40
+ previewSecret?: string | null;
40
41
  }
41
42
  interface ModelRecordsResult {
42
43
  public: {
@@ -91,7 +92,7 @@ type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
91
92
  * page.
92
93
  */
93
94
  declare function normalizeBlockContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
94
- declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
95
+ declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions, previewSecret?: string): Promise<void>;
95
96
 
96
97
  /**
97
98
  * Finds the forms a page needs by reading the blocks' schemas, so a form field
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.22.0" ;
155
+ var CMSSY_CORE_VERSION = "19.24.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/data/http.ts
@@ -638,10 +638,10 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
638
638
  }
639
639
  }
640
640
  }`);
641
- var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {
641
+ var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
642
642
  public {
643
643
  model {
644
- records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {
644
+ records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
645
645
  items { id modelId data status createdAt updatedAt }
646
646
  total
647
647
  hasMore
@@ -780,10 +780,10 @@ function createCmssyClient(input) {
780
780
  }
781
781
 
782
782
  // src/data/block-content.ts
783
- var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {
783
+ var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String, $previewSecret: String) {
784
784
  public {
785
785
  model {
786
- recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {
786
+ recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale, previewSecret: $previewSecret) {
787
787
  id modelId data status createdAt updatedAt
788
788
  }
789
789
  }
@@ -923,7 +923,7 @@ function collectionKey(ref) {
923
923
  "\0"
924
924
  );
925
925
  }
926
- async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}) {
926
+ async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}, previewSecret) {
927
927
  const refs = collectRefs(entries, schemas);
928
928
  if (refs.length === 0) return;
929
929
  const client = createCmssyClient(config);
@@ -947,8 +947,20 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
947
947
  let collectionItems;
948
948
  try {
949
949
  [recordsById, collectionItems] = await Promise.all([
950
- fetchPickedRecords(client, [...pickedIds], locale, requestOptions),
951
- fetchCollections(client, collections, locale, requestOptions)
950
+ fetchPickedRecords(
951
+ client,
952
+ [...pickedIds],
953
+ locale,
954
+ requestOptions,
955
+ previewSecret
956
+ ),
957
+ fetchCollections(
958
+ client,
959
+ collections,
960
+ locale,
961
+ requestOptions,
962
+ previewSecret
963
+ )
952
964
  ]);
953
965
  } catch (err) {
954
966
  if (typeof console !== "undefined") {
@@ -982,7 +994,7 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
982
994
  }
983
995
  }
984
996
  }
985
- async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
997
+ async function fetchPickedRecords(client, ids, locale, requestOptions = {}, previewSecret) {
986
998
  const byId = /* @__PURE__ */ new Map();
987
999
  const chunks = [];
988
1000
  for (let i = 0; i < ids.length; i += BY_IDS_CHUNK) {
@@ -992,7 +1004,11 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
992
1004
  chunks.map(async (chunk) => {
993
1005
  const result = await client.queryScoped(
994
1006
  RECORDS_BY_IDS_QUERY,
995
- { ids: chunk, locale: locale ?? null },
1007
+ {
1008
+ ids: chunk,
1009
+ locale: locale ?? null,
1010
+ previewSecret: previewSecret ?? null
1011
+ },
996
1012
  requestOptions
997
1013
  );
998
1014
  for (const record of result.public.model.recordsByIds) {
@@ -1002,7 +1018,7 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
1002
1018
  );
1003
1019
  return byId;
1004
1020
  }
1005
- async function fetchCollections(client, collections, locale, requestOptions = {}) {
1021
+ async function fetchCollections(client, collections, locale, requestOptions = {}, previewSecret) {
1006
1022
  const byKey = /* @__PURE__ */ new Map();
1007
1023
  await Promise.all(
1008
1024
  [...collections.entries()].map(async ([key, { model, sort, limit }]) => {
@@ -1012,7 +1028,8 @@ async function fetchCollections(client, collections, locale, requestOptions = {}
1012
1028
  modelSlug: model,
1013
1029
  sort: sort ?? null,
1014
1030
  limit: limit ?? COLLECTION_DEFAULT_LIMIT,
1015
- locale: locale ?? null
1031
+ locale: locale ?? null,
1032
+ previewSecret: previewSecret ?? null
1016
1033
  },
1017
1034
  requestOptions
1018
1035
  );
@@ -1349,9 +1366,15 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
1349
1366
  $workspaceId: ID!
1350
1367
  $items: [PriceQueryItem!]!
1351
1368
  $channel: String
1369
+ $previewSecret: String
1352
1370
  ) {
1353
1371
  account {
1354
- prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
1372
+ prices(
1373
+ workspaceId: $workspaceId
1374
+ items: $items
1375
+ channel: $channel
1376
+ previewSecret: $previewSecret
1377
+ ) {
1355
1378
  recordId
1356
1379
  variantKey
1357
1380
  currency
@@ -152,7 +152,7 @@ function documentText(document) {
152
152
  }
153
153
 
154
154
  // src/version.ts
155
- var CMSSY_CORE_VERSION = "19.22.0" ;
155
+ var CMSSY_CORE_VERSION = "19.24.0" ;
156
156
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
157
157
 
158
158
  // src/content/content-client.ts
package/dist/preflight.js CHANGED
@@ -150,7 +150,7 @@ function documentText(document) {
150
150
  }
151
151
 
152
152
  // src/version.ts
153
- var CMSSY_CORE_VERSION = "19.22.0" ;
153
+ var CMSSY_CORE_VERSION = "19.24.0" ;
154
154
  var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
155
155
 
156
156
  // src/content/content-client.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "19.22.0",
3
+ "version": "19.24.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",