@crystaldesign/diva-backoffice 25.13.0-beta.45 → 25.13.0-beta.46

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.
@@ -9224,12 +9224,11 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9224
9224
  },
9225
9225
  permission: 'backoffice_admin_organizations'
9226
9226
  }, {
9227
- name: ['settings', 'aiSettings', 'monthlyOrgCoinLimit'],
9228
- label: t('backoffice.form.organizationdetails.items.ai.monthlyOrgCoinLimit'),
9227
+ name: ['settings', 'aiSettings', 'monthlyOrgRenderingLimit'],
9228
+ label: t('backoffice.form.organizationdetails.items.ai.monthlyOrgRenderingLimit'),
9229
9229
  type: 'number',
9230
9230
  permission: 'backoffice_admin_organizations',
9231
9231
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9232
- defaultValue: 100000,
9233
9232
  hidden: function hidden(data) {
9234
9233
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9235
9234
  },
@@ -9240,24 +9239,62 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9240
9239
  onValueChange: function onValueChange(value, item, form) {
9241
9240
  if (value && typeof value === 'number') {
9242
9241
  // Compute all limits from monthly org limit
9243
- form.setFieldValue(['settings', 'aiSettings', 'weeklyOrgCoinLimit'], Math.round(value / 2));
9244
- form.setFieldValue(['settings', 'aiSettings', 'dailyOrgCoinLimit'], Math.round(value / 10));
9245
- form.setFieldValue(['settings', 'aiSettings', 'monthlyUserCoinLimit'], Math.round(value / 2));
9246
- form.setFieldValue(['settings', 'aiSettings', 'weeklyUserCoinLimit'], Math.round(value / 4));
9247
- form.setFieldValue(['settings', 'aiSettings', 'dailyUserCoinLimit'], Math.round(value / 20));
9242
+ form.setFieldValue(['settings', 'aiSettings', 'weeklyOrgRenderingLimit'], Math.round(value / 2));
9243
+ form.setFieldValue(['settings', 'aiSettings', 'dailyOrgRenderingLimit'], Math.round(value / 10));
9244
+ form.setFieldValue(['settings', 'aiSettings', 'monthlyUserRenderingLimit'], Math.round(value / 2));
9245
+ form.setFieldValue(['settings', 'aiSettings', 'weeklyUserRenderingLimit'], Math.round(value / 4));
9246
+ form.setFieldValue(['settings', 'aiSettings', 'dailyUserRenderingLimit'], Math.round(value / 20));
9248
9247
  var formattedValue = value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
9249
- var price = (value / 100).toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
9250
- item.helpText = formattedValue + ' divaCoins = €' + price + ' limit per month. Changes to this field will auto-update other limits.';
9248
+
9249
+ // Calculate tiered customer pricing
9250
+ var calculateTieredPrice = function calculateTieredPrice(units) {
9251
+ var tiers = [{
9252
+ max: 200,
9253
+ price: 0.5
9254
+ }, {
9255
+ max: 500,
9256
+ price: 0.4
9257
+ }, {
9258
+ max: 1000,
9259
+ price: 0.32
9260
+ }, {
9261
+ max: 2500,
9262
+ price: 0.26
9263
+ }, {
9264
+ max: 5000,
9265
+ price: 0.22
9266
+ }, {
9267
+ max: 10000,
9268
+ price: 0.19
9269
+ }, {
9270
+ max: Infinity,
9271
+ price: 0.16
9272
+ }];
9273
+ var total = 0;
9274
+ var remaining = units;
9275
+ var previousMax = 0;
9276
+ for (var _i = 0, _tiers = tiers; _i < _tiers.length; _i++) {
9277
+ var tier = _tiers[_i];
9278
+ if (remaining <= 0) break;
9279
+ var unitsInTier = Math.min(remaining, tier.max - previousMax);
9280
+ total += unitsInTier * tier.price;
9281
+ remaining -= unitsInTier;
9282
+ previousMax = tier.max;
9283
+ }
9284
+ return total;
9285
+ };
9286
+ var customerPrice = calculateTieredPrice(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, '.');
9287
+ var avgPrice = (calculateTieredPrice(value) / value).toFixed(3);
9288
+ item.helpText = formattedValue + ' renderings = ~€' + customerPrice + ' customer price (avg €' + avgPrice + '/unit). Tiered: 0-200: €0.50, 201-500: €0.40, 501-1K: €0.32, 1K-2.5K: €0.26, 2.5K-5K: €0.22, 5K-10K: €0.19, 10K+: €0.16';
9251
9289
  }
9252
9290
  },
9253
- helpText: '1000 divaCoins =1 limit per month. Changes to this field will auto-update other limits.'
9291
+ helpText: 'Volume-based pricing: First 200 @ 0.50/unit, decreases to €0.16/unit after 10K. 1 unit = 1 Gemini rendering, OpenAI = 4 units. Changes auto-update other limits.'
9254
9292
  }, {
9255
- name: ['settings', 'aiSettings', 'weeklyOrgCoinLimit'],
9256
- label: t('backoffice.form.organizationdetails.items.ai.weeklyOrgCoinLimit'),
9293
+ name: ['settings', 'aiSettings', 'weeklyOrgRenderingLimit'],
9294
+ label: t('backoffice.form.organizationdetails.items.ai.weeklyOrgRenderingLimit'),
9257
9295
  type: 'number',
9258
9296
  permission: 'backoffice_admin_organizations',
9259
9297
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9260
- defaultValue: 50000,
9261
9298
  hidden: function hidden(data) {
9262
9299
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9263
9300
  },
@@ -9267,12 +9304,11 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9267
9304
  },
