@cmssy/core 19.15.0 → 19.16.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-MPHJMucu.d.cts → content-client-EAeHiBv2.d.cts} +6 -2
- package/dist/{content-client-MPHJMucu.d.ts → content-client-EAeHiBv2.d.ts} +6 -2
- package/dist/{csp-DKvpTbqW.d.ts → csp-CYbG4uan.d.cts} +8 -3
- package/dist/{csp-B7EAjPSy.d.cts → csp-DE59VC7Q.d.ts} +8 -3
- package/dist/index.cjs +295 -12
- package/dist/index.d.cts +100 -9
- package/dist/index.d.ts +100 -9
- package/dist/index.js +287 -13
- package/dist/internal/locale.cjs +21 -8
- package/dist/internal/locale.d.cts +2 -2
- package/dist/internal/locale.d.ts +2 -2
- package/dist/internal/locale.js +21 -8
- package/dist/internal.cjs +28 -10
- package/dist/internal.d.cts +7 -6
- package/dist/internal.d.ts +7 -6
- package/dist/internal.js +28 -10
- package/dist/{locale-DfW5CAIM.d.cts → locale-CUk6dYTo.d.cts} +2 -2
- package/dist/{locale-B3M-PFm4.d.ts → locale-Ds2uJX5V.d.ts} +2 -2
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.d.cts +2 -2
- package/dist/preflight.d.ts +2 -2
- package/dist/preflight.js +1 -1
- package/package.json +2 -2
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.16.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -451,13 +451,26 @@ function resolvePublicUrl(config) {
|
|
|
451
451
|
// src/data/graphql-request.ts
|
|
452
452
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
453
453
|
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
454
|
+
const text = documentText(query);
|
|
455
|
+
return postGraphql(
|
|
456
|
+
url,
|
|
457
|
+
text,
|
|
458
|
+
withConfigChannel(config, text, variables),
|
|
459
|
+
{
|
|
460
|
+
fetch: options.fetch,
|
|
461
|
+
signal: options.signal,
|
|
462
|
+
headers: options.headers,
|
|
463
|
+
retry: options.retry,
|
|
464
|
+
label
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
function withConfigChannel(config, document2, variables) {
|
|
469
|
+
const channel = config.channel?.trim();
|
|
470
|
+
if (!channel || !/\$channel\b/.test(document2)) return variables;
|
|
471
|
+
const current = variables ?? {};
|
|
472
|
+
if (current.channel !== void 0) return variables;
|
|
473
|
+
return { ...current, channel };
|
|
461
474
|
}
|
|
462
475
|
var SITE_CONFIG_QUERY = typedOperation(`query PublicSiteConfig($workspaceSlug: String!) {
|
|
463
476
|
public {
|
|
@@ -573,9 +586,14 @@ function createCmssyClient(input) {
|
|
|
573
586
|
// src/data/buyer-prices.ts
|
|
574
587
|
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
575
588
|
var priceDisplayModeValues = ["gross", "net"];
|
|
576
|
-
var
|
|
589
|
+
var priceListSourceValues = ["MEMBER", "COMPANY", "CHANNEL"];
|
|
590
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
591
|
+
$workspaceId: ID!
|
|
592
|
+
$items: [PriceQueryItem!]!
|
|
593
|
+
$channel: String
|
|
594
|
+
) {
|
|
577
595
|
account {
|
|
578
|
-
prices(workspaceId: $workspaceId, items: $items) {
|
|
596
|
+
prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
|
|
579
597
|
recordId
|
|
580
598
|
variantKey
|
|
581
599
|
currency
|
|
@@ -584,6 +602,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
584
602
|
listed
|
|
585
603
|
basePrice
|
|
586
604
|
source
|
|
605
|
+
listSource
|
|
587
606
|
minQuantity
|
|
588
607
|
maxQuantity
|
|
589
608
|
increment
|
|
@@ -630,7 +649,8 @@ async function getBuyerPrices(config, items, options) {
|
|
|
630
649
|
workspaceId: options.workspaceId,
|
|
631
650
|
items: items.map(
|
|
632
651
|
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
633
|
-
)
|
|
652
|
+
),
|
|
653
|
+
...channelVariable(options.channel)
|
|
634
654
|
},
|
|
635
655
|
{
|
|
636
656
|
public: true,
|
|
@@ -659,6 +679,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
659
679
|
$sort: BuyerCatalogSort
|
|
660
680
|
$limit: Int
|
|
661
681
|
$offset: Int
|
|
682
|
+
$channel: String
|
|
662
683
|
) {
|
|
663
684
|
account {
|
|
664
685
|
catalogPrices(
|
|
@@ -674,6 +695,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
674
695
|
sort: $sort
|
|
675
696
|
limit: $limit
|
|
676
697
|
offset: $offset
|
|
698
|
+
channel: $channel
|
|
677
699
|
) {
|
|
678
700
|
total
|
|
679
701
|
hasMore
|
|
@@ -686,6 +708,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
686
708
|
listed
|
|
687
709
|
basePrice
|
|
688
710
|
source
|
|
711
|
+
listSource
|
|
689
712
|
minQuantity
|
|
690
713
|
maxQuantity
|
|
691
714
|
increment
|
|
@@ -719,7 +742,11 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
719
742
|
const data = await graphqlRequest(
|
|
720
743
|
config,
|
|
721
744
|
BUYER_CATALOG_PRICES_QUERY,
|
|
722
|
-
{
|
|
745
|
+
{
|
|
746
|
+
...query,
|
|
747
|
+
workspaceId: options.workspaceId,
|
|
748
|
+
...channelVariable(options.channel)
|
|
749
|
+
},
|
|
723
750
|
{
|
|
724
751
|
public: true,
|
|
725
752
|
fetch: options.fetch,
|
|
@@ -734,6 +761,229 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
734
761
|
);
|
|
735
762
|
return data.account.catalogPrices;
|
|
736
763
|
}
|
|
764
|
+
function channelVariable(channel) {
|
|
765
|
+
return channel === void 0 ? {} : { channel };
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// src/data/public-prices.ts
|
|
769
|
+
var CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
|
|
770
|
+
var priceWithheldReasonValues = [
|
|
771
|
+
"MEMBERS_ONLY",
|
|
772
|
+
"COMPANY_MEMBERS_ONLY"
|
|
773
|
+
];
|
|
774
|
+
var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
775
|
+
$workspaceId: String!
|
|
776
|
+
$channel: String!
|
|
777
|
+
$items: [PriceQueryItem!]!
|
|
778
|
+
$locale: String
|
|
779
|
+
) {
|
|
780
|
+
public {
|
|
781
|
+
pricing {
|
|
782
|
+
prices(
|
|
783
|
+
workspaceId: $workspaceId
|
|
784
|
+
channel: $channel
|
|
785
|
+
items: $items
|
|
786
|
+
locale: $locale
|
|
787
|
+
) {
|
|
788
|
+
displayMode
|
|
789
|
+
priceWithheld
|
|
790
|
+
nextChangeAt
|
|
791
|
+
items {
|
|
792
|
+
record {
|
|
793
|
+
id
|
|
794
|
+
modelId
|
|
795
|
+
data
|
|
796
|
+
status
|
|
797
|
+
available
|
|
798
|
+
quantityIncrement
|
|
799
|
+
variantCount
|
|
800
|
+
createdAt
|
|
801
|
+
updatedAt
|
|
802
|
+
}
|
|
803
|
+
price {
|
|
804
|
+
recordId
|
|
805
|
+
variantKey
|
|
806
|
+
currency
|
|
807
|
+
price
|
|
808
|
+
priceMax
|
|
809
|
+
listed
|
|
810
|
+
basePrice
|
|
811
|
+
source
|
|
812
|
+
listSource
|
|
813
|
+
minQuantity
|
|
814
|
+
maxQuantity
|
|
815
|
+
increment
|
|
816
|
+
tiers {
|
|
817
|
+
minQty
|
|
818
|
+
price
|
|
819
|
+
}
|
|
820
|
+
displayMode
|
|
821
|
+
taxRate
|
|
822
|
+
priceAmount {
|
|
823
|
+
net
|
|
824
|
+
tax
|
|
825
|
+
gross
|
|
826
|
+
}
|
|
827
|
+
priceMaxAmount {
|
|
828
|
+
net
|
|
829
|
+
tax
|
|
830
|
+
gross
|
|
831
|
+
}
|
|
832
|
+
basePriceAmount {
|
|
833
|
+
net
|
|
834
|
+
tax
|
|
835
|
+
gross
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}`);
|
|
843
|
+
var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
844
|
+
$workspaceId: String!
|
|
845
|
+
$channel: String!
|
|
846
|
+
$modelSlug: String!
|
|
847
|
+
$filter: JSON
|
|
848
|
+
$stockState: String
|
|
849
|
+
$sku: String
|
|
850
|
+
$locale: String
|
|
851
|
+
$currency: String
|
|
852
|
+
$priceMin: Int
|
|
853
|
+
$priceMax: Int
|
|
854
|
+
$sort: BuyerCatalogSort
|
|
855
|
+
$limit: Int
|
|
856
|
+
$offset: Int
|
|
857
|
+
) {
|
|
858
|
+
public {
|
|
859
|
+
pricing {
|
|
860
|
+
catalogPrices(
|
|
861
|
+
workspaceId: $workspaceId
|
|
862
|
+
channel: $channel
|
|
863
|
+
modelSlug: $modelSlug
|
|
864
|
+
filter: $filter
|
|
865
|
+
stockState: $stockState
|
|
866
|
+
sku: $sku
|
|
867
|
+
locale: $locale
|
|
868
|
+
currency: $currency
|
|
869
|
+
priceMin: $priceMin
|
|
870
|
+
priceMax: $priceMax
|
|
871
|
+
sort: $sort
|
|
872
|
+
limit: $limit
|
|
873
|
+
offset: $offset
|
|
874
|
+
) {
|
|
875
|
+
total
|
|
876
|
+
hasMore
|
|
877
|
+
displayMode
|
|
878
|
+
priceWithheld
|
|
879
|
+
nextChangeAt
|
|
880
|
+
items {
|
|
881
|
+
record {
|
|
882
|
+
id
|
|
883
|
+
modelId
|
|
884
|
+
data
|
|
885
|
+
status
|
|
886
|
+
available
|
|
887
|
+
quantityIncrement
|
|
888
|
+
variantCount
|
|
889
|
+
createdAt
|
|
890
|
+
updatedAt
|
|
891
|
+
}
|
|
892
|
+
price {
|
|
893
|
+
recordId
|
|
894
|
+
variantKey
|
|
895
|
+
currency
|
|
896
|
+
price
|
|
897
|
+
priceMax
|
|
898
|
+
listed
|
|
899
|
+
basePrice
|
|
900
|
+
source
|
|
901
|
+
listSource
|
|
902
|
+
minQuantity
|
|
903
|
+
maxQuantity
|
|
904
|
+
increment
|
|
905
|
+
tiers {
|
|
906
|
+
minQty
|
|
907
|
+
price
|
|
908
|
+
}
|
|
909
|
+
displayMode
|
|
910
|
+
taxRate
|
|
911
|
+
priceAmount {
|
|
912
|
+
net
|
|
913
|
+
tax
|
|
914
|
+
gross
|
|
915
|
+
}
|
|
916
|
+
priceMaxAmount {
|
|
917
|
+
net
|
|
918
|
+
tax
|
|
919
|
+
gross
|
|
920
|
+
}
|
|
921
|
+
basePriceAmount {
|
|
922
|
+
net
|
|
923
|
+
tax
|
|
924
|
+
gross
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}`);
|
|
932
|
+
function requireChannel(config, options, helper) {
|
|
933
|
+
const channel = (options.channel ?? config.channel)?.trim();
|
|
934
|
+
if (!channel) {
|
|
935
|
+
throw new Error(
|
|
936
|
+
`cmssy: ${helper} needs a sales channel - set channel in the client config or pass it in the options`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
return channel;
|
|
940
|
+
}
|
|
941
|
+
async function getPublicPrices(config, items, options) {
|
|
942
|
+
const channel = requireChannel(config, options, "getPublicPrices");
|
|
943
|
+
if (items.length > CMSSY_PUBLIC_PRICES_MAX_ITEMS) {
|
|
944
|
+
throw new Error(
|
|
945
|
+
`cmssy: getPublicPrices takes at most ${CMSSY_PUBLIC_PRICES_MAX_ITEMS} items, got ${items.length} - split the request`
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
const data = await graphqlRequest(
|
|
949
|
+
config,
|
|
950
|
+
PUBLIC_PRICES_QUERY,
|
|
951
|
+
{
|
|
952
|
+
workspaceId: options.workspaceId,
|
|
953
|
+
channel,
|
|
954
|
+
items: items.map(
|
|
955
|
+
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
956
|
+
),
|
|
957
|
+
...options.locale ? { locale: options.locale } : {}
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
public: true,
|
|
961
|
+
fetch: options.fetch,
|
|
962
|
+
signal: options.signal,
|
|
963
|
+
retry: options.retry,
|
|
964
|
+
headers: { "x-workspace-id": options.workspaceId }
|
|
965
|
+
},
|
|
966
|
+
"channel prices"
|
|
967
|
+
);
|
|
968
|
+
return data.public.pricing.prices;
|
|
969
|
+
}
|
|
970
|
+
async function getPublicCatalogPrices(config, query, options) {
|
|
971
|
+
const channel = requireChannel(config, options, "getPublicCatalogPrices");
|
|
972
|
+
const data = await graphqlRequest(
|
|
973
|
+
config,
|
|
974
|
+
PUBLIC_CATALOG_PRICES_QUERY,
|
|
975
|
+
{ ...query, workspaceId: options.workspaceId, channel },
|
|
976
|
+
{
|
|
977
|
+
public: true,
|
|
978
|
+
fetch: options.fetch,
|
|
979
|
+
signal: options.signal,
|
|
980
|
+
retry: options.retry,
|
|
981
|
+
headers: { "x-workspace-id": options.workspaceId }
|
|
982
|
+
},
|
|
983
|
+
"channel catalogue prices"
|
|
984
|
+
);
|
|
985
|
+
return data.public.pricing.catalogPrices;
|
|
986
|
+
}
|
|
737
987
|
|
|
738
988
|
// src/data/checkout-errors.ts
|
|
739
989
|
var quantityRuleReasonValues = [
|
|
@@ -784,6 +1034,30 @@ function quantityRuleViolation(error) {
|
|
|
784
1034
|
}
|
|
785
1035
|
return void 0;
|
|
786
1036
|
}
|
|
1037
|
+
var channelRefusalReasonValues = [
|
|
1038
|
+
"UNKNOWN_CHANNEL",
|
|
1039
|
+
...priceWithheldReasonValues
|
|
1040
|
+
];
|
|
1041
|
+
var WITHHELD_REASONS = new Set(
|
|
1042
|
+
priceWithheldReasonValues
|
|
1043
|
+
);
|
|
1044
|
+
function channelRefusal(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.channel !== "string") continue;
|
|
1049
|
+
if (typeof ext.reason === "string" && WITHHELD_REASONS.has(ext.reason)) {
|
|
1050
|
+
return {
|
|
1051
|
+
reason: ext.reason,
|
|
1052
|
+
channel: ext.channel
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
if (ext.code === "BAD_USER_INPUT" && ext.reason === void 0) {
|
|
1056
|
+
return { reason: "UNKNOWN_CHANNEL", channel: ext.channel };
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return void 0;
|
|
1060
|
+
}
|
|
787
1061
|
|
|
788
1062
|
// src/fields.ts
|
|
789
1063
|
function build(type, opts) {
|
|
@@ -1398,4 +1672,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1398
1672
|
return parsed;
|
|
1399
1673
|
}
|
|
1400
1674
|
|
|
1401
|
-
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_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, getBuyerCatalogPrices, getBuyerPrices, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, orderProgress, orderProgressValues, parseEditorMessage, postToEditor, priceDisplayModeValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
1675
|
+
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 };
|
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.16.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -368,13 +368,26 @@ function resolvePublicUrl(config) {
|
|
|
368
368
|
// src/data/graphql-request.ts
|
|
369
369
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
370
370
|
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
371
|
+
const text = documentText(query);
|
|
372
|
+
return postGraphql(
|
|
373
|
+
url,
|
|
374
|
+
text,
|
|
375
|
+
withConfigChannel(config, text, variables),
|
|
376
|
+
{
|
|
377
|
+
fetch: options.fetch,
|
|
378
|
+
signal: options.signal,
|
|
379
|
+
headers: options.headers,
|
|
380
|
+
retry: options.retry,
|
|
381
|
+
label
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
function withConfigChannel(config, document, variables) {
|
|
386
|
+
const channel = config.channel?.trim();
|
|
387
|
+
if (!channel || !/\$channel\b/.test(document)) return variables;
|
|
388
|
+
const current = variables ?? {};
|
|
389
|
+
if (current.channel !== void 0) return variables;
|
|
390
|
+
return { ...current, channel };
|
|
378
391
|
}
|
|
379
392
|
var SITE_CONFIG_QUERY = typedOperation(`query PublicSiteConfig($workspaceSlug: String!) {
|
|
380
393
|
public {
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-CUk6dYTo.cjs';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-EAeHiBv2.cjs';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-Ds2uJX5V.js';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-EAeHiBv2.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.16.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -366,13 +366,26 @@ function resolvePublicUrl(config) {
|
|
|
366
366
|
// src/data/graphql-request.ts
|
|
367
367
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
368
368
|
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
369
|
+
const text = documentText(query);
|
|
370
|
+
return postGraphql(
|
|
371
|
+
url,
|
|
372
|
+
text,
|
|
373
|
+
withConfigChannel(config, text, variables),
|
|
374
|
+
{
|
|
375
|
+
fetch: options.fetch,
|
|
376
|
+
signal: options.signal,
|
|
377
|
+
headers: options.headers,
|
|
378
|
+
retry: options.retry,
|
|
379
|
+
label
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
function withConfigChannel(config, document, variables) {
|
|
384
|
+
const channel = config.channel?.trim();
|
|
385
|
+
if (!channel || !/\$channel\b/.test(document)) return variables;
|
|
386
|
+
const current = variables ?? {};
|
|
387
|
+
if (current.channel !== void 0) return variables;
|
|
388
|
+
return { ...current, channel };
|
|
376
389
|
}
|
|
377
390
|
var SITE_CONFIG_QUERY = typedOperation(`query PublicSiteConfig($workspaceSlug: String!) {
|
|
378
391
|
public {
|
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.16.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -593,13 +593,26 @@ function asBucket(value) {
|
|
|
593
593
|
// src/data/graphql-request.ts
|
|
594
594
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
595
595
|
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
596
|
+
const text = documentText(query);
|
|
597
|
+
return postGraphql(
|
|
598
|
+
url,
|
|
599
|
+
text,
|
|
600
|
+
withConfigChannel(config, text, variables),
|
|
601
|
+
{
|
|
602
|
+
fetch: options.fetch,
|
|
603
|
+
signal: options.signal,
|
|
604
|
+
headers: options.headers,
|
|
605
|
+
retry: options.retry,
|
|
606
|
+
label
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
function withConfigChannel(config, document2, variables) {
|
|
611
|
+
const channel = config.channel?.trim();
|
|
612
|
+
if (!channel || !/\$channel\b/.test(document2)) return variables;
|
|
613
|
+
const current = variables ?? {};
|
|
614
|
+
if (current.channel !== void 0) return variables;
|
|
615
|
+
return { ...current, channel };
|
|
603
616
|
}
|
|
604
617
|
var SITE_CONFIG_QUERY = typedOperation(`query PublicSiteConfig($workspaceSlug: String!) {
|
|
605
618
|
public {
|
|
@@ -1336,9 +1349,13 @@ function cmssyCspHeaders(options) {
|
|
|
1336
1349
|
}
|
|
1337
1350
|
|
|
1338
1351
|
// src/data/buyer-prices.ts
|
|
1339
|
-
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
1352
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
1353
|
+
$workspaceId: ID!
|
|
1354
|
+
$items: [PriceQueryItem!]!
|
|
1355
|
+
$channel: String
|
|
1356
|
+
) {
|
|
1340
1357
|
account {
|
|
1341
|
-
prices(workspaceId: $workspaceId, items: $items) {
|
|
1358
|
+
prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
|
|
1342
1359
|
recordId
|
|
1343
1360
|
variantKey
|
|
1344
1361
|
currency
|
|
@@ -1347,6 +1364,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1347
1364
|
listed
|
|
1348
1365
|
basePrice
|
|
1349
1366
|
source
|
|
1367
|
+
listSource
|
|
1350
1368
|
minQuantity
|
|
1351
1369
|
maxQuantity
|
|
1352
1370
|
increment
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { C as CmssyClientConfig } from './content-client-EAeHiBv2.cjs';
|
|
2
|
+
export { f as fetchLayouts, a as fetchPage, b as fetchPageById, c as fetchPageMeta, d as fetchPages, r as resolveApiUrl } from './content-client-EAeHiBv2.cjs';
|
|
3
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-CUk6dYTo.cjs';
|
|
4
|
+
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-CUk6dYTo.cjs';
|
|
5
|
+
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
6
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
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';
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-CYbG4uan.cjs';
|
|
8
|
+
export { c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-CYbG4uan.cjs';
|
|
8
9
|
export { localizedPath } from './internal/locale.cjs';
|
|
9
10
|
|
|
10
11
|
interface SiteConfigVariables {
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { C as CmssyClientConfig } from './content-client-EAeHiBv2.js';
|
|
2
|
+
export { f as fetchLayouts, a as fetchPage, b as fetchPageById, c as fetchPageMeta, d as fetchPages, r as resolveApiUrl } from './content-client-EAeHiBv2.js';
|
|
3
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-Ds2uJX5V.js';
|
|
4
|
+
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-Ds2uJX5V.js';
|
|
5
|
+
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
6
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
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';
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-DE59VC7Q.js';
|
|
8
|
+
export { c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-DE59VC7Q.js';
|
|
8
9
|
export { localizedPath } from './internal/locale.js';
|
|
9
10
|
|
|
10
11
|
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.16.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -591,13 +591,26 @@ function asBucket(value) {
|
|
|
591
591
|
// src/data/graphql-request.ts
|
|
592
592
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
593
593
|
const url = options.public ? resolvePublicUrl(config) : resolveApiUrl(config.apiUrl);
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
594
|
+
const text = documentText(query);
|
|
595
|
+
return postGraphql(
|
|
596
|
+
url,
|
|
597
|
+
text,
|
|
598
|
+
withConfigChannel(config, text, variables),
|
|
599
|
+
{
|
|
600
|
+
fetch: options.fetch,
|
|
601
|
+
signal: options.signal,
|
|
602
|
+
headers: options.headers,
|
|
603
|
+
retry: options.retry,
|
|
604
|
+
label
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
function withConfigChannel(config, document2, variables) {
|
|
609
|
+
const channel = config.channel?.trim();
|
|
610
|
+
if (!channel || !/\$channel\b/.test(document2)) return variables;
|
|
611
|
+
const current = variables ?? {};
|
|
612
|
+
if (current.channel !== void 0) return variables;
|
|
613
|
+
return { ...current, channel };
|
|
601
614
|
}
|
|
602
615
|
var SITE_CONFIG_QUERY = typedOperation(`query PublicSiteConfig($workspaceSlug: String!) {
|
|
603
616
|
public {
|
|
@@ -1334,9 +1347,13 @@ function cmssyCspHeaders(options) {
|
|
|
1334
1347
|
}
|
|
1335
1348
|
|
|
1336
1349
|
// src/data/buyer-prices.ts
|
|
1337
|
-
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
1350
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
1351
|
+
$workspaceId: ID!
|
|
1352
|
+
$items: [PriceQueryItem!]!
|
|
1353
|
+
$channel: String
|
|
1354
|
+
) {
|
|
1338
1355
|
account {
|
|
1339
|
-
prices(workspaceId: $workspaceId, items: $items) {
|
|
1356
|
+
prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
|
|
1340
1357
|
recordId
|
|
1341
1358
|
variantKey
|
|
1342
1359
|
currency
|
|
@@ -1345,6 +1362,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1345
1362
|
listed
|
|
1346
1363
|
basePrice
|
|
1347
1364
|
source
|
|
1365
|
+
listSource
|
|
1348
1366
|
minQuantity
|
|
1349
1367
|
maxQuantity
|
|
1350
1368
|
increment
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
1
|
+
import { CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-EAeHiBv2.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
1
|
+
import { CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-EAeHiBv2.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|