@cmssy/core 19.13.0 → 19.15.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 +80 -2
- package/dist/index.d.cts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +78 -3
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +21 -1
- package/dist/internal.js +21 -1
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -225,7 +225,7 @@ function documentText(document2) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// src/version.ts
|
|
228
|
-
var CMSSY_CORE_VERSION = "19.
|
|
228
|
+
var CMSSY_CORE_VERSION = "19.15.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -573,6 +573,7 @@ function createCmssyClient(input) {
|
|
|
573
573
|
|
|
574
574
|
// src/data/buyer-prices.ts
|
|
575
575
|
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
576
|
+
var priceDisplayModeValues = ["gross", "net"];
|
|
576
577
|
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
577
578
|
account {
|
|
578
579
|
prices(workspaceId: $workspaceId, items: $items) {
|
|
@@ -584,10 +585,30 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
584
585
|
listed
|
|
585
586
|
basePrice
|
|
586
587
|
source
|
|
588
|
+
minQuantity
|
|
589
|
+
maxQuantity
|
|
590
|
+
increment
|
|
587
591
|
tiers {
|
|
588
592
|
minQty
|
|
589
593
|
price
|
|
590
594
|
}
|
|
595
|
+
displayMode
|
|
596
|
+
taxRate
|
|
597
|
+
priceAmount {
|
|
598
|
+
net
|
|
599
|
+
tax
|
|
600
|
+
gross
|
|
601
|
+
}
|
|
602
|
+
priceMaxAmount {
|
|
603
|
+
net
|
|
604
|
+
tax
|
|
605
|
+
gross
|
|
606
|
+
}
|
|
607
|
+
basePriceAmount {
|
|
608
|
+
net
|
|
609
|
+
tax
|
|
610
|
+
gross
|
|
611
|
+
}
|
|
591
612
|
}
|
|
592
613
|
}
|
|
593
614
|
}`);
|
|
@@ -657,6 +678,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
657
678
|
) {
|
|
658
679
|
total
|
|
659
680
|
hasMore
|
|
681
|
+
displayMode
|
|
660
682
|
items {
|
|
661
683
|
recordId
|
|
662
684
|
currency
|
|
@@ -665,6 +687,26 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
665
687
|
listed
|
|
666
688
|
basePrice
|
|
667
689
|
source
|
|
690
|
+
minQuantity
|
|
691
|
+
maxQuantity
|
|
692
|
+
increment
|
|
693
|
+
displayMode
|
|
694
|
+
taxRate
|
|
695
|
+
priceAmount {
|
|
696
|
+
net
|
|
697
|
+
tax
|
|
698
|
+
gross
|
|
699
|
+
}
|
|
700
|
+
priceMaxAmount {
|
|
701
|
+
net
|
|
702
|
+
tax
|
|
703
|
+
gross
|
|
704
|
+
}
|
|
705
|
+
basePriceAmount {
|
|
706
|
+
net
|
|
707
|
+
tax
|
|
708
|
+
gross
|
|
709
|
+
}
|
|
668
710
|
}
|
|
669
711
|
}
|
|
670
712
|
}
|
|
@@ -695,11 +737,20 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
695
737
|
}
|
|
696
738
|
|
|
697
739
|
// src/data/checkout-errors.ts
|
|
740
|
+
var quantityRuleReasonValues = [
|
|
741
|
+
"QUANTITY_BELOW_MIN",
|
|
742
|
+
"QUANTITY_ABOVE_MAX",
|
|
743
|
+
"QUANTITY_NOT_ON_STEP"
|
|
744
|
+
];
|
|
698
745
|
var checkoutErrorReasonValues = [
|
|
699
746
|
"CART_REPRICED",
|
|
700
|
-
"CART_CURRENCY_CHANGED"
|
|
747
|
+
"CART_CURRENCY_CHANGED",
|
|
748
|
+
"BUYER_CHANGED",
|
|
749
|
+
"PRODUCT_NOT_SOLD",
|
|
750
|
+
...quantityRuleReasonValues
|
|
701
751
|
];
|
|
702
752
|
var REASONS = new Set(checkoutErrorReasonValues);
|
|
753
|
+
var QUANTITY_REASONS = new Set(quantityRuleReasonValues);
|
|
703
754
|
function checkoutErrorReason(error) {
|
|
704
755
|
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
705
756
|
for (const entry of error.errors) {
|
|
@@ -710,6 +761,30 @@ function checkoutErrorReason(error) {
|
|
|
710
761
|
}
|
|
711
762
|
return void 0;
|
|
712
763
|
}
|
|
764
|
+
function isCount(value) {
|
|
765
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
766
|
+
}
|
|
767
|
+
function quantityRuleViolation(error) {
|
|
768
|
+
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
769
|
+
for (const entry of error.errors) {
|
|
770
|
+
const ext = entry.extensions;
|
|
771
|
+
if (!ext || typeof ext.reason !== "string") continue;
|
|
772
|
+
if (!QUANTITY_REASONS.has(ext.reason)) continue;
|
|
773
|
+
const { quantity, minQuantity, maxQuantity, increment, itemId } = ext;
|
|
774
|
+
if (!isCount(quantity) || !isCount(minQuantity) || !isCount(maxQuantity) || !isCount(increment)) {
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
return {
|
|
778
|
+
reason: ext.reason,
|
|
779
|
+
quantity,
|
|
780
|
+
minQuantity,
|
|
781
|
+
maxQuantity,
|
|
782
|
+
increment,
|
|
783
|
+
itemId: typeof itemId === "string" ? itemId : null
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
return void 0;
|
|
787
|
+
}
|
|
713
788
|
|
|
714
789
|
// src/fields.ts
|
|
715
790
|
function build(type, opts) {
|
|
@@ -1393,7 +1468,10 @@ exports.orderProgress = orderProgress;
|
|
|
1393
1468
|
exports.orderProgressValues = orderProgressValues;
|
|
1394
1469
|
exports.parseEditorMessage = parseEditorMessage;
|
|
1395
1470
|
exports.postToEditor = postToEditor;
|
|
1471
|
+
exports.priceDisplayModeValues = priceDisplayModeValues;
|
|
1396
1472
|
exports.propsToSchema = propsToSchema;
|
|
1473
|
+
exports.quantityRuleReasonValues = quantityRuleReasonValues;
|
|
1474
|
+
exports.quantityRuleViolation = quantityRuleViolation;
|
|
1397
1475
|
exports.registryToManifestBlocks = registryToManifestBlocks;
|
|
1398
1476
|
exports.resolveCmssyLocale = resolveCmssyLocale;
|
|
1399
1477
|
exports.resolveEditorOrigin = resolveEditorOrigin;
|
package/dist/index.d.cts
CHANGED
|
@@ -16,6 +16,13 @@ interface CmssyPriceTier {
|
|
|
16
16
|
minQty: number;
|
|
17
17
|
price: number;
|
|
18
18
|
}
|
|
19
|
+
declare const priceDisplayModeValues: readonly ["gross", "net"];
|
|
20
|
+
type CmssyPriceDisplayMode = (typeof priceDisplayModeValues)[number];
|
|
21
|
+
interface CmssyTaxedAmount {
|
|
22
|
+
net: number;
|
|
23
|
+
tax: number;
|
|
24
|
+
gross: number;
|
|
25
|
+
}
|
|
19
26
|
interface CmssyBuyerPrice {
|
|
20
27
|
recordId: string;
|
|
21
28
|
variantKey: string | null;
|
|
@@ -25,7 +32,15 @@ interface CmssyBuyerPrice {
|
|
|
25
32
|
listed: boolean;
|
|
26
33
|
basePrice: number;
|
|
27
34
|
source: CmssyPriceSource;
|
|
35
|
+
minQuantity: number;
|
|
36
|
+
maxQuantity: number;
|
|
37
|
+
increment: number;
|
|
28
38
|
tiers: CmssyPriceTier[];
|
|
39
|
+
displayMode: CmssyPriceDisplayMode;
|
|
40
|
+
taxRate: number;
|
|
41
|
+
priceAmount: CmssyTaxedAmount;
|
|
42
|
+
priceMaxAmount: CmssyTaxedAmount | null;
|
|
43
|
+
basePriceAmount: CmssyTaxedAmount;
|
|
29
44
|
}
|
|
30
45
|
interface CmssyMemberPriceList {
|
|
31
46
|
name: string;
|
|
@@ -57,11 +72,20 @@ interface CmssyBuyerCatalogPrice {
|
|
|
57
72
|
listed: boolean;
|
|
58
73
|
basePrice: number;
|
|
59
74
|
source: CmssyPriceSource;
|
|
75
|
+
minQuantity: number;
|
|
76
|
+
maxQuantity: number;
|
|
77
|
+
increment: number;
|
|
78
|
+
displayMode: CmssyPriceDisplayMode;
|
|
79
|
+
taxRate: number;
|
|
80
|
+
priceAmount: CmssyTaxedAmount;
|
|
81
|
+
priceMaxAmount: CmssyTaxedAmount | null;
|
|
82
|
+
basePriceAmount: CmssyTaxedAmount;
|
|
60
83
|
}
|
|
61
84
|
interface CmssyBuyerCatalogPage {
|
|
62
85
|
items: CmssyBuyerCatalogPrice[];
|
|
63
86
|
total: number;
|
|
64
87
|
hasMore: boolean;
|
|
88
|
+
displayMode: CmssyPriceDisplayMode;
|
|
65
89
|
}
|
|
66
90
|
interface BuyerCatalogPricesVariables {
|
|
67
91
|
workspaceId: string;
|
|
@@ -86,9 +110,20 @@ declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResul
|
|
|
86
110
|
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId">;
|
|
87
111
|
declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
|
|
88
112
|
|
|
89
|
-
declare const
|
|
113
|
+
declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
|
114
|
+
type CmssyQuantityRuleReason = (typeof quantityRuleReasonValues)[number];
|
|
115
|
+
declare const checkoutErrorReasonValues: readonly ["CART_REPRICED", "CART_CURRENCY_CHANGED", "BUYER_CHANGED", "PRODUCT_NOT_SOLD", "QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
|
90
116
|
type CmssyCheckoutErrorReason = (typeof checkoutErrorReasonValues)[number];
|
|
117
|
+
interface CmssyQuantityRuleViolation {
|
|
118
|
+
reason: CmssyQuantityRuleReason;
|
|
119
|
+
quantity: number;
|
|
120
|
+
minQuantity: number;
|
|
121
|
+
maxQuantity: number;
|
|
122
|
+
increment: number;
|
|
123
|
+
itemId: string | null;
|
|
124
|
+
}
|
|
91
125
|
declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
|
|
126
|
+
declare function quantityRuleViolation(error: unknown): CmssyQuantityRuleViolation | undefined;
|
|
92
127
|
|
|
93
128
|
/**
|
|
94
129
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
|
@@ -258,4 +293,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
258
293
|
}
|
|
259
294
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
260
295
|
|
|
261
|
-
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_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceQueryItem, type CmssyPriceTier, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
296
|
+
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_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, propsToSchema, quantityRuleReasonValues, quantityRuleViolation, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ interface CmssyPriceTier {
|
|
|
16
16
|
minQty: number;
|
|
17
17
|
price: number;
|
|
18
18
|
}
|
|
19
|
+
declare const priceDisplayModeValues: readonly ["gross", "net"];
|
|
20
|
+
type CmssyPriceDisplayMode = (typeof priceDisplayModeValues)[number];
|
|
21
|
+
interface CmssyTaxedAmount {
|
|
22
|
+
net: number;
|
|
23
|
+
tax: number;
|
|
24
|
+
gross: number;
|
|
25
|
+
}
|
|
19
26
|
interface CmssyBuyerPrice {
|
|
20
27
|
recordId: string;
|
|
21
28
|
variantKey: string | null;
|
|
@@ -25,7 +32,15 @@ interface CmssyBuyerPrice {
|
|
|
25
32
|
listed: boolean;
|
|
26
33
|
basePrice: number;
|
|
27
34
|
source: CmssyPriceSource;
|
|
35
|
+
minQuantity: number;
|
|
36
|
+
maxQuantity: number;
|
|
37
|
+
increment: number;
|
|
28
38
|
tiers: CmssyPriceTier[];
|
|
39
|
+
displayMode: CmssyPriceDisplayMode;
|
|
40
|
+
taxRate: number;
|
|
41
|
+
priceAmount: CmssyTaxedAmount;
|
|
42
|
+
priceMaxAmount: CmssyTaxedAmount | null;
|
|
43
|
+
basePriceAmount: CmssyTaxedAmount;
|
|
29
44
|
}
|
|
30
45
|
interface CmssyMemberPriceList {
|
|
31
46
|
name: string;
|
|
@@ -57,11 +72,20 @@ interface CmssyBuyerCatalogPrice {
|
|
|
57
72
|
listed: boolean;
|
|
58
73
|
basePrice: number;
|
|
59
74
|
source: CmssyPriceSource;
|
|
75
|
+
minQuantity: number;
|
|
76
|
+
maxQuantity: number;
|
|
77
|
+
increment: number;
|
|
78
|
+
displayMode: CmssyPriceDisplayMode;
|
|
79
|
+
taxRate: number;
|
|
80
|
+
priceAmount: CmssyTaxedAmount;
|
|
81
|
+
priceMaxAmount: CmssyTaxedAmount | null;
|
|
82
|
+
basePriceAmount: CmssyTaxedAmount;
|
|
60
83
|
}
|
|
61
84
|
interface CmssyBuyerCatalogPage {
|
|
62
85
|
items: CmssyBuyerCatalogPrice[];
|
|
63
86
|
total: number;
|
|
64
87
|
hasMore: boolean;
|
|
88
|
+
displayMode: CmssyPriceDisplayMode;
|
|
65
89
|
}
|
|
66
90
|
interface BuyerCatalogPricesVariables {
|
|
67
91
|
workspaceId: string;
|
|
@@ -86,9 +110,20 @@ declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResul
|
|
|
86
110
|
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId">;
|
|
87
111
|
declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
|
|
88
112
|
|
|
89
|
-
declare const
|
|
113
|
+
declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
|
114
|
+
type CmssyQuantityRuleReason = (typeof quantityRuleReasonValues)[number];
|
|
115
|
+
declare const checkoutErrorReasonValues: readonly ["CART_REPRICED", "CART_CURRENCY_CHANGED", "BUYER_CHANGED", "PRODUCT_NOT_SOLD", "QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
|
90
116
|
type CmssyCheckoutErrorReason = (typeof checkoutErrorReasonValues)[number];
|
|
117
|
+
interface CmssyQuantityRuleViolation {
|
|
118
|
+
reason: CmssyQuantityRuleReason;
|
|
119
|
+
quantity: number;
|
|
120
|
+
minQuantity: number;
|
|
121
|
+
maxQuantity: number;
|
|
122
|
+
increment: number;
|
|
123
|
+
itemId: string | null;
|
|
124
|
+
}
|
|
91
125
|
declare function checkoutErrorReason(error: unknown): CmssyCheckoutErrorReason | undefined;
|
|
126
|
+
declare function quantityRuleViolation(error: unknown): CmssyQuantityRuleViolation | undefined;
|
|
92
127
|
|
|
93
128
|
/**
|
|
94
129
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
|
@@ -258,4 +293,4 @@ declare class CmssyWebhookError extends Error {
|
|
|
258
293
|
}
|
|
259
294
|
declare function verifyCmssyWebhook(options: VerifyCmssyWebhookOptions): Promise<CmssyWebhookEvent>;
|
|
260
295
|
|
|
261
|
-
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_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceQueryItem, type CmssyPriceTier, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, propsToSchema, registryToManifestBlocks, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
296
|
+
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_SECRET_QUERY_PARAM, type CmssyBuyerCatalogPage, type CmssyBuyerCatalogPrice, type CmssyBuyerCatalogSort, type CmssyBuyerPrice, type CmssyCheckoutErrorReason, type CmssyMemberPriceList, CmssyOperation, type CmssyOrderProgress, type CmssyOrderProgressInput, type CmssyPriceDisplayMode, type CmssyPriceQueryItem, type CmssyPriceTier, type CmssyQuantityRuleReason, type CmssyQuantityRuleViolation, type CmssyTaxedAmount, CmssyWebhookError, type ConditionalFormField, FetchLike, type GetBuyerCatalogPricesQuery, type GetBuyerPricesOptions, type MediaLike, type MintCmssyEditTokenOptions, RetryOption, type VerifyCmssyEditTokenOptions, blocksToMeta, blocksToSchemas, buildBlockManifest, checkoutErrorReason, checkoutErrorReasonValues, fields, getBuyerCatalogPrices, getBuyerPrices, isFormFieldRequired, isFormFieldVisible, isVerifiedEditUrl, layoutRegionsToBridge, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, orderProgress, orderProgressValues, priceDisplayModeValues, 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.
|
|
227
|
+
var CMSSY_CORE_VERSION = "19.15.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -572,6 +572,7 @@ function createCmssyClient(input) {
|
|
|
572
572
|
|
|
573
573
|
// src/data/buyer-prices.ts
|
|
574
574
|
var CMSSY_BUYER_PRICES_MAX_ITEMS = 100;
|
|
575
|
+
var priceDisplayModeValues = ["gross", "net"];
|
|
575
576
|
var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $items: [PriceQueryItem!]!) {
|
|
576
577
|
account {
|
|
577
578
|
prices(workspaceId: $workspaceId, items: $items) {
|
|
@@ -583,10 +584,30 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
583
584
|
listed
|
|
584
585
|
basePrice
|
|
585
586
|
source
|
|
587
|
+
minQuantity
|
|
588
|
+
maxQuantity
|
|
589
|
+
increment
|
|
586
590
|
tiers {
|
|
587
591
|
minQty
|
|
588
592
|
price
|
|
589
593
|
}
|
|
594
|
+
displayMode
|
|
595
|
+
taxRate
|
|
596
|
+
priceAmount {
|
|
597
|
+
net
|
|
598
|
+
tax
|
|
599
|
+
gross
|
|
600
|
+
}
|
|
601
|
+
priceMaxAmount {
|
|
602
|
+
net
|
|
603
|
+
tax
|
|
604
|
+
gross
|
|
605
|
+
}
|
|
606
|
+
basePriceAmount {
|
|
607
|
+
net
|
|
608
|
+
tax
|
|
609
|
+
gross
|
|
610
|
+
}
|
|
590
611
|
}
|
|
591
612
|
}
|
|
592
613
|
}`);
|
|
@@ -656,6 +677,7 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
656
677
|
) {
|
|
657
678
|
total
|
|
658
679
|
hasMore
|
|
680
|
+
displayMode
|
|
659
681
|
items {
|
|
660
682
|
recordId
|
|
661
683
|
currency
|
|
@@ -664,6 +686,26 @@ var BUYER_CATALOG_PRICES_QUERY = typedOperation(`query BuyerCatalogPrices(
|
|
|
664
686
|
listed
|
|
665
687
|
basePrice
|
|
666
688
|
source
|
|
689
|
+
minQuantity
|
|
690
|
+
maxQuantity
|
|
691
|
+
increment
|
|
692
|
+
displayMode
|
|
693
|
+
taxRate
|
|
694
|
+
priceAmount {
|
|
695
|
+
net
|
|
696
|
+
tax
|
|
697
|
+
gross
|
|
698
|
+
}
|
|
699
|
+
priceMaxAmount {
|
|
700
|
+
net
|
|
701
|
+
tax
|
|
702
|
+
gross
|
|
703
|
+
}
|
|
704
|
+
basePriceAmount {
|
|
705
|
+
net
|
|
706
|
+
tax
|
|
707
|
+
gross
|
|
708
|
+
}
|
|
667
709
|
}
|
|
668
710
|
}
|
|
669
711
|
}
|
|
@@ -694,11 +736,20 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
694
736
|
}
|
|
695
737
|
|
|
696
738
|
// src/data/checkout-errors.ts
|
|
739
|
+
var quantityRuleReasonValues = [
|
|
740
|
+
"QUANTITY_BELOW_MIN",
|
|
741
|
+
"QUANTITY_ABOVE_MAX",
|
|
742
|
+
"QUANTITY_NOT_ON_STEP"
|
|
743
|
+
];
|
|
697
744
|
var checkoutErrorReasonValues = [
|
|
698
745
|
"CART_REPRICED",
|
|
699
|
-
"CART_CURRENCY_CHANGED"
|
|
746
|
+
"CART_CURRENCY_CHANGED",
|
|
747
|
+
"BUYER_CHANGED",
|
|
748
|
+
"PRODUCT_NOT_SOLD",
|
|
749
|
+
...quantityRuleReasonValues
|
|
700
750
|
];
|
|
701
751
|
var REASONS = new Set(checkoutErrorReasonValues);
|
|
752
|
+
var QUANTITY_REASONS = new Set(quantityRuleReasonValues);
|
|
702
753
|
function checkoutErrorReason(error) {
|
|
703
754
|
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
704
755
|
for (const entry of error.errors) {
|
|
@@ -709,6 +760,30 @@ function checkoutErrorReason(error) {
|
|
|
709
760
|
}
|
|
710
761
|
return void 0;
|
|
711
762
|
}
|
|
763
|
+
function isCount(value) {
|
|
764
|
+
return typeof value === "number" && Number.isInteger(value);
|
|
765
|
+
}
|
|
766
|
+
function quantityRuleViolation(error) {
|
|
767
|
+
if (!(error instanceof CmssyGraphqlError)) return void 0;
|
|
768
|
+
for (const entry of error.errors) {
|
|
769
|
+
const ext = entry.extensions;
|
|
770
|
+
if (!ext || typeof ext.reason !== "string") continue;
|
|
771
|
+
if (!QUANTITY_REASONS.has(ext.reason)) continue;
|
|
772
|
+
const { quantity, minQuantity, maxQuantity, increment, itemId } = ext;
|
|
773
|
+
if (!isCount(quantity) || !isCount(minQuantity) || !isCount(maxQuantity) || !isCount(increment)) {
|
|
774
|
+
continue;
|
|
775
|
+
}
|
|
776
|
+
return {
|
|
777
|
+
reason: ext.reason,
|
|
778
|
+
quantity,
|
|
779
|
+
minQuantity,
|
|
780
|
+
maxQuantity,
|
|
781
|
+
increment,
|
|
782
|
+
itemId: typeof itemId === "string" ? itemId : null
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
return void 0;
|
|
786
|
+
}
|
|
712
787
|
|
|
713
788
|
// src/fields.ts
|
|
714
789
|
function build(type, opts) {
|
|
@@ -1323,4 +1398,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1323
1398
|
return parsed;
|
|
1324
1399
|
}
|
|
1325
1400
|
|
|
1326
|
-
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, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
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 };
|
package/dist/internal/locale.cjs
CHANGED
package/dist/internal/locale.js
CHANGED
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.15.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -1347,10 +1347,30 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1347
1347
|
listed
|
|
1348
1348
|
basePrice
|
|
1349
1349
|
source
|
|
1350
|
+
minQuantity
|
|
1351
|
+
maxQuantity
|
|
1352
|
+
increment
|
|
1350
1353
|
tiers {
|
|
1351
1354
|
minQty
|
|
1352
1355
|
price
|
|
1353
1356
|
}
|
|
1357
|
+
displayMode
|
|
1358
|
+
taxRate
|
|
1359
|
+
priceAmount {
|
|
1360
|
+
net
|
|
1361
|
+
tax
|
|
1362
|
+
gross
|
|
1363
|
+
}
|
|
1364
|
+
priceMaxAmount {
|
|
1365
|
+
net
|
|
1366
|
+
tax
|
|
1367
|
+
gross
|
|
1368
|
+
}
|
|
1369
|
+
basePriceAmount {
|
|
1370
|
+
net
|
|
1371
|
+
tax
|
|
1372
|
+
gross
|
|
1373
|
+
}
|
|
1354
1374
|
}
|
|
1355
1375
|
}
|
|
1356
1376
|
}`);
|
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.15.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -1345,10 +1345,30 @@ var BUYER_PRICES_QUERY = typedOperation(`query BuyerPrices($workspaceId: ID!, $i
|
|
|
1345
1345
|
listed
|
|
1346
1346
|
basePrice
|
|
1347
1347
|
source
|
|
1348
|
+
minQuantity
|
|
1349
|
+
maxQuantity
|
|
1350
|
+
increment
|
|
1348
1351
|
tiers {
|
|
1349
1352
|
minQty
|
|
1350
1353
|
price
|
|
1351
1354
|
}
|
|
1355
|
+
displayMode
|
|
1356
|
+
taxRate
|
|
1357
|
+
priceAmount {
|
|
1358
|
+
net
|
|
1359
|
+
tax
|
|
1360
|
+
gross
|
|
1361
|
+
}
|
|
1362
|
+
priceMaxAmount {
|
|
1363
|
+
net
|
|
1364
|
+
tax
|
|
1365
|
+
gross
|
|
1366
|
+
}
|
|
1367
|
+
basePriceAmount {
|
|
1368
|
+
net
|
|
1369
|
+
tax
|
|
1370
|
+
gross
|
|
1371
|
+
}
|
|
1352
1372
|
}
|
|
1353
1373
|
}
|
|
1354
1374
|
}`);
|
package/dist/preflight.cjs
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.15.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.
|
|
153
|
+
var CMSSY_CORE_VERSION = "19.15.0" ;
|
|
154
154
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
155
155
|
|
|
156
156
|
// src/content/content-client.ts
|