@cmssy/core 19.15.0 → 19.17.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 +312 -14
- package/dist/index.d.cts +113 -10
- package/dist/index.d.ts +113 -10
- package/dist/index.js +301 -16
- 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 +29 -12
- package/dist/internal.d.cts +7 -6
- package/dist/internal.d.ts +7 -6
- package/dist/internal.js +29 -12
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandingFieldNames, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
2
|
-
export { API_TOKEN_HEADER_NAME, CLIENT_IP_HEADER_NAME, MediaType, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
2
|
+
export { API_TOKEN_HEADER_NAME, CLIENT_IP_HEADER_NAME, MediaType, evaluateFieldConditionGroup, mediaTypeValues, taxTreatmentKindValues } from '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
5
5
|
var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
@@ -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.17.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 {
|
|
@@ -569,13 +582,16 @@ function createCmssyClient(input) {
|
|
|
569
582
|
};
|
|
570
583
|
return client;
|
|
571
584
|
}
|
|
572
|
-
|
|
573
|
-
// src/data/buyer-prices.ts
|
|
574
585
|
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
575
586
|
var priceDisplayModeValues = ["gross", "net"];
|
|
576
|
-
var
|
|
587
|
+
var priceListSourceValues = ["MEMBER", "COMPANY", "CHANNEL"];
|
|
588
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
589
|
+
$workspaceId: ID!
|
|
590
|
+
$items: [PriceQueryItem!]!
|
|
591
|
+
$channel: String
|
|
592
|
+
) {
|
|
577
593
|
account {
|
|
578
|
-
prices(workspaceId: $workspaceId, items: $items) {
|
|
594
|
+
prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
|
|
579
595
|
recordId
|
|
580
596
|
variantKey
|
|
581
597
|
currency
|
|
@@ -584,6 +600,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
584
600
|
listed
|
|
585
601
|
basePrice
|
|
586
602
|
source
|
|
603
|
+
listSource
|
|
587
604
|
minQuantity
|
|
588
605
|
maxQuantity
|
|
589
606
|
increment
|
|
@@ -593,6 +610,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
593
610
|
}
|
|
594
611
|
displayMode
|
|
595
612
|
taxRate
|
|
613
|
+
taxTreatmentKind
|
|
596
614
|
priceAmount {
|
|
597
615
|
net
|
|
598
616
|
tax
|
|
@@ -630,7 +648,8 @@ async function getBuyerPrices(config, items, options) {
|
|
|
630
648
|
workspaceId: options.workspaceId,
|
|
631
649
|
items: items.map(
|
|
632
650
|
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
633
|
-
)
|
|
651
|
+
),
|
|
652
|
+
...channelVariable(options.channel)
|
|
634
653
|
},
|
|
635
654
|
{
|
|
636
655
|
public: true,
|
|
@@ -659,6 +678,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
659
678
|
$sort: BuyerCatalogSort
|
|
660
679
|
$limit: Int
|
|
661
680
|
$offset: Int
|
|
681
|
+
$channel: String
|
|
662
682
|
) {
|
|
663
683
|
account {
|
|
664
684
|
catalogPrices(
|
|
@@ -674,10 +694,19 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
674
694
|
sort: $sort
|
|
675
695
|
limit: $limit
|
|
676
696
|
offset: $offset
|
|
697
|
+
channel: $channel
|
|
677
698
|
) {
|
|
678
699
|
total
|
|
679
700
|
hasMore
|
|
680
701
|
displayMode
|
|
702
|
+
taxTreatment {
|
|
703
|
+
kind
|
|
704
|
+
legalNote
|
|
705
|
+
buyerVatId
|
|
706
|
+
buyerVatCountry
|
|
707
|
+
sellerCountry
|
|
708
|
+
shipToCountry
|
|
709
|
+
}
|
|
681
710
|
items {
|
|
682
711
|
recordId
|
|
683
712
|
currency
|
|
@@ -686,11 +715,13 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
686
715
|
listed
|
|
687
716
|
basePrice
|
|
688
717
|
source
|
|
718
|
+
listSource
|
|
689
719
|
minQuantity
|
|
690
720
|
maxQuantity
|
|
691
721
|
increment
|
|
692
722
|
displayMode
|
|
693
723
|
taxRate
|
|
724
|
+
taxTreatmentKind
|
|
694
725
|
priceAmount {
|
|
695
726
|
net
|
|
696
727
|
tax
|
|
@@ -719,7 +750,11 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
719
750
|
const data = await graphqlRequest(
|
|
720
751
|
config,
|
|
721
752
|
BUYER_CATALOG_PRICES_QUERY,
|
|
722
|
-
{
|
|
753
|
+
{
|
|
754
|
+
...query,
|
|
755
|
+
workspaceId: options.workspaceId,
|
|
756
|
+
...channelVariable(options.channel)
|
|
757
|
+
},
|
|
723
758
|
{
|
|
724
759
|
public: true,
|
|
725
760
|
fetch: options.fetch,
|
|
@@ -734,6 +769,231 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
734
769
|
);
|
|
735
770
|
return data.account.catalogPrices;
|
|
736
771
|
}
|
|
772
|
+
function channelVariable(channel) {
|
|
773
|
+
return channel === void 0 ? {} : { channel };
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// src/data/public-prices.ts
|
|
777
|
+
var CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
|
|
778
|
+
var priceWithheldReasonValues = [
|
|
779
|
+
"MEMBERS_ONLY",
|
|
780
|
+
"COMPANY_MEMBERS_ONLY"
|
|
781
|
+
];
|
|
782
|
+
var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
783
|
+
$workspaceId: String!
|
|
784
|
+
$channel: String!
|
|
785
|
+
$items: [PriceQueryItem!]!
|
|
786
|
+
$locale: String
|
|
787
|
+
) {
|
|
788
|
+
public {
|
|
789
|
+
pricing {
|
|
790
|
+
prices(
|
|
791
|
+
workspaceId: $workspaceId
|
|
792
|
+
channel: $channel
|
|
793
|
+
items: $items
|
|
794
|
+
locale: $locale
|
|
795
|
+
) {
|
|
796
|
+
displayMode
|
|
797
|
+
priceWithheld
|
|
798
|
+
nextChangeAt
|
|
799
|
+
items {
|
|
800
|
+
record {
|
|
801
|
+
id
|
|
802
|
+
modelId
|
|
803
|
+
data
|
|
804
|
+
status
|
|
805
|
+
available
|
|
806
|
+
quantityIncrement
|
|
807
|
+
variantCount
|
|
808
|
+
createdAt
|
|
809
|
+
updatedAt
|
|
810
|
+
}
|
|
811
|
+
price {
|
|
812
|
+
recordId
|
|
813
|
+
variantKey
|
|
814
|
+
currency
|
|
815
|
+
price
|
|
816
|
+
priceMax
|
|
817
|
+
listed
|
|
818
|
+
basePrice
|
|
819
|
+
source
|
|
820
|
+
listSource
|
|
821
|
+
minQuantity
|
|
822
|
+
maxQuantity
|
|
823
|
+
increment
|
|
824
|
+
tiers {
|
|
825
|
+
minQty
|
|
826
|
+
price
|
|
827
|
+
}
|
|
828
|
+
displayMode
|
|
829
|
+
taxRate
|
|
830
|
+
taxTreatmentKind
|
|
831
|
+
priceAmount {
|
|
832
|
+
net
|
|
833
|
+
tax
|
|
834
|
+
gross
|
|
835
|
+
}
|
|
836
|
+
priceMaxAmount {
|
|
837
|
+
net
|
|
838
|
+
tax
|
|
839
|
+
gross
|
|
840
|
+
}
|
|
841
|
+
basePriceAmount {
|
|
842
|
+
net
|
|
843
|
+
tax
|
|
844
|
+
gross
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}`);
|
|
852
|
+
var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
853
|
+
$workspaceId: String!
|
|
854
|
+
$channel: String!
|
|
855
|
+
$modelSlug: String!
|
|
856
|
+
$filter: JSON
|
|
857
|
+
$stockState: String
|
|
858
|
+
$sku: String
|
|
859
|
+
$locale: String
|
|
860
|
+
$currency: String
|
|
861
|
+
$priceMin: Int
|
|
862
|
+
$priceMax: Int
|
|
863
|
+
$sort: BuyerCatalogSort
|
|
864
|
+
$limit: Int
|
|
865
|
+
$offset: Int
|
|
866
|
+
) {
|
|
867
|
+
public {
|
|
868
|
+
pricing {
|
|
869
|
+
catalogPrices(
|
|
870
|
+
workspaceId: $workspaceId
|
|
871
|
+
channel: $channel
|
|
872
|
+
modelSlug: $modelSlug
|
|
873
|
+
filter: $filter
|
|
874
|
+
stockState: $stockState
|
|
875
|
+
sku: $sku
|
|
876
|
+
locale: $locale
|
|
877
|
+
currency: $currency
|
|
878
|
+
priceMin: $priceMin
|
|
879
|
+
priceMax: $priceMax
|
|
880
|
+
sort: $sort
|
|
881
|
+
limit: $limit
|
|
882
|
+
offset: $offset
|
|
883
|
+
) {
|
|
884
|
+
total
|
|
885
|
+
hasMore
|
|
886
|
+
displayMode
|
|
887
|
+
priceWithheld
|
|
888
|
+
nextChangeAt
|
|
889
|
+
items {
|
|
890
|
+
record {
|
|
891
|
+
id
|
|
892
|
+
modelId
|
|
893
|
+
data
|
|
894
|
+
status
|
|
895
|
+
available
|
|
896
|
+
quantityIncrement
|
|
897
|
+
variantCount
|
|
898
|
+
createdAt
|
|
899
|
+
updatedAt
|
|
900
|
+
}
|
|
901
|
+
price {
|
|
902
|
+
recordId
|
|
903
|
+
variantKey
|
|
904
|
+
currency
|
|
905
|
+
price
|
|
906
|
+
priceMax
|
|
907
|
+
listed
|
|
908
|
+
basePrice
|
|
909
|
+
source
|
|
910
|
+
listSource
|
|
911
|
+
minQuantity
|
|
912
|
+
maxQuantity
|
|
913
|
+
increment
|
|
914
|
+
tiers {
|
|
915
|
+
minQty
|
|
916
|
+
price
|
|
917
|
+
}
|
|
918
|
+
displayMode
|
|
919
|
+
taxRate
|
|
920
|
+
taxTreatmentKind
|
|
921
|
+
priceAmount {
|
|
922
|
+
net
|
|
923
|
+
tax
|
|
924
|
+
gross
|
|
925
|
+
}
|
|
926
|
+
priceMaxAmount {
|
|
927
|
+
net
|
|
928
|
+
tax
|
|
929
|
+
gross
|
|
930
|
+
}
|
|
931
|
+
basePriceAmount {
|
|
932
|
+
net
|
|
933
|
+
tax
|
|
934
|
+
gross
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}`);
|
|
942
|
+
function requireChannel(config, options, helper) {
|
|
943
|
+
const channel = (options.channel ?? config.channel)?.trim();
|
|
944
|
+
if (!channel) {
|
|
945
|
+
throw new Error(
|
|
946
|
+
`cmssy: ${helper} needs a sales channel - set channel in the client config or pass it in the options`
|
|
947
|
+
);
|
|
948
|
+
}
|
|
949
|
+
return channel;
|
|
950
|
+
}
|
|
951
|
+
async function getPublicPrices(config, items, options) {
|
|
952
|
+
const channel = requireChannel(config, options, "getPublicPrices");
|
|
953
|
+
if (items.length > CMSSY_PUBLIC_PRICES_MAX_ITEMS) {
|
|
954
|
+
throw new Error(
|
|
955
|
+
`cmssy: getPublicPrices takes at most ${CMSSY_PUBLIC_PRICES_MAX_ITEMS} items, got ${items.length} - split the request`
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
const data = await graphqlRequest(
|
|
959
|
+
config,
|
|
960
|
+
PUBLIC_PRICES_QUERY,
|
|
961
|
+
{
|
|
962
|
+
workspaceId: options.workspaceId,
|
|
963
|
+
channel,
|
|
964
|
+
items: items.map(
|
|
965
|
+
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
966
|
+
),
|
|
967
|
+
...options.locale ? { locale: options.locale } : {}
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
public: true,
|
|
971
|
+
fetch: options.fetch,
|
|
972
|
+
signal: options.signal,
|
|
973
|
+
retry: options.retry,
|
|
974
|
+
headers: { "x-workspace-id": options.workspaceId }
|
|
975
|
+
},
|
|
976
|
+
"channel prices"
|
|
977
|
+
);
|
|
978
|
+
return data.public.pricing.prices;
|
|
979
|
+
}
|
|
980
|
+
async function getPublicCatalogPrices(config, query, options) {
|
|
981
|
+
const channel = requireChannel(config, options, "getPublicCatalogPrices");
|
|
982
|
+
const data = await graphqlRequest(
|
|
983
|
+
config,
|
|
984
|
+
PUBLIC_CATALOG_PRICES_QUERY,
|
|
985
|
+
{ ...query, workspaceId: options.workspaceId, channel },
|
|
986
|
+
{
|
|
987
|
+
public: true,
|
|
988
|
+
fetch: options.fetch,
|
|
989
|
+
signal: options.signal,
|
|
990
|
+
retry: options.retry,
|
|
991
|
+
headers: { "x-workspace-id": options.workspaceId }
|
|
992
|
+
},
|
|
993
|
+
"channel catalogue prices"
|
|
994
|
+
);
|
|
995
|
+
return data.public.pricing.catalogPrices;
|
|
996
|
+
}
|
|
737
997
|
|
|
738
998
|
// src/data/checkout-errors.ts
|
|
739
999
|
var quantityRuleReasonValues = [
|
|
@@ -746,6 +1006,7 @@ var checkoutErrorReasonValues = [
|
|
|
746
1006
|
"CART_CURRENCY_CHANGED",
|
|
747
1007
|
"BUYER_CHANGED",
|
|
748
1008
|
"PRODUCT_NOT_SOLD",
|
|
1009
|
+
"TAX_TREATMENT_CHANGED",
|
|
749
1010
|
...quantityRuleReasonValues
|
|
750
1011
|
];
|
|
751
1012
|
var REASONS = new Set(checkoutErrorReasonValues);
|
|
@@ -784,6 +1045,30 @@ function quantityRuleViolation(error) {
|
|
|
784
1045
|
}
|
|
785
1046
|
return void 0;
|
|
786
1047
|
}
|
|
1048
|
+
var channelRefusalReasonValues = [
|
|
1049
|
+
"UNKNOWN_CHANNEL",
|
|
1050
|
+
...priceWithheldReasonValues
|
|
1051
|
+
];
|
|
1052
|
+
var WITHHELD_REASONS = new Set(
|
|
1053
|
+
priceWithheldReasonValues
|
|
1054
|
+
);
|
|
1055
|
+
function channelRefusal(error) {
|
|
1056
|
+
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
1057
|
+
for (const entry of error.errors) {
|
|
1058
|
+
const ext = entry.extensions;
|
|
1059
|
+
if (!ext || typeof ext.channel !== "string") continue;
|
|
1060
|
+
if (typeof ext.reason === "string" && WITHHELD_REASONS.has(ext.reason)) {
|
|
1061
|
+
return {
|
|
1062
|
+
reason: ext.reason,
|
|
1063
|
+
channel: ext.channel
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
if (ext.code === "BAD_USER_INPUT" && ext.reason === void 0) {
|
|
1067
|
+
return { reason: "UNKNOWN_CHANNEL", channel: ext.channel };
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
return void 0;
|
|
1071
|
+
}
|
|
787
1072
|
|
|
788
1073
|
// src/fields.ts
|
|
789
1074
|
function build(type, opts) {
|
|
@@ -1398,4 +1683,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1398
1683
|
return parsed;
|
|
1399
1684
|
}
|
|
1400
1685
|
|
|
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 };
|
|
1686
|
+
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.17.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.17.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.17.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 {
|
|
@@ -1334,11 +1347,13 @@ function cmssyCspHeaders(options) {
|
|
|
1334
1347
|
"Content-Security-Policy": frameAncestors(options.editorOrigin)
|
|
1335
1348
|
};
|
|
1336
1349
|
}
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1350
|
+
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices(
|
|
1351
|
+
$workspaceId: ID!
|
|
1352
|
+
$items: [PriceQueryItem!]!
|
|
1353
|
+
$channel: String
|
|
1354
|
+
) {
|
|
1340
1355
|
account {
|
|
1341
|
-
prices(workspaceId: $workspaceId, items: $items) {
|
|
1356
|
+
prices(workspaceId: $workspaceId, items: $items, channel: $channel) {
|
|
1342
1357
|
recordId
|
|
1343
1358
|
variantKey
|
|
1344
1359
|
currency
|
|
@@ -1347,6 +1362,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1347
1362
|
listed
|
|
1348
1363
|
basePrice
|
|
1349
1364
|
source
|
|
1365
|
+
listSource
|
|
1350
1366
|
minQuantity
|
|
1351
1367
|
maxQuantity
|
|
1352
1368
|
increment
|
|
@@ -1356,6 +1372,7 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1356
1372
|
}
|
|
1357
1373
|
displayMode
|
|
1358
1374
|
taxRate
|
|
1375
|
+
taxTreatmentKind
|
|
1359
1376
|
priceAmount {
|
|
1360
1377
|
net
|
|
1361
1378
|
tax
|
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 {
|