Skip to content

Commit d92af3e

Browse files
committed
refactor: Rename PrimerCheckoutColors to CheckoutColors
Simplifies color system naming by removing redundant Primer prefix. Updates all references across CheckoutComponents module.
1 parent a0b503d commit d92af3e

File tree

20 files changed

+155
-207
lines changed

20 files changed

+155
-207
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,11 @@ launch.json
102102

103103
# Style-dictionary file generation, we only want to commit package.json and package-lock.json
104104
**/node_modules/
105+
106+
# Serena files
107+
.serena/
108+
109+
# Claude files
110+
.claude/
111+
CLAUDE.md
112+
.mcp.json

Debug App/Primer.io Debug App SPM.xcodeproj/project.pbxproj

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
044F805B2C6B4F9800E9F878 /* MerchantHeadlessCheckoutStripeAchViewController+StripeAch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044F80562C6B4F9800E9F878 /* MerchantHeadlessCheckoutStripeAchViewController+StripeAch.swift */; };
1717
044F805C2C6B4F9800E9F878 /* MerchantHeadlessStripeAchFieldsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044F80572C6B4F9800E9F878 /* MerchantHeadlessStripeAchFieldsView.swift */; };
1818
044F805D2C6B4F9800E9F878 /* MerchantHeadlessStripeAchFieldsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 044F80582C6B4F9800E9F878 /* MerchantHeadlessStripeAchFieldsViewModel.swift */; };
19-
0498E1CF2BFB509F00EEF9EE /* PrimerNolPaySDK in Frameworks */ = {isa = PBXBuildFile; productRef = 0498E1CE2BFB509F00EEF9EE /* PrimerNolPaySDK */; };
2019
049A055C2B4BF044002CEEBA /* MerchantHeadlessVaultManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A055B2B4BF044002CEEBA /* MerchantHeadlessVaultManagerViewController.swift */; };
2120
8723ADDD2B8E0F5100A5FE23 /* MerchantHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADDC2B8E0F5100A5FE23 /* MerchantHelpers.swift */; };
2221
8723ADE42B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADDF2B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift */; };
2322
8723ADE52B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE02B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift */; };
2423
8723ADE62B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE12B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift */; };
2524
8723ADE72B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE22B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift */; };
2625
8723ADE82B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE32B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift */; };
27-
87BD7B802C2350B900BE70E8 /* PrimerStripeSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 87BD7B7F2C2350B900BE70E8 /* PrimerStripeSDK */; };
2826
A1DD4D4B2E3A856C00877A5D /* CheckoutComponentsMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1DD4D4A2E3A856C00877A5D /* CheckoutComponentsMenuViewController.swift */; };
2927
A1DD4D5A2E3A859F00877A5D /* ShowcaseDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1DD4D4C2E3A859F00877A5D /* ShowcaseDemo.swift */; };
3028
A1DD4D5B2E3A859F00877A5D /* SingleFieldCustomisationDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1DD4D4D2E3A859F00877A5D /* SingleFieldCustomisationDemo.swift */; };
@@ -73,7 +71,6 @@
7371
F00C66152ACC67FA00187028 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FC701AFD94F96F0F1D108D1A /* LaunchScreen.xib */; };
7472
F00C66162ACC67FA00187028 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE259612A00F85709107B872 /* Main.storyboard */; };
7573
F04510E32ACD98E100A0A48C /* PrimerSDK in Frameworks */ = {isa = PBXBuildFile; productRef = F04510E22ACD98E100A0A48C /* PrimerSDK */; };
76-
F04510E62ACD990A00A0A48C /* PrimerKlarnaSDK in Frameworks */ = {isa = PBXBuildFile; productRef = F04510E52ACD990A00A0A48C /* PrimerKlarnaSDK */; };
7774
F04DFC6B2DAE4F130006AEDC /* AppLinkConfigProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04DFC6A2DAE4F130006AEDC /* AppLinkConfigProvider.swift */; };
7875
F04DFC6D2DAE4F310006AEDC /* AppLinkConfigProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04DFC6C2DAE4F310006AEDC /* AppLinkConfigProvider.swift */; };
7976
F04DFC6F2DAE4F4D0006AEDC /* TestSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04DFC6E2DAE4F4D0006AEDC /* TestSettings.swift */; };
@@ -208,9 +205,6 @@
208205
buildActionMask = 2147483647;
209206
files = (
210207
F04510E32ACD98E100A0A48C /* PrimerSDK in Frameworks */,
211-
F04510E62ACD990A00A0A48C /* PrimerKlarnaSDK in Frameworks */,
212-
0498E1CF2BFB509F00EEF9EE /* PrimerNolPaySDK in Frameworks */,
213-
87BD7B802C2350B900BE70E8 /* PrimerStripeSDK in Frameworks */,
214208
);
215209
runOnlyForDeploymentPostprocessing = 0;
216210
};
@@ -471,9 +465,6 @@
471465
name = "Debug App SPM";
472466
packageProductDependencies = (
473467
F04510E22ACD98E100A0A48C /* PrimerSDK */,
474-
F04510E52ACD990A00A0A48C /* PrimerKlarnaSDK */,
475-
0498E1CE2BFB509F00EEF9EE /* PrimerNolPaySDK */,
476-
87BD7B7F2C2350B900BE70E8 /* PrimerStripeSDK */,
477468
);
478469
productName = "Debug App";
479470
productReference = F00C661E2ACC67FA00187028 /* Debug App SPM.app */;
@@ -512,9 +503,6 @@
512503
);
513504
mainGroup = 1C9799A622D0CCDBBF94925B;
514505
packageReferences = (
515-
F04510E42ACD990A00A0A48C /* XCRemoteSwiftPackageReference "primer-klarna-sdk-ios" */,
516-
0498E1CD2BFB509F00EEF9EE /* XCRemoteSwiftPackageReference "primer-nol-pay-sdk-ios" */,
517-
87BD7B7E2C2350B900BE70E8 /* XCRemoteSwiftPackageReference "primer-stripe-sdk-ios" */,
518506
);
519507
productRefGroup = DF30711EB149C64C364BB79A /* Products */;
520508
projectDirPath = "";
@@ -864,53 +852,11 @@
864852
};
865853
/* End XCConfigurationList section */
866854

