@wix/himalaya-cli 0.1524.0 → 0.1526.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +14 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +22 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/worker-subtree-safe-types.generated.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +5 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/cashier-charges.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +7 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +35 -9
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +14 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +34 -8
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +13 -0
- package/dist/cli.mjs +136 -39
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/designing-himi-screens.md +43 -18
- package/guides/recipe-dynamic-list.md +7 -7
- package/guides/recipe-four-state.md +47 -41
- package/guides/recipe-search.md +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +69 -40
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +9 -1
- package/templates/beauty-salon/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +153 -132
- package/templates/branded-lite/dev/index.ts +165 -88
- package/templates/branded-lite/tier5-src/business-chat/index.ts +4 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +9 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +153 -132
- package/templates/community-club/dev/index.ts +40 -21
- package/templates/community-club/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/events-meetups/dev/index.ts +36 -19
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/gym-fitness/dev/index.ts +73 -42
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +9 -1
- package/templates/gym-fitness/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +153 -132
- package/templates/nonprofit-cause/dev/index.ts +47 -29
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/podcast-creator/dev/index.ts +47 -29
- package/templates/podcast-creator/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/portfolio-creative/dev/index.ts +52 -27
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +153 -132
- package/templates/restaurant/dev/index.ts +48 -25
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/retail-store/dev/index.ts +44 -23
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +69 -10
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +153 -132
- package/templates/yoga-studio/dev/index.ts +57 -34
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +9 -1
- package/templates/yoga-studio/tier5-src/himi-branded-lite-place-summary/index.ts +12 -1
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +69 -10
|
@@ -226,6 +226,20 @@ export declare function emptyState(props: {
|
|
|
226
226
|
actionStyle?: "primary" | "secondary" | "plain";
|
|
227
227
|
actionSize?: "sm" | "md";
|
|
228
228
|
}): Component;
|
|
229
|
+
/** #4349 — the ONE standard load-error layout. Every prop is optional: an absent
|
|
230
|
+
* title/body/ctaLabel falls back to the variant's default copy. */
|
|
231
|
+
export declare function errorState(props?: {
|
|
232
|
+
variant?: "server" | "offline" | "permission" | "signIn";
|
|
233
|
+
variantPath?: string;
|
|
234
|
+
title?: string;
|
|
235
|
+
body?: string;
|
|
236
|
+
cta?: {
|
|
237
|
+
actionId: string;
|
|
238
|
+
params?: Record<string, string>;
|
|
239
|
+
};
|
|
240
|
+
ctaLabel?: string;
|
|
241
|
+
placement?: "screen" | "section";
|
|
242
|
+
}): Component;
|
|
229
243
|
export declare function appIntent(pkg: string, type: string, props: unknown, opts?: {
|
|
230
244
|
id?: string;
|
|
231
245
|
}): Component;
|
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts
CHANGED
|
@@ -625,6 +625,24 @@ export interface EmptyStateProps {
|
|
|
625
625
|
/** The CTA's Button `size`. Default `"sm"`. */
|
|
626
626
|
actionSize?: "sm" | "md";
|
|
627
627
|
}
|
|
628
|
+
/**
|
|
629
|
+
* The ONE standard load-error layout (#4349): a centred stack of a 20px glyph, title,
|
|
630
|
+
* body and one pill CTA. No icon tile, no card. Every prop is optional: an absent
|
|
631
|
+
* `title` / `body` / `ctaLabel` falls back to the variant's default copy.
|
|
632
|
+
*/
|
|
633
|
+
export interface ErrorStateProps {
|
|
634
|
+
/** Default `"server"`. An unknown value is treated as `"server"`. */
|
|
635
|
+
variant?: "server" | "offline" | "permission" | "signIn";
|
|
636
|
+
/** `$service:` binding that selects the variant at runtime; wins over `variant`. */
|
|
637
|
+
variantPath?: string;
|
|
638
|
+
title?: string;
|
|
639
|
+
body?: string;
|
|
640
|
+
/** The CTA's action. Absent → no button. */
|
|
641
|
+
cta?: Action;
|
|
642
|
+
ctaLabel?: string;
|
|
643
|
+
/** `"screen"` (default, ~96px from the top) or `"section"` (~24px). */
|
|
644
|
+
placement?: "screen" | "section";
|
|
645
|
+
}
|
|
628
646
|
export interface InterpolatedText {
|
|
629
647
|
template: string;
|
|
630
648
|
params?: Record<string, string>;
|
|
@@ -2417,6 +2435,10 @@ export type CoreComponentBody = {
|
|
|
2417
2435
|
package: "himalaya";
|
|
2418
2436
|
type: "EmptyState";
|
|
2419
2437
|
props: EmptyStateProps;
|
|
2438
|
+
} | {
|
|
2439
|
+
package: "himalaya";
|
|
2440
|
+
type: "ErrorState";
|
|
2441
|
+
props: ErrorStateProps;
|
|
2420
2442
|
} | {
|
|
2421
2443
|
package: "himalaya";
|
|
2422
2444
|
type: "Text";
|
|
@@ -83,6 +83,10 @@ export declare const WORKER_SUBTREE_SAFE_TYPE_RULES: {
|
|
|
83
83
|
readonly children: readonly [];
|
|
84
84
|
readonly actions: readonly ["action"];
|
|
85
85
|
};
|
|
86
|
+
readonly ErrorState: {
|
|
87
|
+
readonly children: readonly [];
|
|
88
|
+
readonly actions: readonly ["cta"];
|
|
89
|
+
};
|
|
86
90
|
readonly Banner: {
|
|
87
91
|
readonly children: readonly [];
|
|
88
92
|
readonly actions: readonly ["action"];
|
|
@@ -76,10 +76,14 @@ export type IapEligibility = {
|
|
|
76
76
|
};
|
|
77
77
|
/** `open`: a pending order the cashier can charge. `granted`: the vertical already gives the
|
|
78
78
|
* member access, so nothing is sold. */
|
|
79
|
-
export type OrderAttempt = (
|
|
79
|
+
export type OrderAttempt = (
|
|
80
|
+
/** `placed`: the order was created by this call, so it cannot have a charge yet. Only an adapter
|
|
81
|
+
* that never returns an existing order may say so; an order it reuses must be listed first. */
|
|
82
|
+
{
|
|
80
83
|
status: "open";
|
|
81
84
|
cashierOrderId: string;
|
|
82
85
|
verticalRef: VerticalRef;
|
|
86
|
+
placed?: boolean;
|
|
83
87
|
} | {
|
|
84
88
|
status: "granted";
|
|
85
89
|
} | {
|
|
@@ -15,6 +15,9 @@ export type AppleIapChargeResult = {
|
|
|
15
15
|
status: "closed" | "inOtherPayment" | "refused" | "notConfigured" | "invalidResponse" | "unavailable" | "notEnabled" | "sessionChanged";
|
|
16
16
|
};
|
|
17
17
|
export declare function ensureAppleIapCharge(bridge: SessionBoundBridge, route: CashierRoute, orderId: string): Promise<AppleIapChargeResult>;
|
|
18
|
+
/** An order created in this same call has no charges, so List would only cost a round trip. A
|
|
19
|
+
* lost answer is still reconciled through List. */
|
|
20
|
+
export declare function chargePlacedOrder(bridge: SessionBoundBridge, route: CashierRoute, orderId: string): Promise<AppleIapChargeResult>;
|
|
18
21
|
export declare function listOrderCharges(bridge: SessionBoundBridge, route: CashierRoute, orderId: string): Promise<{
|
|
19
22
|
status: "ok";
|
|
20
23
|
charges: CashierCharge[];
|
|
@@ -9313,6 +9313,7 @@ var CORE_COMPONENTS = /* @__PURE__ */ new Set([
|
|
|
9313
9313
|
"himalaya.Divider",
|
|
9314
9314
|
"himalaya.Spacer",
|
|
9315
9315
|
"himalaya.EmptyState",
|
|
9316
|
+
"himalaya.ErrorState",
|
|
9316
9317
|
"himalaya.Text",
|
|
9317
9318
|
"himalaya.Image",
|
|
9318
9319
|
"himalaya.Icon",
|
|
@@ -10744,6 +10745,12 @@ var WORKER_SUBTREE_SAFE_TYPE_RULES = {
|
|
|
10744
10745
|
"action"
|
|
10745
10746
|
]
|
|
10746
10747
|
},
|
|
10748
|
+
"ErrorState": {
|
|
10749
|
+
"children": [],
|
|
10750
|
+
"actions": [
|
|
10751
|
+
"cta"
|
|
10752
|
+
]
|
|
10753
|
+
},
|
|
10747
10754
|
"Banner": {
|
|
10748
10755
|
"children": [],
|
|
10749
10756
|
"actions": [
|
|
@@ -810,10 +810,23 @@ function enabledPricing(source, deps) {
|
|
|
810
810
|
let selling = "active";
|
|
811
811
|
let lookupRevision = 0;
|
|
812
812
|
let answeredRoutes;
|
|
813
|
+
let inFlight;
|
|
814
|
+
const sharedAnswer = (request) => {
|
|
815
|
+
const key = JSON.stringify(request);
|
|
816
|
+
if (inFlight?.key === key) return inFlight.answer;
|
|
817
|
+
const answer = Promise.resolve(source.mapping.resolve(request));
|
|
818
|
+
const asked = { key, answer };
|
|
819
|
+
inFlight = asked;
|
|
820
|
+
const settle = () => {
|
|
821
|
+
if (inFlight === asked) inFlight = void 0;
|
|
822
|
+
};
|
|
823
|
+
answer.then(settle, settle);
|
|
824
|
+
return answer;
|
|
825
|
+
};
|
|
813
826
|
const mapping = {
|
|
814
827
|
resolve: async (request) => {
|
|
815
828
|
const asked = lookupRevision;
|
|
816
|
-
const answer = await
|
|
829
|
+
const answer = await sharedAnswer(request);
|
|
817
830
|
if (asked === lookupRevision) answeredRoutes = routesAnswered(answer);
|
|
818
831
|
return answer;
|
|
819
832
|
}
|
|
@@ -1570,12 +1583,19 @@ function storesAppleSalesEnabled() {
|
|
|
1570
1583
|
|
|
1571
1584
|
// ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
|
|
1572
1585
|
async function ensureAppleIapCharge(bridge, route, orderId) {
|
|
1573
|
-
|
|
1574
|
-
if (
|
|
1586
|
+
const invalid = invalidRequest(route, orderId);
|
|
1587
|
+
if (invalid) return invalid;
|
|
1575
1588
|
const listed = await listOrderCharges(bridge, route, orderId);
|
|
1576
1589
|
if (listed.status !== "ok") return listed;
|
|
1577
1590
|
return decideFromCharges(listed.charges) ?? chargeThenReconcile(bridge, route, orderId);
|
|
1578
1591
|
}
|
|
1592
|
+
async function chargePlacedOrder(bridge, route, orderId) {
|
|
1593
|
+
return invalidRequest(route, orderId) ?? chargeThenReconcile(bridge, route, orderId);
|
|
1594
|
+
}
|
|
1595
|
+
function invalidRequest(route, orderId) {
|
|
1596
|
+
if (!isRoutePrefix2(route.prefix)) return { status: "notConfigured" };
|
|
1597
|
+
return orderId ? null : { status: "invalidResponse" };
|
|
1598
|
+
}
|
|
1579
1599
|
async function listOrderCharges(bridge, route, orderId) {
|
|
1580
1600
|
const answer = await bridge.call("GET", chargesPath(route, orderId));
|
|
1581
1601
|
if (answer.status !== "ok") return failureOf(answer);
|
|
@@ -1892,7 +1912,7 @@ function createWixOrderBackend(deps) {
|
|
|
1892
1912
|
async function startOrderFor(sale) {
|
|
1893
1913
|
const ordered = await orderFor(sale);
|
|
1894
1914
|
if (isStop(ordered)) return contextResult(sale.catalogRef, ordered);
|
|
1895
|
-
const charged = await chargeFor(sale, ordered, { reordered: false });
|
|
1915
|
+
const charged = await chargeFor(sale, ordered.ref, { reordered: false, placed: ordered.placed });
|
|
1896
1916
|
if (isStop(charged)) return contextResult(sale.catalogRef, charged);
|
|
1897
1917
|
return startFor(sale, charged);
|
|
1898
1918
|
}
|
|
@@ -1952,7 +1972,9 @@ function createWixOrderBackend(deps) {
|
|
|
1952
1972
|
return true;
|
|
1953
1973
|
};
|
|
1954
1974
|
const attempt3 = existing?.cashierOrderId && existing.verticalRef ? await reopenOrOpen(sale, { cashierOrderId: existing.cashierOrderId, verticalRef: existing.verticalRef }) : await sale.adapter.openOrder(sale.item, sale.bridge, beforeCreate);
|
|
1955
|
-
|
|
1975
|
+
if (prevented) return prevented;
|
|
1976
|
+
const ref = recordOrder(sale, existing, attempt3);
|
|
1977
|
+
return isStop(ref) ? ref : { ref, placed: isPlaced(attempt3) };
|
|
1956
1978
|
}
|
|
1957
1979
|
async function reopenOrOpen(sale, order) {
|
|
1958
1980
|
const reopened = await sale.adapter.reopenOrder(order, sale.bridge);
|
|
@@ -1978,7 +2000,7 @@ function createWixOrderBackend(deps) {
|
|
|
1978
2000
|
});
|
|
1979
2001
|
}
|
|
1980
2002
|
async function chargeFor(sale, ref, options) {
|
|
1981
|
-
const charge = await ensureAppleIapCharge(sale.bridge, deps.cashier, ref.cashierOrderId ?? "");
|
|
2003
|
+
const charge = await (options.placed ? chargePlacedOrder : ensureAppleIapCharge)(sale.bridge, deps.cashier, ref.cashierOrderId ?? "");
|
|
1982
2004
|
switch (charge.status) {
|
|
1983
2005
|
case "pending":
|
|
1984
2006
|
return persist(sale, { ...ref, stage: "charged", wixTransactionId: charge.transactionId, updatedAt: now() });
|
|
@@ -2002,8 +2024,9 @@ function createWixOrderBackend(deps) {
|
|
|
2002
2024
|
async function reorder(sale) {
|
|
2003
2025
|
if (sale.adapter.repeatable) return stopWith("rejected", "orderClosed");
|
|
2004
2026
|
if (!forget(sale, sale.catalogRef)) return stopWith("rejected", "storageUnavailable");
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2027
|
+
const attempt3 = await sale.adapter.openOrder(sale.item, sale.bridge);
|
|
2028
|
+
const recorded = recordOrder(sale, void 0, attempt3);
|
|
2029
|
+
return isStop(recorded) ? recorded : chargeFor(sale, recorded, { reordered: true, placed: isPlaced(attempt3) });
|
|
2007
2030
|
}
|
|
2008
2031
|
async function alreadyPaid(sale, ref) {
|
|
2009
2032
|
const access = await sale.adapter.readAccess(ref.verticalRef ?? {}, sale.bridge);
|
|
@@ -2237,6 +2260,9 @@ function unassociatedHold(transaction, updatedAt) {
|
|
|
2237
2260
|
function acknowledgementOf(transaction, scopeKey) {
|
|
2238
2261
|
return { transactionId: transaction.transactionId, productId: transaction.productId, environment: transaction.environment, scopeKey };
|
|
2239
2262
|
}
|
|
2263
|
+
function isPlaced(attempt3) {
|
|
2264
|
+
return attempt3.status === "open" && attempt3.placed === true;
|
|
2265
|
+
}
|
|
2240
2266
|
function refAt(partition, key) {
|
|
2241
2267
|
return partition.refs().find((ref) => ref.key === key);
|
|
2242
2268
|
}
|
|
@@ -3267,7 +3293,7 @@ async function readAccess3(verticalRef, bridge) {
|
|
|
3267
3293
|
async function placedOrder(body, bridge) {
|
|
3268
3294
|
if (!isObject7(body) || !isNonEmpty3(body.orderId)) return ORDER_REFUSED;
|
|
3269
3295
|
const verticalRef = { orderId: body.orderId };
|
|
3270
|
-
if (isNonEmpty3(body.paymentGatewayOrderId)) return { status: "open", cashierOrderId: body.paymentGatewayOrderId, verticalRef };
|
|
3296
|
+
if (isNonEmpty3(body.paymentGatewayOrderId)) return { status: "open", cashierOrderId: body.paymentGatewayOrderId, verticalRef, placed: true };
|
|
3271
3297
|
const access = await readAccess3(verticalRef, bridge);
|
|
3272
3298
|
if (access === "granted") return GRANTED;
|
|
3273
3299
|
return access === "sessionChanged" || access === "unavailable" ? { status: access } : ORDER_REFUSED;
|
|
@@ -787,10 +787,23 @@ function enabledPricing(source, deps) {
|
|
|
787
787
|
let selling = "active";
|
|
788
788
|
let lookupRevision = 0;
|
|
789
789
|
let answeredRoutes;
|
|
790
|
+
let inFlight;
|
|
791
|
+
const sharedAnswer = (request) => {
|
|
792
|
+
const key = JSON.stringify(request);
|
|
793
|
+
if (inFlight?.key === key) return inFlight.answer;
|
|
794
|
+
const answer = Promise.resolve(source.mapping.resolve(request));
|
|
795
|
+
const asked = { key, answer };
|
|
796
|
+
inFlight = asked;
|
|
797
|
+
const settle = () => {
|
|
798
|
+
if (inFlight === asked) inFlight = void 0;
|
|
799
|
+
};
|
|
800
|
+
answer.then(settle, settle);
|
|
801
|
+
return answer;
|
|
802
|
+
};
|
|
790
803
|
const mapping = {
|
|
791
804
|
resolve: async (request) => {
|
|
792
805
|
const asked = lookupRevision;
|
|
793
|
-
const answer = await
|
|
806
|
+
const answer = await sharedAnswer(request);
|
|
794
807
|
if (asked === lookupRevision) answeredRoutes = routesAnswered(answer);
|
|
795
808
|
return answer;
|
|
796
809
|
}
|
|
@@ -1352,10 +1352,23 @@ function enabledPricing(source, deps) {
|
|
|
1352
1352
|
let selling = "active";
|
|
1353
1353
|
let lookupRevision = 0;
|
|
1354
1354
|
let answeredRoutes;
|
|
1355
|
+
let inFlight;
|
|
1356
|
+
const sharedAnswer = (request) => {
|
|
1357
|
+
const key = JSON.stringify(request);
|
|
1358
|
+
if (inFlight?.key === key) return inFlight.answer;
|
|
1359
|
+
const answer = Promise.resolve(source.mapping.resolve(request));
|
|
1360
|
+
const asked = { key, answer };
|
|
1361
|
+
inFlight = asked;
|
|
1362
|
+
const settle = () => {
|
|
1363
|
+
if (inFlight === asked) inFlight = void 0;
|
|
1364
|
+
};
|
|
1365
|
+
answer.then(settle, settle);
|
|
1366
|
+
return answer;
|
|
1367
|
+
};
|
|
1355
1368
|
const mapping = {
|
|
1356
1369
|
resolve: async (request) => {
|
|
1357
1370
|
const asked = lookupRevision;
|
|
1358
|
-
const answer = await
|
|
1371
|
+
const answer = await sharedAnswer(request);
|
|
1359
1372
|
if (asked === lookupRevision) answeredRoutes = routesAnswered(answer);
|
|
1360
1373
|
return answer;
|
|
1361
1374
|
}
|
|
@@ -2130,12 +2143,19 @@ function itemPaymentEnabled() {
|
|
|
2130
2143
|
|
|
2131
2144
|
// ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
|
|
2132
2145
|
async function ensureAppleIapCharge(bridge, route, orderId) {
|
|
2133
|
-
|
|
2134
|
-
if (
|
|
2146
|
+
const invalid = invalidRequest(route, orderId);
|
|
2147
|
+
if (invalid) return invalid;
|
|
2135
2148
|
const listed = await listOrderCharges(bridge, route, orderId);
|
|
2136
2149
|
if (listed.status !== "ok") return listed;
|
|
2137
2150
|
return decideFromCharges(listed.charges) ?? chargeThenReconcile(bridge, route, orderId);
|
|
2138
2151
|
}
|
|
2152
|
+
async function chargePlacedOrder(bridge, route, orderId) {
|
|
2153
|
+
return invalidRequest(route, orderId) ?? chargeThenReconcile(bridge, route, orderId);
|
|
2154
|
+
}
|
|
2155
|
+
function invalidRequest(route, orderId) {
|
|
2156
|
+
if (!isRoutePrefix2(route.prefix)) return { status: "notConfigured" };
|
|
2157
|
+
return orderId ? null : { status: "invalidResponse" };
|
|
2158
|
+
}
|
|
2139
2159
|
async function listOrderCharges(bridge, route, orderId) {
|
|
2140
2160
|
const answer = await bridge.call("GET", chargesPath(route, orderId));
|
|
2141
2161
|
if (answer.status !== "ok") return failureOf(answer);
|
|
@@ -2452,7 +2472,7 @@ function createWixOrderBackend(deps) {
|
|
|
2452
2472
|
async function startOrderFor(sale) {
|
|
2453
2473
|
const ordered = await orderFor(sale);
|
|
2454
2474
|
if (isStop(ordered)) return contextResult(sale.catalogRef, ordered);
|
|
2455
|
-
const charged = await chargeFor(sale, ordered, { reordered: false });
|
|
2475
|
+
const charged = await chargeFor(sale, ordered.ref, { reordered: false, placed: ordered.placed });
|
|
2456
2476
|
if (isStop(charged)) return contextResult(sale.catalogRef, charged);
|
|
2457
2477
|
return startFor(sale, charged);
|
|
2458
2478
|
}
|
|
@@ -2512,7 +2532,9 @@ function createWixOrderBackend(deps) {
|
|
|
2512
2532
|
return true;
|
|
2513
2533
|
};
|
|
2514
2534
|
const attempt4 = existing?.cashierOrderId && existing.verticalRef ? await reopenOrOpen(sale, { cashierOrderId: existing.cashierOrderId, verticalRef: existing.verticalRef }) : await sale.adapter.openOrder(sale.item, sale.bridge, beforeCreate);
|
|
2515
|
-
|
|
2535
|
+
if (prevented) return prevented;
|
|
2536
|
+
const ref = recordOrder(sale, existing, attempt4);
|
|
2537
|
+
return isStop(ref) ? ref : { ref, placed: isPlaced(attempt4) };
|
|
2516
2538
|
}
|
|
2517
2539
|
async function reopenOrOpen(sale, order) {
|
|
2518
2540
|
const reopened = await sale.adapter.reopenOrder(order, sale.bridge);
|
|
@@ -2538,7 +2560,7 @@ function createWixOrderBackend(deps) {
|
|
|
2538
2560
|
});
|
|
2539
2561
|
}
|
|
2540
2562
|
async function chargeFor(sale, ref, options) {
|
|
2541
|
-
const charge = await ensureAppleIapCharge(sale.bridge, deps.cashier, ref.cashierOrderId ?? "");
|
|
2563
|
+
const charge = await (options.placed ? chargePlacedOrder : ensureAppleIapCharge)(sale.bridge, deps.cashier, ref.cashierOrderId ?? "");
|
|
2542
2564
|
switch (charge.status) {
|
|
2543
2565
|
case "pending":
|
|
2544
2566
|
return persist(sale, { ...ref, stage: "charged", wixTransactionId: charge.transactionId, updatedAt: now() });
|
|
@@ -2562,8 +2584,9 @@ function createWixOrderBackend(deps) {
|
|
|
2562
2584
|
async function reorder(sale) {
|
|
2563
2585
|
if (sale.adapter.repeatable) return stopWith("rejected", "orderClosed");
|
|
2564
2586
|
if (!forget(sale, sale.catalogRef)) return stopWith("rejected", "storageUnavailable");
|
|
2565
|
-
const
|
|
2566
|
-
|
|
2587
|
+
const attempt4 = await sale.adapter.openOrder(sale.item, sale.bridge);
|
|
2588
|
+
const recorded = recordOrder(sale, void 0, attempt4);
|
|
2589
|
+
return isStop(recorded) ? recorded : chargeFor(sale, recorded, { reordered: true, placed: isPlaced(attempt4) });
|
|
2567
2590
|
}
|
|
2568
2591
|
async function alreadyPaid(sale, ref) {
|
|
2569
2592
|
const access = await sale.adapter.readAccess(ref.verticalRef ?? {}, sale.bridge);
|
|
@@ -2797,6 +2820,9 @@ function unassociatedHold(transaction, updatedAt) {
|
|
|
2797
2820
|
function acknowledgementOf(transaction, scopeKey) {
|
|
2798
2821
|
return { transactionId: transaction.transactionId, productId: transaction.productId, environment: transaction.environment, scopeKey };
|
|
2799
2822
|
}
|
|
2823
|
+
function isPlaced(attempt4) {
|
|
2824
|
+
return attempt4.status === "open" && attempt4.placed === true;
|
|
2825
|
+
}
|
|
2800
2826
|
function refAt(partition, key) {
|
|
2801
2827
|
return partition.refs().find((ref) => ref.key === key);
|
|
2802
2828
|
}
|
|
@@ -8206,6 +8206,12 @@ var WORKER_SUBTREE_SAFE_TYPE_RULES = {
|
|
|
8206
8206
|
"action"
|
|
8207
8207
|
]
|
|
8208
8208
|
},
|
|
8209
|
+
"ErrorState": {
|
|
8210
|
+
"children": [],
|
|
8211
|
+
"actions": [
|
|
8212
|
+
"cta"
|
|
8213
|
+
]
|
|
8214
|
+
},
|
|
8209
8215
|
"Banner": {
|
|
8210
8216
|
"children": [],
|
|
8211
8217
|
"actions": [
|
|
@@ -8743,6 +8749,12 @@ function emptyState(props) {
|
|
|
8743
8749
|
body: { package: "himalaya", type: "EmptyState", props }
|
|
8744
8750
|
};
|
|
8745
8751
|
}
|
|
8752
|
+
function errorState(props = {}) {
|
|
8753
|
+
return {
|
|
8754
|
+
id: auto("error_state"),
|
|
8755
|
+
body: { package: "himalaya", type: "ErrorState", props }
|
|
8756
|
+
};
|
|
8757
|
+
}
|
|
8746
8758
|
function appIntent(pkg, type, props, opts) {
|
|
8747
8759
|
return {
|
|
8748
8760
|
id: opts?.id ?? auto(type.toLowerCase()),
|
|
@@ -9414,6 +9426,7 @@ export {
|
|
|
9414
9426
|
donutChart,
|
|
9415
9427
|
emptyBlock,
|
|
9416
9428
|
emptyState,
|
|
9429
|
+
errorState,
|
|
9417
9430
|
fab,
|
|
9418
9431
|
fieldError,
|
|
9419
9432
|
filterChips,
|