@wix/himalaya-cli 0.1320.0 → 0.1322.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.
Files changed (64) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +1 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/biometrics/src/index.d.ts +11 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +4 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/host-session.d.ts +4 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +13 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/mapping-source.d.ts +8 -3
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments.d.ts +5 -4
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview/src/index.d.ts +4 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/index.d.ts +16 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/tokens.d.ts +9 -1
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +5 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-core.d.ts +3 -1
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +4 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +83 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-core.d.ts +36 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce.d.ts +8 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +3 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/purchase-fields.d.ts +4 -0
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/display.d.ts +21 -0
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
  24. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
  25. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
  26. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1205 -71
  27. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +125 -13
  28. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
  29. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -1
  30. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
  31. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
  32. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
  33. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
  34. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview-page.mjs +78 -0
  35. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview.mjs +16 -0
  36. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +13 -4
  37. package/dist/cli.mjs +87 -23
  38. package/dist/preview-assets.generated.bin +0 -0
  39. package/guides/getting-started.md +4 -2
  40. package/guides/himi-skill.md +4 -2
  41. package/guides/iap-pricing.md +33 -26
  42. package/guides/index.json +2 -1
  43. package/guides/sdk-reference.json +50 -8
  44. package/guides/tokens.md +22 -1
  45. package/guides/web-page-native-sdk.md +154 -33
  46. package/guides/webview-page-sdk.md +11 -0
  47. package/package.json +2 -2
  48. package/templates/beauty-salon/dev/index.ts +492 -0
  49. package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  50. package/templates/branded-lite/dev/index.ts +533 -0
  51. package/templates/branded-lite/tier5-src/_shared/iap-worker.ts +21 -44
  52. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +77 -47
  53. package/templates/branded-lite/tier5-src/himi-branded-lite-programs/index.ts +24 -38
  54. package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  55. package/templates/gym-fitness/dev/index.ts +492 -0
  56. package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  57. package/templates/portfolio-creative/dev/index.ts +492 -0
  58. package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  59. package/templates/retail-store/dev/index.ts +492 -0
  60. package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  61. package/templates/yoga-studio/dev/index.ts +41 -0
  62. package/templates/yoga-studio/tier5-src/_shared/iap-worker.ts +21 -44
  63. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +77 -47
  64. package/templates/yoga-studio/tier5-src/himi-branded-lite-programs/index.ts +24 -38
@@ -9655,6 +9655,498 @@ const SCREENS = runtimeSetting({
9655
9655
  "hiddenPath": "$service:spacesCollectionDetail.noEntity"
9656
9656
  }
9657
9657
  },