867-
/* Begin XCRemoteSwiftPackageReference section */
868-
0498E1CD2BFB509F00EEF9EE /* XCRemoteSwiftPackageReference "primer-nol-pay-sdk-ios" */ = {
869-
isa = XCRemoteSwiftPackageReference;
870-
repositoryURL = "https://github.com/primer-io/primer-nol-pay-sdk-ios";
871-
requirement = {
872-
kind = upToNextMajorVersion;
873-
minimumVersion = 1.0.2;
874-
};
875-
};
876-
87BD7B7E2C2350B900BE70E8 /* XCRemoteSwiftPackageReference "primer-stripe-sdk-ios" */ = {
877-
isa = XCRemoteSwiftPackageReference;
878-
repositoryURL = "https://github.com/primer-io/primer-stripe-sdk-ios";
879-
requirement = {
880-
kind = upToNextMajorVersion;
881-
minimumVersion = 1.0.0;
882-
};
883-
};
884-
F04510E42ACD990A00A0A48C /* XCRemoteSwiftPackageReference "primer-klarna-sdk-ios" */ = {
885-
isa = XCRemoteSwiftPackageReference;
886-
repositoryURL = "https://github.com/primer-io/primer-klarna-sdk-ios";
887-
requirement = {
888-
kind = upToNextMajorVersion;
889-
minimumVersion = 1.0.0;
890-
};
891-
};
892-
/* End XCRemoteSwiftPackageReference section */
893-
894855
/* Begin XCSwiftPackageProductDependency section */
895-
0498E1CE2BFB509F00EEF9EE /* PrimerNolPaySDK */ = {
896-
isa = XCSwiftPackageProductDependency;
897-
package = 0498E1CD2BFB509F00EEF9EE /* XCRemoteSwiftPackageReference "primer-nol-pay-sdk-ios" */;
898-
productName = PrimerNolPaySDK;
899-
};
900-
87BD7B7F2C2350B900BE70E8 /* PrimerStripeSDK */ = {
901-
isa = XCSwiftPackageProductDependency;
902-
package = 87BD7B7E2C2350B900BE70E8 /* XCRemoteSwiftPackageReference "primer-stripe-sdk-ios" */;
903-
productName = PrimerStripeSDK;
904-
};
905856
F04510E22ACD98E100A0A48C /* PrimerSDK */ = {
906857
isa = XCSwiftPackageProductDependency;
907858
productName = PrimerSDK;
908859
};
909-
F04510E52ACD990A00A0A48C /* PrimerKlarnaSDK */ = {
910-
isa = XCSwiftPackageProductDependency;
911-
package = F04510E42ACD990A00A0A48C /* XCRemoteSwiftPackageReference "primer-klarna-sdk-ios" */;
912-
productName = PrimerKlarnaSDK;
913-
};
914860
/* End XCSwiftPackageProductDependency section */
915861
};
916862
rootObject = 25AB41367F759CCDA1881AD2 /* Project object */;
Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//
22
// CardNetworkBadge.swift
3-
// PrimerSDK - CheckoutComponents
4-
//
5-
// Created by Boris on 16.7.25.
63
//
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
5+
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
76

