feeef 0.9.3 → 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
CHANGED
|
@@ -612,6 +612,29 @@ var UserRepository = class extends ModelRepository {
|
|
|
612
612
|
};
|
|
613
613
|
return this.auth;
|
|
614
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Generates a short-lived, single-use Feeef auth code for cross-device / QR login.
|
|
617
|
+
*
|
|
618
|
+
* POST `/users/auth/code` (auth required).
|
|
619
|
+
*/
|
|
620
|
+
async createAuthCode(options = {}) {
|
|
621
|
+
const res = await this.client.post(`/${this.resource}/auth/code`, {
|
|
622
|
+
redirect: options.redirect
|
|
623
|
+
});
|
|
624
|
+
return res.data;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Signs in using a one-time Feeef auth code (OAuth-like semantics).
|
|
628
|
+
*
|
|
629
|
+
* POST `/users/auth/code/consume` (public). On success it returns a bearer token and user.
|
|
630
|
+
*/
|
|
631
|
+
async signinWithCode(options) {
|
|
632
|
+
const res = await this.client.post(`/${this.resource}/auth/code/consume`, {
|
|
633
|
+
authCode: options.authCode
|
|
634
|
+
});
|
|
635
|
+
this.auth = res.data;
|
|
636
|
+
return this.auth;
|
|
637
|
+
}
|
|
615
638
|
/**
|
|
616
639
|
* Signs out the currently authenticated user.
|
|
617
640
|
* Deletes the token on the server and clears local auth state.
|
|
@@ -2394,6 +2417,20 @@ var convertOrderEntityToOrderTrackEntity = (order) => {
|
|
|
2394
2417
|
})) || []
|
|
2395
2418
|
};
|
|
2396
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
|
+
}
|
|
2397
2434
|
|
|
2398
2435
|
// src/core/entities/shipping_method.ts
|
|
2399
2436
|
var ShippingMethodStatus = /* @__PURE__ */ ((ShippingMethodStatus2) => {
|
|
@@ -4167,14 +4204,66 @@ var generatePublicStoreIntegrationWebhooks = (webhooks) => {
|
|
|
4167
4204
|
webhookUrls: activeWebhooks.map((webhook) => webhook.url)
|
|
4168
4205
|
};
|
|
4169
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
|
+
}
|
|
4170
4249
|
var generatePublicStoreIntegrationSecurity = (security) => {
|
|
4171
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
|
+
};
|
|
4172
4264
|
return {
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
frontend: security.orders.frontend
|
|
4176
|
-
} : void 0,
|
|
4177
|
-
active: security.active
|
|
4265
|
+
active: security.active,
|
|
4266
|
+
options
|
|
4178
4267
|
};
|
|
4179
4268
|
};
|
|
4180
4269
|
var generatePublicStoreIntegrationPayment = (payment) => {
|
|
@@ -4216,6 +4305,12 @@ var PixelReportMode = /* @__PURE__ */ ((PixelReportMode2) => {
|
|
|
4216
4305
|
PixelReportMode2["both"] = "both";
|
|
4217
4306
|
return PixelReportMode2;
|
|
4218
4307
|
})(PixelReportMode || {});
|
|
4308
|
+
var SecurityTreatment = /* @__PURE__ */ ((SecurityTreatment2) => {
|
|
4309
|
+
SecurityTreatment2["block"] = "block";
|
|
4310
|
+
SecurityTreatment2["warning"] = "warning";
|
|
4311
|
+
SecurityTreatment2["fake"] = "fake";
|
|
4312
|
+
return SecurityTreatment2;
|
|
4313
|
+
})(SecurityTreatment || {});
|
|
4219
4314
|
var WebhookEvent = /* @__PURE__ */ ((WebhookEvent2) => {
|
|
4220
4315
|
WebhookEvent2["ORDER_CREATED"] = "orderCreated";
|
|
4221
4316
|
WebhookEvent2["ORDER_UPDATED"] = "orderUpdated";
|
|
@@ -4990,6 +5085,7 @@ export {
|
|
|
4990
5085
|
ProductType,
|
|
4991
5086
|
ProductVariantView,
|
|
4992
5087
|
PromoRepository,
|
|
5088
|
+
SecurityTreatment,
|
|
4993
5089
|
ShippingMethodPolicy,
|
|
4994
5090
|
ShippingMethodRepository,
|
|
4995
5091
|
ShippingMethodStatus,
|
|
@@ -5053,7 +5149,10 @@ export {
|
|
|
5053
5149
|
getLegacyAiBillingFlat,
|
|
5054
5150
|
getShippingPrice,
|
|
5055
5151
|
isAttachmentType,
|
|
5152
|
+
isFakeOrder,
|
|
5153
|
+
isFakeOrderId,
|
|
5056
5154
|
isShippingAvailable,
|
|
5155
|
+
isWarningOrder,
|
|
5057
5156
|
mergeAiModelsBilling,
|
|
5058
5157
|
normalizeAttachmentPayload,
|
|
5059
5158
|
normalizeAttachmentPayloads,
|
|
@@ -5064,6 +5163,7 @@ export {
|
|
|
5064
5163
|
serializeAttachmentPayloads,
|
|
5065
5164
|
serializeImagePromptTemplateCreate,
|
|
5066
5165
|
serializeImagePromptTemplateUpdate,
|
|
5166
|
+
shouldSuppressPixelEvents,
|
|
5067
5167
|
transmitRootFromApiBaseUrl,
|
|
5068
5168
|
tryFixPhoneNumber,
|
|
5069
5169
|
validatePhoneNumber
|