9658
+ {
9659
+ "id": "",
9660
+ "body": {
9661
+ "package": "himalaya",
9662
+ "type": "VStack",
9663
+ "props": {
9664
+ "spacing": 10,
9665
+ "children": [
9666
+ {
9667
+ "id": "himi_collection.skeleton_1",
9668
+ "body": {
9669
+ "package": "himalaya",
9670
+ "type": "ZStack",
9671
+ "props": {
9672
+ "alignment": "center",
9673
+ "children": []
9674
+ }
9675
+ },
9676
+ "modifiers": {
9677
+ "height": 96,
9678
+ "background": {
9679
+ "token": "surfaceSecondary"
9680
+ },
9681
+ "border": {
9682
+ "width": 1,
9683
+ "color": {
9684
+ "token": "border"
9685
+ }
9686
+ },
9687
+ "cornerRadius": 8
9688
+ }
9689
+ },
9690
+ {
9691
+ "id": "himi_collection.skeleton_2",
9692
+ "body": {
9693
+ "package": "himalaya",
9694
+ "type": "ZStack",
9695
+ "props": {
9696
+ "alignment": "center",
9697
+ "children": []
9698
+ }
9699
+ },
9700
+ "modifiers": {
9701
+ "height": 96,
9702
+ "background": {
9703
+ "token": "surfaceSecondary"
9704
+ },
9705
+ "border": {
9706
+ "width": 1,
9707
+ "color": {
9708
+ "token": "border"
9709
+ }
9710
+ },
9711
+ "cornerRadius": 8
9712
+ }
9713
+ },
9714
+ {
9715
+ "id": "himi_collection.skeleton_3",
9716
+ "body": {
9717
+ "package": "himalaya",
9718
+ "type": "ZStack",
9719
+ "props": {
9720
+ "alignment": "center",
9721
+ "children": []
9722
+ }
9723
+ },
9724
+ "modifiers": {
9725
+ "height": 96,
9726
+ "background": {
9727
+ "token": "surfaceSecondary"
9728
+ },
9729
+ "border": {
9730
+ "width": 1,
9731
+ "color": {
9732
+ "token": "border"
9733
+ }
9734
+ },
9735
+ "cornerRadius": 8
9736
+ }
9737
+ }
9738
+ ]
9739
+ }
9740
+ },
9741
+ "modifiers": {
9742
+ "hiddenPath": "$service:spacesCollectionDetail.hideProductsLoading"
9743
+ }
9744
+ },
9745
+ {
9746
+ "id": "himi_collection.products_retry.block",
9747
+ "body": {
9748
+ "package": "himalaya",
9749
+ "type": "VStack",
9750
+ "props": {
9751
+ "spacing": 12,
9752
+ "alignment": "leading",
9753
+ "children": [
9754
+ {
9755
+ "id": "",
9756
+ "body": {
9757
+ "package": "himalaya",
9758
+ "type": "HStack",
9759
+ "props": {
9760
+ "spacing": 10,
9761
+ "children": [
9762
+ {
9763
+ "id": "",
9764
+ "body": {
9765
+ "package": "himalaya",
9766
+ "type": "Icon",
9767
+ "props": {
9768
+ "name": "warning",
9769
+ "size": 18,
9770
+ "tint": "accentPrimary"
9771
+ }
9772
+ },
9773
+ "modifiers": {
9774
+ "accessibilityRole": "decorative"
9775
+ }
9776
+ },
9777
+ {
9778
+ "id": "",
9779
+ "body": {
9780
+ "package": "himalaya",
9781
+ "type": "Text",
9782
+ "props": {
9783
+ "text": "Something did not load.",
9784
+ "style": "bodyEmphasis"
9785
+ }
9786
+ }
9787
+ }
9788
+ ]
9789
+ }
9790
+ }
9791
+ },
9792
+ {
9793
+ "id": "",
9794
+ "body": {
9795
+ "package": "himalaya",
9796
+ "type": "Text",
9797
+ "props": {
9798
+ "text": "Try again when the connection settles.",
9799
+ "style": "body",
9800
+ "color": "textSecondary"
9801
+ }
9802
+ }
9803
+ },
9804
+ {
9805
+ "id": "himi_collection.products_retry",
9806
+ "body": {
9807
+ "package": "himalaya",
9808
+ "type": "Button",
9809
+ "props": {
9810
+ "title": "Try again",
9811
+ "style": "secondary",
9812
+ "action": {
9813
+ "actionId": "tier5.spacesCollectionDetail.retryProducts"
9814
+ }
9815
+ }
9816
+ }
9817
+ }
9818
+ ]
9819
+ }
9820
+ },
9821
+ "modifiers": {
9822
+ "background": {
9823
+ "token": "surfaceElevated"
9824
+ },
9825
+ "border": {
9826
+ "width": 1,
9827
+ "color": {
9828
+ "token": "border"
9829
+ }
9830
+ },
9831
+ "cornerRadius": 8,
9832
+ "padding": {
9833
+ "leading": 14,
9834
+ "trailing": 14,
9835
+ "top": 14,
9836
+ "bottom": 14
9837
+ },
9838
+ "hiddenPath": "$service:spacesCollectionDetail.productsNotErrored"
9839
+ }
9840
+ },
9841
+ {
9842
+ "id": "himi_collection.products",
9843
+ "body": {
9844
+ "package": "himalaya",
9845
+ "type": "LazyList",
9846
+ "props": {
9847
+ "spacing": 10,
9848
+ "itemsPath": "$service:spacesCollectionDetail.products",
9849
+ "items": [
9850
+ {
9851
+ "id": "himi_collection.row",
9852
+ "body": {
9853
+ "package": "himalaya",
9854
+ "type": "VStack",
9855
+ "props": {
9856
+ "spacing": 9,
9857
+ "alignment": "leading",
9858
+ "children": [
9859
+ {
9860
+ "id": "",
9861
+ "body": {
9862
+ "package": "himalaya",
9863
+ "type": "Image",
9864
+ "props": {
9865
+ "url": "$item.image",
9866
+ "fillWidth": true,
9867
+ "height": 168,
9868
+ "contentMode": "fill",
9869
+ "contentDescription": "$item.name"
9870
+ }
9871
+ },
9872
+ "modifiers": {
9873
+ "cornerRadius": 8,
9874
+ "fillMaxWidth": true,
9875
+ "hiddenPath": "$item.noImage"
9876
+ }
9877
+ },
9878
+ {
9879
+ "id": "himi_collection.row.monogram",
9880
+ "body": {
9881
+ "package": "himalaya",
9882
+ "type": "ZStack",
9883
+ "props": {
9884
+ "alignment": "center",
9885
+ "children": [
9886
+ {
9887
+ "id": "",
9888
+ "body": {
9889
+ "package": "himalaya",
9890
+ "type": "Text",
9891
+ "props": {
9892
+ "text": "$item.initial",
9893
+ "style": "display",
9894
+ "color": "textOnAccent",
9895
+ "maxLines": 1
9896
+ }
9897
+ }
9898
+ }
9899
+ ]
9900
+ }
9901
+ },
9902
+ "modifiers": {
9903
+ "fillMaxWidth": true,
9904
+ "height": 168,
9905
+ "background": {
9906
+ "token": "accentPrimary"
9907
+ },
9908
+ "cornerRadius": 8,
9909
+ "hiddenPath": "$item.hasImage"
9910
+ }
9911
+ },
9912
+ {
9913
+ "id": "",
9914
+ "body": {
9915
+ "package": "himalaya",
9916
+ "type": "Text",
9917
+ "props": {
9918
+ "text": "$item.name",
9919
+ "style": "bodyEmphasis",
9920
+ "maxLines": 2
9921
+ }
9922
+ }
9923
+ },
9924
+ {
9925
+ "id": "",
9926
+ "body": {
9927
+ "package": "himalaya",
9928
+ "type": "Text",
9929
+ "props": {
9930
+ "text": "$item.subtitle",
9931
+ "style": "footnote",
9932
+ "color": "accentPrimary",
9933
+ "maxLines": 1,
9934
+ "collapseWhenEmpty": true
9935
+ }
9936
+ }
9937
+ }
9938
+ ]
9939
+ }
9940
+ },
9941
+ "modifiers": {
9942
+ "background": {
9943
+ "token": "surfaceElevated"
9944
+ },
9945
+ "border": {
9946
+ "width": 1,
9947
+ "color": {
9948
+ "token": "border"
9949
+ }
9950
+ },
9951
+ "cornerRadius": 8,
9952
+ "padding": {
9953
+ "leading": 12,
9954
+ "trailing": 12,
9955
+ "top": 12,
9956
+ "bottom": 12
9957
+ },
9958
+ "onTap": {
9959
+ "actionId": "himi.open",
9960
+ "params": {
9961
+ "screenId": "$item.detailScreenId",
9962
+ "id": "$item.id"
9963
+ }
9964
+ },
9965
+ "pressFeedback": "scale",
9966
+ "haptic": "light",
9967
+ "accessibilityLabel": "$item.name"
9968
+ }
9969
+ }
9970
+ ],
9971
+ "onPullToRefresh": {
9972
+ "actionId": "tier5.spacesCollectionDetail.load"
9973
+ },
9974
+ "pagination": {
9975
+ "cursor": "$service:spacesCollectionDetail.productsCursor",
9976
+ "onLoadMore": {
9977
+ "actionId": "tier5.spacesCollectionDetail.loadMoreProducts"
9978
+ },
9979
+ "pageSize": 50
9980
+ }
9981
+ }
9982
+ },
9983
+ "modifiers": {
9984
+ "hiddenPath": "$service:spacesCollectionDetail.hideProducts"
9985
+ }
9986
+ },
9987
+ {
9988
+ "id": "himi_collection.products_more_retry.block",
9989
+ "body": {
9990
+ "package": "himalaya",
9991
+ "type": "VStack",
9992
+ "props": {
9993
+ "spacing": 12,
9994
+ "alignment": "leading",
9995
+ "children": [
9996
+ {
9997
+ "id": "",
9998
+ "body": {
9999
+ "package": "himalaya",
10000
+ "type": "HStack",
10001
+ "props": {
10002
+ "spacing": 10,
10003
+ "children": [
10004
+ {
10005
+ "id": "",
10006
+ "body": {
10007
+ "package": "himalaya",
10008
+ "type": "Icon",
10009
+ "props": {
10010
+ "name": "warning",
10011
+ "size": 18,
10012
+ "tint": "accentPrimary"
10013
+ }
10014
+ },
10015
+ "modifiers": {
10016
+ "accessibilityRole": "decorative"
10017
+ }
10018
+ },
10019
+ {
10020
+ "id": "",
10021
+ "body": {
10022
+ "package": "himalaya",
10023
+ "type": "Text",
10024
+ "props": {
10025
+ "text": "Something did not load.",
10026
+ "style": "bodyEmphasis"
10027
+ }
10028
+ }
10029
+ }
10030
+ ]
10031
+ }
10032
+ }
10033
+ },
10034
+ {
10035
+ "id": "",
10036
+ "body": {
10037
+ "package": "himalaya",
10038
+ "type": "Text",
10039
+ "props": {
10040
+ "text": "Try again when the connection settles.",
10041
+ "style": "body",
10042
+ "color": "textSecondary"
10043
+ }
10044
+ }
10045
+ },
10046
+ {
10047
+ "id": "himi_collection.products_more_retry",
10048
+ "body": {
10049
+ "package": "himalaya",
10050
+ "type": "Button",
10051
+ "props": {
10052
+ "title": "Try again",
10053
+ "style": "secondary",
10054
+ "action": {
10055
+ "actionId": "tier5.spacesCollectionDetail.retryProducts"
10056
+ }
10057
+ }
10058
+ }
10059
+ }
10060
+ ]
10061
+ }
10062
+ },
10063
+ "modifiers": {
10064
+ "background": {
10065
+ "token": "surfaceElevated"
10066
+ },
10067
+ "border": {
10068
+ "width": 1,
10069
+ "color": {
10070
+ "token": "border"
10071
+ }
10072
+ },
10073
+ "cornerRadius": 8,
10074
+ "padding": {
10075
+ "leading": 14,
10076
+ "trailing": 14,
10077
+ "top": 14,
10078
+ "bottom": 14
10079
+ },
10080
+ "hiddenPath": "$service:spacesCollectionDetail.productsNoPageError"
10081
+ }
10082
+ },
10083
+ {
10084
+ "id": "",
10085
+ "body": {
10086
+ "package": "himalaya",
10087
+ "type": "VStack",
10088
+ "props": {
10089
+ "spacing": 12,
10090
+ "alignment": "center",
10091
+ "children": [
10092
+ {
10093
+ "id": "",
10094
+ "body": {
10095
+ "package": "himalaya",
10096
+ "type": "Icon",
10097
+ "props": {
10098
+ "name": "bag",
10099
+ "size": 34,
10100
+ "tint": "textTertiary"
10101
+ }
10102
+ },
10103
+ "modifiers": {
10104
+ "accessibilityRole": "decorative"
10105
+ }
10106
+ },
10107
+ {
10108
+ "id": "",
10109
+ "body": {
10110
+ "package": "himalaya",
10111
+ "type": "Text",
10112
+ "props": {
10113
+ "text": "No products in this category yet.",
10114
+ "style": "bodyEmphasis",
10115
+ "color": "textSecondary",
10116
+ "collapseWhenEmpty": true
10117
+ }
10118
+ }
10119
+ },
10120
+ {
10121
+ "id": "himi_collection.products_empty.cta",
10122
+ "body": {
10123
+ "package": "himalaya",
10124
+ "type": "Button",
10125
+ "props": {
10126
+ "title": "Back to categories",
10127
+ "style": "secondary",
10128
+ "action": {
10129
+ "actionId": "himi.open",
10130
+ "params": {
10131
+ "screenId": "himi_collections"
10132
+ }
10133
+ }
10134
+ }
10135
+ }
10136
+ }
10137
+ ]
10138
+ }
10139
+ },
10140
+ "modifiers": {
10141
+ "padding": {
10142
+ "leading": 24,
10143
+ "trailing": 24,
10144
+ "top": 24,
10145
+ "bottom": 24
10146
+ },
10147
+ "hiddenPath": "$service:spacesCollectionDetail.noEmpty"
10148
+ }
10149
+ },
9658
10150
  {
9659
10151
  "id": "",
9660
10152
  "body": {
@@ -85162,6 +85654,9 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
85162
85654
  "actionId": "tier5.himiBrandedProgram.enroll"
85163
85655
  }
85164
85656
  }
