feeef 0.9.4 → 0.9.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
@@ -2417,6 +2417,20 @@ var convertOrderEntityToOrderTrackEntity = (order) => {
2417
2417
  })) || []
2418
2418
  };
2419
2419
  };
2420
+ function isFakeOrderId(orderId) {
2421
+ return !!orderId && orderId.startsWith("FuHe3nf");
2422
+ }
2423
+ function isFakeOrder(order) {
2424
+ return isFakeOrderId(order.id) || order.metadata?._fake === true;
2425
+ }
2426
+ function isWarningOrder(order) {
2427
+ return order.claims?.security?.treatment === "warning";
2428
+ }
2429
+ function shouldSuppressPixelEvents(order) {
2430
+ if (isFakeOrder(order)) return true;
2431
+ const treatment = order.claims?.security?.treatment;
2432
+ return treatment === "warning" || treatment === "fake";
2433
+ }
2420
2434
 
2421
2435
  // src/core/entities/shipping_method.ts
2422
2436
  var ShippingMethodStatus = /* @__PURE__ */ ((ShippingMethodStatus2) => {
@@ -4190,14 +4204,66 @@ var generatePublicStoreIntegrationWebhooks = (webhooks) => {
4190
4204
  webhookUrls: activeWebhooks.map((webhook) => webhook.url)
4191
4205
  };
4192
4206
  };
4207
+ function toPublicSecurityOption(raw) {
4208
+ if (!raw || typeof raw.active !== "boolean" || raw.treatment === void 0 || raw.treatment === null) {
4209
+ return void 0;
4210
+ }
4211
+ return {
4212
+ active: raw.active,
4213
+ ttl: typeof raw.ttl === "number" && !Number.isNaN(raw.ttl) ? raw.ttl : 0,
4214
+ treatment: raw.treatment
4215
+ };
4216
+ }
4217
+ function toPublicMinTimeInPage(raw) {
4218
+ if (!raw || typeof raw.active !== "boolean" || raw.treatment === void 0 || raw.treatment === null) {
4219
+ return void 0;
4220
+ }
4221
+ return {
4222
+ active: raw.active,
4223
+ duration: typeof raw.duration === "number" && !Number.isNaN(raw.duration) ? raw.duration : 0,
4224
+ treatment: raw.treatment
4225
+ };
4226
+ }
4227
+ function toPublicCountries(raw) {
4228
+ if (!raw || typeof raw.active !== "boolean" || raw.treatment === void 0 || raw.treatment === null) {
4229
+ return void 0;
4230
+ }
4231
+ return {
4232
+ active: raw.active,
4233
+ treatment: raw.treatment,
4234
+ allowed: raw.allowed ?? null,
4235
+ blocked: Array.isArray(raw.blocked) ? [...raw.blocked] : []
4236
+ };
4237
+ }
4238
+ function toPublicSources(raw) {
4239
+ if (!raw || typeof raw.active !== "boolean" || raw.treatment === void 0 || raw.treatment === null) {
4240
+ return void 0;
4241
+ }
4242
+ return {
4243
+ active: raw.active,
4244
+ treatment: raw.treatment,
4245
+ allowed: raw.allowed ?? null,
4246
+ blocked: Array.isArray(raw.blocked) ? [...raw.blocked] : []
4247
+ };
4248
+ }
4193
4249
  var generatePublicStoreIntegrationSecurity = (security) => {
4194
4250
  if (!security) return null;
4251
+ const opts = security.options;
4252
+ const frontend = toPublicSecurityOption(opts?.frontend);
4253
+ const doubleSend = toPublicSecurityOption(opts?.doubleSend);
4254
+ const minTimeInPage = toPublicMinTimeInPage(opts?.minTimeInPage);
4255
+ const countries = toPublicCountries(opts?.countries);
4256
+ const sources = toPublicSources(opts?.sources);
4257
+ const options = {
4258
+ ...frontend ? { frontend } : {},
4259
+ ...doubleSend ? { doubleSend } : {},
4260
+ ...minTimeInPage ? { minTimeInPage } : {},
4261
+ ...countries ? { countries } : {},
4262
+ ...sources ? { sources } : {}
4263
+ };
4195
4264
  return {
4196
- key: "[none]",
4197
- orders: security.orders ? {
4198
- frontend: security.orders.frontend
4199
- } : void 0,
4200
- active: security.active
4265
+ active: security.active,
4266
+ options
4201
4267
  };
4202
4268
  };
4203
4269
  var generatePublicStoreIntegrationPayment = (payment) => {
@@ -4239,6 +4305,19 @@ var PixelReportMode = /* @__PURE__ */ ((PixelReportMode2) => {
4239
4305
  PixelReportMode2["both"] = "both";
4240
4306
  return PixelReportMode2;
4241
4307
  })(PixelReportMode || {});
4308
+ var PixelStatusDimension = /* @__PURE__ */ ((PixelStatusDimension2) => {
4309
+ PixelStatusDimension2["orderStatus"] = "orderStatus";
4310
+ PixelStatusDimension2["deliveryStatus"] = "deliveryStatus";
4311
+ PixelStatusDimension2["paymentStatus"] = "paymentStatus";
4312
+ PixelStatusDimension2["customStatus"] = "customStatus";
4313
+ return PixelStatusDimension2;
4314
+ })(PixelStatusDimension || {});
4315
+ var SecurityTreatment = /* @__PURE__ */ ((SecurityTreatment2) => {
4316
+ SecurityTreatment2["block"] = "block";
4317
+ SecurityTreatment2["warning"] = "warning";
4318
+ SecurityTreatment2["fake"] = "fake";
4319
+ return SecurityTreatment2;
4320
+ })(SecurityTreatment || {});
4242
4321
  var WebhookEvent = /* @__PURE__ */ ((WebhookEvent2) => {
4243
4322
  WebhookEvent2["ORDER_CREATED"] = "orderCreated";
4244
4323
  WebhookEvent2["ORDER_UPDATED"] = "orderUpdated";
@@ -5007,12 +5086,14 @@ export {
5007
5086
  OrderStatus,
5008
5087
  PaymentStatus,
5009
5088
  PixelReportMode,
5089
+ PixelStatusDimension,
5010
5090
  ProcolisDeliveryIntegrationApi,
5011
5091
  ProductRepository,
5012
5092
  ProductStatus,
5013
5093
  ProductType,
5014
5094
  ProductVariantView,
5015
5095
  PromoRepository,
5096
+ SecurityTreatment,
5016
5097
  ShippingMethodPolicy,
5017
5098
  ShippingMethodRepository,
5018
5099
  ShippingMethodStatus,
@@ -5076,7 +5157,10 @@ export {
5076
5157
  getLegacyAiBillingFlat,
5077
5158
  getShippingPrice,
5078
5159
  isAttachmentType,
5160
+ isFakeOrder,
5161
+ isFakeOrderId,
5079
5162
  isShippingAvailable,
5163
+ isWarningOrder,
5080
5164
  mergeAiModelsBilling,
5081
5165
  normalizeAttachmentPayload,
5082
5166
  normalizeAttachmentPayloads,
@@ -5087,6 +5171,7 @@ export {
5087
5171
  serializeAttachmentPayloads,
5088
5172
  serializeImagePromptTemplateCreate,
5089
5173
  serializeImagePromptTemplateUpdate,
5174
+ shouldSuppressPixelEvents,
5090
5175
  transmitRootFromApiBaseUrl,
5091
5176
  tryFixPhoneNumber,
5092
5177
  validatePhoneNumber