87
import SwiftUI
98

@@ -23,7 +22,6 @@ import SwiftUI
2322
/// ```
2423
@available(iOS 15.0, *)
2524
struct CardNetworkBadge: View, LogReporter {
26-
2725
// MARK: - Properties
2826

2927
/// The card network to display in the badge
@@ -46,66 +44,65 @@ struct CardNetworkBadge: View, LogReporter {
4644
} else {
4745
Text(network.displayName.prefix(2).uppercased())
4846
.font(PrimerFont.smallBadge(tokens: tokens))
49-
.foregroundColor(PrimerCheckoutColors.primary(tokens: tokens))
47+
.foregroundColor(CheckoutColors.primary(tokens: tokens))
5048
.frame(width: PrimerSize.large(tokens: tokens), height: PrimerSize.small(tokens: tokens))
5149
.overlay(
5250
RoundedRectangle(cornerRadius: PrimerRadius.xsmall(tokens: tokens))
53-
.stroke(PrimerCheckoutColors.borderDefault(tokens: tokens), lineWidth: PrimerBorderWidth.thin)
51+
.stroke(CheckoutColors.borderDefault(tokens: tokens), lineWidth: PrimerBorderWidth.thin)
5452
)
5553
}
56-
5754
}
5855
}
5956

6057
// MARK: - Previews
6158