9268
9305
  helpText: 'Auto-computed as monthlyOrg/2. Can be manually adjusted.'
9269
9306
  }, {
9270
- name: ['settings', 'aiSettings', 'dailyOrgCoinLimit'],
9271
- label: t('backoffice.form.organizationdetails.items.ai.dailyOrgCoinLimit'),
9307
+ name: ['settings', 'aiSettings', 'dailyOrgRenderingLimit'],
9308
+ label: t('backoffice.form.organizationdetails.items.ai.dailyOrgRenderingLimit'),
9272
9309
  type: 'number',
9273
9310
  permission: 'backoffice_admin_organizations',
9274
9311
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9275
- defaultValue: 10000,
9276
9312
  hidden: function hidden(data) {
9277
9313
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9278
9314
  },
@@ -9282,12 +9318,11 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9282
9318
  },
9283
9319
  helpText: 'Auto-computed as monthlyOrg/10. Can be manually adjusted.'
9284
9320
  }, {
9285
- name: ['settings', 'aiSettings', 'monthlyUserCoinLimit'],
9286
- label: t('backoffice.form.organizationdetails.items.ai.monthlyUserCoinLimit'),
9321
+ name: ['settings', 'aiSettings', 'monthlyUserRenderingLimit'],
9322
+ label: t('backoffice.form.organizationdetails.items.ai.monthlyUserRenderingLimit'),
9287
9323
  type: 'number',
9288
9324
  permission: 'backoffice_admin_organizations',
9289
9325
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9290
- defaultValue: 50000,
9291
9326
  hidden: function hidden(data) {
9292
9327
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9293
9328
  },
@@ -9297,12 +9332,11 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9297
9332
  },
9298
9333
  helpText: 'Auto-computed as monthlyOrg/2. Can be manually adjusted.'
9299
9334
  }, {
9300
- name: ['settings', 'aiSettings', 'weeklyUserCoinLimit'],
9301
- label: t('backoffice.form.organizationdetails.items.ai.weeklyUserCoinLimit'),
9335
+ name: ['settings', 'aiSettings', 'weeklyUserRenderingLimit'],
9336
+ label: t('backoffice.form.organizationdetails.items.ai.weeklyUserRenderingLimit'),
9302
9337
  type: 'number',
9303
9338
  permission: 'backoffice_admin_organizations',
9304
9339
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9305
- defaultValue: 25000,
9306
9340
  hidden: function hidden(data) {
9307
9341
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9308
9342
  },
@@ -9312,12 +9346,11 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9312
9346
  },
