@final-commerce/common 2.5.1-online.2 → 2.5.1-online.3
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.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +33 -1
- package/dist/pos-types/index.d.ts +33 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3478,6 +3478,8 @@ function foldText(value) {
|
|
|
3478
3478
|
// shipping/countries.ts
|
|
3479
3479
|
var NOT_COUNTRIES = /* @__PURE__ */ new Set(["AC", "CP", "CQ", "DG", "EA", "EU", "EZ", "IC", "QO", "TA", "UN", "XA", "XB", "ZZ"]);
|
|
3480
3480
|
var ALIASES = {
|
|
3481
|
+
canada: "CA",
|
|
3482
|
+
"united states": "US",
|
|
3481
3483
|
usa: "US",
|
|
3482
3484
|
"united states of america": "US",
|
|
3483
3485
|
uk: "GB",
|
|
@@ -3541,6 +3543,7 @@ function normalizeCountry(value) {
|
|
|
3541
3543
|
const upper = text.toUpperCase();
|
|
3542
3544
|
if (upper.length === 2) {
|
|
3543
3545
|
if (NOT_COUNTRIES.has(upper)) return void 0;
|
|
3546
|
+
if (countryCodes().length === 0) return /^[A-Z]{2}$/.test(upper) ? upper : void 0;
|
|
3544
3547
|
const code = canonicalCode(upper);
|
|
3545
3548
|
if (countryCodes().includes(code)) return code;
|
|
3546
3549
|
}
|