6259
#if DEBUG
63-
@available(iOS 15.0, *)
64-
struct CardNetworkBadge_Previews: PreviewProvider {
65-
static var previews: some View {
66-
Group {
67-
// Light mode
68-
VStack(spacing: 16) {
69-
HStack(spacing: 8) {
70-
CardNetworkBadge(network: .visa)
71-
CardNetworkBadge(network: .masterCard)
72-
CardNetworkBadge(network: .amex)
73-
CardNetworkBadge(network: .discover)
74-
}
60+
@available(iOS 15.0, *)
61+
struct CardNetworkBadge_Previews: PreviewProvider {
62+
static var previews: some View {
63+
Group {
64+
// Light mode
65+
VStack(spacing: 16) {
66+
HStack(spacing: 8) {
67+
CardNetworkBadge(network: .visa)
68+
CardNetworkBadge(network: .masterCard)
69+
CardNetworkBadge(network: .amex)
70+
CardNetworkBadge(network: .discover)
71+
}
7572

76-
HStack(spacing: 8) {
77-
CardNetworkBadge(network: .cartesBancaires)
78-
CardNetworkBadge(network: .diners)
79-
CardNetworkBadge(network: .jcb)
80-
CardNetworkBadge(network: .unknown)
73+
HStack(spacing: 8) {
74+
CardNetworkBadge(network: .cartesBancaires)
75+
CardNetworkBadge(network: .diners)
76+
CardNetworkBadge(network: .jcb)
77+
CardNetworkBadge(network: .unknown)
78+
}
8179
}
82-
}
83-
.padding()
84-
.environment(\.designTokens, MockDesignTokens.light)
85-
.previewDisplayName("Light Mode")
80+
.padding()
81+
.environment(\.designTokens, MockDesignTokens.light)
82+
.previewDisplayName("Light Mode")
8683

87-
// Dark mode
88-
VStack(spacing: 16) {
89-
HStack(spacing: 8) {
90-
CardNetworkBadge(network: .visa)
91-
CardNetworkBadge(network: .masterCard)
92-
CardNetworkBadge(network: .amex)
93-
CardNetworkBadge(network: .discover)
94-
}
84+
// Dark mode
85+
VStack(spacing: 16) {
86+
HStack(spacing: 8) {
87+
CardNetworkBadge(network: .visa)
88+
CardNetworkBadge(network: .masterCard)
89+
CardNetworkBadge(network: .amex)
90+
CardNetworkBadge(network: .discover)
91+
}
9592

96-
HStack(spacing: 8) {
97-
CardNetworkBadge(network: .cartesBancaires)
98-
CardNetworkBadge(network: .diners)
99-
CardNetworkBadge(network: .jcb)
100-
CardNetworkBadge(network: .unknown)
93+
HStack(spacing: 8) {
94+
CardNetworkBadge(network: .cartesBancaires)
95+
CardNetworkBadge(network: .diners)
96+
CardNetworkBadge(network: .jcb)
97+
CardNetworkBadge(network: .unknown)
98+
}
10199
}
100+
.padding()
101+
.background(Color.black)
102+
.environment(\.designTokens, MockDesignTokens.dark)
103+
.preferredColorScheme(.dark)
104+
.previewDisplayName("Dark Mode")
102105
}
103-
.padding()
104-
.background(Color.black)
105-
.environment(\.designTokens, MockDesignTokens.dark)
106-
.preferredColorScheme(.dark)
107-
.previewDisplayName("Dark Mode")
108106
}
109107
}
110-
}
111108
#endif

Sources/PrimerSDK/Classes/CheckoutComponents/Internal/Presentation/Components/CardNetworkSelector.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ struct CardNetworkSelector: View {
3838

3939
Text(selectedNetwork.displayName)
4040
.font(PrimerFont.body(tokens: tokens))
41-
.foregroundColor(PrimerCheckoutColors.primary(tokens: tokens))
41+
.foregroundColor(CheckoutColors.primary(tokens: tokens))
4242

4343
Spacer()
4444

4545
Image(systemName: isExpanded ? "chevron.up" : "chevron.down")
46-
.foregroundColor(PrimerCheckoutColors.secondary(tokens: tokens))
46+
.foregroundColor(CheckoutColors.secondary(tokens: tokens))
4747
.font(PrimerFont.caption(tokens: tokens))
4848
}
4949
.padding(.horizontal, PrimerSpacing.medium(tokens: tokens))
5050
.padding(.vertical, PrimerSpacing.small(tokens: tokens))
51-
.background(PrimerCheckoutColors.gray100(tokens: tokens))
51+
.background(CheckoutColors.gray100(tokens: tokens))
5252
.cornerRadius(PrimerRadius.small(tokens: tokens))
5353
})
5454

@@ -69,13 +69,13 @@ struct CardNetworkSelector: View {
6969

7070
Text(network.displayName)
7171
.font(PrimerFont.body(tokens: tokens))
72-
.foregroundColor(PrimerCheckoutColors.primary(tokens: tokens))
72+
.foregroundColor(CheckoutColors.primary(tokens: tokens))
7373

7474
Spacer()
7575
}
7676
.padding(.horizontal, PrimerSpacing.medium(tokens: tokens))
7777
.padding(.vertical, PrimerSpacing.small(tokens: tokens))
78-
.background(PrimerCheckoutColors.clear(tokens: tokens))
78+
.background(CheckoutColors.clear(tokens: tokens))
7979
})
8080
.buttonStyle(PlainButtonStyle())
8181

@@ -86,10 +86,10 @@ struct CardNetworkSelector: View {
8686
}
8787
}
8888
}
89-
.background(PrimerCheckoutColors.gray100(tokens: tokens))
89+
.background(CheckoutColors.gray100(tokens: tokens))
9090
.cornerRadius(PrimerRadius.small(tokens: tokens))
9191
.shadow(
92-
color: PrimerCheckoutColors.borderDefault(tokens: tokens),
92+
color: CheckoutColors.borderDefault(tokens: tokens),
9393
radius: PrimerRadius.small(tokens: tokens),
9494
x: 0,
9595
y: PrimerSpacing.xxsmall(tokens: tokens)

Sources/PrimerSDK/Classes/CheckoutComponents/Internal/Presentation/Components/Infrastructure/Containers/PrimerInputFieldContainer+PreviewHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct PreviewContainerWithRightComponent: View {
8080
.resizable()
8181
.aspectRatio(contentMode: .fit)
8282
.frame(width: iconSize, height: iconSize)
83-
.foregroundColor(PrimerCheckoutColors.textSecondary(tokens: tokens))
83+
.foregroundColor(CheckoutColors.textSecondary(tokens: tokens))
8484
}
8585
)
8686
}

