@idigi/reaction-plugin-shipments-flat-rate
Advanced tools
Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "@idigi/reaction-plugin-shipments-flat-rate", | ||
"description": "Flat Rate Shipments plugin for the Reaction API", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
@@ -28,7 +28,7 @@ "type": "module", | ||
"dependencies": { | ||
"@reactioncommerce/api-utils": "^1.14.3", | ||
"@reactioncommerce/api-utils": "^1.16.9", | ||
"@reactioncommerce/logger": "^1.1.3", | ||
"@reactioncommerce/random": "^1.0.2", | ||
"@reactioncommerce/reaction-error": "^1.0.1", | ||
"simpl-schema": "^1.8.0" | ||
"simpl-schema": "^1.12.0" | ||
}, | ||
@@ -84,6 +84,3 @@ "devDependencies": { | ||
] | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -1,26 +0,20 @@ | ||
[ | ||
{ | ||
"i18n": "en", | ||
"ns": "reaction-shipping-rates", | ||
"translation": { | ||
"reaction-shipping-rates": { | ||
"admin": { | ||
"shippingSettings": { | ||
"header": "Shipping", | ||
"flatRateLabel": "Flat Rate", | ||
"confirmRateDelete": "Delete this fulfillment method?", | ||
"rateSaved": "Fulfillment method saved", | ||
"rateFailed": "Fulfillment method update failed", | ||
"noRatesFound": "No flat rate fulfillment methods found" | ||
}, | ||
"shippingGrid": { | ||
"name": "Name", | ||
"group": "Group", | ||
"rate": "Rate", | ||
"label": "Label", | ||
"toSelectCitiesIncludes": "To select the included cities, you must first deselect all the excluded cities.", | ||
"citiesIncludes": "Cities Includes", | ||
"toSelectCitiesExcludes": "To select the excluded cities, you must first deselect all the included cities.", | ||
"citiesExcludes": "Cities Excludes" | ||
} | ||
[{ | ||
"i18n": "en", | ||
"ns": "reaction-shipping-rates", | ||
"translation": { | ||
"reaction-shipping-rates": { | ||
"admin": { | ||
"shippingSettings": { | ||
"header": "Shipping", | ||
"flatRateLabel": "Flat Rate", | ||
"confirmRateDelete": "Delete this fulfillment method?", | ||
"rateSaved": "Fulfillment method saved", | ||
"rateFailed": "Fulfillment method update failed", | ||
"noRatesFound": "No flat rate fulfillment methods found" | ||
}, | ||
"shippingGrid": { | ||
"name": "Name", | ||
"group": "Group", | ||
"rate": "Rate", | ||
"label": "Label" | ||
} | ||
@@ -30,2 +24,2 @@ } | ||
} | ||
] | ||
}] |
@@ -1,25 +0,19 @@ | ||
[ | ||
{ | ||
"i18n": "fr", | ||
"ns": "reaction-shipping-rates", | ||
"translation": { | ||
"reaction-shipping-rates": { | ||
"admin": { | ||
"shippingSettings": { | ||
"flatRateLabel": "Forfait", | ||
"confirmRateDelete": "Supprimer le tarif ?", | ||
"rateSaved": "Tarif forfaitaire sauvegardé.", | ||
"rateFailed": "La mise à jour du tarif forfaitaire a échouée.", | ||
"noRatesFound": "Pas de prix trouvés." | ||
}, | ||
"shippingGrid": { | ||
"name": "Nom", | ||
"group": "Groupe", | ||
"rate": "Tarif", | ||
"label": "Étiquette", | ||
"toSelectCitiesIncludes": "Pour sélectionner les villes incluses, vous devez d'abord désélectionner toutes les villes exclues", | ||
"citiesIncludes": "Les villes y compris", | ||
"toSelectCitiesExcludes": "Pour sélectionner les villes exclues, vous devez d'abord désélectionner toutes les villes incluses", | ||
"citiesExcludes": "Les villes exclues" | ||
} | ||
[{ | ||
"i18n": "fr", | ||
"ns": "reaction-shipping-rates", | ||
"translation": { | ||
"reaction-shipping-rates": { | ||
"admin": { | ||
"shippingSettings": { | ||
"flatRateLabel": "Forfait", | ||
"confirmRateDelete": "Supprimer le tarif ?", | ||
"rateSaved": "Tarif forfaitaire sauvegardé.", | ||
"rateFailed": "La mise à jour du tarif forfaitaire a échouée.", | ||
"noRatesFound": "Pas de prix trouvés." | ||
}, | ||
"shippingGrid": { | ||
"name": "Nom", | ||
"group": "Groupe", | ||
"rate": "Tarif", | ||
"label": "Étiquette" | ||
} | ||
@@ -29,2 +23,2 @@ } | ||
} | ||
] | ||
}] |
import pkg from "../package.json"; | ||
import i18n from "./i18n/index.js"; | ||
import getFulfillmentMethodsWithQuotes from "./getFulfillmentMethodsWithQuotes.js"; | ||
import preStartup from "./preStartup.js"; | ||
import resolvers from "./resolvers/index.js"; | ||
@@ -47,4 +46,3 @@ import mutations from "./mutations/index.js"; | ||
functionsByType: { | ||
preStartup: [preStartup], | ||
getFulfillmentMethodsWithQuotes: [getFulfillmentMethodsWithQuotes], | ||
getFulfillmentMethodsWithQuotes: [getFulfillmentMethodsWithQuotes] | ||
}, | ||
@@ -51,0 +49,0 @@ shopSettingsConfig: { |
@@ -26,2 +26,3 @@ import { attributeDenyCheck } from "./attributeDenyCheck.js"; | ||
const methodRestrictions = await FlatRateFulfillmentRestrictions.find({ methodIds: method._id }).toArray(); | ||
// Check method against location allow check | ||
@@ -28,0 +29,0 @@ const methodIsAllowedBasedOnShippingLocationsAllowList = await locationAllowCheck(methodRestrictions, method, hydratedOrder); |
@@ -13,3 +13,2 @@ /** | ||
const { country: restrictionCountry, postal: restrictionPostal, region: restrictionRegion, cities: restrictionCities } = destination; | ||
console.info("\n\n==> isDestinationRestricted\n", shippingCity, restrictionCities, destination, "\n", ""); | ||
@@ -16,0 +15,0 @@ // Start checking at the micro-level, and move more macro as we go on |
import isDestinationRestricted from "./isDestinationRestricted.js"; | ||
import lodash from "lodash" | ||
@@ -13,8 +12,2 @@ /** | ||
const { shippingAddress } = hydratedOrder; | ||
const { city } = shippingAddress; | ||
const { citiesIncludes = [] } = method; | ||
// The method is exclude by city | ||
if (citiesIncludes.length && !citiesIncludes.map((_city) => lodash.kebabCase(_city)).includes(lodash.kebabCase(city))) { | ||
return false | ||
} | ||
// Get method specific destination allow restrictions | ||
@@ -21,0 +14,0 @@ const allowRestrictions = methodRestrictions.filter((restriction) => restriction.type === "allow"); |
import isDestinationRestricted from "./isDestinationRestricted.js"; | ||
import lodash from "lodash" | ||
@@ -13,9 +12,2 @@ /** | ||
const { shippingAddress } = hydratedOrder; | ||
const { city } = shippingAddress; | ||
const { citiesExcludes = [] } = method; | ||
// The method is exclude by city | ||
if (citiesExcludes.length && citiesExcludes.map((_city) => lodash.kebabCase(_city)).includes(lodash.kebabCase(city))) { | ||
return false | ||
} | ||
// Get method specific allow restrictions | ||
@@ -22,0 +14,0 @@ const denyRestrictions = methodRestrictions.filter((restriction) => restriction.type === "deny"); |
@@ -18,15 +18,5 @@ import SimpleSchema from "simpl-schema"; | ||
"name": String, | ||
"rate": Number, | ||
"citiesIncludes": { | ||
type: Array, | ||
optional: true | ||
}, | ||
"citiesIncludes.$": String, | ||
"citiesExcludes": { | ||
type: Array, | ||
optional: true | ||
}, | ||
"citiesExcludes.$": String | ||
"rate": Number | ||
}); | ||
export default methodSchema; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
154925
86
2622
Updatedsimpl-schema@^1.12.0