feeef 0.9.4 → 0.9.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/build/index.js +82 -5
- package/build/index.js.map +1 -1
- package/build/src/core/entities/order.d.ts +18 -0
- package/build/src/core/entities/store.d.ts +58 -27
- package/package.json +1 -1
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
|
-
|
|
4197
|
-
|
|
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,12 @@ var PixelReportMode = /* @__PURE__ */ ((PixelReportMode2) => {
|
|
|
4239
4305
|
PixelReportMode2["both"] = "both";
|
|
4240
4306
|
return PixelReportMode2;
|
|
4241
4307
|
})(PixelReportMode || {});
|
|
4308
|
+
var SecurityTreatment = /* @__PURE__ */ ((SecurityTreatment2) => {
|
|
4309
|
+
SecurityTreatment2["block"] = "block";
|
|
4310
|
+
SecurityTreatment2["warning"] = "warning";
|
|
4311
|
+
SecurityTreatment2["fake"] = "fake";
|
|
4312
|
+
return SecurityTreatment2;
|
|
4313
|
+
})(SecurityTreatment || {});
|
|
4242
4314
|
var WebhookEvent = /* @__PURE__ */ ((WebhookEvent2) => {
|
|
4243
4315
|
WebhookEvent2["ORDER_CREATED"] = "orderCreated";
|
|
4244
4316
|
WebhookEvent2["ORDER_UPDATED"] = "orderUpdated";
|
|
@@ -5013,6 +5085,7 @@ export {
|
|
|
5013
5085
|
ProductType,
|
|
5014
5086
|
ProductVariantView,
|
|
5015
5087
|
PromoRepository,
|
|
5088
|
+
SecurityTreatment,
|
|
5016
5089
|
ShippingMethodPolicy,
|
|
5017
5090
|
ShippingMethodRepository,
|
|
5018
5091
|
ShippingMethodStatus,
|
|
@@ -5076,7 +5149,10 @@ export {
|
|
|
5076
5149
|
getLegacyAiBillingFlat,
|
|
5077
5150
|
getShippingPrice,
|
|
5078
5151
|
isAttachmentType,
|
|
5152
|
+
isFakeOrder,
|
|
5153
|
+
isFakeOrderId,
|
|
5079
5154
|
isShippingAvailable,
|
|
5155
|
+
isWarningOrder,
|
|
5080
5156
|
mergeAiModelsBilling,
|
|
5081
5157
|
normalizeAttachmentPayload,
|
|
5082
5158
|
normalizeAttachmentPayloads,
|
|
@@ -5087,6 +5163,7 @@ export {
|
|
|
5087
5163
|
serializeAttachmentPayloads,
|
|
5088
5164
|
serializeImagePromptTemplateCreate,
|
|
5089
5165
|
serializeImagePromptTemplateUpdate,
|
|
5166
|
+
shouldSuppressPixelEvents,
|
|
5090
5167
|
transmitRootFromApiBaseUrl,
|
|
5091
5168
|
tryFixPhoneNumber,
|
|
5092
5169
|
validatePhoneNumber
|