@@ -146,6 +146,26 @@ export default class ContentFeature {
146146
147147 /**
148148 * Return a specific setting from the feature settings
149+ * If the "settings" key within the config has a "domains" key, it will be used to override the settings.
150+ * This uses JSONPatch to apply the patches to settings before getting the setting value.
151+ * For example.com getFeatureSettings('val') will return 1:
152+ * ```json
153+ * {
154+ * "settings": {
155+ * "domains": [
156+ * {
157+ * "domain": "example.com",
158+ * "patchSettings": [
159+ * { "op": "replace", "path": "/val", "value": 1 }
160+ * ]
161+ * }
162+ * ]
163+ * }
164+ * }
165+ * ```
166+ * "domain" can either be a string or an array of strings.
167+
168+ * For boolean states you should consider using getFeatureSettingEnabled.
149169 * @param {string } featureKeyName
150170 * @param {string } [featureName]
151171 * @returns {any }
@@ -184,6 +204,23 @@ export default class ContentFeature {
184204 /**
185205 * For simple boolean settings, return true if the setting is 'enabled'
186206 * For objects, verify the 'state' field is 'enabled'.
207+ * This allows for future forwards compatibility with more complex settings if required.
208+ * For example:
209+ * ```json
210+ * {
211+ * "toggle": "enabled"
212+ * }
213+ * ```
214+ * Could become later (without breaking changes):
215+ * ```json
216+ * {
217+ * "toggle": {
218+ * "state": "enabled",
219+ * "someOtherKey": 1
220+ * }
221+ * }
222+ * ```
223+ * This also supports domain overrides as per `getFeatureSetting`.
187224 * @param {string } featureKeyName
188225 * @param {string } [featureName]
189226 * @returns {boolean }
@@ -198,8 +235,10 @@ export default class ContentFeature {
198235
199236 /**
200237 * Given a config key, interpret the value as a list of domain overrides, and return the elements that match the current page
238+ * Consider using patchSettings instead as per `getFeatureSetting`.
201239 * @param {string } featureKeyName
202240 * @return {any[] }
241+ * @private
203242 */
204243 matchDomainFeatureSetting ( featureKeyName ) {
205244 const domain = this . #args?. site . domain ;
0 commit comments