Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7a743ba09 | ||
|
|
751d9a34e3 | ||
|
|
6facf5d72d | ||
|
|
da68f0a582 | ||
|
|
9cb0979606 | ||
|
|
f778064aef | ||
|
|
1ac5095177 | ||
|
|
bc64ff47b2 | ||
|
|
8083c4f06d | ||
|
|
7770c763cc | ||
|
|
b4a8546ce6 | ||
|
|
3b83eac099 | ||
|
|
c623a32bb5 | ||
|
|
03f509d83e | ||
|
|
a33f130341 | ||
|
|
7ab78bd550 | ||
|
|
71da064cab | ||
|
|
569e62fef4 | ||
|
|
fcc7c70310 | ||
|
|
fdc24083cf | ||
|
|
6f725bc0ef | ||
|
|
f6b1044a17 | ||
|
|
f52575db9c | ||
|
|
7f8ae8bd74 | ||
|
|
b211c8773b | ||
|
|
b78fbbdc4e | ||
|
|
0da9f68353 | ||
|
|
d4e3a99e61 | ||
|
|
c2f6f9d226 | ||
|
|
0f6d8b37f4 | ||
|
|
5015fb2838 | ||
|
|
e9abc9840a | ||
|
|
47beece729 | ||
|
|
7ab391d48f | ||
|
|
065a0b3178 | ||
|
|
4104235546 | ||
|
|
bc2acc3eb6 | ||
|
|
2d3c590c71 | ||
|
|
cb9762b0d6 | ||
|
|
3e15cb1481 | ||
|
|
57780ae99c | ||
|
|
3dda7fcf60 | ||
|
|
bddd591d63 | ||
|
|
0d19412c96 | ||
|
|
164bb267f1 | ||
|
|
8929501be5 | ||
|
|
383d371d00 | ||
|
|
5b06034255 | ||
|
|
449fad5ed1 | ||
|
|
059ba0b565 | ||
|
|
4675a5b5e3 | ||
|
|
ff3a1cb00b | ||
|
|
29579f80d3 | ||
|
|
16ade71598 | ||
|
|
2238a34c53 | ||
|
|
ea71591557 | ||
|
|
e87ba066db | ||
|
|
bb4bcdf600 | ||
|
|
1171390996 | ||
|
|
be59cca162 | ||
|
|
444178df05 | ||
|
|
d2737a4998 | ||
|
|
866ffbf774 | ||
|
|
66807fca8d | ||
|
|
47ac13b114 | ||
|
|
e578ba521d | ||
|
|
e01192fb5e | ||
|
|
e9c5830d4e | ||
|
|
9d391aeb95 | ||
|
|
a9d0cba909 | ||
|
|
5d3ca82236 | ||
|
|
d2183c9a3c | ||
|
|
4361e71030 | ||
|
|
46807e3089 | ||
|
|
d6608283f6 | ||
|
|
e41a898686 | ||
|
|
0cd3772517 | ||
|
|
5b0bb45e52 | ||
|
|
106b0ebbdf | ||
|
|
a49b20dfd4 | ||
|
|
7cd3fac28b | ||
|
|
9319906737 | ||
|
|
0106c94d24 | ||
|
|
37d86ba36e | ||
|
|
c2a355f2de |
@@ -0,0 +1 @@
|
|||||||
|
graphify-out/graph.json merge=graphify
|
||||||
@@ -13,9 +13,11 @@ declare module 'vue' {
|
|||||||
ADivider: typeof import('ant-design-vue/es')['Divider']
|
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||||
AForm: typeof import('ant-design-vue/es')['Form']
|
AForm: typeof import('ant-design-vue/es')['Form']
|
||||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||||
|
AImage: typeof import('ant-design-vue/es')['Image']
|
||||||
AInput: typeof import('ant-design-vue/es')['Input']
|
AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
|
AppCreditLink: typeof import('./src/components/AppCreditLink.vue')['default']
|
||||||
ARadio: typeof import('ant-design-vue/es')['Radio']
|
ARadio: typeof import('ant-design-vue/es')['Radio']
|
||||||
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
|
||||||
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
|
||||||
@@ -50,13 +52,18 @@ declare module 'vue' {
|
|||||||
Disabled: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled.vue')['default']
|
Disabled: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled.vue')['default']
|
||||||
DisabledDate: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled-date.vue')['default']
|
DisabledDate: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/disabled-date.vue')['default']
|
||||||
Empty: typeof import('./src/components/empty.vue')['default']
|
Empty: typeof import('./src/components/empty.vue')['default']
|
||||||
|
EnamadBadge: typeof import('./src/components/EnamadBadge.vue')['default']
|
||||||
ExtraFooter: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/extra-footer.vue')['default']
|
ExtraFooter: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/extra-footer.vue')['default']
|
||||||
Format: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/format.vue')['default']
|
Format: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/format.vue')['default']
|
||||||
|
GoldDayCalculatorModal: typeof import('./src/components/GoldDayCalculatorModal.vue')['default']
|
||||||
GoldLoading: typeof import('./src/components/GoldLoading.vue')['default']
|
GoldLoading: typeof import('./src/components/GoldLoading.vue')['default']
|
||||||
|
InstallButton: typeof import('./src/components/InstallButton.vue')['default']
|
||||||
ListAnim: typeof import('./src/components/ListAnim.vue')['default']
|
ListAnim: typeof import('./src/components/ListAnim.vue')['default']
|
||||||
Mode: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/mode.vue')['default']
|
Mode: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/mode.vue')['default']
|
||||||
PresettedRanges: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/presetted-ranges.vue')['default']
|
PresettedRanges: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/presetted-ranges.vue')['default']
|
||||||
ProductImage: typeof import('./src/components/ProductImage.vue')['default']
|
ProductImage: typeof import('./src/components/ProductImage.vue')['default']
|
||||||
|
PwaInstallGuideModal: typeof import('./src/components/pwa/PwaInstallGuideModal.vue')['default']
|
||||||
|
PwaInstallStepIllustration: typeof import('./src/components/pwa/PwaInstallStepIllustration.vue')['default']
|
||||||
RangePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/range-picker.vue')['default']
|
RangePicker: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/range-picker.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
RouterView: typeof import('vue-router')['RouterView']
|
RouterView: typeof import('vue-router')['RouterView']
|
||||||
@@ -64,11 +71,13 @@ declare module 'vue' {
|
|||||||
Size: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/size.vue')['default']
|
Size: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/size.vue')['default']
|
||||||
StartEnd: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/start-end.vue')['default']
|
StartEnd: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/start-end.vue')['default']
|
||||||
Suffix: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/suffix.vue')['default']
|
Suffix: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/suffix.vue')['default']
|
||||||
|
SupportContactBar: typeof import('./src/components/SupportContactBar.vue')['default']
|
||||||
SupportMessengerBrandIcon: typeof import('./src/components/SupportMessengerBrandIcon.vue')['default']
|
SupportMessengerBrandIcon: typeof import('./src/components/SupportMessengerBrandIcon.vue')['default']
|
||||||
SupportMessengerPicker: typeof import('./src/components/SupportMessengerPicker.vue')['default']
|
SupportMessengerPicker: typeof import('./src/components/SupportMessengerPicker.vue')['default']
|
||||||
Switchable: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/switchable.vue')['default']
|
Switchable: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/switchable.vue')['default']
|
||||||
Text: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/text.vue')['default']
|
Text: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/text.vue')['default']
|
||||||
Time: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/time.vue')['default']
|
Time: typeof import('./src/components/BasicPacks/BaseDatePicker/src/datePick/demo/time.vue')['default']
|
||||||
|
TradeFeeConfirmSummary: typeof import('./src/components/TradeFeeConfirmSummary.vue')['default']
|
||||||
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
TransactionSkeleton: typeof import('./src/components/TransactionSkeleton.vue')['default']
|
||||||
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
VanActionSheet: typeof import('vant/es')['ActionSheet']
|
||||||
VanDialog: typeof import('vant/es')['Dialog']
|
VanDialog: typeof import('vant/es')['Dialog']
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"0": "useTvMonitorPage",
|
||||||
|
"1": "ref_utils",
|
||||||
|
"2": "index.vue",
|
||||||
|
"3": "productPrice.ts",
|
||||||
|
"4": "useNewPhysicalRequestPage.ts",
|
||||||
|
"5": "api/products.ts",
|
||||||
|
"6": "priceSocket.ts",
|
||||||
|
"7": "priceSocketState.ts",
|
||||||
|
"8": "useProductsPageData.ts",
|
||||||
|
"9": "AuthPriceStream"
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"0": "d7734412cf0800ce", "1": "67d1701e4c6cea74", "2": "a1988eda2ebb6afe", "3": "18bc618fd6f328bb", "4": "b16e1aea09ac331f", "5": "8d51306eb7d0daf2", "6": "fe2bcdb916bbc9f9", "7": "ac69b3434e72782c", "8": "004ed482633014da", "9": "08b88f1fc8c91c56"}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"0": "useTvMonitorPage",
|
||||||
|
"1": "useTvMonitorPage.ts",
|
||||||
|
"2": "index.vue",
|
||||||
|
"3": "productPrice.ts",
|
||||||
|
"4": "getProductBaseBuyPrice",
|
||||||
|
"5": "ref_models",
|
||||||
|
"6": "isTvProductPriceInactive",
|
||||||
|
"7": "applyPriceOffsetPercent"
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
# Graph Report - ghatreh_user (2026-09-27)
|
||||||
|
|
||||||
|
## Corpus Check
|
||||||
|
- 598 files · ~506,745 words
|
||||||
|
- Verdict: corpus is large enough that graph structure adds value.
|
||||||
|
- Unclassified: 51 file(s) not represented in the graph (top: .less 25, .eot 6, .ttf 6)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- 84 nodes · 154 edges · 8 communities
|
||||||
|
- Extraction: 91% EXTRACTED · 9% INFERRED · 0% AMBIGUOUS · INFERRED: 14 edges (avg confidence: 0.85)
|
||||||
|
- Token cost: 0 input · 0 output
|
||||||
|
|
||||||
|
## Graph Freshness
|
||||||
|
- Built from commit: `8083c4f0`
|
||||||
|
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||||
|
- Run `graphify update .` after code changes (no API cost).
|
||||||
|
|
||||||
|
## Community Hubs (Navigation)
|
||||||
|
- useTvMonitorPage
|
||||||
|
- useTvMonitorPage.ts
|
||||||
|
- index.vue
|
||||||
|
- productPrice.ts
|
||||||
|
- getProductBaseBuyPrice
|
||||||
|
- ref_models
|
||||||
|
- isTvProductPriceInactive
|
||||||
|
- applyPriceOffsetPercent
|
||||||
|
|
||||||
|
## God Nodes (most connected - your core abstractions)
|
||||||
|
1. `useTvMonitorPage()` - 25 edges
|
||||||
|
2. `getProductBaseBuyPrice()` - 10 edges
|
||||||
|
3. `getProductBuyPrice()` - 7 edges
|
||||||
|
4. `getProductBaseSellPrice()` - 6 edges
|
||||||
|
5. `getProductSellPrice()` - 6 edges
|
||||||
|
6. `productUsesLastPriceIfZero()` - 5 edges
|
||||||
|
7. `applyPriceOffsetPercent()` - 5 edges
|
||||||
|
8. `isProductPriceInactive()` - 5 edges
|
||||||
|
9. `formatTvPrice()` - 5 edges
|
||||||
|
10. `cashFeeOptions()` - 4 edges
|
||||||
|
|
||||||
|
## Surprising Connections (you probably didn't know these)
|
||||||
|
- `useTvMonitorPage()` --indirect_call--> `isShowOnTv()` [INFERRED]
|
||||||
|
src/views/tv/composables/useTvMonitorPage.ts → src/views/tv/composables/useTvMonitorPage.ts _Bridges community 1 → community 0_
|
||||||
|
- `colleagueSideUnit()` --calls--> `getColleagueSourcedUnitPrice()` [EXTRACTED]
|
||||||
|
src/utils/productPrice.ts → src/utils/productPrice.ts _Bridges community 4 → community 7_
|
||||||
|
- `getProductBuyPrice()` --calls--> `getProductBaseBuyPrice()` [EXTRACTED]
|
||||||
|
src/utils/productPrice.ts → src/utils/productPrice.ts _Bridges community 4 → community 3_
|
||||||
|
- `getTvProductBuyPrice()` --calls--> `getProductBuyPrice()` [EXTRACTED]
|
||||||
|
src/utils/productPrice.ts → src/utils/productPrice.ts _Bridges community 3 → community 6_
|
||||||
|
- `isTvProductPriceInactive()` --calls--> `isProductPriceInactive()` [EXTRACTED]
|
||||||
|
src/utils/productPrice.ts → src/utils/productPrice.ts _Bridges community 4 → community 6_
|
||||||
|
|
||||||
|
## Import Cycles
|
||||||
|
- None detected.
|
||||||
|
|
||||||
|
## Communities (8 total, 0 thin omitted)
|
||||||
|
|
||||||
|
### Community 0 - "useTvMonitorPage"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (17): floorTvToman(), formatTvPrice(), parseTvNews(), useTvMonitorPage(), hideCursorSoon(), isProductTvInactive(), liveQuoteLabel(), loadProducts() (+9 more)
|
||||||
|
|
||||||
|
### Community 1 - "useTvMonitorPage.ts"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (15): ref_api, ref_assets, ref_moment, ref_moment_jalaali, ref_store, ref_utils, ref_vue, ref_vueuse_core (+7 more)
|
||||||
|
|
||||||
|
### Community 2 - "index.vue"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (15): ref_components, ref_views, coinColumns, extraTickerLoop, loopNews(), loopTicker(), marqueeCopies(), newsDuration() (+7 more)
|
||||||
|
|
||||||
|
### Community 3 - "productPrice.ts"
|
||||||
|
Cohesion: 0.44
|
||||||
|
Nodes (9): buyCashFee(), cashFeeOptions(), getProductBuyPrice(), getProductSellPrice(), hasProductUnitWeight(), isProductWithoutDisplayPrice(), productPriceAmountFactor(), productUsesLiveBoardQuote() (+1 more)
|
||||||
|
|
||||||
|
### Community 4 - "getProductBaseBuyPrice"
|
||||||
|
Cohesion: 0.43
|
||||||
|
Nodes (8): colleagueSideUnit(), getProductBaseBuyPrice(), getProductBaseSellPrice(), getReferenceProductBaseBuyPrice(), hasReferenceReadingMethod(), isProductPriceInactive(), isProductVisible(), productUsesLastPriceIfZero()
|
||||||
|
|
||||||
|
### Community 5 - "ref_models"
|
||||||
|
Cohesion: 0.40
|
||||||
|
Nodes (4): ref_models, CountPInventory, PInventory, Product
|
||||||
|
|
||||||
|
### Community 6 - "isTvProductPriceInactive"
|
||||||
|
Cohesion: 0.50
|
||||||
|
Nodes (5): getTvProductBuyPrice(), getTvProductSellPrice(), isTvProductPriceInactive(), tvBuyUnitPrice(), tvSellUnitPrice()
|
||||||
|
|
||||||
|
### Community 7 - "applyPriceOffsetPercent"
|
||||||
|
Cohesion: 0.67
|
||||||
|
Nodes (3): applyPriceOffsetPercent(), getColleagueSourcedUnitPrice(), resolvePriceOffsetRatio()
|
||||||
|
|
||||||
|
## Knowledge Gaps
|
||||||
|
- **6 isolated node(s):** `Product`, `PInventory`, `CountPInventory`, `{ theme, themeVars, toggleTheme }`, `{
|
||||||
|
rootEl,
|
||||||
|
brandName,
|
||||||
|
brandLogo,
|
||||||
|
nowLabel,
|
||||||
|
dateLabel,
|
||||||
|
parsianCoins,
|
||||||
|
bankCoins,
|
||||||
|
hasCoinBoard,
|
||||||
|
hasBoardContent,
|
||||||
|
tickerProducts,
|
||||||
|
tickerTitle,
|
||||||
|
extraTickerProducts,
|
||||||
|
extraTickerTitle,
|
||||||
|
tvNewsItems,
|
||||||
|
newsTickerTitle,
|
||||||
|
statusBanner,
|
||||||
|
showMainQuote,
|
||||||
|
mainQuoteReady,
|
||||||
|
mainQuoteReady,
|
||||||
|
liveBuy,
|
||||||
|
liveSell,
|
||||||
|
isLive,
|
||||||
|
isFullscreen,
|
||||||
|
cursorHidden,
|
||||||
|
loading,
|
||||||
|
productWeightLabel,
|
||||||
|
tickerItemLabel,
|
||||||
|
isProductTvInactive,
|
||||||
|
productBuyLabel,
|
||||||
|
productSellLabel,
|
||||||
|
liveQuoteLabel,
|
||||||
|
toggleFullscreen,
|
||||||
|
}` (+1 more)
|
||||||
|
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 18 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
|
||||||
|
|
||||||
|
## Suggested Questions
|
||||||
|
_Questions this graph is uniquely positioned to answer:_
|
||||||
|
|
||||||
|
- **Why does `useTvMonitorPage()` connect `useTvMonitorPage` to `useTvMonitorPage.ts`?**
|
||||||
|
_High betweenness centrality (0.342) - this node is a cross-community bridge._
|
||||||
|
- **Why does `formatTvPrice()` connect `useTvMonitorPage` to `useTvMonitorPage.ts`?**
|
||||||
|
_High betweenness centrality (0.026) - this node is a cross-community bridge._
|
||||||
|
- **Why does `getProductBaseBuyPrice()` connect `getProductBaseBuyPrice` to `productPrice.ts`, `applyPriceOffsetPercent`?**
|
||||||
|
_High betweenness centrality (0.004) - this node is a cross-community bridge._
|
||||||
|
- **Are the 13 inferred relationships involving `useTvMonitorPage()` (e.g. with `isBankCoin()` and `isGoldBar()`) actually correct?**
|
||||||
|
_`useTvMonitorPage()` has 13 INFERRED edges - model-reasoned connections that need verification._
|
||||||
|
- **What connects `Product`, `PInventory`, `CountPInventory` to the rest of the system?**
|
||||||
|
_6 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||||
|
- **Should `useTvMonitorPage` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.1380952380952381 - nodes in this community are weakly interconnected._
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"0": "useTvMonitorPage",
|
||||||
|
"1": "ref_utils",
|
||||||
|
"2": "index.vue",
|
||||||
|
"3": "productPrice.ts",
|
||||||
|
"4": "forceReconnect",
|
||||||
|
"5": "api/products.ts",
|
||||||
|
"6": "priceSocket.ts",
|
||||||
|
"7": "connect",
|
||||||
|
"8": "useProductsPageData.ts",
|
||||||
|
"9": "AuthPriceStream",
|
||||||
|
"10": "initPriceRealtimeChannel"
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
# Graph Report - ghatreh_user (2026-09-28)
|
||||||
|
|
||||||
|
## Corpus Check
|
||||||
|
- 598 files · ~506,942 words
|
||||||
|
- Verdict: corpus is large enough that graph structure adds value.
|
||||||
|
- Unclassified: 51 file(s) not represented in the graph (top: .less 25, .eot 6, .ttf 6)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- 196 nodes · 413 edges · 11 communities (10 shown, 1 thin omitted)
|
||||||
|
- Extraction: 93% EXTRACTED · 7% INFERRED · 0% AMBIGUOUS · INFERRED: 27 edges (avg confidence: 0.85)
|
||||||
|
- Token cost: 0 input · 0 output
|
||||||
|
|
||||||
|
## Graph Freshness
|
||||||
|
- Built from commit: `1ac50951`
|
||||||
|
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||||
|
- Run `graphify update .` after code changes (no API cost).
|
||||||
|
|
||||||
|
## Community Hubs (Navigation)
|
||||||
|
- useTvMonitorPage
|
||||||
|
- ref_utils
|
||||||
|
- index.vue
|
||||||
|
- productPrice.ts
|
||||||
|
- forceReconnect
|
||||||
|
- api/products.ts
|
||||||
|
- priceSocket.ts
|
||||||
|
- connect
|
||||||
|
- useProductsPageData.ts
|
||||||
|
- AuthPriceStream
|
||||||
|
- initPriceRealtimeChannel
|
||||||
|
|
||||||
|
## God Nodes (most connected - your core abstractions)
|
||||||
|
1. `useTvMonitorPage()` - 28 edges
|
||||||
|
2. `connect()` - 15 edges
|
||||||
|
3. `getProductBaseBuyPrice()` - 10 edges
|
||||||
|
4. `touchStreamActivity()` - 9 edges
|
||||||
|
5. `runFallbackPoll()` - 9 edges
|
||||||
|
6. `bindStreamEvents()` - 9 edges
|
||||||
|
7. `forceReconnect()` - 9 edges
|
||||||
|
8. `maybeShowNetworkAlert()` - 8 edges
|
||||||
|
9. `disconnect()` - 8 edges
|
||||||
|
10. `applyProductsList()` - 8 edges
|
||||||
|
|
||||||
|
## Surprising Connections (you probably didn't know these)
|
||||||
|
- `connect()` --calls--> `AuthPriceStream` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 9 → community 7_
|
||||||
|
- `connect()` --calls--> `resolveStreamUrl()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 10 → community 7_
|
||||||
|
- `forceReconnect()` --calls--> `clearReconnectTimer()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 7 → community 4_
|
||||||
|
- `connect()` --calls--> `touchStreamActivity()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 1 → community 7_
|
||||||
|
- `connect()` --calls--> `stopFallbackPolling()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 6 → community 7_
|
||||||
|
|
||||||
|
## Import Cycles
|
||||||
|
- None detected.
|
||||||
|
|
||||||
|
## Communities (11 total, 1 thin omitted)
|
||||||
|
|
||||||
|
### Community 0 - "useTvMonitorPage"
|
||||||
|
Cohesion: 0.09
|
||||||
|
Nodes (33): ref_api, ref_assets, ref_moment, ref_moment_jalaali, ref_vueuse_core, bankCoinRank(), floorTvToman(), formatTvPrice() (+25 more)
|
||||||
|
|
||||||
|
### Community 1 - "ref_utils"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (15): ref_composables, ref_store, ref_utils, applyAppNotificationFromStream(), applyLastFromStream(), applySettingsFromStream(), applyUnreadCountFromStreamPayload(), bindStreamEvents() (+7 more)
|
||||||
|
|
||||||
|
### Community 2 - "index.vue"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (15): ref_components, ref_vue, coinColumns, extraTickerLoop, loopNews(), loopTicker(), marqueeCopies(), newsDuration() (+7 more)
|
||||||
|
|
||||||
|
### Community 3 - "productPrice.ts"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (25): applyPriceOffsetPercent(), buyCashFee(), cashFeeOptions(), colleagueSideUnit(), getColleagueSourcedUnitPrice(), getProductBaseBuyPrice(), getProductBaseSellPrice(), getProductBuyPrice() (+17 more)
|
||||||
|
|
||||||
|
### Community 4 - "forceReconnect"
|
||||||
|
Cohesion: 0.21
|
||||||
|
Nodes (16): bindBrowserNetworkListeners(), forceReconnect(), isPageVisible(), maybeShowNetworkAlert(), notifyPriceLastFetchFailed(), onBrowserOffline(), onBrowserOnline(), onPageShow() (+8 more)
|
||||||
|
|
||||||
|
### Community 5 - "api/products.ts"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (5): ref_models, TvServerTime, CountPInventory, PInventory, Product
|
||||||
|
|
||||||
|
### Community 6 - "priceSocket.ts"
|
||||||
|
Cohesion: 0.16
|
||||||
|
Nodes (12): ref_ant_design_vue, ref_views, clearFallbackPollTimer(), clearPriceNetworkAlert(), getPriceSourceStaleMs(), isMobileDevice(), isRealPriceOutage(), onTvBoard() (+4 more)
|
||||||
|
|
||||||
|
### Community 7 - "connect"
|
||||||
|
Cohesion: 0.36
|
||||||
|
Nodes (10): clearConnectingLifecycle(), clearReconnectTimer(), connect(), disconnect(), disconnectSourceOnly(), handleStreamLost(), markConnectingLifecycle(), scheduleReconnect() (+2 more)
|
||||||
|
|
||||||
|
### Community 8 - "useProductsPageData.ts"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (31): applyProductsList(), applyProductsListFromSocket(), applySocketProductList(), changeProductsTab(), flagOff(), flagOn(), initialized, initProductsPageData() (+23 more)
|
||||||
|
|
||||||
|
### Community 10 - "initPriceRealtimeChannel"
|
||||||
|
Cohesion: 0.60
|
||||||
|
Nodes (5): initPriceRealtimeChannel(), isPriceWebSocketEnabled(), isTruthySetting(), resolveStreamPath(), resolveStreamUrl()
|
||||||
|
|
||||||
|
## Knowledge Gaps
|
||||||
|
- **13 isolated node(s):** `initialized`, `productsActiveKey`, `productsTypeItems`, `productsFirstItems`, `productsItems` (+8 more)
|
||||||
|
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 37 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
|
||||||
|
- **1 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||||
|
|
||||||
|
## Suggested Questions
|
||||||
|
_Questions this graph is uniquely positioned to answer:_
|
||||||
|
|
||||||
|
- **Why does `AuthPriceStream` connect `AuthPriceStream` to `priceSocket.ts`, `connect`?**
|
||||||
|
_High betweenness centrality (0.035) - this node is a cross-community bridge._
|
||||||
|
- **Why does `runFallbackPoll()` connect `priceSocket.ts` to `ref_utils`, `forceReconnect`?**
|
||||||
|
_High betweenness centrality (0.019) - this node is a cross-community bridge._
|
||||||
|
- **Are the 13 inferred relationships involving `useTvMonitorPage()` (e.g. with `isBankCoin()` and `isGoldBar()`) actually correct?**
|
||||||
|
_`useTvMonitorPage()` has 13 INFERRED edges - model-reasoned connections that need verification._
|
||||||
|
- **What connects `initialized`, `productsActiveKey`, `productsTypeItems` to the rest of the system?**
|
||||||
|
_13 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||||
|
- **Should `useTvMonitorPage` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.09309309309309309 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `useProductsPageData.ts` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.11931818181818182 - nodes in this community are weakly interconnected._
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"0": "useTvMonitorPage",
|
||||||
|
"1": "ref_utils",
|
||||||
|
"2": "index.vue",
|
||||||
|
"3": "productPrice.ts",
|
||||||
|
"5": "api/products.ts",
|
||||||
|
"6": "priceSocket.ts",
|
||||||
|
"8": "useProductsPageData.ts",
|
||||||
|
"9": "AuthPriceStream"
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
# Graph Report - ghatreh_user (2026-09-28)
|
||||||
|
|
||||||
|
## Corpus Check
|
||||||
|
- 598 files · ~506,836 words
|
||||||
|
- Verdict: corpus is large enough that graph structure adds value.
|
||||||
|
- Unclassified: 51 file(s) not represented in the graph (top: .less 25, .eot 6, .ttf 6)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- 198 nodes · 409 edges · 8 communities (7 shown, 1 thin omitted)
|
||||||
|
- Extraction: 93% EXTRACTED · 7% INFERRED · 0% AMBIGUOUS · INFERRED: 28 edges (avg confidence: 0.85)
|
||||||
|
- Token cost: 0 input · 0 output
|
||||||
|
|
||||||
|
## Graph Freshness
|
||||||
|
- Built from commit: `9cb09796`
|
||||||
|
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||||
|
- Run `graphify update .` after code changes (no API cost).
|
||||||
|
|
||||||
|
## Community Hubs (Navigation)
|
||||||
|
- useTvMonitorPage
|
||||||
|
- ref_utils
|
||||||
|
- index.vue
|
||||||
|
- productPrice.ts
|
||||||
|
- api/products.ts
|
||||||
|
- priceSocket.ts
|
||||||
|
- useProductsPageData.ts
|
||||||
|
- AuthPriceStream
|
||||||
|
|
||||||
|
## God Nodes (most connected - your core abstractions)
|
||||||
|
1. `useTvMonitorPage()` - 25 edges
|
||||||
|
2. `connect()` - 15 edges
|
||||||
|
3. `getProductBaseBuyPrice()` - 10 edges
|
||||||
|
4. `touchStreamActivity()` - 9 edges
|
||||||
|
5. `bindStreamEvents()` - 9 edges
|
||||||
|
6. `forceReconnect()` - 9 edges
|
||||||
|
7. `runFallbackPoll()` - 8 edges
|
||||||
|
8. `maybeShowNetworkAlert()` - 8 edges
|
||||||
|
9. `disconnect()` - 8 edges
|
||||||
|
10. `applyProductsList()` - 8 edges
|
||||||
|
|
||||||
|
## Surprising Connections (you probably didn't know these)
|
||||||
|
- `connect()` --calls--> `AuthPriceStream` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 9 → community 6_
|
||||||
|
- `connect()` --calls--> `touchStreamActivity()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 1 → community 6_
|
||||||
|
|
||||||
|
## Import Cycles
|
||||||
|
- None detected.
|
||||||
|
|
||||||
|
## Communities (8 total, 1 thin omitted)
|
||||||
|
|
||||||
|
### Community 0 - "useTvMonitorPage"
|
||||||
|
Cohesion: 0.10
|
||||||
|
Nodes (30): ref_api, ref_assets, ref_moment, ref_moment_jalaali, ref_vueuse_core, bankCoinRank(), floorTvToman(), formatTvPrice() (+22 more)
|
||||||
|
|
||||||
|
### Community 1 - "ref_utils"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (15): ref_composables, ref_store, ref_utils, applyAppNotificationFromStream(), applyLastFromStream(), applySettingsFromStream(), applyUnreadCountFromStreamPayload(), bindStreamEvents() (+7 more)
|
||||||
|
|
||||||
|
### Community 2 - "index.vue"
|
||||||
|
Cohesion: 0.10
|
||||||
|
Nodes (23): ref_components, ref_views, ref_vue, priceSocketConnected, priceStreamConnectingSince, priceStreamLifecycle, priceStreamList, priceStreamProducts (+15 more)
|
||||||
|
|
||||||
|
### Community 3 - "productPrice.ts"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (24): applyPriceOffsetPercent(), buyCashFee(), cashFeeOptions(), getColleagueSourcedUnitPrice(), getProductBaseBuyPrice(), getProductBaseSellPrice(), getProductBuyPrice(), getProductSellPrice() (+16 more)
|
||||||
|
|
||||||
|
### Community 5 - "api/products.ts"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (5): ref_models, TvServerTime, CountPInventory, PInventory, Product
|
||||||
|
|
||||||
|
### Community 6 - "priceSocket.ts"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (41): ref_ant_design_vue, bindBrowserNetworkListeners(), clearConnectingLifecycle(), clearFallbackPollTimer(), clearPriceNetworkAlert(), clearReconnectTimer(), connect(), disconnect() (+33 more)
|
||||||
|
|
||||||
|
### Community 8 - "useProductsPageData.ts"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (31): applyProductsList(), applyProductsListFromSocket(), applySocketProductList(), changeProductsTab(), flagOff(), flagOn(), initialized, initProductsPageData() (+23 more)
|
||||||
|
|
||||||
|
## Knowledge Gaps
|
||||||
|
- **20 isolated node(s):** `Product`, `PInventory`, `CountPInventory`, `priceSocketConnected`, `priceWssEnabled` (+15 more)
|
||||||
|
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 43 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
|
||||||
|
- **1 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||||
|
|
||||||
|
## Suggested Questions
|
||||||
|
_Questions this graph is uniquely positioned to answer:_
|
||||||
|
|
||||||
|
- **Why does `AuthPriceStream` connect `AuthPriceStream` to `priceSocket.ts`?**
|
||||||
|
_High betweenness centrality (0.035) - this node is a cross-community bridge._
|
||||||
|
- **Why does `runFallbackPoll()` connect `priceSocket.ts` to `ref_utils`, `index.vue`?**
|
||||||
|
_High betweenness centrality (0.016) - this node is a cross-community bridge._
|
||||||
|
- **Are the 14 inferred relationships involving `useTvMonitorPage()` (e.g. with `isBankCoin()` and `isGoldBar()`) actually correct?**
|
||||||
|
_`useTvMonitorPage()` has 14 INFERRED edges - model-reasoned connections that need verification._
|
||||||
|
- **What connects `Product`, `PInventory`, `CountPInventory` to the rest of the system?**
|
||||||
|
_20 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||||
|
- **Should `useTvMonitorPage` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.09982174688057041 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `index.vue` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.10153846153846154 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `priceSocket.ts` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.10638297872340426 - nodes in this community are weakly interconnected._
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
# Graph Report - ghatreh_user (2026-09-29)
|
||||||
|
|
||||||
|
## Corpus Check
|
||||||
|
- 598 files · ~506,875 words
|
||||||
|
- Verdict: corpus is large enough that graph structure adds value.
|
||||||
|
- Unclassified: 51 file(s) not represented in the graph (top: .less 25, .eot 6, .ttf 6)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- 208 nodes · 426 edges · 10 communities (9 shown, 1 thin omitted)
|
||||||
|
- Extraction: 92% EXTRACTED · 8% INFERRED · 0% AMBIGUOUS · INFERRED: 33 edges (avg confidence: 0.85)
|
||||||
|
- Token cost: 0 input · 0 output
|
||||||
|
|
||||||
|
## Graph Freshness
|
||||||
|
- Built from commit: `da68f0a5`
|
||||||
|
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||||
|
- Run `graphify update .` after code changes (no API cost).
|
||||||
|
|
||||||
|
## Community Hubs (Navigation)
|
||||||
|
- useTvMonitorPage
|
||||||
|
- ref_utils
|
||||||
|
- index.vue
|
||||||
|
- productPrice.ts
|
||||||
|
- useNewPhysicalRequestPage.ts
|
||||||
|
- api/products.ts
|
||||||
|
- priceSocket.ts
|
||||||
|
- priceSocketState.ts
|
||||||
|
- useProductsPageData.ts
|
||||||
|
- AuthPriceStream
|
||||||
|
|
||||||
|
## God Nodes (most connected - your core abstractions)
|
||||||
|
1. `useTvMonitorPage()` - 25 edges
|
||||||
|
2. `connect()` - 15 edges
|
||||||
|
3. `getProductBaseBuyPrice()` - 10 edges
|
||||||
|
4. `bindStreamEvents()` - 9 edges
|
||||||
|
5. `touchStreamActivity()` - 9 edges
|
||||||
|
6. `forceReconnect()` - 9 edges
|
||||||
|
7. `useNewPhysicalRequestPage()` - 8 edges
|
||||||
|
8. `applyProductsList()` - 8 edges
|
||||||
|
9. `applySocketProductList()` - 8 edges
|
||||||
|
10. `disconnect()` - 8 edges
|
||||||
|
|
||||||
|
## Surprising Connections (you probably didn't know these)
|
||||||
|
- `connect()` --calls--> `AuthPriceStream` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 9 → community 6_
|
||||||
|
- `connect()` --calls--> `bindStreamEvents()` [EXTRACTED]
|
||||||
|
src/utils/priceSocket.ts → src/utils/priceSocket.ts _Bridges community 1 → community 6_
|
||||||
|
|
||||||
|
## Import Cycles
|
||||||
|
- None detected.
|
||||||
|
|
||||||
|
## Communities (10 total, 1 thin omitted)
|
||||||
|
|
||||||
|
### Community 0 - "useTvMonitorPage"
|
||||||
|
Cohesion: 0.10
|
||||||
|
Nodes (29): ref_assets, ref_moment, ref_moment_jalaali, ref_vueuse_core, bankCoinRank(), floorTvToman(), formatTvPrice(), isBankCoin() (+21 more)
|
||||||
|
|
||||||
|
### Community 1 - "ref_utils"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (15): ref_composables, ref_store, ref_utils, applyAppNotificationFromStream(), applyLastFromStream(), applySettingsFromStream(), applyUnreadCountFromStreamPayload(), bindStreamEvents() (+7 more)
|
||||||
|
|
||||||
|
### Community 2 - "index.vue"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (15): ref_components, ref_views, coinColumns, extraTickerLoop, loopNews(), loopTicker(), marqueeCopies(), newsDuration() (+7 more)
|
||||||
|
|
||||||
|
### Community 3 - "productPrice.ts"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (24): applyPriceOffsetPercent(), buyCashFee(), cashFeeOptions(), getColleagueSourcedUnitPrice(), getProductBaseBuyPrice(), getProductBaseSellPrice(), getProductBuyPrice(), getProductSellPrice() (+16 more)
|
||||||
|
|
||||||
|
### Community 4 - "useNewPhysicalRequestPage.ts"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (13): ref_ant_design_vue, ref_api, ref_lodash, ref_router, NEW_PHYSICAL_REQUEST_KEY, NewPhysicalRequestContext, useNewPhysicalRequestPage(), getAddress() (+5 more)
|
||||||
|
|
||||||
|
### Community 5 - "api/products.ts"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (5): ref_models, TvServerTime, CountPInventory, PInventory, Product
|
||||||
|
|
||||||
|
### Community 6 - "priceSocket.ts"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (40): bindBrowserNetworkListeners(), clearConnectingLifecycle(), clearFallbackPollTimer(), clearPriceNetworkAlert(), clearReconnectTimer(), connect(), disconnect(), disconnectSourceOnly() (+32 more)
|
||||||
|
|
||||||
|
### Community 7 - "priceSocketState.ts"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (8): ref_vue, priceSocketConnected, priceStreamConnectingSince, priceStreamLifecycle, priceStreamList, priceStreamProducts, priceStreamServerUnix, priceWssEnabled
|
||||||
|
|
||||||
|
### Community 8 - "useProductsPageData.ts"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (31): applyProductsList(), applyProductsListFromSocket(), applySocketProductList(), changeProductsTab(), flagOff(), flagOn(), initialized, initProductsPageData() (+23 more)
|
||||||
|
|
||||||
|
## Knowledge Gaps
|
||||||
|
- **22 isolated node(s):** `NewPhysicalRequestContext`, `NEW_PHYSICAL_REQUEST_KEY`, `initialized`, `productsActiveKey`, `productsTypeItems` (+17 more)
|
||||||
|
These have ≤1 connection - possible missing edges or undocumented components. (Counts symbols only; 45 node(s) total have ≤1 connection when file, concept and rationale nodes are included.)
|
||||||
|
- **1 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||||
|
|
||||||
|
## Suggested Questions
|
||||||
|
_Questions this graph is uniquely positioned to answer:_
|
||||||
|
|
||||||
|
- **Why does `AuthPriceStream` connect `AuthPriceStream` to `priceSocket.ts`?**
|
||||||
|
_High betweenness centrality (0.033) - this node is a cross-community bridge._
|
||||||
|
- **Are the 14 inferred relationships involving `useTvMonitorPage()` (e.g. with `isBankCoin()` and `isGoldBar()`) actually correct?**
|
||||||
|
_`useTvMonitorPage()` has 14 INFERRED edges - model-reasoned connections that need verification._
|
||||||
|
- **What connects `NewPhysicalRequestContext`, `NEW_PHYSICAL_REQUEST_KEY`, `initialized` to the rest of the system?**
|
||||||
|
_22 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||||
|
- **Should `useTvMonitorPage` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.10416666666666667 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `useNewPhysicalRequestPage.ts` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.12418300653594772 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `priceSocket.ts` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.1378048780487805 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `useProductsPageData.ts` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.125 - nodes in this community are weakly interconnected._
|
||||||
@@ -41,8 +41,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.boot-loader {
|
.boot-loader {
|
||||||
min-height: 100vh;
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 2147483646;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
min-height: 100dvh;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
direction: rtl;
|
direction: rtl;
|
||||||
@@ -53,71 +59,36 @@
|
|||||||
"Segoe UI",
|
"Segoe UI",
|
||||||
sans-serif;
|
sans-serif;
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at top, var(--boot-orb), transparent 38%),
|
radial-gradient(ellipse 70% 45% at 50% 28%, var(--boot-orb), transparent 70%),
|
||||||
linear-gradient(
|
linear-gradient(180deg, var(--boot-bg) 0%, var(--boot-bg-soft) 100%);
|
||||||
135deg,
|
|
||||||
var(--boot-bg) 0%,
|
|
||||||
var(--boot-bg-soft) 100%
|
|
||||||
);
|
|
||||||
color: var(--boot-text);
|
color: var(--boot-text);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boot-loader__card {
|
.boot-loader__logo {
|
||||||
position: relative;
|
height: min(20vh, 160px);
|
||||||
width: min(340px, calc(100vw - 48px));
|
width: auto;
|
||||||
padding: 30px 22px 28px;
|
max-width: min(70vw, 280px);
|
||||||
border-radius: 24px;
|
object-fit: contain;
|
||||||
text-align: center;
|
opacity: 0;
|
||||||
background: var(--boot-card);
|
transition: opacity 0.28s ease;
|
||||||
border: 1px solid var(--boot-border);
|
|
||||||
box-shadow: 0 18px 48px var(--boot-shadow);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.boot-loader__orb {
|
.boot-loader__logo.is-ready {
|
||||||
position: absolute;
|
opacity: 1;
|
||||||
top: -72px;
|
|
||||||
left: 50%;
|
|
||||||
width: 150px;
|
|
||||||
height: 150px;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
border-radius: 999px;
|
|
||||||
background: var(--boot-orb);
|
|
||||||
filter: blur(8px);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.boot-loader__spinner {
|
.boot-loader__spinner {
|
||||||
position: relative;
|
position: absolute;
|
||||||
z-index: 1;
|
bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
|
||||||
width: 56px;
|
width: 26px;
|
||||||
height: 56px;
|
height: 26px;
|
||||||
margin: 0 auto 20px;
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
border: 4px solid var(--boot-spinner-track);
|
border: 3px solid var(--boot-spinner-track);
|
||||||
border-top-color: var(--boot-accent);
|
border-top-color: var(--boot-accent);
|
||||||
animation: boot-spin 0.9s linear infinite;
|
animation: boot-spin 0.9s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boot-loader__title {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
margin: 0;
|
|
||||||
font-size: 19px;
|
|
||||||
font-weight: 800;
|
|
||||||
letter-spacing: -0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.boot-loader__text {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
margin: 10px 0 0;
|
|
||||||
color: var(--boot-muted);
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes boot-spin {
|
@keyframes boot-spin {
|
||||||
to {
|
to {
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
@@ -143,16 +114,25 @@
|
|||||||
try {
|
try {
|
||||||
var rawCookie = getCookie(CONFIG_COOKIE_NAME)
|
var rawCookie = getCookie(CONFIG_COOKIE_NAME)
|
||||||
|
|
||||||
if (!rawCookie) return null
|
if (rawCookie) {
|
||||||
|
var decoded = decodeURIComponent(rawCookie)
|
||||||
var decoded = decodeURIComponent(rawCookie)
|
var payload = JSON.parse(decoded)
|
||||||
var payload = JSON.parse(decoded)
|
if (payload && payload.config) return payload.config
|
||||||
|
}
|
||||||
return payload && payload.config ? payload.config : null
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Boot theme: failed to read cached config', error)
|
console.warn('Boot theme: failed to read cached config', error)
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var rawLs = localStorage.getItem('APP_CONFIG_LS_CACHE')
|
||||||
|
if (!rawLs) return null
|
||||||
|
var lsPayload = JSON.parse(rawLs)
|
||||||
|
if (lsPayload && lsPayload.config) return lsPayload.config
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Boot theme: failed to read LS config cache', error)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeHex(hex) {
|
function normalizeHex(hex) {
|
||||||
@@ -238,6 +218,146 @@
|
|||||||
document.documentElement.style.setProperty(name, value)
|
document.documentElement.style.setProperty(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var BOOT_LOGO_KEY = 'BOOT_LOGO_URL'
|
||||||
|
var BOOT_LOGO_VERSION_KEY = 'BOOT_LOGO_VERSION'
|
||||||
|
|
||||||
|
function rewriteLegacyBootLogoUrl(url) {
|
||||||
|
var value = String(url || '').trim()
|
||||||
|
if (!value) return ''
|
||||||
|
if (value.indexOf('/uploads/') === 0) {
|
||||||
|
var base = 'https://adm.montzar.ir'
|
||||||
|
try {
|
||||||
|
var last = localStorage.getItem('CONFIG_Success_URL')
|
||||||
|
if (last) {
|
||||||
|
var sa = new URL(last)
|
||||||
|
var path = sa.pathname.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||||
|
base = path && path !== '/' ? sa.origin + path : sa.origin
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
return base + value
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickAvatarRaw(value) {
|
||||||
|
if (value == null) return ''
|
||||||
|
if (typeof value === 'string') return String(value).trim()
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
return String(value.full_src || value.url || value.src || value.avatar || '').trim()
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function logoCacheValid() {
|
||||||
|
try {
|
||||||
|
var v = String(localStorage.getItem('version') || '').trim()
|
||||||
|
var lv = String(localStorage.getItem(BOOT_LOGO_VERSION_KEY) || '').trim()
|
||||||
|
if (v && lv && v !== lv) return false
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readCachedLogoUrl() {
|
||||||
|
if (!logoCacheValid()) return ''
|
||||||
|
try {
|
||||||
|
return String(localStorage.getItem(BOOT_LOGO_KEY) || '').trim()
|
||||||
|
} catch (e) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveAbsoluteLogoUrl(raw) {
|
||||||
|
if (!raw) return ''
|
||||||
|
if (/^(https?:\/\/|data:|blob:)/i.test(raw)) {
|
||||||
|
var abs = window.location.protocol === 'https:' ? raw.replace(/^http:\/\//i, 'https://') : raw
|
||||||
|
return rewriteLegacyBootLogoUrl(abs)
|
||||||
|
}
|
||||||
|
var path = raw.replace(/^\/+/, '')
|
||||||
|
return window.location.origin + '/server/' + path
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveBootLogoUrl(config) {
|
||||||
|
var nested = config && config.user && typeof config.user === 'object' ? config.user : {}
|
||||||
|
var fromUser = rewriteLegacyBootLogoUrl(pickAvatarRaw(nested.avatar))
|
||||||
|
if (fromUser) return resolveAbsoluteLogoUrl(fromUser)
|
||||||
|
|
||||||
|
var cached = readCachedLogoUrl()
|
||||||
|
if (cached && /^(data:|blob:)/i.test(cached)) return cached
|
||||||
|
return resolveAbsoluteLogoUrl(cached)
|
||||||
|
}
|
||||||
|
|
||||||
|
function persistLogoCache(logoUrl) {
|
||||||
|
try {
|
||||||
|
var v = String(localStorage.getItem('version') || '').trim()
|
||||||
|
if (v) localStorage.setItem(BOOT_LOGO_VERSION_KEY, v)
|
||||||
|
if (!logoUrl) return
|
||||||
|
localStorage.setItem(BOOT_LOGO_KEY, logoUrl)
|
||||||
|
if (logoUrl.indexOf('data:') === 0 || typeof fetch !== 'function') return
|
||||||
|
try {
|
||||||
|
if (new URL(logoUrl, window.location.href).origin !== window.location.origin) return
|
||||||
|
} catch (e) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fetch(logoUrl, { mode: 'cors', credentials: 'omit' })
|
||||||
|
.then(function (res) {
|
||||||
|
return res && res.ok ? res.blob() : Promise.reject()
|
||||||
|
})
|
||||||
|
.then(function (blob) {
|
||||||
|
if (!blob || blob.size > 450000) return
|
||||||
|
var reader = new FileReader()
|
||||||
|
reader.onloadend = function () {
|
||||||
|
try {
|
||||||
|
if (typeof reader.result === 'string' && reader.result.indexOf('data:') === 0) {
|
||||||
|
localStorage.setItem(BOOT_LOGO_KEY, reader.result)
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
reader.readAsDataURL(blob)
|
||||||
|
})
|
||||||
|
.catch(function () {})
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyBootLogo(config) {
|
||||||
|
var img = document.getElementById('boot-logo')
|
||||||
|
if (!img) return
|
||||||
|
|
||||||
|
var logoUrl = resolveBootLogoUrl(config || {})
|
||||||
|
if (!logoUrl) {
|
||||||
|
img.hidden = true
|
||||||
|
img.removeAttribute('src')
|
||||||
|
img.classList.remove('is-ready')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
function markReady() {
|
||||||
|
img.hidden = false
|
||||||
|
img.removeAttribute('hidden')
|
||||||
|
img.classList.add('is-ready')
|
||||||
|
persistLogoCache(logoUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
img.onload = markReady
|
||||||
|
img.onerror = function () {
|
||||||
|
img.hidden = true
|
||||||
|
img.classList.remove('is-ready')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (img.getAttribute('src') === logoUrl && img.complete && img.naturalWidth > 0) {
|
||||||
|
markReady()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
img.hidden = false
|
||||||
|
img.removeAttribute('hidden')
|
||||||
|
img.src = logoUrl
|
||||||
|
if (logoUrl.indexOf('data:') === 0) markReady()
|
||||||
|
}
|
||||||
|
|
||||||
|
window.__APPLY_BOOT_BRANDING__ = applyBootLogo
|
||||||
|
|
||||||
function applyBootTheme() {
|
function applyBootTheme() {
|
||||||
var config = readCachedConfig()
|
var config = readCachedConfig()
|
||||||
var user = config && config.user ? config.user : null
|
var user = config && config.user ? config.user : null
|
||||||
@@ -289,6 +409,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
applyBootTheme()
|
applyBootTheme()
|
||||||
|
applyBootLogo(readCachedConfig())
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@@ -296,15 +417,15 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="boot-loader">
|
<div class="boot-loader">
|
||||||
<div class="boot-loader__card">
|
<img id="boot-logo" class="boot-loader__logo" alt="" decoding="async" hidden />
|
||||||
<div class="boot-loader__orb"></div>
|
<div class="boot-loader__spinner" aria-hidden="true"></div>
|
||||||
<div class="boot-loader__spinner"></div>
|
|
||||||
|
|
||||||
<h1 class="boot-loader__title">در حال هدایت به سامانه</h1>
|
|
||||||
<p class="boot-loader__text">لطفاً چند لحظه صبر کنید...</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
if (typeof window.__APPLY_BOOT_BRANDING__ === 'function') {
|
||||||
|
window.__APPLY_BOOT_BRANDING__()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
;(function () {
|
;(function () {
|
||||||
@@ -325,28 +446,63 @@
|
|||||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVersionUrls() {
|
function resolveTenantDomain() {
|
||||||
var protocol = getProtocol()
|
var host = String(window.location.hostname || '').trim()
|
||||||
|
if (!host || host === 'localhost' || host === '127.0.0.1') {
|
||||||
|
return 'k.montzar.ir'
|
||||||
|
}
|
||||||
|
return host
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSuperAdminBases() {
|
||||||
return [
|
return [
|
||||||
'https://nerkh.gold/get_version',
|
'https://adm.montzar.ir',
|
||||||
'https://tablo.talasevin.ir/get_version',
|
'https://adm.montech.ir',
|
||||||
'https://abshode-service.montgit.ir/server/get_version',
|
'https://adm.montest.ir'
|
||||||
protocol + '//212.23.201.173:8381/get_version',
|
|
||||||
protocol + '//91.212.174.137:4040/server/get_version'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfigUrls() {
|
function isDevHost() {
|
||||||
var protocol = getProtocol()
|
var host = String(window.location.hostname || '').trim()
|
||||||
|
return host === 'localhost' || host === '127.0.0.1'
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
function getVersionUrls() {
|
||||||
protocol + '//nerkh.gold/get_user',
|
var domain = encodeURIComponent(resolveTenantDomain())
|
||||||
protocol + '//tablo.talasevin.ir/get_user',
|
var urls = getSuperAdminBases().map(function (base) {
|
||||||
protocol + '//abshode-service.montgit.ir/server/get_user',
|
return base + '/get_version?domain=' + domain
|
||||||
protocol + '//212.23.201.173:8381/get_user',
|
})
|
||||||
protocol + '//91.212.174.137:4040/server/get_user'
|
|
||||||
]
|
if (isDevHost()) {
|
||||||
|
var protocol = getProtocol()
|
||||||
|
urls = urls.concat([
|
||||||
|
'https://tablo.talasevin.ir/get_version',
|
||||||
|
'https://abshode-service.montgit.ir/server/get_version',
|
||||||
|
protocol + '//212.23.201.173:8381/get_version',
|
||||||
|
protocol + '//91.212.174.137:4040/server/get_version'
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
return urls
|
||||||
|
}
|
||||||
|
|
||||||
|
function getConfigUrls() {
|
||||||
|
var domain = encodeURIComponent(resolveTenantDomain())
|
||||||
|
var urls = getSuperAdminBases().map(function (base) {
|
||||||
|
return base + '/get_user?domain=' + domain
|
||||||
|
})
|
||||||
|
|
||||||
|
if (isDevHost()) {
|
||||||
|
var protocol = getProtocol()
|
||||||
|
urls = urls.concat([
|
||||||
|
protocol + '//tablo.talasevin.ir/get_user',
|
||||||
|
protocol + '//abshode-service.montgit.ir/server/get_user',
|
||||||
|
protocol + '//212.23.201.173:8381/get_user',
|
||||||
|
protocol + '//91.212.174.137:4040/server/get_user'
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
return urls
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortVersionUrls(urls) {
|
function sortVersionUrls(urls) {
|
||||||
@@ -536,6 +692,10 @@
|
|||||||
CONFIG_COOKIE_MAX_AGE_SECONDS +
|
CONFIG_COOKIE_MAX_AGE_SECONDS +
|
||||||
'; SameSite=Lax' +
|
'; SameSite=Lax' +
|
||||||
secure
|
secure
|
||||||
|
|
||||||
|
if (typeof window.__APPLY_BOOT_BRANDING__ === 'function') {
|
||||||
|
window.__APPLY_BOOT_BRANDING__(config)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Failed to write config cookie:', error)
|
console.warn('Failed to write config cookie:', error)
|
||||||
}
|
}
|
||||||
@@ -624,10 +784,10 @@
|
|||||||
'<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>' +
|
'<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>' +
|
||||||
'<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در بارگذاری برنامه</h2>' +
|
'<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در بارگذاری برنامه</h2>' +
|
||||||
'<p style="margin: 0 0 20px; color: var(--boot-muted); line-height: 2; font-size: 14px;">' +
|
'<p style="margin: 0 0 20px; color: var(--boot-muted); line-height: 2; font-size: 14px;">' +
|
||||||
'ارتباط با سرور برقرار نشد یا فایلهای برنامه بهدرستی دریافت نشدند.' +
|
'برقراری ارتباط با سرور امکانپذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازهسازی نمایید.' +
|
||||||
'</p>' +
|
'</p>' +
|
||||||
'<button onclick="window.__APP_BOOT_SIMPLE_RETRY__()" style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent); color: white; cursor: pointer; font-weight: 700;">' +
|
'<button onclick="window.__APP_BOOT_SIMPLE_RETRY__()" style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent); color: white; cursor: pointer; font-weight: 700;">' +
|
||||||
'تلاش مجدد' +
|
'تازهسازی صفحه' +
|
||||||
'</button>' +
|
'</button>' +
|
||||||
'<button onclick="window.__APP_BOOT_CLEAN_RELOAD__()" style="margin-right: 8px; padding: 11px 18px; border: 1px solid var(--boot-border); border-radius: 12px; background: transparent; color: var(--boot-text); cursor: pointer; font-weight: 700;">' +
|
'<button onclick="window.__APP_BOOT_CLEAN_RELOAD__()" style="margin-right: 8px; padding: 11px 18px; border: 1px solid var(--boot-border); border-radius: 12px; background: transparent; color: var(--boot-text); cursor: pointer; font-weight: 700;">' +
|
||||||
'پاکسازی و تلاش مجدد' +
|
'پاکسازی و تلاش مجدد' +
|
||||||
@@ -639,8 +799,8 @@
|
|||||||
async function cleanFetchAndReload() {
|
async function cleanFetchAndReload() {
|
||||||
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
|
renderRecovering('در حال دریافت تنظیمات جدید برنامه...')
|
||||||
|
|
||||||
var version = await loadRemoteVersion(5)
|
var version = await loadRemoteVersion(3)
|
||||||
var freshConfigResult = await fetchFreshConfig(5)
|
var freshConfigResult = await fetchFreshConfig(3)
|
||||||
|
|
||||||
clearReadableCookies()
|
clearReadableCookies()
|
||||||
// clearLocalStorageExceptToken()
|
// clearLocalStorageExceptToken()
|
||||||
|
|||||||
@@ -39,7 +39,8 @@
|
|||||||
"vue3-apexcharts": "^1.4.4",
|
"vue3-apexcharts": "^1.4.4",
|
||||||
"vue3-lazyload": "^0.3.8",
|
"vue3-lazyload": "^0.3.8",
|
||||||
"vue3-odometer": "^0.1.3",
|
"vue3-odometer": "^0.1.3",
|
||||||
"vue3-otp-input": "^0.4.1"
|
"vue3-otp-input": "^0.4.1",
|
||||||
|
"wavesurfer.js": "^7.12.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rushstack/eslint-patch": "^1.3.2",
|
"@rushstack/eslint-patch": "^1.3.2",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 583 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"nm":"Pre-comp 1","ddd":0,"h":1200,"w":1200,"meta":{"g":"LottieFiles AE 0.1.21"},"layers":[{"ty":4,"nm":"arrow down Outlines","sr":1,"st":0,"op":1020,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[256,256,0],"ix":1},"s":{"a":0,"k":[46.875,46.875,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[600,528,0],"t":0,"ti":[0,0,0],"to":[0,-15.333,0]},{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[600,436,0],"t":13,"ti":[0,-15.333,0],"to":[0,0,0]},{"s":[600,528,0],"t":27}],"ix":2,"x":"var $bm_rt;\n$bm_rt = loopOut('cycle');"},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Group 1","ix":1,"cix":2,"np":4,"it":[{"ty":"sh","bm":0,"hd":false,"mn":"ADBE Vector Shape - Group","nm":"Path 1","ix":1,"d":1,"ks":{"a":0,"k":{"c":true,"i":[[7.831,7.793],[7.792,-7.828],[0,0],[0,0],[11.045,0],[0,-11.046],[0,0],[0,0],[7.829,-7.792],[-7.791,-7.829],[0,0],[-0.005,-0.006],[-7.819,7.833],[-0.005,0.006],[0,0]],"o":[[-7.829,-7.792],[0,0],[0,0],[0,-11.046],[-11.046,0],[0,0],[0,0],[-7.792,-7.828],[-7.83,7.793],[0,0],[0.006,0.007],[7.792,7.809],[0.006,-0.007],[0,0],[7.79,-7.828]],"v":[[118.109,117.328],[89.825,117.394],[20.001,187.557],[20.001,-236],[0.001,-256],[-19.999,-236],[-19.999,187.557],[-89.824,117.393],[-118.107,117.327],[-118.175,145.612],[-14.175,250.116],[-14.157,250.134],[14.158,250.135],[14.176,250.117],[118.176,145.613]]},"ix":2}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[0.1608,0.1608,0.3843],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[255.999,256],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":1},{"ty":4,"nm":"Shape Layer 1","sr":1,"st":0,"op":1020,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[141,141,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[622.56,380.04,0],"t":0,"ti":[0,0,0],"to":[0,-15.333,0]},{"o":{"x":0.333,"y":0},"i":{"x":0.667,"y":1},"s":[622.56,288.04,0],"t":13,"ti":[0,-15.333,0],"to":[0,0,0]},{"s":[622.56,380.04,0],"t":27}],"ix":2,"x":"var $bm_rt;\n$bm_rt = loopOut('cycle');"},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[144,144],"ix":2}},{"ty":"fl","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Fill","nm":"Fill 1","c":{"a":0,"k":[1,1,1],"ix":4},"r":1,"o":{"a":0,"k":100,"ix":5}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[-16,156],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":2}],"v":"5.5.7","fr":30,"op":1020,"ip":0,"assets":[]}
|
||||||
|
Before Width: | Height: | Size: 30 KiB |
@@ -2,7 +2,6 @@
|
|||||||
<div class="desktopConfig w-full right-0 left-0">
|
<div class="desktopConfig w-full right-0 left-0">
|
||||||
<transition mode="out-in" name="fade">
|
<transition mode="out-in" name="fade">
|
||||||
<AConfigProvider
|
<AConfigProvider
|
||||||
v-if="!showSplash"
|
|
||||||
:theme="{
|
:theme="{
|
||||||
token: {
|
token: {
|
||||||
colorPrimary: colors.primary,
|
colorPrimary: colors.primary,
|
||||||
@@ -19,34 +18,10 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
</AConfigProvider>
|
</AConfigProvider>
|
||||||
|
|
||||||
<div v-else class="app-splash-screen flex items-center justify-center bg-white">
|
|
||||||
<div class="app-splash-screen__gradient app-splash-screen__gradient--top h-1/3 flex">
|
|
||||||
<img :src="img_topGradiant" alt="" class="absolute z-10 w-full h-full object-cover" />
|
|
||||||
<img :src="img_pattern" alt="" class="absolute w-full h-full object-none" />
|
|
||||||
</div>
|
|
||||||
<div class="app-splash-screen__gradient app-splash-screen__gradient--bottom h-1/3">
|
|
||||||
<img
|
|
||||||
:src="img_bottomGradiant"
|
|
||||||
alt=""
|
|
||||||
class="absolute z-10 w-full h-full object-cover"
|
|
||||||
/>
|
|
||||||
<img :src="img_pattern" alt="" class="absolute w-full h-full object-none" />
|
|
||||||
</div>
|
|
||||||
<div class="splash_appear_fade_in relative z-10">
|
|
||||||
<img :src="logoFull" class="h-[20vh] max-h-[180px] w-auto object-contain" alt="" />
|
|
||||||
</div>
|
|
||||||
<div class="app-splash-screen__version home_appear_fade_in_up">
|
|
||||||
<div class="text-center text-xs">نسخه: {{ displayVersion }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="app-splash-screen__spinner">
|
|
||||||
<a-spin :indicator="indicator" size="small" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="showSupportButton && !showSplash"
|
v-if="showSupportButton && route.name !== 'support' && !hideAppChrome"
|
||||||
id="support-button"
|
id="support-button"
|
||||||
ref="supportButtonEl"
|
ref="supportButtonEl"
|
||||||
class="draggable-support-button"
|
class="draggable-support-button"
|
||||||
@@ -61,94 +36,125 @@
|
|||||||
<div class="support-button-inner" :style="{ '--support-accent': supportAccentColor }">
|
<div class="support-button-inner" :style="{ '--support-accent': supportAccentColor }">
|
||||||
<BasicIcon :icon="supportIcon" size="18" class="support-button-icon" />
|
<BasicIcon :icon="supportIcon" size="18" class="support-button-icon" />
|
||||||
<span class="support-button-label">پشتیبانی</span>
|
<span class="support-button-label">پشتیبانی</span>
|
||||||
|
<span
|
||||||
|
v-if="supportChatUnreadCount > 0"
|
||||||
|
class="support-fab-badge"
|
||||||
|
>
|
||||||
|
{{ supportChatUnreadCount > 99 ? '99+' : supportChatUnreadCount }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<SupportMessengerPicker
|
<SupportMessengerPicker
|
||||||
v-model:open="supportPickerOpen"
|
v-model:open="supportPickerOpen"
|
||||||
:entries="supportMessengerEntries"
|
:entries="supportMessengerEntries"
|
||||||
:anchor-el="supportButtonEl"
|
:anchor-el="pickerAnchorEl"
|
||||||
@select="openSupportMessengerEntry"
|
@select="openMessengerEntry"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VersionUpdateModal />
|
<VersionUpdateModal />
|
||||||
|
|
||||||
|
<PwaInstallGuideModal
|
||||||
|
v-if="!hideAppChrome"
|
||||||
|
v-model:open="guideOpen"
|
||||||
|
:platform="platform"
|
||||||
|
@complete="completeGuide()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="!hideAppChrome && !isDesktop"
|
||||||
|
class="app-credit-footer app-credit-footer--mobile"
|
||||||
|
:class="{ 'app-credit-footer--login': isLoginRoute }"
|
||||||
|
>
|
||||||
|
<EnamadBadge v-if="isLoginRoute" size="sm" />
|
||||||
|
<AppCreditLink variant="mobile" />
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="!hideAppChrome && showDesktopFloatingCredit"
|
||||||
|
class="app-credit-footer app-credit-footer--desktop-float"
|
||||||
|
:class="{ 'app-credit-footer--login': isLoginRoute }"
|
||||||
|
>
|
||||||
|
<EnamadBadge v-if="isLoginRoute" size="sm" />
|
||||||
|
<AppCreditLink variant="float" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<GoldDayCalculatorModal />
|
||||||
|
<GoldLoading v-model:show="colleagueOrderWaiting" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { colors } from './themeConfig'
|
import { colors } from './themeConfig'
|
||||||
import pkg from '../package.json'
|
import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue'
|
||||||
import { getDisplayAppVersion } from '@/config/config-cache'
|
import { useRoute } from 'vue-router'
|
||||||
import { computed, defineAsyncComponent, h, onMounted, ref } from 'vue'
|
import { message } from 'ant-design-vue'
|
||||||
import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg'
|
import { showBrowserNotification } from '@/utils/browserNotification'
|
||||||
import img_pattern from '@/views/login/assets/img/pattern.svg'
|
|
||||||
import { LoadingOutlined } from '@ant-design/icons-vue'
|
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
import {
|
import { useSupportMessenger } from '@/composables/useSupportMessenger'
|
||||||
loadSupportMessengerFromSettings,
|
import { loadSupportMessengerFromSettings } from '@/utils/supportMessenger'
|
||||||
openSupportMessengerEntry,
|
|
||||||
resolveSupportMessengerEntries,
|
|
||||||
supportMessengerPickerOpen,
|
|
||||||
supportMessengerSettings,
|
|
||||||
} from '@/utils/supportMessenger'
|
|
||||||
import SupportMessengerPicker from '@/components/SupportMessengerPicker.vue'
|
import SupportMessengerPicker from '@/components/SupportMessengerPicker.vue'
|
||||||
import { useDraggableFloatingButton } from '@/utils/useDraggableFloatingButton'
|
import { useDraggableFloatingButton } from '@/utils/useDraggableFloatingButton'
|
||||||
import { useApplyDesktopLayoutClass } from '@/layouts/composables/useAppLayout'
|
import { useApplyDesktopLayoutClass, useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
|
import AppCreditLink from '@/components/AppCreditLink.vue'
|
||||||
import img_bottomGradiant from '@/views/login/assets/img/gr_bottom_white.svg'
|
import EnamadBadge from '@/components/EnamadBadge.vue'
|
||||||
import logoFull from '@/assets/img/logo_full_.png'
|
import { usePwaInstall } from '@/composables/usePwaInstall'
|
||||||
|
import PwaInstallGuideModal from '@/components/pwa/PwaInstallGuideModal.vue'
|
||||||
|
import GoldDayCalculatorModal from '@/components/GoldDayCalculatorModal.vue'
|
||||||
|
import GoldLoading from '@/components/GoldLoading.vue'
|
||||||
|
import { colleagueOrderWaiting, resumeColleagueOrderIfPending } from '@/composables/useColleagueOrderWait'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
import { connectChatIfExists, disconnectChat, isSettingFlagOn, unreadSupportCount, useChatService } from '@/utils/chat'
|
||||||
|
import { getToken } from '@/utils'
|
||||||
|
|
||||||
const VersionUpdateModal = defineAsyncComponent(
|
const VersionUpdateModal = defineAsyncComponent(
|
||||||
() => import('@/modules/version/VersionUpdateModal.vue')
|
() => import('@/modules/version/VersionUpdateModal.vue')
|
||||||
)
|
)
|
||||||
|
|
||||||
const indicator = h(LoadingOutlined, {
|
const route = useRoute()
|
||||||
style: {
|
const hideAppChrome = computed(() => route.meta.hideChrome === true || route.name === 'tvMonitor')
|
||||||
fontSize: '24px'
|
|
||||||
},
|
|
||||||
spin: true
|
|
||||||
})
|
|
||||||
const displayVersion = getDisplayAppVersion(pkg.version)
|
|
||||||
const showSplash = ref(true)
|
|
||||||
|
|
||||||
useApplyDesktopLayoutClass()
|
useApplyDesktopLayoutClass()
|
||||||
|
|
||||||
const supportButtonEl = ref<HTMLElement | null>(null)
|
const isDesktop = useDesktopBreakpoint()
|
||||||
const supportPickerOpen = supportMessengerPickerOpen
|
const showDesktopFloatingCredit = computed(() => {
|
||||||
|
if (!isDesktop.value) return false
|
||||||
|
return route.name === 'login' || !!route.meta.hideMenu
|
||||||
|
})
|
||||||
|
const isLoginRoute = computed(() => route.name === 'login')
|
||||||
|
|
||||||
const supportMessengerEntries = computed(() =>
|
const {
|
||||||
resolveSupportMessengerEntries(supportMessengerSettings.value),
|
guideOpen,
|
||||||
|
platform,
|
||||||
|
completeGuide,
|
||||||
|
} = usePwaInstall()
|
||||||
|
|
||||||
|
const {
|
||||||
|
supportPickerOpen,
|
||||||
|
supportPickerAnchor,
|
||||||
|
supportMessengerEntries,
|
||||||
|
messengerMeta,
|
||||||
|
isChatEnabled,
|
||||||
|
hasMessengerLink: showSupportButton,
|
||||||
|
openMessengerEntry,
|
||||||
|
openSupportMessenger,
|
||||||
|
} = useSupportMessenger()
|
||||||
|
|
||||||
|
const supportButtonEl = ref<HTMLElement | null>(null)
|
||||||
|
const pickerAnchorEl = computed(() => supportPickerAnchor.value ?? supportButtonEl.value)
|
||||||
|
|
||||||
|
const supportChatUnreadCount = computed(() =>
|
||||||
|
isChatEnabled.value ? Number(unreadSupportCount.value) || 0 : 0,
|
||||||
)
|
)
|
||||||
|
|
||||||
const showSupportButton = computed(() => supportMessengerEntries.value.length > 0)
|
const supportIcon = computed(() => messengerMeta.value.icon)
|
||||||
|
|
||||||
const primaryEntry = computed(() => supportMessengerEntries.value[0] ?? null)
|
|
||||||
|
|
||||||
const supportIcon = computed(() => primaryEntry.value?.icon ?? 'vuesax-linear:messages-2')
|
|
||||||
|
|
||||||
const supportAccentColor = computed(() =>
|
const supportAccentColor = computed(() =>
|
||||||
(primaryEntry.value?.accent ?? colors.primary) || '#334155',
|
(messengerMeta.value.accent !== '#334155'
|
||||||
|
? messengerMeta.value.accent
|
||||||
|
: colors.primary) || '#334155',
|
||||||
)
|
)
|
||||||
|
|
||||||
let supportPickerOpenedAt = 0
|
|
||||||
|
|
||||||
function openSupportLink() {
|
|
||||||
const entries = supportMessengerEntries.value
|
|
||||||
if (entries.length === 0) return
|
|
||||||
if (entries.length === 1) {
|
|
||||||
void openSupportMessengerEntry(entries[0])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const now = Date.now()
|
|
||||||
if (supportPickerOpen.value) {
|
|
||||||
if (now - supportPickerOpenedAt < 450) return
|
|
||||||
supportPickerOpen.value = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
supportPickerOpen.value = true
|
|
||||||
supportPickerOpenedAt = now
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
dragging: supportDragging,
|
dragging: supportDragging,
|
||||||
fabStyle: supportButtonStyle,
|
fabStyle: supportButtonStyle,
|
||||||
@@ -163,27 +169,203 @@ const {
|
|||||||
defaultRightOffset: 16,
|
defaultRightOffset: 16,
|
||||||
})
|
})
|
||||||
|
|
||||||
function openSupportLinkHandler() {
|
|
||||||
openSupportLink()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSupportPointerUp(event: PointerEvent) {
|
function handleSupportPointerUp(event: PointerEvent) {
|
||||||
const clicked = supportPointerUp(event)
|
const clicked = supportPointerUp(event)
|
||||||
if (!clicked) return
|
if (!clicked) return
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
openSupportLinkHandler()
|
void openSupportMessenger(supportButtonEl.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadSupportMessengerFromSettings()
|
await loadSupportMessengerFromSettings()
|
||||||
setTimeout(() => {
|
})
|
||||||
showSplash.value = false
|
|
||||||
}, 2000)
|
const userStore = useUserStore()
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
const { latestIncomingNotification } = useChatService()
|
||||||
|
let lastConnectedChatSessionKey = ''
|
||||||
|
let lastSupportToastAt = 0
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [
|
||||||
|
userStore.userInfo?.chat_room_id,
|
||||||
|
userStore.userInfo?.chat_user_id,
|
||||||
|
settingsStore.getSettingByKey('chat_api_key'),
|
||||||
|
settingsStore.getSettingByKey('show_to_users_chat'),
|
||||||
|
settingsStore.getSettingByKey('has_chat'),
|
||||||
|
getToken(),
|
||||||
|
],
|
||||||
|
async ([roomId, chatUserId, chatApiKey, chatAdminFlag, chatCustomerFlag, token]) => {
|
||||||
|
const chatOn =
|
||||||
|
isSettingFlagOn(chatAdminFlag) && isSettingFlagOn(chatCustomerFlag)
|
||||||
|
if (!token || !chatOn || !chatApiKey || !roomId || !chatUserId) {
|
||||||
|
lastConnectedChatSessionKey = ''
|
||||||
|
disconnectChat()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const sessionKey = `${roomId}:${chatUserId}:${chatApiKey}`
|
||||||
|
if (lastConnectedChatSessionKey === sessionKey) return
|
||||||
|
|
||||||
|
try {
|
||||||
|
await connectChatIfExists()
|
||||||
|
lastConnectedChatSessionKey = sessionKey
|
||||||
|
} catch (error) {
|
||||||
|
lastConnectedChatSessionKey = ''
|
||||||
|
console.error('connectChatIfExists failed:', error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => getToken(),
|
||||||
|
(token) => {
|
||||||
|
if (token) void resumeColleagueOrderIfPending()
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(latestIncomingNotification, (payload) => {
|
||||||
|
if (!payload) return
|
||||||
|
if (payload.at === lastSupportToastAt) return
|
||||||
|
lastSupportToastAt = payload.at
|
||||||
|
|
||||||
|
// فقط وقتی خارج از صفحهٔ چت (گیت داخل chat.ts)؛ داخل چت نوتیف نمیآید
|
||||||
|
if (typeof document === 'undefined' || document.visibilityState === 'visible') {
|
||||||
|
message.info({
|
||||||
|
content: `پیام جدید پشتیبانی: ${payload.body}`,
|
||||||
|
duration: 3,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
void showBrowserNotification({
|
||||||
|
title: payload.title || 'پشتیبانی',
|
||||||
|
body: payload.body || 'پیام جدید',
|
||||||
|
tag: 'support-chat-message',
|
||||||
|
url: '/support',
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
.app-credit-footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1000000;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-credit-footer--mobile {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 426px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
min-height: var(--app-credit-bar-inner);
|
||||||
|
padding: 4px 0 var(--app-safe-bottom);
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 -2px 4px -2px #0000001a;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-size: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-credit-footer--login.app-credit-footer--mobile {
|
||||||
|
min-height: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root:has(.app-credit-footer--login) {
|
||||||
|
--app-credit-bar-inner: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-credit-footer--desktop-float {
|
||||||
|
left: auto;
|
||||||
|
right: 20px;
|
||||||
|
bottom: 16px;
|
||||||
|
width: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-credit-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__logo {
|
||||||
|
width: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--mobile {
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px 0;
|
||||||
|
color: inherit;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--sidebar {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 4px;
|
||||||
|
color: #9ca3af;
|
||||||
|
font-size: 10px;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 15px;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--float {
|
||||||
|
gap: 6px;
|
||||||
|
padding: 7px 14px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #6b7280;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||||
|
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--tv {
|
||||||
|
gap: 8px;
|
||||||
|
padding: 6px 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.updateButton .van-dialog__confirm .van-button__text {
|
.updateButton .van-dialog__confirm .van-button__text {
|
||||||
color: @primary-color !important;
|
color: @primary-color !important;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@@ -203,6 +385,7 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.support-button-inner {
|
.support-button-inner {
|
||||||
|
position: relative;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@@ -228,6 +411,24 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.support-fab-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: -6px;
|
||||||
|
left: -4px;
|
||||||
|
z-index: 2;
|
||||||
|
min-width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
padding: 0 5px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #dc2626;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 18px;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 0 0 2px #fff;
|
||||||
|
}
|
||||||
|
|
||||||
#support-button:not(.is-dragging):hover .support-button-inner {
|
#support-button:not(.is-dragging):hover .support-button-inner {
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import useAxios from '@/utils/useAxios'
|
||||||
|
|
||||||
|
export type AppNotificationSeverity = 'info' | 'success' | 'warning' | 'danger'
|
||||||
|
|
||||||
|
export interface CustomerAppNotification {
|
||||||
|
id: number
|
||||||
|
title: string
|
||||||
|
body: string
|
||||||
|
severity: AppNotificationSeverity
|
||||||
|
created_at?: string
|
||||||
|
is_read: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAppNotifications = async () =>
|
||||||
|
await useAxios.get<CustomerAppNotification[]>(`/customer/app_notifications`)
|
||||||
|
|
||||||
|
export const getAppNotificationsUnreadCount = async () =>
|
||||||
|
await useAxios.get<{ unread_count: number }>(`/customer/app_notifications/unread-count`)
|
||||||
|
|
||||||
|
export const markAppNotificationRead = async (id: number) =>
|
||||||
|
await useAxios.post(`/customer/app_notifications/${id}/read`)
|
||||||
|
|
||||||
|
export const markAllAppNotificationsRead = async () =>
|
||||||
|
await useAxios.post(`/customer/app_notifications/read-all`)
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
import useAxios from "@/utils/useAxios";
|
import useAxios from "@/utils/useAxios";
|
||||||
import type {PInventory, Product} from "@/models/products";
|
|
||||||
import type {PWallet, Wallet} from '@/models/wallet'
|
|
||||||
import type {Order} from "@/models/order";
|
import type {Order} from "@/models/order";
|
||||||
import {useUserStore} from "@/store/userStore";
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
|
|
||||||
export const checkoutCart = async (orders: Order[]): Promise<any> => {
|
export const checkoutCart = async (orders: Order[]): Promise<any> => {
|
||||||
return await useAxios.post<Order[]>(`/customer/cart/checkout`, orders)
|
return await useAxios.post<Order[]>(`/customer/cart/checkout`, orders)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import useAxios from '@/utils/useAxios'
|
||||||
|
import type { User } from '@/models/login'
|
||||||
|
|
||||||
|
export const startChat = async (): Promise<{ message: string; user: User }> => {
|
||||||
|
return await useAxios.get<{ message: string; user: User }>(`/customer/start-chat`)
|
||||||
|
}
|
||||||
@@ -5,13 +5,23 @@ import type {Ref, UnwrapRef} from "vue";
|
|||||||
import type {Transaction} from "@/models/transaction";
|
import type {Transaction} from "@/models/transaction";
|
||||||
import {useUserStore} from "@/store/userStore";
|
import {useUserStore} from "@/store/userStore";
|
||||||
|
|
||||||
const userStore = useUserStore()
|
function customerOrderPrefix() {
|
||||||
|
// lazy: این ماژول ممکن است قبل از app.use(pinia) لود شود
|
||||||
|
return `/customer${!useUserStore().isSingle ? '' : '/single'}`
|
||||||
|
}
|
||||||
|
|
||||||
export const createOrder = async (obj: Order): Promise<any> => {
|
export const createOrder = async (obj: Order): Promise<any> => {
|
||||||
return await useAxios.post<Order>(`/customer${!userStore.isSingle ? '' : '/single'}/order`, obj)
|
return await useAxios.post<Order>(`${customerOrderPrefix()}/order`, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getPendingColleagueOrder = async (): Promise<any> => {
|
||||||
|
return await useAxios.get(`${customerOrderPrefix()}/order/pending`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getColleagueOrderStatus = async (id: number): Promise<any> => {
|
||||||
|
return await useAxios.get(`${customerOrderPrefix()}/order/${id}/status`)
|
||||||
|
}
|
||||||
|
|
||||||
export const getOrders = async (tbl: Ref<UnwrapRef<TableInput>>): Promise<TableOutput<Transaction>> => {
|
export const getOrders = async (tbl: Ref<UnwrapRef<TableInput>>): Promise<TableOutput<Transaction>> => {
|
||||||
return await useAxios.post<TableOutput<Order>>(`/customer${!userStore.isSingle ? '' : '/single'}/order/table`, tbl)
|
return await useAxios.post<TableOutput<Order>>(`${customerOrderPrefix()}/order/table`, tbl)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,39 @@
|
|||||||
import useAxios from "@/utils/useAxios";
|
import useAxios from "@/utils/useAxios";
|
||||||
import type {PInventory, Product} from "@/models/products";
|
import type {PInventory, Product} from "@/models/products";
|
||||||
import type { PWallet, Wallet } from '@/models/wallet'
|
import { priceStreamList } from "@/utils/priceSocketState";
|
||||||
|
|
||||||
|
|
||||||
export const getProducts = async (): Promise<any> => {
|
export const getProducts = async (force = false): Promise<Product[]> => {
|
||||||
return await useAxios.get<Product[]>(`/customer/product/list`, { timeout: 15000 })
|
if (!force && Array.isArray(priceStreamList.value) && priceStreamList.value.length > 0) {
|
||||||
|
return priceStreamList.value as unknown as Product[]
|
||||||
|
}
|
||||||
|
const response = await useAxios.get<Product[]>(`/customer/product/list`, { timeout: 15000 })
|
||||||
|
return Array.isArray(response) ? response : []
|
||||||
}
|
}
|
||||||
|
export const getTvProducts = async (): Promise<Product[]> => {
|
||||||
|
const response = await useAxios.get<unknown>(`/customer/tv/products`, { timeout: 15000 })
|
||||||
|
return Array.isArray(response) ? (response as Product[]) : []
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TvServerTime = {
|
||||||
|
unix: number
|
||||||
|
iso: string
|
||||||
|
timezone: string
|
||||||
|
stream_key?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getTvServerTime = async (): Promise<TvServerTime | null> => {
|
||||||
|
try {
|
||||||
|
const response = await useAxios.get<TvServerTime>(`/customer/tv/time`, { timeout: 10000 })
|
||||||
|
if (response && typeof (response as TvServerTime).unix === 'number') {
|
||||||
|
return response as TvServerTime
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
export const getProductById = async ( id:number|null): Promise<any> => {
|
export const getProductById = async ( id:number|null): Promise<any> => {
|
||||||
return await useAxios.get<Product[]>(`/customer/product/list/${id}`, { timeout: 15000 })
|
return await useAxios.get<Product[]>(`/customer/product/list/${id}`, { timeout: 15000 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { setupRouterGuards } from '@/app/setupRouter'
|
|||||||
import { useSettingsStore } from '@/store/settingsStore'
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
import { initPriceRealtimeChannel } from '@/utils/priceSocket'
|
import { initPriceRealtimeChannel } from '@/utils/priceSocket'
|
||||||
import { initMobileScrollRestoration } from '@/layouts/composables/useMobileScrollReset'
|
import { initMobileScrollRestoration } from '@/layouts/composables/useMobileScrollReset'
|
||||||
|
import { initMobileInputKeyboardScroll } from '@/utils/mobileInputKeyboardScroll'
|
||||||
|
|
||||||
type BootWindow = Window & {
|
type BootWindow = Window & {
|
||||||
__BOOT_TIMEOUT__?: number
|
__BOOT_TIMEOUT__?: number
|
||||||
@@ -48,13 +49,13 @@ function showBootstrapError(error: unknown) {
|
|||||||
<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>
|
<div style="font-size: 42px; margin-bottom: 12px;">⚠️</div>
|
||||||
<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در راهاندازی برنامه</h2>
|
<h2 style="margin: 0 0 12px; font-size: 20px;">خطا در راهاندازی برنامه</h2>
|
||||||
<p style="margin: 0 0 20px; color: var(--boot-muted, rgba(15,23,42,0.62)); line-height: 2; font-size: 14px;">
|
<p style="margin: 0 0 20px; color: var(--boot-muted, rgba(15,23,42,0.62)); line-height: 2; font-size: 14px;">
|
||||||
لطفاً اتصال اینترنت خود را بررسی کنید و دوباره تلاش کنید.
|
برقراری ارتباط با سرور امکانپذیر نیست. لطفاً اتصال اینترنت خود را بررسی کرده و صفحه را تازهسازی نمایید.
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
onclick="location.reload()"
|
onclick="location.reload()"
|
||||||
style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent, #2563eb); color: white; cursor: pointer; font-weight: 700;"
|
style="padding: 11px 22px; border: 0; border-radius: 12px; background: var(--boot-accent, #2563eb); color: white; cursor: pointer; font-weight: 700;"
|
||||||
>
|
>
|
||||||
تلاش مجدد
|
تازهسازی صفحه
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -76,6 +77,7 @@ export async function bootstrapApp() {
|
|||||||
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
initPriceRealtimeChannel((key) => settingsStore.getSettingByKey(key))
|
||||||
|
|
||||||
initMobileScrollRestoration()
|
initMobileScrollRestoration()
|
||||||
|
initMobileInputKeyboardScroll()
|
||||||
setupRouterGuards()
|
setupRouterGuards()
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia, setActivePinia } from 'pinia'
|
||||||
import VueLazyLoad from 'vue3-lazyload'
|
import VueLazyLoad from 'vue3-lazyload'
|
||||||
import VueApexCharts from 'vue3-apexcharts'
|
import VueApexCharts from 'vue3-apexcharts'
|
||||||
import App from '@/App.vue'
|
import App from '@/App.vue'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
|
||||||
export function createVueApp() {
|
export function createVueApp() {
|
||||||
const app = createApp(App)
|
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
|
setActivePinia(pinia)
|
||||||
|
|
||||||
|
const app = createApp(App)
|
||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
app.use(VueLazyLoad, {})
|
app.use(VueLazyLoad, {})
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
setFingerTimeOut,
|
setFingerTimeOut,
|
||||||
setHasFingerPrint
|
setHasFingerPrint
|
||||||
} from '@/app/authBoot'
|
} from '@/app/authBoot'
|
||||||
import { recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
import { clearVantOverlays, recoverMobileViewportAfterAuth } from '@/layouts/composables/useMobileScrollReset'
|
||||||
|
|
||||||
export function setupRouterGuards() {
|
export function setupRouterGuards() {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@@ -33,8 +33,17 @@ export function setupRouterGuards() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isGuestAllowed(to: RouteLocationNormalized) {
|
||||||
|
if (to.meta?.public) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return ['login', '404', 'buyProduct', 'productDetail', 'about', 'aboutSoftware', 'cart', 'tvMonitor'].includes(
|
||||||
|
to.name as string,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||||
if (to.name === 'buyProduct' || to.name === 'productDetail' || to.name === 'about' || to.name === 'cart') {
|
if (isGuestAllowed(to)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
if (to.name !== 'login') {
|
if (to.name !== 'login') {
|
||||||
@@ -53,7 +62,70 @@ export function setupRouterGuards() {
|
|||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
authStore.setLoading(true)
|
authStore.setLoading(true)
|
||||||
clearFingerTimeout()
|
clearFingerTimeout()
|
||||||
setFingerTimeOut(to)
|
if (to.name !== 'tvMonitor' && !to.meta?.hideChrome) {
|
||||||
|
setFingerTimeOut(to)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.name === 'notifyTrigger' && getToken()) {
|
||||||
|
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
if (!settingsStore.loaded) {
|
||||||
|
await settingsStore.fetchSettings()
|
||||||
|
}
|
||||||
|
if (!settingsStore.isSettingTruthy('has_page_price_trigger')) {
|
||||||
|
return next({ name: (from.name as string) || 'user' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.name === 'appNotifications' && getToken()) {
|
||||||
|
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
if (!settingsStore.loaded) {
|
||||||
|
await settingsStore.fetchSettings()
|
||||||
|
}
|
||||||
|
if (!settingsStore.isSettingTruthy('has_page_notification')) {
|
||||||
|
return next({ name: (from.name as string) || 'home' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.name === 'giftCard' && getToken()) {
|
||||||
|
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
if (!settingsStore.loaded) {
|
||||||
|
await settingsStore.fetchSettings()
|
||||||
|
}
|
||||||
|
if (!settingsStore.isSettingTruthy('has_page_gift_card')) {
|
||||||
|
return next({ name: (from.name as string) || 'user' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
getToken() &&
|
||||||
|
(to.name === 'piggy' ||
|
||||||
|
to.name === 'fund' ||
|
||||||
|
to.name === 'fund_info' ||
|
||||||
|
to.name === 'fund_add')
|
||||||
|
) {
|
||||||
|
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
if (!settingsStore.loaded) {
|
||||||
|
await settingsStore.fetchSettings()
|
||||||
|
}
|
||||||
|
if (!settingsStore.isSettingTruthy('enable_product_funds')) {
|
||||||
|
return next({ name: (from.name as string) || 'home' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (to.name === 'earnMoney' && getToken()) {
|
||||||
|
const { useSettingsStore } = await import('@/store/settingsStore')
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
if (!settingsStore.loaded) {
|
||||||
|
await settingsStore.fetchSettings()
|
||||||
|
}
|
||||||
|
if (!settingsStore.isSettingTruthy('has_page_earn_money')) {
|
||||||
|
return next({ name: (from.name as string) || 'user' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false
|
isFirst = false
|
||||||
@@ -79,7 +151,7 @@ export function setupRouterGuards() {
|
|||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
|
if (isGuestAllowed(to)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
goToLogin(to, next)
|
goToLogin(to, next)
|
||||||
@@ -93,7 +165,7 @@ export function setupRouterGuards() {
|
|||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['login', '404', 'buyProduct', 'productDetail', 'about', 'cart'].includes(to.name as string)) {
|
if (isGuestAllowed(to)) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
return next({ name: 'login' })
|
return next({ name: 'login' })
|
||||||
@@ -108,6 +180,9 @@ export function setupRouterGuards() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.afterEach((to, from) => {
|
router.afterEach((to, from) => {
|
||||||
|
if (to.name === 'login') {
|
||||||
|
clearVantOverlays()
|
||||||
|
}
|
||||||
if (document.documentElement.classList.contains('app-layout--desktop')) return
|
if (document.documentElement.classList.contains('app-layout--desktop')) return
|
||||||
if (from.name === 'login') {
|
if (from.name === 'login') {
|
||||||
recoverMobileViewportAfterAuth()
|
recoverMobileViewportAfterAuth()
|
||||||
|
|||||||
@@ -10,8 +10,10 @@
|
|||||||
@import (less) '../../views/base/user/desktop/styles/desktop-user.less';
|
@import (less) '../../views/base/user/desktop/styles/desktop-user.less';
|
||||||
@import (less) '../../views/base/priceTrigger/desktop/styles/desktop-price-trigger.less';
|
@import (less) '../../views/base/priceTrigger/desktop/styles/desktop-price-trigger.less';
|
||||||
@import (less) '../../views/base/home/desktop/styles/desktop-home.less';
|
@import (less) '../../views/base/home/desktop/styles/desktop-home.less';
|
||||||
|
@import (less) '../../views/base/gold/desktop/styles/desktop-gold.less';
|
||||||
@import (less) '../../views/login/desktop/styles/desktop-login.less';
|
@import (less) '../../views/login/desktop/styles/desktop-login.less';
|
||||||
@import (less) '../../layouts/desktop/styles/desktop-inner-pages.less';
|
@import (less) '../../layouts/desktop/styles/desktop-inner-pages.less';
|
||||||
|
@import (less) './mobile-keyboard-scroll.less';
|
||||||
|
|
||||||
html {
|
html {
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
@@ -64,11 +66,11 @@ body {
|
|||||||
color-scheme: only light;
|
color-scheme: only light;
|
||||||
--app-safe-top: env(safe-area-inset-top, 0px);
|
--app-safe-top: env(safe-area-inset-top, 0px);
|
||||||
--app-safe-bottom: env(safe-area-inset-bottom, 0px);
|
--app-safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
--app-credit-bar-inner: 0px;
|
--app-credit-bar-inner: 28px;
|
||||||
--app-home-header-offset: calc(4.25rem + var(--app-safe-top));
|
--app-home-header-offset: calc(4.25rem + var(--app-safe-top));
|
||||||
--app-credit-footer-offset: var(--app-safe-bottom);
|
--app-credit-footer-offset: calc(var(--app-credit-bar-inner) + var(--app-safe-bottom));
|
||||||
--app-nav-height: 80px;
|
--app-nav-height: 80px;
|
||||||
--app-bottom-chrome-height: calc(var(--app-nav-height) + var(--app-safe-bottom));
|
--app-bottom-chrome-height: calc(var(--app-nav-height) + var(--app-credit-footer-offset));
|
||||||
--app-add-card-height: 88px;
|
--app-add-card-height: 88px;
|
||||||
--wallet-card-dock-overlap: 52px;
|
--wallet-card-dock-overlap: 52px;
|
||||||
--app-z-nav: 5000;
|
--app-z-nav: 5000;
|
||||||
@@ -91,6 +93,13 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 500px) {
|
||||||
|
.login-vip-page__body{
|
||||||
|
height: 20vh !important;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
.fade-leave-active {
|
.fade-leave-active {
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
@@ -105,9 +114,24 @@ body {
|
|||||||
z-index: 5001 !important;
|
z-index: 5001 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
//.van-overlay{
|
.van-overlay{
|
||||||
// z-index: 2000 !important;
|
z-index: 5000 !important;
|
||||||
//}
|
background: rgba(0, 0, 0, 0.55) !important;
|
||||||
|
pointer-events: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-dialog {
|
||||||
|
z-index: var(--app-z-dialog, 5300) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.van-overflow-hidden {
|
||||||
|
.bottom-appbar,
|
||||||
|
.app-credit-footer,
|
||||||
|
#support-button {
|
||||||
|
visibility: hidden !important;
|
||||||
|
pointer-events: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.color-transition {
|
.color-transition {
|
||||||
transition: color 0.3s ease;
|
transition: color 0.3s ease;
|
||||||
@@ -159,10 +183,16 @@ body {
|
|||||||
border: 1px solid #d1d5db;
|
border: 1px solid #d1d5db;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
color: #111827;
|
||||||
|
caret-color: #111827;
|
||||||
|
-webkit-text-fill-color: #111827;
|
||||||
|
color-scheme: light;
|
||||||
//@apply bg-gray-50;
|
//@apply bg-gray-50;
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
color: #111827;
|
||||||
|
-webkit-text-fill-color: #111827;
|
||||||
//display: none;
|
//display: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
border: 1px solid #a72b77 !important;
|
border: 1px solid #a72b77 !important;
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
:root {
|
||||||
|
--app-keyboard-inset: 0px;
|
||||||
|
--app-visual-viewport-height: 100dvh;
|
||||||
|
--app-visual-viewport-offset-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767.98px) {
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
select,
|
||||||
|
.ant-input,
|
||||||
|
.ant-input-affix-wrapper,
|
||||||
|
.ant-select-selection-search-input {
|
||||||
|
scroll-margin-bottom: calc(var(--app-keyboard-inset) + 16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-keyboard-open='true'] {
|
||||||
|
.main-with-bottom-chrome,
|
||||||
|
.login-vip-page__body,
|
||||||
|
.login-page,
|
||||||
|
.login-page-root,
|
||||||
|
.ant-modal-body,
|
||||||
|
.ant-drawer-body,
|
||||||
|
.van-action-sheet__content,
|
||||||
|
.basic-action-sheet__body {
|
||||||
|
scroll-padding-bottom: calc(var(--app-keyboard-inset) + 16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-with-bottom-chrome,
|
||||||
|
.login-vip-page__body,
|
||||||
|
.login-page {
|
||||||
|
padding-bottom: var(--app-keyboard-inset);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-mobile {
|
||||||
|
height: var(--app-visual-viewport-height, 100dvh);
|
||||||
|
max-height: var(--app-visual-viewport-height, 100dvh);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-page.flex {
|
||||||
|
height: var(--app-visual-viewport-height, 92vh) !important;
|
||||||
|
max-height: var(--app-visual-viewport-height, 92vh) !important;
|
||||||
|
overflow-y: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
align-items: flex-start !important;
|
||||||
|
justify-content: flex-start !important;
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 607 B |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
|
||||||
|
<circle cx="128" cy="128" r="124" fill="#12B76A"/>
|
||||||
|
<!-- Bootstrap Icons telephone-fill — گوشی کامل -->
|
||||||
|
<g transform="translate(48 48) scale(10)">
|
||||||
|
<path
|
||||||
|
fill="#fff"
|
||||||
|
d="M1.885.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.967.315 1.49l-.547 2.19a.678.678 0 0 0 .178.643l2.457 2.457a.678.678 0 0 0 .644.178l2.189-.547a1.745 1.745 0 0 1 1.49.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.634 18.634 0 0 1-7.01-4.42 18.634 18.634 0 0 1-4.42-7.009c-.362-1.03-.038-2.137.703-2.877L1.885.511z"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 680 B |
@@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" fill="none">
|
||||||
|
<circle cx="128" cy="128" r="128" fill="#3B82F6"/>
|
||||||
|
<path
|
||||||
|
fill="#fff"
|
||||||
|
d="M78 76h100c11 0 20 9 20 20v64c0 11-9 20-20 20h-52l-30 26v-26H78c-11 0-20-9-20-20V96c0-11 9-20 20-20zm16 40h68v14H94v-14zm0 28h48v14H94v-14z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 337 B |
@@ -0,0 +1,98 @@
|
|||||||
|
<template>
|
||||||
|
<a
|
||||||
|
href="https://montzar.ir"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="app-credit-link"
|
||||||
|
:class="`app-credit-link--${variant}`"
|
||||||
|
>
|
||||||
|
<span class="app-credit-link__text">توسعه و طراحی توسط</span>
|
||||||
|
<img :src="logoMontzarUrl" alt="montzar" class="app-credit-link__logo" />
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import logoMontzarUrl from '@/assets/img/logo-montzar.png'
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
variant?: 'mobile' | 'sidebar' | 'float' | 'tv'
|
||||||
|
}>(),
|
||||||
|
{ variant: 'mobile' },
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.app-credit-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__logo {
|
||||||
|
width: auto;
|
||||||
|
max-width: 140px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--mobile {
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px 0;
|
||||||
|
color: inherit;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--sidebar {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 4px;
|
||||||
|
color: #9ca3af;
|
||||||
|
font-size: 10px;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 15px;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--float {
|
||||||
|
gap: 6px;
|
||||||
|
padding: 7px 14px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #6b7280;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid rgba(15, 23, 42, 0.08);
|
||||||
|
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--tv {
|
||||||
|
gap: 8px;
|
||||||
|
padding: 6px 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
|
|
||||||
|
.app-credit-link__logo {
|
||||||
|
height: 16px;
|
||||||
|
max-width: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
</style>-->
|
</style>-->
|
||||||
<template>
|
<template>
|
||||||
<VanActionSheet :show="show" @update:show="$emit('update:show', $event)" :placement="placement" teleport="body">
|
<VanActionSheet :show="show" overlay lock-scroll close-on-click-overlay teleport="body" :placement="placement" @update:show="$emit('update:show', $event)">
|
||||||
<div class="justify-center cursor-pointer flex mt-1" @click="$emit('update:show', false)">
|
<div class="justify-center cursor-pointer flex mt-1" @click="$emit('update:show', false)">
|
||||||
<span class="rounded-sm w-12 border-t-2 border-t-solid border-t-gray-500 mt-2"></span>
|
<span class="rounded-sm w-12 border-t-2 border-t-solid border-t-gray-500 mt-2"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
:type="props.type"
|
:type="props.type"
|
||||||
class=""
|
class=""
|
||||||
@change="handlerChange"
|
@change="handlerChange"
|
||||||
|
@input="handlerChange"
|
||||||
/>
|
/>
|
||||||
<a-input
|
<a-input
|
||||||
v-else
|
v-else
|
||||||
@@ -28,6 +29,9 @@
|
|||||||
:pattern="props.pattern"
|
:pattern="props.pattern"
|
||||||
class=""
|
class=""
|
||||||
@change="handlerChange"
|
@change="handlerChange"
|
||||||
|
@input="handlerChange"
|
||||||
|
@blur="emits('blur', $event)"
|
||||||
|
@focus="emits('focus', $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -36,7 +40,11 @@
|
|||||||
import {usePrefix} from "@/utils/usePrefix";
|
import {usePrefix} from "@/utils/usePrefix";
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import {usePrice} from "@/components/BasicPacks/BasicPriceInput/src/utils/usePrice";
|
import {usePrice} from "@/components/BasicPacks/BasicPriceInput/src/utils/usePrice";
|
||||||
import {persianToEnglishDigits, shouldNormalizeInputDigits} from '@/utils/persianDigits';
|
import {
|
||||||
|
normalizeDecimalInput,
|
||||||
|
persianToEnglishDigits,
|
||||||
|
shouldNormalizeDecimalSeparators,
|
||||||
|
} from '@/utils/persianDigits';
|
||||||
|
|
||||||
//Props
|
//Props
|
||||||
interface Prop {
|
interface Prop {
|
||||||
@@ -61,7 +69,7 @@ const addonTextColor = computed(() => props.addonTextColor)
|
|||||||
const props = withDefaults(defineProps<Prop>(), {
|
const props = withDefaults(defineProps<Prop>(), {
|
||||||
isPassword: false
|
isPassword: false
|
||||||
})
|
})
|
||||||
const emits = defineEmits(['update:value', 'onchange'])
|
const emits = defineEmits(['update:value', 'onchange', 'blur', 'focus'])
|
||||||
|
|
||||||
const localValue = computed({
|
const localValue = computed({
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -79,18 +87,23 @@ function normalizeValue(value: unknown) {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
let normalized = String(value)
|
if (shouldNormalizeDecimalSeparators(props)) {
|
||||||
if (shouldNormalizeInputDigits(props)) {
|
const isPrice = String(props.type ?? '').trim().toLowerCase() === 'price'
|
||||||
normalized = persianToEnglishDigits(normalized)
|
return normalizeDecimalInput(value as string | number, {
|
||||||
|
commaAsThousand: isPrice,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if (props.type === 'price') {
|
|
||||||
normalized = normalized.replaceAll(',', '')
|
return persianToEnglishDigits(String(value))
|
||||||
}
|
|
||||||
return normalized
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlerChange = (e: any) => {
|
const handlerChange = (e: Event | string) => {
|
||||||
const normalized = normalizeValue(e.target.value)
|
const target = typeof e === 'string' ? null : (e.target as HTMLInputElement | null)
|
||||||
|
const raw = typeof e === 'string' ? e : target?.value
|
||||||
|
const normalized = normalizeValue(raw)
|
||||||
|
if (target && typeof normalized === 'string' && target.value !== normalized) {
|
||||||
|
target.value = normalized
|
||||||
|
}
|
||||||
emits('update:value', normalized)
|
emits('update:value', normalized)
|
||||||
emits('onchange', normalized)
|
emits('onchange', normalized)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<a-modal
|
<a-modal
|
||||||
v-model:visible="localValue"
|
v-model:visible="localValue"
|
||||||
:title="props.title"
|
:title="slots.title ? undefined : props.title"
|
||||||
centered
|
centered
|
||||||
@ok="emits('ok')"
|
@ok="emits('ok')"
|
||||||
@cancel="emits('close')"
|
@cancel="emits('close')"
|
||||||
@@ -11,9 +11,13 @@
|
|||||||
:width="props.width"
|
:width="props.width"
|
||||||
:ok-text="props.okText"
|
:ok-text="props.okText"
|
||||||
:cancel-text="props.cancelText"
|
:cancel-text="props.cancelText"
|
||||||
|
:confirm-loading="props.loading"
|
||||||
:closable="props.closable"
|
:closable="props.closable"
|
||||||
:wrapClassName="props.wrapClassName"
|
:wrapClassName="props.wrapClassName"
|
||||||
>
|
>
|
||||||
|
<template v-if="slots.title" #title>
|
||||||
|
<slot name="title" />
|
||||||
|
</template>
|
||||||
<template v-if="props.customFooter" #footer> <slot name="footer" /></template>
|
<template v-if="props.customFooter" #footer> <slot name="footer" /></template>
|
||||||
<a-spin :spinning="props.loading">
|
<a-spin :spinning="props.loading">
|
||||||
<div class="overflow-y-auto py-2 px-1 relative max-h-[83vh]" id="body">
|
<div class="overflow-y-auto py-2 px-1 relative max-h-[83vh]" id="body">
|
||||||
@@ -25,8 +29,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//define emit
|
import { computed, useSlots } from 'vue'
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
const emits = defineEmits(['ok', 'close', 'update:visible'])
|
const emits = defineEmits(['ok', 'close', 'update:visible'])
|
||||||
|
|
||||||
@@ -53,6 +56,8 @@ const props = withDefaults(defineProps<Prop>(), {
|
|||||||
closable: true
|
closable: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const slots = useSlots()
|
||||||
|
|
||||||
const localValue = computed({
|
const localValue = computed({
|
||||||
get() {
|
get() {
|
||||||
return props.visible
|
return props.visible
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import {usePrice} from './utils/usePrice'
|
import {usePrice} from './utils/usePrice'
|
||||||
import {computed} from "vue";
|
import {computed} from "vue";
|
||||||
import BasicInput from "../../BasicInput.vue";
|
import BasicInput from "../../BasicInput.vue";
|
||||||
import {persianToEnglishDigits} from '@/utils/persianDigits'
|
import {normalizeDecimalInput} from '@/utils/persianDigits'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value?: string | number
|
value?: string | number
|
||||||
@@ -24,7 +24,7 @@ const props = withDefaults(defineProps<Props>(), {})
|
|||||||
|
|
||||||
const _val = computed({
|
const _val = computed({
|
||||||
set(val: string) {
|
set(val: string) {
|
||||||
emit('update:value', persianToEnglishDigits(val).replaceAll(',', ''))
|
emit('update:value', normalizeDecimalInput(val))
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return props.value ? usePrice(props.value as number, true, '').trim() : ''
|
return props.value ? usePrice(props.value as number, true, '').trim() : ''
|
||||||
|
|||||||
@@ -0,0 +1,861 @@
|
|||||||
|
<template>
|
||||||
|
<div
|
||||||
|
ref="containerRef"
|
||||||
|
class="product-picker-root"
|
||||||
|
:class="{
|
||||||
|
'product-picker-root--compact': compact,
|
||||||
|
'product-picker-root--open': isOpen,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<label v-if="label" class="product-picker__label">{{ label }}</label>
|
||||||
|
|
||||||
|
<!-- سلکتور جمعوجور -->
|
||||||
|
<div
|
||||||
|
class="product-picker__control"
|
||||||
|
:class="{
|
||||||
|
'product-picker__control--clickable': !disabled && !isEdit,
|
||||||
|
'product-picker__control--disabled': disabled,
|
||||||
|
'product-picker__control--locked': isEdit,
|
||||||
|
'product-picker__control--active': isOpen,
|
||||||
|
}"
|
||||||
|
role="button"
|
||||||
|
:tabindex="disabled ? -1 : 0"
|
||||||
|
:aria-label="label || placeholder"
|
||||||
|
@click="toggleOpen"
|
||||||
|
@keydown.enter.prevent="toggleOpen"
|
||||||
|
>
|
||||||
|
<div class="product-picker__value">
|
||||||
|
<span class="product-picker__icon" aria-hidden="true">
|
||||||
|
<BasicIcon
|
||||||
|
:icon="isEdit ? 'vuesax-linear:lock' : 'vuesax-linear:box-1'"
|
||||||
|
:size="compact ? 16 : 18"
|
||||||
|
:color="selectedItem ? 'var(--App-secondary-color, #e0be7f)' : 'var(--app-text-soft, #9ca3af)'"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="product-picker__text"
|
||||||
|
:class="{ 'product-picker__text--placeholder': !selectedItem && !lockedTitle }"
|
||||||
|
>
|
||||||
|
{{ displayTitle }}
|
||||||
|
</span>
|
||||||
|
<span v-if="displayUnit" class="product-picker__unit">({{ displayUnit }})</span>
|
||||||
|
<span v-if="displaySubtitle" class="product-picker__subtitle">{{ displaySubtitle }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="product-picker__trailing">
|
||||||
|
<button
|
||||||
|
v-if="allowClear && selectedItem && !disabled && !isEdit"
|
||||||
|
type="button"
|
||||||
|
class="product-picker__clear-btn"
|
||||||
|
aria-label="پاک کردن"
|
||||||
|
@click.stop="handleClear"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" size="16" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</button>
|
||||||
|
<span class="product-picker__arrow" aria-hidden="true">
|
||||||
|
<BasicIcon
|
||||||
|
v-if="!isEdit"
|
||||||
|
:icon="isOpen ? 'vuesax-linear:arrow-up-1' : 'vuesax-linear:arrow-down-1'"
|
||||||
|
size="16"
|
||||||
|
color="var(--app-text-soft, #9ca3af)"
|
||||||
|
/>
|
||||||
|
<BasicIcon v-else icon="vuesax-linear:lock" size="14" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- دراپداون دسکتاپ -->
|
||||||
|
<div
|
||||||
|
v-if="isDesktop && isOpen && !disabled && !isEdit"
|
||||||
|
class="product-picker__dropdown"
|
||||||
|
:style="dropdownStyle"
|
||||||
|
>
|
||||||
|
<div class="product-picker__search">
|
||||||
|
<span class="product-picker__search-icon" aria-hidden="true">
|
||||||
|
<BasicIcon icon="vuesax-linear:search-normal" size="16" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
ref="desktopSearchInputRef"
|
||||||
|
v-model="searchQuery"
|
||||||
|
type="text"
|
||||||
|
class="product-picker__search-input"
|
||||||
|
placeholder="جستجوی محصول..."
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-if="searchQuery"
|
||||||
|
type="button"
|
||||||
|
class="product-picker__clear-query-btn"
|
||||||
|
aria-label="پاک کردن جستجو"
|
||||||
|
@click="searchQuery = ''"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" size="15" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="product-picker__list" role="listbox">
|
||||||
|
<button
|
||||||
|
v-for="p in filteredList"
|
||||||
|
:key="getItemKey(p)"
|
||||||
|
type="button"
|
||||||
|
role="option"
|
||||||
|
class="product-picker__item"
|
||||||
|
:class="{ 'product-picker__item--selected': isSelected(p) }"
|
||||||
|
:aria-selected="isSelected(p)"
|
||||||
|
@click="selectItem(p)"
|
||||||
|
>
|
||||||
|
<div class="product-picker__item-info">
|
||||||
|
<span class="product-picker__item-icon">
|
||||||
|
<BasicIcon
|
||||||
|
icon="vuesax-linear:box-1"
|
||||||
|
size="16"
|
||||||
|
:color="isSelected(p) ? 'var(--App-secondary-color, #e0be7f)' : 'inherit'"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<span class="product-picker__item-title">{{ getItemTitle(p) }}</span>
|
||||||
|
<span v-if="getItemUnit(p)" class="product-picker__item-unit">({{ getItemUnit(p) }})</span>
|
||||||
|
<span v-if="getItemSubtitle(p)" class="product-picker__item-subtitle">{{ getItemSubtitle(p) }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span v-if="isSelected(p)" class="product-picker__item-check">
|
||||||
|
<BasicIcon icon="vuesax-linear:tick-circle" size="18" color="var(--App-secondary-color, #e0be7f)" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="loading" class="product-picker__loading">
|
||||||
|
<BasicIcon icon="vuesax-linear:box-time" size="20" class="animate-spin" color="var(--App-secondary-color, #e0be7f)" />
|
||||||
|
<span>در حال دریافت محصولات...</span>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="filteredList.length === 0" class="product-picker__empty">
|
||||||
|
<BasicIcon icon="vuesax-linear:info-circle" size="20" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
<span>{{ emptyText }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- اکشنشیت موبایل -->
|
||||||
|
<BasicActionSheet
|
||||||
|
v-if="!isDesktop"
|
||||||
|
v-model:show="isSheetOpen"
|
||||||
|
:title="sheetTitle"
|
||||||
|
:closable="true"
|
||||||
|
@closed="onSheetClosed"
|
||||||
|
>
|
||||||
|
<div class="product-picker-sheet">
|
||||||
|
<div class="product-picker-sheet__search">
|
||||||
|
<span class="product-picker-sheet__search-icon" aria-hidden="true">
|
||||||
|
<BasicIcon icon="vuesax-linear:search-normal" size="18" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</span>
|
||||||
|
<input
|
||||||
|
ref="mobileSearchInputRef"
|
||||||
|
v-model="searchQuery"
|
||||||
|
type="text"
|
||||||
|
class="product-picker-sheet__search-input"
|
||||||
|
placeholder="جستجوی نام یا کد محصول..."
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
v-if="searchQuery"
|
||||||
|
type="button"
|
||||||
|
class="product-picker-sheet__clear-btn"
|
||||||
|
aria-label="پاک کردن جستجو"
|
||||||
|
@click="searchQuery = ''"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:close-circle" size="18" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="product-picker-sheet__list" role="listbox">
|
||||||
|
<button
|
||||||
|
v-for="p in filteredList"
|
||||||
|
:key="getItemKey(p)"
|
||||||
|
type="button"
|
||||||
|
role="option"
|
||||||
|
class="product-picker-sheet__item"
|
||||||
|
:class="{ 'product-picker-sheet__item--selected': isSelected(p) }"
|
||||||
|
:aria-selected="isSelected(p)"
|
||||||
|
@click="selectItem(p)"
|
||||||
|
>
|
||||||
|
<div class="product-picker-sheet__item-info">
|
||||||
|
<span class="product-picker-sheet__item-icon">
|
||||||
|
<BasicIcon
|
||||||
|
icon="vuesax-linear:box-1"
|
||||||
|
size="18"
|
||||||
|
:color="isSelected(p) ? 'var(--App-secondary-color, #e0be7f)' : 'inherit'"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<div class="product-picker-sheet__item-texts">
|
||||||
|
<span class="product-picker-sheet__item-title">{{ getItemTitle(p) }}</span>
|
||||||
|
<span
|
||||||
|
v-if="getItemSubtitle(p) || getItemUnit(p)"
|
||||||
|
class="product-picker-sheet__item-meta"
|
||||||
|
>
|
||||||
|
{{ getItemSubtitle(p) || `واحد: ${getItemUnit(p)}` }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span v-if="isSelected(p)" class="product-picker-sheet__item-check">
|
||||||
|
<BasicIcon icon="vuesax-linear:tick-circle" size="20" color="var(--App-secondary-color, #e0be7f)" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="loading" class="product-picker-sheet__loading">
|
||||||
|
<BasicIcon icon="vuesax-linear:box-time" size="26" class="animate-spin" color="var(--App-secondary-color, #e0be7f)" />
|
||||||
|
<span class="mt-2 text-sm text-gray-400">در حال دریافت محصولات...</span>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="filteredList.length === 0" class="product-picker-sheet__empty">
|
||||||
|
<BasicIcon icon="vuesax-linear:info-circle" size="24" color="var(--app-text-soft, #9ca3af)" />
|
||||||
|
<span>{{ emptyText }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</BasicActionSheet>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||||
|
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
modelValue?: number | string | null
|
||||||
|
value?: number | string | null
|
||||||
|
items?: any[]
|
||||||
|
products?: any[]
|
||||||
|
keyName?: string
|
||||||
|
valueName?: string
|
||||||
|
unitName?: string
|
||||||
|
subtitleName?: string
|
||||||
|
placeholder?: string
|
||||||
|
sheetTitle?: string
|
||||||
|
label?: string
|
||||||
|
disabled?: boolean
|
||||||
|
loading?: boolean
|
||||||
|
isEdit?: boolean
|
||||||
|
lockedTitle?: string
|
||||||
|
allowClear?: boolean
|
||||||
|
compact?: boolean
|
||||||
|
emptyText?: string
|
||||||
|
dropdownStyle?: Record<string, any>
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
modelValue: undefined,
|
||||||
|
value: undefined,
|
||||||
|
items: undefined,
|
||||||
|
products: undefined,
|
||||||
|
keyName: 'id',
|
||||||
|
valueName: 'title',
|
||||||
|
unitName: 'unit',
|
||||||
|
subtitleName: 'subtitle',
|
||||||
|
placeholder: 'انتخاب محصول...',
|
||||||
|
sheetTitle: 'انتخاب محصول',
|
||||||
|
label: '',
|
||||||
|
disabled: false,
|
||||||
|
loading: false,
|
||||||
|
isEdit: false,
|
||||||
|
lockedTitle: '',
|
||||||
|
allowClear: false,
|
||||||
|
compact: false,
|
||||||
|
emptyText: 'محصولی یافت نشد',
|
||||||
|
dropdownStyle: undefined,
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:modelValue': [val: any]
|
||||||
|
'update:value': [val: any]
|
||||||
|
'change': [item: any]
|
||||||
|
'clear': []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const isDesktop = useDesktopBreakpoint()
|
||||||
|
const containerRef = ref<HTMLElement>()
|
||||||
|
const desktopSearchInputRef = ref<HTMLInputElement>()
|
||||||
|
const mobileSearchInputRef = ref<HTMLInputElement>()
|
||||||
|
|
||||||
|
const isOpen = ref(false)
|
||||||
|
const isSheetOpen = ref(false)
|
||||||
|
const searchQuery = ref('')
|
||||||
|
|
||||||
|
const effectiveList = computed(() => {
|
||||||
|
if (Array.isArray(props.items)) return props.items
|
||||||
|
if (Array.isArray(props.products)) return props.products
|
||||||
|
return []
|
||||||
|
})
|
||||||
|
|
||||||
|
const currentValue = computed(() => {
|
||||||
|
if (props.modelValue !== undefined) return props.modelValue
|
||||||
|
return props.value
|
||||||
|
})
|
||||||
|
|
||||||
|
function getItemKey(item: any): any {
|
||||||
|
if (!item) return ''
|
||||||
|
return item[props.keyName] !== undefined ? item[props.keyName] : item.id
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemTitle(item: any): string {
|
||||||
|
if (!item) return ''
|
||||||
|
return String(item[props.valueName] || item.title || item.name || `محصول ${getItemKey(item)}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemUnit(item: any): string {
|
||||||
|
if (!item) return ''
|
||||||
|
return item[props.unitName] || item.unit || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemSubtitle(item: any): string {
|
||||||
|
if (!item) return ''
|
||||||
|
return item[props.subtitleName] || item.subtitle || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedItem = computed(() => {
|
||||||
|
const val = currentValue.value
|
||||||
|
if (val === undefined || val === null || val === '') return null
|
||||||
|
return effectiveList.value.find((p) => String(getItemKey(p)) === String(val)) ?? null
|
||||||
|
})
|
||||||
|
|
||||||
|
const displayTitle = computed(() => {
|
||||||
|
if (props.isEdit && props.lockedTitle) return props.lockedTitle
|
||||||
|
if (selectedItem.value) return getItemTitle(selectedItem.value)
|
||||||
|
const val = currentValue.value
|
||||||
|
if (val !== undefined && val !== null && val !== '') return `محصول ${val}`
|
||||||
|
return props.placeholder
|
||||||
|
})
|
||||||
|
|
||||||
|
const displayUnit = computed(() => {
|
||||||
|
if (props.isEdit) return ''
|
||||||
|
return selectedItem.value ? getItemUnit(selectedItem.value) : ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const displaySubtitle = computed(() => {
|
||||||
|
if (props.isEdit) return ''
|
||||||
|
return selectedItem.value ? getItemSubtitle(selectedItem.value) : ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function isSelected(item: any): boolean {
|
||||||
|
const val = currentValue.value
|
||||||
|
if (val === undefined || val === null || val === '') return false
|
||||||
|
return String(getItemKey(item)) === String(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeText(text: string): string {
|
||||||
|
return (text || '')
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/ي/g, 'ی')
|
||||||
|
.replace(/ك/g, 'ک')
|
||||||
|
.replace(/[\u200B-\u200D\uFEFF]/g, '')
|
||||||
|
.trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
const filteredList = computed(() => {
|
||||||
|
const q = normalizeText(searchQuery.value)
|
||||||
|
if (!q) return effectiveList.value
|
||||||
|
return effectiveList.value.filter((p) => {
|
||||||
|
const title = normalizeText(getItemTitle(p))
|
||||||
|
const unit = normalizeText(getItemUnit(p))
|
||||||
|
const subtitle = normalizeText(getItemSubtitle(p))
|
||||||
|
const key = String(getItemKey(p))
|
||||||
|
return title.includes(q) || unit.includes(q) || subtitle.includes(q) || key.includes(q)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function toggleOpen() {
|
||||||
|
if (props.disabled || props.isEdit) return
|
||||||
|
if (isDesktop.value) {
|
||||||
|
isOpen.value = !isOpen.value
|
||||||
|
if (isOpen.value) {
|
||||||
|
nextTick(() => {
|
||||||
|
desktopSearchInputRef.value?.focus()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
searchQuery.value = ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isSheetOpen.value = true
|
||||||
|
nextTick(() => {
|
||||||
|
mobileSearchInputRef.value?.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectItem(item: any) {
|
||||||
|
const key = getItemKey(item)
|
||||||
|
emit('update:modelValue', key)
|
||||||
|
emit('update:value', key)
|
||||||
|
emit('change', item)
|
||||||
|
isOpen.value = false
|
||||||
|
isSheetOpen.value = false
|
||||||
|
searchQuery.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClear() {
|
||||||
|
emit('update:modelValue', undefined)
|
||||||
|
emit('update:value', undefined)
|
||||||
|
emit('change', undefined)
|
||||||
|
emit('clear')
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSheetClosed() {
|
||||||
|
searchQuery.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClickOutside(e: MouseEvent) {
|
||||||
|
if (containerRef.value && !containerRef.value.contains(e.target as Node)) {
|
||||||
|
isOpen.value = false
|
||||||
|
searchQuery.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('click', handleClickOutside)
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('click', handleClickOutside)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.product-picker-root {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.375rem;
|
||||||
|
width: 100%;
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
&--open {
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
|
--picker-bg: var(--app-surface, var(--admin-bg-surface, #ffffff));
|
||||||
|
--picker-border: var(--app-border, var(--admin-border, #e2e8f0));
|
||||||
|
--picker-border-focus: var(--app-border-strong, var(--App-secondary-color, #e0be7f));
|
||||||
|
--picker-text: var(--app-text-primary, var(--admin-text, #0f172a));
|
||||||
|
--picker-text-soft: var(--app-text-muted, var(--admin-text-secondary, #64748b));
|
||||||
|
--picker-inset: var(--app-surface-inset, rgba(15, 23, 42, 0.03));
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(html[data-theme='dark']) .product-picker-root,
|
||||||
|
:global(html.dark) .product-picker-root {
|
||||||
|
--picker-bg: var(--app-surface, #1e2026);
|
||||||
|
--picker-border: var(--app-border, rgba(255, 255, 255, 0.12));
|
||||||
|
--picker-border-focus: var(--app-border-strong, rgba(255, 255, 255, 0.28));
|
||||||
|
--picker-text: var(--app-text-primary, #ffffff);
|
||||||
|
--picker-text-soft: var(--app-text-muted, rgba(255, 255, 255, 0.55));
|
||||||
|
--picker-inset: var(--app-surface-inset, rgba(255, 255, 255, 0.04));
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--picker-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__control {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: 2.65rem;
|
||||||
|
padding: 0 0.75rem;
|
||||||
|
border-radius: 0.65rem;
|
||||||
|
border: 1px solid var(--picker-border);
|
||||||
|
background: var(--picker-bg);
|
||||||
|
color: var(--picker-text);
|
||||||
|
direction: rtl;
|
||||||
|
transition: all 0.18s ease;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
.product-picker-root--compact & {
|
||||||
|
min-height: 2.35rem;
|
||||||
|
padding: 0 0.6rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--picker-border-focus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
border-color: var(--picker-border-focus);
|
||||||
|
box-shadow: 0 0 0 2px rgba(227, 176, 86, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
background: var(--picker-inset);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--locked {
|
||||||
|
background: var(--picker-inset);
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__value {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__text {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--picker-text);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
.product-picker-root--compact & {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--placeholder {
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__unit {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__subtitle {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: var(--App-secondary-color, #e0be7f);
|
||||||
|
font-weight: 600;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__trailing {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__clear-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 9999px;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__arrow {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* دراپداون دسکتاپ */
|
||||||
|
.product-picker__dropdown {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1050;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
border: 1px solid var(--picker-border);
|
||||||
|
background: var(--picker-bg);
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.375rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
height: 2.25rem;
|
||||||
|
padding: 0 0.6rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background: var(--picker-inset);
|
||||||
|
border: 1px solid var(--picker-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__search-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__search-input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--picker-text);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
text-align: right;
|
||||||
|
direction: rtl;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__clear-query-btn {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
max-height: 14rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.5rem 0.65rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
outline: none;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--picker-inset);
|
||||||
|
border-color: var(--picker-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--selected {
|
||||||
|
background: rgba(224, 190, 127, 0.12);
|
||||||
|
border-color: var(--App-secondary-color, #e0be7f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-title {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--picker-text);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-unit {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-subtitle {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: var(--App-secondary-color, #e0be7f);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__item-check {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker__empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding: 1.25rem 0.5rem;
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* شیت موبایل */
|
||||||
|
.product-picker-sheet {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding-bottom: 1.5rem;
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
height: 2.75rem;
|
||||||
|
padding: 0 0.85rem;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
background: var(--picker-inset);
|
||||||
|
border: 1px solid var(--picker-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__search-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__search-input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--picker-text);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: right;
|
||||||
|
direction: rtl;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__clear-btn {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.35rem;
|
||||||
|
max-height: 55vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.65rem 0.75rem;
|
||||||
|
border-radius: 0.65rem;
|
||||||
|
border: 1px solid var(--picker-border);
|
||||||
|
background: var(--picker-bg);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
outline: none;
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: var(--App-secondary-color, #e0be7f);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--selected {
|
||||||
|
border-color: var(--App-secondary-color, #e0be7f);
|
||||||
|
background: rgba(224, 190, 127, 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.65rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 2.1rem;
|
||||||
|
height: 2.1rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background: var(--picker-inset);
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.product-picker-sheet__item--selected & {
|
||||||
|
background: var(--App-secondary-color, #e0be7f);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-texts {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-title {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--picker-text);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-meta {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__item-check {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-picker-sheet__empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
padding: 2rem 1rem;
|
||||||
|
color: var(--picker-text-soft);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<a
|
||||||
|
v-if="href && src"
|
||||||
|
referrerpolicy="origin"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
:href="href"
|
||||||
|
class="enamad-badge"
|
||||||
|
:class="`enamad-badge--${size}`"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
referrerpolicy="origin"
|
||||||
|
:src="src"
|
||||||
|
alt="enamad"
|
||||||
|
class="enamad-badge__img"
|
||||||
|
:code="code || undefined"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
size?: 'sm' | 'lg'
|
||||||
|
}>(),
|
||||||
|
{ size: 'sm' },
|
||||||
|
)
|
||||||
|
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
|
||||||
|
const href = computed(() =>
|
||||||
|
String(settingsStore.getSettingByKey('enamad_url') ?? '').trim(),
|
||||||
|
)
|
||||||
|
const src = computed(() =>
|
||||||
|
String(settingsStore.getSettingByKey('enamad_logo') ?? '').trim(),
|
||||||
|
)
|
||||||
|
const code = computed(() => {
|
||||||
|
try {
|
||||||
|
const u = new URL(href.value || src.value)
|
||||||
|
return u.searchParams.get('Code') || u.searchParams.get('code') || ''
|
||||||
|
} catch {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.enamad-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enamad-badge__img {
|
||||||
|
width: auto;
|
||||||
|
cursor: pointer;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enamad-badge--sm .enamad-badge__img {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enamad-badge--lg .enamad-badge__img {
|
||||||
|
height: 120px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal
|
||||||
|
v-model:visible="visible"
|
||||||
|
width="400px"
|
||||||
|
destroy-on-close
|
||||||
|
custom-footer
|
||||||
|
wrap-class-name="gold-day-calc-modal"
|
||||||
|
>
|
||||||
|
<template #title>
|
||||||
|
<div class="gold-day-calc-modal__title">
|
||||||
|
<BasicIcon icon="vuesax-linear:chart-2" size="20" class="gold-day-calc-modal__title-icon" />
|
||||||
|
<span>محاسبهگر طلای شما</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="gold-day-calc" dir="rtl">
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="weight"
|
||||||
|
title="وزن طلا (گرم)"
|
||||||
|
type="tel"
|
||||||
|
place-holder="مثلاً ۱۰.۵"
|
||||||
|
inputmode="decimal"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BasicInput
|
||||||
|
:value="unitPriceInput"
|
||||||
|
title="قیمت روز طلا"
|
||||||
|
type="tel"
|
||||||
|
disabled
|
||||||
|
addon-before="ریال"
|
||||||
|
place-holder="قیمت صفحه اصلی"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="feePercent"
|
||||||
|
title="اجرت ساخت (%)"
|
||||||
|
type="tel"
|
||||||
|
place-holder="مثلاً ۷"
|
||||||
|
inputmode="decimal"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<BasicInput
|
||||||
|
v-model:value="taxPercent"
|
||||||
|
title="سود و مالیات (%)"
|
||||||
|
type="tel"
|
||||||
|
place-holder="مثلاً ۹"
|
||||||
|
inputmode="decimal"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="gold-day-calc__result rounded-xl border border-solid border-gray-200 bg-gray-50 p-3">
|
||||||
|
<div class="text-xs text-gray-500 mb-1">کل نهایی</div>
|
||||||
|
<div class="gold-day-calc__total text-lg font-bold text-primary">
|
||||||
|
<span class="gold-day-calc__num">{{ formattedTotal }}</span>
|
||||||
|
<span class="text-sm font-medium text-gray-600">ریال</span>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2 flex flex-col gap-1 text-xs text-gray-600">
|
||||||
|
<div class="flex justify-between gap-2">
|
||||||
|
<span>هزینه طلا</span>
|
||||||
|
<span class="gold-day-calc__num">{{ formatRial(breakdown.goldCost) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between gap-2">
|
||||||
|
<span>اجرت</span>
|
||||||
|
<span class="gold-day-calc__num">{{ formatRial(breakdown.feeCost) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between gap-2">
|
||||||
|
<span>سود و مالیات</span>
|
||||||
|
<span class="gold-day-calc__num">{{ formatRial(breakdown.taxCost) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<BasicButton type="primary" class="!w-full" size="middle" @click="recalculate">
|
||||||
|
محاسبه مجدد
|
||||||
|
</BasicButton>
|
||||||
|
</template>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
import BasicModal from '@/components/BasicPacks/BasicModal.vue'
|
||||||
|
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { goldDayCalculatorVisible } from '@/composables/useGoldDayCalculator'
|
||||||
|
import {
|
||||||
|
getLastPrices,
|
||||||
|
getTradeBuyPrice,
|
||||||
|
lastPrice,
|
||||||
|
startLastPricePolling,
|
||||||
|
stopLastPricePolling,
|
||||||
|
} from '@/utils/price'
|
||||||
|
import { getPriceDisplayState, NO_QUOTE_MESSAGE } from '@/utils/storeHours'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import { persianToEnglishDigits } from '@/utils/persianDigits'
|
||||||
|
|
||||||
|
const visible = goldDayCalculatorVisible
|
||||||
|
|
||||||
|
const weight = ref<string | number>('')
|
||||||
|
const feePercent = ref<string | number>('')
|
||||||
|
const taxPercent = ref<string | number>('')
|
||||||
|
const tick = ref(0)
|
||||||
|
|
||||||
|
function parseNum(raw: string | number | undefined): number {
|
||||||
|
const s = persianToEnglishDigits(String(raw ?? ''))
|
||||||
|
.replace(/,/g, '')
|
||||||
|
.replace(/[^\d.]/g, '')
|
||||||
|
const n = Number.parseFloat(s)
|
||||||
|
return Number.isFinite(n) ? n : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const liveUnitPrice = computed(() => {
|
||||||
|
void tick.value
|
||||||
|
if (getPriceDisplayState() !== 'open') return 0
|
||||||
|
return getTradeBuyPrice(lastPrice.value) || 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const unitPriceInput = computed(() => {
|
||||||
|
void tick.value
|
||||||
|
const state = getPriceDisplayState()
|
||||||
|
if (state === 'closed') return 'فروشگاه بسته است'
|
||||||
|
if (state === 'no_quote') return NO_QUOTE_MESSAGE
|
||||||
|
const p = liveUnitPrice.value
|
||||||
|
return p > 0 ? usePriceWithoutType(p) : ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const breakdown = computed(() => {
|
||||||
|
void tick.value
|
||||||
|
const w = parseNum(weight.value)
|
||||||
|
const fee = parseNum(feePercent.value)
|
||||||
|
const tax = parseNum(taxPercent.value)
|
||||||
|
const unit = liveUnitPrice.value
|
||||||
|
const goldCost = w * unit
|
||||||
|
const feeCost = goldCost * (fee / 100)
|
||||||
|
const taxCost = (goldCost + feeCost) * (tax / 100)
|
||||||
|
const total = goldCost + feeCost + taxCost
|
||||||
|
return { goldCost, feeCost, taxCost, total }
|
||||||
|
})
|
||||||
|
|
||||||
|
const formattedTotal = computed(() => formatRial(breakdown.value.total))
|
||||||
|
|
||||||
|
function formatRial(n: number) {
|
||||||
|
if (!Number.isFinite(n) || n <= 0) return '۰'
|
||||||
|
return usePriceWithoutType(Math.round(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
function recalculate() {
|
||||||
|
tick.value += 1
|
||||||
|
void getLastPrices()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(visible, async (open) => {
|
||||||
|
if (open) {
|
||||||
|
startLastPricePolling()
|
||||||
|
await getLastPrices()
|
||||||
|
tick.value += 1
|
||||||
|
} else {
|
||||||
|
stopLastPricePolling()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.gold-day-calc {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* فقط متن لیبل RTL — گروه اینپوت LTR بماند تا addon ریال نشکند */
|
||||||
|
.gold-day-calc :deep(.ant-input-group) {
|
||||||
|
direction: ltr;
|
||||||
|
display: table;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc :deep(.ant-input-group > .ant-input) {
|
||||||
|
direction: ltr;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc :deep(.ant-input:not(.ant-input-group *)) {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc__result {
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc__total {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc__num {
|
||||||
|
direction: ltr;
|
||||||
|
unicode-bidi: isolate;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.gold-day-calc-modal {
|
||||||
|
.ant-modal-content {
|
||||||
|
direction: rtl;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-height: min(88dvh, 640px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-header {
|
||||||
|
flex-shrink: 0;
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
/* ضربدر فیزیکی چپ — پدینگ راست کم تا عنوان نزدیک لبه راست بماند */
|
||||||
|
padding-left: 2.75rem;
|
||||||
|
padding-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-title {
|
||||||
|
text-align: right;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc-modal__title {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 0.5rem;
|
||||||
|
direction: rtl;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold-day-calc-modal__title-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: var(--App-secondary-color, #c9a062);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ضربدر سمت چپ — عنوان سمت راست */
|
||||||
|
.ant-modal-close {
|
||||||
|
inset-inline-start: 0 !important;
|
||||||
|
inset-inline-end: auto !important;
|
||||||
|
right: auto !important;
|
||||||
|
left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-body {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
max-height: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#body {
|
||||||
|
max-height: min(48dvh, 360px) !important;
|
||||||
|
overflow-y: auto !important;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-footer {
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
border-top: 1px solid rgba(148, 163, 184, 0.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767.98px) {
|
||||||
|
.gold-day-calc-modal {
|
||||||
|
.ant-modal {
|
||||||
|
max-width: calc(100vw - 1.5rem);
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-content {
|
||||||
|
max-height: min(86dvh, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* بین هدر و دکمه — ارتفاع کمتر تا اسکرول بخورد */
|
||||||
|
#body {
|
||||||
|
max-height: min(42dvh, 280px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-modal-body {
|
||||||
|
padding-top: 0.25rem;
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 400px) {
|
||||||
|
.gold-day-calc-modal #body {
|
||||||
|
max-height: min(38dvh, 240px) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<van-dialog
|
<van-dialog
|
||||||
class="updateButton"
|
v-model:show="show"
|
||||||
confirm-button-text="متوجه شدم"
|
class="gold-loading-dialog updateButton"
|
||||||
|
teleport="body"
|
||||||
|
:z-index="zIndex"
|
||||||
:show-confirm-button="false"
|
:show-confirm-button="false"
|
||||||
@confirm="update()"
|
:close-on-click-overlay="false"
|
||||||
|
:close-on-popstate="false"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col items-center p-2">
|
<div class="flex flex-col items-center p-2">
|
||||||
<DotLottieVue class="w-15rem h-15rem" autoplay loop src="/animIsTracking.json" />
|
<DotLottieVue class="w-15rem h-15rem" autoplay loop src="/animIsTracking.json" />
|
||||||
@@ -16,21 +19,27 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
import { computed } from 'vue'
|
||||||
import { update } from 'lodash'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import anim from '@/assets/img/anim/anim1.json'
|
|
||||||
import { DotLottieVue } from '@lottiefiles/dotlottie-vue'
|
import { DotLottieVue } from '@lottiefiles/dotlottie-vue'
|
||||||
interface Prop {
|
import { APP_Z_OVERLAY } from '@/utils/zIndex'
|
||||||
title: string
|
|
||||||
info?: string
|
const props = withDefaults(
|
||||||
infoHead?: string
|
defineProps<{
|
||||||
isLine?: boolean
|
show?: boolean
|
||||||
value?: string | number
|
zIndex?: number
|
||||||
}
|
}>(),
|
||||||
const props = withDefaults(defineProps<Prop>(), {
|
{
|
||||||
isLine: false
|
show: false,
|
||||||
|
zIndex: APP_Z_OVERLAY,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:show': [value: boolean]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const show = computed({
|
||||||
|
get: () => props.show,
|
||||||
|
set: (value: boolean) => emit('update:show', value),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less"></style>
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="showInstallEntry" class="mt-2 w-full">
|
||||||
|
<BasicButton class="!w-full" @click="onClick">
|
||||||
|
{{ canNativeInstall ? 'نصب اپلیکیشن' : 'آموزش نصب' }}
|
||||||
|
</BasicButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import { usePwaInstall } from '@/composables/usePwaInstall'
|
||||||
|
import { PWA_MANIFEST_READY_EVENT } from '@/modules/pwa/manifest'
|
||||||
|
import {
|
||||||
|
hasNativeInstallPrompt,
|
||||||
|
initPwaInstallPromptListener,
|
||||||
|
} from '@/modules/pwa/pwaInstall'
|
||||||
|
|
||||||
|
const { tryInstallOrOpenGuide, showInstallEntry } = usePwaInstall()
|
||||||
|
const canNativeInstall = ref(false)
|
||||||
|
|
||||||
|
function refreshCanInstall() {
|
||||||
|
canNativeInstall.value = hasNativeInstallPrompt()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onClick() {
|
||||||
|
await tryInstallOrOpenGuide()
|
||||||
|
refreshCanInstall()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initPwaInstallPromptListener()
|
||||||
|
refreshCanInstall()
|
||||||
|
window.addEventListener(PWA_MANIFEST_READY_EVENT, refreshCanInstall)
|
||||||
|
window.addEventListener('appinstalled', refreshCanInstall)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener(PWA_MANIFEST_READY_EVENT, refreshCanInstall)
|
||||||
|
window.removeEventListener('appinstalled', refreshCanInstall)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -29,16 +29,26 @@ const props = withDefaults(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function productImageKey(product?: ProductImageSource): string {
|
||||||
|
return [
|
||||||
|
product?.file_id ?? '',
|
||||||
|
product?.file?.id ?? '',
|
||||||
|
product?.file?.full_src ?? '',
|
||||||
|
product?.file?.src ?? '',
|
||||||
|
product?.file?.url ?? '',
|
||||||
|
product?.img ?? '',
|
||||||
|
].join('|')
|
||||||
|
}
|
||||||
|
|
||||||
const currentSrc = ref(resolveProductImageSrc(props.product))
|
const currentSrc = ref(resolveProductImageSrc(props.product))
|
||||||
const usingFallback = ref(false)
|
const usingFallback = ref(false)
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.product,
|
() => productImageKey(props.product),
|
||||||
(product) => {
|
() => {
|
||||||
usingFallback.value = false
|
usingFallback.value = false
|
||||||
currentSrc.value = resolveProductImageSrc(product)
|
currentSrc.value = resolveProductImageSrc(props.product)
|
||||||
},
|
},
|
||||||
{ deep: true }
|
|
||||||
)
|
)
|
||||||
|
|
||||||
function handleError() {
|
function handleError() {
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="variant === 'desktop' ? desktopRootClass : mobileRootClass">
|
||||||
|
<button
|
||||||
|
ref="triggerEl"
|
||||||
|
type="button"
|
||||||
|
class="support-contact-bar__btn"
|
||||||
|
:disabled="!canContactSupport"
|
||||||
|
@click="onSupportClick"
|
||||||
|
>
|
||||||
|
<BasicIcon icon="vuesax-linear:messages-2" size="20" color="#fff" />
|
||||||
|
<span>ارتباط با پشتیبانی</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { useSupportMessenger } from '@/composables/useSupportMessenger'
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
variant?: 'mobile' | 'desktop'
|
||||||
|
mobileRootClass?: string
|
||||||
|
desktopRootClass?: string
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
variant: 'mobile',
|
||||||
|
mobileRootClass: 'wrap-fix bottom-0 px-10 pb-3rem flex bg-white',
|
||||||
|
desktopRootClass: 'dpage-support',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const {
|
||||||
|
supportPhoneLink,
|
||||||
|
hasMessengerLink,
|
||||||
|
hasSupportPhoneLink,
|
||||||
|
openSupportMessenger,
|
||||||
|
} = useSupportMessenger()
|
||||||
|
|
||||||
|
const triggerEl = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
|
const canContactSupport = computed(() => hasMessengerLink.value || hasSupportPhoneLink.value)
|
||||||
|
|
||||||
|
async function onSupportClick() {
|
||||||
|
// همان رفتار دکمه شناور پشتیبانی — بدون پیشنویس واریز
|
||||||
|
if (hasMessengerLink.value) {
|
||||||
|
await openSupportMessenger(triggerEl.value)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasSupportPhoneLink.value && supportPhoneLink.value) {
|
||||||
|
window.location.href = supportPhoneLink.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.support-contact-bar__btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 2.75rem;
|
||||||
|
padding: 0.65rem 1rem;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
background: var(--App-primary, @App-primary-color);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.55;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dpage-support {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -21,8 +21,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import baleLogo from '@/assets/messengers/bale.png'
|
import baleLogo from '@/assets/messengers/bale.png'
|
||||||
|
import callLogo from '@/assets/messengers/call.svg'
|
||||||
import eitaaLogo from '@/assets/messengers/eitaa.png'
|
import eitaaLogo from '@/assets/messengers/eitaa.png'
|
||||||
import rubikaLogo from '@/assets/messengers/rubika.png'
|
import rubikaLogo from '@/assets/messengers/rubika.png'
|
||||||
|
import smsLogo from '@/assets/messengers/sms.svg'
|
||||||
import soroushLogo from '@/assets/messengers/soroush.svg'
|
import soroushLogo from '@/assets/messengers/soroush.svg'
|
||||||
import telegramLogo from '@/assets/messengers/telegram.svg'
|
import telegramLogo from '@/assets/messengers/telegram.svg'
|
||||||
import whatsappLogo from '@/assets/messengers/whatsapp.svg'
|
import whatsappLogo from '@/assets/messengers/whatsapp.svg'
|
||||||
@@ -34,6 +36,8 @@ const LOGOS: Record<string, string> = {
|
|||||||
rubika: rubikaLogo,
|
rubika: rubikaLogo,
|
||||||
eitaa: eitaaLogo,
|
eitaa: eitaaLogo,
|
||||||
soroush: soroushLogo,
|
soroush: soroushLogo,
|
||||||
|
call: callLogo,
|
||||||
|
sms: smsLogo,
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{ messenger: string }>()
|
const props = defineProps<{ messenger: string }>()
|
||||||
|
|||||||
@@ -30,7 +30,13 @@
|
|||||||
:aria-label="entry.label"
|
:aria-label="entry.label"
|
||||||
@click.stop="select(entry)"
|
@click.stop="select(entry)"
|
||||||
>
|
>
|
||||||
<SupportMessengerBrandIcon :messenger="entry.messenger" />
|
<SupportMessengerBrandIcon v-if="entry.messenger !== 'chat'" :messenger="entry.messenger" />
|
||||||
|
<BasicIcon
|
||||||
|
v-else
|
||||||
|
:icon="entry.icon || 'vuesax-linear:messages-2'"
|
||||||
|
size="22"
|
||||||
|
:color="entry.accent || '#16a34a'"
|
||||||
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
@@ -39,6 +45,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
||||||
import SupportMessengerBrandIcon from '@/components/SupportMessengerBrandIcon.vue'
|
import SupportMessengerBrandIcon from '@/components/SupportMessengerBrandIcon.vue'
|
||||||
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
import type { ResolvedSupportMessengerEntry } from '@/utils/supportMessenger'
|
import type { ResolvedSupportMessengerEntry } from '@/utils/supportMessenger'
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|||||||
@@ -0,0 +1,227 @@
|
|||||||
|
<template>
|
||||||
|
<div class="trade-fee-summary">
|
||||||
|
<div class="trade-fee-summary__quote">
|
||||||
|
<div class="trade-fee-summary__label">مظنه هر {{ weightUnit }}</div>
|
||||||
|
<div class="trade-fee-summary__value trade-fee-summary__value--strong">
|
||||||
|
<span>{{ formattedUnitPrice }}</span>
|
||||||
|
<span class="trade-fee-summary__unit">ریال</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="(section, index) in breakdown.sections"
|
||||||
|
:key="section.heading"
|
||||||
|
class="trade-fee-summary__section"
|
||||||
|
:class="{ 'trade-fee-summary__section--divided': index > 0 }"
|
||||||
|
>
|
||||||
|
<div class="trade-fee-summary__heading">{{ section.heading }}</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-for="(row, rowIndex) in section.rows"
|
||||||
|
:key="`${section.heading}-${rowIndex}`"
|
||||||
|
class="trade-fee-summary__row"
|
||||||
|
:class="{
|
||||||
|
'trade-fee-summary__row--divider': row.dividerBefore,
|
||||||
|
'trade-fee-summary__row--bold': row.bold,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="trade-fee-summary__label"
|
||||||
|
:class="{ 'trade-fee-summary__label--strong': row.bold }"
|
||||||
|
>
|
||||||
|
<span v-if="row.plus" class="trade-fee-summary__sign trade-fee-summary__sign--plus">+</span>
|
||||||
|
<span v-else-if="row.minus && !row.bold" class="trade-fee-summary__sign trade-fee-summary__sign--minus">−</span>
|
||||||
|
{{ row.label }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="trade-fee-summary__value"
|
||||||
|
:class="{
|
||||||
|
'trade-fee-summary__value--minus': row.minus && !row.bold,
|
||||||
|
'trade-fee-summary__value--plus': row.plus,
|
||||||
|
'trade-fee-summary__value--strong': row.bold,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template v-if="row.gram != null">
|
||||||
|
<span>{{ formatTradeGramDisplay(row.gram) }}</span>
|
||||||
|
<span class="trade-fee-summary__unit">{{ weightUnit }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="row.rial != null">
|
||||||
|
<span v-if="row.minus && row.bold">−</span>
|
||||||
|
<span>{{ formatRial(row.rial) }}</span>
|
||||||
|
<span class="trade-fee-summary__unit">ریال</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="section.footnote" class="trade-fee-summary__footnote">
|
||||||
|
{{ section.footnote }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { usePriceWithoutType } from '@/utils/usePrice'
|
||||||
|
import {
|
||||||
|
buildTradeConfirmBreakdown,
|
||||||
|
formatTradeGramDisplay,
|
||||||
|
type TradeInputLock,
|
||||||
|
} from '@/utils/serviceFee'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
isBuy: boolean
|
||||||
|
inputLock: TradeInputLock
|
||||||
|
displayTradeGoldAmount: number | string
|
||||||
|
weightUnit: string
|
||||||
|
unitPriceRial: number
|
||||||
|
feeInGrams: number
|
||||||
|
equivalentPrice: string
|
||||||
|
payablePrice: number
|
||||||
|
orderGoldAmount: number
|
||||||
|
feeInRial: number
|
||||||
|
sellGoldDebit?: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const formattedUnitPrice = computed(() =>
|
||||||
|
usePriceWithoutType(Math.round(props.unitPriceRial)),
|
||||||
|
)
|
||||||
|
|
||||||
|
function formatRial(value: number) {
|
||||||
|
return usePriceWithoutType(Math.round(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
const breakdown = computed(() =>
|
||||||
|
buildTradeConfirmBreakdown({
|
||||||
|
isBuy: props.isBuy,
|
||||||
|
inputLock: props.inputLock,
|
||||||
|
orderGoldAmount: props.orderGoldAmount,
|
||||||
|
feeInGrams: props.feeInGrams,
|
||||||
|
feeInRial: props.feeInRial,
|
||||||
|
payablePrice: props.payablePrice,
|
||||||
|
unitPriceRial: props.unitPriceRial,
|
||||||
|
sellGoldDebit: props.sellGoldDebit,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.trade-fee-summary {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
background: var(--app-surface-inset, var(--app-surface));
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__quote {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding-bottom: 0.75rem;
|
||||||
|
border-bottom: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__section {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
|
||||||
|
&--divided {
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
border-top: 1px solid var(--app-border);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__heading {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-text-primary);
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.25rem 0;
|
||||||
|
|
||||||
|
&--divider {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
border-top: 1px dashed var(--app-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--bold {
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__label {
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--app-text-secondary);
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
&--strong {
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--app-text-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__value {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.25rem;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--app-text-primary);
|
||||||
|
text-align: left;
|
||||||
|
direction: ltr;
|
||||||
|
|
||||||
|
&--strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--minus {
|
||||||
|
color: var(--app-down, #ef4444);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--plus {
|
||||||
|
color: var(--app-up, #22c55e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__unit {
|
||||||
|
font-size: 0.6875rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--app-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__sign {
|
||||||
|
margin-left: 0.25rem;
|
||||||
|
|
||||||
|
&--plus {
|
||||||
|
color: var(--app-up, #22c55e);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--minus {
|
||||||
|
color: var(--app-down, #ef4444);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.trade-fee-summary__footnote {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
padding: 0.5rem 0.625rem;
|
||||||
|
border-radius: 0.625rem;
|
||||||
|
background: var(--app-surface, rgba(255, 255, 255, 0.04));
|
||||||
|
border: 1px solid var(--app-border);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: var(--app-text-secondary);
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,375 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
|
import {
|
||||||
|
PWA_GUIDE_STEP_LABELS,
|
||||||
|
PWA_INSTALL_GUIDE,
|
||||||
|
type PwaPlatform,
|
||||||
|
} from '@/modules/pwa/pwaInstallGuideSteps'
|
||||||
|
import { getDefaultPwaPlatform } from '@/modules/pwa/pwaInstall'
|
||||||
|
import PwaInstallStepIllustration from '@/components/pwa/PwaInstallStepIllustration.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
open: boolean
|
||||||
|
platform?: PwaPlatform
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:open': [value: boolean]
|
||||||
|
complete: []
|
||||||
|
close: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const activePlatform = ref<PwaPlatform>(props.platform ?? getDefaultPwaPlatform())
|
||||||
|
const stepIndex = ref(0)
|
||||||
|
|
||||||
|
const guide = computed(() => PWA_INSTALL_GUIDE[activePlatform.value])
|
||||||
|
const currentStep = computed(() => guide.value.steps[stepIndex.value])
|
||||||
|
const totalSteps = computed(() => guide.value.steps.length)
|
||||||
|
const isFirstStep = computed(() => stepIndex.value === 0)
|
||||||
|
const isLastStep = computed(() => stepIndex.value === totalSteps.value - 1)
|
||||||
|
const stepLabel = computed(() => PWA_GUIDE_STEP_LABELS[stepIndex.value] ?? String(stepIndex.value + 1))
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.open,
|
||||||
|
(visible) => {
|
||||||
|
if (!visible) return
|
||||||
|
activePlatform.value = props.platform ?? getDefaultPwaPlatform()
|
||||||
|
stepIndex.value = 0
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.platform,
|
||||||
|
(value) => {
|
||||||
|
if (value) activePlatform.value = value
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
emit('update:open', false)
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectPlatform(next: PwaPlatform) {
|
||||||
|
if (activePlatform.value === next) return
|
||||||
|
activePlatform.value = next
|
||||||
|
stepIndex.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function goNext() {
|
||||||
|
if (isLastStep.value) {
|
||||||
|
emit('complete')
|
||||||
|
close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
stepIndex.value += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function goPrev() {
|
||||||
|
if (isFirstStep.value) return
|
||||||
|
stepIndex.value -= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function completeGuide() {
|
||||||
|
emit('complete')
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Teleport to="body">
|
||||||
|
<div
|
||||||
|
v-if="open"
|
||||||
|
class="pwa-install-guide"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="pwa-install-guide-title"
|
||||||
|
@click.self="close"
|
||||||
|
>
|
||||||
|
<div class="pwa-install-guide__card">
|
||||||
|
<div class="pwa-install-guide__tabs">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pwa-install-guide__tab"
|
||||||
|
:class="{ 'pwa-install-guide__tab--active': activePlatform === 'ios' }"
|
||||||
|
@click="selectPlatform('ios')"
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||||
|
<rect x="7" y="2" width="10" height="20" rx="2.5" stroke="currentColor" stroke-width="1.5" />
|
||||||
|
<circle cx="12" cy="18.5" r="1" fill="currentColor" />
|
||||||
|
</svg>
|
||||||
|
<span>آیفون</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pwa-install-guide__tab"
|
||||||
|
:class="{ 'pwa-install-guide__tab--active': activePlatform === 'android' }"
|
||||||
|
@click="selectPlatform('android')"
|
||||||
|
>
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||||
|
<path d="M12 4v12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
||||||
|
<path d="M8.5 8.5 12 5l3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path d="M6 16h12v3a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-3Z" stroke="currentColor" stroke-width="1.5" />
|
||||||
|
</svg>
|
||||||
|
<span>اندروید</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pwa-install-guide__header">
|
||||||
|
<span class="pwa-install-guide__progress">
|
||||||
|
مرحله {{ stepLabel }} از {{ PWA_GUIDE_STEP_LABELS.length }}
|
||||||
|
</span>
|
||||||
|
<h2 id="pwa-install-guide-title" class="pwa-install-guide__title">
|
||||||
|
{{ guide.title }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pwa-install-guide__content">
|
||||||
|
<span class="pwa-install-guide__badge">{{ stepLabel }}</span>
|
||||||
|
|
||||||
|
<PwaInstallStepIllustration :type="currentStep.illustration" />
|
||||||
|
|
||||||
|
<p class="pwa-install-guide__text">{{ currentStep.text }}</p>
|
||||||
|
<p v-if="currentStep.hint" class="pwa-install-guide__hint">{{ currentStep.hint }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pwa-install-guide__nav">
|
||||||
|
<template v-if="isLastStep">
|
||||||
|
<BasicButton class="pwa-install-guide__primary" type="primary" @click="completeGuide">
|
||||||
|
متوجه شدم
|
||||||
|
</BasicButton>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pwa-install-guide__nav-btn"
|
||||||
|
:disabled="isFirstStep"
|
||||||
|
aria-label="مرحله قبل"
|
||||||
|
@click="goPrev"
|
||||||
|
>
|
||||||
|
‹
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="pwa-install-guide__dots" aria-hidden="true">
|
||||||
|
<span
|
||||||
|
v-for="(_, index) in totalSteps"
|
||||||
|
:key="index"
|
||||||
|
class="pwa-install-guide__dot"
|
||||||
|
:class="{ 'pwa-install-guide__dot--active': index === stepIndex }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="pwa-install-guide__nav-btn"
|
||||||
|
aria-label="مرحله بعد"
|
||||||
|
@click="goNext"
|
||||||
|
>
|
||||||
|
›
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-if="!isLastStep">
|
||||||
|
<BasicButton class="pwa-install-guide__primary" type="primary" @click="goNext">
|
||||||
|
بعدی
|
||||||
|
<span class="pwa-install-guide__primary-chevron">›</span>
|
||||||
|
</BasicButton>
|
||||||
|
|
||||||
|
<button type="button" class="pwa-install-guide__close" @click="close">
|
||||||
|
بستن
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.pwa-install-guide {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: var(--app-z-modal, 5500);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 16px;
|
||||||
|
background: rgba(15, 23, 42, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__card {
|
||||||
|
width: min(100%, 360px);
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24px;
|
||||||
|
padding: 14px 16px 18px;
|
||||||
|
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__tabs {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f1f5f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__tab {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 6px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 10px 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #64748b;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
color: #0f172a;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 14px 2px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__progress {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #94a3b8;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__content {
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 18px;
|
||||||
|
background: #f8fafc;
|
||||||
|
padding: 14px 14px 16px;
|
||||||
|
min-height: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 12px;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__text {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.8;
|
||||||
|
color: #334155;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__hint {
|
||||||
|
margin: 8px 0 0;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #64748b;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 14px 0 12px;
|
||||||
|
|
||||||
|
.pwa-install-guide__primary {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__nav-btn {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
color: #334155;
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__dots {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__dot {
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #cbd5e1;
|
||||||
|
transition: width 0.15s ease, background 0.15s ease;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
width: 22px;
|
||||||
|
background: #2563eb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__primary {
|
||||||
|
width: 100%;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 14px !important;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__primary-chevron {
|
||||||
|
margin-right: 4px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-install-guide__close {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,413 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PwaGuideIllustration } from '@/modules/pwa/pwaInstallGuideSteps'
|
||||||
|
import shareAppleIcon from '@/assets/img/share-apple.png'
|
||||||
|
import addToHomeScreenIcon from '@/assets/img/Add-to-homeScreen.png'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
type: PwaGuideIllustration
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="pwa-step-illustration"
|
||||||
|
:class="{
|
||||||
|
'pwa-step-illustration--android-menu': type === 'android-menu',
|
||||||
|
'pwa-step-illustration--ios-safari': type === 'ios-safari',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="pwa-step-illustration__phone"
|
||||||
|
:class="{
|
||||||
|
'pwa-step-illustration__phone--android-menu': type === 'android-menu',
|
||||||
|
'pwa-step-illustration__phone--ios-safari': type === 'ios-safari',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="pwa-step-illustration__screen"
|
||||||
|
:class="{
|
||||||
|
'pwa-step-illustration__screen--android-menu': type === 'android-menu',
|
||||||
|
'pwa-step-illustration__screen--ios-safari': type === 'ios-safari',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template v-if="type === 'android-chrome'">
|
||||||
|
<div class="pwa-step-illustration__browser-bar">
|
||||||
|
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--red" />
|
||||||
|
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--yellow" />
|
||||||
|
<span class="pwa-step-illustration__dot pwa-step-illustration__dot--green" />
|
||||||
|
</div>
|
||||||
|
<div class="pwa-step-illustration__chrome-body" />
|
||||||
|
<div class="pwa-step-illustration__chrome-label">باز در Chrome</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'android-menu'">
|
||||||
|
<div class="android-menu-scene">
|
||||||
|
<div class="android-menu-scene__toolbar">
|
||||||
|
<div class="android-menu-scene__url-bar" />
|
||||||
|
<div class="android-menu-scene__menu-target" aria-hidden="true">
|
||||||
|
<span class="android-menu-scene__menu-dots">⋮</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="android-menu-scene__viewport">
|
||||||
|
<div class="android-menu-scene__dropdown">
|
||||||
|
<div class="android-menu-scene__dropdown-line" />
|
||||||
|
<div class="android-menu-scene__dropdown-line android-menu-scene__dropdown-line--short" />
|
||||||
|
<div class="android-menu-scene__dropdown-install">
|
||||||
|
Install app
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'android-install'">
|
||||||
|
<div class="pwa-step-illustration__install-btn">Install</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'android-confirm'">
|
||||||
|
<div class="pwa-step-illustration__app-icon" />
|
||||||
|
<div class="pwa-step-illustration__home-label">روی صفحه اصلی</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'ios-safari'">
|
||||||
|
<div class="ios-safari-scene">
|
||||||
|
<div class="ios-safari-scene__toolbar">
|
||||||
|
<span class="ios-safari-scene__toolbar-label">Safari</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ios-safari-scene__viewport">
|
||||||
|
<div class="ios-safari-scene__placeholder" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ios-safari-scene__caption">باز در Safari</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'ios-share'">
|
||||||
|
<div class="pwa-step-illustration__share-wrap">
|
||||||
|
<img :src="shareAppleIcon" alt="" class="pwa-step-illustration__share-icon" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'ios-add-home'">
|
||||||
|
<div class="pwa-step-illustration__sheet">
|
||||||
|
<div class="pwa-step-illustration__sheet-item">Share</div>
|
||||||
|
<div class="pwa-step-illustration__sheet-item pwa-step-illustration__sheet-item--active">
|
||||||
|
<img :src="addToHomeScreenIcon" alt="" class="pwa-step-illustration__sheet-icon" />
|
||||||
|
Add to Home Screen
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="type === 'ios-confirm'">
|
||||||
|
<div class="pwa-step-illustration__app-icon" />
|
||||||
|
<div class="pwa-step-illustration__home-label">روی صفحه اصلی</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.pwa-step-illustration {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 8px 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__phone {
|
||||||
|
width: 148px;
|
||||||
|
height: 220px;
|
||||||
|
border: 2px solid #cbd5e1;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 10px 8px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__screen {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__browser-bar {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: 12px;
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__dot {
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 999px;
|
||||||
|
|
||||||
|
&--red { background: #ef4444; }
|
||||||
|
&--yellow { background: #f59e0b; }
|
||||||
|
&--green { background: #22c55e; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__chrome-body {
|
||||||
|
width: 78%;
|
||||||
|
height: 42%;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
|
||||||
|
margin-top: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__chrome-label,
|
||||||
|
.pwa-step-illustration__home-label {
|
||||||
|
font-size: 10px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration--android-menu,
|
||||||
|
.pwa-step-illustration--ios-safari {
|
||||||
|
padding: 12px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__phone--android-menu,
|
||||||
|
.pwa-step-illustration__phone--ios-safari {
|
||||||
|
width: 132px;
|
||||||
|
height: 208px;
|
||||||
|
padding: 0;
|
||||||
|
border-width: 1.5px;
|
||||||
|
border-color: #cbd5e1;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__screen--android-menu,
|
||||||
|
.pwa-step-illustration__screen--ios-safari {
|
||||||
|
border: none;
|
||||||
|
border-radius: 18px;
|
||||||
|
background: #fff;
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene__toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 28px;
|
||||||
|
padding: 8px 10px 6px;
|
||||||
|
border-bottom: 1px solid #eef2f7;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene__toolbar-label {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 72px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #eef2f7;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene__viewport {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 14px 12px 8px;
|
||||||
|
background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene__placeholder {
|
||||||
|
width: 78%;
|
||||||
|
height: 58%;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
|
||||||
|
box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ios-safari-scene__caption {
|
||||||
|
padding: 0 10px 10px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 9px;
|
||||||
|
color: #64748b;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__toolbar {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 10px 8px 8px;
|
||||||
|
border-bottom: 1px solid #eef2f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__url-bar {
|
||||||
|
flex: 1;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #e8edf5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__menu-target {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: 1.5px dashed #2563eb;
|
||||||
|
border-radius: 999px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(37, 99, 235, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__menu-dots {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #334155;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__viewport {
|
||||||
|
position: relative;
|
||||||
|
height: calc(100% - 41px);
|
||||||
|
background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__dropdown {
|
||||||
|
position: absolute;
|
||||||
|
top: 6px;
|
||||||
|
right: 8px;
|
||||||
|
width: 78px;
|
||||||
|
padding: 8px 8px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__dropdown-line {
|
||||||
|
height: 4px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #e2e8f0;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
|
||||||
|
&--short {
|
||||||
|
width: 72%;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.android-menu-scene__dropdown-install {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 22px;
|
||||||
|
padding: 4px 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #eff6ff;
|
||||||
|
border: 1px solid #bfdbfe;
|
||||||
|
color: #2563eb;
|
||||||
|
font-size: 8px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__install-btn {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #2563eb;
|
||||||
|
border: 1px solid #2563eb;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 6px 14px;
|
||||||
|
background: #eff6ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__app-icon {
|
||||||
|
width: 42px;
|
||||||
|
height: 42px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__share-wrap {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 14px;
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
border: 2px dashed #2563eb;
|
||||||
|
border-radius: 999px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__share-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__sheet {
|
||||||
|
width: 88%;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__sheet-item {
|
||||||
|
padding: 8px 10px;
|
||||||
|
font-size: 9px;
|
||||||
|
color: #64748b;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
color: #2563eb;
|
||||||
|
border: 1px solid #2563eb;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 6px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pwa-step-illustration__sheet-icon {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
|
import { notification } from 'ant-design-vue'
|
||||||
|
import { getAppNotificationsUnreadCount } from '@/api/appNotifications'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
import { getToken } from '@/utils'
|
||||||
|
import { showBrowserNotification } from '@/utils/browserNotification'
|
||||||
|
import { priceSocketConnected, priceWssEnabled } from '@/utils/priceSocketState'
|
||||||
|
import { APP_Z_TOAST } from '@/utils/zIndex'
|
||||||
|
|
||||||
|
const unreadCount = ref(0)
|
||||||
|
let started = false
|
||||||
|
let lastStreamNotifId = 0
|
||||||
|
let hydratedUnread = false
|
||||||
|
let lastShownNotifId = 0
|
||||||
|
let toastConfigured = false
|
||||||
|
let hydrateFallbackTimer: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
|
function ensureNotifToastConfig() {
|
||||||
|
if (toastConfigured) return
|
||||||
|
toastConfigured = true
|
||||||
|
notification.config({
|
||||||
|
placement: 'topRight',
|
||||||
|
top: 'calc(var(--app-home-header-offset, 4.25rem) + 0.5rem)',
|
||||||
|
duration: 5,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function notificationsEnabled(): boolean {
|
||||||
|
return Boolean(getToken()) && useSettingsStore().isSettingTruthy('has_page_notification')
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearHydrateFallback() {
|
||||||
|
if (hydrateFallbackTimer) {
|
||||||
|
clearTimeout(hydrateFallbackTimer)
|
||||||
|
hydrateFallbackTimer = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** از SSE رویداد unread-count — بدون HTTP */
|
||||||
|
function applyUnreadCountFromStream(payload: Record<string, unknown>) {
|
||||||
|
if (!notificationsEnabled()) {
|
||||||
|
unreadCount.value = 0
|
||||||
|
hydratedUnread = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const next = Number(payload.unread_count ?? 0) || 0
|
||||||
|
unreadCount.value = Math.max(0, next)
|
||||||
|
hydratedUnread = true
|
||||||
|
clearHydrateFallback()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** فقط وقتی SSE در دسترس نیست یا برای ریفرش دستی صفحه اعلانها */
|
||||||
|
async function refreshUnreadCount() {
|
||||||
|
if (!notificationsEnabled()) {
|
||||||
|
unreadCount.value = 0
|
||||||
|
hydratedUnread = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const data = await getAppNotificationsUnreadCount()
|
||||||
|
unreadCount.value = Number(data?.unread_count ?? 0) || 0
|
||||||
|
hydratedUnread = true
|
||||||
|
} catch {
|
||||||
|
// silent — badge optional
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearUnreadLocally() {
|
||||||
|
unreadCount.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function showInAppToast(title: string, body: string) {
|
||||||
|
try {
|
||||||
|
ensureNotifToastConfig()
|
||||||
|
notification.open({
|
||||||
|
message: title || 'اعلان جدید',
|
||||||
|
description: body || undefined,
|
||||||
|
placement: 'topRight',
|
||||||
|
duration: 5,
|
||||||
|
class: 'app-notif-toast',
|
||||||
|
style: { zIndex: APP_Z_TOAST },
|
||||||
|
onClick: () => {
|
||||||
|
void import('@/router').then((mod) => {
|
||||||
|
mod.default.push({ name: 'appNotifications' }).catch(() => undefined)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function presentNotification(payload: {
|
||||||
|
id?: number
|
||||||
|
title?: string
|
||||||
|
body?: string
|
||||||
|
}) {
|
||||||
|
const id = Number(payload.id ?? 0)
|
||||||
|
if (id > 0 && id === lastShownNotifId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (id > 0) {
|
||||||
|
lastShownNotifId = id
|
||||||
|
}
|
||||||
|
|
||||||
|
const title = String(payload.title ?? '').trim() || 'اعلان جدید'
|
||||||
|
const body = String(payload.body ?? '').trim()
|
||||||
|
|
||||||
|
showInAppToast(title, body)
|
||||||
|
await showBrowserNotification({
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
tag: id > 0 ? `app-notification-${id}` : undefined,
|
||||||
|
url: '/appNotifications',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/** از SSE رویداد app_notification — بدون polling HTTP */
|
||||||
|
function bumpUnreadFromStream(payload: Record<string, unknown>) {
|
||||||
|
if (!notificationsEnabled()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = Number(payload.id ?? 0)
|
||||||
|
if (id > 0 && id === lastStreamNotifId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (id > 0) {
|
||||||
|
lastStreamNotifId = id
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload.unread_count !== undefined && payload.unread_count !== null) {
|
||||||
|
applyUnreadCountFromStream(payload)
|
||||||
|
} else {
|
||||||
|
unreadCount.value = Math.max(0, unreadCount.value) + 1
|
||||||
|
hydratedUnread = true
|
||||||
|
clearHydrateFallback()
|
||||||
|
}
|
||||||
|
|
||||||
|
void presentNotification({
|
||||||
|
id,
|
||||||
|
title: String(payload.title ?? ''),
|
||||||
|
body: String(payload.body ?? ''),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* بدون interval: اگر استریم قیمت روشن است منتظر رویداد SSE میمانیم؛
|
||||||
|
* فقط وقتی wss خاموش است یا SSE تا ۱۲ثانیه نیامد، یکبار HTTP میزنیم.
|
||||||
|
*/
|
||||||
|
function scheduleHydrate() {
|
||||||
|
if (!notificationsEnabled()) {
|
||||||
|
unreadCount.value = 0
|
||||||
|
hydratedUnread = false
|
||||||
|
clearHydrateFallback()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!priceWssEnabled.value) {
|
||||||
|
void refreshUnreadCount()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priceSocketConnected.value || hydratedUnread) {
|
||||||
|
clearHydrateFallback()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
clearHydrateFallback()
|
||||||
|
hydrateFallbackTimer = setTimeout(() => {
|
||||||
|
hydrateFallbackTimer = null
|
||||||
|
if (!hydratedUnread && notificationsEnabled() && !priceSocketConnected.value) {
|
||||||
|
void refreshUnreadCount()
|
||||||
|
}
|
||||||
|
}, 12000)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAppNotificationBadge() {
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
const enabled = computed(() => settingsStore.isSettingTruthy('has_page_notification'))
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
started = true
|
||||||
|
scheduleHydrate()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
// module-level badge — keep state for other headers
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(enabled, (on) => {
|
||||||
|
if (!on) {
|
||||||
|
unreadCount.value = 0
|
||||||
|
hydratedUnread = false
|
||||||
|
clearHydrateFallback()
|
||||||
|
} else {
|
||||||
|
scheduleHydrate()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch([priceSocketConnected, priceWssEnabled], () => {
|
||||||
|
if (!started) return
|
||||||
|
scheduleHydrate()
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
enabled,
|
||||||
|
unreadCount,
|
||||||
|
refreshUnreadCount,
|
||||||
|
clearUnreadLocally,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
refreshUnreadCount,
|
||||||
|
clearUnreadLocally,
|
||||||
|
bumpUnreadFromStream,
|
||||||
|
applyUnreadCountFromStream,
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import router from '@/router'
|
||||||
|
import { getColleagueOrderStatus, getPendingColleagueOrder } from '@/api/order'
|
||||||
|
import { useUserStore } from '@/store/userStore'
|
||||||
|
import { useWalletStore } from '@/store/walletStore'
|
||||||
|
import { useFundUserStore } from '@/store/fundStore'
|
||||||
|
import { getToken } from '@/utils'
|
||||||
|
|
||||||
|
export const colleagueOrderWaiting = ref(false)
|
||||||
|
|
||||||
|
const CLIENT_POLL_MS = 10000
|
||||||
|
const MAX_WAIT_MS = 15 * 60 * 1000
|
||||||
|
const STREAM_EVENT = 'colleague-order'
|
||||||
|
|
||||||
|
type WaitResult = 'success' | 'failed' | 'none'
|
||||||
|
|
||||||
|
let inflight: Promise<WaitResult> | null = null
|
||||||
|
|
||||||
|
export function emitColleagueOrderFromStream(payload: unknown) {
|
||||||
|
window.dispatchEvent(new CustomEvent(STREAM_EVENT, { detail: payload }))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isColleagueOrderPending(res: unknown): boolean {
|
||||||
|
if (!res || typeof res !== 'object') return false
|
||||||
|
const row = res as Record<string, any>
|
||||||
|
if (row.pending === true) return true
|
||||||
|
if (Array.isArray(row) && row[0]?.pending === true) return true
|
||||||
|
const sts = Number(
|
||||||
|
row[0]?.sts ?? row.sts ?? row[1]?.order?.sts ?? row.order?.sts ?? NaN
|
||||||
|
)
|
||||||
|
return sts === 4
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colleagueOrderIdFromResponse(res: unknown): number | null {
|
||||||
|
if (!res || typeof res !== 'object') return null
|
||||||
|
const row = res as Record<string, any>
|
||||||
|
const id = Number(
|
||||||
|
row[0]?.order_id ?? row.order_id ?? row[1]?.order?.id ?? row.order?.id ?? NaN
|
||||||
|
)
|
||||||
|
return id > 0 ? id : null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function finishSuccess() {
|
||||||
|
try {
|
||||||
|
await useUserStore().getMyInfo()
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await useWalletStore().getMyWallet()
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await useFundUserStore().getMyFund()
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
message.success('سفارش شما با موفقیت انجام شد')
|
||||||
|
if (router.currentRoute.value.name !== 'transactions') {
|
||||||
|
await router.push({ name: 'transactions' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stsFromPayload(payload: Record<string, any> | null | undefined): number | null {
|
||||||
|
if (!payload) return null
|
||||||
|
const sts = Number(payload.sts ?? payload.order?.sts)
|
||||||
|
return Number.isFinite(sts) ? sts : null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** نتیجه قطعی از پاسخ status/pending — null یعنی هنوز باید صبر کرد */
|
||||||
|
function settleFromPayload(payload: Record<string, any> | null | undefined): WaitResult | null {
|
||||||
|
if (!payload || typeof payload !== 'object') return null
|
||||||
|
|
||||||
|
const pending = payload.pending
|
||||||
|
const sts = stsFromPayload(payload)
|
||||||
|
|
||||||
|
if (sts === 2) return 'success'
|
||||||
|
if (sts === 3) return 'failed'
|
||||||
|
if (sts !== null && sts !== 4) return 'failed'
|
||||||
|
if (pending === false) {
|
||||||
|
if (sts === 2) return 'success'
|
||||||
|
return 'failed'
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readSettle(orderId: number | null): Promise<WaitResult | null> {
|
||||||
|
try {
|
||||||
|
if (orderId && orderId > 0) {
|
||||||
|
const row = (await getColleagueOrderStatus(orderId)) as Record<string, any>
|
||||||
|
return settleFromPayload(row)
|
||||||
|
}
|
||||||
|
const row = (await getPendingColleagueOrder()) as Record<string, any>
|
||||||
|
return settleFromPayload(row)
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function waitForColleagueOrder(orderId?: number | null): Promise<WaitResult> {
|
||||||
|
if (inflight) return inflight
|
||||||
|
|
||||||
|
inflight = (async () => {
|
||||||
|
colleagueOrderWaiting.value = true
|
||||||
|
let settled: WaitResult | null = null
|
||||||
|
const startedAt = Date.now()
|
||||||
|
|
||||||
|
const finish = (result: WaitResult) => {
|
||||||
|
if (settled) return
|
||||||
|
settled = result
|
||||||
|
}
|
||||||
|
|
||||||
|
const onStream = (event: Event) => {
|
||||||
|
const detail = (event as CustomEvent).detail as Record<string, any> | undefined
|
||||||
|
if (orderId && Number(detail?.order_id) > 0 && Number(detail.order_id) !== orderId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const result = settleFromPayload(detail ?? null)
|
||||||
|
if (result) finish(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener(STREAM_EVENT, onStream)
|
||||||
|
|
||||||
|
try {
|
||||||
|
while (!settled) {
|
||||||
|
if (Date.now() - startedAt > MAX_WAIT_MS) {
|
||||||
|
finish('failed')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const result = await readSettle(orderId ?? null)
|
||||||
|
if (result) {
|
||||||
|
finish(result)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
await new Promise<void>((resolve) => {
|
||||||
|
const timer = window.setTimeout(resolve, CLIENT_POLL_MS)
|
||||||
|
const once = () => {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
window.addEventListener(STREAM_EVENT, once, { once: true })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
window.removeEventListener(STREAM_EVENT, onStream)
|
||||||
|
colleagueOrderWaiting.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settled === 'success') {
|
||||||
|
await finishSuccess()
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
|
||||||
|
message.error('سفارش توسط همکار رد شد')
|
||||||
|
return 'failed'
|
||||||
|
})().finally(() => {
|
||||||
|
inflight = null
|
||||||
|
})
|
||||||
|
|
||||||
|
return inflight
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function afterCreateOrder(res: unknown): Promise<WaitResult> {
|
||||||
|
if (isColleagueOrderPending(res)) {
|
||||||
|
return waitForColleagueOrder(colleagueOrderIdFromResponse(res))
|
||||||
|
}
|
||||||
|
await finishSuccess()
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function resumeColleagueOrderIfPending(): Promise<WaitResult> {
|
||||||
|
if (!getToken()) return 'none'
|
||||||
|
try {
|
||||||
|
const row = (await getPendingColleagueOrder()) as Record<string, any>
|
||||||
|
if (!row?.pending) return 'none'
|
||||||
|
const id = Number(row.order_id ?? row.order?.id ?? 0)
|
||||||
|
return waitForColleagueOrder(id > 0 ? id : null)
|
||||||
|
} catch {
|
||||||
|
return 'none'
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
/** باز/بسته بودن مدال محاسبهگر طلا — مشترک بین منوی کاربر و همبرگر */
|
||||||
|
export const goldDayCalculatorVisible = ref(false)
|
||||||
|
|
||||||
|
export function openGoldDayCalculator() {
|
||||||
|
goldDayCalculatorVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
export function closeGoldDayCalculator() {
|
||||||
|
goldDayCalculatorVisible.value = false
|
||||||
|
}
|
||||||
@@ -1,47 +1,75 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { getProducts } from '@/api/products'
|
import { getProducts } from '@/api/products'
|
||||||
import type { Product } from '@/models/products'
|
import type { Product } from '@/models/products'
|
||||||
import { getLastStreamProductsList } from '@/utils/productStreamBridge'
|
import { priceStreamList } from '@/utils/priceSocketState'
|
||||||
|
|
||||||
/** کش مشترک لیست محصولات — dedupe درخواستهای polling */
|
/** کش مشترک لیست محصولات — dedupe درخواستهای polling */
|
||||||
const catalogProducts = ref<Product[]>([])
|
const catalogProducts = ref<Product[]>([])
|
||||||
let catalogPromise: Promise<Product[]> | null = null
|
let catalogPromise: Promise<Product[]> | null = null
|
||||||
|
|
||||||
export function getProductsCatalogRef() {
|
export function getProductsCatalogRef() {
|
||||||
|
if (catalogProducts.value.length === 0 && Array.isArray(priceStreamList.value) && priceStreamList.value.length > 0) {
|
||||||
|
catalogProducts.value = priceStreamList.value as unknown as Product[]
|
||||||
|
}
|
||||||
return catalogProducts
|
return catalogProducts
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findProductInCatalog(id: number): Product | undefined {
|
export function syncCatalogFromStream(streamProducts: Product[]) {
|
||||||
const cached = catalogProducts.value.find((p) => p.id === id)
|
if (!Array.isArray(streamProducts) || streamProducts.length === 0) return
|
||||||
if (cached) {
|
if (catalogProducts.value.length === 0) {
|
||||||
return cached
|
catalogProducts.value = streamProducts
|
||||||
|
} else {
|
||||||
|
const map = new Map(streamProducts.map((p) => [p.id, p]))
|
||||||
|
catalogProducts.value.forEach((p) => {
|
||||||
|
const incoming = map.get(p.id)
|
||||||
|
if (incoming) {
|
||||||
|
if (incoming.price !== undefined) p.price = incoming.price
|
||||||
|
if (incoming.price_buy !== undefined) p.price_buy = incoming.price_buy
|
||||||
|
if (incoming.price_sell !== undefined) p.price_sell = incoming.price_sell
|
||||||
|
if (incoming.trade_open !== undefined) p.trade_open = incoming.trade_open
|
||||||
|
if (incoming.show !== undefined) p.show = incoming.show
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getLastStreamProductsList()?.find((p) => p.id === id)
|
export function findProductInCatalog(id: number): Product | undefined {
|
||||||
|
return catalogProducts.value.find((p) => p.id === id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProductsCatalog(force = false): Promise<Product[]> {
|
export function getProductsCatalog(force = false): Promise<Product[]> {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
const streamed = getLastStreamProductsList()
|
|
||||||
if (streamed?.length) {
|
|
||||||
catalogProducts.value = streamed
|
|
||||||
return Promise.resolve(streamed)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (catalogProducts.value.length > 0) {
|
if (catalogProducts.value.length > 0) {
|
||||||
return Promise.resolve(catalogProducts.value)
|
return Promise.resolve(catalogProducts.value)
|
||||||
}
|
}
|
||||||
|
if (Array.isArray(priceStreamList.value) && priceStreamList.value.length > 0) {
|
||||||
|
catalogProducts.value = priceStreamList.value as unknown as Product[]
|
||||||
|
return Promise.resolve(catalogProducts.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force && catalogPromise) {
|
if (!force && catalogPromise) {
|
||||||
return catalogPromise
|
return catalogPromise
|
||||||
}
|
}
|
||||||
|
|
||||||
catalogPromise = getProducts()
|
catalogPromise = getProducts(force)
|
||||||
.then((products) => {
|
.then((products) => {
|
||||||
catalogProducts.value = products ?? []
|
const list = Array.isArray(products) ? products : []
|
||||||
|
if (list.length > 0) {
|
||||||
|
catalogProducts.value = list
|
||||||
|
}
|
||||||
return catalogProducts.value
|
return catalogProducts.value
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
if (catalogProducts.value.length > 0) {
|
||||||
|
return catalogProducts.value
|
||||||
|
}
|
||||||
|
if (Array.isArray(priceStreamList.value) && priceStreamList.value.length > 0) {
|
||||||
|
catalogProducts.value = priceStreamList.value as unknown as Product[]
|
||||||
|
return catalogProducts.value
|
||||||
|
}
|
||||||
|
throw err
|
||||||
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
catalogPromise = null
|
catalogPromise = null
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
import type { PwaPlatform } from '@/modules/pwa/pwaInstallGuideSteps'
|
||||||
|
import {
|
||||||
|
getDefaultPwaPlatform,
|
||||||
|
initPwaInstallPromptListener,
|
||||||
|
isPwaInstallBannerDismissed,
|
||||||
|
markPwaInstallBannerAsShown,
|
||||||
|
shouldOfferPwaInstall,
|
||||||
|
shouldShowPwaInstallPrompt,
|
||||||
|
triggerNativePwaInstall,
|
||||||
|
} from '@/modules/pwa/pwaInstall'
|
||||||
|
|
||||||
|
const guideOpen = ref(false)
|
||||||
|
const bannerVisible = ref(false)
|
||||||
|
const platform = ref<PwaPlatform>(getDefaultPwaPlatform())
|
||||||
|
const installBannerConsumed = ref(isPwaInstallBannerDismissed())
|
||||||
|
/** false وقتی اپ بهصورت PWA/TWA باز شده یا همین الان نصب شده */
|
||||||
|
const offerInstall = ref(shouldOfferPwaInstall())
|
||||||
|
let listenerReady = false
|
||||||
|
let offerListenersBound = false
|
||||||
|
|
||||||
|
function refreshOfferInstall() {
|
||||||
|
offerInstall.value = shouldOfferPwaInstall()
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindOfferInstallListeners() {
|
||||||
|
if (offerListenersBound || typeof window === 'undefined') return
|
||||||
|
offerListenersBound = true
|
||||||
|
|
||||||
|
refreshOfferInstall()
|
||||||
|
|
||||||
|
const onInstalled = () => {
|
||||||
|
offerInstall.value = false
|
||||||
|
}
|
||||||
|
window.addEventListener('appinstalled', onInstalled)
|
||||||
|
|
||||||
|
const modes = ['standalone', 'fullscreen', 'minimal-ui', 'window-controls-overlay'] as const
|
||||||
|
const mediaLists = modes.map((mode) => window.matchMedia(`(display-mode: ${mode})`))
|
||||||
|
const onDisplayModeChange = () => refreshOfferInstall()
|
||||||
|
for (const mql of mediaLists) {
|
||||||
|
mql.addEventListener('change', onDisplayModeChange)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureListener() {
|
||||||
|
if (listenerReady) return
|
||||||
|
listenerReady = true
|
||||||
|
initPwaInstallPromptListener()
|
||||||
|
bindOfferInstallListeners()
|
||||||
|
}
|
||||||
|
|
||||||
|
export function usePwaInstall() {
|
||||||
|
ensureListener()
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
refreshOfferInstall()
|
||||||
|
})
|
||||||
|
|
||||||
|
const canPrompt = computed(() => {
|
||||||
|
if (installBannerConsumed.value) return false
|
||||||
|
return shouldShowPwaInstallPrompt()
|
||||||
|
})
|
||||||
|
|
||||||
|
const showInstallEntry = computed(() => offerInstall.value)
|
||||||
|
|
||||||
|
function consumeInstallBanner() {
|
||||||
|
if (installBannerConsumed.value) return
|
||||||
|
markPwaInstallBannerAsShown()
|
||||||
|
installBannerConsumed.value = true
|
||||||
|
bannerVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function openGuide(nextPlatform?: PwaPlatform) {
|
||||||
|
if (!offerInstall.value) return
|
||||||
|
consumeInstallBanner()
|
||||||
|
platform.value = nextPlatform ?? getDefaultPwaPlatform()
|
||||||
|
guideOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeGuide() {
|
||||||
|
guideOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function showBanner() {
|
||||||
|
if (!canPrompt.value) return
|
||||||
|
bannerVisible.value = true
|
||||||
|
markPwaInstallBannerAsShown()
|
||||||
|
installBannerConsumed.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideBanner() {
|
||||||
|
bannerVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function dismissBanner() {
|
||||||
|
consumeInstallBanner()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function completeGuide() {
|
||||||
|
await triggerNativePwaInstall()
|
||||||
|
consumeInstallBanner()
|
||||||
|
closeGuide()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** نصب مستقیم مرورگر؛ اگر ممکن نبود مدال آموزش. */
|
||||||
|
async function tryInstallOrOpenGuide(nextPlatform?: PwaPlatform) {
|
||||||
|
if (!offerInstall.value) return false
|
||||||
|
const installed = await triggerNativePwaInstall()
|
||||||
|
if (installed) {
|
||||||
|
offerInstall.value = false
|
||||||
|
consumeInstallBanner()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
openGuide(nextPlatform)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
guideOpen,
|
||||||
|
bannerVisible,
|
||||||
|
platform,
|
||||||
|
canPrompt,
|
||||||
|
showInstallEntry,
|
||||||
|
openGuide,
|
||||||
|
closeGuide,
|
||||||
|
showBanner,
|
||||||
|
hideBanner,
|
||||||
|
dismissBanner,
|
||||||
|
completeGuide,
|
||||||
|
tryInstallOrOpenGuide,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
import {
|
||||||
|
buildDepositSmsUrl,
|
||||||
|
buildSupportPhoneUrl,
|
||||||
|
loadSupportMessengerFromSettings,
|
||||||
|
messengerNeedsClipboardCopy,
|
||||||
|
openSupportMessengerEntry,
|
||||||
|
resolveDepositGuideText,
|
||||||
|
resolveDepositSupportMessage,
|
||||||
|
resolveSupportMessengerEntries,
|
||||||
|
resolveSupportMessengerLink,
|
||||||
|
resolveSupportMessengerMeta,
|
||||||
|
supportMessengerPickerAnchor,
|
||||||
|
supportMessengerPickerOpen,
|
||||||
|
supportMessengerSettings,
|
||||||
|
type ResolvedSupportMessengerEntry,
|
||||||
|
} from '@/utils/supportMessenger'
|
||||||
|
import {
|
||||||
|
copyDepositFieldValue,
|
||||||
|
displayDepositCardNumber,
|
||||||
|
displayDepositSheba,
|
||||||
|
getDepositGuideVarsFromSettings,
|
||||||
|
getDepositSettingLabel,
|
||||||
|
hasDepositFieldValue,
|
||||||
|
} from '@/utils/depositGuideText'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
|
import { isUserSupportChatEnabled } from '@/utils/chat'
|
||||||
|
|
||||||
|
/** plain: منوی شناور / درباره ما — بدون پیشمتن | deposit: مودال واریز — با deposit_support_message_text */
|
||||||
|
type SupportPickerIntent = 'plain' | 'deposit'
|
||||||
|
|
||||||
|
const CHAT_PICKER_ENTRY: ResolvedSupportMessengerEntry = {
|
||||||
|
messenger: 'chat',
|
||||||
|
id: 'support-chat',
|
||||||
|
label: 'چت پشتیبانی',
|
||||||
|
icon: 'vuesax-linear:messages-2',
|
||||||
|
accent: '#16a34a',
|
||||||
|
url: '',
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useSupportMessenger() {
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
const supportPickerOpen = supportMessengerPickerOpen
|
||||||
|
const supportPickerIntent = ref<SupportPickerIntent>('plain')
|
||||||
|
|
||||||
|
/** چت فقط بعد از لاگین — روی صفحه ورود در picker نیاید */
|
||||||
|
const isChatEnabled = computed(() => {
|
||||||
|
void route.name
|
||||||
|
return isUserSupportChatEnabled()
|
||||||
|
})
|
||||||
|
|
||||||
|
const legacySupportLink = computed(() => '')
|
||||||
|
|
||||||
|
const depositSupportMessage = computed(() => resolveDepositSupportMessage())
|
||||||
|
|
||||||
|
const supportMessengerEntries = computed(() =>
|
||||||
|
resolveSupportMessengerEntries(supportMessengerSettings.value),
|
||||||
|
)
|
||||||
|
|
||||||
|
const pickerEntries = computed(() => {
|
||||||
|
const list = [...supportMessengerEntries.value]
|
||||||
|
if (isChatEnabled.value) {
|
||||||
|
list.unshift(CHAT_PICKER_ENTRY)
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
})
|
||||||
|
|
||||||
|
const primaryMessengerEntry = computed(() => supportMessengerEntries.value[0] ?? null)
|
||||||
|
|
||||||
|
const messengerType = computed(
|
||||||
|
() => (primaryMessengerEntry.value?.messenger ?? supportMessengerSettings.value.messenger ?? '').trim().toLowerCase(),
|
||||||
|
)
|
||||||
|
|
||||||
|
const messengerMeta = computed(() => {
|
||||||
|
if (isChatEnabled.value && supportMessengerEntries.value.length === 0) {
|
||||||
|
return {
|
||||||
|
label: CHAT_PICKER_ENTRY.label,
|
||||||
|
icon: CHAT_PICKER_ENTRY.icon,
|
||||||
|
accent: CHAT_PICKER_ENTRY.accent,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return primaryMessengerEntry.value
|
||||||
|
? {
|
||||||
|
label: primaryMessengerEntry.value.label,
|
||||||
|
icon: primaryMessengerEntry.value.icon,
|
||||||
|
accent: primaryMessengerEntry.value.accent,
|
||||||
|
}
|
||||||
|
: resolveSupportMessengerMeta(messengerType.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
const messengerLink = computed(() =>
|
||||||
|
primaryMessengerEntry.value?.url
|
||||||
|
|| resolveSupportMessengerLink(
|
||||||
|
supportMessengerSettings.value.messenger,
|
||||||
|
supportMessengerSettings.value.messengerId,
|
||||||
|
legacySupportLink.value,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
function goToSupportChat() {
|
||||||
|
void router.push({ name: 'support' })
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openMessengerEntry(entry: ResolvedSupportMessengerEntry, text?: string) {
|
||||||
|
if (entry.messenger === 'chat') {
|
||||||
|
return goToSupportChat()
|
||||||
|
}
|
||||||
|
|
||||||
|
const messageText =
|
||||||
|
text !== undefined
|
||||||
|
? text.trim()
|
||||||
|
: supportPickerIntent.value === 'deposit'
|
||||||
|
? depositSupportMessage.value.trim()
|
||||||
|
: ''
|
||||||
|
const opened = await openSupportMessengerEntry(entry, messageText, legacySupportLink.value)
|
||||||
|
if (!opened) return false
|
||||||
|
|
||||||
|
if (messageText && messengerNeedsClipboardCopy(entry.messenger)) {
|
||||||
|
message.success('متن پیام کپی شد — در پیامرسان paste کنید')
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
let supportPickerOpenedAt = 0
|
||||||
|
|
||||||
|
async function openSupportPicker(
|
||||||
|
intent: SupportPickerIntent,
|
||||||
|
anchorEl?: HTMLElement | null,
|
||||||
|
) {
|
||||||
|
supportPickerIntent.value = intent
|
||||||
|
if (anchorEl !== undefined) {
|
||||||
|
supportMessengerPickerAnchor.value = anchorEl
|
||||||
|
}
|
||||||
|
|
||||||
|
const draft =
|
||||||
|
intent === 'deposit' ? depositSupportMessage.value.trim() : ''
|
||||||
|
const messengerEntries = supportMessengerEntries.value
|
||||||
|
const entries = pickerEntries.value
|
||||||
|
|
||||||
|
// لیست خالی + چت خاموش → هیچکار
|
||||||
|
if (entries.length === 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// فقط چت (لیست پیامرسان خالی) → مستقیم چت
|
||||||
|
if (isChatEnabled.value && messengerEntries.length === 0) {
|
||||||
|
return goToSupportChat()
|
||||||
|
}
|
||||||
|
|
||||||
|
// فقط یک گزینه (چت یا یک پیامرسان) → مستقیم همان
|
||||||
|
if (entries.length === 1) {
|
||||||
|
return openMessengerEntry(entries[0], draft)
|
||||||
|
}
|
||||||
|
|
||||||
|
// چند گزینه (چت + لینکها یا چند پیامرسان) → منوی انتخاب
|
||||||
|
const now = Date.now()
|
||||||
|
if (supportPickerOpen.value) {
|
||||||
|
if (now - supportPickerOpenedAt < 450) return true
|
||||||
|
supportPickerOpen.value = false
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
supportPickerOpen.value = true
|
||||||
|
supportPickerOpenedAt = now
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openSupportMessenger(anchorEl?: HTMLElement | null) {
|
||||||
|
return openSupportPicker('plain', anchorEl)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openDepositSupportMessenger(anchorEl?: HTMLElement | null) {
|
||||||
|
return openSupportPicker('deposit', anchorEl)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSupportMessengerClick(event?: Event) {
|
||||||
|
const target = event?.currentTarget
|
||||||
|
const anchor = target instanceof HTMLElement ? target : null
|
||||||
|
void openSupportMessenger(anchor)
|
||||||
|
}
|
||||||
|
|
||||||
|
const depositSmsLink = computed(() =>
|
||||||
|
buildDepositSmsUrl(
|
||||||
|
supportMessengerSettings.value.depositSmsSupportNumber,
|
||||||
|
depositSupportMessage.value,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
const supportPhoneLink = computed(() => {
|
||||||
|
const fromSettings = buildSupportPhoneUrl(
|
||||||
|
supportMessengerSettings.value.depositSmsSupportNumber,
|
||||||
|
)
|
||||||
|
if (fromSettings) return fromSettings
|
||||||
|
|
||||||
|
const legacy = legacySupportLink.value
|
||||||
|
if (legacy.startsWith('tel:') && legacy.length > 4) return legacy
|
||||||
|
|
||||||
|
return ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const supportMessengerText = computed(() => resolveDepositGuideText())
|
||||||
|
|
||||||
|
const depositCardNumberRaw = computed(() => {
|
||||||
|
void settingsStore.settings
|
||||||
|
const fromMessenger = supportMessengerSettings.value.depositCardNumber?.trim()
|
||||||
|
if (fromMessenger) return fromMessenger
|
||||||
|
return String(getDepositGuideVarsFromSettings().cardNumber ?? '').trim()
|
||||||
|
})
|
||||||
|
|
||||||
|
const depositShebaRaw = computed(() => {
|
||||||
|
void settingsStore.settings
|
||||||
|
const fromMessenger = supportMessengerSettings.value.depositSheba?.trim()
|
||||||
|
if (fromMessenger) return fromMessenger
|
||||||
|
return String(getDepositGuideVarsFromSettings().sheba ?? '').trim()
|
||||||
|
})
|
||||||
|
|
||||||
|
const depositCardNumber = computed(() => displayDepositCardNumber(depositCardNumberRaw.value))
|
||||||
|
const depositSheba = computed(() => displayDepositSheba(depositShebaRaw.value))
|
||||||
|
|
||||||
|
const depositCardLabel = computed(() => {
|
||||||
|
void settingsStore.settings
|
||||||
|
return getDepositSettingLabel('deposit_card_number', 'شماره کارت واریز')
|
||||||
|
})
|
||||||
|
|
||||||
|
const depositShebaLabel = computed(() => {
|
||||||
|
void settingsStore.settings
|
||||||
|
return getDepositSettingLabel('deposit_sheba', 'شبا واریز')
|
||||||
|
})
|
||||||
|
|
||||||
|
const hasDepositCardValue = computed(() => hasDepositFieldValue(depositCardNumberRaw.value))
|
||||||
|
const hasDepositShebaValue = computed(() => hasDepositFieldValue(depositShebaRaw.value))
|
||||||
|
|
||||||
|
async function copyDepositCardNumber() {
|
||||||
|
await copyDepositFieldValue(
|
||||||
|
depositCardNumberRaw.value,
|
||||||
|
'card',
|
||||||
|
'شماره کارت ثبت نشده است',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyDepositShebaNumber() {
|
||||||
|
await copyDepositFieldValue(
|
||||||
|
depositShebaRaw.value,
|
||||||
|
'sheba',
|
||||||
|
'شماره شبا ثبت نشده است',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasMessengerLink = computed(
|
||||||
|
() => isChatEnabled.value || supportMessengerEntries.value.length > 0,
|
||||||
|
)
|
||||||
|
const hasMultipleMessengers = computed(() => pickerEntries.value.length > 1)
|
||||||
|
const hasSupportPhoneLink = computed(() => !!supportPhoneLink.value)
|
||||||
|
const hasSupportActions = computed(() => hasSupportPhoneLink.value || hasMessengerLink.value)
|
||||||
|
const opensInNewTab = computed(() => /^https?:\/\//i.test(messengerLink.value))
|
||||||
|
|
||||||
|
return {
|
||||||
|
supportPickerOpen,
|
||||||
|
supportPickerAnchor: supportMessengerPickerAnchor,
|
||||||
|
supportMessengerEntries: pickerEntries,
|
||||||
|
isChatEnabled,
|
||||||
|
messengerType,
|
||||||
|
messengerMeta,
|
||||||
|
messengerLink,
|
||||||
|
supportPhoneLink,
|
||||||
|
depositSmsLink,
|
||||||
|
supportMessengerText,
|
||||||
|
depositSupportMessage,
|
||||||
|
depositCardNumber,
|
||||||
|
depositSheba,
|
||||||
|
depositCardNumberRaw,
|
||||||
|
depositShebaRaw,
|
||||||
|
depositCardLabel,
|
||||||
|
depositShebaLabel,
|
||||||
|
hasDepositCardValue,
|
||||||
|
hasDepositShebaValue,
|
||||||
|
copyDepositCardNumber,
|
||||||
|
copyDepositShebaNumber,
|
||||||
|
openSupportMessenger,
|
||||||
|
openDepositSupportMessenger,
|
||||||
|
openMessengerEntry,
|
||||||
|
handleSupportMessengerClick,
|
||||||
|
goToSupportChat,
|
||||||
|
hasMessengerLink,
|
||||||
|
hasMultipleMessengers,
|
||||||
|
hasSupportPhoneLink,
|
||||||
|
hasSupportActions,
|
||||||
|
opensInNewTab,
|
||||||
|
loadSupportMessengerFromSettings,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { fetchTrackingSettings, isTrackingSystemsEnabled } from '@/utils/trackingSystemsSettings'
|
||||||
|
|
||||||
|
export function useTrackingSystemsFeature() {
|
||||||
|
const trackingSystemsEnabled = ref(false)
|
||||||
|
const trackingSystemsReady = ref(false)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
const settings = await fetchTrackingSettings()
|
||||||
|
trackingSystemsEnabled.value = isTrackingSystemsEnabled(settings)
|
||||||
|
} finally {
|
||||||
|
trackingSystemsReady.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
trackingSystemsEnabled,
|
||||||
|
trackingSystemsReady,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { AppConfig } from './types'
|
import type { AppConfig } from './types'
|
||||||
|
import { rewriteLegacyUploadUrl } from './rewrite-legacy-upload-url'
|
||||||
|
|
||||||
type RawAppConfig = AppConfig & {
|
type RawAppConfig = AppConfig & {
|
||||||
user?: Record<string, any>
|
user?: Record<string, any>
|
||||||
@@ -32,6 +33,10 @@ function normalizeUserConfig(user?: Record<string, any>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof normalized.avatar === 'string') {
|
||||||
|
normalized.avatar = rewriteLegacyUploadUrl(normalized.avatar)
|
||||||
|
}
|
||||||
|
|
||||||
return normalized
|
return normalized
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,14 +45,17 @@ export function normalizeAppConfig(config: RawAppConfig): RawAppConfig {
|
|||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.user || typeof config.user !== 'object') {
|
const next: RawAppConfig = { ...config }
|
||||||
return config
|
|
||||||
|
if (typeof next.avatar === 'string') {
|
||||||
|
next.avatar = rewriteLegacyUploadUrl(next.avatar)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
if (next.user && typeof next.user === 'object') {
|
||||||
...config,
|
next.user = normalizeUserConfig(next.user)
|
||||||
user: normalizeUserConfig(config.user),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return next
|
||||||
}
|
}
|
||||||
|
|
||||||
let appConfig: RawAppConfig | null = null
|
let appConfig: RawAppConfig | null = null
|
||||||
@@ -55,6 +63,13 @@ let appConfig: RawAppConfig | null = null
|
|||||||
export function setAppConfig(config: RawAppConfig) {
|
export function setAppConfig(config: RawAppConfig) {
|
||||||
appConfig = normalizeAppConfig(config || {})
|
appConfig = normalizeAppConfig(config || {})
|
||||||
window.__APP_CONFIG__ = appConfig
|
window.__APP_CONFIG__ = appConfig
|
||||||
|
try {
|
||||||
|
const apply = (window as Window & {__APPLY_BOOT_BRANDING__?: (c: unknown) => void})
|
||||||
|
.__APPLY_BOOT_BRANDING__
|
||||||
|
if (typeof apply === 'function') apply(appConfig)
|
||||||
|
} catch {
|
||||||
|
/* boot DOM ممکن است هنوز نباشد */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRawAppConfig() {
|
export function getRawAppConfig() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { getConfig } from '@/config/app-config'
|
import { getConfig } from '@/config/app-config'
|
||||||
|
import { rewriteLegacyUploadUrl } from '@/config/rewrite-legacy-upload-url'
|
||||||
import { isPwaManifestReady } from '@/modules/pwa/manifest'
|
import { isPwaManifestReady } from '@/modules/pwa/manifest'
|
||||||
|
|
||||||
export function applyAppConfig() {
|
export function applyAppConfig() {
|
||||||
@@ -14,7 +15,7 @@ function setTitle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLogoUrl() {
|
function getLogoUrl() {
|
||||||
return getConfig<string>('avatar') || '/favicon.png'
|
return rewriteLegacyUploadUrl(getConfig<string>('avatar') || '/favicon.png')
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFavicon() {
|
function setFavicon() {
|
||||||
@@ -76,8 +77,8 @@ function resolveRemoteLogo(path: string) {
|
|||||||
|
|
||||||
const lastSuccess = localStorage.getItem('CONFIG_Success_URL')
|
const lastSuccess = localStorage.getItem('CONFIG_Success_URL')
|
||||||
const base = lastSuccess
|
const base = lastSuccess
|
||||||
? lastSuccess.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
? lastSuccess.replace(/[?#].*$/, '').replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||||
: 'https://nerkh.gold'
|
: 'https://adm.montzar.ir'
|
||||||
|
|
||||||
return `${base}/${path.replace(/^\/+/, '')}`
|
return `${base}/${path.replace(/^\/+/, '')}`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { AppConfig } from '@/config/types'
|
import type { AppConfig } from '@/config/types'
|
||||||
|
import { rewriteLegacyUploadUrl } from '@/config/rewrite-legacy-upload-url'
|
||||||
import { resetVersionCheckCache } from '@/config/load-version'
|
import { resetVersionCheckCache } from '@/config/load-version'
|
||||||
import { clearCachedPwaManifest } from '@/modules/pwa/manifest-cache'
|
import { clearCachedPwaManifest } from '@/modules/pwa/manifest-cache'
|
||||||
import { tokenName } from '@/themeConfig'
|
import { tokenName } from '@/themeConfig'
|
||||||
@@ -62,8 +63,28 @@ export function readCachedAppConfig(): AppConfig | null {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function persistBootLogo(config: AppConfig) {
|
||||||
|
try {
|
||||||
|
const nested = (config as {user?: Record<string, unknown>})?.user
|
||||||
|
const avatar = rewriteLegacyUploadUrl(String(nested?.avatar || '').trim())
|
||||||
|
const version = String(localStorage.getItem(VERSION_STORAGE_KEY) || '').trim()
|
||||||
|
const cachedUrl = localStorage.getItem('BOOT_LOGO_URL') || ''
|
||||||
|
const cachedVer = localStorage.getItem('BOOT_LOGO_VERSION') || ''
|
||||||
|
const cacheFresh = !!(cachedUrl && version && cachedVer && version === cachedVer)
|
||||||
|
if (avatar && (!cacheFresh || cachedUrl !== avatar)) localStorage.setItem('BOOT_LOGO_URL', avatar)
|
||||||
|
if (version) localStorage.setItem('BOOT_LOGO_VERSION', version)
|
||||||
|
const apply = (window as Window & {__APPLY_BOOT_BRANDING__?: (c: unknown) => void})
|
||||||
|
.__APPLY_BOOT_BRANDING__
|
||||||
|
if (typeof apply === 'function') apply(config)
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function writeCachedAppConfig(config: AppConfig) {
|
export function writeCachedAppConfig(config: AppConfig) {
|
||||||
try {
|
try {
|
||||||
|
persistBootLogo(config)
|
||||||
|
|
||||||
const payload: CachedConfigPayload = {
|
const payload: CachedConfigPayload = {
|
||||||
cached_at: Date.now(),
|
cached_at: Date.now(),
|
||||||
config
|
config
|
||||||
@@ -206,12 +227,22 @@ export async function clearBrowserRuntimeCaches() {
|
|||||||
|
|
||||||
function clearLocalStorageExceptToken() {
|
function clearLocalStorageExceptToken() {
|
||||||
const token = localStorage.getItem(tokenName)
|
const token = localStorage.getItem(tokenName)
|
||||||
|
let bootLogo = ''
|
||||||
|
let bootLogoVer = ''
|
||||||
|
try {
|
||||||
|
bootLogo = localStorage.getItem('BOOT_LOGO_URL') || ''
|
||||||
|
bootLogoVer = localStorage.getItem('BOOT_LOGO_VERSION') || ''
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
localStorage.setItem(tokenName, token)
|
localStorage.setItem(tokenName, token)
|
||||||
}
|
}
|
||||||
|
if (bootLogo) localStorage.setItem('BOOT_LOGO_URL', bootLogo)
|
||||||
|
if (bootLogoVer) localStorage.setItem('BOOT_LOGO_VERSION', bootLogoVer)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearAppStorageExceptToken() {
|
export function clearAppStorageExceptToken() {
|
||||||
@@ -254,6 +285,11 @@ export async function refreshConfigCacheForVersion(
|
|||||||
|
|
||||||
writeCachedAppConfig(freshConfig)
|
writeCachedAppConfig(freshConfig)
|
||||||
finishVersionUpdateBeforeReload(normalizedVersion)
|
finishVersionUpdateBeforeReload(normalizedVersion)
|
||||||
|
try {
|
||||||
|
localStorage.setItem('BOOT_LOGO_VERSION', normalizedVersion)
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
|
||||||
return freshConfig
|
return freshConfig
|
||||||
}
|
}
|
||||||
@@ -275,6 +311,11 @@ export async function resetAppAndRefreshConfig(
|
|||||||
|
|
||||||
if (normalizedVersion) {
|
if (normalizedVersion) {
|
||||||
writeStoredAppVersion(normalizedVersion)
|
writeStoredAppVersion(normalizedVersion)
|
||||||
|
try {
|
||||||
|
localStorage.setItem('BOOT_LOGO_VERSION', normalizedVersion)
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return freshConfig
|
return freshConfig
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
import type { AppConfig } from '@/config/types'
|
import type { AppConfig } from '@/config/types'
|
||||||
import { normalizeAppConfig } from '@/config/app-config'
|
import { normalizeAppConfig } from '@/config/app-config'
|
||||||
import { readCachedAppConfig, writeCachedAppConfig } from '@/config/config-cache'
|
import { readCachedAppConfig, writeCachedAppConfig } from '@/config/config-cache'
|
||||||
|
import {
|
||||||
|
allowSuperAdminFallback,
|
||||||
|
getSuperAdminBase,
|
||||||
|
getSuperAdminBases,
|
||||||
|
isSuperAdminUrl,
|
||||||
|
resolveTenantDomain,
|
||||||
|
SA_RETRY_ROUNDS,
|
||||||
|
} from '@/config/superadmin'
|
||||||
|
|
||||||
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
|
const CONFIG_SUCCESS_URL_KEY = 'CONFIG_Success_URL'
|
||||||
export const CONFIG_RETRY_ROUNDS = 5
|
export const CONFIG_RETRY_ROUNDS = SA_RETRY_ROUNDS
|
||||||
|
|
||||||
function getProtocol() {
|
function getProtocol() {
|
||||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||||
@@ -11,24 +19,34 @@ function getProtocol() {
|
|||||||
|
|
||||||
export function getConfigUrls() {
|
export function getConfigUrls() {
|
||||||
const protocol = getProtocol()
|
const protocol = getProtocol()
|
||||||
|
const domain = encodeURIComponent(resolveTenantDomain())
|
||||||
|
const urls = getSuperAdminBases().map((base) => `${base}/get_user?domain=${domain}`)
|
||||||
|
|
||||||
return [
|
if (allowSuperAdminFallback()) {
|
||||||
`${protocol}//nerkh.gold/get_user`,
|
urls.push(
|
||||||
`${protocol}//tablo.talasevin.ir/get_user`,
|
`${protocol}//tablo.talasevin.ir/get_user`,
|
||||||
`${protocol}//abshode-service.montgit.ir/server/get_user`,
|
`${protocol}//abshode-service.montgit.ir/server/get_user`,
|
||||||
`${protocol}//212.23.201.173:8381/get_user`,
|
`${protocol}//212.23.201.173:8381/get_user`,
|
||||||
`${protocol}//91.212.174.137:4040/server/get_user`
|
`${protocol}//91.212.174.137:4040/server/get_user`,
|
||||||
]
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return urls
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortConfigUrls(urls: string[]) {
|
export function sortConfigUrls(urls: string[]) {
|
||||||
const lastSuccessUrl = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
const lastSuccessUrl = localStorage.getItem(CONFIG_SUCCESS_URL_KEY)
|
||||||
|
if (
|
||||||
return [...urls].sort((a, b) => {
|
!lastSuccessUrl ||
|
||||||
if (a === lastSuccessUrl) return -1
|
!urls.includes(lastSuccessUrl) ||
|
||||||
if (b === lastSuccessUrl) return 1
|
!isSuperAdminUrl(lastSuccessUrl)
|
||||||
return 0
|
) {
|
||||||
})
|
if (lastSuccessUrl && !isSuperAdminUrl(lastSuccessUrl)) {
|
||||||
|
localStorage.removeItem(CONFIG_SUCCESS_URL_KEY)
|
||||||
|
}
|
||||||
|
return [...urls]
|
||||||
|
}
|
||||||
|
return [lastSuccessUrl, ...urls.filter((url) => url !== lastSuccessUrl)]
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearStaleConfigSuccessUrl(url: string) {
|
function clearStaleConfigSuccessUrl(url: string) {
|
||||||
@@ -45,10 +63,10 @@ async function fetchConfig(url: string, timeout = 3000): Promise<AppConfig> {
|
|||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json'
|
Accept: 'application/json',
|
||||||
},
|
},
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
signal: controller.signal
|
signal: controller.signal,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@@ -78,7 +96,11 @@ export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise
|
|||||||
const timeout = index === urls.length - 1 ? 7000 : 4000
|
const timeout = index === urls.length - 1 ? 7000 : 4000
|
||||||
const config = await fetchConfig(url, timeout)
|
const config = await fetchConfig(url, timeout)
|
||||||
|
|
||||||
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
|
if (isSuperAdminUrl(url)) {
|
||||||
|
localStorage.setItem(CONFIG_SUCCESS_URL_KEY, url)
|
||||||
|
} else {
|
||||||
|
clearStaleConfigSuccessUrl(url)
|
||||||
|
}
|
||||||
writeCachedAppConfig(config)
|
writeCachedAppConfig(config)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
@@ -89,7 +111,11 @@ export async function fetchFreshAppConfig(rounds = CONFIG_RETRY_ROUNDS): Promise
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('Cannot load app config from any server')
|
throw new Error(
|
||||||
|
getSuperAdminBase()
|
||||||
|
? `Cannot load from SuperAdmin (${getSuperAdminBase()}).`
|
||||||
|
: 'Cannot load app config from any server',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadAppConfig(): Promise<AppConfig> {
|
export async function loadAppConfig(): Promise<AppConfig> {
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
import {
|
||||||
|
allowSuperAdminFallback,
|
||||||
|
getSuperAdminBases,
|
||||||
|
isSuperAdminUrl,
|
||||||
|
resolveTenantDomain,
|
||||||
|
SA_RETRY_ROUNDS,
|
||||||
|
} from '@/config/superadmin'
|
||||||
|
|
||||||
type VersionResponse =
|
type VersionResponse =
|
||||||
| string
|
| string
|
||||||
| number
|
| number
|
||||||
@@ -9,10 +17,9 @@ type VersionResponse =
|
|||||||
}
|
}
|
||||||
|
|
||||||
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
const VERSION_SUCCESS_URL_KEY = 'VERSION_Success_URL'
|
||||||
export const VERSION_RETRY_ROUNDS = 5
|
export const VERSION_RETRY_ROUNDS = SA_RETRY_ROUNDS
|
||||||
|
|
||||||
let versionFetchPromise: Promise<string | null> | null = null
|
let versionFetchPromise: Promise<string | null> | null = null
|
||||||
let cachedVersionResult: string | null | undefined
|
|
||||||
|
|
||||||
function getProtocol() {
|
function getProtocol() {
|
||||||
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
return window.location.protocol === 'https:' ? 'https:' : 'http:'
|
||||||
@@ -20,25 +27,34 @@ function getProtocol() {
|
|||||||
|
|
||||||
function getVersionUrls() {
|
function getVersionUrls() {
|
||||||
const protocol = getProtocol()
|
const protocol = getProtocol()
|
||||||
|
const domain = encodeURIComponent(resolveTenantDomain())
|
||||||
|
const urls = getSuperAdminBases().map((base) => `${base}/get_version?domain=${domain}`)
|
||||||
|
|
||||||
return [
|
if (allowSuperAdminFallback()) {
|
||||||
'https://nerkh.gold/get_version',
|
urls.push(
|
||||||
'https://tablo.talasevin.ir/get_version',
|
'https://tablo.talasevin.ir/get_version',
|
||||||
'https://abshode-service.montgit.ir/server/get_version',
|
'https://abshode-service.montgit.ir/server/get_version',
|
||||||
`${protocol}//212.23.201.173:8381/get_version`,
|
`${protocol}//212.23.201.173:8381/get_version`,
|
||||||
`${protocol}//91.212.174.137:4040/server/get_version`
|
`${protocol}//91.212.174.137:4040/server/get_version`,
|
||||||
]
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return urls
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortVersionUrls(urls: string[]) {
|
function sortVersionUrls(urls: string[]) {
|
||||||
const lastSuccessUrl = localStorage.getItem(VERSION_SUCCESS_URL_KEY)
|
const lastSuccessUrl = localStorage.getItem(VERSION_SUCCESS_URL_KEY)
|
||||||
|
if (
|
||||||
if (!lastSuccessUrl) {
|
!lastSuccessUrl ||
|
||||||
return urls
|
!urls.includes(lastSuccessUrl) ||
|
||||||
|
!isSuperAdminUrl(lastSuccessUrl)
|
||||||
|
) {
|
||||||
|
if (lastSuccessUrl && !isSuperAdminUrl(lastSuccessUrl)) {
|
||||||
|
localStorage.removeItem(VERSION_SUCCESS_URL_KEY)
|
||||||
|
}
|
||||||
|
return [...urls]
|
||||||
}
|
}
|
||||||
|
return [lastSuccessUrl, ...urls.filter((url) => url !== lastSuccessUrl)]
|
||||||
const others = urls.filter((url) => url !== lastSuccessUrl)
|
|
||||||
return [lastSuccessUrl, ...others]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearStaleVersionSuccessUrl(url: string) {
|
function clearStaleVersionSuccessUrl(url: string) {
|
||||||
@@ -89,10 +105,10 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
|
|||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json'
|
Accept: 'application/json',
|
||||||
},
|
},
|
||||||
cache: 'no-store',
|
cache: 'no-store',
|
||||||
signal: controller.signal
|
signal: controller.signal,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@@ -100,18 +116,22 @@ async function fetchVersion(url: string, timeout = 3500): Promise<string | null>
|
|||||||
}
|
}
|
||||||
|
|
||||||
const contentType = response.headers.get('content-type') ?? ''
|
const contentType = response.headers.get('content-type') ?? ''
|
||||||
|
if (!contentType.includes('application/json')) {
|
||||||
|
throw new Error('Version response is not JSON')
|
||||||
|
}
|
||||||
|
|
||||||
const data = contentType.includes('application/json')
|
const data = (await response.json()) as VersionResponse
|
||||||
? ((await response.json()) as VersionResponse)
|
|
||||||
: ((await response.text()) as VersionResponse)
|
|
||||||
|
|
||||||
const version = normalizeVersionResponse(data)
|
const version = normalizeVersionResponse(data)
|
||||||
|
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error('Version response is empty')
|
throw new Error('Version response is empty')
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
|
if (isSuperAdminUrl(url)) {
|
||||||
|
localStorage.setItem(VERSION_SUCCESS_URL_KEY, url)
|
||||||
|
} else {
|
||||||
|
clearStaleVersionSuccessUrl(url)
|
||||||
|
}
|
||||||
|
|
||||||
return version
|
return version
|
||||||
} finally {
|
} finally {
|
||||||
@@ -143,7 +163,6 @@ async function fetchVersionWithRetry(rounds = VERSION_RETRY_ROUNDS): Promise<str
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resetVersionCheckCache() {
|
export function resetVersionCheckCache() {
|
||||||
cachedVersionResult = undefined
|
|
||||||
versionFetchPromise = null
|
versionFetchPromise = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,22 +177,13 @@ export async function loadRemoteAppVersion(options?: {
|
|||||||
resetVersionCheckCache()
|
resetVersionCheckCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cachedVersionResult !== undefined) {
|
|
||||||
return cachedVersionResult
|
|
||||||
}
|
|
||||||
|
|
||||||
if (versionFetchPromise) {
|
if (versionFetchPromise) {
|
||||||
return versionFetchPromise
|
return versionFetchPromise
|
||||||
}
|
}
|
||||||
|
|
||||||
versionFetchPromise = fetchVersionWithRetry(rounds)
|
versionFetchPromise = fetchVersionWithRetry(rounds).finally(() => {
|
||||||
.then((version) => {
|
versionFetchPromise = null
|
||||||
cachedVersionResult = version
|
})
|
||||||
return version
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
versionFetchPromise = null
|
|
||||||
})
|
|
||||||
|
|
||||||
return versionFetchPromise
|
return versionFetchPromise
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
function resolveSaBase(): string {
|
||||||
|
try {
|
||||||
|
const last = localStorage.getItem('CONFIG_Success_URL')
|
||||||
|
if (last) {
|
||||||
|
const parsed = new URL(last)
|
||||||
|
const path = parsed.pathname.replace(/\/get_user\/?$/i, '').replace(/\/+$/, '')
|
||||||
|
return path && path !== '/' ? `${parsed.origin}${path}` : parsed.origin
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
return 'https://adm.montzar.ir'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** فقط /uploads/ نسبی؛ URL مطلق (نرخ و …) دست نخورده */
|
||||||
|
export function rewriteLegacyUploadUrl(raw: unknown): string {
|
||||||
|
const value = String(raw || '').trim()
|
||||||
|
if (!value) return ''
|
||||||
|
if (value.startsWith('/uploads/')) return `${resolveSaBase()}${value}`
|
||||||
|
return value
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/** سوپرادمین — مستر، بعد دو اسلیو */
|
||||||
|
export const SUPERADMIN_BASES = [
|
||||||
|
'https://adm.montzar.ir',
|
||||||
|
'https://adm.montech.ir',
|
||||||
|
'https://adm.montest.ir',
|
||||||
|
] as const
|
||||||
|
|
||||||
|
/** هر API: سه دامنه × سه دور */
|
||||||
|
export const SA_RETRY_ROUNDS = 3
|
||||||
|
|
||||||
|
function normalizeBase(url: string) {
|
||||||
|
return String(url || '').trim().replace(/\/$/, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSuperAdminBases(): string[] {
|
||||||
|
const fromEnv = normalizeBase(String(import.meta.env.VITE_SUPERADMIN_URL || ''))
|
||||||
|
const bases = [...SUPERADMIN_BASES]
|
||||||
|
if (fromEnv) {
|
||||||
|
return [fromEnv, ...bases.filter((base) => base !== fromEnv)]
|
||||||
|
}
|
||||||
|
return bases
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSuperAdminBase(): string {
|
||||||
|
return getSuperAdminBases()[0] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveTenantDomain(): string {
|
||||||
|
const override = String(import.meta.env.VITE_TENANT_DOMAIN || '').trim()
|
||||||
|
if (override) return override
|
||||||
|
|
||||||
|
const host = String(window.location.hostname || '').trim()
|
||||||
|
if (!host || host === 'localhost' || host === '127.0.0.1') {
|
||||||
|
return 'k.montzar.ir'
|
||||||
|
}
|
||||||
|
return host
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isSuperAdminUrl(url: string): boolean {
|
||||||
|
return getSuperAdminBases().some((base) => url.startsWith(base))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function allowSuperAdminFallback(): boolean {
|
||||||
|
return Boolean(import.meta.env.DEV)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchSuperAdminJson<T>(
|
||||||
|
buildUrl: (base: string) => string,
|
||||||
|
timeout = 5000,
|
||||||
|
): Promise<T> {
|
||||||
|
let lastError: unknown
|
||||||
|
const bases = getSuperAdminBases()
|
||||||
|
for (let round = 1; round <= SA_RETRY_ROUNDS; round++) {
|
||||||
|
for (const base of bases) {
|
||||||
|
const controller = new AbortController()
|
||||||
|
const timer = window.setTimeout(() => controller.abort(), timeout)
|
||||||
|
try {
|
||||||
|
const res = await fetch(buildUrl(base), {
|
||||||
|
method: 'GET',
|
||||||
|
cache: 'no-store',
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: { Accept: 'application/json' },
|
||||||
|
})
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP ${res.status}`)
|
||||||
|
}
|
||||||
|
const contentType = res.headers.get('content-type') || ''
|
||||||
|
if (!contentType.includes('application/json')) {
|
||||||
|
throw new Error('SuperAdmin response is not JSON')
|
||||||
|
}
|
||||||
|
return (await res.json()) as T
|
||||||
|
} catch (error) {
|
||||||
|
lastError = error
|
||||||
|
} finally {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw lastError instanceof Error ? lastError : new Error('SuperAdmin unreachable')
|
||||||
|
}
|
||||||
@@ -8,6 +8,10 @@ export function useAppNavigation() {
|
|||||||
const popVisible = ref(false)
|
const popVisible = ref(false)
|
||||||
const currentRoute = computed(() => route.name)
|
const currentRoute = computed(() => route.name)
|
||||||
const hideMenu = computed(() => !!route.meta.hideMenu)
|
const hideMenu = computed(() => !!route.meta.hideMenu)
|
||||||
|
/** فقط ناو پایین موبایل — سایدبار دسکتاپ را مخفی نمیکند */
|
||||||
|
const hideBottomNav = computed(
|
||||||
|
() => !!route.meta.hideBottomNav || !!route.meta.hideMenu,
|
||||||
|
)
|
||||||
|
|
||||||
function isNavActive(routeName: string) {
|
function isNavActive(routeName: string) {
|
||||||
return currentRoute.value === routeName
|
return currentRoute.value === routeName
|
||||||
@@ -34,6 +38,7 @@ export function useAppNavigation() {
|
|||||||
popVisible,
|
popVisible,
|
||||||
currentRoute,
|
currentRoute,
|
||||||
hideMenu,
|
hideMenu,
|
||||||
|
hideBottomNav,
|
||||||
isNavActive,
|
isNavActive,
|
||||||
navItemClass,
|
navItemClass,
|
||||||
navigateTo,
|
navigateTo,
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ function clearBodyScrollLock() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** leftover van-dialog overlay after logout/navigation — blocks all clicks */
|
||||||
|
export function clearVantOverlays() {
|
||||||
|
document.querySelectorAll('body > .van-overlay').forEach((el) => el.remove())
|
||||||
|
clearBodyScrollLock()
|
||||||
|
}
|
||||||
|
|
||||||
function resetAllScrollPositions() {
|
function resetAllScrollPositions() {
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
document.documentElement.scrollTop = 0
|
document.documentElement.scrollTop = 0
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ export const GUEST_PRIMARY_NAV: AppNavItem[] = [
|
|||||||
{ id: 'login', routeName: 'login', label: 'ورود', icon: 'vuesax-linear:login' },
|
{ id: 'login', routeName: 'login', label: 'ورود', icon: 'vuesax-linear:login' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const RECOVERY_SITES_NAV_ITEM: AppNavItem = {
|
||||||
|
id: 'recoverySites',
|
||||||
|
routeName: 'recoverySites',
|
||||||
|
label: 'سایتهای ریگیری',
|
||||||
|
icon: 'vuesax-linear:global',
|
||||||
|
}
|
||||||
|
|
||||||
/** منوی FAB موبایل + بخش فرعی سایدبار دسکتاپ — کاربر لاگینشده */
|
/** منوی FAB موبایل + بخش فرعی سایدبار دسکتاپ — کاربر لاگینشده */
|
||||||
export const AUTH_SECONDARY_NAV: AppNavItem[] = [
|
export const AUTH_SECONDARY_NAV: AppNavItem[] = [
|
||||||
{ id: 'notifyTrigger', routeName: 'notifyTrigger', label: 'هشدار قیمت', icon: 'vuesax-linear:bill' },
|
{ id: 'notifyTrigger', routeName: 'notifyTrigger', label: 'هشدار قیمت', icon: 'vuesax-linear:bill' },
|
||||||
@@ -34,6 +41,13 @@ export function getPrimaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
|||||||
return isAuthenticated ? AUTH_PRIMARY_NAV : GUEST_PRIMARY_NAV
|
return isAuthenticated ? AUTH_PRIMARY_NAV : GUEST_PRIMARY_NAV
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSecondaryNavItems(isAuthenticated: boolean): AppNavItem[] {
|
export function getSecondaryNavItems(
|
||||||
return isAuthenticated ? AUTH_SECONDARY_NAV : []
|
isAuthenticated: boolean,
|
||||||
|
options?: { includeRecoverySites?: boolean },
|
||||||
|
): AppNavItem[] {
|
||||||
|
if (!isAuthenticated) return []
|
||||||
|
if (options?.includeRecoverySites) {
|
||||||
|
return [...AUTH_SECONDARY_NAV, RECOVERY_SITES_NAV_ITEM]
|
||||||
|
}
|
||||||
|
return AUTH_SECONDARY_NAV
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@
|
|||||||
@click="navigateTo(item.routeName)"
|
@click="navigateTo(item.routeName)"
|
||||||
/>
|
/>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<div class="desktop-sidebar__credit">
|
||||||
|
<AppCreditLink variant="sidebar" />
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,15 +46,38 @@ import { computed } from 'vue'
|
|||||||
import logoFull from '@/assets/img/logo_full_.png'
|
import logoFull from '@/assets/img/logo_full_.png'
|
||||||
import { isToken } from '@/utils'
|
import { isToken } from '@/utils'
|
||||||
import { useCartStore } from '@/store/cartStore'
|
import { useCartStore } from '@/store/cartStore'
|
||||||
|
import { useTrackingSystemsFeature } from '@/composables/useTrackingSystemsFeature'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
import { getPrimaryNavItems, getSecondaryNavItems } from '../config/navigation'
|
||||||
import { useAppNavigation } from '../composables/useAppNavigation'
|
import { useAppNavigation } from '../composables/useAppNavigation'
|
||||||
|
import { featureSettingForRoute } from '@/utils/superAdminMenuGates'
|
||||||
import DesktopNavItem from './DesktopNavItem.vue'
|
import DesktopNavItem from './DesktopNavItem.vue'
|
||||||
|
import AppCreditLink from '@/components/AppCreditLink.vue'
|
||||||
|
|
||||||
const cartStore = useCartStore()
|
const cartStore = useCartStore()
|
||||||
const authenticated = computed(() => isToken())
|
const authenticated = computed(() => isToken())
|
||||||
const navLogo = logoFull
|
const navLogo = logoFull
|
||||||
const primaryItems = computed(() => getPrimaryNavItems(authenticated.value))
|
const { trackingSystemsEnabled } = useTrackingSystemsFeature()
|
||||||
const secondaryItems = computed(() => getSecondaryNavItems(authenticated.value))
|
const settingsStore = useSettingsStore()
|
||||||
|
const primaryItems = computed(() =>
|
||||||
|
getPrimaryNavItems(authenticated.value).filter((item) => {
|
||||||
|
const featureKey = featureSettingForRoute(item.routeName)
|
||||||
|
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
/** «لیست دریافتیها» فقط در موبایل نمایش داده میشود */
|
||||||
|
const DESKTOP_HIDDEN_NAV_IDS = ['list']
|
||||||
|
const secondaryItems = computed(() =>
|
||||||
|
getSecondaryNavItems(authenticated.value, {
|
||||||
|
includeRecoverySites: trackingSystemsEnabled.value,
|
||||||
|
}).filter((item) => {
|
||||||
|
if (DESKTOP_HIDDEN_NAV_IDS.includes(item.id)) return false
|
||||||
|
const featureKey = featureSettingForRoute(item.routeName)
|
||||||
|
if (featureKey) return settingsStore.isSettingTruthy(featureKey)
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
)
|
||||||
const cartCount = computed(() => cartStore.itemCount || 0)
|
const cartCount = computed(() => cartStore.itemCount || 0)
|
||||||
|
|
||||||
const { isNavActive, navigateTo } = useAppNavigation()
|
const { isNavActive, navigateTo } = useAppNavigation()
|
||||||
|
|||||||
@@ -85,6 +85,13 @@
|
|||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.desktop-sidebar__credit {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 12px 8px 4px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.desktop-sidebar__divider {
|
.desktop-sidebar__divider {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: rgba(0, 0, 0, 0.08);
|
background: rgba(0, 0, 0, 0.08);
|
||||||
|
|||||||
@@ -111,13 +111,17 @@ html.app-layout--desktop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dhome-topbar {
|
.dhome-topbar {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 30;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
margin-bottom: 28px;
|
margin: -4px 0 20px;
|
||||||
padding-bottom: 24px;
|
padding: 12px 0 20px;
|
||||||
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
|
||||||
|
background: #f6f7f9;
|
||||||
|
|
||||||
&__eyebrow {
|
&__eyebrow {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
@navigate="navigateTo"
|
@navigate="navigateTo"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div :class="['main-with-bottom-chrome', { 'main-with-bottom-chrome--no-nav': hideMenu }]">
|
<div :class="['main-with-bottom-chrome', { 'main-with-bottom-chrome--no-nav': hideBottomNav }]">
|
||||||
<router-view v-slot="{ Component, route: activeRoute }">
|
<router-view v-slot="{ Component, route: activeRoute }">
|
||||||
<transition :name="activeRoute.meta.transition || 'fade'">
|
<transition :name="activeRoute.meta.transition || 'fade'">
|
||||||
<component :is="Component" :key="activeRoute.fullPath" class="main-with-bottom-chrome-inner" />
|
<component :is="Component" :key="activeRoute.fullPath" class="main-with-bottom-chrome-inner" />
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<MobileBottomNav
|
<MobileBottomNav
|
||||||
v-if="!hideMenu"
|
v-if="!hideBottomNav"
|
||||||
:nav-item-class="navItemClass"
|
:nav-item-class="navItemClass"
|
||||||
@navigate="navigateTo"
|
@navigate="navigateTo"
|
||||||
@toggle-overflow="toggleOverflowMenu"
|
@toggle-overflow="toggleOverflowMenu"
|
||||||
@@ -37,7 +37,7 @@ const route = useRoute()
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
popVisible,
|
popVisible,
|
||||||
hideMenu,
|
hideBottomNav,
|
||||||
navItemClass,
|
navItemClass,
|
||||||
navigateTo,
|
navigateTo,
|
||||||
toggleOverflowMenu,
|
toggleOverflowMenu,
|
||||||
@@ -47,6 +47,7 @@ const {
|
|||||||
watch(
|
watch(
|
||||||
() => route.fullPath,
|
() => route.fullPath,
|
||||||
() => {
|
() => {
|
||||||
|
closeOverflowMenu()
|
||||||
resetMobileAppScroll()
|
resetMobileAppScroll()
|
||||||
},
|
},
|
||||||
{ flush: 'post' },
|
{ flush: 'post' },
|
||||||
|
|||||||
@@ -2,12 +2,15 @@
|
|||||||
<Transition>
|
<Transition>
|
||||||
<div
|
<div
|
||||||
v-if="show"
|
v-if="show"
|
||||||
class="top-0 bottom-0 bg-black wrap-fix z-5000 opacity-60"
|
class="top-0 bottom-0 bg-black wrap-fix z-5200 opacity-60"
|
||||||
@click="$emit('close')"
|
@click="$emit('close')"
|
||||||
/>
|
/>
|
||||||
</Transition>
|
</Transition>
|
||||||
<Transition name="slide-fade">
|
<Transition name="slide-fade">
|
||||||
<div v-if="show" class="wrap-fix bottom-11vh z-5000 flex justify-center items-end">
|
<div
|
||||||
|
v-if="show"
|
||||||
|
class="wrap-fix z-5200 flex justify-center items-end bottom-[calc(var(--app-bottom-chrome-height)+1.5rem)]"
|
||||||
|
>
|
||||||
<div class="relative flex flex-col items-center">
|
<div class="relative flex flex-col items-center">
|
||||||
<div
|
<div
|
||||||
class="flex items-center justify-center bg-white rounded-full w-[30px] h-[30px] mb-2"
|
class="flex items-center justify-center bg-white rounded-full w-[30px] h-[30px] mb-2"
|
||||||
@@ -34,18 +37,7 @@
|
|||||||
>
|
>
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex gap-2 items-center">
|
||||||
<BasicIcon icon="vuesax-linear:direct-inbox" size="16" class="absolute right-2" />
|
<BasicIcon icon="vuesax-linear:direct-inbox" size="16" class="absolute right-2" />
|
||||||
<div>دریافت طلای فیزیکی</div>
|
<div>تحویل فیزیکی</div>
|
||||||
</div>
|
|
||||||
</BasicButton>
|
|
||||||
<BasicButton
|
|
||||||
v-if="authenticated"
|
|
||||||
icon-size="16"
|
|
||||||
class="!font-bold w-15rem"
|
|
||||||
@click="go('notifyTrigger')"
|
|
||||||
>
|
|
||||||
<div class="flex gap-2 items-center">
|
|
||||||
<BasicIcon icon="vuesax-linear:bill" size="16" class="absolute right-2" />
|
|
||||||
<div>هشدار قیمت</div>
|
|
||||||
</div>
|
</div>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
<BasicButton
|
<BasicButton
|
||||||
@@ -71,7 +63,7 @@
|
|||||||
<!-- </div>-->
|
<!-- </div>-->
|
||||||
<!-- </BasicButton>-->
|
<!-- </BasicButton>-->
|
||||||
<BasicButton
|
<BasicButton
|
||||||
v-if="authenticated"
|
v-if="authenticated && giftCardEnabled"
|
||||||
icon-size="16"
|
icon-size="16"
|
||||||
class="!font-bold w-15rem"
|
class="!font-bold w-15rem"
|
||||||
@click="go('giftCard')"
|
@click="go('giftCard')"
|
||||||
@@ -87,6 +79,17 @@
|
|||||||
<div>درباره ما</div>
|
<div>درباره ما</div>
|
||||||
</div>
|
</div>
|
||||||
</BasicButton>
|
</BasicButton>
|
||||||
|
<BasicButton
|
||||||
|
v-if="authenticated && trackingSystemsEnabled"
|
||||||
|
icon-size="16"
|
||||||
|
class="!font-bold w-15rem"
|
||||||
|
@click="go('recoverySites')"
|
||||||
|
>
|
||||||
|
<div class="flex gap-2 items-center">
|
||||||
|
<BasicIcon icon="vuesax-linear:global" size="16" class="absolute right-2" />
|
||||||
|
<div>سایتهای ریگیری</div>
|
||||||
|
</div>
|
||||||
|
</BasicButton>
|
||||||
<BasicButton
|
<BasicButton
|
||||||
v-if="authenticated"
|
v-if="authenticated"
|
||||||
icon-size="16"
|
icon-size="16"
|
||||||
@@ -108,6 +111,8 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
|
import { useTrackingSystemsFeature } from '@/composables/useTrackingSystemsFeature'
|
||||||
|
import { useSettingsStore } from '@/store/settingsStore'
|
||||||
import { isToken } from '@/utils'
|
import { isToken } from '@/utils'
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@@ -120,6 +125,11 @@ const emit = defineEmits<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const authenticated = computed(() => isToken())
|
const authenticated = computed(() => isToken())
|
||||||
|
const { trackingSystemsEnabled } = useTrackingSystemsFeature()
|
||||||
|
const settingsStore = useSettingsStore()
|
||||||
|
const giftCardEnabled = computed(() =>
|
||||||
|
settingsStore.isSettingTruthy('has_page_gift_card'),
|
||||||
|
)
|
||||||
|
|
||||||
function go(routeName: string) {
|
function go(routeName: string) {
|
||||||
emit('navigate', routeName)
|
emit('navigate', routeName)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
.bottom-appbar {
|
.bottom-appbar {
|
||||||
z-index: var(--app-z-nav, 5000);
|
z-index: var(--app-z-nav, 5000);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: var(--app-credit-footer-offset, 28px);
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
height: calc(var(--app-nav-height, 80px) + var(--app-safe-bottom, env(safe-area-inset-bottom, 0px)));
|
height: var(--app-nav-height, 80px);
|
||||||
padding-bottom: var(--app-safe-bottom, env(safe-area-inset-bottom, 0px));
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
|
|||||||
@@ -39,6 +39,11 @@
|
|||||||
.bottom-appbar {
|
.bottom-appbar {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--app-credit-bar-inner: 0px;
|
||||||
|
--app-credit-footer-offset: 0px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html.app-layout--desktop {
|
html.app-layout--desktop {
|
||||||
|
|||||||
@@ -53,6 +53,9 @@
|
|||||||
&__title {
|
&__title {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__trailing {
|
&__trailing {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import './assets/css/main.less'
|
|||||||
import 'virtual:uno.css'
|
import 'virtual:uno.css'
|
||||||
|
|
||||||
import { initPwaInstallCapture } from '@/modules/pwa/manifest'
|
import { initPwaInstallCapture } from '@/modules/pwa/manifest'
|
||||||
|
import { preloadLottieAssets } from '@/utils/lottieAssets'
|
||||||
import { bootstrapApp } from '@/app/bootstrap'
|
import { bootstrapApp } from '@/app/bootstrap'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -15,4 +16,5 @@ export {
|
|||||||
import '@unocss/reset/tailwind-compat.css'
|
import '@unocss/reset/tailwind-compat.css'
|
||||||
|
|
||||||
initPwaInstallCapture()
|
initPwaInstallCapture()
|
||||||
|
void preloadLottieAssets()
|
||||||
bootstrapApp()
|
bootstrapApp()
|
||||||
|
|||||||