9313
9347
  helpText: 'Auto-computed as monthlyOrg/4. Can be manually adjusted.'
9314
9348
  }, {
9315
- name: ['settings', 'aiSettings', 'dailyUserCoinLimit'],
9316
- label: t('backoffice.form.organizationdetails.items.ai.dailyUserCoinLimit'),
9349
+ name: ['settings', 'aiSettings', 'dailyUserRenderingLimit'],
9350
+ label: t('backoffice.form.organizationdetails.items.ai.dailyUserRenderingLimit'),
9317
9351
  type: 'number',
9318
9352
  permission: 'backoffice_admin_organizations',
9319
9353
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9320
- defaultValue: 5000,
9321
9354
  hidden: function hidden(data) {
9322
9355
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9323
9356
  },
@@ -9332,7 +9365,6 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9332
9365
  type: 'number',
9333
9366
  permission: 'backoffice_admin_organizations',
9334
9367
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9335
- defaultValue: 2,
9336
9368
  hidden: function hidden(data) {
9337
9369
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9338
9370
  },
@@ -9343,7 +9375,6 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9343
9375
  type: 'number',
9344
9376
  permission: 'backoffice_admin_organizations',
9345
9377
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9346
- defaultValue: 10,
9347
9378
  hidden: function hidden(data) {
9348
9379
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9349
9380
  },
@@ -9354,7 +9385,6 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
9354
9385
  type: 'number',
9355
9386
  permission: 'backoffice_admin_organizations',
9356
9387
  tabgroup: t('backoffice.form.organizationdetails.items.ai.tabgroup'),
9357
- defaultValue: 5,
9358
9388
  hidden: function hidden(data) {
9359
9389
  return (data === null || data === void 0 ? void 0 : data.type) !== 'RETAILER' && (data === null || data === void 0 ? void 0 : data.parentType) !== 'RETAILER';
9360
9390
  }
@@ -18332,6 +18362,7 @@ var InputComponent = function InputComponent(_ref, ref) {
18332
18362
  var item = _ref.item,
18333
18363
  data = _ref.data,
18334
18364
  value = _ref.value,
18365
+ absoluteName = _ref.absoluteName,
18335
18366
  _onChange = _ref.onChange;
18336
18367
  var _useState = useState((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : value),
18337
18368
  _useState2 = _slicedToArray(_useState, 2),
@@ -18348,7 +18379,7 @@ var InputComponent = function InputComponent(_ref, ref) {
18348
18379
  var onPwChange = function onPwChange(e) {
18349
18380
  var input = e.target.value;
18350
18381
  setPwValue(input);
18351
- _onChange === null || _onChange === void 0 || _onChange(item.name, e.target.value);
18382
+ _onChange === null || _onChange === void 0 || _onChange(absoluteName, e.target.value);
18352
18383
  setShowContent(true);
18353
18384
  };
18354
18385
  var onFocus = function onFocus() {
@@ -18390,7 +18421,7 @@ var InputComponent = function InputComponent(_ref, ref) {
18390
18421
  value: item.type === 'dateinput' ? new Date((_item$value5 = item.value) !== null && _item$value5 !== void 0 ? _item$value5 : value).toLocaleString().replace('Invalid Date', '') : (_item$value6 = item.value) !== null && _item$value6 !== void 0 ? _item$value6 : value,
18391
18422
  placeholder: item.placeholder,
18392
18423
  onChange: function onChange(e) {
18393
- return _onChange === null || _onChange === void 0 ? void 0 : _onChange(item.name, e.target.value.trim());
18424
+ return _onChange === null || _onChange === void 0 ? void 0 : _onChange(absoluteName, e.target.value.trim());
18394
18425
  }
18395
18426
  });
18396
18427
  };
@@ -20755,6 +20786,7 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
20755
20786
  item: item,
20756
20787
  data: state.data,
20757
20788
  value: item.value,
20789
+ absoluteName: absoluteName,
20758
20790
  onChange: state.onInputChanged
20759
20791
  });
20760
20792
  }
