@wix/himalaya-cli 0.1679.0 → 0.1680.0
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/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{4a260ef73a6f9f421a9119eac3d67bb9978e67b44c66a870038d189e6c77a0bd.bin → 4f58be42c5c8007715860f364adb1cdcb02156d76672fa38ba7ea412ee8fac2a.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +160 -110
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +1 -0
- package/templates/beauty-salon/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/beauty-salon-owner/dev/index.ts +2 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/branded-lite/dev/index.ts +9 -4
- package/templates/branded-lite/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/branded-lite/tier5-src/business-chat/index.ts +8 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +14 -0
- package/templates/branded-lite/tier5-src/wix-spaces-chat-thread/index.ts +3 -1
- package/templates/branded-lite/tier5-src/wix-spaces-food-orders/index.ts +15 -0
- package/templates/branded-lite/tier5-src/wix-spaces-forum/index.ts +22 -1
- package/templates/community-club-owner/dev/index.ts +2 -1
- package/templates/community-club-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/conference/dev/index.ts +2 -1
- package/templates/conference/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/conference/tier5-src/business-chat/index.ts +8 -0
- package/templates/events-meetups-owner/dev/index.ts +2 -1
- package/templates/events-meetups-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/gym-fitness/dev/index.ts +1 -0
- package/templates/gym-fitness/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/gym-fitness-owner/dev/index.ts +2 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/nonprofit-cause-owner/dev/index.ts +2 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/owner-lite/dev/index.ts +2 -1
- package/templates/owner-lite/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/podcast-creator-owner/dev/index.ts +2 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/portfolio-creative/dev/index.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/portfolio-creative-owner/dev/index.ts +2 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/restaurant/dev/index.ts +2 -1
- package/templates/restaurant/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/restaurant/tier5-src/wix-spaces-food-orders/index.ts +15 -0
- package/templates/restaurant-owner/dev/index.ts +2 -1
- package/templates/restaurant-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/retail-store/dev/index.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +14 -0
- package/templates/retail-store-owner/dev/index.ts +2 -1
- package/templates/retail-store-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
- package/templates/salon-spa/dev/index.ts +2 -1
- package/templates/salon-spa/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/salon-spa/tier5-src/business-chat/index.ts +8 -0
- package/templates/wholesale-store/dev/index.ts +3 -1
- package/templates/wholesale-store/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/wholesale-store/tier5-src/business-chat/index.ts +8 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-cart/index.ts +9 -0
- package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +14 -0
- package/templates/yoga-studio-owner/dev/index.ts +2 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-inbox-thread/index.ts +6 -2
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1680.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"artifactId": "himalaya-cli"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
"falconPackageHash": "
|
|
82
|
+
"falconPackageHash": "88e481ba051daa219fc6f0e90a2256bc136eca9d28de0c4e066d09c6"
|
|
83
83
|
}
|
|
@@ -33972,6 +33972,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
33972
33972
|
"share",
|
|
33973
33973
|
"local_database",
|
|
33974
33974
|
"open_url",
|
|
33975
|
+
"wix_platform",
|
|
33975
33976
|
"iap",
|
|
33976
33977
|
"app_info"
|
|
33977
33978
|
],
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// RN BI events whose fields exist only in a worker (epic #4973). The platform maps send every
|
|
2
|
+
// other RN event; these go through `wixPlatform.bi.log`, built inline with RN's own field names
|
|
3
|
+
// rather than by bundling a `@wix/bi-logger-*` package. The host owns every identity and common
|
|
4
|
+
// field (msid, uuid, installationId, contactId, _lv, ...), so none is named here.
|
|
5
|
+
import { bi, type BiLogEvent } from "@himalaya/wix-platform";
|
|
6
|
+
|
|
7
|
+
/** Sends one event without waiting for it and never throws: BI must not change a screen. A
|
|
8
|
+
* screen whose descriptor does not declare `wix_platform` is refused by the host, which is
|
|
9
|
+
* swallowed here like any other BI failure. */
|
|
10
|
+
export function logBi(event: BiLogEvent): void {
|
|
11
|
+
try {
|
|
12
|
+
void Promise.resolve(bi.log(event)).catch(() => undefined);
|
|
13
|
+
} catch {
|
|
14
|
+
/* BI is best-effort */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The HTTP status a Wix SDK error carries (`HTTP 429: ...`, or a `status` field), else 0. */
|
|
19
|
+
export function wixErrorStatus(error: unknown): number {
|
|
20
|
+
const own = Number((error as { status?: unknown; statusCode?: unknown } | null)?.status ?? (error as { statusCode?: unknown } | null)?.statusCode);
|
|
21
|
+
if (Number.isFinite(own) && own > 0) return own;
|
|
22
|
+
const match = /\bHTTP (\d{3})\b/.exec(String((error as Error | null)?.message ?? error ?? ""));
|
|
23
|
+
return match ? Number(match[1]) : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function applicationErrorCode(body: unknown): string {
|
|
27
|
+
const o = body as { details?: { applicationError?: { code?: unknown } }; applicationError?: { code?: unknown }; code?: unknown } | null;
|
|
28
|
+
const code = o?.details?.applicationError?.code ?? o?.applicationError?.code ?? o?.code;
|
|
29
|
+
return typeof code === "string" ? code : "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The code both native bridges put in an application error's message: `HTTP 400 [CODE]: description`
|
|
33
|
+
* (iOS JSWorker.swift `WixApiCapability.Error.application`, Android WebViewJSWorker.kt `Error.Application`). */
|
|
34
|
+
const BRIDGE_APPLICATION_CODE = /\bHTTP \d{3} \[([A-Za-z0-9_.:-]+)\]/;
|
|
35
|
+
|
|
36
|
+
/** The Wix application error code of a failed call (RN's `serializeError(e).code`): read from the
|
|
37
|
+
* error itself, else from the `[CODE]` the native bridges put after `HTTP <status> `, else from the
|
|
38
|
+
* JSON body after `HTTP <status>: ` (the bridges' raw-status arm and the web host's wixCall). ""
|
|
39
|
+
* when there is none. */
|
|
40
|
+
export function wixErrorCode(error: unknown): string {
|
|
41
|
+
const own = applicationErrorCode(error);
|
|
42
|
+
if (own) return own;
|
|
43
|
+
const message = String((error as Error | null)?.message ?? error ?? "");
|
|
44
|
+
const bracketed = BRIDGE_APPLICATION_CODE.exec(message);
|
|
45
|
+
if (bracketed) return bracketed[1];
|
|
46
|
+
const start = message.indexOf("{");
|
|
47
|
+
if (start < 0) return "";
|
|
48
|
+
try {
|
|
49
|
+
return applicationErrorCode(JSON.parse(message.slice(start)));
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// RN's `ErrorIndicationType` (mobile-apps-inbox services/errorIndications/errorIndications.type.ts).
|
|
56
|
+
const ERROR_INDICATIONS = new Set([
|
|
57
|
+
"ACCESS_TOKEN_EXPIRED", "ALLOWED_MESSAGING_TIME_WINDOW_EXPIRED", "ATTACHMENT_SIZE_EXCEEDS_ALLOWED_LIMIT", "CAMPAIGN_SUSPENDED",
|
|
58
|
+
"FACEBOOK_ALLOWED_WINDOW_EXPIRED", "GMAIL_ADV_PROTECTION", "INSTAGRAM_ALLOWED_WINDOW_EXPIRED", "INVALID_CHARACTERS",
|
|
59
|
+
"INVALID_PHONE_NUMBER", "INVALID_RECIPIENT_ADDRESS", "LANDLINE_OR_UNREACHABLE_CARRIER", "MESSAGE_FILTERED",
|
|
60
|
+
"MMS_NOT_SUPPORTED_RECEIVING_PHONE_NUMBER", "NETWORK_ISSUE", "NO_MATCHING_RECIPIENT_FOUND", "POLICY_VIOLATION", "QUOTA_EXCEEDED",
|
|
61
|
+
"RATE_LIMIT", "RATE_LIMIT_ERROR", "RECIPIENT_BLOCKED_MESSAGES", "RECIPIENT_NOT_AVAILABLE", "SERVICE_UNAVAILABLE",
|
|
62
|
+
"TELCO_LANDLINE_OR_UNREACHABLE_CARRIER", "TELCO_MEDIA_EXCEEDS_MESSAGING_PROVIDER_SIZE_LIMIT",
|
|
63
|
+
"TELCO_MESSAGE_DELIVERY_UNKNOWN_DESTINATION_HANDSET", "TELCO_MESSAGE_FILTERED", "TELCO_MESSAGE_FROM_NUMBER_STILL_BEING_CONFIGURED",
|
|
64
|
+
"TELCO_MESSAGE_FROM_UNREGISTERED_NUMBER", "TELCO_UNKNOWN_ERROR", "TELCO_UNREACHABLE_DESTINATION_HANDSET", "TOO_MANY_REQUESTS",
|
|
65
|
+
"TOTAL_ATTACHMENTS_SIZE_EXCEEDS_ALLOWED_LIMIT", "UNEXPECTED_ERROR_RETRY_LATER", "UNKNOWN_FAILED_CODE", "UNSUPPORTED",
|
|
66
|
+
"UNSUPPORTED_MESSAGE_TYPE", "USER_RATE_LIMIT",
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
/** 5:1604 inboxSendMessageErrorMsgShown (`@wix/bi-logger-crm-data` v2, endpoint ''), for a chat
|
|
70
|
+
* send that failed and said so. RN's `errorReason` is the failed message's indication code, and
|
|
71
|
+
* RN reports a code it does not know as UNSUPPORTED (`getErrorIndicationFromCode`); a send that
|
|
72
|
+
* never left the device is NETWORK_ISSUE and a 429 is RATE_LIMIT. */
|
|
73
|
+
export function logChatSendError(input: { chatroomId: string; contactId?: string; error: unknown; offline: boolean }): void {
|
|
74
|
+
const code = wixErrorCode(input.error);
|
|
75
|
+
const errorReason = input.offline ? "NETWORK_ISSUE"
|
|
76
|
+
: ERROR_INDICATIONS.has(code) ? code
|
|
77
|
+
: wixErrorStatus(input.error) === 429 ? "RATE_LIMIT"
|
|
78
|
+
: "UNSUPPORTED";
|
|
79
|
+
logBi({
|
|
80
|
+
evid: 1604,
|
|
81
|
+
src: 5,
|
|
82
|
+
endpoint: "",
|
|
83
|
+
params: { origin: "native", chatroomId: input.chatroomId, ...(input.contactId ? { contact_id: input.contactId } : {}), errorReason },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -11,6 +11,7 @@ import { createRedirectSession } from "@himalaya/wix-redirects";
|
|
|
11
11
|
import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
|
|
12
12
|
import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
|
|
13
13
|
import { formatCurrency } from "../_shared/engine-intl.js";
|
|
14
|
+
import { logBi, wixErrorCode } from "../_shared/wix-bi.js";
|
|
14
15
|
|
|
15
16
|
/** Wix Stores appDefId — the vertical that owns a cart/ecom order, and therefore the
|
|
16
17
|
* `appId` its cashier order is paid under. (Same constant Wix's own tooling uses.) */
|
|
@@ -458,6 +459,14 @@ const svc = defineService<State, {
|
|
|
458
459
|
const mayHaveLanded = added || writeMayHaveLanded(error);
|
|
459
460
|
const refreshed = mayHaveLanded ? await refresh(state).catch(() => null) : null;
|
|
460
461
|
if (refreshed?.appliedCode === code) return derive({ ...refreshed, promoBusy: false, promoCode: "", promoError: "" });
|
|
462
|
+
// 130:117 couponApplyingFailed (ecom-platform bi/storefront.ts:448, sent from cartActions.ts:345 when
|
|
463
|
+
// the add-coupon call throws). errorCode is RN's serializeError(e).code, the Wix application error code.
|
|
464
|
+
// Only the add-coupon call itself: once it answered, the coupon is on the cart, and a later step that
|
|
465
|
+
// throws (the cart refresh) is not a coupon that failed to apply.
|
|
466
|
+
if (!added) {
|
|
467
|
+
const errorCode = wixErrorCode(error);
|
|
468
|
+
logBi({ evid: 117, src: 130, endpoint: "ec-site", params: { origin: "checkout", couponCode: code, ...(errorCode ? { errorCode } : {}) } });
|
|
469
|
+
}
|
|
461
470
|
return derive({ ...state, promoBusy: false, promoError: mayHaveLanded
|
|
462
471
|
? copyParam("cart.promoUnconfirmed", "Could not confirm the promo code. Refresh your cart.")
|
|
463
472
|
: isOfflineFailure(error)
|
|
@@ -66166,7 +66166,8 @@ const SCREENS = runtimeSetting({
|
|
|
66166
66166
|
"integrity": "",
|
|
66167
66167
|
"contentType": "application/javascript+ts-bundle",
|
|
66168
66168
|
"declaredCapabilities": [
|
|
66169
|
-
"wix_api"
|
|
66169
|
+
"wix_api",
|
|
66170
|
+
"wix_platform"
|
|
66170
66171
|
],
|
|
66171
66172
|
"minBinaryVersion": "0.1.0",
|
|
66172
66173
|
"bundleVersion": "0.0.1"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// RN BI events whose fields exist only in a worker (epic #4973). The platform maps send every
|
|
2
|
+
// other RN event; these go through `wixPlatform.bi.log`, built inline with RN's own field names
|
|
3
|
+
// rather than by bundling a `@wix/bi-logger-*` package. The host owns every identity and common
|
|
4
|
+
// field (msid, uuid, installationId, contactId, _lv, ...), so none is named here.
|
|
5
|
+
import { bi, type BiLogEvent } from "@himalaya/wix-platform";
|
|
6
|
+
|
|
7
|
+
/** Sends one event without waiting for it and never throws: BI must not change a screen. A
|
|
8
|
+
* screen whose descriptor does not declare `wix_platform` is refused by the host, which is
|
|
9
|
+
* swallowed here like any other BI failure. */
|
|
10
|
+
export function logBi(event: BiLogEvent): void {
|
|
11
|
+
try {
|
|
12
|
+
void Promise.resolve(bi.log(event)).catch(() => undefined);
|
|
13
|
+
} catch {
|
|
14
|
+
/* BI is best-effort */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The HTTP status a Wix SDK error carries (`HTTP 429: ...`, or a `status` field), else 0. */
|
|
19
|
+
export function wixErrorStatus(error: unknown): number {
|
|
20
|
+
const own = Number((error as { status?: unknown; statusCode?: unknown } | null)?.status ?? (error as { statusCode?: unknown } | null)?.statusCode);
|
|
21
|
+
if (Number.isFinite(own) && own > 0) return own;
|
|
22
|
+
const match = /\bHTTP (\d{3})\b/.exec(String((error as Error | null)?.message ?? error ?? ""));
|
|
23
|
+
return match ? Number(match[1]) : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function applicationErrorCode(body: unknown): string {
|
|
27
|
+
const o = body as { details?: { applicationError?: { code?: unknown } }; applicationError?: { code?: unknown }; code?: unknown } | null;
|
|
28
|
+
const code = o?.details?.applicationError?.code ?? o?.applicationError?.code ?? o?.code;
|
|
29
|
+
return typeof code === "string" ? code : "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The code both native bridges put in an application error's message: `HTTP 400 [CODE]: description`
|
|
33
|
+
* (iOS JSWorker.swift `WixApiCapability.Error.application`, Android WebViewJSWorker.kt `Error.Application`). */
|
|
34
|
+
const BRIDGE_APPLICATION_CODE = /\bHTTP \d{3} \[([A-Za-z0-9_.:-]+)\]/;
|
|
35
|
+
|
|
36
|
+
/** The Wix application error code of a failed call (RN's `serializeError(e).code`): read from the
|
|
37
|
+
* error itself, else from the `[CODE]` the native bridges put after `HTTP <status> `, else from the
|
|
38
|
+
* JSON body after `HTTP <status>: ` (the bridges' raw-status arm and the web host's wixCall). ""
|
|
39
|
+
* when there is none. */
|
|
40
|
+
export function wixErrorCode(error: unknown): string {
|
|
41
|
+
const own = applicationErrorCode(error);
|
|
42
|
+
if (own) return own;
|
|
43
|
+
const message = String((error as Error | null)?.message ?? error ?? "");
|
|
44
|
+
const bracketed = BRIDGE_APPLICATION_CODE.exec(message);
|
|
45
|
+
if (bracketed) return bracketed[1];
|
|
46
|
+
const start = message.indexOf("{");
|
|
47
|
+
if (start < 0) return "";
|
|
48
|
+
try {
|
|
49
|
+
return applicationErrorCode(JSON.parse(message.slice(start)));
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// RN's `ErrorIndicationType` (mobile-apps-inbox services/errorIndications/errorIndications.type.ts).
|
|
56
|
+
const ERROR_INDICATIONS = new Set([
|
|
57
|
+
"ACCESS_TOKEN_EXPIRED", "ALLOWED_MESSAGING_TIME_WINDOW_EXPIRED", "ATTACHMENT_SIZE_EXCEEDS_ALLOWED_LIMIT", "CAMPAIGN_SUSPENDED",
|
|
58
|
+
"FACEBOOK_ALLOWED_WINDOW_EXPIRED", "GMAIL_ADV_PROTECTION", "INSTAGRAM_ALLOWED_WINDOW_EXPIRED", "INVALID_CHARACTERS",
|
|
59
|
+
"INVALID_PHONE_NUMBER", "INVALID_RECIPIENT_ADDRESS", "LANDLINE_OR_UNREACHABLE_CARRIER", "MESSAGE_FILTERED",
|
|
60
|
+
"MMS_NOT_SUPPORTED_RECEIVING_PHONE_NUMBER", "NETWORK_ISSUE", "NO_MATCHING_RECIPIENT_FOUND", "POLICY_VIOLATION", "QUOTA_EXCEEDED",
|
|
61
|
+
"RATE_LIMIT", "RATE_LIMIT_ERROR", "RECIPIENT_BLOCKED_MESSAGES", "RECIPIENT_NOT_AVAILABLE", "SERVICE_UNAVAILABLE",
|
|
62
|
+
"TELCO_LANDLINE_OR_UNREACHABLE_CARRIER", "TELCO_MEDIA_EXCEEDS_MESSAGING_PROVIDER_SIZE_LIMIT",
|
|
63
|
+
"TELCO_MESSAGE_DELIVERY_UNKNOWN_DESTINATION_HANDSET", "TELCO_MESSAGE_FILTERED", "TELCO_MESSAGE_FROM_NUMBER_STILL_BEING_CONFIGURED",
|
|
64
|
+
"TELCO_MESSAGE_FROM_UNREGISTERED_NUMBER", "TELCO_UNKNOWN_ERROR", "TELCO_UNREACHABLE_DESTINATION_HANDSET", "TOO_MANY_REQUESTS",
|
|
65
|
+
"TOTAL_ATTACHMENTS_SIZE_EXCEEDS_ALLOWED_LIMIT", "UNEXPECTED_ERROR_RETRY_LATER", "UNKNOWN_FAILED_CODE", "UNSUPPORTED",
|
|
66
|
+
"UNSUPPORTED_MESSAGE_TYPE", "USER_RATE_LIMIT",
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
/** 5:1604 inboxSendMessageErrorMsgShown (`@wix/bi-logger-crm-data` v2, endpoint ''), for a chat
|
|
70
|
+
* send that failed and said so. RN's `errorReason` is the failed message's indication code, and
|
|
71
|
+
* RN reports a code it does not know as UNSUPPORTED (`getErrorIndicationFromCode`); a send that
|
|
72
|
+
* never left the device is NETWORK_ISSUE and a 429 is RATE_LIMIT. */
|
|
73
|
+
export function logChatSendError(input: { chatroomId: string; contactId?: string; error: unknown; offline: boolean }): void {
|
|
74
|
+
const code = wixErrorCode(input.error);
|
|
75
|
+
const errorReason = input.offline ? "NETWORK_ISSUE"
|
|
76
|
+
: ERROR_INDICATIONS.has(code) ? code
|
|
77
|
+
: wixErrorStatus(input.error) === 429 ? "RATE_LIMIT"
|
|
78
|
+
: "UNSUPPORTED";
|
|
79
|
+
logBi({
|
|
80
|
+
evid: 1604,
|
|
81
|
+
src: 5,
|
|
82
|
+
endpoint: "",
|
|
83
|
+
params: { origin: "native", chatroomId: input.chatroomId, ...(input.contactId ? { contact_id: input.contactId } : {}), errorReason },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -22,7 +22,8 @@ import { defineService, navigate, type NavDirective, type PollDirective, type St
|
|
|
22
22
|
import { getMessages, sendChatMessage, listChatrooms, markChatroomRead, getChatToken, type ChatMessage } from "@himalaya/wix-chat-web";
|
|
23
23
|
import { formatMonthDayTime } from "../_shared/engine-intl.js";
|
|
24
24
|
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
25
|
-
import { ownerLoadError, ownerWriteError, writeMayHaveLanded } from "../_shared/owner-load-error.js";
|
|
25
|
+
import { isOfflineFailure, ownerLoadError, ownerWriteError, writeMayHaveLanded } from "../_shared/owner-load-error.js";
|
|
26
|
+
import { logChatSendError } from "../_shared/wix-bi.js";
|
|
26
27
|
import { stashCopy, copyParam } from "../_shared/himi-copy.js";
|
|
27
28
|
import { chatRealtimeConfig, createReloadGate, createSendIntents, createVisitToken, liveDirectives, postWithVisitToken, liveFallback, type ChatLiveMode, type ChatRealtimeConfig } from "../_shared/chat-live.js";
|
|
28
29
|
|
|
@@ -280,7 +281,10 @@ const svc = defineService<ThreadState, {
|
|
|
280
281
|
} catch (e) {
|
|
281
282
|
// The draft stays: the owner should not have to type it again. A send that may
|
|
282
283
|
// have landed says so, so a retry does not post it twice unknowingly.
|
|
283
|
-
|
|
284
|
+
if (writeMayHaveLanded(e)) return { ...live(), sendHint: ownerWriteError(e) };
|
|
285
|
+
const { id, kind } = input();
|
|
286
|
+
logChatSendError({ chatroomId: s.chatroomId, contactId: kind === "contact" ? id : "", error: e, offline: isOfflineFailure(e) });
|
|
287
|
+
return { ...live(), sendHint: `${copyParam("ownerInbox.sendFailed", "Couldn’t send")} — ${ownerWriteError(e)}` };
|
|
284
288
|
}
|
|
285
289
|
// Clear the composer only if it still holds what was sent — the owner may already be
|
|
286
290
|
// typing the next message — judged on the state AFTER the re-read's await.
|
|
@@ -41234,7 +41234,8 @@ const SCREENS = runtimeSetting({
|
|
|
41234
41234
|
"integrity": "",
|
|
41235
41235
|
"contentType": "application/javascript+ts-bundle",
|
|
41236
41236
|
"declaredCapabilities": [
|
|
41237
|
-
"wix_api"
|
|
41237
|
+
"wix_api",
|
|
41238
|
+
"wix_platform"
|
|
41238
41239
|
],
|
|
41239
41240
|
"minBinaryVersion": "0.1.0",
|
|
41240
41241
|
"bundleVersion": "0.0.1"
|
|
@@ -61525,7 +61526,8 @@ const SCREENS = runtimeSetting({
|
|
|
61525
61526
|
"integrity": "",
|
|
61526
61527
|
"contentType": "application/javascript+ts-bundle",
|
|
61527
61528
|
"declaredCapabilities": [
|
|
61528
|
-
"wix_api"
|
|
61529
|
+
"wix_api",
|
|
61530
|
+
"wix_platform"
|
|
61529
61531
|
],
|
|
61530
61532
|
"minBinaryVersion": "0.1.0",
|
|
61531
61533
|
"bundleVersion": "0.0.1"
|
|
@@ -90533,7 +90535,8 @@ const SCREENS = runtimeSetting({
|
|
|
90533
90535
|
"declaredCapabilities": [
|
|
90534
90536
|
"wix_api",
|
|
90535
90537
|
"wix_chat",
|
|
90536
|
-
"open_url"
|
|
90538
|
+
"open_url",
|
|
90539
|
+
"wix_platform"
|
|
90537
90540
|
],
|
|
90538
90541
|
"minBinaryVersion": "0.1.0",
|
|
90539
90542
|
"bundleVersion": "0.1.0"
|
|
@@ -92789,7 +92792,8 @@ const SCREENS = runtimeSetting({
|
|
|
92789
92792
|
"wix_api",
|
|
92790
92793
|
"wix_cashier",
|
|
92791
92794
|
"open_url",
|
|
92792
|
-
"local_database"
|
|
92795
|
+
"local_database",
|
|
92796
|
+
"wix_platform"
|
|
92793
92797
|
],
|
|
92794
92798
|
"minBinaryVersion": "0.1.0",
|
|
92795
92799
|
"bundleVersion": "0.0.1"
|
|
@@ -98292,6 +98296,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
98292
98296
|
"share",
|
|
98293
98297
|
"local_database",
|
|
98294
98298
|
"open_url",
|
|
98299
|
+
"wix_platform",
|
|
98295
98300
|
"iap",
|
|
98296
98301
|
"app_info"
|
|
98297
98302
|
],
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// RN BI events whose fields exist only in a worker (epic #4973). The platform maps send every
|
|
2
|
+
// other RN event; these go through `wixPlatform.bi.log`, built inline with RN's own field names
|
|
3
|
+
// rather than by bundling a `@wix/bi-logger-*` package. The host owns every identity and common
|
|
4
|
+
// field (msid, uuid, installationId, contactId, _lv, ...), so none is named here.
|
|
5
|
+
import { bi, type BiLogEvent } from "@himalaya/wix-platform";
|
|
6
|
+
|
|
7
|
+
/** Sends one event without waiting for it and never throws: BI must not change a screen. A
|
|
8
|
+
* screen whose descriptor does not declare `wix_platform` is refused by the host, which is
|
|
9
|
+
* swallowed here like any other BI failure. */
|
|
10
|
+
export function logBi(event: BiLogEvent): void {
|
|
11
|
+
try {
|
|
12
|
+
void Promise.resolve(bi.log(event)).catch(() => undefined);
|
|
13
|
+
} catch {
|
|
14
|
+
/* BI is best-effort */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The HTTP status a Wix SDK error carries (`HTTP 429: ...`, or a `status` field), else 0. */
|
|
19
|
+
export function wixErrorStatus(error: unknown): number {
|
|
20
|
+
const own = Number((error as { status?: unknown; statusCode?: unknown } | null)?.status ?? (error as { statusCode?: unknown } | null)?.statusCode);
|
|
21
|
+
if (Number.isFinite(own) && own > 0) return own;
|
|
22
|
+
const match = /\bHTTP (\d{3})\b/.exec(String((error as Error | null)?.message ?? error ?? ""));
|
|
23
|
+
return match ? Number(match[1]) : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function applicationErrorCode(body: unknown): string {
|
|
27
|
+
const o = body as { details?: { applicationError?: { code?: unknown } }; applicationError?: { code?: unknown }; code?: unknown } | null;
|
|
28
|
+
const code = o?.details?.applicationError?.code ?? o?.applicationError?.code ?? o?.code;
|
|
29
|
+
return typeof code === "string" ? code : "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The code both native bridges put in an application error's message: `HTTP 400 [CODE]: description`
|
|
33
|
+
* (iOS JSWorker.swift `WixApiCapability.Error.application`, Android WebViewJSWorker.kt `Error.Application`). */
|
|
34
|
+
const BRIDGE_APPLICATION_CODE = /\bHTTP \d{3} \[([A-Za-z0-9_.:-]+)\]/;
|
|
35
|
+
|
|
36
|
+
/** The Wix application error code of a failed call (RN's `serializeError(e).code`): read from the
|
|
37
|
+
* error itself, else from the `[CODE]` the native bridges put after `HTTP <status> `, else from the
|
|
38
|
+
* JSON body after `HTTP <status>: ` (the bridges' raw-status arm and the web host's wixCall). ""
|
|
39
|
+
* when there is none. */
|
|
40
|
+
export function wixErrorCode(error: unknown): string {
|
|
41
|
+
const own = applicationErrorCode(error);
|
|
42
|
+
if (own) return own;
|
|
43
|
+
const message = String((error as Error | null)?.message ?? error ?? "");
|
|
44
|
+
const bracketed = BRIDGE_APPLICATION_CODE.exec(message);
|
|
45
|
+
if (bracketed) return bracketed[1];
|
|
46
|
+
const start = message.indexOf("{");
|
|
47
|
+
if (start < 0) return "";
|
|
48
|
+
try {
|
|
49
|
+
return applicationErrorCode(JSON.parse(message.slice(start)));
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// RN's `ErrorIndicationType` (mobile-apps-inbox services/errorIndications/errorIndications.type.ts).
|
|
56
|
+
const ERROR_INDICATIONS = new Set([
|
|
57
|
+
"ACCESS_TOKEN_EXPIRED", "ALLOWED_MESSAGING_TIME_WINDOW_EXPIRED", "ATTACHMENT_SIZE_EXCEEDS_ALLOWED_LIMIT", "CAMPAIGN_SUSPENDED",
|
|
58
|
+
"FACEBOOK_ALLOWED_WINDOW_EXPIRED", "GMAIL_ADV_PROTECTION", "INSTAGRAM_ALLOWED_WINDOW_EXPIRED", "INVALID_CHARACTERS",
|
|
59
|
+
"INVALID_PHONE_NUMBER", "INVALID_RECIPIENT_ADDRESS", "LANDLINE_OR_UNREACHABLE_CARRIER", "MESSAGE_FILTERED",
|
|
60
|
+
"MMS_NOT_SUPPORTED_RECEIVING_PHONE_NUMBER", "NETWORK_ISSUE", "NO_MATCHING_RECIPIENT_FOUND", "POLICY_VIOLATION", "QUOTA_EXCEEDED",
|
|
61
|
+
"RATE_LIMIT", "RATE_LIMIT_ERROR", "RECIPIENT_BLOCKED_MESSAGES", "RECIPIENT_NOT_AVAILABLE", "SERVICE_UNAVAILABLE",
|
|
62
|
+
"TELCO_LANDLINE_OR_UNREACHABLE_CARRIER", "TELCO_MEDIA_EXCEEDS_MESSAGING_PROVIDER_SIZE_LIMIT",
|
|
63
|
+
"TELCO_MESSAGE_DELIVERY_UNKNOWN_DESTINATION_HANDSET", "TELCO_MESSAGE_FILTERED", "TELCO_MESSAGE_FROM_NUMBER_STILL_BEING_CONFIGURED",
|
|
64
|
+
"TELCO_MESSAGE_FROM_UNREGISTERED_NUMBER", "TELCO_UNKNOWN_ERROR", "TELCO_UNREACHABLE_DESTINATION_HANDSET", "TOO_MANY_REQUESTS",
|
|
65
|
+
"TOTAL_ATTACHMENTS_SIZE_EXCEEDS_ALLOWED_LIMIT", "UNEXPECTED_ERROR_RETRY_LATER", "UNKNOWN_FAILED_CODE", "UNSUPPORTED",
|
|
66
|
+
"UNSUPPORTED_MESSAGE_TYPE", "USER_RATE_LIMIT",
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
/** 5:1604 inboxSendMessageErrorMsgShown (`@wix/bi-logger-crm-data` v2, endpoint ''), for a chat
|
|
70
|
+
* send that failed and said so. RN's `errorReason` is the failed message's indication code, and
|
|
71
|
+
* RN reports a code it does not know as UNSUPPORTED (`getErrorIndicationFromCode`); a send that
|
|
72
|
+
* never left the device is NETWORK_ISSUE and a 429 is RATE_LIMIT. */
|
|
73
|
+
export function logChatSendError(input: { chatroomId: string; contactId?: string; error: unknown; offline: boolean }): void {
|
|
74
|
+
const code = wixErrorCode(input.error);
|
|
75
|
+
const errorReason = input.offline ? "NETWORK_ISSUE"
|
|
76
|
+
: ERROR_INDICATIONS.has(code) ? code
|
|
77
|
+
: wixErrorStatus(input.error) === 429 ? "RATE_LIMIT"
|
|
78
|
+
: "UNSUPPORTED";
|
|
79
|
+
logBi({
|
|
80
|
+
evid: 1604,
|
|
81
|
+
src: 5,
|
|
82
|
+
endpoint: "",
|
|
83
|
+
params: { origin: "native", chatroomId: input.chatroomId, ...(input.contactId ? { contact_id: input.contactId } : {}), errorReason },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -12,6 +12,7 @@ import { smartChatHistory } from '../_shared/business-chat-history.js';
|
|
|
12
12
|
import { hostSiteFromInput } from '../_shared/branded-lite-hosted.js';
|
|
13
13
|
import { productImage, searchStoreProducts } from '../_shared/himi-store.js';
|
|
14
14
|
import { queryServices } from '@himalaya/wix-bookings';
|
|
15
|
+
import { logBi, logChatSendError } from '../_shared/wix-bi.js';
|
|
15
16
|
|
|
16
17
|
type PendingIntent = BusinessChatIntent & { suggestionId?:string; answerTo?:string };
|
|
17
18
|
// Only what the screen reads. This state crosses into the worker on every keystroke, so a row carries no raw
|
|
@@ -424,6 +425,8 @@ async function deliver(pending:BusinessChatIntent,draft:string):Promise<void>{
|
|
|
424
425
|
}catch(error){
|
|
425
426
|
const lost=/member_sign_in_required|MemberAccessChanged|\b401\b|\b403\b/i.test(String(error));
|
|
426
427
|
result={id:pending.id,draft,error,outcome:lost?'signed_out':businessChatSendRejected(error)?'rejected':'unconfirmed'};
|
|
428
|
+
// 5:1604: a rejected send is the one the screen reports as failed (an unconfirmed one asks the member to check).
|
|
429
|
+
if(result.outcome==='rejected'&&sendEpoch===epoch)logChatSendError({chatroomId:pending.roomId,error,offline:false});
|
|
427
430
|
}
|
|
428
431
|
if(sendEpoch===epoch)void svc.settleSend(result);
|
|
429
432
|
}
|
|
@@ -556,6 +559,11 @@ const svc=defineService<State,Record<string,(s:State,a?:unknown)=>State|undefine
|
|
|
556
559
|
const ownName=[...s.messages].reverse().find(row=>row.mine&&row.senderName)?.senderName??'';
|
|
557
560
|
const pending={...newBusinessChatIntent(text,s.roomId,s.principal),senderName:ownName,...sendAnchor(s.messages,text,s.phase==='ready'),smartChatFromStart:s.transcriptSource==='members'&&s.smartChatEmpty};
|
|
558
561
|
draftRevision++;// a refresh that began before this send must not bring the sent text back into the composer
|
|
562
|
+
// 5:510 engageSendMessageClick, as RN's mobile-apps-inbox logSendMessage sends it for a member's typed message to the
|
|
563
|
+
// business (biLogger.service.ts:226-258, origin 'native' from biLogger.utils.ts). RN has no contact id here either.
|
|
564
|
+
// It is logged on the Send tap, before the network call, on purpose: RN calls engageSendMessageClick synchronously
|
|
565
|
+
// before sendMessageService.sendMessage, so a send the server then refuses has logged 510 and also logs 1604 (deliver).
|
|
566
|
+
logBi({evid:510,src:5,endpoint:'',params:{origin:'native',is_member:true,chatRoomType:'member to business',activity_type:'',appName:'',expand_mode:false,textLength:text.length,is_demo:false}});
|
|
559
567
|
void deliver(pending,s.draft);
|
|
560
568
|
return shape({...s,draft:'',pendingIntent:pending,messages:[...s.messages,pendingRow(pending)],error:'',notice:'',scrollSend:s.scrollSend+1});
|
|
561
569
|
},
|
|
@@ -11,6 +11,7 @@ import { createRedirectSession } from "@himalaya/wix-redirects";
|
|
|
11
11
|
import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
|
|
12
12
|
import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
|
|
13
13
|
import { formatCurrency } from "../_shared/engine-intl.js";
|
|
14
|
+
import { logBi, wixErrorCode } from "../_shared/wix-bi.js";
|
|
14
15
|
|
|
15
16
|
/** Wix Stores appDefId — the vertical that owns a cart/ecom order, and therefore the
|
|
16
17
|
* `appId` its cashier order is paid under. (Same constant Wix's own tooling uses.) */
|
|
@@ -458,6 +459,14 @@ const svc = defineService<State, {
|
|
|
458
459
|
const mayHaveLanded = added || writeMayHaveLanded(error);
|
|
459
460
|
const refreshed = mayHaveLanded ? await refresh(state).catch(() => null) : null;
|
|
460
461
|
if (refreshed?.appliedCode === code) return derive({ ...refreshed, promoBusy: false, promoCode: "", promoError: "" });
|
|
462
|
+
// 130:117 couponApplyingFailed (ecom-platform bi/storefront.ts:448, sent from cartActions.ts:345 when
|
|
463
|
+
// the add-coupon call throws). errorCode is RN's serializeError(e).code, the Wix application error code.
|
|
464
|
+
// Only the add-coupon call itself: once it answered, the coupon is on the cart, and a later step that
|
|
465
|
+
// throws (the cart refresh) is not a coupon that failed to apply.
|
|
466
|
+
if (!added) {
|
|
467
|
+
const errorCode = wixErrorCode(error);
|
|
468
|
+
logBi({ evid: 117, src: 130, endpoint: "ec-site", params: { origin: "checkout", couponCode: code, ...(errorCode ? { errorCode } : {}) } });
|
|
469
|
+
}
|
|
461
470
|
return derive({ ...state, promoBusy: false, promoError: mayHaveLanded
|
|
462
471
|
? copyParam("cart.promoUnconfirmed", "Could not confirm the promo code. Refresh your cart.")
|
|
463
472
|
: isOfflineFailure(error)
|
|
@@ -17,6 +17,7 @@ import { getStoreProduct, plainText, productImage, productPrice, wixMediaUrl, pr
|
|
|
17
17
|
import { cleanTitle } from "../_shared/himi-text.js";
|
|
18
18
|
import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
19
19
|
import { isBridgeUnavailable } from "../_shared/owner-load-error.js";
|
|
20
|
+
import { logBi } from "../_shared/wix-bi.js";
|
|
20
21
|
import { isProductSaved, toggleSavedProduct } from "../_shared/himi-store-saved.js";
|
|
21
22
|
import { openRichLink } from "../_shared/rich-content-link.js";
|
|
22
23
|
import { descriptionBody } from "../_shared/rich-body.js";
|
|
@@ -129,6 +130,18 @@ function outOfStockPick(groups: StoreOption[], selection: StoreOptionSelection):
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/** What to say under the picker: the groups still unchosen, else the choice made. */
|
|
133
|
+
/** 10:183 addToCartError (wix-store-merchant-app features/front/bi/index.ts:117, sent from
|
|
134
|
+
* ProductViewScreen when Add to cart fails validation). RN's `field` joins the failed checks by
|
|
135
|
+
* its own names: a required option left unchosen is `product_options`, a chosen combination with
|
|
136
|
+
* no stock left is `quantity`. Himi has no custom text fields, so `custom_field` never appears. */
|
|
137
|
+
function logAddToCartError(productId: string, groups: StoreOption[], selection: StoreOptionSelection): void {
|
|
138
|
+
const field = [
|
|
139
|
+
...(groups.some((g) => !selection[g.id]) ? ["product_options"] : []),
|
|
140
|
+
...(outOfStockPick(groups, selection) ? ["quantity"] : []),
|
|
141
|
+
].join(",");
|
|
142
|
+
if (field) logBi({ evid: 183, src: 10, endpoint: "ec-sf", params: { productId, message: "validation error", field } });
|
|
143
|
+
}
|
|
144
|
+
|
|
132
145
|
function optionsHint(groups: StoreOption[], selection: StoreOptionSelection): string {
|
|
133
146
|
const missing = groups.filter((g) => !selection[g.id]).map((g) => g.name);
|
|
134
147
|
if (!missing.length) {
|
|
@@ -792,6 +805,7 @@ const svc = onlineService<S, {
|
|
|
792
805
|
if (s.adding) return s;
|
|
793
806
|
// Missing choices show field errors; unavailable products still fail closed.
|
|
794
807
|
if (s.optionsIncomplete) {
|
|
808
|
+
if (!s.optionsUnknown) logAddToCartError(id, s.optionGroups, s.selection);
|
|
795
809
|
// With no groups in hand there is nothing for `optionsHint` to name, so the
|
|
796
810
|
// offline case needs its own reason rather than an empty string.
|
|
797
811
|
return derive({ ...s, showOptionErrors: true, optionValidationTarget: s.optionGroups.find(g => !s.selection[g.id])?.id ?? "", optionValidationRequest: (s.optionValidationRequest || 0) + 1, cartHint: s.optionsUnknown
|
|
@@ -16,7 +16,8 @@ import { formatMonthDay, formatMonthDayTime } from "../_shared/engine-intl.js";
|
|
|
16
16
|
import { initials } from "../_shared/himi-text.js";
|
|
17
17
|
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
18
18
|
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
19
|
-
import { writeMayHaveLanded } from "../_shared/owner-load-error.js";
|
|
19
|
+
import { isOfflineFailure, writeMayHaveLanded } from "../_shared/owner-load-error.js";
|
|
20
|
+
import { logChatSendError } from "../_shared/wix-bi.js";
|
|
20
21
|
import { CHAT_LIVE_POLL_ID, chatRealtimeConfig, createReloadGate, createSendIntents, createVisitToken, liveDirectives, postWithVisitToken, isTokenRejected, liveFallback, type ChatLiveMode, type ChatRealtimeConfig } from "../_shared/chat-live.js";
|
|
21
22
|
|
|
22
23
|
import { memberAccess, memberAccessChanged } from "../_shared/member-access.js";
|
|
@@ -310,6 +311,7 @@ const svc = defineService<S, {
|
|
|
310
311
|
// reuses its message id, so it cannot become a second message.
|
|
311
312
|
const msg = (e as { message?: string })?.message || "";
|
|
312
313
|
if (writeMayHaveLanded(e)) return { ...liveState(), resolvedChatroomId: chatroomId, sendHint: "Couldn't confirm it was sent — check before sending again." };
|
|
314
|
+
logChatSendError({ chatroomId, error: e, offline: isOfflineFailure(e) });
|
|
313
315
|
return { ...liveState(), resolvedChatroomId: chatroomId, sendHint: msg ? `Couldn't send — ${msg.slice(0, 80)}` : "Couldn't send — try again." };
|
|
314
316
|
}
|
|
315
317
|
await assertThreadMember(s);
|
|
@@ -39,6 +39,7 @@ import { hostedCheckoutOpener, hostedSitePageOpener, isHostedWorker } from "../_
|
|
|
39
39
|
import { assertOrderMember, orderAccessDenied, orderMember, ownedOrderCache, type OrderMember } from "../_shared/member-orders.js";
|
|
40
40
|
import { formatDateMedium, formatWeekdayDateTime } from "../_shared/engine-intl.js";
|
|
41
41
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
42
|
+
import { logBi } from "../_shared/wix-bi.js";
|
|
42
43
|
|
|
43
44
|
interface LineRow {
|
|
44
45
|
id: string;
|
|
@@ -511,6 +512,19 @@ async function refreshOrderingFor(cart: WixCartV2): Promise<boolean> {
|
|
|
511
512
|
}
|
|
512
513
|
}
|
|
513
514
|
|
|
515
|
+
/** The restaurants member module's cart events (`@wix/bi-logger-olo-members-view`, src 61), sent once
|
|
516
|
+
* Wix confirmed the change: 61:910 cartRemoveDish for a dish that left the order, 61:909
|
|
517
|
+
* cartDishQuantitiesUpdate for a new quantity (wix-one-app-restaurants-member
|
|
518
|
+
* screens/DishScreen/useHooks.ts:153 and :170). `dishId` is the menu item, as RN's `itemId`. RN's
|
|
519
|
+
* restaurant defaults (restaurantId, locationGuid, oloSessionId) have no Himi source. A minus that
|
|
520
|
+
* empties the line removes it, so it is a removal here, where RN's stepper sends 909 at 0 first. */
|
|
521
|
+
function logDishChange(line: WixCartV2LineItem, deleted: boolean, delta: number, quantity: number): void {
|
|
522
|
+
const dishId = line.source?.catalogReference?.catalogItemId ?? "";
|
|
523
|
+
if (!dishId) return;
|
|
524
|
+
if (deleted) logBi({ evid: 910, src: 61, endpoint: "olo-members-view", params: { dishId } });
|
|
525
|
+
else logBi({ evid: 909, src: 61, endpoint: "olo-members-view", params: { dishId, action: delta < 0 ? "decrease" : "increase", quantity } });
|
|
526
|
+
}
|
|
527
|
+
|
|
514
528
|
function changeQuantity(id: string, delta: number, remove = false): Promise<S> {
|
|
515
529
|
// Actions can overlap. Serialize writes and calculate from Wix's current quantity,
|
|
516
530
|
// so two rapid taps never both send the same absolute newQuantity.
|
|
@@ -530,6 +544,7 @@ function changeQuantity(id: string, delta: number, remove = false): Promise<S> {
|
|
|
530
544
|
? await removeLineItemsFromCurrentCartV2([id])
|
|
531
545
|
: await updateLineItemsInCurrentCartV2([{ lineItemId: id, quantity: next }]);
|
|
532
546
|
const cart = response.cart ?? await getCurrentCartV2();
|
|
547
|
+
if (isRestaurantLine(line)) logDishChange(line, deleted, delta, next);
|
|
533
548
|
const hint = deleted ? copyParam("foodOrders.itemRemoved", "Removed from your order.") : "";
|
|
534
549
|
// The write already landed: a failed ordering refresh must not hide the updated cart.
|
|
535
550
|
const refreshFailed = await refreshOrderingFor(cart);
|
|
@@ -4,6 +4,7 @@ import { defineService } from "@himalaya/state";
|
|
|
4
4
|
import { withEmptyFlags } from "../_shared/empty-flags.js";
|
|
5
5
|
import { queryPosts, type WixPost } from "@himalaya/wix-forum";
|
|
6
6
|
import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
7
|
+
import { logBi } from "../_shared/wix-bi.js";
|
|
7
8
|
|
|
8
9
|
interface Row {
|
|
9
10
|
id: string;
|
|
@@ -89,10 +90,26 @@ function filterRows(all: Row[], q: string): Row[] {
|
|
|
89
90
|
return all.filter((r) => r.name.toLowerCase().includes(t) || (r.subtitle || "").toLowerCase().includes(t));
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
/** The last term 69:511 was sent for. The search field already debounces its changes (200 ms), so a
|
|
94
|
+
* filter call is a settled term; this keeps a repeated one (a re-sent value) from counting twice.
|
|
95
|
+
* Module-level, so `load` clears it: a reloaded or re-opened screen starts a new search session, and
|
|
96
|
+
* its first search counts even when the term is the one searched before. */
|
|
97
|
+
let lastSearchTerm = "";
|
|
98
|
+
|
|
99
|
+
/** 69:511 SEARCH_RESULTS (wix-one-app-forum services/bi.ts:253, sent from forum-search.tsx after each
|
|
100
|
+
* search answers). RN counts the server's total; Himi searches the posts it loaded, so the count is
|
|
101
|
+
* of those. RN sends the term as typed; here it is trimmed, and keeps its case. */
|
|
102
|
+
function logSearchResults(term: string, count: number): void {
|
|
103
|
+
if (!term || term === lastSearchTerm) return;
|
|
104
|
+
lastSearchTerm = term;
|
|
105
|
+
logBi({ evid: 511, src: 69, endpoint: "forums-uou", params: { origin: "search_results", result_count_posts: count, search_term: term } });
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
const svc = defineService<S, { load: (s: S) => Promise<S>; filter: (s: S, arg?: unknown) => S }>("spacesForum", withEmptyFlags({
|
|
93
109
|
state: { status: "loading", all: [], posts: [], emptyText: "" },
|
|
94
110
|
actions: {
|
|
95
111
|
load: async (s) => {
|
|
112
|
+
lastSearchTerm = "";
|
|
96
113
|
try {
|
|
97
114
|
const r = await queryPosts({ query: { cursorPaging: { limit: 50 } } } as never);
|
|
98
115
|
const all = (((r as unknown as { posts?: WixPost[] }).posts) ?? []).map(norm);
|
|
@@ -100,8 +117,12 @@ const svc = defineService<S, { load: (s: S) => Promise<S>; filter: (s: S, arg?:
|
|
|
100
117
|
} catch { return { ...s, status: "ready", all: [], posts: [], emptyText: "No posts yet" }; }
|
|
101
118
|
},
|
|
102
119
|
filter: (s, arg) => {
|
|
103
|
-
const
|
|
120
|
+
const typed = (typeof arg === "string" ? arg : (arg as { value?: string })?.value || "").trim();
|
|
121
|
+
const q = typed.toLowerCase();
|
|
104
122
|
const filtered = filterRows(s.all, q);
|
|
123
|
+
// Clearing the field ends the search, so typing the same term again is a new one.
|
|
124
|
+
if (!typed) lastSearchTerm = "";
|
|
125
|
+
else if (s.status === "ready") logSearchResults(typed, filtered.length);
|
|
105
126
|
return { ...s, posts: filtered, emptyText: filtered.length ? "" : "No results" };
|
|
106
127
|
},
|
|
107
128
|
},
|
|
@@ -66166,7 +66166,8 @@ const SCREENS = runtimeSetting({
|
|
|
66166
66166
|
"integrity": "",
|
|
66167
66167
|
"contentType": "application/javascript+ts-bundle",
|
|
66168
66168
|
"declaredCapabilities": [
|
|
66169
|
-
"wix_api"
|
|
66169
|
+
"wix_api",
|
|
66170
|
+
"wix_platform"
|
|
66170
66171
|
],
|
|
66171
66172
|
"minBinaryVersion": "0.1.0",
|
|
66172
66173
|
"bundleVersion": "0.0.1"
|