Sources/PrimerSDK/Classes/CheckoutComponents/Internal/Presentation/Components/Infrastructure/Containers/PrimerInputFieldContainer+Rendering.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension PrimerInputFieldContainer {
4646

4747
func makeTextFieldContainerBackgroundBackground() -> some View {
4848
RoundedRectangle(cornerRadius: PrimerRadius.small(tokens: tokens))
49-
.fill(styling?.backgroundColor ?? PrimerCheckoutColors.background(tokens: tokens))
49+
.fill(styling?.backgroundColor ?? CheckoutColors.background(tokens: tokens))
5050
}
5151

5252
func makeTextFieldContainerWarning() -> some View {
@@ -55,7 +55,7 @@ extension PrimerInputFieldContainer {
5555
.resizable()
5656
.aspectRatio(contentMode: .fit)
5757
.frame(width: iconSize, height: iconSize)
58-
.foregroundColor(PrimerCheckoutColors.iconNegative(tokens: tokens))
58+
.foregroundColor(CheckoutColors.iconNegative(tokens: tokens))
5959
.offset(x: hasError ? 0 : -10)
6060
.opacity(hasError ? 1.0 : 0.0)
6161
.animation(.spring(response: 0.3, dampingFraction: 0.7), value: hasError)

Sources/PrimerSDK/Classes/CheckoutComponents/Internal/Presentation/Components/Infrastructure/Containers/PrimerInputFieldContainer+Styling.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ extension PrimerInputFieldContainer {
1818
}
1919

2020
var labelForegroundColor: Color {
21-
styling?.labelColor ?? PrimerCheckoutColors.textPrimary(tokens: tokens)
21+
styling?.labelColor ?? CheckoutColors.textPrimary(tokens: tokens)
2222
}
2323

2424
var errorMessageForegroundColor: Color {
25-
PrimerCheckoutColors.textNegative(tokens: tokens)
25+
CheckoutColors.textNegative(tokens: tokens)
2626
}
2727

2828
var errorBorderColor: Color {
29-
styling?.errorBorderColor ?? PrimerCheckoutColors.borderError(tokens: tokens)
29+
styling?.errorBorderColor ?? CheckoutColors.borderError(tokens: tokens)
3030
}
3131

3232
var focusedBorderColor: Color {
33-
styling?.focusedBorderColor ?? PrimerCheckoutColors.borderFocus(tokens: tokens)
33+
styling?.focusedBorderColor ?? CheckoutColors.borderFocus(tokens: tokens)
3434
}
3535

3636
var defaultBorderColor: Color {
37-
styling?.borderColor ?? PrimerCheckoutColors.borderDefault(tokens: tokens)
37+
styling?.borderColor ?? CheckoutColors.borderDefault(tokens: tokens)
3838
}
3939
}
4040

0 commit comments

Comments
 (0)