@@ -20773,7 +20805,7 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
20773
20805
  value: item.value,
20774
20806
  placeholder: item.placeholder,
20775
20807
  onBlur: function onBlur(e) {
20776
- return state.onInputChanged(item.name, e.target.value.trim());
20808
+ return state.onInputChanged(absoluteName, e.target.value.trim());
20777
20809
  }
20778
20810
  });
20779
20811
  case 'detailaction':
@@ -20824,7 +20856,7 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
20824
20856
  disabled: disabled,
20825
20857
  value: item.value,
20826
20858
  formatter: function formatter(value) {
20827
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.');
20859
+ return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
20828
20860
  },
20829
20861
  onChange: function onChange(value) {
20830
20862
  _onChange(absoluteName, value);
@@ -20884,12 +20916,14 @@ function getElement(item, setCanSave, state, absoluteName, _onChange, _onError,
20884
20916
  return /*#__PURE__*/jsx(InputComponent$1, {
20885
20917
  item: item,
20886
20918
  data: state.data,
20919
+ absoluteName: absoluteName,
20887
20920
  onChange: state.onInputChanged
20888
20921
  });
20889
20922
  case 'dateinput':
20890
20923
  return /*#__PURE__*/jsx(InputComponent$1, {
20891
20924
  item: item,
20892
20925
  data: state.data,
20926
+ absoluteName: absoluteName,
20893
20927
  onChange: state.onInputChanged
20894
20928
  });
20895
20929
  case 'subTitle':
@@ -5,6 +5,7 @@ type Props = {
5
5
  item: InputItem | SimpleItem;
6
6
  data: any;
7
7
  value?: string;
8
+ absoluteName: string | (string | number)[];
8
9
  onChange: (id: string | (string | number)[], value: any) => void;
9
10
  };
10
11
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<Props & React.RefAttributes<InputRef>, "ref"> & React.RefAttributes<InputRef>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/Form/Fields/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAY,MAAM,MAAM,CAAC;AAEjD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAClE,CAAC;;AA8DF,wBAA0D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/Form/Fields/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAY,MAAM,MAAM,CAAC;AAEjD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3C,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAClE,CAAC;;AA8DF,wBAA0D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "25.13.0-beta.45",
3
+ "version": "25.13.0-beta.46",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "5.4.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "25.13.0-beta.45",
19
- "@crystaldesign/content-item": "25.13.0-beta.45",
20
- "@crystaldesign/diva-core": "25.13.0-beta.45",
21
- "@crystaldesign/diva-utils": "25.13.0-beta.45",
22
- "@crystaldesign/media-upload": "25.13.0-beta.45",
23
- "@crystaldesign/rtf-editor": "25.13.0-beta.45",
24
- "@crystaldesign/spreadsheet": "25.13.0-beta.45",
18
+ "@crystaldesign/content-box": "25.13.0-beta.46",
19
+ "@crystaldesign/content-item": "25.13.0-beta.46",
20
+ "@crystaldesign/diva-core": "25.13.0-beta.46",
21
+ "@crystaldesign/diva-utils": "25.13.0-beta.46",
22
+ "@crystaldesign/media-upload": "25.13.0-beta.46",
23
+ "@crystaldesign/rtf-editor": "25.13.0-beta.46",
24
+ "@crystaldesign/spreadsheet": "25.13.0-beta.46",
25
25
  "@google/model-viewer": "3.5.0",
26
26
  "ag-charts-community": "^10.1.0",
27
27
  "ag-charts-react": "^10.1.0",
@@ -51,5 +51,5 @@
51
51
  },
52
52
  "module": "build/esm/index.js",
53
53
  "types": "./build/types/backoffice/src/index.d.ts",
54
- "gitHead": "7b04559b1689c99df827dad694b5568a32073b2e"
54
+ "gitHead": "b7e46a56b73ba6fb493131d369575324234ff921"
55
55
  }