@final-commerce/common 2.5.1-online.2 → 2.5.1-online.4
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 +256 -184
- package/dist/pos-types/index.d.ts +256 -184
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3257,6 +3257,8 @@ function foldText(value) {
|
|
|
3257
3257
|
// shipping/countries.ts
|
|
3258
3258
|
var NOT_COUNTRIES = /* @__PURE__ */ new Set(["AC", "CP", "CQ", "DG", "EA", "EU", "EZ", "IC", "QO", "TA", "UN", "XA", "XB", "ZZ"]);
|
|
3259
3259
|
var ALIASES = {
|
|
3260
|
+
canada: "CA",
|
|
3261
|
+
"united states": "US",
|
|
3260
3262
|
usa: "US",
|
|
3261
3263
|
"united states of america": "US",
|
|
3262
3264
|
uk: "GB",
|
|
@@ -3320,6 +3322,7 @@ function normalizeCountry(value) {
|
|
|
3320
3322
|
const upper = text.toUpperCase();
|
|
3321
3323
|
if (upper.length === 2) {
|
|
3322
3324
|
if (NOT_COUNTRIES.has(upper)) return void 0;
|
|
3325
|
+
if (countryCodes().length === 0) return /^[A-Z]{2}$/.test(upper) ? upper : void 0;
|
|
3323
3326
|
const code = canonicalCode(upper);
|
|
3324
3327
|
if (countryCodes().includes(code)) return code;
|
|
3325
3328
|
}
|