85657
+ },
85658
+ "modifiers": {
85659
+ "hiddenPath": "$service:himiBrandedProgram.enrollHidden"
85165
85660
  }
85166
85661
  },
85167
85662
  {
@@ -85175,6 +85670,44 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
85175
85670
  "color": "textSecondary",
85176
85671
  "collapseWhenEmpty": true
85177
85672
  }
85673
+ },
85674
+ "modifiers": {
85675
+ "hiddenPath": "$service:himiBrandedProgram.enrollHidden"
85676
+ }
85677
+ },
85678
+ {
85679
+ "id": "himi_program.buy",
85680
+ "body": {
85681
+ "package": "himalaya",
85682
+ "type": "Button",
85683
+ "props": {
85684
+ "title": "$service:himiBrandedProgram.buyLabel",
85685
+ "style": "primary",
85686
+ "fullWidth": true,
85687
+ "disabledPath": "$service:himiBrandedProgram.buyDisabled",
85688
+ "action": {
85689
+ "actionId": "tier5.himiBrandedProgram.buy"
85690
+ }
85691
+ }
85692
+ },
85693
+ "modifiers": {
85694
+ "hiddenPath": "$service:himiBrandedProgram.buyHidden"
85695
+ }
85696
+ },
85697
+ {
85698
+ "id": "himi_program.buy_note",
85699
+ "body": {
85700
+ "package": "himalaya",
85701
+ "type": "Text",
85702
+ "props": {
85703
+ "text": "$service:himiBrandedProgram.buyNote",
85704
+ "style": "footnote",
85705
+ "color": "textSecondary",
85706
+ "collapseWhenEmpty": true
85707
+ }
85708
+ },
85709
+ "modifiers": {
85710
+ "hiddenPath": "$service:himiBrandedProgram.buyHidden"
85178
85711
  }
85179
85712
  },
