看个具体的例子: InjectionToken 构造函数,需要传一个类型参数进去。 这个 ActionReducerMap 的定义很讲究: export declare type ActionReducerMap<T, V extends Action = Action> = { [p in keyof T]: ActionReducer<T[p], V>; }; 使用这个类型时,需要传入两个类型参数 T 和
标题:@ngrx/router-store 的作用 官网 用于将 Angular Router 与 Store 连接的绑定。 在每个路由器导航周期中,会分派多个动作,让您可以监听路由器状态的变化。 然后,您可以从路由器的状态中选择数据,为您的应用程序提供附加信息。 安装: npm install @ngrx/router-store --save 之后,
如果客户已经拥有 CDN 缓存,可以不启用 cache:true, cacheSize:xxx 。 这种内存缓存功能仅适用于没有生产就绪 CDN 的简单店面。也就是说,如果客户没有任何外部缓存服务(akamai / cloudflare / 其他),他们可以尝试,至少暂时,使用 SSR 服务内存缓存和 cache: true (最好也使用 cacheSi
在 SAP Spartacus package.json 里有一个依赖叫做 release-it: 这个工具的链接:https://github.com/release-it/release-it 这是一个用于自动化版本控制和包发布相关任务的通用 CLI 工具。 使用 release-it 进行版本管理,并通过其多功能配置、强大的插件系统和挂钩来执行任何
如果直接访问如下 url: http://localhost:4200/powertools-spa/en/USD/jerryproduct/3881018/Angle Grinder RT-AG 115 页面打开后,没有看到和 product 相关的执行逻辑: 这个 cxRoute: 'product' 是哪里维护的? 看这个高亮区域是从哪里赋值的? 在 routing.module.js 里,一个初始化
使用如下代码: export class AppModule { constructor(private router: Router,protected injector: Injector){ this.router.events.subscribe((data) => { console.log('Jerry route event: ', data); }); const routeConfig: Router = this.in
我使用基于版本 3.4.5(某客户正在使用)的 Schematics 创建了一个店面,并在 SSR 模式下运行它。 我在浏览器中访问 http://localhost:4000/。 通过 Chrome 开发工具我知道主页的源代码是由 SSR 服务器成功生成了。 然而,即使在 SSR 模式下,我发现 /cms/pages OCC API 仍然是从客户端触
callFake 的接口定义可以在 jasmine.js 里找到: SpyStrategy.callFake, 返回 Spy 对象。 spy1 即 originalEngine,二者指向同一个对象实例: 只要 spy1 即 originalEngine 这个函数被调用,则返回 callFake 指定的 mock 版本的实现:return originalEngineInstance,后者也是个 mock 对象
Spartacus 每个 UI 划分成不同的区域 section,每个区域由若干个 slots 组成。每个 slot 可以包含一个或多个 CMS Component. 我曾经写过一篇 文章 详细介绍过。 以 homepage为例,其实现的 HTML 位置:projects\storefrontlib\src\layout\main\storefront.component.html 看这个 header
Commerce Cloud portal: CCV2 部署包含构建和部署两个子步骤。 首先登录 cloud portal,创建一个新 build: 点击 create 按钮: 输入构建的名称和托管要构建的代码库的 git 分支。名称只是一个标签,但是,我们按照惯例使用名称是为了更容易了解构建包含的内容。约定如下: spartacus-[hyb
Please note that concurrency: 50 (in SsrOptimizationOptions) means that OptimizedSsrEngine will perform at most 50 parallel rendering tasks. With the option reuseCurrentRendering enabled, it means: At most 50 different URLs can be rendered at once (regar
产品明细页面 Product Detail Page,简称 PDP. 首先在页面上找到 Component selector:cx-tab-paragraph-container: 对应的 Angular Component 名称:TabParagraphContainerComponent 四个 button 之后,在 active div 里,是 cx-product-details-tab: 其 Component:ProductDetailsTa
此功能是在 TUA Spartacus 库的 1.0 版中引入的。 购物车在 TUA Spartacus 与核心 Commerce Spartacus 中的工作方式不同,需要支持产品供应以及复杂的定价结构,以支持多种类型的收费,包括一次性收费、经常性收费和基于使用的收费。 在各种费用中,对于购物车,客户需要了解结帐时的立即付
此功能是在 TUA Spartacus 库的 1.0 版中引入的。 购物车在 TUA Spartacus 与核心 Commerce Spartacus 中的工作方式不同,需要支持产品供应以及复杂的定价结构,以支持多种类型的收费,包括一次性收费、经常性收费和基于使用的收费。 在各种费用中,对于购物车,客户需要了解结帐时的
在 Storefront AppModule 构造函数里注入 ActiveCartService: private cartService: ActiveCartService, 调用其 API: const loading$ = this.cartService.getLoading(); loading$.subscribe((data) => console.log('Jerry cart loading? ', data)); 打印出的日志: a
在 Storefront AppModule 构造函数里注入 ActiveCartService: private cartService: ActiveCartService, 调用其 API: const loading$ = this.cartService.getLoading(); loading$.subscribe((data) => console.log('Jerry cart loading? ', data)); 打印出的日志:
来自 nguniversal 的 express engine 渲染完了后,渲染完毕的 HTML 源代码保存在 150 行代码 html 里,callback 就是 Spartacus 团队开发的 ssr optimization engine 的实现: 回调执行时,maxRenderTimeout 不为空,说明 maxRenderTime 驱动的 setTimeout 尚未执行,这说明 maxRenderTime
前文:SAP Spartacus 服务器端渲染单步调试步骤之一:应用程序准备工作 入口: 进入 platform-server.js: 入口: 最终在服务器端执行 bootstrap,输入 Component 为 AppComponent: 这些调用栈和在客户端执行是一样的: 一旦进入这个调用,说明服务器端应用程序的渲染已经结束了: html 变量
首先在一个标准的 Storefront 上,找到该 Component 的 selector 找到其 Component 名称:LoginComponent 然后找到该 Component 的路径,位于 feature-libs 下面的 user 模块内: feature-libs\user\account\components\login\login.component.ts 在该模块内,找到了其与 CMS Component Lo
在 auth.interceptor.ts 里判断,token 是否过期: isExpiredToken: 通过服务器端返回的错误类型判断。 如果确实过期了,首先调用 handleExpiredToken, 返回的 Observable 对象,使用该 token,重新发送之前因为 token 过期而失效的请求:createNewRequestWithNewToken: stream 是一个 Behav
以 Spartacus-b2c-configuration.module.ts 文件为例: 这些默认的配置文件,都是从另一个库,即 @Spartacus/Storefront 里导入的,后者的入口是 public_api 文件: 在这个文件里加上一行打印语句,可以看到所有默认的配置: 这些默认配置硬编码在 layout-config.ts 内: 如果注释掉一部
同 SAP Fiori 一样,SAP Spartacus 里也有大量的自定义 icon 设计,比如下图的 iconTypes.RESET: 需要调用 iconLoader 获取 RESET icon 对应的 HTML 源代码: 动态创建新的 link 标签,并加载对应的 css: css 地址:https://use.fontawesome.com/releases/v5.8.1/css/all.css SAP Spar
这是一个客户采取 SAP Spartacus 实施的 Storefront - 电商店铺,已经上线了: https://lego.yellowblocks.me/en-ae/ 该网站开启了 SSR 即服务器端渲染模式,便于网站的内容被网络爬虫索引: 该页面源代码内的 title 标签内包含的内容,会出现在搜索引擎结果列表的网站标题区域内: descri
In SAP Spartacus document there is a page for "How to Debug a Server–Side Rendered Storefront" using Visual Studio Code. https://sap.github.io/spartacus-docs/3.x/how-to-debug-server-side-rendered-storefront/ This document just introduces another
问题:Where to configure session timeout in Spartacus 答案 我假设您使用 Hybris OAuth 服务器的默认身份验证流程(密码流程)。 在这种情况下,会话长度是通过后台的 OAuth 客户端设置来控制的。 但是,要知道会话何时到期,您可以检查令牌有效负载 (AuthStorageService.getToken)。属性