@wix/himalaya-cli 0.1723.0 → 0.1724.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/app-config.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/godot/src/index.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/attendance-classifier.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +3 -39
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +10 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/preview-surfaces.d.ts +24 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-web-sdk.d.ts +37 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-web-sdk.generated.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/wrapped-app-link.d.ts +13 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +2 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-order-backend.d.ts +0 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/attendance.d.ts +2 -8
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +4 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +175 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +46 -502
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +5 -26
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +64 -648
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/package-reader.js +4 -4
- package/dist/browser-plane/preview-deferred/{74e5b76ecf38392d7eb3f9a9512d60a0675de85d411c9c56293e123152b3f70b.bin → a6e25c06d2a17ab2b5e34bf2b5965fa3ddd76ce3da32a036e546a60938130d7b.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +1275 -408
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +6 -2
- package/guides/iap-screen-adoption.md +4 -4
- package/guides/sdk-reference.json +11 -74
- package/guides/webview-page-sdk.md +14 -0
- package/guides/wix-business-context.md +24 -0
- package/guides/wix-site-to-himi-app.md +2 -1
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/brandy/README.md +13 -0
- package/templates/brandy/config.ts +15 -1
- package/templates/brandy/dev/index.ts +10 -7
- package/templates/community-club/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/conference/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +2 -2
- package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +5 -8
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +2 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/attendance-orders.d.ts +0 -10
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/online-programs-orders.d.ts +0 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/pricing-plans-orders.d.ts +0 -2
|
@@ -2,7 +2,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
2
2
|
import { defineService as registerState } from "@himalaya/state";
|
|
3
3
|
// Tier-5 bundle: himi-store — product detail.
|
|
4
4
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
5
|
-
import {
|
|
5
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
6
6
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
7
7
|
import { share as shareSheet } from "@himalaya/share";
|
|
8
8
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -466,10 +466,8 @@ function derive(s: S): S {
|
|
|
466
466
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
467
467
|
let cartBadgeEpoch = 0;
|
|
468
468
|
|
|
469
|
-
// A digital product with no options sells through the App Store
|
|
470
|
-
//
|
|
471
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
472
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
469
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
470
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
473
471
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
474
472
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
475
473
|
|
|
@@ -477,7 +475,7 @@ let productPricing: IapCommerce;
|
|
|
477
475
|
let checkoutEntered = false;
|
|
478
476
|
const defineService = withIapPresentation<S>({
|
|
479
477
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
480
|
-
adapters:
|
|
478
|
+
adapters: [storesProductOrders],
|
|
481
479
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
482
480
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
483
481
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -508,7 +506,7 @@ const defineService = withIapPresentation<S>({
|
|
|
508
506
|
function applePurchase(state: S): IapPurchaseFields {
|
|
509
507
|
const id = inputId();
|
|
510
508
|
const loaded = !!id && lastLoadedId === id;
|
|
511
|
-
const sellable =
|
|
509
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
512
510
|
const copy = iapPurchaseCopy("product");
|
|
513
511
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
514
512
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -516,7 +514,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
516
514
|
|
|
517
515
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
518
516
|
function enterCheckout(): void {
|
|
519
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
520
517
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
521
518
|
checkoutEntered = true;
|
|
522
519
|
}
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -2,7 +2,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
2
2
|
import { defineService as registerState } from "@himalaya/state";
|
|
3
3
|
// Tier-5 bundle: himi-store — product detail.
|
|
4
4
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
5
|
-
import {
|
|
5
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
6
6
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
7
7
|
import { share as shareSheet } from "@himalaya/share";
|
|
8
8
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -466,10 +466,8 @@ function derive(s: S): S {
|
|
|
466
466
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
467
467
|
let cartBadgeEpoch = 0;
|
|
468
468
|
|
|
469
|
-
// A digital product with no options sells through the App Store
|
|
470
|
-
//
|
|
471
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
472
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
469
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
470
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
473
471
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
474
472
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
475
473
|
|
|
@@ -477,7 +475,7 @@ let productPricing: IapCommerce;
|
|
|
477
475
|
let checkoutEntered = false;
|
|
478
476
|
const defineService = withIapPresentation<S>({
|
|
479
477
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
480
|
-
adapters:
|
|
478
|
+
adapters: [storesProductOrders],
|
|
481
479
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
482
480
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "paintCached"], concurrentPublishActions: ["buy"],
|
|
483
481
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -508,7 +506,7 @@ const defineService = withIapPresentation<S>({
|
|
|
508
506
|
function applePurchase(state: S): IapPurchaseFields {
|
|
509
507
|
const id = inputId();
|
|
510
508
|
const loaded = !!id && lastLoadedId === id;
|
|
511
|
-
const sellable =
|
|
509
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
512
510
|
const copy = iapPurchaseCopy("product");
|
|
513
511
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
514
512
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -516,7 +514,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
516
514
|
|
|
517
515
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
518
516
|
function enterCheckout(): void {
|
|
519
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
520
517
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
521
518
|
checkoutEntered = true;
|
|
522
519
|
}
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -3,7 +3,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
3
3
|
import { defineService as registerState } from "@himalaya/state";
|
|
4
4
|
// Tier-5 bundle: himi-store — product detail.
|
|
5
5
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
6
|
-
import {
|
|
6
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
7
7
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
8
8
|
import { share as shareSheet } from "@himalaya/share";
|
|
9
9
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -451,10 +451,8 @@ function derive(s: S): S {
|
|
|
451
451
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
452
452
|
let cartBadgeEpoch = 0;
|
|
453
453
|
|
|
454
|
-
// A digital product with no options sells through the App Store
|
|
455
|
-
//
|
|
456
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
457
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
454
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
455
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
458
456
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
459
457
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
460
458
|
|
|
@@ -462,7 +460,7 @@ let productPricing: IapCommerce;
|
|
|
462
460
|
let checkoutEntered = false;
|
|
463
461
|
const registerProduct = withIapPresentation<S>({
|
|
464
462
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
465
|
-
adapters:
|
|
463
|
+
adapters: [storesProductOrders],
|
|
466
464
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
467
465
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
|
|
468
466
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -513,7 +511,7 @@ const defineService = withReadLifecycle(registerProduct, "load", {
|
|
|
513
511
|
function applePurchase(state: S): IapPurchaseFields {
|
|
514
512
|
const id = inputId();
|
|
515
513
|
const loaded = !!id && lastLoadedId === id;
|
|
516
|
-
const sellable =
|
|
514
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
517
515
|
const copy = iapPurchaseCopy("product");
|
|
518
516
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
519
517
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -521,7 +519,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
521
519
|
|
|
522
520
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
523
521
|
function enterCheckout(): void {
|
|
524
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
525
522
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
526
523
|
checkoutEntered = true;
|
|
527
524
|
}
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -3,7 +3,7 @@ import { withOnlineWrites, offlineWritesEnabled, offlineWriteMessage } from "../
|
|
|
3
3
|
import { defineService as registerState } from "@himalaya/state";
|
|
4
4
|
// Tier-5 bundle: himi-store — product detail.
|
|
5
5
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
6
|
-
import {
|
|
6
|
+
import { storesProductOrders, type IapCommerce, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
7
7
|
import { iapPriceCopy, iapPurchaseCopy } from "../_shared/iap-worker.js";
|
|
8
8
|
import { share as shareSheet } from "@himalaya/share";
|
|
9
9
|
import { addToCurrentCart, getCurrentCart } from "@himalaya/wix-ecom";
|
|
@@ -451,10 +451,8 @@ function derive(s: S): S {
|
|
|
451
451
|
// read answering late — must not replace the badge the add set (#3468 review).
|
|
452
452
|
let cartBadgeEpoch = 0;
|
|
453
453
|
|
|
454
|
-
// A digital product with no options sells through the App Store
|
|
455
|
-
//
|
|
456
|
-
// Until then, and for any other product, an App Store route only blocks the regular checkout.
|
|
457
|
-
const SELLS_THROUGH_APPLE = storesAppleSalesEnabled();
|
|
454
|
+
// A digital product with no options sells through the App Store: wix-iap StartItemPayment places and
|
|
455
|
+
// charges its order. For any other product, an App Store route only blocks the regular checkout.
|
|
458
456
|
const WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
459
457
|
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
460
458
|
|
|
@@ -462,7 +460,7 @@ let productPricing: IapCommerce;
|
|
|
462
460
|
let checkoutEntered = false;
|
|
463
461
|
const registerProduct = withIapPresentation<S>({
|
|
464
462
|
register: withOnlineWrites(registerState, ["beginAdd", "addToCart", "buy"], { derive, messageFields: action => action === "buy" ? ["buyNote"] : ["cartHint"] }),
|
|
465
|
-
adapters:
|
|
463
|
+
adapters: [storesProductOrders],
|
|
466
464
|
onCreate: commerce => { productPricing = commerce; }, prefix: "product",
|
|
467
465
|
transientKeys: ["optionValidationTarget", "optionValidationRequest", "opt1ScrollRequest", "opt2ScrollRequest", "opt3ScrollRequest", "galleryIndex", "price", "optionsIncomplete", "cartHint", "cartHidden", "buyHidden", "buyLabel", "buyDisabled", "buyNote", "purchasedNote", "addedSheetPresented", "shareHint"], contentActions: ["load", "readChanged"], concurrentPublishActions: ["buy"],
|
|
468
466
|
items: state => inputId() ? [{ reference: { kind: "storesProduct", id: inputId() }, commerceDisplayPrice: state.price }] : [],
|
|
@@ -513,7 +511,7 @@ const defineService = withReadLifecycle(registerProduct, "load", {
|
|
|
513
511
|
function applePurchase(state: S): IapPurchaseFields {
|
|
514
512
|
const id = inputId();
|
|
515
513
|
const loaded = !!id && lastLoadedId === id;
|
|
516
|
-
const sellable =
|
|
514
|
+
const sellable = loaded && lastProduct?.productType?.toLowerCase() === "digital" && !state.optionsUnknown && state.optionGroups.length === 0;
|
|
517
515
|
const copy = iapPurchaseCopy("product");
|
|
518
516
|
const fields = sellable ? productPricing.purchaseFields({ kind: "storesProduct", id }, copy) : NOT_APPLE;
|
|
519
517
|
return fields.appleRoute ? fields : NOT_APPLE;
|
|
@@ -521,7 +519,6 @@ function applePurchase(state: S): IapPurchaseFields {
|
|
|
521
519
|
|
|
522
520
|
/** On every entry: the first starts the checkout (recovering held purchases), later ones reconcile. */
|
|
523
521
|
function enterCheckout(): void {
|
|
524
|
-
if (!SELLS_THROUGH_APPLE) return;
|
|
525
522
|
void (checkoutEntered ? productPricing.reconcile() : productPricing.start());
|
|
526
523
|
checkoutEntered = true;
|
|
527
524
|
}
|
|
@@ -17,7 +17,7 @@ import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
|
17
17
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
18
18
|
import { memberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
19
19
|
import { CONTINUATION_BUDGET_MS, memberScreenTarget, within } from "../_shared/member-screen.js";
|
|
20
|
-
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders,
|
|
20
|
+
import { createIapCommerce, onlineProgramOrders, pricingPlanOrders, storesProductOrders } from "@himalaya/iap-checkout";
|
|
21
21
|
import { IAP_RESTORE_KEYS, NO_IAP_RESTORE, createIapRestore, resetUnhydratedKeysOnOlderRuntime, type IapRestoreFields } from "../_shared/iap-worker.js";
|
|
22
22
|
|
|
23
23
|
interface AuthRouteInput {
|
|
@@ -615,7 +615,7 @@ interface S extends IapRestoreFields {
|
|
|
615
615
|
// row shows once purchasing is ready on this host (a bound iOS binary with managed StoreKit), to a
|
|
616
616
|
// guest too: the restore itself asks them to sign in.
|
|
617
617
|
const commerce = createIapCommerce({
|
|
618
|
-
adapters: [onlineProgramOrders, pricingPlanOrders,
|
|
618
|
+
adapters: [onlineProgramOrders, pricingPlanOrders, storesProductOrders],
|
|
619
619
|
onChange: () => { void svc.restorePublish(); },
|
|
620
620
|
});
|
|
621
621
|
const restore = createIapRestore(commerce, { prefix: "storeAccount", repaint: () => { void svc.restorePublish(); } });
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IapOrderAdapter } from "../apple-iap-contract.js";
|
|
2
|
-
export declare function attendanceClientOrdersWith(options: {
|
|
3
|
-
bookingsEnabled: boolean;
|
|
4
|
-
eventsEnabled: boolean;
|
|
5
|
-
now?: () => number;
|
|
6
|
-
}): {
|
|
7
|
-
bookingOrders: IapOrderAdapter;
|
|
8
|
-
eventTicketOrders: IapOrderAdapter;
|
|
9
|
-
};
|
|
10
|
-
export declare const bookingClientOrders: IapOrderAdapter, eventTicketClientOrders: IapOrderAdapter;
|