85180
85713
  {
@@ -1,49 +1,11 @@
1
- // Worker-side glue for the shared IAP catalog layer (`@himalaya/iap` → createIapCatalogPricing),
2
- // shared by every screen that shows or sells an IAP-backed item. Mapping, Apple prices and payment
3
- // guards live in the SDK; this only supplies the host scope, the copy, and the hydration reset.
4
- import { get as appInfo } from "@himalaya/app-info";
5
- import type { IapCatalogScope, IapPriceCopy } from "@himalaya/iap";
1
+ // Worker-side glue for the shared IAP layer (`@himalaya/iap` catalog pricing and
2
+ // `@himalaya/iap-checkout` → createIapCommerce), shared by every screen that shows or sells an
3
+ // IAP-backed item. Mapping, Apple prices, payment guards, the host scope and the sale live in the
4
+ // SDK; this only supplies the copy and the hydration reset.
5
+ import type { IapPriceCopy } from "@himalaya/iap";
6
+ import type { IapPurchaseCopy } from "@himalaya/iap-checkout";
6
7
  import { copyParam } from "./himi-copy.js";
7
8
 
8
- export interface HostIapScope {
9
- scope: IapCatalogScope;
10
- platform: string;
11
- }
12
-
13
- let hostScope: Promise<HostIapScope> | undefined;
14
-
15
- /** Read once per worker, and only by an enabled screen: a disabled one makes no app-info call.
16
- * App identity and platform come from the host, never a screen param. The site is the host-owned
17
- * native preference business (the web partition uses an OAuth client ID); without one, the mapping source's
18
- * bound site applies. A failed read leaves identity empty, which fails every item closed — and is
19
- * not kept, so the next lookup asks the host again instead of staying invalid for good. */
20
- export function hostIapScope(): Promise<HostIapScope> {
21
- return hostScope ??= readHostScope().then((read) => {
22
- if (!hostScopeComplete(read)) hostScope = undefined;
23
- return read;
24
- });
25
- }
26
-
27
- /** An incomplete scope prices every item `invalidInput`, which the shared layer never offers to
28
- * retry — so a screen offers Retry itself while its own host read is what failed. */
29
- export function hostScopeComplete(read: HostIapScope): boolean {
30
- return !!read.scope.appId && !!read.scope.bundleId && !!read.platform;
31
- }
32
-
33
- async function readHostScope(): Promise<HostIapScope> {
34
- const identity = await appInfo().catch(() => undefined);
35
- const siteId = identity?.platform === "web" ? "" : hostSiteId();
36
- return {
37
- scope: { appId: identity?.appId ?? "", bundleId: identity?.bundleId ?? "", ...(siteId ? { siteId } : {}) },
38
- platform: identity?.platform ?? "",
39
- };
40
- }
41
-
42
- function hostSiteId(): string {
43
- const value = (globalThis as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input?.__himiPreferenceBusiness;
44
- return typeof value === "string" ? value.trim() : "";
45
- }
46
-
47
9
  /** Price labels from the screen's copy pack (`<prefix>.priceLoadingText`, …). */
48
10
  export function iapPriceCopy(prefix: string): IapPriceCopy {
49
11
  return {
@@ -54,6 +16,21 @@ export function iapPriceCopy(prefix: string): IapPriceCopy {
54
16
  };
55
17
  }
56
18
 
19
+ /** App Store purchase labels from the screen's copy pack (`<prefix>.buyCta`, …), for
20
+ * `iapPurchaseFields`. Customer copy only: no backend names, ids or diagnostics. */
21
+ export function iapPurchaseCopy(prefix: string): IapPurchaseCopy {
22
+ return {
23
+ buy: copyParam(`${prefix}.buyCta`, "Get access"),
24
+ processing: copyParam(`${prefix}.purchaseProcessingText`, "Processing your purchase…"),
25
+ awaitingApproval: copyParam(`${prefix}.purchaseAwaitingApprovalText`, "Waiting for approval"),
26
+ unavailable: copyParam(`${prefix}.purchaseTemporarilyUnavailableText`, "Purchasing is temporarily unavailable."),
27
+ signInRequired: copyParam(`${prefix}.purchaseSignInText`, "Sign in to buy."),
28
+ retry: copyParam(`${prefix}.purchaseRetryText`, "Something went wrong. Try again."),
29
+ priceChanged: copyParam(`${prefix}.purchasePriceChangedText`, "The price changed. Check it and try again."),
30
+ support: copyParam(`${prefix}.purchaseSupportText`, "We couldn't finish this purchase. Contact support."),
31
+ };
32
+ }
33
+
57
34
  /** What `notHydrated` does, for a runtime that ignores the option (a binary older than it, still
58
35
  * served new bundles): put the listed keys back to their declared values before any action runs,
59
36
  * so a persisted price or an enabled purchase action never paints as this run's. */