@repobit/dex-store-elements 1.2.4 → 1.2.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.5](https://github.com/bitdefender/dex-core/compare/@repobit/dex-store-elements@1.2.4...@repobit/dex-store-elements@1.2.5) (2025-10-28)
7
+
8
+ **Note:** Version bump only for package @repobit/dex-store-elements
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.2.4](https://github.com/bitdefender/dex-core/compare/@repobit/dex-store-elements@1.2.3...@repobit/dex-store-elements@1.2.4) (2025-10-20)
7
15
 
8
16
 
package/README.md CHANGED
@@ -54,11 +54,11 @@ Peer dependencies are resolved automatically by npm; no extra install command is
54
54
  <div data-store-render data-store-price="discounted || full"></div>
55
55
  <a data-store-render data-store-buy-link>Buy</a>
56
56
  <!-- Eta template (text) -->
57
- <p>Now at only {{= it.option.discountedPrice }}!</p>
57
+ <p>Now at only {{= it.option.price.discounted }}!</p>
58
58
  <!-- Eta template (attribute, implicit) -->
59
59
  <div title="Devices {{= it.option.devices }}"></div>
60
60
  <!-- Hide via DSL using merged context -->
61
- <div data-store-render data-store-hide="!it.option.discountedPrice">
61
+ <div data-store-render data-store-hide="!it.option.price.discounted">
62
62
  Hidden when discounted price doesn't exists
63
63
  </div>
64
64
  <!-- Actions -->
@@ -162,8 +162,8 @@ Notes
162
162
  - `it.state.*` aggregated min/max data (also available under `it.ctx`)
163
163
  - any keys returned from your `root.derived`
164
164
  - Examples:
165
- - `data-store-hide="it.option.discountedPrice === 0"`
166
- - `data-store-hide="(it.state.price.min > 100) && (it.product.campaign === 'test')"`
165
+ - `data-store-hide="!it.option.price.discounted"` (hide when no discounted price)
166
+ - `data-store-hide="it.product.campaign === 'test'"`
167
167
 
168
168
  ## Eta templates
169
169
  - Text/HTML: any element that is not a provider and doesn’t contain nested providers is treated as a whole-template; `innerHTML` is compiled once and morphed via nanomorph. This preserves existing DOM event listeners and state.
@@ -176,12 +176,69 @@ Notes
176
176
  - your derived overlay merged at top-level (see below)
177
177
 
178
178
  ## Derived variables/functions
179
- - Provide a function at the root: `root.derived = async ({ option, product, state, store }) => ({ ... })`
179
+ - Provide a function at the root: `root.derived = async ({ option, product, state }) => ({ ... })`
180
180
  - The returned object is merged into the Eta/DSL context:
181
- - Example: `({ mails: (p) => (option.getDevices()/p)*100, option: { someVar: state.discount.value.min } })`
181
+ - Example: `({ mails: (p) => (option?.getDevices?.()/p)*100, option: { someVar: state.discount.value.min } })`
182
182
  - Use it in Eta: `{{= it.mails(10) }}` or `{{= it.option.someVar }}`
183
183
  - Use it in hide: `data-store-hide="it.mails(10) >= 50"`
184
184
 
185
+ ## DSL context reference
186
+ The DSL and Eta contexts use Eta’s default variable name `it`. The following keys are available:
187
+
188
+ - it.option
189
+ - price
190
+ - full: formatted full price (string)
191
+ - discounted: formatted discounted price (string)
192
+ - fullMonthly: formatted monthly full price (string)
193
+ - discountedMonthly: formatted monthly discounted price (string)
194
+ - discount
195
+ - value: formatted discount amount (string)
196
+ - percentage: formatted percentage discount with symbol (string)
197
+ - valueMonthly: formatted monthly discount amount (string)
198
+ - percentageMonthly: formatted monthly percentage with symbol (string)
199
+ - links
200
+ - buy: buy URL (string)
201
+ - trial: trial URL if available (string)
202
+ - devices: number
203
+ - subscription: number
204
+
205
+ - it.product
206
+ - id: string
207
+ - campaign: string
208
+ - name: string
209
+
210
+ - it.state (also available as `it.ctx`)
211
+ - price
212
+ - full
213
+ - min: formatted string
214
+ - max: formatted string
215
+ - monthly
216
+ - min: formatted string
217
+ - max: formatted string
218
+ - discounted
219
+ - min: formatted string
220
+ - max: formatted string
221
+ - monthly
222
+ - min: formatted string
223
+ - max: formatted string
224
+ - discount
225
+ - percentage
226
+ - min: formatted string
227
+ - max: formatted string
228
+ - monthly
229
+ - min: formatted string
230
+ - max: formatted string
231
+ - value
232
+ - min: formatted string
233
+ - max: formatted string
234
+ - monthly
235
+ - min: formatted string
236
+ - max: formatted string
237
+
238
+ Notes
239
+ - All price/discount values in the DSL are formatted strings (currency-aware). Do not perform numeric comparisons on them. Prefer truthiness checks (e.g., `!it.option.price.discounted`).
240
+ - `it.ctx` is an alias of `it.state` for convenience.
241
+
185
242
  ## Actions
186
243
  - Add `data-store-action` to elements to emit store events.
187
244
  - Set absolute values: `data-store-set-devices`, `data-store-set-subscription`, `data-store-set-id`, `data-store-set-campaign`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repobit/dex-store-elements",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "HTML elements layer for pricings",
5
5
  "author": "Buga Adrian Alexandru <abuga@bitdefender.com>",
6
6
  "homepage": "https://github.com/bitdefender/dex-core#readme",
@@ -62,5 +62,5 @@
62
62
  ]
63
63
  }
64
64
  },
65
- "gitHead": "c38f5d5676fedc5a6adc0b1248803ac5ad376f86"
65
+ "gitHead": "9994983ec6b6d8140dbb2cfb2c11a6935943381e"
66
66
  }