feeef 0.12.5 → 0.12.7

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/build/index.js CHANGED
@@ -2966,6 +2966,14 @@ var StoreTemplatesRepository = class extends ModelRepository {
2966
2966
  });
2967
2967
  return toListResponse3(res.data);
2968
2968
  }
2969
+ /**
2970
+ * Platform default Lithium theme (`GET /store_templates/default`).
2971
+ * Configured via `templateMarketplace.defaultTemplateId`.
2972
+ */
2973
+ async getDefault() {
2974
+ const res = await this.client.get(`/${this.resource}/default`);
2975
+ return res.data;
2976
+ }
2969
2977
  async fork(options) {
2970
2978
  const res = await this.client.post(`/${this.resource}/${options.fromId}/fork`, {
2971
2979
  storeId: options.storeId,
@@ -3123,21 +3131,30 @@ function shouldSuppressPixelEvents(order) {
3123
3131
  }
3124
3132
 
3125
3133
  // src/core/entities/product_offer_policy.ts
3134
+ function readForceOffer(product) {
3135
+ return product.forceOffer === true || product.force_offer === true;
3136
+ }
3137
+ function readDefaultOfferCode(product) {
3138
+ const code = product.defaultOfferCode ?? product.default_offer_code;
3139
+ if (typeof code !== "string") return null;
3140
+ const trimmed = code.trim();
3141
+ return trimmed.length > 0 ? trimmed : null;
3142
+ }
3126
3143
  function syncDefaultOfferCode(offers, defaultOfferCode) {
3127
3144
  if (!defaultOfferCode || !offers?.length) return null;
3128
3145
  return offers.some((o) => o.code === defaultOfferCode) ? defaultOfferCode : null;
3129
3146
  }
3130
3147
  function resolveInitialProductOffer(product) {
3131
- const code = syncDefaultOfferCode(product.offers, product.defaultOfferCode);
3148
+ const code = syncDefaultOfferCode(product.offers, readDefaultOfferCode(product));
3132
3149
  if (!code || !product.offers?.length) return void 0;
3133
3150
  return product.offers.find((o) => o.code === code);
3134
3151
  }
3135
3152
  function isProductOfferRequired(product) {
3136
- return product.forceOffer === true;
3153
+ return readForceOffer(product);
3137
3154
  }
3138
3155
  function isProductOfferLocked(product) {
3139
- if (product.forceOffer !== true) return false;
3140
- return syncDefaultOfferCode(product.offers, product.defaultOfferCode) !== null;
3156
+ if (!readForceOffer(product)) return false;
3157
+ return syncDefaultOfferCode(product.offers, readDefaultOfferCode(product)) !== null;
3141
3158
  }
3142
3159
  function resolveForcedProductOffer(product) {
3143
3160
  if (!isProductOfferLocked(product)) return void 0;